ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/interface/TRootCluster.h
Revision: 1.5
Committed: Mon Jun 29 14:52:52 2009 UTC (15 years, 10 months ago) by lethuill
Content type: text/plain
Branch: MAIN
CVS Tags: all_2_2_9_03, all_2_2_9_02
Branch point for: CMSSW_2_2_X_br
Changes since 1.4: +17 -3 lines
Log Message:
Complete photons/electrons <-> Superclusters <-> Basic Clusters navigation via TRef or Indices

File Contents

# User Rev Content
1 mlethuil 1.1 #ifndef TRootCluster_h
2     #define TRootCluster_h
3    
4     /************************************************************************************************************************************
5 lethuill 1.4 Cluster Type: ijk
6     i = algo => 1=Island , 2=Hybrid, 3=multi5x5
7     j = detector => 1=ECAL Barrel , 2=ECAL Endcap
8     k = corrections => 0=nopreshower / uncorrected , 1=no preshower / standard CMSSW corections
9     2=preshower / standard CMSSW corections , 3= preshower / uncorrected
10    
11     BasicClusters
12     110 => Island Barrel BasicClusters
13     120 => Island Endcap BasicClusters
14     210 => hybrid Barrel BasicClusters
15     320 => multi5x5 Endcap BasicClusters
16    
17     SuperClusters
18     110 => Island Barrel SuperClusters
19     120 => Island Endcap SuperClusters
20     121 => Corrected Island Endcap SuperClusters (standard CMSSW corrections)
21     122 => Corrected Island Endcap SuperClusters with Preshower (standard CMSSW corrections)
22     210 => Hybrid Barrel SuperClusters
23     211 => Corrected Hybrid Barrel SuperClusters (standard CMSSW corrections)
24     320 => Multi5x5 Endcap SuperClusters
25     322 => Corrected Multi5x5 Endcap SuperClusters with Preshower (standard CMSSW corrections)
26     323 => Multi5x5 Endcap SuperClusters with Preshower
27    
28     Shapes variables (e3x3, e5x5, eMax, e2nd) are not modified by CMSSW energy corrections
29     Shapes variables for SuperClusters correspond to shapes variables of the seed BasicCluster
30 mlethuil 1.1
31     ************************************************************************************************************************************/
32    
33     #include <string>
34     #include <iostream>
35    
36     #include "Rtypes.h"
37     #include "TVector3.h"
38 lethuill 1.2 #include "TMath.h"
39 lethuill 1.3 #include "TRef.h"
40 mlethuil 1.1
41     using namespace std;
42    
43     class TRootCluster : public TVector3
44     {
45    
46 lethuill 1.4 public:
47    
48     TRootCluster() : TVector3(), position_(), det_(-1), e3x3_(0.), e5x5_(0.), eMax_(0.), e2nd_(0.), nXtals_(0), uid_(0) {;}
49     TRootCluster(const TRootCluster& cluster) : TVector3(cluster), position_(cluster.position_), det_(cluster.det_),
50     e3x3_(cluster.e3x3_), e5x5_(cluster.e5x5_), eMax_(cluster.eMax_), e2nd_(cluster.e2nd_), nXtals_(cluster.nXtals_), uid_(cluster.uid_) {;}
51     TRootCluster(Double_t energy, Double_t eta, Double_t phi) : position_(), det_(-1), e3x3_(0.), e5x5_(0.), eMax_(0.), e2nd_(0.), nXtals_(0), uid_(0)
52     {
53     this->SetPtEtaPhi(energy*TMath::Sin(2.0*TMath::ATan(TMath::Exp(-eta))), eta, phi);
54     }
55    
56     TRootCluster(Double_t energy, Double_t eta, Double_t phi, Double_t x, Double_t y, Double_t z) :
57     position_(x,y,z), det_(-1), e3x3_(0.), e5x5_(0.), eMax_(0.), e2nd_(0.), nXtals_(0), uid_(0)
58     {
59     this->SetPtEtaPhi(energy*TMath::Sin(2.0*TMath::ATan(TMath::Exp(-eta))), eta, phi);
60     }
61    
62     TRootCluster(Double_t energy, Double_t eta, Double_t phi, Double_t x, Double_t y, Double_t z, Int_t det) :
63     position_(x,y,z), det_(det), e3x3_(0.), e5x5_(0.), eMax_(0.), e2nd_(0.), nXtals_(0), uid_(0)
64     {
65     this->SetPtEtaPhi(energy*TMath::Sin(2.0*TMath::ATan(TMath::Exp(-eta))), eta, phi);
66     }
67    
68     TRootCluster(const TVector3 &momentum) : TVector3(momentum), position_(), det_(-1), e3x3_(0.), e5x5_(0.), eMax_(0.), e2nd_(0.), nXtals_(0), uid_(0) {;}
69     TRootCluster(const TVector3 &momentum, const TVector3 &position, Int_t det) : TVector3(momentum), position_(position), det_(det), e3x3_(0.), e5x5_(0.), eMax_(0.), e2nd_(0.), nXtals_(0), uid_(0) {;}
70     ~TRootCluster() {;}
71    
72    
73     Double_t calX() const { return position_.x(); }
74     Double_t calY() const { return position_.y(); }
75     Double_t calZ() const { return position_.z(); }
76     Int_t det() const { return det_; }
77     Int_t type() const { return det_; }
78     Double_t e3x3() const { return e3x3_; }
79     Double_t e5x5() const { return e5x5_; }
80     Double_t eMax() const { return eMax_; }
81     Double_t e2nd() const { return e2nd_; }
82     Int_t nXtals() const { return nXtals_; }
83     Int_t uid() const { return uid_; }
84 lethuill 1.5 TString typeName() const {
85     if ( det_==110 ) return "Island Barrel BC";
86     else if ( det_==120 ) return "Island Endcap BC";
87     else if ( det_==210 ) return "Hybrid Barrel BC";
88     else if ( det_==320 ) return "Multi5x5 Endcap BC";
89     else return "Unknown type SC";
90     }
91    
92 lethuill 1.4 void setCalX(Double_t x) { position_.SetX(x); }
93     void setCalY(Double_t y) { position_.SetY(y); }
94     void setCalZ(Double_t z) { position_.SetZ(z); }
95     void setDet(Int_t det) { det_ = det; }
96     void setType(Int_t det) { det_ = det; }
97     void setE3x3(Double_t e3x3) { e3x3_ = e3x3; }
98     void setE5x5(Double_t e5x5) { e5x5_ = e5x5; }
99     void setEmax(Double_t eMax) { eMax_ = eMax; }
100     void setE2nd(Double_t e2nd) { e2nd_ = e2nd; }
101     void setNxtals(Int_t nXtals) { nXtals_ = nXtals; }
102     void setUid(Int_t uid) { uid_ = uid; }
103    
104    
105 lethuill 1.5 friend std::ostream& operator<< (std::ostream& stream, const TRootCluster& clus)
106     {
107 lethuill 1.4 stream << "TRootCluster - Type=" << clus.det() << " (E,Et,eta,phi)=(" << clus.Mag() <<"," << clus.Pt() <<"," << clus.Eta() <<"," << clus.Phi() << ")"
108     << " Calo position (x,y,z)=(" << clus.calX() << "," << clus.calY() << "," << clus.calZ() << ")"
109     << " e3x3=" << clus.e3x3() << " e5x5=" << clus.e5x5() << " eMax=" << clus.eMax()<< " e2nd=" << clus.e2nd() << " nXtals=" << clus.nXtals();
110     return stream;
111     };
112    
113 lethuill 1.5 void Print()
114     {
115     std::cout << "TRootCluster - Type=" << this->det() << " (E,Et,eta,phi)=(" << this->Mag() <<"," << this->Pt() <<"," << this->Eta() <<"," << this->Phi() << ")"
116     << " Calo position (x,y,z)=(" << this->calX() << "," << this->calY() << "," << this->calZ() << ")"
117     << " e3x3=" << this->e3x3() << " e5x5=" << this->e5x5() << " eMax=" << this->eMax()<< " e2nd=" << this->e2nd() << " nXtals=" << this->nXtals();
118     };
119 lethuill 1.4
120 lethuill 1.5
121 lethuill 1.4 protected:
122    
123     TVector3 position_;
124     Int_t det_;
125     Double_t e3x3_;
126     Double_t e5x5_;
127     Double_t eMax_;
128     Double_t e2nd_;
129     Int_t nXtals_;
130     Int_t uid_;
131    
132     ClassDef (TRootCluster,2);
133 mlethuil 1.1
134     };
135    
136     #endif