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.11 by loizides, Sun Mar 8 12:09:58 2009 UTC vs.
Revision 1.16 by paus, Sun Oct 23 01:53:16 2011 UTC

# Line 3 | Line 3
3   //
4   // CaloTower
5   //
6 < // This class holds calo tower information.
6 > // 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   //
10   // Authors: S.Xie
11   //--------------------------------------------------------------------------------------------------
# Line 21 | Line 23 | namespace mithep
23    class CaloTower : public DataObject
24    {
25      public:
26 <      CaloTower() : fEmEnergy(0), fHadEnergy(0), fOuterEnergy(0) {}
26 >      CaloTower() : fEmEnergy(0), fHadEnergy(0), fOuterEnergy(0), fMass(0) {}
27  
28        Double_t             E()           const { return (fEmEnergy + fHadEnergy);                }
29        Double_t             EmEt()        const { return fEmEnergy*TMath::Sin(Theta());           }
# Line 32 | Line 34 | namespace mithep
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 +      Double_t             Mass()        const { return fMass;                                   }
38        const FourVectorM   &Mom()         const;
39        Double_t             Phi()         const { return fPosition.Phi();                         }
40 +      Double_t             Pt()          const { Double_t r=Et(); if(r<0) r=0; return r;         }
41        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 <      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(); }
46 >      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 >      void                 SetMass(Double_t mass) { fMass = mass;      }
53        void                 SetPosition(Double_t x, Double_t y, Double_t z)
54                               { fPosition.SetXYZ(x,y,z); ClearMom(); ClearPos(); }
55  
# Line 58 | Line 63 | namespace mithep
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 +      Double32_t           fMass;         //[0,0,14]tower mass
67        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  
72 <    ClassDef(CaloTower, 1) // Calo tower class
72 >    ClassDef(CaloTower, 2) // Calo tower class
73    };
74   }
75  
# Line 71 | Line 77 | namespace mithep
77   inline void mithep::CaloTower::GetMom() const
78   {
79    // Compute four momentum.
80 <
81 <  if (E() > 0)
82 <    fCachedMom.SetCoordinates(Et(),Eta(),Phi(),0.0);
80 >  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    else
86      fCachedMom = mithep::FourVectorM();
87   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines