Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

baseAnalysis.h

Go to the documentation of this file.
00001 #ifndef baseAnalysis_H
00002 #define baseAnalysis_H
00003 
00004 #include <string>
00005 #include <map>
00006 #include <vector>
00007 #include <iostream>
00008 
00009 #include "HepMC/GenEvent.h"
00010 
00011 #include "fastjet/PseudoJet.hh"
00012 #include "fastjet/JetDefinition.hh"
00013 
00014 // forward declarations
00015 namespace fastjet {
00016   class ClusterSequence;
00017 }
00018 namespace HepPDT {
00019   class ParticleDataTable;
00020 }
00021 class TFile;
00022 class TH1D;
00023 
00024 //sj//enum RETURN{FAILURE=-1, SUCCESS=1, CHARGED=2, NOTCHARGED=3, FINALSTATEPARTICLE=4};
00025 
00026 /**
00027 @class baseAnalysis.h
00028 @brief Base class for all  HepMCanalysis classes to implement common 
00029        functionality and interfaces.
00030 
00031 @author Cano Ay Dec 2008 */
00032 
00033 class baseAnalysis
00034 {
00035  public:
00036 
00037   baseAnalysis();
00038   virtual ~baseAnalysis();
00039   
00040   virtual int Finalize();
00041   virtual int Finalize(TFile* output);
00042   //virtual TH1D* popHisto(std::vector<TH1D*>);
00043   virtual TH1D* popHisto();
00044 
00045   virtual int Init(double maxeta=2.5, double minpt=0.5) { std::cout << "baseAnalysis: WARNING: You have called the dummy function Init()." << std::endl; return 0;};
00046   virtual int Process(HepMC::GenEvent* hepmcevt) { std::cout << "baseAnalysis: WARNING: You have called the dummy function Process()." << std::endl; return 0;} ;
00047   //virtual std::vector<TH1D*> averagedHistograms() {TH1D* temp; std::vector<TH1D*> temp_vec; temp_vec.clear(); temp_vec.push_back(temp); return temp_vec;} ;
00048   virtual std::vector<TH1D*> averagedHistograms() {return m_histVector;} ;
00049 
00050   /** Initialize FastJet Algorithm*/
00051   int InitJetFinder(double coneRadius, double overlapThreshold, double jet_ptmin, double lepton_ptmin, double DeltaR_lepton_track);
00052   int FindJetableParticles(HepMC::GenEvent* hepmcevt);
00053   int FindJet(HepMC::GenEvent* hepmcevt);
00054   int DeleteJetObject(HepMC::GenEvent* hepmcevt);
00055   std::vector<fastjet::PseudoJet> GetJet(HepMC::GenEvent* hepmcevt);
00056   virtual void SetJet(std::vector<fastjet::PseudoJet>* inclusive_jets) {m_inclusive_jets=*inclusive_jets;};
00057 
00058   /** Calculate Missing Et*/
00059   int FindMissingEt(HepMC::GenEvent* hepmcevt);
00060   int ClearMissingEt(HepMC::GenEvent* hepmcevt);
00061 
00062   /** Clear some values from the event */
00063   int ClearEvent(HepMC::GenEvent* hepmcevt);
00064 
00065   /** Set the Output filename*/  
00066   inline int setOutpuFileName(const char* filename){ m_outputFileName=filename; return 0;};
00067   
00068   /** Set the directory name in Output root file*/  
00069   inline int setOutpuRootDir(const char* dirname){ m_outputRootDir=dirname; return 0;};
00070 
00071   /** Check some special neutral Particles */
00072   inline bool IsNeutrino(int pid) { if( abs(pid)==12 || abs(pid)==14 || abs(pid)==16) return true; else return false; };
00073   inline bool IsGamma(int pid) { if( abs(pid)==22 ) return true; else return false; };
00074   inline bool IsNeutron(int pid) { if( abs(pid)==2112 ) return true; else return false; };
00075   inline bool IsK0(int pid) { if( abs(pid)==130 || abs(pid)==310 || abs(pid)==311 ) return true; else return false; };
00076   inline bool IsPi0(int pid) { if( abs(pid)==111 || abs(pid)==113 || abs(pid)==221 ) return true; else return false; };
00077   inline bool IsElectron(int pid) { if( abs(pid)==11 ) return true; else return false; };
00078   inline bool IsMuon(int pid) { if( abs(pid)==13 ) return true; else return false; };
00079 
00080 
00081   /** Check if neutral particle*/  
00082   inline int chargedParticle(int pid) { 
00083     if( IsNeutrino(pid) || IsGamma(pid) || IsNeutron(pid) || IsK0(pid) || IsPi0(pid) || abs(pid)== 94 || abs(pid)==1000039 || abs(pid) ==1000022 || abs(pid) ==39 || abs(pid) ==5100022) //above neutral particles and some "special" neutral particles
00084       {return false;} 
00085     else 
00086       {return true;}
00087     return 0;};
00088   
00089   /** Check if final state particle*/
00090   virtual int IsFinalStateParticle(HepMC::GenParticle *p);
00091 
00092   /** Set the maximum allowed eta range*/  
00093   inline int setMaxEtaCut(double maxeta){ m_max_eta=maxeta; return 0;};
00094   
00095   /** Set maximum pt of tracks */  
00096   inline int setMinPtCut(double minpt){ m_min_pt=minpt; return 0;};
00097   
00098   /** Initialization of histograms  */ 
00099   TH1D* initHist(std::string name, std::string title, std::string xlabel, int nrBins=100, double xmin=0., double xmax=100.) ;
00100   TH1D* initHistVariableBin(std::string name, std::string title, std::string xlabel, int nbin, double nbinRange[]) ;
00101   
00102   /** check if mother decayed into daugther */ 
00103   bool checkDaughter(HepMC::GenParticle* mother, HepMC::GenParticle* daughter, int maxGenerations=-1) ;
00104   
00105   /** check if the track comes from a specific particle e.g. pid(W-Boson)=24 */ 
00106   bool trackfromPID(int pid,HepMC::GenParticle* track, int maxGenerations=-1) ;
00107 
00108   /** calculate the rapidity of a particle */
00109   inline double getRapidity(HepMC::GenEvent::particle_const_iterator p) {
00110     double e = (*p)->momentum().e();
00111     double pz = (*p)->momentum().pz();
00112     double rapidity = 0.5 * log((e + pz) / (e - pz));
00113     return rapidity;
00114   };
00115 
00116  protected:
00117   
00118   /** jet finding */
00119   fastjet::JetDefinition::Plugin*   m_plugin;
00120   fastjet::JetDefinition*           m_jetDef;
00121 
00122   std::vector<fastjet::PseudoJet>  m_input_particles;
00123   std::vector<fastjet::PseudoJet> m_inclusive_jets;
00124   fastjet::ClusterSequence* m_clust_seq;
00125 
00126   std::map< std::string, int > m_histCounter;
00127   std::vector<TH1D*> m_histVector;
00128   std::vector<TH1D*> m_histVectorVariableBin;  
00129   std::string m_outputFileName;
00130   std::string m_outputRootDir;
00131 
00132   //for jet finder
00133   double m_coneRadius;
00134   double m_overlapThreshold;
00135   double m_jet_ptmin;
00136   double m_lepton_ptmin;
00137   double m_DeltaR_lepton_track;
00138   bool m_Jetfinder_enabled;
00139   
00140   // specify the maximum eta of tracks
00141   double m_max_eta;
00142   double m_min_pt;
00143 
00144   // for calculation of the missing energy
00145   double exMissTruth;
00146   double eyMissTruth;
00147   double etMissTruth;
00148   double etsumMissTruth;
00149   
00150   const HepPDT::ParticleDataTable* m_particleTable;
00151 };
00152 
00153 #endif

Generated on Thu Jul 23 14:57:35 2009 for HepMCAnalysis by  doxygen 1.3.9.1