CMS 3D CMS Logo

PFBlockElement.h
Go to the documentation of this file.
1 #ifndef __PFBlockElement__
2 #define __PFBlockElement__
3 
13 
14 #include "DataFormats/ParticleFlowReco/interface/PFMultilinksTC.h" // Glowinski & Gouzevitch
15 
16 #include <iostream>
17 
18 namespace reco {
19  class PFBlockElementCluster;
20  class PFBlockElementTrack;
21 
27  public:
30  enum Type {
31  NONE = 0,
32  TRACK = 1,
33  PS1 = 2,
34  PS2 = 3,
35  ECAL = 4,
36  HCAL = 5,
37  GSF = 6,
38  BREM = 7,
39  HFEM = 8,
40  HFHAD = 9,
41  SC = 10,
42  HO = 11,
43  HGCAL = 12,
44  kNBETypes = 13
45  };
46 
48 
51  : type_(type), locked_(false), index_(static_cast<unsigned>(-1)), time_(0.f), timeError_(-1.f) {}
52 
54  virtual ~PFBlockElement() {}
55 
57  virtual void Dump(std::ostream& out = std::cout, const char* tab = " ") const;
58 
60  virtual PFBlockElement* clone() const = 0;
61 
63  void lock() { locked_ = true; }
64 
66  void unLock() { locked_ = false; }
67 
69  Type type() const { return type_; }
70 
72  virtual bool trackType(TrackType trType) const { return false; }
73 
75  virtual void setTrackType(TrackType trType, bool value) {
76  std::cout << "Error in PFBlockElement::setTrackType : this base class method is not implemented" << std::endl;
77  }
78 
80  bool locked() const { return locked_; }
81 
83  void setIndex(unsigned index) { index_ = index; }
84 
86  unsigned index() const { return index_; }
87 
88  virtual const reco::TrackRef& trackRef() const { return nullTrack_; }
89  virtual const PFRecTrackRef& trackRefPF() const { return nullPFRecTrack_; }
90  virtual const PFClusterRef& clusterRef() const { return nullPFCluster_; }
92  virtual const ConversionRefVector& convRefs() const { return nullConv_; }
93  virtual const MuonRef& muonRef() const { return nullMuon_; }
94  virtual const VertexCompositeCandidateRef& V0Ref() const { return nullVertex_; }
95  virtual void setDisplacedVertexRef(const PFDisplacedTrackerVertexRef& niref, TrackType trType) {
96  std::cout << "Error in PFBlockElement::setDisplacedVertexRef : this base class method is not implemented"
97  << std::endl;
98  }
99  virtual void setConversionRef(const ConversionRef& convRef, TrackType trType) {
100  std::cout << "Error in PFBlockElement::setConversionRef : this base class method is not implemented" << std::endl;
101  }
102  virtual void setMuonRef(const MuonRef& muref) {
103  std::cout << "Error in PFBlockElement::setMuonRef : this base class method is not implemented" << std::endl;
104  }
105  virtual void setV0Ref(const VertexCompositeCandidateRef& v0ref, TrackType trType) {
106  std::cout << "Error in PFBlockElement::setV0Ref : this base class method is not implemented" << std::endl;
107  }
108 
109  virtual bool isSecondary() const { return false; }
110  virtual bool isPrimary() const { return false; }
111  virtual bool isLinkedToDisplacedVertex() const { return false; }
112 
113  // Glowinski & Gouzevitch
116 
118  const auto& it = multilinks_.find(type);
119  if (it != multilinks_.end())
120  return it->second.isValid;
121  else
122  return false; // no multilinks_ for the specified type
123  }
124  const PFMultilinksType& getMultilinks(Type type) const { return multilinks_.at(type).linkedPFObjects; }
125  // ! Glowinski & Gouzevitch
126 
128  bool isTimeValid() const { return timeError_ >= 0.f; }
130  float time() const { return time_; }
132  float timeError() const { return timeError_; }
134  void setTime(float time, float timeError = 0.f) {
135  time_ = time;
137  }
138 
139  protected:
143 
147  bool locked_;
148 
150  unsigned index_;
151 
152  // Glowinski & Gouzevitch
153  // PFMultiLinks for each different link target type
154  std::map<reco::PFBlockElement::Type, PFMultiLinksTC> multilinks_;
155  // ! Glowinski & Gouzevitch
156 
158  float time_;
160  float timeError_;
161 
167  const static MuonRef nullMuon_;
169  };
170 
171  std::ostream& operator<<(std::ostream& out, const PFBlockElement& element);
172 
173 } // namespace reco
174 #endif
Abstract base class for a PFBlock element (track, cluster...)
void unLock()
unlock element
virtual const PFDisplacedTrackerVertexRef & displacedVertexRef(TrackType trType) const
static const MuonRef nullMuon_
virtual const ConversionRefVector & convRefs() const
float timeError() const
static const PFRecTrackRef nullPFRecTrack_
virtual const reco::TrackRef & trackRef() const
static const PFDisplacedTrackerVertexRef nullPFDispVertex_
PFBlockElement(Type type=NONE)
standard constructor
virtual const PFRecTrackRef & trackRefPF() const
virtual PFBlockElement * clone() const =0
necessary to have the edm::OwnVector<PFBlockElement> working
virtual void setTrackType(TrackType trType, bool value)
the trackType
const PFMultilinksType & getMultilinks(Type type) const
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
virtual const VertexCompositeCandidateRef & V0Ref() const
float timeError_
timing information uncertainty (<0 if timing not available)
std::vector< PFMultilink > PFMultilinksType
collection of PFSuperCluster objects
void setIndex(unsigned index)
set index
unsigned index() const
virtual void setDisplacedVertexRef(const PFDisplacedTrackerVertexRef &niref, TrackType trType)
virtual void setV0Ref(const VertexCompositeCandidateRef &v0ref, TrackType trType)
virtual const PFClusterRef & clusterRef() const
double f[11][100]
bool isTimeValid() const
do we have a valid time information
Definition: value.py:1
bool locked() const
locked ?
bool isMultilinksValide(Type type) const
static const PFClusterRef nullPFCluster_
void lock()
lock element
virtual bool trackType(TrackType trType) const
static const ConversionRefVector nullConv_
virtual bool isLinkedToDisplacedVertex() const
Definition: HCAL.py:1
void setIsValidMultilinks(bool isVal, Type type)
std::map< reco::PFBlockElement::Type, PFMultiLinksTC > multilinks_
virtual ~PFBlockElement()
destructor
virtual void setConversionRef(const ConversionRef &convRef, TrackType trType)
float time_
timing information (valid if timeError_ >= 0)
virtual void Dump(std::ostream &out=std::cout, const char *tab=" ") const
print the object inside the element
unsigned index_
index in block vector
static const reco::TrackRef nullTrack_
fixed size matrix
static const VertexCompositeCandidateRef nullVertex_
void setMultilinks(const PFMultiLinksTC &ml, Type type)
virtual void setMuonRef(const MuonRef &muref)
virtual bool isPrimary() const
virtual bool isSecondary() const
void setTime(float time, float timeError=0.f)
the timing information
virtual const MuonRef & muonRef() const