19 #include "hiterator.h"
20 #include "hcategory.h"
21 #include "hlinearcategory.h"
22 #include "hlocation.h"
90 const Option_t par[]):
127 fbgoodSeg0 = (strstr(s.Data(),
"GOOGSEG0") != NULL);
128 fbgoodSeg1 = (strstr(s.Data(),
"GOODSEG1") != NULL);
129 fbgoodMeta = (strstr(s.Data(),
"GOODMETA") != NULL);
130 fbgoodRK = (strstr(s.Data(),
"GOODRK") != NULL);
133 fbIsDebug = (strstr(s.Data(),
"DEBUG") != NULL);
134 fbdoRichAlign= (strstr(s.Data(),
"NORICHALIGN")!= NULL)? kFALSE : kTRUE;
136 fbdoMETAQANorm = (strstr(s.Data(),
"NOMETAQANORM")!= NULL)? kFALSE : kTRUE;
137 fbdoMomentumCorr = (strstr(s.Data(),
"NOMOMENTUMCORR")!= NULL)? kFALSE : kTRUE;
140 fbnoFake = (strstr(s.Data(),
"NOFAKE") != NULL);
141 if(strstr(s.Data(),
"ACCEPTFAKE")!= NULL)
fbnoFake=kFALSE;
250 Error (
"init()",
"gHades->getBeamTimeID() == Particle::kUnknownBeam! Not set properly, use Particle::eBeamTime definition (hparticledef.h), RICH correction will depend on it.");
258 Info (
"init()",
"gHades->getBeamTimeID() == %i !, use Particle::eBeamTime definition (hparticledef.h) to set RICH correction properly.",beamID);
265 Error (
"init()",
"Retrieve ZERO pointer for MetaMatch iter!");
271 Error (
"init()",
"Retrieve ZERO pointer for HParticleCandFillerPar!");
277 Error (
"init()",
"Retrieve ZERO pointer for HRich700DigiPar!");
283 Error (
"init()",
"Retrieve ZERO pointer for HTofWalkPar!");
290 Error (
"init()",
"Retrieve ZERO pointer for HMdcSizesCells!");
295 Error (
"init()",
"Retrieve ZERO pointer for fMetaMatchIter!");
361 Float_t chi2Clust = vertexClust.
getChi2();
364 Double_t qabest = 100000;
368 for(Int_t i = 0; i < nrich; i ++){
372 Float_t richCorr = 0.;
388 Float_t thetaCor =
theta;
389 Float_t phiCor =
phi;
394 Double_t thcor =
theta;
395 Double_t phcor =
phi;
397 thetaCor = (Float_t)thcor;
398 phiCor = (Float_t)phcor;
407 if(qa >= 0 && qa < qabest) {
499 else {Error(
"fillCandNoMeta",
"Unknown momentum option");}
582 Float_t tofqua[3] = {-1,-1,-1};
583 Float_t minTof = 1e37;
584 Int_t minIndMeta =
kNoUse;
586 if(tofClst||tofHit1||tofHit2) {
589 for(Int_t i = 0; i < 3; i ++) {
591 if (tofqua[i] >= 0 && tofqua[i] < minTof){ minTof = tofqua[i]; minIndMeta = i;}
625 Float_t rkqua [3] = {-1,-1,-1};
639 if(tofClst && rkhit[kTofClst]) { rkqua[
kTofClst] = rkhit[
kTofClst]->getQualityTof();}
640 if(tofHit1 && rkhit[kTofHit1]) { rkqua[
kTofHit1] = rkhit[
kTofHit1]->getQualityTof();}
641 if(tofHit2 && rkhit[kTofHit2]) { rkqua[
kTofHit2] = rkhit[
kTofHit2]->getQualityTof();}
643 if(tofClst && rkhit[kTofClst]) { rkqua[
kTofClst] = rkhit[
kTofClst]->getMetaRadius();}
644 if(tofHit1 && rkhit[kTofHit1]) { rkqua[
kTofHit1] = rkhit[
kTofHit1]->getMetaRadius();}
645 if(tofHit2 && rkhit[kTofHit2]) { rkqua[
kTofHit2] = rkhit[
kTofHit2]->getMetaRadius();}
646 }
else { Error(
"fillCandTof",
"Unknown sort option");}
649 for(Int_t i = 0; i < 3; i ++) {
650 if (rkqua[i] > 1e37 ) rkqua[i] = 1e36;
651 if (rkqua[i] >= 0 && rkqua[i] < min){ min = rkqua[i]; minInd = i;}
662 Error(
"fillCand()",
"(system == 1) No valid rk object!");
671 HKalTrack* rkhit [3] = { 0, 0, 0};
672 Float_t rkqua [3] = {-1,-1,-1};
686 if(tofClst && rkhit[kTofClst]) { rkqua[
kTofClst] = rkhit[
kTofClst]->getQualityTof();}
687 if(tofHit1 && rkhit[kTofHit1]) { rkqua[
kTofHit1] = rkhit[
kTofHit1]->getQualityTof();}
688 if(tofHit2 && rkhit[kTofHit2]) { rkqua[
kTofHit2] = rkhit[
kTofHit2]->getQualityTof();}
690 if(tofClst && rkhit[kTofClst]) { rkqua[
kTofClst] = rkhit[
kTofClst]->getMetaRadius();}
691 if(tofHit1 && rkhit[kTofHit1]) { rkqua[
kTofHit1] = rkhit[
kTofHit1]->getMetaRadius();}
692 if(tofHit2 && rkhit[kTofHit2]) { rkqua[
kTofHit2] = rkhit[
kTofHit2]->getMetaRadius();}
693 }
else { Error(
"fillCandTof",
"Unknown sort option");}
695 for(Int_t i = 0; i < 3; i ++) {
696 if (rkqua[i] > 1e37 ) rkqua[i] = 1e36;
697 if (rkqua[i] >= 0 && rkqua[i] < min){ min = rkqua[i]; minInd = i;}
708 Error(
"fillCand()",
"(system == 1) No valid kaltrack object!");
713 Error(
"fillCandTof",
"Unknown momentum option");
732 Error(
"fillCandTof",
"Unknown momentum option");
845 Error(
"fillCandRpc",
"Unknown momentum option");
955 Error(
"fillCandRpc",
"Unknown momentum option");
1065 Error(
"fillCandRpc",
"Unknown momentum option");
1090 Bool_t rkSuccess = kTRUE;
1091 Float_t rkchi2 = -1;
1098 if (rkchi2 < 0) { rkSuccess = kFALSE; }
1103 rkchi2 = kal->getChi2();
1104 if (rkchi2 < 0) { rkSuccess = kFALSE; }
1107 Error(
"fillCand",
"Unknown momentum option");
1111 Int_t bestShrInd = -1;
1114 HKalTrack* bestKalShr = 0;
1116 Int_t bestEmcInd = -1;
1119 HKalTrack* bestKalEmc = 0;
1124 Float_t emcQA = 10000.;
1133 if(qa>=0 && qa < emcQA) {
1140 HKalTrack* kalEmc=0;
1145 else { Error(
"fillCand",
"Unknown sort option");}
1150 else if(
fsortSwitch==1)qa=kalEmc->getMetaRadius();
1151 else { Error(
"fillCand",
"Unknown sort option");}
1153 else { Error(
"fillCand",
"Unknown momentum option");}
1155 if(qa>=0 && qa < emcQA) {
1160 bestKalEmc = kalEmc;
1169 Float_t shrQA = 10000.;
1178 if(qa>=0 && qa < shrQA) {
1185 HKalTrack* kalShr=0;
1190 else { Error(
"fillCand",
"Unknown sort option");}
1195 else if(
fsortSwitch==1)qa=kalShr->getMetaRadius();
1196 else { Error(
"fillCand",
"Unknown sort option");}
1198 else { Error(
"fillCand",
"Unknown momentum option");}
1200 if(qa>=0 && qa < shrQA) {
1205 bestKalShr = kalShr;
1242 for(Int_t
n = 0;
n < numTof;
n ++)
1269 for(Int_t
n = 0;
n < numRpc;
n ++)
1280 else { Error(
"fillCand",
"Unknown momentum option");}
1289 else { Error(
"fillCand",
"Unknown momentum option");}
1308 if(numRpc <= 0 && (bestShr||bestEmc)){
1318 fillCandEmc(rkSuccess,meta,cand,numEmc,bestEmcInd );
1321 else { Error(
"fillCand",
"Unknown momentum option");}
1327 else { Error(
"fillCand",
"Unknown momentum option");}
1352 for(Int_t
n = 0;
n < numTof;
n ++)
1365 else { Error(
"fillCand",
"Unknown momentum option");}
1374 else { Error(
"fillCand",
"Unknown momentum option");}
1394 for(Int_t
n = 0;
n < numRpc;
n ++)
1407 else { Error(
"fillCand",
"Unknown momentum option");}
1416 else { Error(
"fillCand",
"Unknown momentum option");}
1436 Error(
"fillCand()",
"metamatch system other than -1 to 2 = %i!",meta->
getSystem());
1467 vector<Int_t> goodTracks;
1470 Int_t nGoodOuterTracks = 0;
1476 if( nGoodInnerTracks == 0) {
1483 Int_t nwOuterCut = 0;
1487 if( nGoodOuterTracks == 0) {
1500 for(Int_t i = 0; i < nGoodInnerTracks; i ++) {
1504 goodTracks.push_back(tr);
1512 if(i < nGoodInnerTracks && objects.pSeg1->getNTimes(i) >=
fMinWireGoodTrack) ghost = 0;
1515 if(tr < 1 && tr != gHades->getEmbeddingRealTrackId() )
continue;
1516 if(tr > 0 && find(goodTracks.begin(),goodTracks.end(),tr) == goodTracks.end()) {
1530 if(i < nGoodOuterTracks && objects.pSeg2->getNTimes(i) >=
fMinWireGoodTrack) ghost = 0;
1533 if(tr < 1 && tr != gHades->getEmbeddingRealTrackId() )
continue;
1534 if(tr > 0 && find(goodTracks.begin(),goodTracks.end(),tr) == goodTracks.end()) {
1572 Int_t selMetaHit =
kNoUse;
1576 else Error(
"fillCandSim()",
"Unknown momswitch !");
1577 }
else { selMetaHit = cand.
usedMeta; }
1586 for(Int_t i = 0; i < nTr && i < 3; i ++)
1591 Bool_t good = kFALSE;
1608 }
else if(selMetaHit ==
kTofHit1) {
1613 Bool_t good = kFALSE;
1629 }
else if(selMetaHit ==
kTofHit2) {
1634 Bool_t good = kFALSE;
1651 }
else if(selMetaHit ==
kRpcClst) {
1660 Warning(
"fillCandSim()",
"RPC number of tracks > 4! Should not happen.");
1663 for(Int_t i = 0; i < nTr; i ++) {
1669 Warning(
"fillCandSim()",
"RPC track not at box! Should not happen.");
1695 for(Int_t i = 0; i < nTr; i ++) {
1706 for(Int_t i = 0; i < nTr; i ++) {
1748 Float_t chi2Clust = vertexClust.
getChi2();
1758 Float_t richCorr = 0;
1782 thetaCor = (Float_t)thcor;
1783 phiCor = (Float_t)phcor;
1801 else Error(
"fillSingleProperties()",
"Unknown momswitch !");
1819 }
else Error(
"fillSingleProperties()",
"Unknown momswitch !");
1839 else Error(
"fillSingleProperties()",
"Unknown momswitch !");
1856 if(size < 2)
return;
1858 Float_t
phi1=0.,phi2=0.,theta1=0.,theta2=0.;
1859 Float_t oAngle = -1;
1863 for(UInt_t i = 0; i < size ; i ++){
1873 }
else Error(
"fillCollectiveProperties()",
"Unknown momswitch !");
1881 for(UInt_t j = 0; j < size; j ++){
1883 if(cand.
ind == cand2.
ind)
continue;
1889 phi2 = cand2.
rk.
phi;
1894 }
else Error(
"fillCollectiveProperties()",
"Unknown momswitch !");
1910 for(UInt_t l = 0; l < ntr; l ++){
1954 if(!cand->
used)
continue;
2014 Bool_t cropped [4] ;
2015 for(Int_t i = 0 ; i <
n ; i ++){
2020 for(Int_t j = 0 ; j < 4 ; j ++) cropped[j] = kFALSE;
2022 for(Int_t j = 0 ; j < 4 ; j ++) {
2039 Int_t layers[2] = {0,5};
2043 Double_t xmin,xmax,ymin,ymax;
2045 for(Int_t s = 0; s < 2; s++){
2048 if(!seg[s])
continue;
2049 for(Int_t m = 0; m < 2; m++){
2052 Int_t lay = layers[m];
2053 (*fSizesCells)[sec][mod][lay].calcSegIntersec(seg[s]->getZ(),seg[s]->getR(),seg[s]->getTheta(),seg[s]->getPhi(),x,y,z);
2054 (*fSizesCells)[sec][mod][lay].transTo(x,y,z);
2068 for(UInt_t i = 0; i < nt; i ++){
void fill(HEmcCluster *hit)
HParticleCandFiller(const Option_t pOpt[]="")
void fillCandRpc(Bool_t rkSuccess, HMetaMatch2 *meta, candidate &cand, Int_t num, Int_t slot)
Bool_t initContainer(void)
HCategory * fCatShowerHit
static Int_t getEmbeddingRealTrackId()
void setConditions(const Option_t par[])
ClassImp(HParticleCandFiller) HParticleCandFiller
Int_t getTrack(Short_t n=0) const
HCategory * fCatParticleDebug
void addTrack(Int_t tr, Int_t n, Int_t flag=0, Float_t scale=1.)
Int_t getNTrack2(Int_t i=0)
HCategory * fCatGeantKine
Bool_t fbdoPathLengthCorr
true: (default) do systematic corrections on momentum
void fillGeantAcceptance()
void addTrack(Int_t index, Float_t oAngle)
Float_t fScaleGhostTrack
minium number of wire from same track for good track (MDC), otherwise ghost
void fill(HMdcTrkCand *trk)
Float_t fAngleCloseTrack
scale weight of wires of good track (MDC)
void setAtMdcEdge(UInt_t i)
static Bool_t correctPathLength(HParticleCand *pCand, HGeomVector &vertex, const HMdcPlane *planes, const HGeomVector &targetMidPoint, Double_t beamEnergy=1230)
Int_t getInnerSegInd() const
void fillCand(HMetaMatch2 *meta)
Bool_t fbdoGeantAcceptance
true: (default) do correction of path length to vertex
Int_t getSeg1Ind(void) const
HTofClusterSim * pTofClst
Bool_t fbdoMETAQANorm
true: (default) do correction for vertexz pos in ring sorting
void fillLayerPoints(HMdcSizesCells *fSizesCells, Bool_t secsys=kFALSE)
Bool_t fbdoMomentumCorr
true: (default) do normalization of RK meta dx
static Bool_t normDX(HParticleCand *c, TString beamtime="apr12")
Int_t findBestRich(HMetaMatch2 *meta, HMdcSeg *seg)
Bool_t fbdoRichAlign
true: keep only candidate which is not markerd as fake rejected
void fillMetaKal(HMetaMatch2 *meta, Int_t n=0, HKalTrack *rk=0)
Bool_t modStatus(Int_t s, Int_t m) const
Bool_t fbgoodLepton
true: keep only fitted RK
static Bool_t checkCropedLayer(HGeantKine *kine, HMdcLayer *mdcLayer, Bool_t *croped=0, Bool_t checkHit=kTRUE)
HRuntimeDb * getRuntimeDb(void)
HEvent *& getCurrentEvent(void)
Float_t getChiq(void) const
void fillCollectiveProperties(void)
void fill(HShowerHit *hit)
void getAlignedThetaPhi(const Float_t theta, const Float_t phi, Float_t &thetaCor, Float_t &phiCor)
Bool_t fbgoodSeg0
true: fill catParticleMdc
virtual HEventHeader * getHeader(void) const
Int_t fsortSwitch
: Particle::kMomRK or Particle::kMomKalman
void addObjectToOutput(TObject *obj)
static HMdcSizesCells * getObject(void)
Int_t fRichCorrectionVersion
take into account for filling neighbour tracks with open angle < this
Bool_t fbgoodMeta
true: keep only fitted seg1
void checkCropLayer(HParticleCand *c)
HTofWalkPar * fTofWalkPar
HCategory * fCatParticleCand
Bool_t getCropedLayersEdge(TVector2 &p, Int_t s, Int_t m, Int_t l, Double_t &xmin, Double_t &xmax, Double_t &ymin, Double_t &ymax)
static T * getObject(T *pout, Short_t num=-1, Int_t index=-1, Bool_t silent=kFALSE)
static HCategory * getCategory(Short_t num, Int_t warn=0, TString name="")
void fillMeta(HMetaMatch2 *meta, Int_t n=0, HRKTrackB *rk=0)
Float_t fScaleGoodTrack
scale weight of wires of ghost track (MDC)
static T * newObject(T *pout, Short_t num, Int_t &index)
const HGeomVector & getTargetMidPoint()
Int_t fmomSwitch
true: (default) loop geant kine and fill acceptance + crop bits
Bool_t fbnoFake
true: keep only candidate with ring match
HGeomVector & getPos(void)
void fillCandShower(Bool_t rkSuccess, HMetaMatch2 *meta, candidate &cand, Int_t num, Int_t slot)
HRich700DigiPar * fRich700DigiPar
Bool_t fbFillMdc
debug mode ?
Int_t getNTrack1(void) const
HCategory * fCatTofCluster
const Cat_t catTofCluster
Bool_t fbdoRichVertexCorr
true: (default)align the rich (real data)
const Cat_t catEmcCluster
Float_t getRichCorr(Float_t zVertex, Float_t thetaRich, Float_t phiRich)
UChar_t getNTimes(Int_t n) const
void sortWeightNdet(void)
void fillRKPlane(HMdcSizesCells *fSizesCells)
static void printSpace(TString space)
HEmcClusterSim * pEmcClst
void initVars()
-1=init 0=apr12,aug14,jul14 , 1 = mar19
Int_t getOuterSegInd() const
const Cat_t catParticleMdc
void fillMeta(HMetaMatch2 *meta, Int_t n=0)
void fill(HKalTrack *trk)
void fillParticleCand(HParticleCand *part, Int_t index, Int_t momSwitch=Particle::kMomRK)
HRpcClusterSim * pRpcClst
Double_t getRich700CircleCenterY()
Int_t getSeg2Ind(void) const
void setAtMdcEdge(UInt_t i)
Bool_t acceptPhiTheta(Int_t s, Float_t mom, Float_t dphi, Float_t dtheta)
void fillMeta(HMetaMatch2 *meta)
void fillCandSim(candidate &cand)
void fillParticleCandSim(HParticleCandSim *part, HCategory *kineCat=0)
const Cat_t catRpcCluster
HShowerHitSim * pShowerHit
Float_t getQualityEmc() const
void addTrackWeight(trackinfo *inf)
Int_t howManyTracks() const
HIterator * fMetaMatchIter
HParSet * getContainer(const Text_t *)
static Float_t setCorrectedMomentum(HParticleCand *c)
Float_t getQualityShower() const
Int_t getNTracks(void) const
void getTrackList(Int_t *array)
void unsetAtMdcEdge(UInt_t i)
Int_t getInterpolatedSectorThetaPhi(Float_t x, Float_t y, Float_t &theta, Float_t &phi)
static Float_t calcRichQA(HMdcSeg *seg, HRichHit *hit)
void fillMeta(HMetaMatch2 *meta)
HCategory * fCatRpcCluster
Int_t fMinWireGoodTrack
vector for all metaMatch objects candidates.
Int_t getTrack(Int_t n) const
void fillMeta(HMetaMatch2 *meta, Int_t n=0, HRKTrackB *rk=0)
HMdcSizesCells * fSizesCells
Int_t getNTrack1(Int_t i=0)
Double_t getRich700CircleCenterX()
HCategory * fCatEmcCluster
void fillMetaKal(HMetaMatch2 *meta, Int_t n=0, HKalTrack *rk=0)
Bool_t fbgoodSeg1
true: keep only fitted seg0
Int_t getNTrack2(void) const
void fillMeta(HMetaMatch2 *meta, Int_t n=0)
HCategory * fCatParticleMdc
HParticleCandFillerPar * fFillerPar
sort by quality (0), radius(1)
void getIsAtBoxList(Bool_t *array)
Float_t getSumOfWeights(void)
void setIndex(Short_t ind)
virtual HCategory * getCategory(Cat_t aCat)=0
void fillMeta(HMetaMatch2 *meta, Int_t n=0, Int_t hit=0)
HCategory * fCatMetaMatch
~HParticleCandFiller(void)
void fillCandNoMeta(Bool_t rkSuccess, HMetaMatch2 *meta, candidate &cand, Int_t num)
void fillMeta(HMetaMatch2 *meta)
Short_t getNTracks(void) const
HCategory * fCatMdcTrkCand
void fill(HSplineTrack *trk)
static HMdcSeg * getMdcSeg(Int_t segind)
Int_t getGoodTrack(Int_t i1, HMdcSegSim *outerSeg, Int_t nWiresCut=5) const
Bool_t fbgoodRK
true: keep only candidate with META
static Float_t getOpeningAngle(Float_t phi1, Float_t theta1, Float_t phi2, Float_t theta2)
void fill(HRpcCluster *clst)
const HMdcPlane * getMdcPlanes()
void fillSingleProperties(void)
Char_t getNNotFakeTracks(void) const
Short_t getSector() const
static Bool_t alignRichRing(const Double_t theta, const Double_t phi, Double_t &thetaCor, Double_t &phiCor)
static HCategory * addCategory(Short_t num, TString name="", Int_t size=1000, TString partev="", Bool_t dynamicsize=kFALSE)
void fillCandEmc(Bool_t rkSuccess, HMetaMatch2 *meta, candidate &cand, Int_t num, Int_t slot)
Bool_t isEMC
keep pointers for this candidate
vector< trackinfo * > tracks
const Cat_t catMdcTrkCand
static Int_t findFirstHitInTof(Int_t trackID, Int_t modeTrack=2)
Int_t getTrack(Int_t n=0) const
vector< candidate * > all_candidates
const Cat_t catSplineTrack
Bool_t isAcceptanceFilled()
const Cat_t catParticleDebug
void fillCandTof(Bool_t rkSuccess, HMetaMatch2 *meta, candidate &cand, Int_t num, Int_t slot)
static T * newSlot(T *pout, Short_t num, Int_t &index)
const Cat_t catParticleCand
void fill(HTofHit *hit, Int_t type=1)