CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/SimG4CMS/HcalTestBeam/interface/HcalTB06Analysis.h

Go to the documentation of this file.
00001 #ifndef SimG4CMS_HcalTestBeam_HcalTB06Analysis_H
00002 #define SimG4CMS_HcalTestBeam_HcalTB06Analysis_H
00003 // -*- C++ -*-
00004 //
00005 // Package:     HcalTestBeam
00006 // Class  :     HcalTB06Analysis
00007 //
00014 //
00015 // Original Author:  Sunanda Banerjee
00016 //         Created:  Tue Oct 10 10:14:34 CEST 2006
00017 //
00018   
00019 // system include files
00020 #include <iostream>
00021 #include <memory>
00022 #include <vector>
00023 #include <string>
00024  
00025 // user include files
00026 #include "SimG4Core/Watcher/interface/SimProducer.h"
00027 #include "SimG4Core/Notification/interface/Observer.h"
00028  
00029 #include "SimG4CMS/HcalTestBeam/interface/HcalTB06Histo.h"
00030 
00031 #include "SimDataFormats/CaloHit/interface/CaloHit.h"
00032 #include "SimDataFormats/HcalTestBeam/interface/PHcalTB06Info.h"
00033 
00034 #include "G4Step.hh"
00035 #include "G4Track.hh"
00036 #include "G4ThreeVector.hh"
00037 
00038 #include <boost/cstdint.hpp>
00039 
00040 class BeginOfRun;
00041 class BeginOfEvent;
00042 class EndOfEvent;
00043 
00044 class HcalTB06Analysis : public SimProducer,
00045                          public Observer<const BeginOfRun *>,
00046                          public Observer<const BeginOfEvent *>,
00047                          public Observer<const EndOfEvent *>,
00048                          public Observer<const G4Step *> {
00049 
00050 public:
00051 
00052   HcalTB06Analysis(const edm::ParameterSet &p);
00053   virtual ~HcalTB06Analysis();
00054 
00055   virtual void produce(edm::Event&, const edm::EventSetup&);
00056 
00057 private:
00058 
00059   HcalTB06Analysis(const HcalTB06Analysis&); // stop default
00060   const HcalTB06Analysis& operator=(const HcalTB06Analysis&);
00061  
00062   void  init();
00063  
00064   // observer methods
00065   void update(const BeginOfRun * run);
00066   void update(const BeginOfEvent * evt);
00067   void update(const G4Step * step);
00068   void update(const EndOfEvent * evt);
00069 
00070   //User methods
00071   void fillBuffer(const EndOfEvent * evt);
00072   void finalAnalysis();
00073   void fillEvent(PHcalTB06Info&);
00074 
00075   void   clear();
00076 
00077 private:
00078 
00079   HcalTB06Histo*             histo;
00080 
00081   // to read from parameter set
00082   double                     beamOffset;
00083   int                        iceta, icphi;
00084   std::vector<std::string>   names;
00085   G4RotationMatrix*          beamline_RM;
00086 
00087   // Constants for the run
00088   int                        count;
00089     
00090   // Constants for the event
00091   int                        nPrimary, particleType;
00092   double                     pInit, etaInit, phiInit;
00093   std::vector<CaloHit>       ecalHitCache;
00094   std::vector<CaloHit>       hcalHitCache, hcalHitLayer;
00095   double                     etots, eecals, ehcals;
00096 
00097   bool                       pvFound;
00098   int                        evNum, pvType;
00099   G4ThreeVector              pvPosition, pvMomentum, pvUVW;
00100   std::vector<int>           secTrackID, secPartID;
00101   std::vector<G4ThreeVector> secMomentum;
00102   std::vector<double>        secEkin;
00103   std::vector<int>           shortLivedSecondaries;
00104 };
00105 
00106 #endif