Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

TMarBody.C

Go to the documentation of this file.
00001 
00002 // Class TMarBody
00003 //
00004 // Author     : Matti Peez
00005 // Created    : 02/2002
00006 // Last update: $Date: 2005/06/08 11:39:56 $
00007 //          by: $Author: blist $
00008 // Comment: Definition of a reconstructed body with Pt(body) > Pt(min,body)
00009 //          - Pointing to the particle candidate
00010 //          - Type
00012 
00013 #ifndef __TMARBODY
00014 #include "Marana/TMarBody.h"
00015 #endif
00016 
00017 // Important for ROOT use
00018 ClassImp(TMarBody)
00019 
00020 TMarBody::TMarBody(void)
00021 {
00022 // Base constructor
00023    fE=0;        
00024    fPt=0;       
00025    fEta=0;     
00026    fPhi=0;      
00027    fIndex = -1;
00028    fIndexID = -1;
00029    fSelected = kFALSE;
00030 }
00031 TMarBody::TMarBody(Int_t ID,Int_t indexID,Int_t index)
00032 {
00033 // Constructor with index
00034    fE=0;        
00035    fPt=0;       
00036    fEta=0;     
00037    fPhi=0;         
00038    fIndex = index;
00039    fIndexID = indexID;
00040    fID = ID;
00041    fSelected = kFALSE;
00042 }
00043 TMarBody::TMarBody(TMarBody *body){
00044 // Copy information from body
00045 
00046   body->GetEPtEtaPhi(fE,fPt,fEta,fPhi);
00047   fIndex = body->GetIndex();
00048   fIndexID = body->GetIndexID();
00049   fID = body->GetType();
00050   if (body->IsSel() == kTRUE)
00051     fSelected = kTRUE;
00052   else
00053     fSelected = kFALSE;
00054 }
00055 
00056 TMarBody::TMarBody(const Int_t& ID,const Int_t& indexID,const Float_t& E,const
00057 Float_t& Pt,const Float_t &Eta,const Float_t& Phi,const Int_t& index)
00058 {
00059    fE=E;        
00060    fPt=Pt;       
00061    fEta=Eta;     
00062    fPhi=Phi;         
00063    fIndex = index;
00064    fIndexID = indexID;
00065    fID = ID;
00066    fSelected = kFALSE;
00067 
00068 
00069 
00070 }
00071 TMarBody::~TMarBody()
00072 {
00073 
00074 }
00075 
00076 
00077 Int_t TMarBody::GetType(void) const
00078 {
00079 // Get type of object
00080 
00081  return(fID);
00082 }
00083 
00084 Int_t TMarBody::GetIndex(void) const
00085 {
00086 // Get index of object
00087 
00088  return(fIndex);
00089 }
00090 Int_t TMarBody::GetIndexID(void) const
00091 {
00092 // Get index of object
00093 
00094  return(fIndexID);
00095 } 
00096 
00097 Bool_t TMarBody::GetEPtEtaPhi(Float_t &E,Float_t &Pt,Float_t &Eta,Float_t &Phi) const
00098 {
00099 // Set kinematics
00100 
00101   Bool_t selection = kTRUE;
00102 
00103   E = fE;
00104   Pt = fPt;
00105   Eta = fEta;
00106   Phi = fPhi;
00107 
00108   // Check coherence
00109   if (Pt<=0)
00110    return(kFALSE);
00111 
00112  return(selection);
00113 }
00114 
00115 void TMarBody::SetEPtEtaPhi(Float_t E,Float_t Pt,Float_t Eta,Float_t Phi)
00116 {
00117 // Set kinematics
00118 
00119   fE = E;
00120   fPt = Pt;
00121   fEta = Eta;
00122   fPhi = Phi;
00123 }
00124 Float_t TMarBody::GetE() const
00125 {
00126 // Return E of particle
00127   
00128   return(fE);
00129 }
00130 Float_t TMarBody::GetP() const
00131 {
00132 // Return P of particle, up to npw consider m=0 for particle
00133   
00134   return(fE);
00135 }
00136 
00137 Float_t TMarBody::GetPt()  const
00138 {
00139 // Return pt of particle
00140   
00141   return(fPt);
00142 }
00143 Float_t TMarBody::GetEta() const
00144 {
00145 // Return eta of particle
00146   
00147   return(fEta);
00148 }
00149 
00150 Float_t TMarBody::GetTheta() const
00151 {
00152 // Return eta of particle
00153   
00154   return(2.*TMath::ATan(exp(-fEta)));
00155 }
00156 
00157 
00158 Float_t TMarBody::GetPhi() const
00159 {
00160 // Return phi of particle
00161   
00162   return(fPhi);
00163 }
00164 
00165 Float_t TMarBody::GetPx() const
00166 {
00167 // Return px of particle
00168   Float_t Px=this->GetP()*TMath::Sin(this->GetTheta())*TMath::Cos(this->GetPhi());
00169   return(Px);
00170 }
00171 Float_t TMarBody::GetPy() const
00172 {
00173 // Return px of particle
00174   Float_t Py=this->GetP()*TMath::Sin(this->GetTheta())*TMath::Sin(this->GetPhi());
00175   return(Py);
00176 }
00177 
00178 Float_t TMarBody::GetPz() const
00179 {
00180 // Return px of particle
00181   Float_t Pz=this->GetP()*TMath::Cos(this->GetTheta());
00182   return(Pz);
00183 }
00184 
00185 
00186 void TMarBody::SetSel(Bool_t selection)
00187 {
00188 // Set selection bit to "selection"
00189 
00190  fSelected = selection;
00191 }
00192 
00193 
00194 Bool_t TMarBody::IsSel(void)
00195 {
00196 // Is selected ?
00197  
00198  return(fSelected);
00199 } 
00200 
00201 
00202 Int_t TMarBody::Compare(const TObject* body) 
00203 {
00204 // Defines sorting criterion for bodies
00205 
00206     if(!body->InheritsFrom("TMarBody")) {
00207         Warning("IsEqual","input object must inherit from TMarBody!");
00208         return kFALSE;
00209     }
00210     TMarBody *Body = (TMarBody*) body;
00211     Float_t Pt = GetPt();
00212     if (Pt < Body->GetPt()) return 1;
00213     else if (Pt == Body->GetPt()) return 0;
00214     else if (Pt > Body->GetPt())  return -1;
00215     return -99;
00216 }
00217 
00218 
00219 Bool_t TMarBody::IsEqual(const TMarBody* body) 
00220 {
00221 // Defines sorting criterion for bodies, clusters are 
00222 // considered equal if they have equal pt.
00223 
00224     if(!body->InheritsFrom("TMarBody")) {
00225         Warning("IsEqual","input object must inherit from TMarBody!");
00226         return kFALSE;
00227     }
00228     TMarBody *Body = (TMarBody*) body;
00229     if (fPt == Body->GetPt()&&fEta==Body->GetEta()&&fPhi==Body->GetPhi()) 
00230         return kTRUE;
00231     return kFALSE;
00232 
00233 }
00234 
00235 
00236 TLorentzVector TMarBody::GetFourVector()
00237 {
00238    TLorentzVector vect(0,0,0,0);
00239    vect.SetPtEtaPhiE(fPt,fEta,fPhi,fE);
00240    return vect;
00241 }
00242 
00243 Bool_t TMarBody::IsSortable() const
00244 {
00245   return kTRUE;
00246 }
00247 
00248 
00249 
00250 Float_t TMarBody::EtaPhiDist(TMarBody *body)
00251 {
00252 // Calculate eta-phi distance between bodies
00253 
00254  Float_t Dist=99999;
00255 
00256  Float_t DiffEta = body->GetEta()-this->GetEta();
00257  Float_t DiffPhi = TMath::ACos(TMath::Cos(body->GetPhi()-this->GetPhi()));
00258 
00259  Float_t Dist2 = DiffEta*DiffEta + DiffPhi*DiffPhi;
00260  if (Dist2 > 0.0001) Dist = TMath::Sqrt(Dist2);         
00261  else Dist = 0;
00262  
00263 
00264  return Dist;
00265 }
00266 
00267 
00268 
00269 bool TMarBody::operator<(const TMarBody& other){
00270   return (fPt<other.fPt);
00271 
00272 }

Generated on Thu Jul 28 11:48:52 2005 for SFHMarana by doxygen 1.3.2