ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/SuperCluster.h
Revision: 1.27
Committed: Sat May 5 16:49:10 2012 UTC (13 years ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_028, Mit_027a, Mit_027
Changes since 1.26: +32 -4 lines
Log Message:
Version 027 - complete version for ICHEP 2012.

File Contents

# User Rev Content
1 sixie 1.1 //--------------------------------------------------------------------------------------------------
2 paus 1.27 // $Id: SuperCluster.h,v 1.26 2012/03/29 23:41:55 paus Exp $
3 sixie 1.1 //
4     // SuperCluster
5     //
6 loizides 1.7 // This class holds the super cluster information.
7 sixie 1.1 //
8 paus 1.27 // Authors: C.Paus, J.Bendavid, S.Xie
9 sixie 1.1 //--------------------------------------------------------------------------------------------------
10    
11 loizides 1.3 #ifndef MITANA_DATATREE_SUPERCLUSTER_H
12     #define MITANA_DATATREE_SUPERCLUSTER_H
13 paus 1.25
14 sixie 1.1 #include <TMath.h>
15 loizides 1.11 #include "MitCommon/DataFormats/interface/Vect3C.h"
16 sixie 1.1 #include "MitAna/DataTree/interface/DataObject.h"
17     #include "MitAna/DataTree/interface/BasicCluster.h"
18 paus 1.27 #include "MitAna/DataTree/interface/PsCluster.h"
19 bendavid 1.18 #include "MitAna/DataTree/interface/CaloTower.h"
20 sixie 1.1 #include "MitAna/DataCont/interface/RefArray.h"
21 bendavid 1.8 #include "MitAna/DataCont/interface/Ref.h"
22 sixie 1.1
23 paus 1.25 namespace mithep
24 sixie 1.1 {
25     class SuperCluster : public DataObject
26     {
27 paus 1.25 public:
28     SuperCluster() : fEnergy(0), fEtaWidth(0), fPreshowerEnergy(0),
29     fPhiWidth(0), fRawEnergy(0),
30     fEtaC(-99.), fEtaS(-99.), fEtaM(-99.),
31     fPhiC(-99.), fPhiS(-99.), fPhiM(-99.),
32     fXC(-99.), fXS(-99.), fXM(-99.), fXZ(-99.),
33 paus 1.27 fYC(-99.), fYS(-99.), fYM(-99.), fYZ(-99.),
34     fPreshowerEnergyPlane1(0.), fPreshowerEnergyPlane2(0.),
35     fPsEffWidthSigmaXX(-99.), fPsEffWidthSigmaYY(-99.) {}
36 paus 1.25
37     void AddCluster(const BasicCluster *c) { fClusters.Add(c); }
38 paus 1.27 void AddPsClust(const PsCluster *c) { fPsClusts.Add(c); }
39 paus 1.25 void AddTower(const CaloTower *t) { fCaloTowers.Add(t); }
40     const BasicCluster *Cluster(UInt_t i) const { return fClusters.At(i); }
41     UInt_t ClusterSize() const { return fClusters.Entries(); }
42     UInt_t NClusters() const { return fClusters.Entries(); }
43     UInt_t NHits() const;
44 paus 1.27 const PsCluster *PsClust(UInt_t i) const { return fPsClusts.At(i); }
45     UInt_t NPsClusts() const { return fPsClusts.Entries(); }
46 paus 1.25 Int_t Compare(const TObject *o) const;
47     Double_t Energy() const { return fEnergy; }
48     Double_t Et() const;
49     Double_t Eta() const { return fPoint.Eta(); }
50     Double_t AbsEta() const { return TMath::Abs(Eta()); }
51     Double_t EtaWidth() const { return fEtaWidth; }
52     Bool_t HasSeed() const { return fSeedRef.IsValid(); }
53     Bool_t HasTower(const CaloTower *t) const { return fCaloTowers.HasObject(t); }
54     Double_t HcalDepth1Energy() const { return fHcalDepth1Energy; }
55     Double_t HcalDepth2Energy() const { return fHcalDepth2Energy; }
56     Double_t HadDepth1OverEm() const { return fHcalDepth1Energy/fEnergy; }
57     Double_t HadDepth2OverEm() const { return fHcalDepth2Energy/fEnergy; }
58     Double_t HadOverEm() const { return (fHcalDepth1Energy+
59     fHcalDepth2Energy)/fEnergy; }
60     Bool_t IsSortable() const { return kTRUE; }
61     EObjType ObjType() const { return kSuperCluster; }
62     UInt_t NTowers() const { return fCaloTowers.Entries(); }
63     Double_t Phi() const { return fPoint.Phi(); }
64     Double_t PhiWidth() const { return fPhiWidth; }
65     ThreeVectorC Point() const { return fPoint.V(); }
66     void Print(Option_t *opt="") const;
67     Double_t PreshowerEnergy() const { return fPreshowerEnergy; }
68 paus 1.27 Double_t PreshowerEnergyPlane1() const { return fPreshowerEnergyPlane1; }
69     Double_t PreshowerEnergyPlane2() const { return fPreshowerEnergyPlane2; }
70 paus 1.25 Double_t RawEnergy() const { return fRawEnergy; }
71     Double_t Rho() const { return fPoint.Rho(); }
72     Double_t R9() const { return fSeedRef.Obj()->E3x3()/fRawEnergy; }
73     const BasicCluster *Seed() const { return fSeedRef.Obj(); }
74     const CaloTower *Tower(UInt_t i) const { return fCaloTowers.At(i); }
75     Double_t EtaC() const { return fEtaC; }
76     Double_t EtaS() const { return fEtaS; }
77     Double_t EtaM() const { return fEtaM; }
78     Double_t PhiC() const { return fPhiC; }
79     Double_t PhiS() const { return fPhiS; }
80     Double_t PhiM() const { return fPhiM; }
81     Double_t XC() const { return fXC; }
82     Double_t XS() const { return fXS; }
83     Double_t XM() const { return fXM; }
84     Double_t XZ() const { return fXZ; }
85     Double_t YC() const { return fYC; }
86     Double_t YS() const { return fYS; }
87     Double_t YM() const { return fYM; }
88     Double_t YZ() const { return fYZ; }
89 paus 1.27 Double_t Time() const { return fTime; }
90     Double_t SeedTime() const { return fSeedTime; }
91     Double_t PsEffWidthSigmaXX() const { return fPsEffWidthSigmaXX; }
92     Double_t PsEffWidthSigmaYY() const { return fPsEffWidthSigmaYY; }
93    
94 paus 1.25 void SetEnergy(Double_t energy) { fEnergy = energy; }
95     void SetEtaWidth(Double_t etaWidth) { fEtaWidth = etaWidth; }
96     void SetPhiWidth(Double_t phiWidth) { fPhiWidth = phiWidth; }
97     void SetPreshowerEnergy(Double_t e) { fPreshowerEnergy = e; }
98 paus 1.27 void SetPreshowerEnergyPlane1(Double_t e) { fPreshowerEnergyPlane1 = e; }
99     void SetPreshowerEnergyPlane2(Double_t e) { fPreshowerEnergyPlane2 = e; }
100 paus 1.25 void SetRawEnergy(Double_t rawEnergy) { fRawEnergy = rawEnergy; }
101     void SetHcalDepth1Energy(Double_t x) { fHcalDepth1Energy = x; }
102     void SetHcalDepth2Energy(Double_t x) { fHcalDepth2Energy = x; }
103     void SetSeed(const BasicCluster *s) { fSeedRef = s; }
104     void SetXYZ(Double_t x, Double_t y, Double_t z) { fPoint.SetXYZ(x,y,z); }
105     void SetEtaC(Double_t x) { fEtaC = x; }
106     void SetEtaS(Double_t x) { fEtaS = x; }
107     void SetEtaM(Double_t x) { fEtaM = x; }
108     void SetPhiC(Double_t x) { fPhiC = x; }
109     void SetPhiS(Double_t x) { fPhiS = x; }
110     void SetPhiM(Double_t x) { fPhiM = x; }
111     void SetXC(Double_t x) { fXC = x; }
112     void SetXS(Double_t x) { fXS = x; }
113     void SetXM(Double_t x) { fXM = x; }
114     void SetXZ(Double_t x) { fXZ = x; }
115     void SetYC(Double_t x) { fYC = x; }
116     void SetYS(Double_t x) { fYS = x; }
117     void SetYM(Double_t x) { fYM = x; }
118     void SetYZ(Double_t x) { fYZ = x; }
119 paus 1.27 void SetTime(Double_t x) { fTime = x; }
120     void SetSeedTime(Double_t x) { fSeedTime = x; }
121     void SetPsEffWidthSigmaXX(Double_t x) { fPsEffWidthSigmaXX = x; }
122     void SetPsEffWidthSigmaYY(Double_t x) { fPsEffWidthSigmaYY = x; }
123 paus 1.25
124     // Some structural tools
125 paus 1.26 void Mark(UInt_t i=1) const;
126 paus 1.25
127     protected:
128     Vect3C fPoint; //centroid Position
129     Double32_t fEnergy; //[0,0,14]super cluster energy
130     Double32_t fEtaWidth; //[0,0,14]width in Phi
131     Double32_t fPreshowerEnergy; //[0,0,14]energy in the preshower
132     Double32_t fPhiWidth; //[0,0,14]width in Phi
133     Double32_t fRawEnergy; //[0,0,14]super cluster raw energy
134     Double32_t fHcalDepth1Energy; //[0,0,14] hcal depth1 over ECAL energy
135     Double32_t fHcalDepth2Energy; //[0,0,14] hcal depth2 over ECAL energy
136     RefArray<BasicCluster> fClusters; //assigned basic clusters
137     Ref<BasicCluster> fSeedRef; //seed cluster
138     RefArray<CaloTower> fCaloTowers; //calo towers (matched by detid)
139     Double32_t fEtaC; //local coordinates
140     Double32_t fEtaS; //local coordinates
141     Double32_t fEtaM; //local coordinates
142     Double32_t fPhiC; //local coordinates
143     Double32_t fPhiS; //local coordinates
144     Double32_t fPhiM; //local coordinates
145     Double32_t fXC; //local coordinates
146     Double32_t fXS; //local coordinates
147     Double32_t fXM; //local coordinates
148     Double32_t fXZ; //local coordinates
149     Double32_t fYC; //local coordinates
150     Double32_t fYS; //local coordinates
151     Double32_t fYM; //local coordinates
152     Double32_t fYZ; //local coordinates
153 paus 1.27 Double32_t fTime; //ecal timing (weighted average)
154     Double32_t fSeedTime; //ecal timing (seed crystal)
155    
156     Double32_t fPreshowerEnergyPlane1; //local coordinates
157     Double32_t fPreshowerEnergyPlane2; //local coordinates
158     Double32_t fPsEffWidthSigmaXX; //preshower cluster width in x plane
159     Double32_t fPsEffWidthSigmaYY; //preshower cluster width in y plane
160     RefArray<PsCluster> fPsClusts; //assigned preshower clusters
161 sixie 1.1
162 paus 1.27 ClassDef(SuperCluster, 5) // Super cluster class
163 sixie 1.1 };
164     }
165 loizides 1.13
166     //--------------------------------------------------------------------------------------------------
167 paus 1.26 inline void mithep::SuperCluster::Mark(UInt_t ib) const
168 paus 1.25 {
169     // mark myself
170 paus 1.26 mithep::DataObject::Mark(ib);
171 paus 1.25 // mark my dependencies if they are there
172     if (fSeedRef.IsValid())
173 paus 1.26 fSeedRef.Obj()->Mark(ib);
174     fClusters .Mark(ib);
175 paus 1.27 fPsClusts .Mark(ib);
176 paus 1.26 fCaloTowers.Mark(ib);
177 paus 1.25 }
178    
179    
180     //--------------------------------------------------------------------------------------------------
181 bendavid 1.23 inline UInt_t mithep::SuperCluster::NHits() const
182     {
183     // Return transverse energy.
184    
185     UInt_t nhits = 0;
186     for (UInt_t i=0; i<fClusters.GetEntries(); ++i) {
187     nhits += fClusters.At(i)->NHits();
188     }
189     return nhits;
190     }
191    
192    
193     //--------------------------------------------------------------------------------------------------
194 sixie 1.14 inline Double_t mithep::SuperCluster::Et() const
195     {
196 loizides 1.15 // Return transverse energy.
197    
198 sixie 1.14 return fEnergy*fPoint.Rho()/fPoint.V().R();
199     }
200    
201     //--------------------------------------------------------------------------------------------------
202 loizides 1.13 inline Int_t mithep::SuperCluster::Compare(const TObject *o) const
203     {
204 paus 1.25 // Default compare function for sorting according to transverse momentum.
205     // Returns -1 if this object is smaller than given object, 0 if objects are
206 loizides 1.13 // equal and 1 if this is larger than given object.
207    
208     const mithep::SuperCluster *s = dynamic_cast<const mithep::SuperCluster *>(o);
209     if (!s)
210     return 1;
211    
212     Double_t mye = Energy();
213     Double_t e = s->Energy();
214     if (mye>e)
215     return -1;
216     else if (e>mye)
217     return +1;
218     return 0;
219     }
220 sixie 1.1 #endif