ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/SuperCluster.h
Revision: 1.29
Committed: Thu Oct 31 14:22:45 2013 UTC (11 years, 6 months ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, HEAD
Changes since 1.28: +44 -38 lines
Log Message:
Last CVS version - 032.

File Contents

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