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.27 by loizides, Tue Mar 3 17:04:09 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;
36 <      FourVector           Mom()                   const;
37 <      const Track         *Trk()                   const { return BestTrk();                }
38 <      Double_t             E()                     const;
39 <      Double_t             P()                     const;
40 <      Double_t             Pt()                    const;
41 <      Double_t             Px()                    const;
42 <      Double_t             Py()                    const;
43 <      Double_t             Pz()                    const;
44 <
45 <      Double_t    Mass()                           const { return 0.51099892e-3;            }
46 <      Double_t    ESuperClusterOverP()             const { return fESuperClusterOverP;      }
47 <      Double_t    ESeedClusterOverPout()           const { return fESeedClusterOverPout;    }
48 <      Double_t    ESeedClusterOverPIn()            const;
49 <      Double_t    PIn()                            const { return fPIn;                     }
50 <      Double_t    POut()                           const { return fPOut;                    }
51 <      Double_t    DeltaEtaSuperClusterTrackAtVtx() const { return fDeltaEtaSuperClTrkAtVtx; }
52 <      Double_t    DeltaEtaSeedClusterTrackAtCalo() const { return fDeltaEtaSeedClTrkAtCalo; }
53 <      Double_t    DeltaPhiSuperClusterTrackAtVtx() const { return fDeltaPhiSuperClTrkAtVtx; }
54 <      Double_t    DeltaPhiSeedClusterTrackAtCalo() const { return fDeltaPhiSeedClTrkAtCalo; }
55 <      Double_t    HadronicOverEm()                 const { return fHadronicOverEm;          }
56 <      Double_t    IsEnergyScaleCorrected()         const { return fIsEnergyScaleCorrected;  }
57 <      Double_t    IsMomentumCorrected()            const { return fIsMomentumCorrected;     }
58 <      Double_t    NumberOfClusters()               const { return fNumberOfClusters;        }
59 <      Double_t    Classification()                 const { return fClassification;          }
60 <      Double_t    E33()                            const { return fE33;                     }
61 <      Double_t    E55()                            const { return fE55;                     }
62 <      Double_t    CovEtaEta()                      const { return fCovEtaEta;               }
63 <      Double_t    CovEtaPhi()                      const { return fCovEtaPhi;               }
64 <      Double_t    CovPhiPhi()                      const { return fCovPhiPhi;               }
65 <      Double_t    CaloIsolation()                  const { return fCaloIsolation;           }
66 <      Double_t    CaloTowerIsolation()             const { return fCaloTowerIsolation;      }
67 <      Double_t    TrackIsolation()                 const { return fTrackIsolation;          }
68 <      Double_t    EcalJurassicIsolation()          const { return fEcalJurassicIsolation;   }
69 <      Double_t    HcalJurassicIsolation()          const { return fHcalJurassicIsolation;   }
70 <
71 <      Double_t    PassLooseID()                    const { return fPassLooseID;             }
72 <      Double_t    PassTightID()                    const { return fPassTightID;             }
73 <      Double_t    IDLikelihood()                   const { return fIDLikelihood;            }
74 <
75 <      void        SetGsfTrk(Track* t)                           { fGsfTrackRef = t;                }
76 <      void        SetTrackerTrk(Track* t)                       { fTrackerTrackRef = t;            }
77 <      void        SetSuperCluster(SuperCluster* sc)             { fSuperClusterRef = sc;           }
78 <      void        SetESuperClusterOverP(Double_t x)             { fESuperClusterOverP = x;         }
79 <      void        SetESeedClusterOverPout(Double_t x)           { fESeedClusterOverPout = x;       }
80 <      void        SetPIn(Double_t PIn)                          { fPIn = PIn;                      }
81 <      void        SetPOut(Double_t POut)                        { fPOut = POut;                    }
82 <      void        SetDeltaEtaSuperClusterTrackAtVtx(Double_t x) { fDeltaEtaSuperClTrkAtVtx = x;    }
83 <      void        SetDeltaEtaSeedClusterTrackAtCalo(Double_t x) { fDeltaEtaSeedClTrkAtCalo = x;    }
84 <      void        SetDeltaPhiSuperClusterTrackAtVtx(Double_t x) { fDeltaPhiSuperClTrkAtVtx = x;    }
85 <      void        SetDeltaPhiSeedClusterTrackAtCalo(Double_t x) { fDeltaPhiSeedClTrkAtCalo = x;    }
86 <      void        SetHadronicOverEm(Double_t x)                 { fHadronicOverEm = x;             }
87 <      void        SetIsEnergyScaleCorrected(Double_t x)         { fIsEnergyScaleCorrected = x;     }
88 <      void        SetIsMomentumCorrected(Double_t x)            { fIsMomentumCorrected = x;        }
89 <      void        SetNumberOfClusters(Double_t x)               { fNumberOfClusters = x;           }
90 <      void        SetClassification(Double_t x)                 { fClassification = x;             }
91 <      void        SetE33(Double_t E33)                          { fE33 = E33;                      }
92 <      void        SetE55(Double_t E55)                          { fE55 = E55;                      }
93 <      void        SetCovEtaEta(Double_t CovEtaEta)              { fCovEtaEta = CovEtaEta;          }
94 <      void        SetCovEtaPhi(Double_t CovEtaPhi)              { fCovEtaPhi = CovEtaPhi;          }
95 <      void        SetCovPhiPhi(Double_t CovPhiPhi)              { fCovPhiPhi = CovPhiPhi;          }
96 <      void        SetCaloIsolation(Double_t CaloIsolation)      { fCaloIsolation = CaloIsolation;  }
97 <      void        SetCaloTowerIsolation(Double_t TowerIso)      { fCaloTowerIsolation = TowerIso;  }
98 <      void        SetTrackIsolation(Double_t TrackIsolation)    { fTrackIsolation = TrackIsolation;}
99 <      void        SetEcalJurassicIsolation(Double_t iso )       { fEcalJurassicIsolation = iso;    }
100 <      void        SetHcalJurassicIsolation(Double_t iso )       { fHcalJurassicIsolation = iso;    }
101 <      void        SetPassLooseID(Double_t passLooseID)          { fPassLooseID = passLooseID;      }
102 <      void        SetPassTightID(Double_t passTightID)          { fPassTightID = passTightID;      }
103 <      void        SetIDLikelihood(Double_t likelihood)          { fIDLikelihood = likelihood;      }
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             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
45 >                             { return fDeltaEtaSuperClTrkAtVtx; }
46 >      Double_t             DeltaEtaSeedClusterTrackAtCalo() const
47 >                             { return fDeltaEtaSeedClTrkAtCalo; }
48 >      Double_t             DeltaPhiSuperClusterTrackAtVtx() const
49 >                             { return fDeltaPhiSuperClTrkAtVtx; }
50 >      Double_t             DeltaPhiSeedClusterTrackAtCalo() const
51 >                             { return fDeltaPhiSeedClTrkAtCalo; }
52 >      Double_t             E33()                   const { return fE33;                        }
53 >      Double_t             E55()                   const { return fE55;                        }
54 >      Double_t             EcalJurassicIsolation() const { return fEcalJurassicIsolation;      }
55 >      Double_t             ESuperClusterOverP()    const { return fESuperClusterOverP;         }
56 >      Double_t             ESeedClusterOverPout()  const { return fESeedClusterOverPout;       }
57 >      Double_t             ESeedClusterOverPIn()   const;
58 >      Double_t             IDLikelihood()          const { return fIDLikelihood;               }
59 >      Double_t             IsEnergyScaleCorrected()const { return fIsEnergyScaleCorrected;     }
60 >      Double_t             IsMomentumCorrected()   const { return fIsMomentumCorrected;        }
61 >      Double_t             HadronicOverEm()        const { return fHadronicOverEm;             }  
62 >      Bool_t               HasGsfTrk()             const { return fGsfTrackRef.IsValid();      }
63 >      Bool_t               HasTrackerTrk()         const { return fTrackerTrackRef.IsValid();  }
64 >      Bool_t               HasSuperCluster()       const { return fSuperClusterRef.IsValid();  }
65 >      Double_t             HcalIsolation()         const { return fHcalJurassicIsolation;      }
66 >      Double_t             NumberOfClusters()      const { return fNumberOfClusters;           }
67 >      EObjType             ObjType()               const { return kElectron;                   }
68 >      Double_t             PassLooseID()           const { return fPassLooseID;                }
69 >      Double_t             PassTightID()           const { return fPassTightID;                }
70 >      Double_t             PIn()                   const { return fPIn;                        }
71 >      Double_t             POut()                  const { return fPOut;                       }
72 >      Double_t             TrackIsolation()        const { return fTrackIsolation;             }
73 >      void                 SetGsfTrk(const Track* t)                    
74 >                             { fGsfTrackRef = t;     ClearMom(); ClearCharge(); }
75 >      void                 SetTrackerTrk(const Track* t)                
76 >                             { fTrackerTrackRef = t; ClearMom(); ClearCharge(); }
77 >      void                 SetSuperCluster(const SuperCluster* sc)      
78 >                             { fSuperClusterRef = sc; ClearMom(); }
79 >      void                 SetCaloIsolation(Double_t caloiso)    { fCaloIsolation = caloiso;   }
80 >      void                 SetCaloTowerIsolation(Double_t tiso)  { fCaloTowerIsolation = tiso; }
81 >      void                 SetClassification(Double_t x)         { fClassification = x;        }
82 >      void                 SetCovEtaEta(Double_t CovEtaEta)      { fCovEtaEta = CovEtaEta;     }
83 >      void                 SetCovEtaPhi(Double_t CovEtaPhi)      { fCovEtaPhi = CovEtaPhi;     }
84 >      void                 SetCovPhiPhi(Double_t CovPhiPhi)      { fCovPhiPhi = CovPhiPhi;     }
85 >      void                 SetCoviEtaiEta(Double_t CoviEtaiEta)  { fCoviEtaiEta = CoviEtaiEta; }
86 >      void                 SetDeltaEtaSuperClusterTrackAtVtx(Double_t x)  
87 >                             { fDeltaEtaSuperClTrkAtVtx = x;   }
88 >      void                 SetDeltaEtaSeedClusterTrackAtCalo(Double_t x)  
89 >                             { fDeltaEtaSeedClTrkAtCalo = x;   }
90 >      void                 SetDeltaPhiSuperClusterTrackAtVtx(Double_t x)  
91 >                             { fDeltaPhiSuperClTrkAtVtx = x;   }
92 >      void                 SetDeltaPhiSeedClusterTrackAtCalo(Double_t x)  
93 >                             { fDeltaPhiSeedClTrkAtCalo = x;   }
94 >      void                 SetE33(Double_t E33)                  { fE33 = E33;                     }
95 >      void                 SetE55(Double_t E55)                  { fE55 = E55;                     }
96 >      void                 SetEcalJurassicIso(Double_t iso )     { fEcalJurassicIsolation = iso;   }
97 >      void                 SetESuperClusterOverP(Double_t x)     { fESuperClusterOverP = x;        }
98 >      void                 SetESeedClusterOverPout(Double_t x)   { fESeedClusterOverPout = x;      }
99 >      void                 SetHadronicOverEm(Double_t x)         { fHadronicOverEm = x;            }
100 >      void                 SetIDLikelihood(Double_t likelihood)  { fIDLikelihood = likelihood;     }
101 >      void                 SetIsEnergyScaleCorrected(Double_t x) { fIsEnergyScaleCorrected = x;    }
102 >      void                 SetIsMomentumCorrected(Double_t x)    { fIsMomentumCorrected = x;       }
103 >      void                 SetHcalIsolation(Double_t iso )       { fHcalJurassicIsolation = iso;   }
104 >      void                 SetNumberOfClusters(Double_t x)       { fNumberOfClusters = x;          }
105 >      void                 SetPassLooseID(Double_t passLooseID)  { fPassLooseID = passLooseID;     }
106 >      void                 SetPassTightID(Double_t passTightID)  { fPassTightID = passTightID;     }
107 >      void                 SetPIn(Double_t PIn)                  { fPIn = PIn;                     }
108 >      void                 SetPOut(Double_t POut)                { fPOut = POut;                   }
109 >      void                 SetTrackIsolation(Double_t trkiso)    { fTrackIsolation = trkiso;       }
110  
111      protected:
112 <      TRef                 fGsfTrackRef;     //global combined track reference
113 <      TRef                 fTrackerTrackRef; //tracker track reference
114 <      TRef                 fSuperClusterRef; //superCluster
115 <
116 <      Double_t             fESuperClusterOverP;
117 <      Double_t             fESeedClusterOverPout;
118 <      Double_t             fDeltaEtaSuperClTrkAtVtx;
119 <      Double_t             fDeltaEtaSeedClTrkAtCalo;
120 <      Double_t             fDeltaPhiSuperClTrkAtVtx;
121 <      Double_t             fDeltaPhiSeedClTrkAtCalo;
122 <      Double_t             fHadronicOverEm;
123 <      Double_t             fIsEnergyScaleCorrected;
124 <      Double_t             fIsMomentumCorrected;      
125 <      Double_t             fNumberOfClusters;
126 <      Double_t             fClassification;          
127 <      Double_t             fE33;
128 <      Double_t             fE55;
129 <      Double_t             fCovEtaEta;
130 <      Double_t             fCovEtaPhi;
131 <      Double_t             fCovPhiPhi;
132 <      Double_t             fCaloIsolation;
133 <      Double_t             fCaloTowerIsolation;
134 <      Double_t             fTrackIsolation;
135 <      Double_t             fEcalJurassicIsolation;
136 <      Double_t             fHcalJurassicIsolation;
137 <      Double_t             fPassLooseID;
138 <      Double_t             fPassTightID;
139 <      Double_t             fIDLikelihood;
140 <      Double_t             fPIn;
141 <      Double_t             fPOut;
112 >      Double_t             GetMass()               const         { return 0.51099892e-3;           }
113 >      void                 GetMom()                const;
114 >
115 >      Ref<Track>           fGsfTrackRef;               //gsf track reference
116 >      Ref<Track>           fTrackerTrackRef;           //tracker track reference
117 >      Ref<SuperCluster>    fSuperClusterRef;           //reference to SuperCluster
118 >      Double32_t           fESuperClusterOverP;        //
119 >      Double32_t           fESeedClusterOverPout;      //
120 >      Double32_t           fDeltaEtaSuperClTrkAtVtx;   //
121 >      Double32_t           fDeltaEtaSeedClTrkAtCalo;   //
122 >      Double32_t           fDeltaPhiSuperClTrkAtVtx;   //
123 >      Double32_t           fDeltaPhiSeedClTrkAtCalo;   //
124 >      Double32_t           fHadronicOverEm;            //
125 >      Double32_t           fIsEnergyScaleCorrected;    //
126 >      Double32_t           fIsMomentumCorrected;       //
127 >      Double32_t           fNumberOfClusters;          //
128 >      Double32_t           fClassification;            //
129 >      Double32_t           fE33;                       //
130 >      Double32_t           fE55;                       //
131 >      Double32_t           fCovEtaEta;                 //
132 >      Double32_t           fCoviEtaiEta;               //
133 >      Double32_t           fCovEtaPhi;                 //
134 >      Double32_t           fCovPhiPhi;                 //
135 >      Double32_t           fCaloIsolation;             //
136 >      Double32_t           fCaloTowerIsolation;        //
137 >      Double32_t           fTrackIsolation;            //
138 >      Double32_t           fEcalJurassicIsolation;     //
139 >      Double32_t           fHcalJurassicIsolation;     //
140 >      Double32_t           fPassLooseID;               //
141 >      Double32_t           fPassTightID;               //
142 >      Double32_t           fIDLikelihood;              //
143 >      Double32_t           fPIn;                       //
144 >      Double32_t           fPOut;                      //
145  
146      ClassDef(Electron, 1) // Electron class
147    };
# Line 136 | Line 152 | inline const mithep::Track *mithep::Elec
152   {
153    // Return "best" track.
154  
155 <  if (GsfTrk())
155 >  if (HasGsfTrk())
156      return GsfTrk();
157 <  else if (TrackerTrk())
157 >  else if (HasTrackerTrk())
158      return TrackerTrk();
159  
160    return 0;
161   }
162  
163   //--------------------------------------------------------------------------------------------------
164 < 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
164 > inline void mithep::Electron::GetMom() const
165   {
166 <  // Return tracker track.
166 >  // Get momentum of the electron. We use the direction of the
167 >  // track and the energy of the SuperCluster.
168  
169 <  return static_cast<const Track*>(fTrackerTrackRef.GetObject());
161 < }
162 < //--------------------------------------------------------------------------------------------------
163 < inline const mithep::SuperCluster *mithep::Electron::SCluster() const
164 < {
165 <  // Return Super cluster
169 >  const mithep::Track *trk = Trk();
170  
171 <  return static_cast<const SuperCluster*>(fSuperClusterRef.GetObject());
172 < }
171 >  if (!trk) {
172 >    fCachedMom.SetCoordinates(0,0,0,0);
173 >    return;
174 >  }
175  
176 < //-------------------------------------------------------------------------------------------------
177 < 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
175 <
176 <  return FourVector(Px(), Py(), Pz(), E());
177 < }
178 <
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 <  
194 <  const mithep::SuperCluster *sc = SCluster();
195 <  if (sc)
196 <    return sc->Energy();
197 <  else
198 <    return TMath::Sqrt(Trk()->P()*Trk()->P() + Mass()*Mass());
199 < }
176 >  Double_t p = 0;
177 >  Double_t mass = GetMass();
178  
201 //-------------------------------------------------------------------------------------------------
202 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  
179    const mithep::SuperCluster *sc = SCluster();
180    if (sc)
181 <    return TMath::Sqrt(sc->Energy()*sc->Energy() - Mass()*Mass());
181 >    p = TMath::Sqrt(sc->Energy()*sc->Energy() - mass*mass);
182    else
183 <    return Trk()->P();
212 < }
183 >    p = trk->P();
184  
185 < //-------------------------------------------------------------------------------------------------
186 < inline Double_t mithep::Electron::Px() const
216 < {
217 <  return Pt()*TMath::Cos(Trk()->Phi());
185 >  Double_t pt = TMath::Abs(p*TMath::Cos(trk->Lambda()));
186 >  fCachedMom.SetCoordinates(pt,trk->Eta(),trk->Phi(),mass);
187   }
188  
189   //-------------------------------------------------------------------------------------------------
190 < 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
190 > inline Double_t mithep::Electron::ESeedClusterOverPIn() const
191   {
192 <  return TMath::Abs(P()*TMath::Cos(Trk()->Lambda()));
192 >  // Return energy of the SuperCluster seed divided by the magnitude
193 >  // of the track momentum at the vertex.
194 >  
195 >  return SCluster()->Seed()->Energy() / PIn();
196   }
197   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines