Go to the documentation of this file.00001 #ifndef ShowerLibraryProducer_HcalForwardAnalysis_h
00002 #define ShowerLibraryProducer_HcalForwardAnalysis_h
00003
00004 #include <iostream>
00005 #include <memory>
00006 #include <vector>
00007 #include <string>
00008
00009
00010 #include "SimG4Core/Watcher/interface/SimProducer.h"
00011 #include "SimG4Core/Notification/interface/Observer.h"
00012
00013 #include "SimG4CMS/ShowerLibraryProducer/interface/FiberG4Hit.h"
00014 #include "SimG4CMS/ShowerLibraryProducer/interface/HFShowerG4Hit.h"
00015
00016 #include "FWCore/ServiceRegistry/interface/Service.h"
00017 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00018
00019
00020 #include "G4Step.hh"
00021 #include "G4Track.hh"
00022 #include "G4ThreeVector.hh"
00023
00024 #include "TFile.h"
00025 #include "TTree.h"
00026
00027 #include <boost/cstdint.hpp>
00028 #include <vector>
00029 #include <string>
00030
00031 class BeginOfRun;
00032 class BeginOfEvent;
00033 class EndOfEvent;
00034
00035 class HcalForwardAnalysis : public SimProducer,
00036 public Observer<const BeginOfRun *>,
00037 public Observer<const BeginOfEvent *>,
00038 public Observer<const EndOfEvent *>,
00039 public Observer<const G4Step *> {
00040
00041 public:
00042
00043 struct Photon {
00044 Photon(int id, float X, float Y, float Z, float T, float Lambda):
00045 fiberId(id), x(X), y(Y), z(Z), t(T), lambda(Lambda) {}
00046 int fiberId;
00047 float x;
00048 float y;
00049 float z;
00050 float t;
00051 float lambda;
00052 };
00053
00054 HcalForwardAnalysis(const edm::ParameterSet &p);
00055 virtual ~HcalForwardAnalysis();
00056
00057 virtual void produce(edm::Event&, const edm::EventSetup&);
00058
00059 private:
00060
00061 HcalForwardAnalysis(const HcalForwardAnalysis&);
00062 const HcalForwardAnalysis& operator=(const HcalForwardAnalysis&);
00063
00064 void init();
00065
00066
00067 void update(const BeginOfRun * run);
00068 void update(const BeginOfEvent * evt);
00069 void update(const G4Step * step);
00070 void update(const EndOfEvent * evt);
00071
00072
00073
00074 void setPhotons(const EndOfEvent * evt);
00075
00076 void fillEvent();
00077 void parseDetId(int id, int& tower, int& cell, int& fiber);
00078 void clear();
00079 edm::Service<TFileService> theFile;
00080
00081 TTree* theTree;
00082 int theEventCounter;
00083 int count;
00084 int evNum;
00085 float x[10000],y[10000],z[10000],t[10000],lambda[10000];
00086 float primX, primY, primZ,primT;
00087 float primMomX, primMomY, primMomZ;
00088 int nphot;
00089 int fiberId[10000];
00090 std::vector<Photon> thePhotons;
00091 std::vector<std::string> theNames;
00092 };
00093 #endif