Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:39

0001 #ifndef DataFormats_HGCalReco_TICLCandidate_h
0002 #define DataFormats_HGCalReco_TICLCandidate_h
0003 
0004 #include "DataFormats/Candidate/interface/LeafCandidate.h"
0005 #include "DataFormats/Common/interface/Ref.h"
0006 #include "DataFormats/HGCalReco/interface/Trackster.h"
0007 #include "DataFormats/Math/interface/Point3D.h"
0008 #include "DataFormats/TrackReco/interface/Track.h"
0009 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0010 
0011 // A TICLCandidate is a lightweight physics object made from one or multiple Tracksters.
0012 
0013 class TICLCandidate : public reco::LeafCandidate {
0014 public:
0015   typedef ticl::Trackster::ParticleType ParticleType;
0016 
0017   TICLCandidate(Charge q, const LorentzVector& p4)
0018       : LeafCandidate(q, p4), time_(0.f), timeError_(-1.f), rawEnergy_(0.f), idProbabilities_{} {}
0019 
0020   TICLCandidate() : LeafCandidate(), time_(0.f), timeError_(-1.f), rawEnergy_(0.f), idProbabilities_{} {}
0021 
0022   TICLCandidate(const edm::Ptr<ticl::Trackster>& trackster)
0023       : LeafCandidate(),
0024         time_(trackster->time()),
0025         timeError_(trackster->timeError()),
0026         rawEnergy_(0.f),
0027         tracksters_({trackster}),
0028         idProbabilities_{} {}
0029 
0030   inline float time() const { return time_; }
0031   inline float timeError() const { return timeError_; }
0032 
0033   void setTime(float time) { time_ = time; };
0034   void setTimeError(float timeError) { timeError_ = timeError; }
0035 
0036   inline const edm::Ptr<reco::Track> trackPtr() const { return trackPtr_; }
0037   void setTrackPtr(const edm::Ptr<reco::Track>& trackPtr) { trackPtr_ = trackPtr; }
0038 
0039   inline float rawEnergy() const { return rawEnergy_; }
0040   void setRawEnergy(float rawEnergy) { rawEnergy_ = rawEnergy; }
0041 
0042   inline const std::vector<edm::Ptr<ticl::Trackster> > tracksters() const { return tracksters_; };
0043 
0044   void setTracksters(const std::vector<edm::Ptr<ticl::Trackster> >& tracksters) { tracksters_ = tracksters; }
0045   void addTrackster(const edm::Ptr<ticl::Trackster>& trackster) {
0046     tracksters_.push_back(trackster);
0047     time_ = trackster->time();
0048     timeError_ = trackster->timeError();
0049   }
0050   // convenience method to return the ID probability for a certain particle type
0051   inline float id_probability(ParticleType type) const {
0052     // probabilities are stored in the same order as defined in the ParticleType enum
0053     return idProbabilities_[(int)type];
0054   }
0055 
0056   void setIdProbabilities(const std::array<float, 8>& idProbs) { idProbabilities_ = idProbs; }
0057 
0058 private:
0059   float time_;
0060   float timeError_;
0061   edm::Ptr<reco::Track> trackPtr_;
0062 
0063   float rawEnergy_;
0064 
0065   // vector of Ptr so Tracksters can come from different collections
0066   // and there can be derived classes
0067   std::vector<edm::Ptr<ticl::Trackster> > tracksters_;
0068 
0069   // Since it contains multiple tracksters, duplicate the probability interface
0070   std::array<float, 8> idProbabilities_;
0071 };
0072 #endif