ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/interface/TRootSuperCluster.h
Revision: 1.4
Committed: Mon Feb 9 16:10:09 2009 UTC (16 years, 2 months ago) by lethuill
Content type: text/plain
Branch: MAIN
CVS Tags: pat_2_1_12_02
Changes since 1.3: +15 -8 lines
Log Message:
Correct bug in SuperCluster <-> Seed Basic Cluster association

File Contents

# User Rev Content
1 mlethuil 1.1 #ifndef TRootSuperCluster_h
2     #define TRootSuperCluster_h
3    
4     /************************************************************************************************************************************
5     SuperCluster Type: ijk
6 lethuill 1.2 i = algo => 1=Island , 2=Hybrid, 3=multi5x5
7 mlethuil 1.1 j = detector => 1=ECAL Barrel , 2=ECAL Endcap
8 lethuill 1.2 k = corrections => 0=nopreshower / uncorrected , 1=no preshower / standard CMSSW corections
9     2=preshower / standard CMSSW corections , 3= preshower / uncorrected
10 mlethuil 1.1
11     110 => Island Barrel SuperClusters
12     120 => Island Endcap SuperClusters
13     121 => Corrected Island Endcap SuperClusters (standard CMSSW corrections)
14     122 => Corrected Island Endcap SuperClusters with Preshower (standard CMSSW corrections)
15     210 => Hybrid Barrel SuperClusters
16     211 => Corrected Hybrid Barrel SuperClusters (standard CMSSW corrections)
17 lethuill 1.2 320 => Multi5x5 Endcap SuperClusters
18     322 => Corrected Multi5x5 Endcap SuperClusters with Preshower (standard CMSSW corrections)
19     323 => Multi5x5 Endcap SuperClusters with Preshower
20    
21 mlethuil 1.1 ************************************************************************************************************************************/
22    
23     #include <string>
24     #include <iostream>
25 lethuill 1.2 #include <vector>
26 mlethuil 1.1
27     #include "Rtypes.h"
28    
29     #include "../interface/TRootCluster.h"
30    
31     using namespace std;
32    
33     class TRootSuperCluster : public TRootCluster
34     {
35    
36     public:
37    
38 lethuill 1.2 TRootSuperCluster() :
39     TRootCluster()
40     ,nBasicClusters_(0)
41     ,subClusterUID_()
42     ,subClusterIndex_()
43 lethuill 1.4 ,seedClusterVectorIndex_(-1)
44 lethuill 1.2 ,preshowerEnergy_(0.)
45     ,rawEnergy_(0.)
46 lethuill 1.3 ,photon_()
47     ,electron_()
48 lethuill 1.2 {;}
49    
50     TRootSuperCluster(const TRootSuperCluster& cluster) :
51     TRootCluster(cluster)
52     ,nBasicClusters_(cluster.nBasicClusters_)
53     ,subClusterUID_(cluster.subClusterUID_)
54     ,subClusterIndex_(cluster.subClusterIndex_)
55 lethuill 1.4 ,seedClusterVectorIndex_(cluster.seedClusterVectorIndex_)
56 lethuill 1.2 ,preshowerEnergy_(cluster.preshowerEnergy_)
57     ,rawEnergy_(cluster.rawEnergy_)
58 lethuill 1.3 ,photon_(cluster.photon_)
59     ,electron_(cluster.photon_)
60 lethuill 1.2 {;}
61    
62     TRootSuperCluster(Double_t energy, Double_t eta, Double_t phi) :
63     TRootCluster(energy, eta, phi)
64     ,nBasicClusters_(0)
65     ,subClusterUID_()
66     ,subClusterIndex_()
67 lethuill 1.4 ,seedClusterVectorIndex_(-1)
68 lethuill 1.2 ,preshowerEnergy_(0.)
69     ,rawEnergy_(0.)
70 lethuill 1.3 ,photon_()
71     ,electron_()
72 lethuill 1.2 {;}
73    
74     TRootSuperCluster(Double_t energy, Double_t eta, Double_t phi, Double_t x, Double_t y, Double_t z) :
75     TRootCluster(energy, eta, phi, x, y, z)
76     ,nBasicClusters_(0)
77     ,subClusterUID_()
78     ,subClusterIndex_()
79 lethuill 1.4 ,seedClusterVectorIndex_(-1)
80 lethuill 1.2 ,preshowerEnergy_(0.)
81     ,rawEnergy_(0.)
82 lethuill 1.3 ,photon_()
83     ,electron_()
84 lethuill 1.2 {;}
85    
86     TRootSuperCluster(Double_t energy, Double_t eta, Double_t phi, Double_t x, Double_t y, Double_t z, Int_t det) :
87     TRootCluster(energy, eta, phi, x, y, z, det)
88     ,nBasicClusters_(0)
89     ,subClusterUID_()
90     ,subClusterIndex_()
91 lethuill 1.4 ,seedClusterVectorIndex_(-1)
92 lethuill 1.2 ,preshowerEnergy_(0.)
93     ,rawEnergy_(0.)
94 lethuill 1.3 ,photon_()
95     ,electron_()
96 lethuill 1.2 {;}
97    
98 mlethuil 1.1 ~TRootSuperCluster() {;}
99    
100    
101     Int_t nBasicClusters() const { return nBasicClusters_; }
102     std::vector<Int_t> subClusterUID() const { return subClusterUID_; }
103     std::vector<Int_t> subClusterIndex() const { return subClusterIndex_; }
104 lethuill 1.4 Int_t seedIndex() const
105 mlethuil 1.1 {
106 lethuill 1.4 if( Int_t(subClusterIndex_.size())>seedClusterVectorIndex_)
107     {
108     return subClusterIndex_.at(seedClusterVectorIndex_);
109 mlethuil 1.1 }
110     else
111     {
112     cout << "No seed BasicCluster in this SuperCluster...." << endl;
113 lethuill 1.4 return -1;
114     }
115 mlethuil 1.1 }
116    
117 lethuill 1.2 Float_t preshowerEnergy() const { return preshowerEnergy_; }
118     Float_t rawEnergy() const { return rawEnergy_; }
119 lethuill 1.3 TObject* photon() const { return photon_.GetObject();}
120     TObject* electron() const { return electron_.GetObject();}
121     Bool_t isPhoton() const { return ( photon_.GetObject() == 0 ? false : true); }
122     Bool_t isElectron() const { return ( electron_.GetObject() == 0 ? false : true); }
123 lethuill 1.2
124 mlethuil 1.1 void setNBasicClusters(Int_t nBasicClusters) { nBasicClusters_ = nBasicClusters; }
125     void addSubClusterUID(Int_t uid) { subClusterUID_.push_back(uid); }
126     void clearSubClusterUID() { subClusterUID_.clear(); }
127     void addSubClusterIndex(Int_t idx) { subClusterIndex_.push_back(idx); }
128     void clearSubClusterIndex() { subClusterIndex_.clear(); }
129 lethuill 1.4 void setSeedClusterVectorIndex(Int_t seedClusterVectorIndex) { seedClusterVectorIndex_ = seedClusterVectorIndex; }
130 lethuill 1.2 void setPreshowerEnergy(Float_t preshowerEnergy) { preshowerEnergy_ = preshowerEnergy; }
131     void setRawEnergy(Float_t rawEnergy) { rawEnergy_ = rawEnergy; }
132 lethuill 1.3 void setPhoton(TObject* photon) { photon_ = photon; }
133     void setElectron(TObject* electron) { electron_ = electron; }
134 mlethuil 1.1
135    
136     friend std::ostream& operator<< (std::ostream& stream, const TRootSuperCluster& clus) {
137     stream << "TRootSuperCluster - Type=" << clus.det_ << " (E,Et,eta,phi)=(" << clus.Mag() <<"," << clus.Pt() <<"," << clus.Eta() <<"," << clus.Phi() << ")"
138     << " Calo position (x,y,z)=(" << clus.calX() << "," << clus.calY() << "," << clus.calZ() << ")"
139 lethuill 1.2 << " nBasicClusters=" << clus.nBasicClusters() << " e3x3=" << clus.e3x3() << " e5x5=" << clus.e5x5() << " eMax=" << clus.eMax()<< " e2nd=" << clus.e2nd()
140     << " nXtals=" << clus.nXtals() << " preshowerEnergy=" << clus.preshowerEnergy() << " rawEnergy=" << clus.rawEnergy();
141 mlethuil 1.1 return stream;
142     };
143    
144    
145    
146     protected:
147    
148     Int_t nBasicClusters_;
149     std::vector<Int_t> subClusterUID_;
150     std::vector<Int_t> subClusterIndex_;
151 lethuill 1.4 Int_t seedClusterVectorIndex_; // position in subClusterIndex_ vector containing the index of the seed basic cluster in the TRootBasicCluster array
152 lethuill 1.2 Float_t preshowerEnergy_;
153     Float_t rawEnergy_;
154 lethuill 1.3 TRef photon_;
155     TRef electron_;
156 mlethuil 1.1
157 lethuill 1.4
158     ClassDef (TRootSuperCluster,5);
159 mlethuil 1.1 };
160    
161     #endif