ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/interface/TRootMCPhoton.h
Revision: 1.1
Committed: Wed Jul 2 16:22:18 2008 UTC (16 years, 10 months ago) by mlethuil
Content type: text/plain
Branch: MAIN
Log Message:
Converted Photons MC Truth

File Contents

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