ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/interface/TRootMCPhoton.h
Revision: 1.6
Committed: Wed Jun 10 11:17:06 2009 UTC (15 years, 10 months ago) by lethuill
Content type: text/plain
Branch: MAIN
CVS Tags: all_3_3_2_01, all_3_2_5_02, all_3_2_5_01, all_2_2_9_03, all_2_2_9_02, all_2_2_9_01, HEAD
Branch point for: CMSSW_2_2_X_br
Changes since 1.5: +146 -145 lines
Error occurred while calculating annotation data.
Log Message:
Better protection against missing collection / Cleaning data format selection / Last iteration for migration to PAT of Photons

File Contents

# Content
1 #ifndef TRootMCPhoton_h
2 #define TRootMCPhoton_h
3
4 #include <vector>
5
6 #include "../interface/TRootParticle.h"
7
8 using namespace std;
9
10 class TRootMCPhoton : public TRootParticle
11 {
12
13 public:
14
15 TRootMCPhoton() :
16 TRootParticle()
17 ,convVertex_()
18 ,tracks_(0)
19 , recoPhotonIndex_(-1)
20 {;}
21
22 TRootMCPhoton(const TRootMCPhoton& photon) :
23 TRootParticle(photon)
24 ,convVertex_(photon.convVertex_)
25 ,tracks_(photon.tracks_)
26 , recoPhotonIndex_(photon.recoPhotonIndex_)
27 {;}
28
29 TRootMCPhoton(Double_t px, Double_t py, Double_t pz, Double_t e) :
30 TRootParticle(px,py,pz,e)
31 ,convVertex_()
32 ,tracks_(0)
33 , recoPhotonIndex_(-1)
34 {;}
35
36 TRootMCPhoton(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vtx_x, Double_t vtx_y, Double_t vtx_z) :
37 TRootParticle(px,py,pz,e,vtx_x,vtx_y,vtx_z)
38 ,convVertex_()
39 ,tracks_(0)
40 , recoPhotonIndex_(-1)
41 {;}
42
43 TRootMCPhoton(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vtx_x, Double_t vtx_y, Double_t vtx_z, Int_t type, Float_t charge) :
44 TRootParticle(px,py,pz,e,vtx_x,vtx_y,vtx_z,type,charge)
45 ,convVertex_()
46 ,tracks_(0)
47 , recoPhotonIndex_(-1)
48 {;}
49
50 TRootMCPhoton(const TLorentzVector &momentum) :
51 TRootParticle(momentum)
52 ,convVertex_()
53 ,tracks_(0)
54 , recoPhotonIndex_(-1)
55 {;}
56
57 TRootMCPhoton(const TLorentzVector &momentum, const TVector3 &vertex, Int_t type, Float_t charge) :
58 TRootParticle(momentum, vertex, type, charge)
59 ,convVertex_()
60 ,tracks_(0)
61 , recoPhotonIndex_(-1)
62 {;}
63
64 TRootMCPhoton(const TLorentzVector &momentum, const TVector3 &vertex, const TVector3 &convVertex, Int_t type, Float_t charge) :
65 TRootParticle(momentum, vertex, type, charge)
66 ,convVertex_()
67 ,tracks_(0)
68 , recoPhotonIndex_(-1)
69 {;}
70
71 TRootMCPhoton(const TLorentzVector &momentum, const TVector3 &vertex, const TVector3 &convVertex, const std::vector<TLorentzVector> &tracks, Int_t type, Float_t charge) :
72 TRootParticle(momentum, vertex, type, charge)
73 ,convVertex_(convVertex)
74 ,tracks_(tracks)
75 , recoPhotonIndex_(-1)
76 {;}
77
78
79 ~TRootMCPhoton() {;}
80
81
82 unsigned int nTracks() const { return tracks_.size(); }
83
84 Float_t convEoverP() const
85 {
86 Float_t ptot = -1.;
87 if (tracks_.size()==2)
88 {
89 TLorentzVector pair = tracks_.at(0) + tracks_.at(1);
90 ptot = ( pair.P()>0 ? this->E() / pair.P() : -1. );
91 }
92 return ptot;
93 }
94
95 Float_t convMass() const
96 {
97 Float_t mass = -1.;
98 if (tracks_.size()==2)
99 {
100 TLorentzVector pair = tracks_.at(0) + tracks_.at(1);
101 mass = pair.M();
102 }
103 return mass;
104 }
105
106 Float_t convDeltaCotanTheta() const
107 {
108 Float_t cotan = -999.;
109 if (tracks_.size()==2)
110 {
111 if ( tan(tracks_.at(0).Theta()) != 0 && tan(tracks_.at(1).Theta()) != 0 ) cotan = 1./ tan(tracks_.at(0).Theta()) - 1./ tan(tracks_.at(1).Theta());
112 }
113 return cotan;
114 }
115
116 Float_t convPtOverEt() const
117 {
118 Float_t pe = -1.;
119 if (tracks_.size()==2)
120 {
121 TLorentzVector pair = tracks_.at(0) + tracks_.at(1);
122 pe = pair.Pt() / this->Et();
123 }
124 return pe;
125 }
126
127
128 TVector3 convVertex() const { return convVertex_;}
129 Double_t conv_vx() const { return convVertex_.x(); }
130 Double_t conv_vy() const { return convVertex_.y(); }
131 Double_t conv_vz() const { return convVertex_.z(); }
132
133 std::vector<TLorentzVector> tracks() const { return tracks_;}
134 Int_t recoPhotonIndex() const { return recoPhotonIndex_;}
135 virtual TString typeName() const { return "TRootMCPhoton"; }
136
137 void setConvVertex(TVector3 convVertex) { convVertex_=convVertex; }
138 void setConvVertex(Double_t x, Double_t y, Double_t z) { convVertex_.SetXYZ(x, y ,z); }
139 void setTracks(std::vector<TLorentzVector> tracks) { tracks_=tracks; }
140 void setRecoPhotonIndex(Int_t recoPhotonIndex) { recoPhotonIndex_=recoPhotonIndex; }
141
142
143 friend std::ostream& operator<< (std::ostream& stream, const TRootMCPhoton& photon) {
144 stream << "Converted TRootMCPhoton (Et,eta,phi)=("<< photon.Et() <<","<< photon.Eta() <<","<< photon.Phi() << ")"
145 << " photon vertex=("<< photon.vx() <<","<< photon.vy() <<","<< photon.vz() << ")"
146 << " conversion vertex=("<< photon.conv_vx() <<","<< photon.conv_vy() <<","<< photon.conv_vz() << ")";
147 return stream;
148 };
149
150
151 private:
152
153 TVector3 convVertex_; // Position of the conversion vertex
154 std::vector<TLorentzVector> tracks_; // Tracks from the conversion
155 Int_t recoPhotonIndex_; // Index of first conversion track (in tracks TCloneArray)
156
157 ClassDef (TRootMCPhoton,1);
158
159 };
160
161 #endif