CMS 3D CMS Logo

TICLCandidate.h
Go to the documentation of this file.
1 #ifndef DataFormats_HGCalReco_TICLCandidate_h
2 #define DataFormats_HGCalReco_TICLCandidate_h
3 
10 
11 // A TICLCandidate is a lightweight physics object made from one or multiple Tracksters.
12 
14 public:
16 
19 
21 
23  : LeafCandidate(),
24  time_(trackster->time()),
25  timeError_(trackster->timeError()),
26  rawEnergy_(0.f),
27  tracksters_({trackster}),
28  idProbabilities_{} {}
29 
30  inline float time() const { return time_; }
31  inline float timeError() const { return timeError_; }
32 
33  void setTime(float time) { time_ = time; };
35 
36  inline const edm::Ptr<reco::Track> trackPtr() const { return trackPtr_; }
38 
39  inline float rawEnergy() const { return rawEnergy_; }
41 
42  inline const std::vector<edm::Ptr<ticl::Trackster> > tracksters() const { return tracksters_; };
43 
45  void addTrackster(const edm::Ptr<ticl::Trackster>& trackster) {
46  tracksters_.push_back(trackster);
47  time_ = trackster->time();
48  timeError_ = trackster->timeError();
49  }
50  // convenience method to return the ID probability for a certain particle type
51  inline float id_probability(ParticleType type) const {
52  // probabilities are stored in the same order as defined in the ParticleType enum
53  return idProbabilities_[(int)type];
54  }
55 
56  inline const std::array<float, 8>& idProbabilities() const { return idProbabilities_; }
57 
59  for (auto& p : idProbabilities_) {
60  p = 0.f;
61  }
62  }
63 
64  void setIdProbabilities(const std::array<float, 8>& idProbs) { idProbabilities_ = idProbs; }
66 
67 private:
68  float time_;
69  float timeError_;
71 
72  float rawEnergy_;
73 
74  // vector of Ptr so Tracksters can come from different collections
75  // and there can be derived classes
76  std::vector<edm::Ptr<ticl::Trackster> > tracksters_;
77 
78  // Since it contains multiple tracksters, duplicate the probability interface
79  std::array<float, 8> idProbabilities_;
80 };
81 #endif
const edm::Ptr< reco::Track > trackPtr() const
Definition: TICLCandidate.h:36
void setIdProbabilities(const std::array< float, 8 > &idProbs)
Definition: TICLCandidate.h:64
int Charge
electric charge type
Definition: Candidate.h:34
void setTracksters(const std::vector< edm::Ptr< ticl::Trackster > > &tracksters)
Definition: TICLCandidate.h:44
std::vector< edm::Ptr< ticl::Trackster > > tracksters_
Definition: TICLCandidate.h:76
const std::array< float, 8 > & idProbabilities() const
Definition: TICLCandidate.h:56
void zeroProbabilities()
Definition: TICLCandidate.h:58
void setTimeError(float timeError)
Definition: TICLCandidate.h:34
edm::Ptr< reco::Track > trackPtr_
Definition: TICLCandidate.h:70
const LorentzVector & p4() const final
four-momentum Lorentz vector
const float timeError() const
Definition: Trackster.h:130
void setIdProbability(ParticleType type, float value)
Definition: TICLCandidate.h:65
double p() const final
magnitude of momentum vector
void setTime(float time)
Definition: TICLCandidate.h:33
void setRawEnergy(float rawEnergy)
Definition: TICLCandidate.h:40
std::array< float, 8 > idProbabilities_
Definition: TICLCandidate.h:79
double f[11][100]
float id_probability(ParticleType type) const
Definition: TICLCandidate.h:51
Definition: value.py:1
ticl::Trackster::ParticleType ParticleType
Definition: TICLCandidate.h:15
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
float timeError() const
Definition: TICLCandidate.h:31
void addTrackster(const edm::Ptr< ticl::Trackster > &trackster)
Definition: TICLCandidate.h:45
const float time() const
Definition: Trackster.h:129
float time() const
Definition: TICLCandidate.h:30
const std::vector< edm::Ptr< ticl::Trackster > > tracksters() const
Definition: TICLCandidate.h:42
TICLCandidate(Charge q, const LorentzVector &p4)
Definition: TICLCandidate.h:17
void setTrackPtr(const edm::Ptr< reco::Track > &trackPtr)
Definition: TICLCandidate.h:37
float rawEnergy() const
Definition: TICLCandidate.h:39
TICLCandidate(const edm::Ptr< ticl::Trackster > &trackster)
Definition: TICLCandidate.h:22