ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/SuperCluster.h
Revision: 1.21
Committed: Mon Sep 20 12:09:15 2010 UTC (14 years, 7 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e
Changes since 1.20: +2 -1 lines
Log Message:
Add HasSeed accessor

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: SuperCluster.h,v 1.20 2010/09/19 18:26:41 bendavid Exp $
3 //
4 // SuperCluster
5 //
6 // This class holds the super cluster information.
7 //
8 // Authors: S.Xie
9 //--------------------------------------------------------------------------------------------------
10
11 #ifndef MITANA_DATATREE_SUPERCLUSTER_H
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), fEtaWidth(0), fPreshowerEnergy(0),
28 fPhiWidth(0), fRawEnergy(0) {}
29
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 Int_t Compare(const TObject *o) const;
35 Double_t Energy() const { return fEnergy; }
36 Double_t Et() const;
37 Double_t Eta() const { return fPoint.Eta(); }
38 Double_t AbsEta() const { return TMath::Abs(Eta()); }
39 Double_t EtaWidth() const { return fEtaWidth; }
40 Bool_t HasSeed() const { return fSeedRef.IsValid(); }
41 Bool_t HasTower(const CaloTower *t) const { return fCaloTowers.HasObject(t); }
42 Double_t HcalDepth1Energy() const { return fHcalDepth1Energy; }
43 Double_t HcalDepth2Energy() const { return fHcalDepth2Energy; }
44 Double_t HadDepth1OverEm() const { return fHcalDepth1Energy/fEnergy; }
45 Double_t HadDepth2OverEm() const { return fHcalDepth2Energy/fEnergy; }
46 Double_t HadOverEm() const { return (fHcalDepth1Energy+
47 fHcalDepth2Energy)/fEnergy; }
48 Bool_t IsSortable() const { return kTRUE; }
49 EObjType ObjType() const { return kSuperCluster; }
50 UInt_t NTowers() const { return fCaloTowers.Entries(); }
51 Double_t Phi() const { return fPoint.Phi(); }
52 Double_t PhiWidth() const { return fPhiWidth; }
53 ThreeVectorC Point() const { return fPoint.V(); }
54 void Print(Option_t *opt="") const;
55 Double_t PreshowerEnergy() const { return fPreshowerEnergy; }
56 Double_t RawEnergy() const { return fRawEnergy; }
57 Double_t Rho() const { return fPoint.Rho(); }
58 const BasicCluster *Seed() const { return fSeedRef.Obj(); }
59 const CaloTower *Tower(UInt_t i) const { return fCaloTowers.At(i); }
60 void SetEnergy(Double_t energy) { fEnergy = energy; }
61 void SetEtaWidth(Double_t etaWidth) { fEtaWidth = etaWidth; }
62 void SetPhiWidth(Double_t phiWidth) { fPhiWidth = phiWidth; }
63 void SetPreshowerEnergy(Double_t e) { fPreshowerEnergy = e; }
64 void SetRawEnergy(Double_t rawEnergy) { fRawEnergy = rawEnergy; }
65 void SetHcalDepth1Energy(Double_t x) { fHcalDepth1Energy = x; }
66 void SetHcalDepth2Energy(Double_t x) { fHcalDepth2Energy = x; }
67 void SetSeed(const BasicCluster *s) { fSeedRef = s; }
68 void SetXYZ(Double_t x, Double_t y, Double_t z) { fPoint.SetXYZ(x,y,z); }
69
70 protected:
71 Vect3C fPoint; //centroid Position
72 Double32_t fEnergy; //[0,0,14]super cluster energy
73 Double32_t fEtaWidth; //[0,0,14]width in Phi
74 Double32_t fPreshowerEnergy; //[0,0,14]energy in the preshower
75 Double32_t fPhiWidth; //[0,0,14]width in Phi
76 Double32_t fRawEnergy; //[0,0,14]super cluster raw energy
77 Double32_t fHcalDepth1Energy; //[0,0,14] hcal depth1 over ECAL energy
78 Double32_t fHcalDepth2Energy; //[0,0,14] hcal depth2 over ECAL energy
79 RefArray<BasicCluster> fClusters; //assigned basic clusters
80 Ref<BasicCluster> fSeedRef; //seed cluster
81 RefArray<CaloTower> fCaloTowers; //calo towers (matched by detid)
82
83 ClassDef(SuperCluster, 3) // Super cluster class
84 };
85 }
86
87 //--------------------------------------------------------------------------------------------------
88 inline Double_t mithep::SuperCluster::Et() const
89 {
90 // Return transverse energy.
91
92 return fEnergy*fPoint.Rho()/fPoint.V().R();
93 }
94
95 //--------------------------------------------------------------------------------------------------
96 inline Int_t mithep::SuperCluster::Compare(const TObject *o) const
97 {
98 // Default compare function for sorting according to transverse momentum.
99 // Returns -1 if this object is smaller than given object, 0 if objects are
100 // equal and 1 if this is larger than given object.
101
102 const mithep::SuperCluster *s = dynamic_cast<const mithep::SuperCluster *>(o);
103 if (!s)
104 return 1;
105
106 Double_t mye = Energy();
107 Double_t e = s->Energy();
108 if (mye>e)
109 return -1;
110 else if (e>mye)
111 return +1;
112 return 0;
113 }
114 #endif