CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Photon.cc
Go to the documentation of this file.
3 
4 using namespace reco;
5 
7  const Point& caloPos,
8  const PhotonCoreRef & core,
9  const Point & vtx) :
10  RecoCandidate( 0, p4, vtx, 22 ),
11  caloPosition_( caloPos ),
12  photonCore_(core),
13  pixelSeed_(false)
14  {}
15 
16 
17 Photon::Photon( const Photon& rhs ) :
18  RecoCandidate(rhs),
19  caloPosition_(rhs.caloPosition_),
20  photonCore_ ( rhs.photonCore_),
21  pixelSeed_ ( rhs.pixelSeed_ ),
22  fiducialFlagBlock_ ( rhs.fiducialFlagBlock_ ),
23  isolationR04_ ( rhs.isolationR04_),
24  isolationR03_ ( rhs.isolationR03_),
25  showerShapeBlock_ ( rhs.showerShapeBlock_),
26  eCorrections_(rhs.eCorrections_),
27  mipVariableBlock_ (rhs.mipVariableBlock_),
28  pfIsolation_ ( rhs.pfIsolation_ )
29  {}
30 
31 
32 
33 
35 
36 Photon * Photon::clone() const {
37  return new Photon( * this );
38 }
39 
40 
41 bool Photon::overlap( const Candidate & c ) const {
42  const RecoCandidate * o = dynamic_cast<const RecoCandidate *>( & c );
43  return ( o != 0 &&
45  );
46  return false;
47 }
48 
49 void Photon::setVertex(const Point & vertex) {
50  math::XYZVectorF direction = caloPosition() - vertex;
51  double energy = this->energy();
52  math::XYZVectorF momentum = direction.unit() * energy;
53  math::XYZTLorentzVector lv(momentum.x(), momentum.y(), momentum.z(), energy );
54  setP4(lv);
55  vertex_ = vertex;
56 }
57 
59  return this->photonCore()->superCluster();
60 }
61 
63 
64  const reco::ConversionRefVector & conv2leg = this->photonCore()->conversions();
65  const reco::ConversionRefVector & conv1leg = this->photonCore()->conversionsOneLeg();
66 
67  int origin = -1;
68  bool isEg=false, isPf=false;
69 
70  for (unsigned iConv=0; iConv<conv2leg.size(); iConv++){
71  std::vector<edm::RefToBase<reco::Track> > convtracks = conv2leg[iConv]->tracks();
72  for (unsigned itk=0; itk<convtracks.size(); itk++){
73  if (convTrack==convtracks[itk]) isEg=true;
74  }
75  }
76 
77  for (unsigned iConv=0; iConv<conv1leg.size(); iConv++){
78  std::vector<edm::RefToBase<reco::Track> > convtracks = conv1leg[iConv]->tracks();
79  for (unsigned itk=0; itk<convtracks.size(); itk++){
80  if (convTrack==convtracks[itk]) isPf=true;
81  }
82  }
83 
84  if (isEg) origin=egamma;
85  if (isPf) origin=pflow;
86  if (isEg && isPf) origin=both;
87 
88  return origin;
89 }
90 
91 
92 void Photon::setCorrectedEnergy( P4type type, float newEnergy, float delta_e, bool setToRecoCandidate ) {
93 
94  math::XYZTLorentzVectorD newP4 = p4() ;
95  newP4 *= newEnergy/newP4.e() ;
96  switch(type)
97  {
98  case ecal_standard:
99  eCorrections_.scEcalEnergy = newEnergy;
101  break ;
102  case ecal_photons:
103  eCorrections_.phoEcalEnergy = newEnergy;
105  break ;
106  case regression1:
107  eCorrections_.regression1Energy = newEnergy ;
109  case regression2:
110  eCorrections_.regression2Energy = newEnergy ;
112  break ;
113  default:
114  throw cms::Exception("reco::Photon")<<"unexpected p4 type: "<< type ;
115  }
116  setP4(type, newP4, delta_e, setToRecoCandidate);
117 
118 }
119 
120 
121 
122 
124  switch(type)
125  {
126  case ecal_standard:
128  break ;
129  case ecal_photons:
131  break ;
132  case regression1:
134  case regression2:
136  break ;
137  default:
138  throw cms::Exception("reco::Photon")<<"unexpected p4 type " << type << " cannot return the energy value: " ;
139  }
140  }
141 
142 
144  switch(type)
145  {
146  case ecal_standard:
148  break ;
149  case ecal_photons:
151  break ;
152  case regression1:
154  case regression2:
156  break ;
157  default:
158  throw cms::Exception("reco::Photon")<<"unexpected p4 type " << type << " cannot return the uncertainty on the energy: " ;
159  }
160  }
161 
162 
163 
164 void Photon::setP4(P4type type, const LorentzVector & p4, float error, bool setToRecoCandidate ) {
165 
166 
167  switch(type)
168  {
169  case ecal_standard:
172  break ;
173  case ecal_photons:
176  break ;
177  case regression1:
180  case regression2:
183  break ;
184  default:
185  throw cms::Exception("reco::Photon")<<"unexpected p4 type: "<< type ;
186  }
187  if (setToRecoCandidate)
188  {
189  setP4(p4) ;
191  }
192 
193 
194 }
195 
197  {
198  switch(type)
199  {
200  case ecal_standard: return eCorrections_.scEcalP4 ;
201  case ecal_photons: return eCorrections_.phoEcalP4 ;
204  default: throw cms::Exception("reco::Photon")<<"unexpected p4 type: "<< type << " cannot return p4 ";
205  }
206  }
type
Definition: HCALResponse.h:21
bool checkOverlap(const R &r1, const R &r2) const
check if two components overlap
Definition: RecoCandidate.h:63
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
virtual const Point & vertex() const
vertex position (overwritten by PF...)
virtual Photon * clone() const
returns a clone of the candidate
Definition: Photon.cc:36
virtual Vector momentum() const
spatial momentum vector
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
Definition: Photon.cc:58
Point vertex_
vertex position
Photon()
default constructor
Definition: Photon.h:31
float getCorrectedEnergy(P4type type) const
Definition: Photon.cc:123
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
LorentzVector regression2P4
Definition: Photon.h:212
reco::PhotonCoreRef photonCore() const
returns a reference to the core photon object
Definition: Photon.h:49
virtual double energy() const
energy
virtual bool overlap(const Candidate &) const
check overlap with another candidate
Definition: Photon.cc:41
double p4[4]
Definition: TauolaWrapper.h:92
EnergyCorrections eCorrections_
Definition: Photon.h:470
void setCorrectedEnergy(P4type type, float E, float dE, bool toCand=true)
Definition: Photon.cc:92
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
Definition: Vector3D.h:17
float getCorrectedEnergyError(P4type type) const
Definition: Photon.cc:143
math::XYZPointF caloPosition() const
position in ECAL: this is th SC position if r9&lt;0.93. If r8&gt;0.93 is position of seed BasicCluster taki...
Definition: Photon.h:80
void setP4(P4type type, const LorentzVector &p4, float p4Error, bool setToRecoCandidate)
Definition: Photon.cc:164
LorentzVector regression1P4
Definition: Photon.h:209
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
virtual ~Photon()
destructor
Definition: Photon.cc:34
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
math::XYZPoint Point
point in the space
Definition: Candidate.h:45
volatile std::atomic< bool > shutdown_flag false
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster
void setVertex(const Point &vertex)
set primary event vertex used to define photon direction
Definition: Photon.cc:49
int conversionTrackProvenance(const edm::RefToBase< reco::Track > &convTrack) const
Definition: Photon.cc:62