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 
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 class baseAnalysis
00033 {
00034 public:
00035   baseAnalysis();
00036   virtual ~baseAnalysis();
00037   
00038   virtual int Finalize();
00039   virtual int Finalize(TFile* output);
00040   //virtual TH1D* popHisto(std::vector<TH1D*>);
00041   virtual TH1D* popHisto();
00042 
00043   virtual int Init(double maxeta = 2.5, double minpt = 0.5 );
00044   virtual int Process(HepMC::GenEvent* hepmcevt);
00045   //virtual std::vector<TH1D*> averagedHistograms() {TH1D* temp; std::vector<TH1D*> temp_vec; 
00046   //temp_vec.clear(); temp_vec.push_back(temp); return temp_vec;} ;
00047 
00048   virtual std::vector<TH1D*> averagedHistograms();
00049   
00050   virtual std::vector<TH1D*>& Histograms();
00051 
00052   /** Initialize FastJet Algorithm*/
00053   int InitJetFinder(double coneRadius, double overlapThreshold, double jet_ptmin, double lepton_ptmin, double DeltaR_lepton_track,
00054       int jetalgorithm = 2);
00055 
00056   int FindJetableParticles(HepMC::GenEvent* hepmcevt); 
00057   int FindJet(HepMC::GenEvent* hepmcevt);
00058   int DeleteJetObject(HepMC::GenEvent* hepmcevt);
00059   
00060   std::vector<fastjet::PseudoJet> GetJet(HepMC::GenEvent* hepmcevt);
00061   virtual void SetJet(std::vector<fastjet::PseudoJet>* inclusive_jets);
00062 
00063   /** Calculate Missing Et*/
00064   int FindMissingEt(HepMC::GenEvent* hepmcevt);
00065   int ClearMissingEt(HepMC::GenEvent* hepmcevt);
00066 
00067   /** Clear some values from the event */
00068   int ClearEvent(HepMC::GenEvent* hepmcevt);
00069 
00070   /** Set the Output filename*/  
00071   inline int setOutputFileName(const std::string& filename); 
00072   
00073   /** Set the directory name in Output root file*/  
00074   inline int setOutputRootDir(const std::string& dirname);
00075 
00076   /** Check some special neutral Particles */
00077   static bool IsNeutrino(int pid);
00078   static bool IsGamma(int pid);
00079   static bool IsNeutron(int pid);
00080   static bool IsK0(int pid); 
00081   static bool IsPi0(int pid);
00082   static bool IsElectron(int pid);
00083   static bool IsMuon(int pid);
00084   static bool IsGluon(int pid);
00085 
00086   /** Check if neutral particle*/  
00087   static bool chargedParticle(int pid);
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);
00094   
00095   /** Set maximum pt of tracks */  
00096   inline int setMinPtCut(double minpt);
00097   
00098   /** Initialization of histograms  */ 
00099   TH1D* initHist(const std::string &name, const std::string &title, const std::string &xlabel, 
00100       int nrBins=100, double xmin=0.0, double xmax=100.0);
00101   TH1D* initHistVariableBin(const std::string &name, const std::string &title, const std::string &xlabel, 
00102       int nbin, double nbinRange[]);
00103   
00104   /** check if mother decayed into daugther */ 
00105   bool checkDaughter(HepMC::GenParticle* mother, HepMC::GenParticle* daughter, int maxGenerations=-1);
00106   
00107   /** check if the track comes from a specific particle e.g. pid(W-Boson)=24 */ 
00108   bool trackfromPID(int pid, HepMC::GenParticle* track, int maxGenerations=-1);
00109 
00110   /** calculate the rapidity of a particle */
00111   static double getRapidity(const HepMC::GenEvent::particle_const_iterator& p);
00112 
00113 protected:
00114   /** jet finding */
00115   fastjet::JetDefinition::Plugin*   m_plugin;
00116   fastjet::JetDefinition*           m_jetDef;
00117 
00118   std::vector< fastjet::PseudoJet >  m_input_particles;
00119   std::vector< fastjet::PseudoJet > m_inclusive_jets;
00120   fastjet::ClusterSequence* m_clust_seq;
00121 
00122   std::map< std::string, int > m_histCounter;
00123   std::vector<TH1D*> m_histVector;
00124   //std::vector<TH1D*> m_histVectorVariableBin;  
00125   std::string m_outputFileName;
00126   std::string m_outputRootDir;
00127 
00128   //for jet finder
00129   double m_coneRadius;
00130   double m_overlapThreshold;
00131   double m_jet_ptmin;
00132   double m_lepton_ptmin;
00133   double m_DeltaR_lepton_track;
00134   bool m_Jetfinder_enabled;
00135   
00136   // specify the maximum eta of tracks
00137   double m_max_eta;
00138   double m_min_pt;
00139 
00140   // for calculation of the missing energy
00141   double exMissTruth;
00142   double eyMissTruth;
00143   double etMissTruth;
00144   double etsumMissTruth;
00145   
00146   //const HepPDT::ParticleDataTable* m_particleTable;
00147 };
00148 
00149 #endif      // BASE_ANALYSIS_H_ 
00150 

Generated on Tue Mar 1 01:18:31 2011 for HepMCAnalysis by  doxygen 1.4.7