test
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  full5x5_showerShapeBlock_ ( rhs.full5x5_showerShapeBlock_),
27  eCorrections_(rhs.eCorrections_),
28  mipVariableBlock_ (rhs.mipVariableBlock_),
29  pfIsolation_ ( rhs.pfIsolation_ )
30  {}
31 
32 
33 
34 
35 Photon::~Photon() { }
36 
37 Photon * Photon::clone() const {
38  return new Photon( * this );
39 }
40 
41 
42 bool Photon::overlap( const Candidate & c ) const {
43  const RecoCandidate * o = dynamic_cast<const RecoCandidate *>( & c );
44  return ( o != 0 &&
46  );
47  return false;
48 }
49 
50 void Photon::setVertex(const Point & vertex) {
51  math::XYZVectorF direction = caloPosition() - vertex;
52  double energy = this->energy();
53  math::XYZVectorF momentum = direction.unit() * energy;
54  math::XYZTLorentzVector lv(momentum.x(), momentum.y(), momentum.z(), energy );
55  setP4(lv);
57 }
58 
60  return this->photonCore()->superCluster();
61 }
62 
64 
65  const reco::ConversionRefVector & conv2leg = this->photonCore()->conversions();
66  const reco::ConversionRefVector & conv1leg = this->photonCore()->conversionsOneLeg();
67 
68  int origin = -1;
69  bool isEg=false, isPf=false;
70 
71  for (unsigned iConv=0; iConv<conv2leg.size(); iConv++){
72  std::vector<edm::RefToBase<reco::Track> > convtracks = conv2leg[iConv]->tracks();
73  for (unsigned itk=0; itk<convtracks.size(); itk++){
74  if (convTrack==convtracks[itk]) isEg=true;
75  }
76  }
77 
78  for (unsigned iConv=0; iConv<conv1leg.size(); iConv++){
79  std::vector<edm::RefToBase<reco::Track> > convtracks = conv1leg[iConv]->tracks();
80  for (unsigned itk=0; itk<convtracks.size(); itk++){
81  if (convTrack==convtracks[itk]) isPf=true;
82  }
83  }
84 
85  if (isEg) origin=egamma;
86  if (isPf) origin=pflow;
87  if (isEg && isPf) origin=both;
88 
89  return origin;
90 }
91 
92 
93 void Photon::setCorrectedEnergy( P4type type, float newEnergy, float delta_e, bool setToRecoCandidate ) {
94 
95  math::XYZTLorentzVectorD newP4 = p4() ;
96  newP4 *= newEnergy/newP4.e() ;
97  switch(type)
98  {
99  case ecal_standard:
100  eCorrections_.scEcalEnergy = newEnergy;
102  break ;
103  case ecal_photons:
104  eCorrections_.phoEcalEnergy = newEnergy;
106  break ;
107  case regression1:
108  eCorrections_.regression1Energy = newEnergy ;
110  case regression2:
111  eCorrections_.regression2Energy = newEnergy ;
113  break ;
114  default:
115  throw cms::Exception("reco::Photon")<<"unexpected p4 type: "<< type ;
116  }
117  setP4(type, newP4, delta_e, setToRecoCandidate);
118 
119 }
120 
121 
122 
123 
124  float Photon::getCorrectedEnergy( P4type type) const {
125  switch(type)
126  {
127  case ecal_standard:
129  break ;
130  case ecal_photons:
132  break ;
133  case regression1:
135  case regression2:
137  break ;
138  default:
139  throw cms::Exception("reco::Photon")<<"unexpected p4 type " << type << " cannot return the energy value: " ;
140  }
141  }
142 
143 
144  float Photon::getCorrectedEnergyError( P4type type) const {
145  switch(type)
146  {
147  case ecal_standard:
149  break ;
150  case ecal_photons:
152  break ;
153  case regression1:
155  case regression2:
157  break ;
158  default:
159  throw cms::Exception("reco::Photon")<<"unexpected p4 type " << type << " cannot return the uncertainty on the energy: " ;
160  }
161  }
162 
163 
164 
165 void Photon::setP4(P4type type, const LorentzVector & p4, float error, bool setToRecoCandidate ) {
166 
167 
168  switch(type)
169  {
170  case ecal_standard:
173  break ;
174  case ecal_photons:
177  break ;
178  case regression1:
181  case regression2:
184  break ;
185  default:
186  throw cms::Exception("reco::Photon")<<"unexpected p4 type: "<< type ;
187  }
188  if (setToRecoCandidate)
189  {
190  setP4(p4) ;
192  }
193 
194 
195 }
196 
197 const Candidate::LorentzVector& Photon::p4( P4type type ) const
198  {
199  switch(type)
200  {
201  case ecal_standard: return eCorrections_.scEcalP4 ;
202  case ecal_photons: return eCorrections_.phoEcalP4 ;
205  default: throw cms::Exception("reco::Photon")<<"unexpected p4 type: "<< type << " cannot return p4 ";
206  }
207  }
type
Definition: HCALResponse.h:21
virtual Photon * clone() const
returns a clone of the candidate
bool checkOverlap(const R &r1, const R &r2) const
check if two components overlap
Definition: RecoCandidate.h:69
void setVertex(const Point &vertex)
set primary event vertex used to define photon direction
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
virtual double energy() const final
energy
void setCorrectedEnergy(P4type type, float E, float dE, bool toCand=true)
virtual ~Photon()
destructor
virtual const Point & vertex() const
vertex position (overwritten by PF...)
math::XYZTLorentzVector LorentzVector
int conversionTrackProvenance(const edm::RefToBase< reco::Track > &convTrack) const
Photon()
default constructor
Definition: Photon.h:31
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual bool overlap(const Candidate &) const
check overlap with another candidate
LorentzVector regression2P4
Definition: Photon.h:258
reco::PhotonCoreRef photonCore() const
returns a reference to the core photon object
Definition: Photon.h:49
double p4[4]
Definition: TauolaWrapper.h:92
math::XYZPoint Point
EnergyCorrections eCorrections_
Definition: Photon.h:519
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
Definition: Vector3D.h:17
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
virtual void setVertex(const Point &vertex)
set vertex
float getCorrectedEnergyError(P4type type) const
LorentzVector regression1P4
Definition: Photon.h:255
virtual Vector momentum() const final
spatial momentum vector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
float getCorrectedEnergy(P4type type) const
size_type size() const
Size of the RefVector.
Definition: RefVector.h:107
volatile std::atomic< bool > shutdown_flag false
virtual const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
void setP4(P4type type, const LorentzVector &p4, float p4Error, bool setToRecoCandidate)
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster