CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ggPFTracks Class Reference

#include <ggPFTracks.h>

Public Member Functions

std::pair< float, float > BeamLineInt (reco::SuperClusterRef sc, vector< edm::RefToBase< reco::Track > > &Tracks, reco::ConversionRefVector &conversions, vector< edm::RefToBase< reco::Track > > &SLTracks, reco::ConversionRefVector &SLconversions)
 
std::pair< float, float > CombZVtx (reco::SuperClusterRef sc, reco::GsfTrackRef gsf, vector< edm::RefToBase< reco::Track > > &Tracks, reco::ConversionRefVector &conversions, vector< edm::RefToBase< reco::Track > > &SLTracks, reco::ConversionRefVector &SLconversions)
 
virtual void getPFConvTracks (reco::Photon phot, vector< edm::RefToBase< reco::Track > > &Tracks, reco::ConversionRefVector &conversions, vector< edm::RefToBase< reco::Track > > &SLTracks, reco::ConversionRefVector &SLconversions)
 
 ggPFTracks (edm::Handle< BeamSpot > &beamSpotHandle)
 
std::pair< float, float > gsfElectronProj (reco::GsfElectron gsf)
 
std::pair< float, float > gsfTrackProj (reco::GsfTrackRef gsf)
 
bool isConv ()
 
std::pair< float, float > SLCombZVtx (reco::Photon phot, bool &hasSL)
 
std::pair< float, float > TrackProj (bool isEb, reco::GsfTrackRef gsf, vector< edm::RefToBase< reco::Track > > &SLTracks, reco::ConversionRefVector &SLconversions)
 
virtual ~ggPFTracks ()
 

Private Attributes

Handle< BeamSpotbeamSpotHandle_
 
bool isConv_
 

Detailed Description

Definition at line 14 of file ggPFTracks.h.

Constructor & Destructor Documentation

ggPFTracks::ggPFTracks ( edm::Handle< BeamSpot > &  beamSpotHandle)
explicit

Definition at line 5 of file ggPFTracks.cc.

7  :
8  beamSpotHandle_(beamSpotHandle),//pass beamspot
9  isConv_(false)
10 {
11 
12 }
Handle< BeamSpot > beamSpotHandle_
Definition: ggPFTracks.h:65
bool isConv_
Definition: ggPFTracks.h:66
ggPFTracks::~ggPFTracks ( )
virtual

Definition at line 14 of file ggPFTracks.cc.

14 {}

Member Function Documentation

std::pair< float, float > ggPFTracks::BeamLineInt ( reco::SuperClusterRef  sc,
vector< edm::RefToBase< reco::Track > > &  Tracks,
reco::ConversionRefVector conversions,
vector< edm::RefToBase< reco::Track > > &  SLTracks,
reco::ConversionRefVector SLconversions 
)

Definition at line 50 of file ggPFTracks.cc.

References beamSpotHandle_, trackerHits::c, conv, edm::RefVector< C, T, F >::size(), slope, mathSSE::sqrt(), lumiQTWidget::t, X, reco::Vertex::x(), vdt::x, detailsBasic3DVector::y, reco::Vertex::y(), detailsBasic3DVector::z, and reco::Vertex::z().

Referenced by CombZVtx(), and SLCombZVtx().

