#ifndef INC_CHARGEDPARTICLE #define INC_CHARGEDPARTICLE ////////////////////////////////////////////////////////////////////// // File: ChargedParticle.hpp // // Purpose: provide a D0PhysObj for tracks at a vertex // // Created: 11-JAN-1999 Serban Protopopescu // Modified:31-AUG-1999 move from kinem to chpart_evt // replace D0Index with LinkIndex (SP) // 11-AUG-2000 include enough information to recreate ETrack at DCA // 31-OCT-2000 add methods to return CPS3DCluster* and FPSRecoCluster* // 15-MAR-2001 PS matching in phi-z; (YG) // add method to return track phi-z at PS // add method to return track XYZ at "single track vertex" // 24-Mar-2004 Added track cluster attributes and methods (HBG). // // Notes concerning track clusters: // // 1. Clusters are stored as // vector >. This is // different from the way GTrack stores them (as // ChunkClusterIndex), but LinkIndex is more // convenient (activation/deactivation is simpler). // 2. Constructors of ChargedParticle leave the // cluster list empty (except copy constructor). // 3. Clusters are initialized in d0reco // using method setClusters, which is called // from ChPartReco. // ////////////////////////////////////////////////////////////////////// #include "kinem/D0PhysObj.hpp" #include "kinem/Quality.hpp" #include "identifiers/ChunkID.hpp" #include "chpart_evt/ChTmbObj.hpp" #include "chpart_evt/ChIsoTmbObj.hpp" #include #include #ifndef __CINT__ #include "trfdca/SurfDCA.h" #include "trfbase/ETrack.h" #endif #ifdef __CINT__ namespace trf{ class ETrack; } #endif class GTrack; class FPSRecoCluster; class CPS3DCluster; namespace d0track{class D0HitMask; class D0MissMask;} namespace vertex{ #ifndef __CINT__ class TrackDCA; #endif const float PIMASS2=0.01920164; class ChargedParticle: public kinem::D0PhysObj{ friend class ChTmbObj; friend class ChIsoTmbObj; public: typedef edm::LinkIndex ChPartIndex; typedef edm::LinkIndex GtrIndex; typedef edm::LinkIndex VtxIndex; typedef edm::LinkIndex CpsIndex; typedef edm::LinkIndex FpsIndex; typedef ChTmbObj::D0clIndex D0clIndex; typedef std::vector VtxIndexList; typedef std::vector CpsLinks; typedef std::vector FpsLinks; typedef ChTmbObj::D0clLinks D0clLinks; // constructors ChargedParticle(); ChargedParticle(float pxyz[3], float E); ChargedParticle(float pxyz[3], float E, float err[20], GtrIndex gtrkindex, VtxIndexList& vps, std::vector& pchisqs, VtxIndexList& vss, std::vector& schisqs); ChargedParticle( const ChargedParticle &chp); ~ChargedParticle(){;} // Interface methods // return 4-vector components and simple derived quantities float px() const; float py() const; float pz() const; float E() const; float pT() const; float phi() const; float eta() const; float theta() const; float p() const; // return Lorentz 4-vector as an array void p4vec(float p4v[4]) const; // return Lorentz 4-vector LorentzVector l4vec() const; // return the space component of Lorentz 4-vector SpaceVector s3vec() const; float charge() const; // get other quantities float getChi2Ndf() const; float getSmtPlsHeight() const; float getCftPlsHeight() const; // return object index and type ChPartIndex index()const; int typeID() const; // return vertex links (and chisqs) const Vertex* getVtxPtr() const; // return pointer corresponding to vtxindex VtxIndex vtxindex(float& chisq) const; // return also corresponding chisq const VtxIndexList& pvtxIndices() const; //return primaries const VtxIndexList& pvtxIndices(std::vector& pchisqs) const; const VtxIndexList& svtxIndices() const; //return secondaries const VtxIndexList& svtxIndices(std::vector& schisqs) const; // return chisq at a given vertex float getChisq(VtxIndex &vtxindx) const; // return GTrack index GtrIndex gtrackindex() const; // return preshower indices CpsIndex cpsindex() const; FpsIndex fpsindex() const; // return preshower pointers const CPS3DCluster* getPtrCps() const; const FPSRecoCluster* getPtrFps() const; // return preshower matching chi2 for best matched CPS cluster float cps_match_chi2() const; // return preshower matching chi2 for the associated CPS cluster float cps_match_chi2(const CPS3DCluster &cps) const; // return EtFlow measurements bool IsIsolated() const; const std::vector& EtFlow() const; const std::vector& EtFlowN() const; // return "single track vertex" position void getXYZ(float xyz[3]) const; float getPSphi() const; //track phi at PS float getPSR() const; //track R at PS float getPSz() const; //track z at PS // get MTC information void getMTC(float e[14], int i[14], float e33[3], float e55[3]) const; float getMTC_E() const; // summed energy // return ETrack at DCA const trf::ETrack& get_etrack() const; // return dE/dx and rms float get_smtdedx()const; float get_cftdedx()const; float getrms_smtdedx()const; float getrms_cftdedx()const; #ifndef __CINT__ // return track DCA values TrackDCA get_trackDCA() const; // at best vertex TrackDCA get_trackDCA(const Vertex& vtx) const; // at vertex vtx // return ThumbNail information ChTmbObj getThumbNail() const; ChIsoTmbObj getChIsoTmbObj() const; // unpack ThumbNail information void unpThumbNail(const ChTmbObj* tmbptr, const int &tmb_version); void unpThumbNail(const ChIsoTmbObj* tmbptr); // get D0HitMask d0track::D0HitMask getHitMask() const; void setHitMask(const d0track::D0HitMask& d0hitmask); // get D0MissMask d0track::D0MissMask getMissMask() const; void setMissMask(const d0track::D0MissMask& d0hitmask); #endif // return error Matrix for px, py, pz (symmetric 3x3) // at present returns 3x3 for phi, tanl and q/pT void errMatrix(MatrixD &m) const; kinem::Quality quality() const; CpsLinks cpslinks() const; FpsLinks fpslinks() const; VtxIndex vtxindex() const; // return vertex corresponding to 4-vector void print(std::ostream& os) const; // set attributes not in constructor void setXYZ(float xyz[3]); void setPS(float phi, float R, float z); void setLinkIndex(edm::ChunkID cid,int indx)const; // mutable index void addPvtxIndex(VtxIndex &vtx, float chisq); void addSvtxIndex(VtxIndex &vtx, float chisq); void addEtFlow(float sumet, int ntrk); void setGTrackIndex(GtrIndex &trkindex); void setQuality(kinem::Quality &quality); void setTypeID(int partid); void set4vec(float pxyz[3], float E); void setETrack(const trf::ETrack& etrack); void setCpsIndex(CpsIndex& cpsindex); void setFpsIndex(FpsIndex& fpsindex); void addFpsIndex(FpsIndex& fpsindex); void setChi2Ndf(float chi2_o_ndf); void setHitMask(const GTrack& gtrack); void setMissMask(const GTrack& gtrack); void setMTC(float e[14], int i[14], float e33[3], float e55[3]); void unpThumbNail(kinem::TmbObj& tmbobj); void fillFromETrack(const trf::ETrack* etrack); void fillRest(); void set_tanl(float tanl, float sig_tanl, float sig_z); //set tanl of charge particle. //Needed for axial only tracks // complete all Links void completeLinks(const edm::AbsChunk* c) const; // Track clusters. const D0clLinks& getClusters() const; void setClusters(const D0clLinks& clusters); private: // persistent quantities float _pxyz[3]; // px,py,pz float _E; // E float _XYZ[3]; // x,y,z near vertex float _PSphi; // phi at preshower float _PSz; // z " float _PSR; // r " float _chi2_o_ndf; // track chi2/deg. of freedom unsigned int _hitmask[4]; // map of hits on track unsigned int _missmask[4]; // map of misses on track // array for ETrack elements (screwed up order for backward compatibility) // error elements // 3x3 phi, tanl and q/pT in 0-5 // (phi-phi,phi-tanl,phi-q/pT, tanl-tanl,tanl-q/pT,q/pT-q/pT) // r in 6-10 (r-r, r-z, r-phi, r-tanl, r-q/pT) // z in 11-14 (z-z,z-phi,z-tanl, z-qopt) // // elements themselves are in 15-19 float _errPxyz[20]; int _partid; // id, set to +120 or -120 (sign gives charge) GtrIndex _gtrackindex; // link to GTrack CpsIndex _cpsindex; // link to CPS cluster FpsIndex _fpsindex; // link to FPS cluster (old, for compatibility) FpsLinks _fpslinks; VtxIndexList _pvtxs; // links to primary vertices VtxIndexList _svtxs; // links to secondary vertices std::vector _pchisqs; // chisqs to primary vertices std::vector _schisqs; // chisqs to secondary vertices kinem::Quality _quality; float _smt_dedx; float _smt_ededx; float _cft_dedx; float _cft_ededx; // Track clusters. D0clLinks _clusters; // quantities below filled only for isolated tracks // the following are tracker transverse energy flow sums // see chpart_reco for definitions. // std::vector _etflow; // sumET of other tracks in cones around track std::vector _etflow_ntrk; //number of tracks for each _trk_eflow bool _is_isolated; //if true the energy flow is filled. // MTC stuff float _mtc_E_total; float _mtc_E[14]; // energy of cells in calo layers: // 0-3 -> EM1 - EM4 // 4 -> MG CC; 5 -> ICD; 6 -> MG EC // 7 - 10 -> FH1 - FH4 // 11 - 13 -> CH1 - CH3 int _i_mtc[14]; // =0 layer isn't hit, = 1 - layer is hit. float _e33[3], _e55[3]; //3x3 and 5x5 sums: 0 - total, 1 - EM, 2- CH // non-persistent quantities #ifndef __CINT__ mutable ChPartIndex _index; //! mutable bool _have_etrack; //! mutable bool _have_dca; //! mutable trf::ETrack _etrack; //! mutable float _dca[2]; //! mutable float _dcaerr[2]; //! static const trf::SurfacePtr _srf_dca; //! float _phi; //! float _eta; //! float _pT; //! #endif }; // required by D0PhysObj inline float ChargedParticle::px()const{ return _pxyz[0]; } inline float ChargedParticle::py()const{ return _pxyz[1]; } inline float ChargedParticle::pz()const{ return _pxyz[2]; } inline float ChargedParticle::E()const{ return _E; } inline float ChargedParticle::pT()const{ return _pT; } inline float ChargedParticle::eta()const{ return _eta; } inline float ChargedParticle::phi()const{ return _phi; } inline int ChargedParticle::typeID()const{ return _partid; } inline float ChargedParticle::charge()const{ float q=0; if(abs(_partid)>100){ _partid<0 ? q=-1.0 : q=1.0; } if(abs(_partid)<20){ _partid<0 ? q=1.0 : q=-1.0; } return q; } inline kinem::Quality ChargedParticle::quality()const{ return _quality; } inline ChargedParticle::ChPartIndex ChargedParticle::index()const{ return _index; } inline ChargedParticle::GtrIndex ChargedParticle::gtrackindex()const{ return _gtrackindex; } inline ChargedParticle::CpsIndex ChargedParticle::cpsindex()const{ return _cpsindex; } inline ChargedParticle::CpsLinks ChargedParticle::cpslinks()const{ CpsLinks links; links.push_back(_cpsindex); return links; } inline ChargedParticle::FpsIndex ChargedParticle::fpsindex()const{ return _fpsindex; } inline ChargedParticle::FpsLinks ChargedParticle::fpslinks()const{ return _fpslinks; } inline ChargedParticle::VtxIndex ChargedParticle::vtxindex()const{ if(_pvtxs.empty()) return VtxIndex(); return _pvtxs[0]; } inline ChargedParticle::VtxIndex ChargedParticle::vtxindex(float& chisq)const{ if(_pvtxs.empty()) return VtxIndex(); chisq=_pchisqs[0]; return _pvtxs[0]; } inline const ChargedParticle::VtxIndexList& ChargedParticle::pvtxIndices() const { return _pvtxs; } inline const ChargedParticle::VtxIndexList& ChargedParticle::svtxIndices() const { return _svtxs; } inline const ChargedParticle::VtxIndexList& ChargedParticle::pvtxIndices( std::vector& pchisqs) const { pchisqs=_pchisqs; return _pvtxs; } inline const ChargedParticle::VtxIndexList& ChargedParticle::svtxIndices( std::vector& schisqs) const { schisqs=_schisqs; return _svtxs; } inline const std::vector& ChargedParticle::EtFlow() const { return _etflow; } inline const std::vector& ChargedParticle::EtFlowN() const { return _etflow_ntrk; } inline bool ChargedParticle::IsIsolated() const { return _is_isolated; } inline void ChargedParticle::getXYZ(float xyz[3]) const { for(int i=0; i<3; i++) xyz[i] = _XYZ[i]; } inline float ChargedParticle::getPSphi() const { return _PSphi; } inline float ChargedParticle::getPSz() const { return _PSz; } inline float ChargedParticle::getPSR() const { return _PSR; } inline float ChargedParticle::getChi2Ndf() const { return _chi2_o_ndf; } // set methods inline void ChargedParticle::setXYZ(float xyz[3]) { for(int i=0; i<3; i++) _XYZ[i] = xyz[i]; } inline void ChargedParticle::setPS(float phi, float R, float z) { _PSphi = phi; _PSR = R; _PSz = z; } inline void ChargedParticle::setLinkIndex(edm::ChunkID cid, int indx)const{ _index=ChPartIndex(this,cid,indx); } inline void ChargedParticle::setTypeID(int partid){ _partid=partid; } inline void ChargedParticle::addPvtxIndex(VtxIndex& vtx, float chisq){ _pvtxs.push_back(vtx); _pchisqs.push_back(chisq); } inline void ChargedParticle::addSvtxIndex(VtxIndex& vtx, float chisq){ _svtxs.push_back(vtx); _schisqs.push_back(chisq); } inline void ChargedParticle::addEtFlow(float etsum, int ntrk){ _is_isolated = true; _etflow.push_back(etsum); _etflow_ntrk.push_back(ntrk); } inline void ChargedParticle::setCpsIndex(CpsIndex& cpsindex){ _cpsindex=cpsindex; } inline void ChargedParticle::setFpsIndex(FpsIndex& fpsindex){ _fpsindex=fpsindex; } inline void ChargedParticle::addFpsIndex(FpsIndex& fpsindex){ _fpslinks.push_back(fpsindex); } inline void ChargedParticle::setGTrackIndex(GtrIndex& gtrkindex){ _gtrackindex=gtrkindex; } inline void ChargedParticle::setQuality(kinem::Quality& quality){ _quality=quality; } inline void ChargedParticle::set4vec(float pxyz[3], float E){ _pxyz[0]=pxyz[0]; _pxyz[1]=pxyz[1]; _pxyz[2]=pxyz[2]; _E=E; fillRest(); } inline void ChargedParticle::setChi2Ndf(float chi2_o_ndf) { _chi2_o_ndf=chi2_o_ndf; } inline float ChargedParticle::getMTC_E() const { return _mtc_E_total; } inline float ChargedParticle::get_smtdedx()const{ return _smt_dedx; } inline float ChargedParticle::get_cftdedx()const{ return _cft_dedx; } inline float ChargedParticle::getrms_smtdedx()const{ return _smt_ededx; } inline float ChargedParticle::getrms_cftdedx()const{ return _cft_ededx; } inline const ChargedParticle::D0clLinks& ChargedParticle::getClusters() const { return _clusters; } inline void ChargedParticle::setClusters(const D0clLinks& clusters) { _clusters = clusters; } } // namespace kinem #endif // INC_CHARGEDPARTICLE