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 "HepMC/GenEvent.h"
00005 
00006 #include <iostream>
00007 #include <stdio.h>
00008 #include "HepMC/IO_GenEvent.h"
00009 #include "HepMC/GenEvent.h"
00010 #include "HepMC/IO_AsciiParticles.h"
00011 #include "HepMC/SimpleVector.h"
00012 
00013 #include "HepPDT/ParticleDataTable.hh"
00014 
00015 #include "fastjet/PseudoJet.hh"
00016 #include "fastjet/ClusterSequence.hh"
00017 #include "fastjet/JetDefinition.hh"
00018 #include "fastjet/SISConePlugin.hh"
00019 
00020 #include "TH1.h"
00021 
00022 using namespace std;
00023 
00024 enum RETURN{FAILURE=-1, SUCCESS=1, CHARGED=2, NOTCHARGED=3};
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 
00034 class baseAnalysis
00035 {
00036  public:
00037   baseAnalysis();
00038   virtual ~baseAnalysis();
00039   
00040   int Finalize();
00041   int Finalize(TFile* output);
00042   
00043   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;};
00044   virtual int Process(HepMC::GenEvent* hepmcevt) { std::cout << "baseAnalysis: WARNING: You have called the dummy function Process()." << std::endl; return 0;} ;
00045 
00046   /** Initialize FastJet Algorithm*/
00047   int InitJetFinder(double coneRadius, double overlapThreshold, double jet_ptmin);
00048   int FindJetableParticles(HepMC::GenEvent* hepmcevt);
00049   int FindJet(HepMC::GenEvent* hepmcevt);
00050   int DeleteJetObject(HepMC::GenEvent* hepmcevt);
00051 
00052   /** Set the Output filename*/  
00053   inline int setOutpuFileName(const char* filename){ m_outputFileName=filename; return 0;};
00054   
00055   /** Set the directory name in Output root file*/  
00056   inline int setOutpuRootDir(const char* dirname){ m_outputRootDir=dirname; return 0;};
00057 
00058   /** Check some special neutral Particles */
00059   inline bool IsNeutrino(int pid) { if( abs(pid)==12 || abs(pid)==14 || abs(pid)==16) return true; else return false; };
00060   inline bool IsGamma(int pid) { if( abs(pid)==22 ) return true; else return false; };
00061   inline bool IsNeutron(int pid) { if( abs(pid)==2112 ) return true; else return false; };
00062   inline bool IsK0(int pid) { if( abs(pid)==130 || abs(pid)==310 || abs(pid)==311 ) return true; else return false; };
00063   inline bool IsPi0(int pid) { if( abs(pid)==111 || abs(pid)==113 || abs(pid)==221 ) return true; else return false; };
00064     
00065   /** Check if neutral particle*/  
00066   inline int chargedParticle(int pid) { 
00067       if( IsNeutrino(pid) || IsGamma(pid) || IsNeutron(pid) || IsK0(pid) || IsPi0(pid) || abs(pid)== 94 )
00068       {return NOTCHARGED;} 
00069     else 
00070       {return CHARGED;}
00071     return 0;};
00072   
00073   /** Set the maximum allowed eta range*/  
00074   inline int setMaxEtaCut(double maxeta){ m_max_eta=maxeta; return 0;};
00075   
00076   /** Set maximum pt of tracks */  
00077   inline int setMinPtCut(double minpt){ m_min_pt=minpt; return 0;};
00078   
00079   /** Initialization of histograms  */ 
00080   TH1D * initHist(string name, string title, string xlabel, int nrBins=100, double xmin=0., double xmax=100.) ;
00081   TH1D * initHistVariableBin(string name, string title, string xlabel, int nbin, Double_t nbinRange[]) ;
00082   
00083   /** check if mother decayed into daugther */ 
00084   bool checkDaughter(HepMC::GenParticle* mother, HepMC::GenParticle* daughter, int maxGenerations=-1) ;
00085   
00086   /** check if the track comes from a specific particle e.g. pid(W-Boson)=24 */ 
00087   bool trackfromPID(int pid,HepMC::GenParticle* track, int maxGenerations=-1) ;
00088 
00089   /** calculate the rapidity of a particle */
00090   inline double getRapidity(HepMC::GenEvent::particle_const_iterator p) {
00091     double e = (*p)->momentum().e();
00092     double pz = (*p)->momentum().pz();
00093     double rapidity = 0.5 * log((e + pz) / (e - pz));
00094     return rapidity;
00095   };
00096 
00097   
00098  protected:
00099   
00100   /** jet finding */
00101   fastjet::JetDefinition::Plugin*   m_plugin;
00102   fastjet::JetDefinition*           m_jetDef;
00103 
00104   std::vector<fastjet::PseudoJet>  m_input_particles;
00105   std::vector<fastjet::PseudoJet> m_inclusive_jets;
00106   fastjet::ClusterSequence* m_clust_seq;
00107 
00108   vector< TH1D * > m_histVector;
00109   vector< TH1D * > m_histVectorVariableBin;  
00110   string m_outputFileName;
00111   string m_outputRootDir;
00112 
00113   //for jet finder
00114   double m_coneRadius;
00115   double m_overlapThreshold;
00116   double m_jet_ptmin;
00117   bool m_Jetfinder_enabled;
00118   
00119   // specify the maximum eta of tracks
00120   double m_max_eta;
00121   double m_min_pt;
00122   
00123   const HepPDT::ParticleDataTable* m_particleTable;
00124 };
00125 
00126 #endif

Generated on Mon Feb 16 15:58:20 2009 for HepMCAnalysis by  doxygen 1.3.9.1