3 |
|
// |
4 |
|
// SuperCluster |
5 |
|
// |
6 |
< |
// Details to be worked out... |
6 |
> |
// This class holds the super cluster information. |
7 |
|
// |
8 |
|
// Authors: S.Xie |
9 |
|
//-------------------------------------------------------------------------------------------------- |
12 |
|
#define MITANA_DATATREE_SUPERCLUSTER_H |
13 |
|
|
14 |
|
#include <TMath.h> |
15 |
+ |
#include "MitCommon/DataFormats/interface/Vect3C.h" |
16 |
|
#include "MitAna/DataTree/interface/DataObject.h" |
17 |
|
#include "MitAna/DataTree/interface/BasicCluster.h" |
18 |
+ |
#include "MitAna/DataTree/interface/CaloTower.h" |
19 |
|
#include "MitAna/DataCont/interface/RefArray.h" |
20 |
+ |
#include "MitAna/DataCont/interface/Ref.h" |
21 |
|
|
22 |
|
namespace mithep |
23 |
|
{ |
24 |
|
class SuperCluster : public DataObject |
25 |
|
{ |
26 |
|
public: |
27 |
< |
SuperCluster() : fEnergy(0.0), fPoint(0,0,0) , fRawEnergy(-1.0) {} |
28 |
< |
~SuperCluster() {} |
27 |
> |
SuperCluster() : fEnergy(0), fEtaWidth(0), fPreshowerEnergy(0), |
28 |
> |
fPhiWidth(0), fRawEnergy(0) {} |
29 |
|
|
30 |
< |
const BasicCluster *Cluster(UInt_t i) const { return fClusters.At(i); } |
31 |
< |
UInt_t ClusterSize() const { return fClusters.GetEntries(); } |
32 |
< |
Double_t Energy() const { return fEnergy; } |
33 |
< |
Double_t Eta() const { return fPoint.Eta(); } |
34 |
< |
Double_t EtaWidth() const { return fEtaWidth; } |
35 |
< |
Double_t Phi() const { return fPoint.Phi(); } |
36 |
< |
Double_t PhiWidth() const { return fPhiWidth; } |
37 |
< |
Double_t PreshowerEnergy() const { return fPreshowerEnergy; } |
38 |
< |
Double_t RawEnergy() const { return fRawEnergy; } |
39 |
< |
const BasicCluster *Seed() const; |
40 |
< |
Double_t X() const { return fPoint.X(); } |
41 |
< |
Double_t Y() const { return fPoint.Y(); } |
42 |
< |
Double_t Z() const { return fPoint.Z(); } |
43 |
< |
void Print(Option_t *opt="") const; |
44 |
< |
|
45 |
< |
void AddCluster( BasicCluster *Cluster) { fClusters.Add(Cluster); } |
46 |
< |
void SetEnergy(Double_t Energy) { fEnergy = Energy; } |
47 |
< |
void SetEtaWidth(Double_t EtaWidth) { fEtaWidth = EtaWidth; } |
48 |
< |
void SetPhiWidth(Double_t PhiWidth) { fPhiWidth = PhiWidth; } |
49 |
< |
void SetPreshowerEnergy(Double_t PreshowerEnergy) { fPreshowerEnergy |
50 |
< |
= PreshowerEnergy; } |
51 |
< |
void SetRawEnergy(Double_t RawEnergy) { fRawEnergy = RawEnergy; } |
52 |
< |
void SetSeed( BasicCluster* SeedRef) { fSeedRef = SeedRef; } |
53 |
< |
void SetXYZ(Double_t x, Double_t y, Double_t z) { fPoint.SetXYZ(x,y,z); } |
30 |
> |
void AddCluster(const BasicCluster *c) { fClusters.Add(c); } |
31 |
> |
void AddTower(const CaloTower *t) { fCaloTowers.Add(t); } |
32 |
> |
const BasicCluster *Cluster(UInt_t i) const { return fClusters.At(i); } |
33 |
> |
UInt_t ClusterSize() const { return fClusters.Entries(); } |
34 |
> |
UInt_t NHits() const; |
35 |
> |
Int_t Compare(const TObject *o) const; |
36 |
> |
Double_t Energy() const { return fEnergy; } |
37 |
> |
Double_t Et() const; |
38 |
> |
Double_t Eta() const { return fPoint.Eta(); } |
39 |
> |
Double_t AbsEta() const { return TMath::Abs(Eta()); } |
40 |
> |
Double_t EtaWidth() const { return fEtaWidth; } |
41 |
> |
Bool_t HasSeed() const { return fSeedRef.IsValid(); } |
42 |
> |
Bool_t HasTower(const CaloTower *t) const { return fCaloTowers.HasObject(t); } |
43 |
> |
Double_t HcalDepth1Energy() const { return fHcalDepth1Energy; } |
44 |
> |
Double_t HcalDepth2Energy() const { return fHcalDepth2Energy; } |
45 |
> |
Double_t HadDepth1OverEm() const { return fHcalDepth1Energy/fEnergy; } |
46 |
> |
Double_t HadDepth2OverEm() const { return fHcalDepth2Energy/fEnergy; } |
47 |
> |
Double_t HadOverEm() const { return (fHcalDepth1Energy+ |
48 |
> |
fHcalDepth2Energy)/fEnergy; } |
49 |
> |
Bool_t IsSortable() const { return kTRUE; } |
50 |
> |
EObjType ObjType() const { return kSuperCluster; } |
51 |
> |
UInt_t NTowers() const { return fCaloTowers.Entries(); } |
52 |
> |
Double_t Phi() const { return fPoint.Phi(); } |
53 |
> |
Double_t PhiWidth() const { return fPhiWidth; } |
54 |
> |
ThreeVectorC Point() const { return fPoint.V(); } |
55 |
> |
void Print(Option_t *opt="") const; |
56 |
> |
Double_t PreshowerEnergy() const { return fPreshowerEnergy; } |
57 |
> |
Double_t RawEnergy() const { return fRawEnergy; } |
58 |
> |
Double_t Rho() const { return fPoint.Rho(); } |
59 |
> |
Double_t R9() const { return fSeedRef.Obj()->E3x3()/fRawEnergy; } |
60 |
> |
const BasicCluster *Seed() const { return fSeedRef.Obj(); } |
61 |
> |
const CaloTower *Tower(UInt_t i) const { return fCaloTowers.At(i); } |
62 |
> |
void SetEnergy(Double_t energy) { fEnergy = energy; } |
63 |
> |
void SetEtaWidth(Double_t etaWidth) { fEtaWidth = etaWidth; } |
64 |
> |
void SetPhiWidth(Double_t phiWidth) { fPhiWidth = phiWidth; } |
65 |
> |
void SetPreshowerEnergy(Double_t e) { fPreshowerEnergy = e; } |
66 |
> |
void SetRawEnergy(Double_t rawEnergy) { fRawEnergy = rawEnergy; } |
67 |
> |
void SetHcalDepth1Energy(Double_t x) { fHcalDepth1Energy = x; } |
68 |
> |
void SetHcalDepth2Energy(Double_t x) { fHcalDepth2Energy = x; } |
69 |
> |
void SetSeed(const BasicCluster *s) { fSeedRef = s; } |
70 |
> |
void SetXYZ(Double_t x, Double_t y, Double_t z) { fPoint.SetXYZ(x,y,z); } |
71 |
|
|
72 |
|
protected: |
73 |
< |
|
74 |
< |
Double32_t fEnergy; //Supercluster energy |
75 |
< |
Double32_t fEtaWidth; //Width in Phi |
76 |
< |
ThreeVector32 fPoint; //Centroid Position |
77 |
< |
Double32_t fPreshowerEnergy; //Energy in the preshower |
78 |
< |
Double32_t fPhiWidth; //Width in Phi |
79 |
< |
Double32_t fRawEnergy; //Supercluster raw energy |
80 |
< |
RefArray<BasicCluster,1024> fClusters; //BasicClusters in this SuperCluster |
81 |
< |
TRef fSeedRef; //the seed cluster |
73 |
> |
Vect3C fPoint; //centroid Position |
74 |
> |
Double32_t fEnergy; //[0,0,14]super cluster energy |
75 |
> |
Double32_t fEtaWidth; //[0,0,14]width in Phi |
76 |
> |
Double32_t fPreshowerEnergy; //[0,0,14]energy in the preshower |
77 |
> |
Double32_t fPhiWidth; //[0,0,14]width in Phi |
78 |
> |
Double32_t fRawEnergy; //[0,0,14]super cluster raw energy |
79 |
> |
Double32_t fHcalDepth1Energy; //[0,0,14] hcal depth1 over ECAL energy |
80 |
> |
Double32_t fHcalDepth2Energy; //[0,0,14] hcal depth2 over ECAL energy |
81 |
> |
RefArray<BasicCluster> fClusters; //assigned basic clusters |
82 |
> |
Ref<BasicCluster> fSeedRef; //seed cluster |
83 |
> |
RefArray<CaloTower> fCaloTowers; //calo towers (matched by detid) |
84 |
|
|
85 |
< |
ClassDef(SuperCluster, 1) // Generic particle class |
85 |
> |
ClassDef(SuperCluster, 3) // Super cluster class |
86 |
|
}; |
87 |
|
} |
88 |
|
|
89 |
|
//-------------------------------------------------------------------------------------------------- |
90 |
< |
inline const mithep::BasicCluster *mithep::SuperCluster::Seed() const |
91 |
< |
{ |
92 |
< |
// Return tracker track. |
90 |
> |
inline UInt_t mithep::SuperCluster::NHits() const |
91 |
> |
{ |
92 |
> |
// Return transverse energy. |
93 |
> |
|
94 |
> |
UInt_t nhits = 0; |
95 |
> |
for (UInt_t i=0; i<fClusters.GetEntries(); ++i) { |
96 |
> |
nhits += fClusters.At(i)->NHits(); |
97 |
> |
} |
98 |
> |
return nhits; |
99 |
> |
} |
100 |
> |
|
101 |
> |
|
102 |
> |
//-------------------------------------------------------------------------------------------------- |
103 |
> |
inline Double_t mithep::SuperCluster::Et() const |
104 |
> |
{ |
105 |
> |
// Return transverse energy. |
106 |
> |
|
107 |
> |
return fEnergy*fPoint.Rho()/fPoint.V().R(); |
108 |
> |
} |
109 |
|
|
110 |
< |
return static_cast<const BasicCluster*>(fSeedRef.GetObject()); |
110 |
> |
//-------------------------------------------------------------------------------------------------- |
111 |
> |
inline Int_t mithep::SuperCluster::Compare(const TObject *o) const |
112 |
> |
{ |
113 |
> |
// Default compare function for sorting according to transverse momentum. |
114 |
> |
// Returns -1 if this object is smaller than given object, 0 if objects are |
115 |
> |
// equal and 1 if this is larger than given object. |
116 |
> |
|
117 |
> |
const mithep::SuperCluster *s = dynamic_cast<const mithep::SuperCluster *>(o); |
118 |
> |
if (!s) |
119 |
> |
return 1; |
120 |
> |
|
121 |
> |
Double_t mye = Energy(); |
122 |
> |
Double_t e = s->Energy(); |
123 |
> |
if (mye>e) |
124 |
> |
return -1; |
125 |
> |
else if (e>mye) |
126 |
> |
return +1; |
127 |
> |
return 0; |
128 |
|
} |
129 |
|
#endif |