Jet.cxx

Go to the documentation of this file.
00001 // Jet implementation
00002 //
00003 
00004 #include "AtlfastEvent/Jet.h"
00005 #include "AtlfastEvent/ReconstructedParticle.h"
00006 #include "AtlfastEvent/ParticleCodes.h"
00007 #include "Navigation/NavigationToken.h"
00008 #include <iomanip>
00009 
00010 namespace Atlfast {
00012   Jet::Jet(const  ICluster& cluster):
00013     AODNavigationImp(), 
00014 
00015     m_momentum(cluster.momentum()),
00016     m_pdg_id(ParticleCodes::UQUARK),
00017     m_tagged(true),
00018     m_dRbquark(999.),
00019     m_dRcquark(999.),
00020     m_dRhadtau(999.){
00021     
00022     IAOO* iaoo = this;
00023     iaoo->associate(&cluster);
00024     m_clusters.push_back(&cluster);
00025   }
00027 
00028   Jet::Jet( const HepLorentzVector& vec, ICluster& cluster ): 
00029     AODNavigationImp(), 
00030     
00031     m_momentum(vec), 
00032     m_pdg_id(ParticleCodes::UQUARK),
00033     m_tagged(true),
00034     m_dRbquark(999.),
00035     m_dRcquark(999.),
00036     m_dRhadtau(999.){
00037     // Here we fill the related cells vector with pointers to the cells
00038     // from which it was constructed.
00039     IAOO* iaoo = this;
00040     iaoo->associate( &cluster );
00041     m_clusters.push_back(&cluster);
00042   }
00044 
00045   Jet::Jet(const Jet& rhs):
00046     Atlfast::IAOO(rhs),
00047     INavigable(rhs),
00048     I4Momentum(rhs),
00049     INavigable4Momentum(rhs),
00050     Atlfast::IKinematic(rhs),
00051     Atlfast::IAODNavigation(rhs),
00052     AODNavigationImp(rhs){
00053     m_momentum = rhs.m_momentum;
00054     m_pdg_id   = rhs.m_pdg_id;
00055     m_tagged   = rhs.m_tagged;
00056     m_dRbquark = rhs.m_dRbquark;
00057     m_dRcquark = rhs.m_dRcquark;
00058     m_dRhadtau = rhs.m_dRhadtau;
00059     m_clusters = rhs.m_clusters;
00060     m_muons    = rhs.m_muons;
00061   }
00062   
00064 
00065   Jet& Jet::operator=(const Jet& rhs){
00066     if(this == &rhs) return *this;
00067 
00068     AODNavigationImp::operator=(rhs);
00069     
00070     m_momentum = rhs.m_momentum;
00071     m_pdg_id   = rhs.m_pdg_id;
00072     m_tagged   = rhs.m_tagged;
00073     m_dRbquark = rhs.m_dRbquark;
00074     m_dRcquark = rhs.m_dRcquark;
00075     m_dRhadtau = rhs.m_dRhadtau;
00076     m_clusters = rhs.m_clusters;
00077     m_muons    = rhs.m_muons;
00078 
00079     return *this;
00080   }
00081     
00083 
00084   void Jet::setMomentum(const HepLorentzVector& vec) {m_momentum=vec;}
00085 
00087 
00088   void Jet::addMuon(const ReconstructedParticle* p) {
00089 
00090     m_momentum += p->momentum();
00091     this->associate(p);
00092     this->m_muons.push_back(p); 
00093   }
00094 
00096   HepLorentzVector Jet::momentum() const {return m_momentum; } 
00098   double  Jet::eta() const { return m_momentum.pseudoRapidity() ;}
00099   double  Jet::phi() const { return m_momentum.phi() ;  } 
00100   double  Jet::pT()  const { return m_momentum.perp() ;}
00101   double  Jet::eT()  const { 
00102     return m_momentum.e()*m_momentum.perp()/m_momentum.rho() ;} 
00103   double  Jet::mT()  const { return m_momentum.mt(); } 
00105   IKinematic* Jet::clone() const{
00106     IKinematic* ik = new Jet(*this);
00107     return ik;
00108   }
00110   //
00111   double  Jet::px()  const { return m_momentum.px(); } 
00112   double  Jet::py()  const { return m_momentum.py(); } 
00113   double  Jet::pz()  const { return m_momentum.pz(); } 
00115       
00116   double  Jet::e()   const { return m_momentum.e(); } 
00117     
00118   
00119   
00121   // methods to set and get label - the 'true' jet flavour  
00122   void Jet::setPdg_id(int pdg_id){
00123     m_pdg_id = pdg_id;
00124   }
00125 
00126   int Jet::pdg_id() const{
00127     return m_pdg_id;
00128   }
00129 
00131   // methods from b-tagging part of AtlfastB
00132   void Jet::setBTagged(std::string tagname) {
00133     m_isBTagged[tagname] = true;
00134     m_tagged=true;
00135   }
00136 
00138   bool Jet::isBTagged() const {
00139     return !m_isBTagged.empty();
00140   }
00141 
00143   bool Jet::isBTagged(std::string tagname) const {
00144     std::map<std::string,double>::const_iterator itr = m_isBTagged.find(tagname);
00145     return itr == m_isBTagged.end() ? false : itr->second;
00146   }
00147 
00149   void Jet::setBTagCorrFactor(std::string tagname, double factor){
00150     m_bCorrFactors[tagname] = factor;
00151   }
00152 
00154   double Jet::bTagCorrFactor() const {
00155     return m_bCorrFactors.empty() ? 0 : (*(m_bCorrFactors.begin())).second;
00156   }
00157   
00159   double Jet::bTagCorrFactor(std::string tagname) const {
00160     std::map<std::string,double>::const_iterator itr = m_bCorrFactors.find(tagname);
00161     return itr == m_bCorrFactors.end() ? 0 : itr->second;
00162   }
00163   
00165   void Jet::setLightTagCorrFactor(std::string tagname, double factor){
00166     m_lCorrFactors[tagname] = factor;
00167   }
00168 
00170   double Jet::lTagCorrFactor() const {
00171     return m_lCorrFactors.empty() ? 0 : (*(m_lCorrFactors.begin())).second;
00172   }
00173   
00175   double Jet::lTagCorrFactor(std::string tagname) const {
00176     std::map<std::string,double>::const_iterator itr = m_lCorrFactors.find(tagname);
00177     return itr == m_lCorrFactors.end() ? 0 : itr->second;
00178   }
00179   
00181   void Jet::setTauTagged(std::string tagname){
00182     m_isTauTagged[tagname] = true;
00183     m_tagged=true;
00184   }
00185   
00187   bool Jet::isTauTagged() const {
00188     return !m_isTauTagged.empty();
00189   }
00190   
00192   bool Jet::isTauTagged(std::string tagname) const {
00193     std::map<std::string,double>::const_iterator itr = m_isTauTagged.find(tagname);
00194     return itr == m_isTauTagged.end() ? false : itr->second;    
00195   }
00196 
00198   void Jet::setTauTagCorrFactor(std::string tagname, double factor){
00199     m_tauCorrFactors[tagname] = factor;
00200     return;
00201   }
00202 
00204   double Jet::tauTagCorrFactor() const {
00205     return m_tauCorrFactors.empty() ? 0 : (*(m_tauCorrFactors.begin())).second;
00206   }
00207   
00209   double Jet::tauTagCorrFactor(std::string tagname) const {
00210     std::map<std::string,double>::const_iterator itr = m_tauCorrFactors.find(tagname);
00211     return itr == m_tauCorrFactors.end() ? 0 : itr->second;
00212   }
00213   
00215   // Labelling parameter methods
00216   void Jet::setdRbquark(double dRbquark){
00217     m_dRbquark = dRbquark;
00218   }
00219   
00221   double Jet::getdRbquark() const {
00222     return m_dRbquark;
00223   }
00224 
00226   void Jet::setdRcquark(double dRcquark){
00227     m_dRcquark = dRcquark;
00228   }
00229 
00231   double Jet::getdRcquark() const {
00232     return m_dRcquark;
00233   }
00234 
00236   void Jet::setdRhadtau(double dRhadtau){
00237     m_dRhadtau = dRhadtau;
00238   }
00239 
00241   double Jet::getdRhadtau() const {
00242     return m_dRhadtau;
00243   }
00244 
00245 
00247   void Jet::print(const std::string& coor, std::string t) const{
00248     AODNavigationImp::print(coor, t);
00249     std::cout<<t<<"pdg: "<<std::setw(12)
00250              <<pdg_id()<<std::string(56,' ')<<"Jet"<<std::endl;
00251   }
00253   void Jet::fillToken( INavigationToken &token ) const{
00254         NavigationToken<I4Momentum>* i4Token =
00255       dynamic_cast< NavigationToken<I4Momentum>* >(&token);
00256     if ( i4Token == 0 ) return;
00257     
00258     // ask clusters to fill token
00259     std::vector<const ICluster*>::const_iterator citer = m_clusters.begin();
00260     for(;citer!=m_clusters.end();++citer){ (*citer)->fillToken(token);}
00261 
00262     // add the muons to the token
00263     std::vector<const ReconstructedParticle*>::const_iterator miter = 
00264       m_muons.begin();
00265     for(;miter!=m_muons.end();++miter){i4Token->setObject((*miter));}
00266   }
00267 } // end of namespace bracket
00268 
00269 
00270 
00271 
00272 
00273 
00274 
00275 

Generated on Fri Sep 21 13:00:10 2007 for AtlfastEvent by  doxygen 1.5.1