ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/CaloTower.h
(Generate patch)

Comparing UserCode/MitAna/DataTree/interface/CaloTower.h (file contents):
Revision 1.3 by loizides, Wed Sep 17 04:21:16 2008 UTC vs.
Revision 1.11 by loizides, Sun Mar 8 12:09:58 2009 UTC

# Line 1 | Line 1
1   //--------------------------------------------------------------------------------------------------
2 < // $ Id $
2 > // $Id$
3   //
4 < // Calo Tower
4 > // CaloTower
5   //
6 < // Details to be worked out...
6 > // This class holds calo tower information.
7   //
8 < // Authors: Si Xie
8 > // Authors: S.Xie
9   //--------------------------------------------------------------------------------------------------
10  
11 < #ifndef DATATREE_CALOTOWER_H
12 < #define DATATREE_CALOTOWER_H
11 > #ifndef MITANA_DATATREE_CALOTOWER_H
12 > #define MITANA_DATATREE_CALOTOWER_H
13  
14   #include <TMath.h>
15 + #include "MitCommon/DataFormats/interface/Vect3C.h"
16 + #include "MitAna/DataCont/interface/CacheFlag.h"
17   #include "MitAna/DataTree/interface/DataObject.h"
18  
19   namespace mithep
# Line 19 | Line 21 | namespace mithep
21    class CaloTower : public DataObject
22    {
23      public:
24 <      CaloTower() {}
25 <      ~CaloTower() {}
26 <    
27 <      void                SetEmEnergy(Double_t EmEnergy)       { fEmEnergy    = EmEnergy;    }
28 <      void                SetEmPosition(Double_t x, Double_t y, Double_t z)
29 <                                                            { fEmPosition.SetXYZ(x,y,z);     }
30 <      void                SetHadEnergy(Double_t HadEnergy)     { fHadEnergy   = HadEnergy;   }
31 <      void                SetHadPosition(Double_t x, Double_t y, Double_t z)
32 <                                                            { fHadPosition.SetXYZ(x,y,z);    }
33 <      void                SetOuterEnergy(Double_t OuterEnergy) { fOuterEnergy = OuterEnergy; }  
34 <      void                SetEmLvl1(Int_t EmLvl1)              { fEmLvl1      = EmLvl1;      }
35 <      void                SetHadLvl1(Int_t HadLvl1)            { fHadLvl1     = HadLvl1;     }
36 <      void                SetMomentum(Double_t x, Double_t y, Double_t z, Double_t e)
37 <                                                            { fMomentum.SetPxPyPzE(x,y,z,e); }              
38 <
39 <      const FourVector   &Mom()         const { return fMomentum;                            }
40 <      Double_t            Eta()         const { return fMomentum.Eta();                      }
41 <      Double_t            Phi()         const { return fMomentum.Phi();                      }
42 <      Double_t            Theta()       const { return fMomentum.Theta();                    }
43 <      Double_t            E()           const { return fMomentum.E();                        }
44 <      Double_t            Et()          const { return E()*sin(Theta());                     }
45 <      Double_t            EmEnergy()    const { return fEmEnergy;                            }
46 <      const ThreeVector  &EmPosition()  const { return fEmPosition;                          }
47 <      Double_t            HadEnergy()   const { return fHadEnergy;                           }
48 <      const ThreeVector  &HadPosition() const { return fHadPosition;                         }
49 <      Double_t            OuterEnergy() const { return fOuterEnergy;                         }
48 <      Double_t            EmEt()        const { return fEmEnergy*sin(Theta());               }
49 <      Double_t            HadEt()       const { return fHadEnergy*sin(Theta());              }
50 <      Double_t            OuterEt()     const { return fOuterEnergy*sin(Theta());            }      
51 <      Double_t            EmLvl1()      const { return fEmLvl1;                              }
52 <      Double_t            HadLvl1()     const { return fHadLvl1;                             }      
24 >      CaloTower() : fEmEnergy(0), fHadEnergy(0), fOuterEnergy(0) {}
25 >
26 >      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  
51      protected:
52 <      FourVector          fMomentum;
53 <      ThreeVector         fEmPosition;   //Position of Ecal shower center
54 <      ThreeVector         fHadPosition;  //Position of Hcal shower center
55 <      Double_t            fEmEnergy;     //tower energy in Ecal
56 <      Double_t            fHadEnergy;    //tower energy in Hcal
57 <      Double_t            fOuterEnergy;
58 <      Int_t               fEmLvl1;
59 <      Int_t               fHadLvl1;
52 >      void                 ClearMom()    const { fCacheMomFlag.ClearCache(); }
53 >      void                 ClearPos()    const { fCachePosFlag.ClearCache(); }
54 >      void                 GetMom()      const;
55 >      void                 GetPos()      const;
56 >    
57 >      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  
66 <    ClassDef(CaloTower, 1) // Generic particle class
66 >    ClassDef(CaloTower, 1) // Calo tower class
67    };
68   }
69 +
70 + //--------------------------------------------------------------------------------------------------
71 + inline void mithep::CaloTower::GetMom() const
72 + {
73 +  // Compute four momentum.
74 +
75 +  if (E() > 0)
76 +    fCachedMom.SetCoordinates(Et(),Eta(),Phi(),0.0);
77 +  else
78 +    fCachedMom = mithep::FourVectorM();
79 + }
80 +
81 + //--------------------------------------------------------------------------------------------------
82 + inline void mithep::CaloTower::GetPos() const
83 + {
84 +  // Compute position.
85 +
86 +  fCachedPos.SetCoordinates(fPosition.Rho(), fPosition.Eta(), fPosition.Phi());
87 + }
88 +
89 + //--------------------------------------------------------------------------------------------------
90 + 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 +  return fCachedMom;
99 + }
100 +
101 + //--------------------------------------------------------------------------------------------------
102 + inline const mithep::ThreeVectorC &mithep::CaloTower::Position() const
103 + {
104 +  // Return cached momentum value.
105 +
106 +  if (!fCachePosFlag.IsValid()) {
107 +    GetPos();
108 +    fCachePosFlag.SetValid();
109 +  }
110 +  return fCachedPos;
111 + }
112   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines