2 #include "G4Electron.hh" 3 #include "G4Positron.hh" 4 #include "G4VProcess.hh" 5 #include "G4SDManager.hh" 6 #include "G4PrimaryParticle.hh" 7 #include "G4PrimaryVertex.hh" 17 using namespace CLHEP;
25 recoEnergyScaleEB_ = myP.
getParameter<
double>(
"recoEnergyScaleEB");
26 recoEnergyScaleEE_ = myP.
getParameter<
double>(
"recoEnergyScaleEE");
29 histFile_ =
new TFile(histFileName_.c_str(),
"RECREATE");
31 TH1::AddDirectory(kTRUE);
34 em_incE =
new TH1F(
"em_incE",
"Incoming energy at Ecal;E (GeV);Number of Events",500,0.0,500.0);
35 em_vtx_rho =
new TH1F(
"em_vtx_rho",
"vertex position;#rho (cm);Number of Events",100,0.0,10.0);
36 em_vtx_z =
new TH1F(
"em_vtx_z",
"vertex position;z (cm);Number of Events",100,-10.0,10.0);
38 eb_ssp_rho =
new TH1F(
"eb_ssp_rho",
"Shower starting position;#rho (cm);Number of Events",200,0.0,200.0);
39 eb_hit_long =
new TH1F(
"eb_hit_long",
"longitudinal hit position;shower depth (cm);Number of energy weighted hits",400,0.0,200.0);
40 eb_hit_lat =
new TH1F(
"eb_hit_lat",
"lateral hit position;arm (cm);Number of energy weighted hits",100,0.0,5.0);
41 eb_hit_rz =
new TH2F(
"eb_hit_rz",
"hit position along the shower direction;shower depth (cm);arm (cm)",400,0.0,200.0,100,0.0,5.0);
42 eb_hit_long_sd =
new TH1F(
"eb_hit_long_sd",
"longitudinal hit position in Sensitive Detector;shower depth (cm);Number of energy weighted hits",400,0.0,200.0);
43 eb_hit_lat_sd =
new TH1F(
"eb_hit_lat_sd",
"lateral hit position in Sensitive Detector;arm (cm);Number of energy weighted hits",100,0.0,5.0);
44 eb_hit_rz_sd =
new TH2F(
"eb_hit_rz_sd",
"hit position along the shower direction in Sensitive Detector;shower depth (cm);arm (cm)",400,0.0,200.0,100,0.0,5.0);
46 ee_ssp_z =
new TH1F(
"ee_ssp_z",
"Shower starting position;z (cm);Number of Events",800,-400.0,400.0);
47 ee_hit_long =
new TH1F(
"ee_hit_long",
"longitudinal hit position;shower depth (cm);Number of energy weighted hits",800,0.0,400.0);
48 ee_hit_lat =
new TH1F(
"ee_hit_lat",
"lateral hit position;arm (cm);Number of energy weighted hits",100,0.0,5.0);
49 ee_hit_rz =
new TH2F(
"ee_hit_rz",
"hit position along the shower direction;shower depth (cm);arm (cm)",800,0.0,400.0,100,0.0,5.0);
50 ee_hit_long_sd =
new TH1F(
"ee_hit_long_sd",
"longitudinal hit position in Sensitive Detector;shower depth (cm);Number of energy weighted hits",800,0.0,400.0);
51 ee_hit_lat_sd =
new TH1F(
"ee_hit_lat_sd",
"lateral hit position in Sensitive Detector;arm (cm);Number of energy weighted hits",100,0.0,5.0);
52 ee_hit_rz_sd =
new TH2F(
"ee_hit_rz_sd",
"hit position along the shower direction in Sensitive Detector;shower depth (cm);arm (cm)",800,0.0,400.0,100,0.0,5.0);
68 const G4Event* evt = (*g4Event)();
69 inc_vertex = evt->GetPrimaryVertex(0)->GetPosition();
70 inc_position = inc_vertex;
71 inc_direction = evt->GetPrimaryVertex(0)->GetPrimary(0)->GetMomentum().unit();
72 inc_energy = evt->GetPrimaryVertex(0)->GetPrimary(0)->GetMomentum().mag();
75 em_incE->Fill(inc_energy/
GeV);
76 em_vtx_rho->Fill(inc_vertex.rho()/cm);
77 em_vtx_z->Fill(inc_vertex.z()/cm);
79 if(
std::abs(inc_direction.eta()) < 1.5) eb_ssp_rho->Fill(inc_position.rho()/cm);
80 else ee_ssp_z->Fill(inc_position.z()/cm);
90 if(aStep ==
nullptr)
return;
92 double hitEnergy = aStep->GetTotalEnergyDeposit();
94 if(hitEnergy < 1.0
e-6)
return;
96 bool inEB =
std::abs(inc_direction.eta()) < 1.5;
98 out_energy += hitEnergy;
101 G4ThreeVector hitPosition = aStep->GetPreStepPoint()->GetPosition();
102 G4ThreeVector
diff = hitPosition - inc_position;
103 double angle = diff.angle(inc_direction);
107 G4VSensitiveDetector* aSensitive = aStep->GetPreStepPoint()->GetSensitiveDetector();
110 hitEnergy *= recoEnergyScaleEB_;
111 eb_hit_long->Fill(diff_z/cm,hitEnergy/
GeV);
112 eb_hit_lat->Fill(diff_r/cm,hitEnergy/
GeV);
113 eb_hit_rz->Fill(diff_z/cm,diff_r/cm,hitEnergy/
GeV);
115 eb_hit_long_sd->Fill(diff_z/cm,hitEnergy/
GeV);
116 eb_hit_lat_sd->Fill(diff_r/cm,hitEnergy/
GeV);
117 eb_hit_rz_sd->Fill(diff_z/cm,diff_r/cm,hitEnergy/
GeV);
121 hitEnergy *= recoEnergyScaleEE_;
122 ee_hit_long->Fill(diff_z/cm,hitEnergy/
GeV);
123 ee_hit_lat->Fill(diff_r/cm,hitEnergy/
GeV);
124 ee_hit_rz->Fill(diff_z/cm,diff_r/cm,hitEnergy/
GeV);
126 ee_hit_long_sd->Fill(diff_z/cm,hitEnergy/
GeV);
127 ee_hit_lat_sd->Fill(diff_r/cm,hitEnergy/
GeV);
128 ee_hit_rz_sd->Fill(diff_z/cm,diff_r/cm,hitEnergy/
GeV);
T getParameter(std::string const &) const
#define DEFINE_SIMWATCHER(type)
Sin< T >::type sin(const T &t)
GflashG4Watcher(const edm::ParameterSet &p)
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
~GflashG4Watcher() override
void update(const BeginOfEvent *) override
This routine will be called when the appropriate signal arrives.
T angle(T x1, T y1, T z1, T x2, T y2, T z2)