56  {
57  std::pair<float,float> Zint(0,0);
58  TVector3 beamspot(beamSpotHandle_->position().x(),beamSpotHandle_->position().y(),
59  beamSpotHandle_->position().z());
60  TVector3 SCPos(sc->position().x()-beamspot[0], sc->position().y()-beamspot[1], sc->position().z()-beamspot[2]);
61  //find min Conversion radius for track pairs if they exist.
62  float convRMin=130;
63  float SLConvRMin=130;
64  int c_index=-1; int SLc_index=-1;
65  if(conversions.size()>0)
66  {
67  for(unsigned int c=0; c<conversions.size(); ++c){
68  float convR=sqrt(conversions[c]->conversionVertex().x()* conversions[c]->conversionVertex().x() + conversions[c]->conversionVertex().y()* conversions[c]->conversionVertex().y());
69  if(convRMin>convR){
70  convRMin=convR;
71  c_index=c;
72  }
73  }
74  }
75 
76  if(SLconversions.size()>0){
77  for(unsigned int SLc=0; SLc<SLconversions.size(); ++SLc){
78  std::vector<math::XYZPointF> innerPos=SLconversions[SLc]->tracksInnerPosition();
79  for (unsigned int t=0; t<innerPos.size(); t++){
80  float convR=sqrt( innerPos[t].X()* innerPos[t].X() + innerPos[t].Y()* innerPos[t].Y());
81 
82  if(SLConvRMin>convR){
83  SLc_index=SLc;
84  SLConvRMin=convR;
85 
86  }
87  }
88  }
89  }
90  TVector3 TkPos(beamspot[0],beamspot[1],beamspot[2]);
91  //take the smaller Radius:
92  if(convRMin<SLConvRMin && c_index>-1){
93  //point using Conversion Vertex
94  TkPos.SetXYZ(conversions[c_index]->conversionVertex().x()-beamspot[0],
95  conversions[c_index]->conversionVertex().y()-beamspot[1],
96  conversions[c_index]->conversionVertex().z()-beamspot[2] );
97  }
98  if(SLConvRMin<convRMin && SLc_index>-1){
99  reco::Vertex conv=SLconversions[SLc_index]->conversionVertex();
100  TkPos.SetXYZ(conv.x()-beamspot[0],
101  conv.y()-beamspot[1],
102  conv.z()-beamspot[2] );
103  }
104  //Intersection fromt the two points:
105  float R1=sqrt(SCPos.X()* SCPos.X() + SCPos.Y()*SCPos.Y());
106  float R2=sqrt(TkPos.X()* TkPos.X() + TkPos.Y()*TkPos.Y());
107  float Z1=SCPos.Z();
108  float Z2=TkPos.Z();
109  float slope=(Z1-Z2)/(R1-R2);
110  Zint.first=Z2 - R2*slope;
111  //determine error based on Tracking Region for conversion pairs:
112  float sigmaPix=0.06;
113  float sigmaTib=0.67;
114  float sigmaTob=2.04;
115  float sigmaFwd1=0.18;
116  float sigmaFwd2=0.61;
117  float sigmaFwd3=0.99;
118  //error of SL tracks of Conversion based on EB/EE and R>39 R<39 (4 cat)
119  float EBLR=0.24;
120  float EBHR=0.478;
121  float EELR=0.416;
122  float EEHR=0.888;
123  if(sc->eta()<1.4442){//Barrel
124  //if conversion
125  if(convRMin<SLConvRMin && c_index>-1){//3 tracking regions
126  if(convRMin<=15)Zint.second=sigmaPix;
127  else if(convRMin>15 && convRMin<=60)Zint.second=sigmaTib;
128  else Zint.second=sigmaTob;
129  }
130  //if SL
131  if(SLConvRMin<convRMin && SLc_index>-1){//2 tracking regions
132  if(SLConvRMin<39)Zint.second=EBLR;
133  else Zint.second=EBHR;
134  }
135  }
136  else{
137  //if conversion
138  if(convRMin<SLConvRMin && c_index>-1){//3 foreward tracking regions
139  float convz=conversions[c_index]->conversionVertex().z();
140  if(convz<=50)Zint.second=sigmaFwd1;
141  else if(convz>50 && convz<=60)Zint.second=sigmaFwd2;
142  else Zint.second=sigmaFwd3;
143  }
144  //if SL
145  if(SLConvRMin<convRMin && SLc_index>-1){//2 tracking regions based on R
146  if(SLConvRMin<39)Zint.second=EELR;
147  else Zint.second=EEHR;
148  }
149  }
150  return Zint;//return intersection at beamline and error in the pointing based on tracking region
151 }
Handle< BeamSpot > beamSpotHandle_
Definition: ggPFTracks.h:65
static HepMC::IO_HEPEVT conv
double y() const
y coordinate
Definition: Vertex.h:97
static const double slope[3]
#define X(str)
Definition: MuonsGrabber.cc:49
double double double z
T sqrt(T t)
Definition: SSEVec.h:46
double z() const
y coordinate
Definition: Vertex.h:99
double x() const
x coordinate
Definition: Vertex.h:95
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
x
Definition: VDTMath.h:216
std::pair< float, float > ggPFTracks::CombZVtx ( reco::SuperClusterRef  sc,
reco::GsfTrackRef  gsf,
vector< edm::RefToBase< reco::Track > > &  Tracks,
reco::ConversionRefVector conversions,
vector< edm::RefToBase< reco::Track > > &  SLTracks,
reco::ConversionRefVector SLconversions 
)

Definition at line 233 of file ggPFTracks.cc.

References BeamLineInt(), beamSpotHandle_, edm::Ref< C, T, F >::isNonnull(), mathSSE::sqrt(), TrackProj(), and Gflash::Z.

241  {
242  std::pair<float, float> combZ(0,0);
243  bool isEb;
244  TVector3 beamspot(beamSpotHandle_->position().x(),beamSpotHandle_->position().y(),
245  beamSpotHandle_->position().z());
246  if(fabs(sc->eta())<1.4442)isEb=true;
247  else isEb=false;
248  std::pair< float,float> SCZ=BeamLineInt(sc, Tracks, conversions,SLTracks, SLconversions);
249  std::pair<float, float> TkPjZ=TrackProj(isEb,gsf,SLTracks, SLconversions);
250  //errors in the two methods
251  float sigZProj=TkPjZ.second;
252  float sigSCPoint=SCZ.second;
253 
254  if(gsf.isNonnull()){combZ=TkPjZ; return combZ;}//for gsf Tracks just return track Proj
255  //weighted avg of the two methods, where weights are based on the error
256  float Z=((SCZ.first/(sigSCPoint*sigSCPoint))+ (TkPjZ.first/( sigZProj* sigZProj)))/(1/(sigSCPoint * sigSCPoint)+ 1/(sigZProj * sigZProj));
257  //total error sum of the two errors in quadrature
258  float sigZ=sqrt((sigSCPoint * sigSCPoint)+ (sigZProj * sigZProj));
259  combZ.first=Z; combZ.second=sigZ;
260  return combZ;
261 }
const double Z[kNumberCalorimeter]
Handle< BeamSpot > beamSpotHandle_
Definition: ggPFTracks.h:65
std::pair< float, float > BeamLineInt(reco::SuperClusterRef sc, vector< edm::RefToBase< reco::Track > > &Tracks, reco::ConversionRefVector &conversions, vector< edm::RefToBase< reco::Track > > &SLTracks, reco::ConversionRefVector &SLconversions)
Definition: ggPFTracks.cc:50
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
T sqrt(T t)
Definition: SSEVec.h:46
std::pair< float, float > TrackProj(bool isEb, reco::GsfTrackRef gsf, vector< edm::RefToBase< reco::Track > > &SLTracks, reco::ConversionRefVector &SLconversions)
Definition: ggPFTracks.cc:153
void ggPFTracks::getPFConvTracks ( reco::Photon  phot,
vector< edm::RefToBase< reco::Track > > &  Tracks,
reco::ConversionRefVector conversions,
vector< edm::RefToBase< reco::Track > > &  SLTracks,
reco::ConversionRefVector SLconversions 
)
virtual

Definition at line 16 of file ggPFTracks.cc.

References trackerHits::c, edm::RefVector< C, T, F >::clear(), reco::Photon::conversions(), reco::Photon::conversionsOneLeg(), isConv_, edm::RefVector< C, T, F >::push_back(), edm::RefVector< C, T, F >::size(), lumiQTWidget::t, and testEve_cfg::tracks.

Referenced by SLCombZVtx().

