ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/interface/TRootSuperCluster.h
(Generate patch)

Comparing UserCode/Morgan/interface/TRootSuperCluster.h (file contents):
Revision 1.5 by lethuill, Wed Mar 11 12:44:56 2009 UTC vs.
Revision 1.7 by lethuill, Mon Jun 29 14:52:52 2009 UTC

# Line 2 | Line 2
2   #define TRootSuperCluster_h
3  
4   /************************************************************************************************************************************
5 <        SuperCluster 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 <        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 <        320 => Multi5x5 Endcap SuperClusters
18 <        322 => Corrected Multi5x5 Endcap SuperClusters with Preshower (standard CMSSW corrections)
19 <        323 => Multi5x5 Endcap SuperClusters with Preshower
20 <                
5 >   SuperCluster 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 >   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 >   320 => Multi5x5 Endcap SuperClusters
18 >   322 => Corrected Multi5x5 Endcap SuperClusters with Preshower (standard CMSSW corrections)
19 >   323 => Multi5x5 Endcap SuperClusters with Preshower
20 >
21   ************************************************************************************************************************************/
22  
23   #include <string>
# Line 30 | Line 30
30  
31   using namespace std;
32  
33 + class TRootPhoton;
34 + class TRootElectron;
35 +
36   class TRootSuperCluster : public TRootCluster
37   {
35        
36 public:
37        
38        TRootSuperCluster() :
39                TRootCluster()
40                ,nBasicClusters_(0)
41                ,subClusterUID_()
42                ,subClusterIndex_()
43                ,seedClusterVectorIndex_(-1)
44                ,preshowerEnergy_(0.)
45                ,rawEnergy_(0.)
46                ,seedCluster_(0)
47                ,photon_(0)
48                ,electron_(0)
49                {;}
50
51        TRootSuperCluster(const TRootSuperCluster& cluster) :
52                TRootCluster(cluster)
53                ,nBasicClusters_(cluster.nBasicClusters_)
54                ,subClusterUID_(cluster.subClusterUID_)
55                ,subClusterIndex_(cluster.subClusterIndex_)
56                ,seedClusterVectorIndex_(cluster.seedClusterVectorIndex_)
57                ,preshowerEnergy_(cluster.preshowerEnergy_)
58                ,rawEnergy_(cluster.rawEnergy_)
59                ,seedCluster_(cluster.seedCluster_)
60                ,photon_(cluster.photon_)
61                ,electron_(cluster.photon_)
62                {;}
63
64        TRootSuperCluster(Double_t energy, Double_t eta, Double_t phi) :
65                TRootCluster(energy, eta, phi)
66                ,nBasicClusters_(0)
67                ,subClusterUID_()
68                ,subClusterIndex_()
69                ,seedClusterVectorIndex_(-1)
70                ,preshowerEnergy_(0.)
71                ,rawEnergy_(0.)
72                ,seedCluster_(0)
73                ,photon_(0)
74                ,electron_(0)
75                {;}
76
77        TRootSuperCluster(Double_t energy, Double_t eta, Double_t phi, Double_t x, Double_t y, Double_t z) :
78                TRootCluster(energy, eta, phi, x, y, z)
79                ,nBasicClusters_(0)
80                ,subClusterUID_()
81                ,subClusterIndex_()
82                ,seedClusterVectorIndex_(-1)
83                ,preshowerEnergy_(0.)
84                ,rawEnergy_(0.)
85                ,seedCluster_(0)
86                ,photon_(0)
87                ,electron_(0)
88                {;}
89
90        TRootSuperCluster(Double_t energy, Double_t eta, Double_t phi, Double_t x, Double_t y, Double_t z, Int_t det) :
91                TRootCluster(energy, eta, phi, x, y, z, det)
92                ,nBasicClusters_(0)
93                ,subClusterUID_()
94                ,subClusterIndex_()
95                ,seedClusterVectorIndex_(-1)
96                ,preshowerEnergy_(0.)
97                ,rawEnergy_(0.)
98                ,seedCluster_(0)
99                ,photon_(0)
100                ,electron_(0)
101                {;}
102
103        ~TRootSuperCluster() {;}
104
105        
106        Int_t nBasicClusters() const   { return nBasicClusters_; }
107        std::vector<Int_t> subClusterUID() const { return subClusterUID_; }
108        std::vector<Int_t> subClusterIndex() const { return subClusterIndex_; }
109        Int_t seedIndex() const
110        {
111                if( Int_t(subClusterIndex_.size())>seedClusterVectorIndex_)
112                {
113                        return subClusterIndex_.at(seedClusterVectorIndex_);
114                }
115                else
116                {
117                        cout << "No seed BasicCluster in this SuperCluster...." << endl;
118                        return -1;
119                }
120        }
121        
122        Float_t preshowerEnergy() const   { return preshowerEnergy_; }
123        Float_t rawEnergy() const   { return rawEnergy_; }
124        TObject* seedCluster() const  { return seedCluster_.GetObject();}
125        TObject* photon() const  { return photon_.GetObject();}
126        TObject* electron() const  { return electron_.GetObject();}
127        Bool_t isPhoton() const { return ( photon_.GetObject() == 0 ? false : true); }
128        Bool_t isElectron() const { return ( electron_.GetObject() == 0 ? false : true); }
129
130        void setNBasicClusters(Int_t nBasicClusters) { nBasicClusters_ = nBasicClusters; }
131        void addSubClusterUID(Int_t uid) { subClusterUID_.push_back(uid); }
132        void clearSubClusterUID() { subClusterUID_.clear(); }
133        void addSubClusterIndex(Int_t idx) { subClusterIndex_.push_back(idx); }
134        void clearSubClusterIndex() { subClusterIndex_.clear(); }
135        void setSeedClusterVectorIndex(Int_t  seedClusterVectorIndex) { seedClusterVectorIndex_ = seedClusterVectorIndex; }
136        void setPreshowerEnergy(Float_t preshowerEnergy) { preshowerEnergy_ = preshowerEnergy; }
137        void setRawEnergy(Float_t rawEnergy) { rawEnergy_ = rawEnergy; }
138        void setSeedCluster(TObject* seedCluster) { seedCluster_ = seedCluster; }
139        void setPhoton(TObject* photon) { photon_ = photon; }
140        void setElectron(TObject* electron) { electron_ = electron; }
141
142
143        friend std::ostream& operator<< (std::ostream& stream, const TRootSuperCluster& clus) {
144                stream << "TRootSuperCluster - Type=" << clus.det_ << "  (E,Et,eta,phi)=(" << clus.Mag() <<"," << clus.Pt() <<"," << clus.Eta() <<"," << clus.Phi() << ")"
145                                << " Calo position (x,y,z)=(" << clus.calX() << "," << clus.calY() << "," << clus.calZ() << ")"
146                                << " nBasicClusters=" << clus.nBasicClusters() << " e3x3=" << clus.e3x3() << " e5x5=" << clus.e5x5() << " eMax=" << clus.eMax()<< " e2nd=" << clus.e2nd()
147                                << " nXtals=" << clus.nXtals() << " preshowerEnergy=" << clus.preshowerEnergy() << " rawEnergy=" << clus.rawEnergy();
148                return stream;
149        };
150        
151        
152                
153 protected:
154        
155        Int_t nBasicClusters_;
156        std::vector<Int_t> subClusterUID_;
157        std::vector<Int_t> subClusterIndex_;
158        Int_t seedClusterVectorIndex_; // position in subClusterIndex_ vector containing the index of the seed basic cluster in the TRootBasicCluster array
159        Float_t preshowerEnergy_;
160        Float_t rawEnergy_;
161        TRef seedCluster_;
162        TRef photon_;
163        TRef electron_;
38  
39 <        
40 <        ClassDef (TRootSuperCluster,5);
39 >   public:
40 >
41 >      TRootSuperCluster() :
42 >      TRootCluster()
43 >      ,rawEnergy_(-1.)
44 >      ,preshowerEnergy_(-1.)
45 >      ,nBasicClusters_(-1)
46 >      ,subBasicClusterUIDVector_()
47 >      ,subBasicClusterIndexVector_()
48 >      ,seedBasicClusterVectorIndex_(-1)
49 >      ,subBasicClusterRefVector_()
50 >      ,seedBasicCluster_(0)
51 >      ,photonIndex_(-1)
52 >      ,photon_(0)
53 >      ,electronIndex_(-1)
54 >      ,electron_(0)
55 >      {;}
56 >
57 >      TRootSuperCluster(const TRootSuperCluster& cluster) :
58 >      TRootCluster(cluster)
59 >      ,rawEnergy_(cluster.rawEnergy_)
60 >      ,preshowerEnergy_(cluster.preshowerEnergy_)
61 >      ,nBasicClusters_(cluster.nBasicClusters_)
62 >      ,subBasicClusterUIDVector_(cluster.subBasicClusterUIDVector_)
63 >      ,subBasicClusterIndexVector_(cluster.subBasicClusterIndexVector_)
64 >      ,seedBasicClusterVectorIndex_(cluster.seedBasicClusterVectorIndex_)
65 >      ,subBasicClusterRefVector_(cluster.subBasicClusterRefVector_)
66 >      ,seedBasicCluster_(cluster.seedBasicCluster_)
67 >      ,photonIndex_(cluster.photonIndex_)
68 >      ,photon_(cluster.photon_)
69 >      ,electronIndex_(cluster.electronIndex_)
70 >      ,electron_(cluster.photon_)
71 >      {;}
72 >
73 >      TRootSuperCluster(Double_t energy, Double_t eta, Double_t phi) :
74 >      TRootCluster(energy, eta, phi)
75 >      ,rawEnergy_(0.)
76 >      ,preshowerEnergy_(0.)
77 >      ,nBasicClusters_(0)
78 >      ,subBasicClusterUIDVector_()
79 >      ,subBasicClusterIndexVector_()
80 >      ,seedBasicClusterVectorIndex_(-1)
81 >      ,subBasicClusterRefVector_()
82 >      ,seedBasicCluster_(0)
83 >      ,photonIndex_(-1)
84 >      ,photon_(0)
85 >      ,electronIndex_(-1)
86 >      ,electron_(0)
87 >      {;}
88 >      
89 >      TRootSuperCluster(Double_t energy, Double_t eta, Double_t phi, Double_t x, Double_t y, Double_t z) :
90 >      TRootCluster(energy, eta, phi, x, y, z)
91 >      ,rawEnergy_(0.)
92 >      ,preshowerEnergy_(0.)
93 >      ,nBasicClusters_(0)
94 >      ,subBasicClusterUIDVector_()
95 >      ,subBasicClusterIndexVector_()
96 >      ,seedBasicClusterVectorIndex_(-1)
97 >      ,subBasicClusterRefVector_()
98 >      ,seedBasicCluster_(0)
99 >      ,photonIndex_(-1)
100 >      ,photon_(0)
101 >      ,electronIndex_(-1)
102 >      ,electron_(0)
103 >      {;}
104 >      
105 >      TRootSuperCluster(Double_t energy, Double_t eta, Double_t phi, Double_t x, Double_t y, Double_t z, Int_t det) :
106 >      TRootCluster(energy, eta, phi, x, y, z, det)
107 >      ,rawEnergy_(0.)
108 >      ,preshowerEnergy_(0.)
109 >      ,nBasicClusters_(0)
110 >      ,subBasicClusterUIDVector_()
111 >      ,subBasicClusterIndexVector_()
112 >      ,seedBasicClusterVectorIndex_(-1)
113 >      ,subBasicClusterRefVector_()
114 >      ,seedBasicCluster_(0)
115 >      ,photonIndex_(-1)
116 >      ,photon_(0)
117 >      ,electronIndex_(-1)
118 >      ,electron_(0)
119 >      {;}
120 >      
121 >      ~TRootSuperCluster() {;}
122 >      
123 >      // ECAL Raw Energy
124 >      Float_t rawEnergy() const   { return rawEnergy_; }
125 >
126 >      // Preshower Energy
127 >      Float_t preshowerEnergy() const   { return preshowerEnergy_; }
128 >
129 >      // Number of  Basic Cluster constituents
130 >      Int_t nBasicClusters() const   { return nBasicClusters_; }
131 >
132 >      // UIDs of the Basic Cluster constituents
133 >      std::vector<Int_t> subBasicClusterUIDVector() const { return subBasicClusterUIDVector_; }
134 >
135 >      // Indexes in TCloneArray ("BasicClusters" branch) of the Basic Cluster constituents
136 >      std::vector<Int_t> subBasicClusterIndexVector() const { return subBasicClusterIndexVector_; }
137 >
138 >      // Index in TCloneArray ("BasicClusters" branch) of the seed Basic Cluster
139 >      Int_t seedBasicClusterIndex() const
140 >      {
141 >         if( Int_t(subBasicClusterIndexVector_.size())>seedBasicClusterVectorIndex_)
142 >         {
143 >            return subBasicClusterIndexVector_.at(seedBasicClusterVectorIndex_);
144 >         }
145 >         else
146 >         {
147 >            cout << "No seed BasicCluster in this SuperCluster...." << endl;
148 >            return -1;
149 >         }
150 >      }
151 >      
152 >      // Get the ith Basic Cluster constituent stocked in subBasicClusterRefVector_
153 >      TRootCluster* subBasicClusterAt(UInt_t index) const
154 >      {
155 >         if ( index>=subBasicClusterRefVector_.size())
156 >         {
157 >            return 0;
158 >         }
159 >         else
160 >         {
161 >            return (TRootCluster*) subBasicClusterRefVector_.at(index).GetObject();
162 >         }
163 >      }
164 >      
165 >      // Get the vector containing the references to Basic Cluster constituent
166 >      std::vector<TRef> subBasicClusterRefVector() const { return subBasicClusterRefVector_; }
167 >      
168 >      // Get the seed Basic Cluster
169 >      TRootCluster* seedBasicCluster() const  { return (TRootCluster*) seedBasicCluster_.GetObject();}
170 >
171 >      // Index in TCloneArray ("Photons" branch) of the possible associated photon
172 >      Int_t photonIndex() const   { return photonIndex_; }
173 >
174 >      // Get possible associated photon
175 >      TRootPhoton* photon() const  { return (TRootPhoton*) photon_.GetObject();}
176 >
177 >      // Index in TCloneArray ("Electrons" branch) of the possible associated electron
178 >      Int_t electronIndex() const   { return electronIndex_; }
179 >
180 >      // Get possible associated electron
181 >      TRootElectron* electron() const  { return (TRootElectron*) electron_.GetObject();}
182 >      
183 >      // is associated to a photon ?
184 >      Bool_t isPhoton() const { return ( photon_.GetObject() == 0 ? false : true); }
185 >
186 >      // is associated to an electron ?
187 >      Bool_t isElectron() const { return ( electron_.GetObject() == 0 ? false : true); }
188 >
189 >      // Name of the clustering algorithm
190 >      TString typeName() const
191 >      {
192 >         if ( det_==110 ) return "Island Barrel SC";
193 >         else if ( det_==120 ) return "Island Endcap SC";
194 >         else if ( det_==121 ) return "Corrected Island Endcap SC";
195 >         else if ( det_==122 ) return "Corrected Island Endcap with Preshower SC";
196 >         else if ( det_==210 ) return "Hybrid Barrel SC";
197 >         else if ( det_==211 ) return "Corrected Hybrid Barrel SC";
198 >         else if ( det_==320 ) return "Multi5x5 Endcap SC";
199 >         else if ( det_==322 ) return "Corrected Multi5x5 Endcap with Preshower SC";
200 >         else if ( det_==323 ) return "Multi5x5 Endcap with Preshower SC";
201 >         else return "Unknown type SC";
202 >      }
203 >      
204 >      void setRawEnergy(Float_t rawEnergy) { rawEnergy_ = rawEnergy; }
205 >      void setPreshowerEnergy(Float_t preshowerEnergy) { preshowerEnergy_ = preshowerEnergy; }
206 >      void setNBasicClusters(Int_t nBasicClusters) { nBasicClusters_ = nBasicClusters; }
207 >      void addSubBasicClusterUID(Int_t uid) { subBasicClusterUIDVector_.push_back(uid); }
208 >      void clearSubBasicClusterUID() { subBasicClusterUIDVector_.clear(); }
209 >      void addSubBasicClusterIndex(Int_t idx) { subBasicClusterIndexVector_.push_back(idx); }
210 >      void clearSubBasicClusterIndex() { subBasicClusterIndexVector_.clear(); }
211 >      void setSeedBasicClusterVectorIndex(Int_t  seedBasicClusterVectorIndex) { seedBasicClusterVectorIndex_ = seedBasicClusterVectorIndex; }
212 >      void addSubBasicCluster(TObject* subBasicCluster) { subBasicClusterRefVector_.push_back(subBasicCluster); }
213 >      void clearSubBasicCluster() { subBasicClusterRefVector_.clear(); }
214 >      void setSeedBasicCluster(TObject* seedBasicCluster) { seedBasicCluster_ = seedBasicCluster; }
215 >      void setPhotonIndex(Int_t photonIndex) { photonIndex_ = photonIndex; }
216 >      void setPhoton(TObject* photon) { photon_ = photon; }
217 >      void setElectronIndex(Int_t electronIndex) { electronIndex_ = electronIndex; }
218 >      void setElectron(TObject* electron) { electron_ = electron; }
219 >      
220 >      
221 >      friend std::ostream& operator<< (std::ostream& stream, const TRootSuperCluster& clus)
222 >      {
223 >         stream << "TRootSuperCluster - Type=" << clus.det_ << "  (E,Et,eta,phi)=(" << clus.Mag() <<"," << clus.Pt() <<"," << clus.Eta() <<"," << clus.Phi() << ")"
224 >         << " Calo position (x,y,z)=(" << clus.calX() << "," << clus.calY() << "," << clus.calZ() << ")"
225 >         << " nBasicClusters=" << clus.nBasicClusters() << " e3x3=" << clus.e3x3() << " e5x5=" << clus.e5x5() << " eMax=" << clus.eMax()<< " e2nd=" << clus.e2nd()
226 >         << " nXtals=" << clus.nXtals() << " preshowerEnergy=" << clus.preshowerEnergy() << " rawEnergy=" << clus.rawEnergy();
227 >         return stream;
228 >      };
229 >      
230 >      void Print()
231 >      {
232 >         std::cout << "TRootSuperCluster - Type=" << this->det_ << "  (E,Et,eta,phi)=(" << this->Mag() <<"," << this->Pt() <<"," << this->Eta() <<"," << this->Phi() << ")"
233 >         << " Calo position (x,y,z)=(" << this->calX() << "," << this->calY() << "," << this->calZ() << ")"
234 >         << " nBasicClusters=" << this->nBasicClusters() << " e3x3=" << this->e3x3() << " e5x5=" << this->e5x5() << " eMax=" << this->eMax()<< " e2nd=" << this->e2nd()
235 >         << " nXtals=" << this->nXtals() << " preshowerEnergy=" << this->preshowerEnergy() << " rawEnergy=" << this->rawEnergy();
236 >      };
237 >
238 >      
239 >   protected:
240 >      
241 >      Float_t rawEnergy_;
242 >      Float_t preshowerEnergy_;
243 >      Int_t nBasicClusters_;
244 >      std::vector<Int_t> subBasicClusterUIDVector_;
245 >      std::vector<Int_t> subBasicClusterIndexVector_;
246 >      Int_t seedBasicClusterVectorIndex_; // position in subBasicClusterIndexVector_ and subBasicClusterRefVector_ of the seedBasicCluster
247 >      std::vector<TRef> subBasicClusterRefVector_;
248 >      TRef seedBasicCluster_;
249 >      Int_t photonIndex_;
250 >      TRef photon_;
251 >      Int_t electronIndex_;
252 >      TRef electron_;
253 >      
254 >      ClassDef (TRootSuperCluster,6);
255 >      
256   };
257  
258   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines