Go to the documentation of this file.00001 #ifndef HcalTestBeam_HcalTB04Analysis_H
00002 #define HcalTestBeam_HcalTB04Analysis_H
00003
00004
00005
00006
00007
00014
00015
00016
00017
00018
00019
00020
00021 #include <iostream>
00022 #include <memory>
00023 #include <vector>
00024 #include <string>
00025
00026
00027 #include "SimG4Core/Watcher/interface/SimProducer.h"
00028 #include "SimG4Core/Notification/interface/Observer.h"
00029
00030 #include "SimG4CMS/Calo/interface/HcalQie.h"
00031 #include "SimG4CMS/HcalTestBeam/interface/HcalTB04Histo.h"
00032
00033 #include "SimDataFormats/CaloHit/interface/CaloHit.h"
00034 #include "SimDataFormats/HcalTestBeam/interface/PHcalTB04Info.h"
00035
00036 #include "G4Step.hh"
00037 #include "G4Track.hh"
00038 #include "G4ThreeVector.hh"
00039
00040 #include <boost/cstdint.hpp>
00041
00042 class BeginOfRun;
00043 class BeginOfEvent;
00044 class EndOfEvent;
00045
00046 class PHcalTB04Info;
00047
00048 class HcalTB04Analysis : public SimProducer,
00049 public Observer<const BeginOfRun *>,
00050 public Observer<const BeginOfEvent *>,
00051 public Observer<const EndOfEvent *>,
00052 public Observer<const G4Step *> {
00053
00054 public:
00055
00056 HcalTB04Analysis(const edm::ParameterSet &p);
00057 virtual ~HcalTB04Analysis();
00058
00059 virtual void produce(edm::Event&, const edm::EventSetup&);
00060
00061 private:
00062
00063 HcalTB04Analysis(const HcalTB04Analysis&);
00064 const HcalTB04Analysis& operator=(const HcalTB04Analysis&);
00065
00066 void init();
00067
00068
00069 void update(const BeginOfRun * run);
00070 void update(const BeginOfEvent * evt);
00071 void update(const G4Step * step);
00072 void update(const EndOfEvent * evt);
00073
00074
00075 void fillBuffer(const EndOfEvent * evt);
00076 void qieAnalysis();
00077 void xtalAnalysis();
00078 void finalAnalysis();
00079 void fillEvent(PHcalTB04Info&);
00080
00081 void clear();
00082 int unitID(uint32_t id);
00083 double scale(int det, int layer);
00084 double timeOfFlight(int det, int layer, double eta);
00085
00086 private:
00087
00088 HcalQie* myQie;
00089 HcalTB04Histo* histo;
00090
00091
00092 bool hcalOnly;
00093 int mode, type;
00094 double ecalNoise, beamOffset;
00095 int iceta, icphi;
00096 double scaleHB0, scaleHB16, scaleHO, scaleHE0;
00097 std::vector<std::string> names;
00098 G4RotationMatrix* beamline_RM;
00099
00100
00101 int count;
00102 int nTower, nCrystal;
00103 std::vector<int> idHcal, idXtal;
00104 std::vector<uint32_t> idTower, idEcal;
00105
00106
00107 int nPrimary, particleType;
00108 double pInit, etaInit, phiInit;
00109 std::vector<CaloHit> ecalHitCache;
00110 std::vector<CaloHit> hcalHitCache, hcalHitLayer;
00111 std::vector<double> esimh, eqie, esime, enois;
00112 std::vector<double> eseta, eqeta, esphi, eqphi, eslay, eqlay;
00113 double etots, eecals, ehcals, etotq, eecalq, ehcalq;
00114
00115 bool pvFound;
00116 int evNum, pvType;
00117 G4ThreeVector pvPosition, pvMomentum, pvUVW;
00118 std::vector<int> secTrackID, secPartID;
00119 std::vector<G4ThreeVector> secMomentum;
00120 std::vector<double> secEkin;
00121 std::vector<int> shortLivedSecondaries;
00122 };
00123
00124 #endif