22  {
23  Tracks.clear();
24  conversions.clear();
25  SLTracks.clear();
26  SLconversions.clear();
27  conversions=phot.conversions();
28  //loop over conversion paris
29  for(unsigned int c=0; c<conversions.size(); ++c){
30  const std::vector<edm::RefToBase<reco::Track> > tracks = conversions[c]->tracks();
31  for (unsigned int t=0; t<tracks.size(); t++){
32  Tracks.push_back(tracks[t]);
33  }
34  }
35 
36  reco::ConversionRefVector SLConversions=phot.conversionsOneLeg();
37 
38  for(unsigned int SLc=0; SLc<SLConversions.size(); ++SLc){
39  const std::vector<edm::RefToBase<reco::Track> > tracks = SLConversions[SLc]->tracks();
40  SLconversions.push_back(SLConversions[SLc]);
41 
42  for (unsigned int t=0; t<tracks.size(); t++){
43  SLTracks.push_back(tracks[t]);
44  }
45  }
46  if(SLConversions.size()>0 || conversions.size()>0)isConv_=true;
47 }
reco::ConversionRefVector conversionsOneLeg() const
vector of references to one leg Conversion&#39;s
Definition: Photon.h:68
reco::ConversionRefVector conversions() const
vector of references to Conversion&#39;s
Definition: Photon.h:62
void clear()
Clear the vector.
Definition: RefVector.h:133
tuple tracks
Definition: testEve_cfg.py:39
bool isConv_
Definition: ggPFTracks.h:66
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
std::pair< float, float > ggPFTracks::gsfElectronProj ( reco::GsfElectron  gsf)

Definition at line 215 of file ggPFTracks.cc.

References funct::cos(), reco::GsfElectron::gsfTrack(), funct::sin(), mathSSE::sqrt(), funct::tan(), theta(), reco::GsfElectron::trackMomentumAtVtx(), reco::GsfElectron::trackPositionAtVtx(), and Gflash::Z.

Referenced by ggPFPhotons::SLPoint().

217  {
218  //if there is a gsf electron then use this for track projection Plenty of inner hits
219 
220  float theta =gsf.trackMomentumAtVtx().theta();
221 
222  float tkz=gsf.trackPositionAtVtx().Z();
223  float tkR=sqrt(gsf.trackPositionAtVtx().X()* gsf.trackPositionAtVtx().X()+ gsf.trackPositionAtVtx().Y()* gsf.trackPositionAtVtx().Y());
224  float thetErr=gsf.gsfTrack()->thetaError();
225  float Z=tkz-tkR/tan(theta);
226  float Zerr=((-1*(cos(theta)*cos(theta))/(sin(theta)* sin(theta))-1)*tkR*thetErr);
227  std::pair<float,float> ZProj(0,0);
228  ZProj.first=Z; ZProj.second=Zerr;
229  return ZProj;
230 
231 }
const double Z[kNumberCalorimeter]
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:272
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
T sqrt(T t)
Definition: SSEVec.h:46
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
math::XYZPointF trackPositionAtVtx() const
Definition: GsfElectron.h:270
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
std::pair< float, float > ggPFTracks::gsfTrackProj ( reco::GsfTrackRef  gsf)

Definition at line 197 of file ggPFTracks.cc.

References funct::cos(), funct::sin(), mathSSE::sqrt(), funct::tan(), theta(), and Gflash::Z.

Referenced by TrackProj().

199  {
200  //if there is a gsf track then use this for track projection Plenty of inner hits
201 
202  float theta =gsf->innerMomentum().theta();
203 
204  float tkz=gsf->innerPosition().Z();
205  float tkR=sqrt(gsf->innerPosition().X()* gsf->innerPosition().X()+ gsf->innerPosition().Y()* gsf->innerPosition().Y());
206  float thetErr=gsf->thetaError();
207  float Z=tkz-tkR/tan(theta);
208  float Zerr=((-1*(cos(theta)*cos(theta))/(sin(theta)* sin(theta))-1)*tkR*thetErr);
209  std::pair<float,float> ZProj(0,0);
210  ZProj.first=Z; ZProj.second=Zerr;
211  return ZProj;
212 
213 }
const double Z[kNumberCalorimeter]
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
T sqrt(T t)
Definition: SSEVec.h:46
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
bool ggPFTracks::isConv ( )
inline

