ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/SuperCluster.h
Revision: 1.13
Committed: Mon Oct 26 09:48:09 2009 UTC (15 years, 6 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_012a, Mit_012
Changes since 1.12: +24 -2 lines
Log Message:
Compare function

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: SuperCluster.h,v 1.12 2009/04/08 10:24:33 loizides 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/DataCont/interface/RefArray.h"
19 #include "MitAna/DataCont/interface/Ref.h"
20
21 namespace mithep
22 {
23 class SuperCluster : public DataObject
24 {
25 public:
26 SuperCluster() : fEnergy(0), fEtaWidth(0), fPreshowerEnergy(0),
27 fPhiWidth(0), fRawEnergy(0) {}
28
29 void AddCluster(const BasicCluster *c) { fClusters.Add(c); }
30 const BasicCluster *Cluster(UInt_t i) const { return fClusters.At(i); }
31 UInt_t ClusterSize() const { return fClusters.Entries(); }
32 Int_t Compare(const TObject *o) const;
33 Double_t Energy() const { return fEnergy; }
34 Double_t Eta() const { return fPoint.Eta(); }
35 Double_t EtaWidth() const { return fEtaWidth; }
36 Bool_t IsSortable() const { return kTRUE; }
37 EObjType ObjType() const { return kSuperCluster; }
38 Double_t Phi() const { return fPoint.Phi(); }
39 Double_t PhiWidth() const { return fPhiWidth; }
40 ThreeVectorC Point() const { return fPoint.V(); }
41 void Print(Option_t *opt="") const;
42 Double_t PreshowerEnergy() const { return fPreshowerEnergy; }
43 Double_t RawEnergy() const { return fRawEnergy; }
44 Double_t Rho() const { return fPoint.Rho(); }
45 const BasicCluster *Seed() const { return fSeedRef.Obj(); }
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 e) { fPreshowerEnergy = e; }
50 void SetRawEnergy(Double_t rawEnergy) { fRawEnergy = rawEnergy; }
51 void SetSeed(const BasicCluster *s) { fSeedRef = s; }
52 void SetXYZ(Double_t x, Double_t y, Double_t z) { fPoint.SetXYZ(x,y,z); }
53
54 protected:
55 Vect3C fPoint; //centroid Position
56 Double32_t fEnergy; //[0,0,14]super cluster energy
57 Double32_t fEtaWidth; //[0,0,14]width in Phi
58 Double32_t fPreshowerEnergy; //[0,0,14]energy in the preshower
59 Double32_t fPhiWidth; //[0,0,14]width in Phi
60 Double32_t fRawEnergy; //[0,0,14]super cluster raw energy
61 RefArray<BasicCluster> fClusters; //assigned basic clusters
62 Ref<BasicCluster> fSeedRef; //seed cluster
63
64 ClassDef(SuperCluster, 1) // Super cluster class
65 };
66 }
67
68 //--------------------------------------------------------------------------------------------------
69 inline Int_t mithep::SuperCluster::Compare(const TObject *o) const
70 {
71 // Default compare function for sorting according to transverse momentum.
72 // Returns -1 if this object is smaller than given object, 0 if objects are
73 // equal and 1 if this is larger than given object.
74
75 const mithep::SuperCluster *s = dynamic_cast<const mithep::SuperCluster *>(o);
76 if (!s)
77 return 1;
78
79 Double_t mye = Energy();
80 Double_t e = s->Energy();
81 if (mye>e)
82 return -1;
83 else if (e>mye)
84 return +1;
85 return 0;
86 }
87 #endif