#ifndef HParticleMetaMatcher_h #define HParticleMetaMatcher_h #include "hgeomtransform.h" #include "hgeomvector.h" #include "hreconstructor.h" #include "hrpccluster.h" #include "hemccluster.h" #include "htofcluster.h" #include "hparticlecand.h" #include "TVector3.h" #include #include #include #include #define EMCMAXCELL 163 #define RPCMAXCELL 31 using namespace std; // from hydra class HCategory; class HGeomVector; class HMetaMatchPar; class HRpcGeomPar; class HRpcGeomCellPar; class HEmcGeomPar; class HTofGeomPar; class HParticleCand; class HSpecGeomPar; class HMdcSizesCells; //################################################################## //################################################################## //---------------------------------------------------------------- // store infos of wires per candidate class HParticleWireInfo : public TObject { public: Int_t ar[4][6][2]; // mod,lay,2 wires/lay HParticleCand* c; Bool_t isGood; // no error h Bool_t isUsed; // kIsUsed Bool_t isSharedInner;// shares wire Bool_t isSharedOuter;// shares wire Int_t nSharedInner; // number of shared wires inner MDC Int_t nSharedOuter; // number of shared wires outer MDC void reset(){ c = 0; isGood = kFALSE; isUsed = kFALSE; isSharedInner = kFALSE; isSharedOuter = kFALSE; nSharedInner = 0; nSharedOuter = 0; for(Int_t m = 0; m < 4; m ++){ for(Int_t l = 0; l < 6; l ++){ ar[m][l][0] =-1; ar[m][l][1] =-1; } } } void print() { cout<<"-------------------------------------------------------"<getSector()<<" iSeg "<getInnerSegInd()<<" oSeg "<getOuterSegInd() <<" isSharedInner "< -1 && w.ar[m][l][0] == ar[m][l][0]) cout<<"m "< -1 && w.ar[m][l][1] == ar[m][l][1]) cout<<"m "< ntimes sec,mod,lay,cell Int_t pid ; Int_t nWRange; // +- wire to check in flagging Int_t nWires; // number of wire in event Int_t nWiresUsed; // number of wires used in event incl. doubles vector vWireInfo;// vector of wireinfo for each HParticleCand map mCandWireInfo; // map HParticleCand -> WireInfo HCategory* pParticleCandCat; //! HParticleCand category HCategory* pSegCat; //! HMdcSeg category HMdcSizesCells* sizescells; Int_t ctCand; Int_t ctCandUsed; Int_t ctevent; Int_t ctSecCand[6]; Int_t ctSecCandUsed[6]; Int_t ctSecSegDouble[6]; Int_t ctSecWire[6]; Int_t ctSecWireDouble[6]; Bool_t fDebug; //! switch print on/off protected: void fillWireInfo(HParticleWireInfo& wi,Int_t flag); void flagDoubleUsedWires(); void fillWire (Int_t s,Int_t m,Int_t l,Int_t c,Int_t flag); // count up a single cell void clear(); // at start of event public: HParticleWireManager(); void setDebug(Bool_t deb=kTRUE){fDebug = deb;} void setWireRange(Int_t r) { nWRange = r;} // blocked +- range arround used wire in layer (0-n) Int_t getNWires () { return nWires;} // number of wires in event Int_t getNWiresUsed() { return nWiresUsed;} Int_t isUsedNtimes(Int_t s,Int_t m,Int_t l,Int_t c); // how many time this cell has been used ? vector& getWireInfo(){ return vWireInfo;} Bool_t getWireInfo(UInt_t i,HParticleWireInfo& w,HParticleCand* c = 0); // index of HParticleCand -> WireInfo Bool_t sharedWires(HParticleWireInfo& w1,HParticleWireInfo& w2 ,Int_t io=0,Int_t range = -1); // compare 2 WireInfo objects if they shared wires Bool_t sharedWires(HParticleCand* c1,HParticleCand* c2,Int_t io=0,Int_t range = -1); // compare 2 HParticleCand objects if they shared wires void init(); Int_t execute(); void print(); ClassDef(HParticleWireManager,0) }; //################################################################## //################################################################## //---------------------------------------------------------------- class HParticleMetaMatcher : public HReconstructor { protected: HCategory* fCatEmcCluster; //! pointer to the Emc cluster category HCategory* fCatTofHit; //! pointer to the Tof hit category HCategory* fCatTofCluster; //! pointer to the Tof cluster category HCategory* fCatRpcCluster; //! pointer to the Rpc cluster category. HRpcGeomPar* fRpcGeometry; //! Rpc geometry HRpcGeomCellPar* pGeomCellPar; //! Rpc cell info HEmcGeomPar* fEmcGeometry; //! Emc geometry HTofGeomPar* fTofGeometry; //! TOF geometry HSpecGeomPar* pSpecGeomPar; //! sector lab trans HMdcSizesCells* fSizesCells; //! helper container HGeomTransform labSecTrans[6]; //! [sec] HGeomTransform modSecTransRpc[6]; //! [sec] HGeomTransform modSecTransEmc[6]; //! [sec] HGeomTransform modSecTransTof[6][8]; //! [sec][mod] TVector3 normVecRpc[6][3]; //! [sec][plane col{0,2,4}, {1,3,5}, mid] normal vector on the RPC module in the sector coordinate system TVector3 normVecEmc[6]; //! [sec] normal vector on the Emc module in the sector coordinate system TVector3 normVecTof[6][8]; //! [sec][mod] normal vector on each Tof module in the sector coordinate system TVector3 centerVecRpc[6][3]; //! [sec][plane col{0,2,4}, {1,3,5}, mid] center vector on the RPC module in the sector coordinate system TVector3 centerVecEmc[6]; //! [sec] center vector on the Emc module in the sector coordinate system TVector3 centerVecTof[6][8]; //! [sec][mod] center vector on each Tof module in the sector coordinate system HGeomVector cellRPC[6][6][RPCMAXCELL][4]; //! [sec][col][cell] 4points HGeomVector cellEMC[6][EMCMAXCELL][4]; //! [sec][cell] 4points HGeomVector cellTOF[6][8][8][4]; //! [sec][mod][cell] 4points Float_t DPlanesRpc; //! RPC displacement for collumns //------------------------------------ // return fake objects for recalcXXX() functions HRpcCluster rpccluster; //! HTofCluster tofcluster; //! HEmcCluster emccluster; //! //------------------------------------ // MDC hit on meta calculated by recalcXXX() functions HGeomVector trackMetaMod; //! HGeomVector trackMetaSec; //! HGeomVector trackMetaLab; //! Bool_t fDebug; //! switch print on/off HParticleWireManager wiremanager; Bool_t findIntersectionLinePlane(TVector3 &pointIntersect, const TVector3 &pos, const TVector3 &dir, const TVector3 &planeCenter, const TVector3 &planeNormal); Bool_t traceToMeta(const HParticleCand* cand,TVector3 &metaHit, const TVector3 &metaCenter, const TVector3 &metaNorm); public: HParticleMetaMatcher(const Text_t *name = "HParticleMetaMatcher",const Text_t *title ="HParticleMetaMatcher"); virtual ~HParticleMetaMatcher() { ; } void setDebug(Bool_t debug=kTRUE) {fDebug = debug;} HParticleWireManager& getWireManager() {return wiremanager;} const HRpcCluster* recalcRpc(HParticleCand* cand); const HTofCluster* recalcTof(HParticleCand* cand); const HEmcCluster* recalcEmc(HParticleCand* cand); const HGeomVector& getTrackMetaMod() { return trackMetaMod;} // only valid direct following recalcXXX() call! const HGeomVector& getTrackMetaSec() { return trackMetaSec;} // only valid direct following recalcXXX() call! const HGeomVector& getTrackMetaLab() { return trackMetaLab;} // only valid direct following recalcXXX() call! Bool_t predictRpcCell(HParticleCand* cand,HGeomVector& hit1,HGeomVector& hit2,Int_t& s,Int_t& col1,Int_t& cell1,Int_t& col2,Int_t& cell2,Int_t sys=1); Bool_t predictTofCell(HParticleCand* cand,HGeomVector& hit0,HGeomVector& hit1,Int_t& s,Int_t& mod0,Int_t& cell0,Int_t& mod1,Int_t& cell1,Int_t sys=1); Bool_t predictEmcCell(HParticleCand* cand,HGeomVector& hit,Int_t& s,Int_t& pos,Int_t& cell,Int_t sys=1); Bool_t predictMdcHit (HParticleCand* cand,HGeomVector& hit,Int_t m); Bool_t predictMdcHitSec(HParticleCand* cand,HGeomVector& hit,Int_t m); Bool_t predictMdcHitLab(HParticleCand* cand,HGeomVector& hit,Int_t m); Bool_t isInRpcCell(HGeomVector& vmod,Int_t s,Int_t col,Int_t c,Float_t xRes = 0.,Float_t yRes = 0.); Bool_t isInTofCell(HGeomVector& vmod,Int_t s,Int_t col,Int_t c,Float_t xRes = 0.,Float_t yRes = 0.); Bool_t isInEmcCell(HGeomVector& vmod,Int_t s,Int_t c,Float_t xRes = 0.,Float_t yRes = 0.); const HGeomVector* getRpcCellGeom(Int_t s,Int_t col,Int_t cell); const HGeomVector* getTofCellGeom(Int_t s,Int_t mod,Int_t cell); const HGeomVector* getEmcCellGeom(Int_t s,Int_t cell); void getEmcCellArray(Int_t s,Int_t cell,vector& vcells); Bool_t init (); Bool_t reinit (); Int_t execute (); Bool_t finalize() { return kTRUE; } ClassDef(HParticleMetaMatcher,0) }; #endif // HParticleMetaMatcher_h