CMS 3D CMS Logo

FP420Test.h

Go to the documentation of this file.
00001 #ifndef FP420Test_H
00002 #define FP420Test_H
00003 
00004 // system include files
00005 #include<vector>
00006 #include <iostream>
00007 #include <memory>
00008 #include <string>
00009 //
00010 // user include files
00011 #include "FWCore/Framework/interface/Frameworkfwd.h"
00012 #include "FWCore/Framework/interface/EDAnalyzer.h"
00013 #include "FWCore/Framework/interface/MakerMacros.h"
00014 
00015 // necessary objects:
00016 #include "FWCore/Framework/interface/ESHandle.h"
00017 #include "SimDataFormats/HepMCProduct/interface/HepMCProduct.h"
00018 
00019 //
00020 //
00021 #include "SimG4Core/Notification/interface/Observer.h"
00022 #include "SimG4Core/Notification/interface/BeginOfJob.h"
00023 #include "SimG4Core/Notification/interface/BeginOfRun.h"
00024 #include "SimG4Core/Notification/interface/EndOfRun.h"
00025 #include "SimG4Core/Notification/interface/BeginOfEvent.h"
00026 #include "SimG4Core/Notification/interface/EndOfEvent.h"
00027 #include "SimG4Core/Notification/interface/BeginOfTrack.h"
00028 #include "SimG4Core/Notification/interface/EndOfTrack.h"
00029 #include "SimG4Core/Watcher/interface/SimWatcher.h"
00030 //#include "SimG4Core/Watcher/interface/SimProducer.h"
00031 //#include "SimG4Core/Watcher/interface/SimWatcherMaker.h"
00032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00033 
00034 #include "SimG4CMS/FP420/interface/FP420G4Hit.h"
00035 
00036 #include "G4VTouchable.hh"
00037 #include <map>
00038 #include <cmath>
00039 #include <CLHEP/Random/Randomize.h> 
00040 // #include <fstream>
00041 
00042 
00043 // ----------------------------------------------------------------
00044 // Includes needed for Root ntupling
00045 //
00046 #include "TROOT.h"
00047 #include "TFile.h"
00048 #include "TH1.h"
00049 #include "TH2.h"
00050 #include "TProfile.h"
00051 #include "TNtuple.h"
00052 #include "TRandom.h"
00053 #include "TLorentzVector.h"
00054 #include "TUnixSystem.h"
00055 #include "TSystem.h"
00056 #include "TMath.h"
00057 #include "TF1.h"
00058 
00059 
00060 #include <TObjArray.h>
00061 #include <TObjString.h>
00062 #include <TNamed.h>
00063 
00064 
00065 class Fp420AnalysisHistManager : public TNamed {
00066         public:
00067 
00068                 Fp420AnalysisHistManager(TString managername);
00069                 ~Fp420AnalysisHistManager();
00070 
00071                 TH1F* GetHisto(Int_t Number);
00072                 TH1F* GetHisto(const TObjString histname);
00073 
00074                 TH2F* GetHisto2(Int_t Number);
00075                 TH2F* GetHisto2(const TObjString histname);
00076 
00077                 void WriteToFile(TString fOutputFile,TString fRecreateFile);
00078 
00079         private:
00080 
00081                 void BookHistos();
00082                 void StoreWeights();
00083                 void HistInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup);
00084                 void HistInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup);
00085 
00086                 const char* fTypeTitle;
00087                 TObjArray* fHistArray;
00088                 TObjArray* fHistNamesArray;
00089 
00090 };
00091 
00092 
00093 class FP420NumberingScheme;
00094 
00095 class BeginOfJob;
00096 class BeginOfRun;
00097 class EndOfRun;
00098 class BeginOfEvent;
00099 class EndOfEvent;
00100 class BeginOfTrack;
00101 class EndOfTrack;
00102 class G4Step;
00103 
00104 /*
00105 class ObserveBeginOfRun : private Observer<const BeginOfRun *> 
00106 {
00107 public:
00108     ObserveBeginOfRun();
00109 private:
00110     void update(const BeginOfRun * run);
00111 };
00112 
00113 class ObserveEndOfRun : private Observer<const EndOfRun *> 
00114 {
00115 public:
00116     ObserveEndOfRun();
00117 private:
00118     void update(const EndOfRun * run);
00119 };
00120 
00121 class ObserveBeginOfEvent : private Observer<const BeginOfEvent *> 
00122 {
00123 public:
00124     ObserveBeginOfEvent();
00125 private:
00126     void update(const BeginOfEvent * evt);
00127 };
00128 
00129 class ObserveEndOfEvent : private Observer<const EndOfEvent *> 
00130 {
00131 public:
00132     ObserveEndOfEvent();
00133 private:
00134     void update(const EndOfEvent * evt);
00135     //    std::vector<FP420G4Hit> theStripHits;
00136 };
00137 
00138 class ObserveBeginOfTrack : private Observer<const BeginOfTrack *> 
00139 {
00140 public:
00141     ObserveBeginOfTrack();
00142 private:
00143     void update(const BeginOfTrack * trk);
00144 };
00145 
00146 class ObserveEndOfTrack : private Observer<const EndOfTrack *> 
00147 {
00148 public:
00149     ObserveEndOfTrack();
00150 private:
00151     void update(const EndOfTrack * trk);
00152 };
00153 
00154 class ObserveStep : private Observer<const G4Step *> 
00155 {
00156 public:
00157     ObserveStep();
00158 private:
00159     void update(const G4Step * step);
00160 };
00161 */
00162                     //class FP420Test: public SimProducer,
00163 class FP420Test : public SimWatcher,
00164   public Observer<const BeginOfJob *>, 
00165   public Observer<const BeginOfRun *>,
00166   public Observer<const EndOfRun *>,
00167   public Observer<const BeginOfEvent *>,
00168   public Observer<const BeginOfTrack *>,
00169   public Observer<const G4Step *>,
00170   public Observer<const EndOfTrack *>,
00171   public Observer<const EndOfEvent *>
00172 {
00173 public:
00174   FP420Test(const edm::ParameterSet &p);
00175   virtual ~FP420Test();
00176   //MyActions();
00177   //MyActions();
00178 private:
00179 
00180   // observer classes
00181   void update(const BeginOfJob * run);
00182   void update(const BeginOfRun * run);
00183   void update(const EndOfRun * run);
00184   void update(const BeginOfEvent * evt);
00185   void update(const BeginOfTrack * trk);
00186   void update(const G4Step * step);
00187   void update(const EndOfTrack * trk);
00188   void update(const EndOfEvent * evt);
00189 
00190 private:
00191 
00192   //UHB_Analysis* UserNtuples;
00193   FP420NumberingScheme * theFP420NumberingScheme;
00194 
00195 
00196   int iev;
00197   int itrk;
00198   G4double entot0, tracklength0;
00199 
00200 private:
00201 // Utilities to get detector levels during a step
00202 
00203   int      detLevels(const G4VTouchable*) const;
00204   G4String  detName(const G4VTouchable*, int, int) const;
00205   void     detectorLevel(const G4VTouchable*, int&, int*, G4String*) const;
00206 
00207 
00208  double rinCalo, zinCalo;
00209  int    lastTrackID;
00210  int verbosity;
00211 
00212  // SumEnerDeposit - all deposited energy on all steps ;  SumStepl - length in steel !!!
00213  G4double      SumEnerDeposit, SumStepl, SumStepc;
00214  // numofpart - # particles produced along primary track
00215  int          numofpart;
00216  // last point of the primary track
00217  G4ThreeVector  lastpo;
00218 
00219 
00220  // z:
00221  double z1, z2, z3, z4; 
00222 
00223 private:
00224 
00225   Float_t fp420eventarray[1];
00226   TNtuple* fp420eventntuple;
00227   TFile fp420OutputFile;
00228   int whichevent;
00229 
00230   Fp420AnalysisHistManager* TheHistManager;  //Histogram Manager of the analysis
00231   std::string fDataLabel;             // Data type label
00232   std::string fOutputFile;            // The output file name
00233   std::string fRecreateFile;          // Recreate the file flag, default="RECREATE"
00234 
00235   //  //  //  //  //  //  TObjString fHistType;
00236 //   TString fDataLabel;             // Data type label
00237 //   TString fOutputFile;            // The output file name
00238 //   TString fRecreateFile;          // Recreate the file flag, default="RECREATE"
00239 
00240 };
00241 
00242 #endif
00243 
00244 
00245 
00246 
00247 
00248 
00249 
00250 
00251 

Generated on Tue Jun 9 17:46:57 2009 for CMSSW by  doxygen 1.5.4