00001 00002 // File: CastorTestAnalysis.h 00003 // Date: 02.07 Panos Katsas 00004 // Description: simulation analysis steering code 00005 // 00007 #undef debug 00008 #ifndef CastorTestAnalysis_h 00009 #define CastorTestAnalysis_h 00010 00011 #include "SimG4Core/Notification/interface/BeginOfJob.h" 00012 #include "SimG4Core/Notification/interface/BeginOfRun.h" 00013 #include "SimG4Core/Notification/interface/EndOfRun.h" 00014 #include "SimG4Core/Notification/interface/BeginOfEvent.h" 00015 #include "SimG4Core/Notification/interface/EndOfEvent.h" 00016 00017 #include "G4SDManager.hh" 00018 #include "G4Step.hh" 00019 #include "G4Track.hh" 00020 #include "G4Event.hh" 00021 #include "G4PrimaryVertex.hh" 00022 #include "G4VProcess.hh" 00023 #include "G4HCofThisEvent.hh" 00024 #include "G4UserEventAction.hh" 00025 #include "CLHEP/Units/GlobalSystemOfUnits.h" 00026 #include "CLHEP/Units/GlobalPhysicalConstants.h" 00027 00028 #include "SimG4Core/Notification/interface/Observer.h" 00029 #include "SimG4Core/Watcher/interface/SimWatcher.h" 00030 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00031 00032 #include "SimG4CMS/Forward/interface/CastorNumberingScheme.h" 00033 00034 #include <cassert> 00035 #include <iostream> 00036 #include <string> 00037 #include <map> 00038 #include <cmath> 00039 #include <memory> 00040 #include <vector> 00041 00042 #include <CLHEP/Random/Randomize.h> 00043 00044 #include "TROOT.h" 00045 #include "TFile.h" 00046 #include "TH1.h" 00047 #include "TH2.h" 00048 #include "TProfile.h" 00049 #include "TNtuple.h" 00050 #include "TRandom.h" 00051 #include "TLorentzVector.h" 00052 #include "TUnixSystem.h" 00053 #include "TSystem.h" 00054 #include "TMath.h" 00055 #include "TF1.h" 00056 00057 00058 class G4Step; 00059 class BeginOfJob; 00060 class BeginOfRun; 00061 class EndOfRun; 00062 class BeginOfEvent; 00063 class EndOfEvent; 00064 00065 class CastorTestAnalysis : public SimWatcher, 00066 public Observer<const BeginOfJob *>, 00067 public Observer<const BeginOfRun *>, 00068 public Observer<const EndOfRun *>, 00069 public Observer<const BeginOfEvent *>, 00070 public Observer<const EndOfEvent *>, 00071 public Observer<const G4Step *> { 00072 00073 public: 00074 CastorTestAnalysis(const edm::ParameterSet &p); 00075 virtual ~CastorTestAnalysis(); 00076 00077 private: 00078 // observer classes 00079 void update(const BeginOfJob * run); 00080 void update(const BeginOfRun * run); 00081 void update(const EndOfRun * run); 00082 void update(const BeginOfEvent * evt); 00083 void update(const EndOfEvent * evt); 00084 void update(const G4Step * step); 00085 00086 private: 00087 00088 void getCastorBranchData(const CaloG4HitCollection * hc); 00089 void Finish(); 00090 00091 int verbosity; 00092 int doNTcastorstep; 00093 int doNTcastorevent; 00094 std::string stepNtFileName; 00095 std::string eventNtFileName; 00096 00097 TFile* castorOutputEventFile; 00098 TFile* castorOutputStepFile; 00099 00100 TNtuple* castorstepntuple; 00101 TNtuple* castoreventntuple; 00102 00103 CastorNumberingScheme* theCastorNumScheme; 00104 00105 int eventIndex; 00106 int stepIndex; 00107 int eventGlobalHit; 00108 00109 Float_t castorsteparray[14]; 00110 Float_t castoreventarray[11]; 00111 00112 }; 00113 00114 #endif // CastorTestAnalysis_h