Definition at line 60 of file ggPFTracks.h.

Referenced by ggPFPhotons::SLPoint().

60 {return isConv_;}
bool isConv_
Definition: ggPFTracks.h:66
std::pair< float, float > ggPFTracks::SLCombZVtx ( reco::Photon  phot,
bool &  hasSL 
)

Definition at line 264 of file ggPFTracks.cc.

References BeamLineInt(), beamSpotHandle_, convBrem_cff::convTracks, getPFConvTracks(), reco::Photon::isEB(), edm::RefVector< C, T, F >::size(), mathSSE::sqrt(), reco::Photon::superCluster(), TrackProj(), and Gflash::Z.

Referenced by ggPFPhotons::SLPoint().

267  {
268  std::pair<float, float> combZ(0,0);
269  TVector3 beamspot(beamSpotHandle_->position().x(),beamSpotHandle_->position().y(),
270  beamSpotHandle_->position().z());
271  bool isEb=phot.isEB();
272  //only want to use SL so the conversion pair variables will be dummy for the get function
273  vector<edm::RefToBase<reco::Track> >convTracks;
274  reco::ConversionRefVector pairConv;
275 
276  reco::ConversionRefVector SLConversions;
277  vector<edm::RefToBase<reco::Track> >SLTracks;
278  reco::GsfTrackRef gsfdummy;
279  getPFConvTracks(phot,convTracks,pairConv ,SLTracks,SLConversions);
280 
281  if(SLConversions.size()>0){
282  hasSL=true;
283  vector<edm::RefToBase<reco::Track> >dummy;
284  reco::ConversionRefVector pairdummy;
285  std::pair<float, float> TkPjZ=TrackProj(isEb,gsfdummy,SLTracks, SLConversions);
286  std::pair< float,float> SCZ=BeamLineInt(phot.superCluster(), dummy,pairdummy,SLTracks, SLConversions);
287  //errors in the two methods
288  float sigZProj=TkPjZ.second;
289  float sigSCPoint=SCZ.second;
290  //weighted avg of the two methods, where weights are based on the error
291  float Z=((SCZ.first/(sigSCPoint*sigSCPoint))+ (TkPjZ.first/(sigZProj * sigZProj)))/(1/(sigSCPoint*sigSCPoint)+ 1/(sigZProj * sigZProj));
292  //total error sum of the two errors in quadrature
293  float sigZ=sqrt((sigSCPoint*sigSCPoint)+ (sigZProj * sigZProj));
294  combZ.first=Z; combZ.second=sigZ;
295  }
296  else if(pairConv.size()>0){//else use Conversion pairs if available
297  std::pair< float,float> SCZ=BeamLineInt(phot.superCluster(),convTracks, pairConv, SLTracks, SLConversions);
298  combZ.first=SCZ.first;
299  combZ.second=SCZ.second;
300  hasSL=false;
301  }
302  else{//returns beamspot
303  combZ.first=beamspot.Z();
304  combZ.second=0;
305  hasSL=false;
306  }
307  return combZ;
308 }
const double Z[kNumberCalorimeter]
Handle< BeamSpot > beamSpotHandle_
Definition: ggPFTracks.h:65
tuple convTracks
Definition: convBrem_cff.py:35
virtual void getPFConvTracks(reco::Photon phot, vector< edm::RefToBase< reco::Track > > &Tracks, reco::ConversionRefVector &conversions, vector< edm::RefToBase< reco::Track > > &SLTracks, reco::ConversionRefVector &SLconversions)
Definition: ggPFTracks.cc:16
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
Definition: Photon.cc:59
std::pair< float, float > BeamLineInt(reco::SuperClusterRef sc, vector< edm::RefToBase< reco::Track > > &Tracks, reco::ConversionRefVector &conversions, vector< edm::RefToBase< reco::Track > > &SLTracks, reco::ConversionRefVector &SLconversions)
Definition: ggPFTracks.cc:50
T sqrt(T t)
Definition: SSEVec.h:46
std::pair< float, float > TrackProj(bool isEb, reco::GsfTrackRef gsf, vector< edm::RefToBase< reco::Track > > &SLTracks, reco::ConversionRefVector &SLconversions)
Definition: ggPFTracks.cc:153
bool isEB() const
Definition: Photon.h:118
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
std::pair< float, float > ggPFTracks::TrackProj ( bool  isEb,
reco::GsfTrackRef  gsf,
vector< edm::RefToBase< reco::Track > > &  SLTracks,
reco::ConversionRefVector SLconversions 
)

