NtupleReader/NtupleReader/MyParticlePair.ixx

00001 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00002 // 10.12.2006, AUTHOR: STEFFEN KAISER
00003 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00004 
00005 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00006 //:: IMPLEMENTATION OF INLINE METHODS DEFINED IN THE CLASS MyParticlePair ::
00007 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00008 
00009 //*****************************************************************************
00010 
00011 //:::::::::::::::::
00012 //:: METHOD init ::
00013 //:::::::::::::::::
00014 
00015 inline void MyParticlePair::init(MyParticle* particle1,
00016                                  MyParticle* particle2) {
00017 
00018     m_particle1 = particle1;
00019     m_particle2 = particle2;
00020 
00021     return;
00022 
00023 }
00024 
00025 //*****************************************************************************
00026 
00027 //:::::::::::::::::::::::::
00028 //:: METHOD get_particle1 ::
00029 //:::::::::::::::::::::::::
00030 
00031 inline MyParticle* MyParticlePair::get_particle1(void) const {
00032 
00033     return m_particle1;
00034 
00035 }
00036 
00037 //*****************************************************************************
00038 
00039 //::::::::::::::::::::::::::
00040 //:: METHOD get_particle2 ::
00041 //::::::::::::::::::::::::::
00042 
00043 inline MyParticle* MyParticlePair::get_particle2(void) const {
00044 
00045     return m_particle2;
00046 
00047 }
00048 
00049 //*****************************************************************************
00050 
00051 //::::::::::::::::
00052 //:: METHOD tlv ::
00053 //::::::::::::::::
00054 
00055 inline TLorentzVector MyParticlePair::tlv(void) const {
00056 
00057     return (TLorentzVector)(m_particle1->tlv() + m_particle2->tlv());
00058 
00059 }
00060 
00061 //*****************************************************************************
00062 
00063 //::::::::::::::::::::
00064 //:: METHOD EtaProd ::
00065 //::::::::::::::::::::
00066 
00067 inline double MyParticlePair::EtaProd(void) const {
00068 
00069         return (double)(m_particle1->tlv().Eta() * m_particle2->tlv().Eta());
00070 
00071 }
00072 
00073 //*****************************************************************************
00074 
00075 //:::::::::::::::::::::
00076 //:: METHOD DeltaPhi ::
00077 //:::::::::::::::::::::
00078 
00079 inline double MyParticlePair::DeltaPhi(void) const {
00080 
00081     return (double) (m_particle1->tlv()).DeltaPhi(m_particle2->tlv());
00082 
00083 }
00084 
00085 //*****************************************************************************
00086 
00087 //::::::::::::::::::::::::
00088 //:: METHOD AbsDeltaPhi ::
00089 //::::::::::::::::::::::::
00090 
00091 inline double MyParticlePair::AbsDeltaPhi(void) const {
00092 
00093     return TMath::Abs( DeltaPhi() ) ;
00094 
00095 }
00096 
00097 //*****************************************************************************
00098 
00099 //:::::::::::::::::::
00100 //:: METHOD DeltaR ::
00101 //:::::::::::::::::::
00102 
00103 inline double MyParticlePair::DeltaR(void) const {
00104 
00105     return (double) (m_particle1->tlv()).DeltaR(m_particle2->tlv());
00106 
00107 }
00108 
00109 //*****************************************************************************
00110 
00111 //::::::::::::::
00112 //:: METHOD M ::
00113 //::::::::::::::
00114 
00115 inline double MyParticlePair::M(void) const {
00116 
00117     return (double) (m_particle1->tlv()+m_particle2->tlv()).M();
00118 
00119 }
00120 
00121 //*****************************************************************************
00122 
00123 //:::::::::::::::::::::
00124 //:: METHOD DeltaEta ::
00125 //:::::::::::::::::::::
00126 
00127 inline double MyParticlePair::DeltaEta(void) const {
00128 
00129     double eta1 =  m_particle1->tlv().Eta();
00130     double eta2 =  m_particle2->tlv().Eta();
00131 
00132     return (eta1 - eta2) ;
00133 
00134 }
00135 
00136 //*****************************************************************************
00137 
00138 //::::::::::::::::::::::::
00139 //:: METHOD AbsDeltaEta ::
00140 //::::::::::::::::::::::::
00141 
00142 inline double MyParticlePair::AbsDeltaEta(void) const {
00143 
00144     return TMath::Abs( DeltaEta() ) ;
00145 
00146 }
00147 
00148 //*****************************************************************************
00149 
00150 //::::::::::::::::::::
00151 //:: METHOD DeltaPt ::
00152 //::::::::::::::::::::
00153 
00154 inline double MyParticlePair::DeltaPt(void) const {
00155 
00156     double pt1 =  m_particle1->tlv().Pt();
00157     double pt2 =  m_particle2->tlv().Pt();
00158 
00159     return (pt1 - pt2) ;
00160 
00161 }
00162 
00163 //*****************************************************************************
00164 
00165 //:::::::::::::::::::::::
00166 //:: METHOD AbsDeltaPt ::
00167 //:::::::::::::::::::::::
00168 
00169 inline double MyParticlePair::AbsDeltaPt(void) const {
00170 
00171     return TMath::Abs( DeltaPt() ) ;
00172 
00173 }
00174 
00175 
00176 //*****************************************************************************
00177 
00178 //:::::::::::::::::::::::::::::::
00179 //:: METHOD get_lepton_flavors ::
00180 //:::::::::::::::::::::::::::::::
00181 
00182 TString
00183 MyParticlePair::get_lepton_flavors(void) {
00184 
00185     int pdgId1 = m_particle1->pdgId();
00186     int pdgId2 = m_particle2->pdgId();
00187 
00188     TString type1 = pdgIdToString(pdgId1);
00189     TString type2 = pdgIdToString(pdgId2);
00190 
00191     TString lp_type = type1+type2;
00192 
00193     if (lp_type == "mue"){
00194         lp_type = "emu";
00195     }
00196 
00197     if(lp_type.Contains("unknown")){
00198         std::cout << "WARNING: get_lepton_flavors applied on particle pair "
00199              << "without two leptons!" << std::endl;
00200     }
00201 
00202     return lp_type;
00203 
00204   }
00205 
00206 //*****************************************************************************
00207 
00208 //::::::::::::::::::::::::::
00209 //:: METHOD pdgIdToString ::
00210 //::::::::::::::::::::::::::
00211 
00212 TString
00213 MyParticlePair::pdgIdToString(int pdgId){
00214 
00215     if (TMath::Abs(pdgId)==11){
00216         return TString("e");
00217     }
00218     else if(TMath::Abs(pdgId)==13){
00219         return TString("mu");
00220     }
00221     else{
00222         return TString("unknown");
00223             //std::cerr << "ERROR: Wrong lepton type in lepon pair pdgId = " << pdgId 
00224             //<< "." << std::endl;
00225             //exit(0);
00226     }
00227 
00228 
00229   }
00230 
00231 //*****************************************************************************
00232 
00233 //::::::::::::::::::::::::::
00234 //:: METHOD PrintParticle ::
00235 //::::::::::::::::::::::::::
00236 
00237 inline void MyParticlePair::Print(std::string option) {
00238 
00239     std::cout << "ParticlePair: " << std::endl;
00240     m_particle1->Print(option);
00241     m_particle2->Print(option);
00242 
00243 }
00244 

Generated on Tue Oct 21 11:50:45 2008 for NtupleAnalysis by  doxygen 1.5.1