baseAnalysis.h

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

Generated on Wed Aug 31 09:44:48 2011 for HepMCAnalysis by  doxygen 1.4.7