ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/CaloTower.h
Revision: 1.16
Committed: Sun Oct 23 01:53:16 2011 UTC (13 years, 6 months ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, HEAD
Branch point for: Mit_025c_branch
Changes since 1.15: +10 -10 lines
Log Message:
Removing lots of Warnings.

File Contents

# User Rev Content
1 sixie 1.1 //--------------------------------------------------------------------------------------------------
2 paus 1.16 // $Id: CaloTower.h,v 1.15 2009/06/18 22:56:30 bendavid Exp $
3 sixie 1.1 //
4 loizides 1.5 // CaloTower
5 sixie 1.1 //
6 paus 1.16 // This class holds calo tower information. Note that the energy of the tower does not necessarily
7     // have to be greater 0. As such E() and Et() can return negative values. In those cases the
8     // FourVectorM will be 0, and also Pt() will return 0.
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 bendavid 1.15 CaloTower() : fEmEnergy(0), fHadEnergy(0), fOuterEnergy(0), fMass(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 bendavid 1.15 Double_t Mass() const { return fMass; }
38 loizides 1.10 const FourVectorM &Mom() const;
39     Double_t Phi() const { return fPosition.Phi(); }
40 loizides 1.14 Double_t Pt() const { Double_t r=Et(); if(r<0) r=0; return r; }
41 loizides 1.10 EObjType ObjType() const { return kCaloTower; }
42     Double_t OuterEnergy() const { return fOuterEnergy; }
43     Double_t OuterEt() const { return fOuterEnergy*TMath::Sin(Theta()); }
44     const ThreeVectorC &Position() const;
45     Double_t Theta() const { return Position().Theta(); }
46 paus 1.16 void SetEmEnergy(Double_t emEnergy)
47     { fEmEnergy = emEnergy; ClearMom(); }
48     void SetHadEnergy(Double_t hadEnergy)
49     { fHadEnergy = hadEnergy; ClearMom(); }
50     void SetOuterEnergy(Double_t outerEnergy)
51     { fOuterEnergy = outerEnergy; ClearMom(); }
52 bendavid 1.15 void SetMass(Double_t mass) { fMass = mass; }
53 loizides 1.10 void SetPosition(Double_t x, Double_t y, Double_t z)
54     { fPosition.SetXYZ(x,y,z); ClearMom(); ClearPos(); }
55 sixie 1.1
56     protected:
57 loizides 1.10 void ClearMom() const { fCacheMomFlag.ClearCache(); }
58     void ClearPos() const { fCachePosFlag.ClearCache(); }
59     void GetMom() const;
60     void GetPos() const;
61 bendavid 1.9
62 loizides 1.10 Vect3C fPosition; //position of tower
63     Double32_t fEmEnergy; //[0,0,14]tower energy in Ecal
64     Double32_t fHadEnergy; //[0,0,14]tower energy in Hcal
65     Double32_t fOuterEnergy; //[0,0,14]tower energy in outer Hcal
66 bendavid 1.15 Double32_t fMass; //[0,0,14]tower mass
67 loizides 1.10 mutable CacheFlag fCacheMomFlag; //||cache validity flag for momentum
68     mutable FourVectorM fCachedMom; //!cached momentum vector
69     mutable CacheFlag fCachePosFlag; //||cache validity flag for position
70     mutable ThreeVectorC fCachedPos; //!cached position vector
71 sixie 1.1
72 bendavid 1.15 ClassDef(CaloTower, 2) // Calo tower class
73 sixie 1.1 };
74     }
75 bendavid 1.4
76     //--------------------------------------------------------------------------------------------------
77 bendavid 1.9 inline void mithep::CaloTower::GetMom() const
78 bendavid 1.4 {
79 loizides 1.10 // Compute four momentum.
80 bendavid 1.15 Double_t energy = E();
81     if (energy > 0) {
82     Double_t pt = TMath::Sin(Theta())*TMath::Sqrt(energy*energy + fMass*fMass);
83     fCachedMom.SetCoordinates(pt,Eta(),Phi(),Mass());
84     }
85 bendavid 1.4 else
86 bendavid 1.9 fCachedMom = mithep::FourVectorM();
87     }
88    
89     //--------------------------------------------------------------------------------------------------
90 loizides 1.10 inline void mithep::CaloTower::GetPos() const
91     {
92     // Compute position.
93    
94     fCachedPos.SetCoordinates(fPosition.Rho(), fPosition.Eta(), fPosition.Phi());
95     }
96    
97     //--------------------------------------------------------------------------------------------------
98 bendavid 1.9 inline const mithep::FourVectorM &mithep::CaloTower::Mom() const
99     {
100     // Return cached momentum value.
101    
102     if (!fCacheMomFlag.IsValid()) {
103     GetMom();
104     fCacheMomFlag.SetValid();
105     }
106 loizides 1.10 return fCachedMom;
107     }
108    
109     //--------------------------------------------------------------------------------------------------
110     inline const mithep::ThreeVectorC &mithep::CaloTower::Position() const
111     {
112     // Return cached momentum value.
113 bendavid 1.9
114 loizides 1.10 if (!fCachePosFlag.IsValid()) {
115     GetPos();
116     fCachePosFlag.SetValid();
117     }
118     return fCachedPos;
119 bendavid 1.4 }
120 sixie 1.1 #endif