Definition at line 153 of file ggPFTracks.cc.

References conv, funct::cos(), gsfTrackProj(), edm::Ref< C, T, F >::isNonnull(), funct::sin(), edm::RefVector< C, T, F >::size(), mathSSE::sqrt(), funct::tan(), theta(), testEve_cfg::tracks, reco::Vertex::x(), reco::Vertex::y(), Gflash::Z, and reco::Vertex::z().

Referenced by CombZVtx(), and SLCombZVtx().

158  {
159  std::pair<float,float> ZProj(0,0);
160 
161  if(gsf.isNonnull()){//if there is a gsf track then use this for track projection Plenty of inner hits
162  ZProj=gsfTrackProj(gsf);
163  return ZProj;
164  }
165 
166  float minR=210;
167  int SLind=-1;
168  if(SLconversions.size()>0){//find track with min Radius (starts earliest)
169  for(unsigned int SLc=0; SLc<SLconversions.size(); ++SLc){
170  reco::Vertex conv=SLconversions[SLc]->conversionVertex();
171  float convR=sqrt( conv.x() * conv.x() + conv.y() * conv.y());
172  if(convR<minR){
173  minR=convR;
174  SLind=SLc;
175  }
176  }
177  reco::Vertex conv=SLconversions[SLind]->conversionVertex();
178  const std::vector<edm::RefToBase<reco::Track> > tracks = SLconversions[SLind]->tracks();
179  float theta =tracks[0]->theta();
180  float tkz=conv.z();
181  float tkR=sqrt( conv.x() * conv.x() + conv.y() * conv.y());
182  float thetErr=tracks[0]->thetaError();
183  float Z=tkz-tkR/tan(theta);//track projection
184  float Zerr=((-1*(cos(theta)*cos(theta))/(sin(theta)* sin(theta))-1)*tkR*thetErr); //projection error based on theta err of track theta derivative of the Zproj
185  //for early tracks theta error is very small so just hard code an error
186  //that is measured by looking at the track Proj resolutin in MC
187  if(tkR<39 && isEb)Zerr=0.234;
188  if(tkR<39 && !isEb)Zerr=0.341;
189  ZProj.first=Z; ZProj.second=Zerr;
190  return ZProj;
191  }
192  return ZProj;
193 }
const double Z[kNumberCalorimeter]
static HepMC::IO_HEPEVT conv
double y() const
y coordinate
Definition: Vertex.h:97
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
T sqrt(T t)
Definition: SSEVec.h:46
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double z() const
y coordinate
Definition: Vertex.h:99
std::pair< float, float > gsfTrackProj(reco::GsfTrackRef gsf)
Definition: ggPFTracks.cc:197
double x() const
x coordinate
Definition: Vertex.h:95
tuple tracks
Definition: testEve_cfg.py:39
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89

Member Data Documentation

Handle<BeamSpot> ggPFTracks::beamSpotHandle_
private

Definition at line 65 of file ggPFTracks.h.

Referenced by BeamLineInt(), CombZVtx(), and SLCombZVtx().

bool ggPFTracks::isConv_
private

Definition at line 66 of file ggPFTracks.h.

Referenced by getPFConvTracks().