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

Comparing UserCode/MitAna/DataTree/interface/Electron.h (file contents):
Revision 1.18 by bendavid, Fri Sep 12 12:44:57 2008 UTC vs.
Revision 1.26 by bendavid, Thu Feb 26 17:06:24 2009 UTC

# Line 3 | Line 3
3   //
4   // Electron
5   //
6 < // Details to be worked out...
6 > // Details to be worked out... TODO: Needs description ala Muon class
7   //
8   // Authors: C.Loizides, J.Bendavid, S.Xie
9   //--------------------------------------------------------------------------------------------------
10  
11 < #ifndef DATATREE_ELECTRON_H
12 < #define DATATREE_ELECTRON_H
11 > #ifndef MITANA_DATATREE_ELECTRON_H
12 > #define MITANA_DATATREE_ELECTRON_H
13  
14   #include "MitAna/DataTree/interface/SuperCluster.h"
15   #include "MitAna/DataTree/interface/ChargedParticle.h"
16 + #include "MitAna/DataCont/interface/Ref.h"
17  
18   namespace mithep
19   {
20    class Electron : public ChargedParticle
21    {
22      public:
23 <      Electron() {}
24 <      ~Electron() {}
23 >      Electron() : fESuperClusterOverP(0), fESeedClusterOverPout(0), fDeltaEtaSuperClTrkAtVtx(0),
24 >                   fDeltaEtaSeedClTrkAtCalo(0), fDeltaPhiSuperClTrkAtVtx(0),
25 >                   fDeltaPhiSeedClTrkAtCalo(0), fHadronicOverEm(0), fIsEnergyScaleCorrected(0),
26 >                   fIsMomentumCorrected(0), fNumberOfClusters(0), fClassification(0), fE33(0),
27 >                   fE55(0), fCovEtaEta(0), fCoviEtaiEta(0), fCovEtaPhi(0), fCovPhiPhi(0),
28 >                   fCaloIsolation(0), fCaloTowerIsolation(0), fTrackIsolation(0),
29 >                   fEcalJurassicIsolation(0), fHcalJurassicIsolation(0), fPassLooseID(0),
30 >                   fPassTightID(0), fIDLikelihood(0), fPIn(0), fPOut(0) {}
31        
32        const Track         *BestTrk()               const;
33 <      const Track         *GsfTrk()                const;
34 <      const Track         *TrackerTrk()            const;
35 <      const SuperCluster  *SCluster()              const;
29 <      FourVector           Mom()                   const;
33 >      const Track         *GsfTrk()                const { return fGsfTrackRef.Obj();       }
34 >      const Track         *TrackerTrk()            const { return fTrackerTrackRef.Obj();   }
35 >      const SuperCluster  *SCluster()              const { return fSuperClusterRef.Obj();   }
36        const Track         *Trk()                   const { return BestTrk();                }
37 <      Double_t             E()                     const;
38 <      Double_t             P()                     const;
39 <      Double_t             Pt()                    const;
40 <      Double_t             Px()                    const;
41 <      Double_t             Py()                    const;
42 <      Double_t             Pz()                    const;
43 <
38 <      Double_t    Mass()                           const { return 0.51099892e-3;            }
39 <      Double_t    ESuperClusterOverP()             const { return fESuperClusterOverP;      }
40 <      Double_t    ESeedClusterOverPout()           const { return fESeedClusterOverPout;    }
41 <      Double_t    ESeedClusterOverPIn()            const;
42 <      Double_t    PIn()                            const { return fPIn;                     }
43 <      Double_t    POut()                           const { return fPOut;                    }
37 >      Double_t    CaloIsolation()                  const { return fCaloIsolation;           }
38 >      Double_t    CaloTowerIsolation()             const { return fCaloTowerIsolation;      }
39 >      Double_t    Classification()                 const { return fClassification;          }
40 >      Double_t    CovEtaEta()                      const { return fCovEtaEta;               }
41 >      Double_t    CovEtaPhi()                      const { return fCovEtaPhi;               }
42 >      Double_t    CovPhiPhi()                      const { return fCovPhiPhi;               }
43 >      Double_t    CoviEtaiEta()                    const { return fCoviEtaiEta;             }
44        Double_t    DeltaEtaSuperClusterTrackAtVtx() const { return fDeltaEtaSuperClTrkAtVtx; }
45        Double_t    DeltaEtaSeedClusterTrackAtCalo() const { return fDeltaEtaSeedClTrkAtCalo; }
46        Double_t    DeltaPhiSuperClusterTrackAtVtx() const { return fDeltaPhiSuperClTrkAtVtx; }
47        Double_t    DeltaPhiSeedClusterTrackAtCalo() const { return fDeltaPhiSeedClTrkAtCalo; }
48      Double_t    HadronicOverEm()                 const { return fHadronicOverEm;          }
49      Double_t    IsEnergyScaleCorrected()         const { return fIsEnergyScaleCorrected;  }
50      Double_t    IsMomentumCorrected()            const { return fIsMomentumCorrected;     }
51      Double_t    NumberOfClusters()               const { return fNumberOfClusters;        }
52      Double_t    Classification()                 const { return fClassification;          }
48        Double_t    E33()                            const { return fE33;                     }
49        Double_t    E55()                            const { return fE55;                     }
55      Double_t    CovEtaEta()                      const { return fCovEtaEta;               }
56      Double_t    CovEtaPhi()                      const { return fCovEtaPhi;               }
57      Double_t    CovPhiPhi()                      const { return fCovPhiPhi;               }
58      Double_t    CaloIsolation()                  const { return fCaloIsolation;           }
59      Double_t    CaloTowerIsolation()             const { return fCaloTowerIsolation;      }
60      Double_t    TrackIsolation()                 const { return fTrackIsolation;          }
50        Double_t    EcalJurassicIsolation()          const { return fEcalJurassicIsolation;   }
51 <      Double_t    HcalJurassicIsolation()          const { return fHcalJurassicIsolation;   }
52 <
51 >      Double_t    ESuperClusterOverP()             const { return fESuperClusterOverP;      }
52 >      Double_t    ESeedClusterOverPout()           const { return fESeedClusterOverPout;    }
53 >      Double_t    ESeedClusterOverPIn()            const;
54 >      Double_t    IDLikelihood()                   const { return fIDLikelihood;            }
55 >      Double_t    IsEnergyScaleCorrected()         const { return fIsEnergyScaleCorrected;  }
56 >      Double_t    IsMomentumCorrected()            const { return fIsMomentumCorrected;     }
57 >      Double_t    HadronicOverEm()                 const { return fHadronicOverEm;          }
58 >      Bool_t      HasGsfTrk()                      const { return fGsfTrackRef.IsValid();   }
59 >      Bool_t      HasTrackerTrk()                  const { return fTrackerTrackRef.IsValid(); }
60 >      Bool_t      HasSuperCluster()                const { return fSuperClusterRef.IsValid(); }
61 >      Double_t    HcalIsolation()                  const { return fHcalJurassicIsolation;   }
62 >      Double_t    NumberOfClusters()               const { return fNumberOfClusters;        }
63 >      EObjType    ObjType()                        const { return kElectron;                }      
64        Double_t    PassLooseID()                    const { return fPassLooseID;             }
65        Double_t    PassTightID()                    const { return fPassTightID;             }
66 <      Double_t    IDLikelihood()                   const { return fIDLikelihood;            }
67 <
68 <      void        SetGsfTrk(Track* t)                           { fGsfTrackRef = t;                }
69 <      void        SetTrackerTrk(Track* t)                       { fTrackerTrackRef = t;            }
70 <      void        SetSuperCluster(SuperCluster* sc)             { fSuperClusterRef = sc;           }
71 <      void        SetESuperClusterOverP(Double_t x)             { fESuperClusterOverP = x;         }
72 <      void        SetESeedClusterOverPout(Double_t x)           { fESeedClusterOverPout = x;       }
73 <      void        SetPIn(Double_t PIn)                          { fPIn = PIn;                      }
74 <      void        SetPOut(Double_t POut)                        { fPOut = POut;                    }
66 >      Double_t    PIn()                            const { return fPIn;                     }
67 >      Double_t    POut()                           const { return fPOut;                    }
68 >      Double_t    TrackIsolation()                 const { return fTrackIsolation;          }
69 >      void        SetGsfTrk(const Track* t)                     { fGsfTrackRef = t; ClearMom(); ClearCharge(); }
70 >      void        SetTrackerTrk(const Track* t)                 { fTrackerTrackRef = t; ClearMom(); ClearCharge(); }
71 >      void        SetSuperCluster(const SuperCluster* sc)       { fSuperClusterRef = sc; ClearMom(); }
72 >      void        SetCaloIsolation(Double_t CaloIsolation)      { fCaloIsolation = CaloIsolation;  }
73 >      void        SetCaloTowerIsolation(Double_t TowerIso)      { fCaloTowerIsolation = TowerIso;  }
74 >      void        SetClassification(Double_t x)                 { fClassification = x;             }
75 >      void        SetCovEtaEta(Double_t CovEtaEta)              { fCovEtaEta = CovEtaEta;          }
76 >      void        SetCovEtaPhi(Double_t CovEtaPhi)              { fCovEtaPhi = CovEtaPhi;          }
77 >      void        SetCovPhiPhi(Double_t CovPhiPhi)              { fCovPhiPhi = CovPhiPhi;          }
78 >      void        SetCoviEtaiEta(Double_t CoviEtaiEta)          { fCoviEtaiEta = CoviEtaiEta;      }
79        void        SetDeltaEtaSuperClusterTrackAtVtx(Double_t x) { fDeltaEtaSuperClTrkAtVtx = x;    }
80        void        SetDeltaEtaSeedClusterTrackAtCalo(Double_t x) { fDeltaEtaSeedClTrkAtCalo = x;    }
81        void        SetDeltaPhiSuperClusterTrackAtVtx(Double_t x) { fDeltaPhiSuperClTrkAtVtx = x;    }
82        void        SetDeltaPhiSeedClusterTrackAtCalo(Double_t x) { fDeltaPhiSeedClTrkAtCalo = x;    }
83 +      void        SetE33(Double_t E33)                          { fE33 = E33;                      }
84 +      void        SetE55(Double_t E55)                          { fE55 = E55;                      }
85 +      void        SetEcalJurassicIsolation(Double_t iso )       { fEcalJurassicIsolation = iso;    }
86 +      void        SetESuperClusterOverP(Double_t x)             { fESuperClusterOverP = x;         }
87 +      void        SetESeedClusterOverPout(Double_t x)           { fESeedClusterOverPout = x;       }
88        void        SetHadronicOverEm(Double_t x)                 { fHadronicOverEm = x;             }
89 +      void        SetIDLikelihood(Double_t likelihood)          { fIDLikelihood = likelihood;      }
90        void        SetIsEnergyScaleCorrected(Double_t x)         { fIsEnergyScaleCorrected = x;     }
91        void        SetIsMomentumCorrected(Double_t x)            { fIsMomentumCorrected = x;        }
92 +      void        SetHcalIsolation(Double_t iso )               { fHcalJurassicIsolation = iso;    }
93        void        SetNumberOfClusters(Double_t x)               { fNumberOfClusters = x;           }
83      void        SetClassification(Double_t x)                 { fClassification = x;             }
84      void        SetE33(Double_t E33)                          { fE33 = E33;                      }
85      void        SetE55(Double_t E55)                          { fE55 = E55;                      }
86      void        SetCovEtaEta(Double_t CovEtaEta)              { fCovEtaEta = CovEtaEta;          }
87      void        SetCovEtaPhi(Double_t CovEtaPhi)              { fCovEtaPhi = CovEtaPhi;          }
88      void        SetCovPhiPhi(Double_t CovPhiPhi)              { fCovPhiPhi = CovPhiPhi;          }
89      void        SetCaloIsolation(Double_t CaloIsolation)      { fCaloIsolation = CaloIsolation;  }
90      void        SetCaloTowerIsolation(Double_t TowerIso)      { fCaloTowerIsolation = TowerIso;  }
91      void        SetTrackIsolation(Double_t TrackIsolation)    { fTrackIsolation = TrackIsolation;}
92      void        SetEcalJurassicIsolation(Double_t iso )       { fEcalJurassicIsolation = iso;    }
93      void        SetHcalJurassicIsolation(Double_t iso )       { fHcalJurassicIsolation = iso;    }
94        void        SetPassLooseID(Double_t passLooseID)          { fPassLooseID = passLooseID;      }
95        void        SetPassTightID(Double_t passTightID)          { fPassTightID = passTightID;      }
96 <      void        SetIDLikelihood(Double_t likelihood)          { fIDLikelihood = likelihood;      }
96 >      void        SetPIn(Double_t PIn)                          { fPIn = PIn;                      }
97 >      void        SetPOut(Double_t POut)                        { fPOut = POut;                    }
98 >      void        SetTrackIsolation(Double_t trkiso)            { fTrackIsolation = trkiso;        }
99  
100      protected:
101 <      TRef                 fGsfTrackRef;     //global combined track reference
102 <      TRef                 fTrackerTrackRef; //tracker track reference
103 <      TRef                 fSuperClusterRef; //superCluster
104 <
105 <      Double_t             fESuperClusterOverP;
106 <      Double_t             fESeedClusterOverPout;
107 <      Double_t             fDeltaEtaSuperClTrkAtVtx;
108 <      Double_t             fDeltaEtaSeedClTrkAtCalo;
109 <      Double_t             fDeltaPhiSuperClTrkAtVtx;
110 <      Double_t             fDeltaPhiSeedClTrkAtCalo;
111 <      Double_t             fHadronicOverEm;
112 <      Double_t             fIsEnergyScaleCorrected;
113 <      Double_t             fIsMomentumCorrected;      
114 <      Double_t             fNumberOfClusters;
115 <      Double_t             fClassification;          
116 <      Double_t             fE33;
117 <      Double_t             fE55;
118 <      Double_t             fCovEtaEta;
119 <      Double_t             fCovEtaPhi;
120 <      Double_t             fCovPhiPhi;
121 <      Double_t             fCaloIsolation;
122 <      Double_t             fCaloTowerIsolation;
123 <      Double_t             fTrackIsolation;
124 <      Double_t             fEcalJurassicIsolation;
125 <      Double_t             fHcalJurassicIsolation;
126 <      Double_t             fPassLooseID;
127 <      Double_t             fPassTightID;
128 <      Double_t             fIDLikelihood;
129 <      Double_t             fPIn;
130 <      Double_t             fPOut;
101 >      Double_t    GetMass()                  const              { return 0.51099892e-3;            }
102 >      void        GetMom()                   const;
103 >
104 >      Ref<Track>  fGsfTrackRef;               //gsf track reference
105 >      Ref<Track>  fTrackerTrackRef;           //tracker track reference
106 >      Ref<SuperCluster> fSuperClusterRef;     //reference to SuperCluster
107 >      Double_t    fESuperClusterOverP;        //
108 >      Double_t    fESeedClusterOverPout;      //
109 >      Double_t    fDeltaEtaSuperClTrkAtVtx;   //
110 >      Double_t    fDeltaEtaSeedClTrkAtCalo;   //
111 >      Double_t    fDeltaPhiSuperClTrkAtVtx;   //
112 >      Double_t    fDeltaPhiSeedClTrkAtCalo;   //
113 >      Double_t    fHadronicOverEm;            //
114 >      Double_t    fIsEnergyScaleCorrected;    //
115 >      Double_t    fIsMomentumCorrected;       //
116 >      Double_t    fNumberOfClusters;          //
117 >      Double_t    fClassification;            //
118 >      Double_t    fE33;                       //
119 >      Double_t    fE55;                       //
120 >      Double_t    fCovEtaEta;                 //
121 >      Double_t    fCoviEtaiEta;               //
122 >      Double_t    fCovEtaPhi;                 //
123 >      Double_t    fCovPhiPhi;                 //
124 >      Double_t    fCaloIsolation;             //
125 >      Double_t    fCaloTowerIsolation;        //
126 >      Double_t    fTrackIsolation;            //
127 >      Double_t    fEcalJurassicIsolation;     //
128 >      Double_t    fHcalJurassicIsolation;     //
129 >      Double_t    fPassLooseID;               //
130 >      Double_t    fPassTightID;               //
131 >      Double_t    fIDLikelihood;              //
132 >      Double_t    fPIn;                       //
133 >      Double_t    fPOut;                      //
134  
135      ClassDef(Electron, 1) // Electron class
136    };
# Line 136 | Line 141 | inline const mithep::Track *mithep::Elec
141   {
142    // Return "best" track.
143  
144 <  if (GsfTrk())
144 >  if (HasGsfTrk())
145      return GsfTrk();
146 <  else if (TrackerTrk())
146 >  else if (HasTrackerTrk())
147      return TrackerTrk();
148  
149    return 0;
150   }
151  
152   //--------------------------------------------------------------------------------------------------
153 < inline const mithep::Track *mithep::Electron::GsfTrk() const
149 < {
150 <  // Return global combined track.
151 <
152 <  return static_cast<const Track*>(fGsfTrackRef.GetObject());
153 < }
154 <
155 < //--------------------------------------------------------------------------------------------------
156 < inline const mithep::Track *mithep::Electron::TrackerTrk() const
153 > inline void mithep::Electron::GetMom() const
154   {
155 <  // Return tracker track.
155 >  // Get momentum of the electron. We use the direction of the
156 >  // track and the energy of the SuperCluster.
157  
158 <  return static_cast<const Track*>(fTrackerTrackRef.GetObject());
161 < }
162 < //--------------------------------------------------------------------------------------------------
163 < inline const mithep::SuperCluster *mithep::Electron::SCluster() const
164 < {
165 <  // Return Super cluster
158 >  const mithep::Track *trk = Trk();
159  
160 <  return static_cast<const SuperCluster*>(fSuperClusterRef.GetObject());
161 < }
162 <
163 < //-------------------------------------------------------------------------------------------------
171 < inline mithep::FourVector mithep::Electron::Mom() const
172 < {
173 <  // Return Momentum of the electron. We use the direction of the
174 <  // Track and the Energy of the Super Cluster
160 >  if (!trk) {
161 >    fCachedMom.SetCoordinates(0,0,0,0);
162 >    return;
163 >  }
164  
165 <  return FourVector(Px(), Py(), Pz(), E());
166 < }
165 >  Double_t p = 0;
166 >  Double_t mass = GetMass();
167  
179 //-------------------------------------------------------------------------------------------------
180 inline Double_t mithep::Electron::ESeedClusterOverPIn() const
181 {
182  // Return Energy of the SuperCluster Seed Divided by the magnitude
183  // of the track momentum at the vertex
184  
185  return SCluster()->Seed()->Energy() / PIn();
186 }
187
188 //-------------------------------------------------------------------------------------------------
189 inline Double_t mithep::Electron::E() const
190 {
191  // Return Energy of the SuperCluster if present
192  // or else return energy derived from the track
193  
168    const mithep::SuperCluster *sc = SCluster();
169    if (sc)
170 <    return sc->Energy();
170 >    p = TMath::Sqrt(sc->Energy()*sc->Energy() - mass*mass);
171    else
172 <    return TMath::Sqrt(Trk()->P()*Trk()->P() + Mass()*Mass());
199 < }
172 >    p = trk->P();
173  
174 < //-------------------------------------------------------------------------------------------------
175 < inline Double_t mithep::Electron::P() const
203 < {
204 <  // Return momentum derived from the SuperCluster if present
205 <  // or else return momentum from the track
206 <  
207 <  const mithep::SuperCluster *sc = SCluster();
208 <  if (sc)
209 <    return TMath::Sqrt(sc->Energy()*sc->Energy() - Mass()*Mass());
210 <  else
211 <    return Trk()->P();
174 >  Double_t pt = TMath::Abs(p*TMath::Cos(trk->Lambda()));
175 >  fCachedMom.SetCoordinates(pt,trk->Eta(),trk->Phi(),mass);
176   }
177  
178   //-------------------------------------------------------------------------------------------------
179 < inline Double_t mithep::Electron::Px() const
216 < {
217 <  return Pt()*TMath::Cos(Trk()->Phi());
218 < }
219 <
220 < //-------------------------------------------------------------------------------------------------
221 < inline Double_t mithep::Electron::Py() const
222 < {
223 <  return Pt()*TMath::Sin(Trk()->Phi());
224 < }
225 <
226 < //-------------------------------------------------------------------------------------------------
227 < inline Double_t mithep::Electron::Pz() const
228 < {
229 <  return P()*TMath::Sin(Trk()->Lambda());
230 < }
231 <
232 < //-------------------------------------------------------------------------------------------------
233 < inline Double_t mithep::Electron::Pt() const
179 > inline Double_t mithep::Electron::ESeedClusterOverPIn() const
180   {
181 <  return TMath::Abs(P()*TMath::Cos(Trk()->Lambda()));
181 >  // Return energy of the SuperCluster seed divided by the magnitude
182 >  // of the track momentum at the vertex.
183 >  
184 >  return SCluster()->Seed()->Energy() / PIn();
185   }
186   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines