ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/CaloTower.h
Revision: 1.10
Committed: Tue Mar 3 17:04:09 2009 UTC (16 years, 2 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_008pre1
Changes since 1.9: +61 -35 lines
Log Message:
Cleanup and double32.

File Contents

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