ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/CaloTower.h
Revision: 1.13
Committed: Mon May 18 06:44:56 2009 UTC (15 years, 11 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.12: +5 -3 lines
Log Message:
Added a comment about negative energy.

File Contents

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