ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/CaloTower.h
Revision: 1.12
Committed: Mon May 18 06:29:57 2009 UTC (15 years, 11 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.11: +2 -1 lines
Log Message:
Added Pt = Et to be able to use CaloTower in Templates that require Pt accessor.

File Contents

# User Rev Content
1 sixie 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.12 // $Id: CaloTower.h,v 1.11 2009/03/08 12:09:58 loizides 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 loizides 1.11 #include "MitCommon/DataFormats/interface/Vect3C.h"
16     #include "MitAna/DataCont/interface/CacheFlag.h"
17 loizides 1.6 #include "MitAna/DataTree/interface/DataObject.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 loizides 1.12 Double_t Pt() const { return Et(); }
38 loizides 1.10 EObjType ObjType() const { return kCaloTower; }
39     Double_t OuterEnergy() const { return fOuterEnergy; }
40     Double_t OuterEt() const { return fOuterEnergy*TMath::Sin(Theta()); }
41     const ThreeVectorC &Position() const;
42     Double_t Theta() const { return Position().Theta(); }
43     void SetEmEnergy(Double_t EmEnergy)
44     { fEmEnergy = EmEnergy; ClearMom(); }
45     void SetHadEnergy(Double_t HadEnergy)
46     { fHadEnergy = HadEnergy; ClearMom(); }
47     void SetOuterEnergy(Double_t OuterEnergy)
48     { fOuterEnergy = OuterEnergy; ClearMom(); }
49     void SetPosition(Double_t x, Double_t y, Double_t z)
50     { fPosition.SetXYZ(x,y,z); ClearMom(); ClearPos(); }
51 sixie 1.1
52     protected:
53 loizides 1.10 void ClearMom() const { fCacheMomFlag.ClearCache(); }
54     void ClearPos() const { fCachePosFlag.ClearCache(); }
55     void GetMom() const;
56     void GetPos() const;
57 bendavid 1.9
58 loizides 1.10 Vect3C fPosition; //position of tower
59     Double32_t fEmEnergy; //[0,0,14]tower energy in Ecal
60     Double32_t fHadEnergy; //[0,0,14]tower energy in Hcal
61     Double32_t fOuterEnergy; //[0,0,14]tower energy in outer Hcal
62     mutable CacheFlag fCacheMomFlag; //||cache validity flag for momentum
63     mutable FourVectorM fCachedMom; //!cached momentum vector
64     mutable CacheFlag fCachePosFlag; //||cache validity flag for position
65     mutable ThreeVectorC fCachedPos; //!cached position vector
66 sixie 1.1
67 loizides 1.6 ClassDef(CaloTower, 1) // Calo tower class
68 sixie 1.1 };
69     }
70 bendavid 1.4
71     //--------------------------------------------------------------------------------------------------
72 bendavid 1.9 inline void mithep::CaloTower::GetMom() const
73 bendavid 1.4 {
74 loizides 1.10 // Compute four momentum.
75 bendavid 1.4
76 loizides 1.8 if (E() > 0)
77 bendavid 1.9 fCachedMom.SetCoordinates(Et(),Eta(),Phi(),0.0);
78 bendavid 1.4 else
79 bendavid 1.9 fCachedMom = mithep::FourVectorM();
80     }
81    
82     //--------------------------------------------------------------------------------------------------
83 loizides 1.10 inline void mithep::CaloTower::GetPos() const
84     {
85     // Compute position.
86    
87     fCachedPos.SetCoordinates(fPosition.Rho(), fPosition.Eta(), fPosition.Phi());
88     }
89    
90     //--------------------------------------------------------------------------------------------------
91 bendavid 1.9 inline const mithep::FourVectorM &mithep::CaloTower::Mom() const
92     {
93     // Return cached momentum value.
94    
95     if (!fCacheMomFlag.IsValid()) {
96     GetMom();
97     fCacheMomFlag.SetValid();
98     }
99 loizides 1.10 return fCachedMom;
100     }
101    
102     //--------------------------------------------------------------------------------------------------
103     inline const mithep::ThreeVectorC &mithep::CaloTower::Position() const
104     {
105     // Return cached momentum value.
106 bendavid 1.9
107 loizides 1.10 if (!fCachePosFlag.IsValid()) {
108     GetPos();
109     fCachePosFlag.SetValid();
110     }
111     return fCachedPos;
112 bendavid 1.4 }
113 sixie 1.1 #endif