ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/CaloTower.h
Revision: 1.9
Committed: Thu Feb 26 17:06:24 2009 UTC (16 years, 2 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.8: +30 -10 lines
Log Message:
Incorporate updated RefArray (no size template argument anymore) and add necessary caches and cache clear calls

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: CaloTower.h,v 1.8 2009/02/18 15:38:54 loizides Exp $
3 //
4 // CaloTower
5 //
6 // This class holds calo tower information.
7 //
8 // Authors: S.Xie
9 //--------------------------------------------------------------------------------------------------
10
11 #ifndef MITANA_DATATREE_CALOTOWER_H
12 #define MITANA_DATATREE_CALOTOWER_H
13
14 #include "MitAna/DataTree/interface/DataObject.h"
15 #include "MitAna/DataTree/interface/CacheFlag.h"
16 #include <TMath.h>
17
18 namespace mithep
19 {
20 class CaloTower : public DataObject
21 {
22 public:
23 CaloTower() : fEmEnergy(0), fHadEnergy(0), fOuterEnergy(0) {}
24
25 Double_t E() const { return (fEmEnergy + fHadEnergy); }
26 Double_t EmEt() const { return fEmEnergy*TMath::Sin(Theta()); }
27 Double_t Eta() const { return fPosition.Eta(); }
28 Double_t Et() const { return E()*TMath::Sin(Theta()); }
29 Double_t EtWithHO() const { return EWithHO()*TMath::Sin(Theta()); }
30 Double_t EWithHO() const { return (fEmEnergy + fHadEnergy + fOuterEnergy); }
31 Double_t EmEnergy() const { return fEmEnergy; }
32 Double_t HadEnergy() const { return fHadEnergy; }
33 Double_t HadEt() const { return fHadEnergy*TMath::Sin(Theta()); }
34 const FourVectorM &Mom() const;
35 Double_t Phi() const { return fPosition.Phi(); }
36 EObjType ObjType() const { return kCaloTower; }
37 Double_t OuterEnergy() const { return fOuterEnergy; }
38 Double_t OuterEt() const { return fOuterEnergy*TMath::Sin(Theta()); }
39 const ThreeVectorC &Position() const { return fPosition; }
40 Double_t Theta() const { return fPosition.Theta(); }
41 void SetEmEnergy(Double_t EmEnergy) { fEmEnergy = EmEnergy; ClearMom(); }
42 void SetHadEnergy(Double_t HadEnergy) { fHadEnergy = HadEnergy; ClearMom(); }
43 void SetOuterEnergy(Double_t OuterEnergy) { fOuterEnergy = OuterEnergy; ClearMom(); }
44 void SetPosition(Double_t x, Double_t y, Double_t z)
45 { fPosition.SetXYZ(x,y,z); ClearMom(); }
46
47 protected:
48 void ClearMom() const { fCacheMomFlag.ClearCache(); }
49 void GetMom() const;
50
51 ThreeVectorC32 fPosition; //position of tower
52 Double32_t fEmEnergy; //tower energy in Ecal
53 Double32_t fHadEnergy; //tower energy in Hcal
54 Double32_t fOuterEnergy; //tower energy in outer Hcal
55
56 mutable CacheFlag fCacheMomFlag; //||cache validity flag for momentum
57 mutable FourVectorM fCachedMom; //!cached momentum vector (filled by derived classes)
58
59 ClassDef(CaloTower, 1) // Calo tower class
60 };
61 }
62
63 //--------------------------------------------------------------------------------------------------
64 inline void mithep::CaloTower::GetMom() const
65 {
66 // Compute and return four momentum.
67
68 if (E() > 0)
69 fCachedMom.SetCoordinates(Et(),Eta(),Phi(),0.0);
70 else
71 fCachedMom = mithep::FourVectorM();
72 }
73
74 //--------------------------------------------------------------------------------------------------
75 inline const mithep::FourVectorM &mithep::CaloTower::Mom() const
76 {
77 // Return cached momentum value.
78
79 if (!fCacheMomFlag.IsValid()) {
80 GetMom();
81 fCacheMomFlag.SetValid();
82 }
83
84 return fCachedMom;
85 }
86 #endif