CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
GflashG4Watcher Class Reference

#include <GflashG4Watcher.h>

Inheritance diagram for GflashG4Watcher:
SimWatcher Observer< const BeginOfEvent * > Observer< const EndOfEvent * > Observer< const G4Step * >

Public Member Functions

 GflashG4Watcher (const edm::ParameterSet &p)
 
 ~GflashG4Watcher () override
 
- Public Member Functions inherited from SimWatcher
 SimWatcher ()
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent * >
 Observer ()
 
void slotForUpdate (const EndOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const G4Step * >
 Observer ()
 
void slotForUpdate (const G4Step * iT)
 
virtual ~Observer ()
 

Private Member Functions

void update (const BeginOfEvent *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfEvent *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *) override
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

TH1F * eb_hit_lat
 
TH1F * eb_hit_lat_sd
 
TH1F * eb_hit_long
 
TH1F * eb_hit_long_sd
 
TH2F * eb_hit_rz
 
TH2F * eb_hit_rz_sd
 
TH1F * eb_ssp_rho
 
TH1F * ee_hit_lat
 
TH1F * ee_hit_lat_sd
 
TH1F * ee_hit_long
 
TH1F * ee_hit_long_sd
 
TH2F * ee_hit_rz
 
TH2F * ee_hit_rz_sd
 
TH1F * ee_ssp_z
 
TH1F * em_incE
 
TH1F * em_vtx_rho
 
TH1F * em_vtx_z
 
TFile * histFile_
 
std::string histFileName_
 
G4ThreeVector inc_direction
 
G4double inc_energy
 
G4bool inc_flag
 
G4ThreeVector inc_position
 
G4ThreeVector inc_vertex
 
G4double out_energy
 
double recoEnergyScaleEB_
 
double recoEnergyScaleEE_
 

Additional Inherited Members

Detailed Description

Definition at line 22 of file GflashG4Watcher.h.

Constructor & Destructor Documentation

◆ GflashG4Watcher()

GflashG4Watcher::GflashG4Watcher ( const edm::ParameterSet p)

Definition at line 21 of file GflashG4Watcher.cc.

21  {
22  edm::ParameterSet myP = p.getParameter<edm::ParameterSet>("GflashG4Watcher");
23  histFileName_ = myP.getParameter<std::string>("histFileName");
24  recoEnergyScaleEB_ = myP.getParameter<double>("recoEnergyScaleEB");
25  recoEnergyScaleEE_ = myP.getParameter<double>("recoEnergyScaleEE");
26 
27  histFile_ = new TFile(histFileName_.c_str(), "RECREATE");
28 
29  TH1::AddDirectory(kTRUE);
30 
31  em_incE = new TH1F("em_incE", "Incoming energy at Ecal;E (GeV);Number of Events", 500, 0.0, 500.0);
32  em_vtx_rho = new TH1F("em_vtx_rho", "vertex position;#rho (cm);Number of Events", 100, 0.0, 10.0);
33  em_vtx_z = new TH1F("em_vtx_z", "vertex position;z (cm);Number of Events", 100, -10.0, 10.0);
34 
35  eb_ssp_rho = new TH1F("eb_ssp_rho", "Shower starting position;#rho (cm);Number of Events", 200, 0.0, 200.0);
36  eb_hit_long = new TH1F("eb_hit_long",
37  "longitudinal hit position;shower depth (cm);Number "
38  "of energy weighted hits",
39  400,
40  0.0,
41  200.0);
42  eb_hit_lat = new TH1F("eb_hit_lat", "lateral hit position;arm (cm);Number of energy weighted hits", 100, 0.0, 5.0);
43  eb_hit_rz = new TH2F(
44  "eb_hit_rz", "hit position along the shower direction;shower depth (cm);arm (cm)", 400, 0.0, 200.0, 100, 0.0, 5.0);
45  eb_hit_long_sd = new TH1F("eb_hit_long_sd",
46  "longitudinal hit position in Sensitive Detector;shower depth "
47  "(cm);Number of energy weighted hits",
48  400,
49  0.0,
50  200.0);
51  eb_hit_lat_sd = new TH1F("eb_hit_lat_sd",
52  "lateral hit position in Sensitive Detector;arm "
53  "(cm);Number of energy weighted hits",
54  100,
55  0.0,
56  5.0);
57  eb_hit_rz_sd = new TH2F("eb_hit_rz_sd",
58  "hit position along the shower direction in "
59  "Sensitive Detector;shower depth (cm);arm (cm)",
60  400,
61  0.0,
62  200.0,
63  100,
64  0.0,
65  5.0);
66 
67  ee_ssp_z = new TH1F("ee_ssp_z", "Shower starting position;z (cm);Number of Events", 800, -400.0, 400.0);
68  ee_hit_long = new TH1F("ee_hit_long",
69  "longitudinal hit position;shower depth (cm);Number "
70  "of energy weighted hits",
71  800,
72  0.0,
73  400.0);
74  ee_hit_lat = new TH1F("ee_hit_lat", "lateral hit position;arm (cm);Number of energy weighted hits", 100, 0.0, 5.0);
75  ee_hit_rz = new TH2F(
76  "ee_hit_rz", "hit position along the shower direction;shower depth (cm);arm (cm)", 800, 0.0, 400.0, 100, 0.0, 5.0);
77  ee_hit_long_sd = new TH1F("ee_hit_long_sd",
78  "longitudinal hit position in Sensitive Detector;shower depth "
79  "(cm);Number of energy weighted hits",
80  800,
81  0.0,
82  400.0);
83  ee_hit_lat_sd = new TH1F("ee_hit_lat_sd",
84  "lateral hit position in Sensitive Detector;arm "
85  "(cm);Number of energy weighted hits",
86  100,
87  0.0,
88  5.0);
89  ee_hit_rz_sd = new TH2F("ee_hit_rz_sd",
90  "hit position along the shower direction in "
91  "Sensitive Detector;shower depth (cm);arm (cm)",
92  800,
93  0.0,
94  400.0,
95  100,
96  0.0,
97  5.0);
98 }

References edm::ParameterSet::getParameter(), AlCaHLTBitMon_ParallelJobs::p, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~GflashG4Watcher()

GflashG4Watcher::~GflashG4Watcher ( )
override

Definition at line 100 of file GflashG4Watcher.cc.

100  {
101  histFile_->cd();
102  histFile_->Write();
103  histFile_->Close();
104 }

Member Function Documentation

◆ update() [1/3]

void GflashG4Watcher::update ( const BeginOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 106 of file GflashG4Watcher.cc.

106  {
107  inc_flag = false;
108 
109  const G4Event *evt = (*g4Event)();
110  inc_vertex = evt->GetPrimaryVertex(0)->GetPosition();
112  inc_direction = evt->GetPrimaryVertex(0)->GetPrimary(0)->GetMomentum().unit();
113  inc_energy = evt->GetPrimaryVertex(0)->GetPrimary(0)->GetMomentum().mag();
114  out_energy = 0;
115 
116  em_incE->Fill(inc_energy / GeV);
117  em_vtx_rho->Fill(inc_vertex.rho() / cm);
118  em_vtx_z->Fill(inc_vertex.z() / cm);
119 
120  if (std::abs(inc_direction.eta()) < 1.5)
121  eb_ssp_rho->Fill(inc_position.rho() / cm);
122  else
123  ee_ssp_z->Fill(inc_position.z() / cm);
124 }

References funct::abs(), and GeV.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [2/3]

void GflashG4Watcher::update ( const EndOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent * >.

Definition at line 126 of file GflashG4Watcher.cc.

126 {}

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [3/3]

void GflashG4Watcher::update ( const G4Step *  )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 128 of file GflashG4Watcher.cc.

128  {
129  if (aStep == nullptr)
130  return;
131 
132  double hitEnergy = aStep->GetTotalEnergyDeposit();
133 
134  if (hitEnergy < 1.0e-6)
135  return;
136 
137  bool inEB = std::abs(inc_direction.eta()) < 1.5;
138 
139  out_energy += hitEnergy; // to check outgoing energy
140 
141  // This is to calculate shower depth and arm of hits from the shower direction
142  G4ThreeVector hitPosition = aStep->GetPreStepPoint()->GetPosition();
143  G4ThreeVector diff = hitPosition - inc_position;
144  double angle = diff.angle(inc_direction);
145  double diff_z = std::abs(diff.mag() * std::cos(angle));
146  double diff_r = std::abs(diff.mag() * std::sin(angle));
147 
148  G4VSensitiveDetector *aSensitive = aStep->GetPreStepPoint()->GetSensitiveDetector();
149 
150  if (inEB) { // showers in barrel crystals
151  hitEnergy *= recoEnergyScaleEB_;
152  eb_hit_long->Fill(diff_z / cm, hitEnergy / GeV);
153  eb_hit_lat->Fill(diff_r / cm, hitEnergy / GeV);
154  eb_hit_rz->Fill(diff_z / cm, diff_r / cm, hitEnergy / GeV);
155  if (aSensitive) {
156  eb_hit_long_sd->Fill(diff_z / cm, hitEnergy / GeV);
157  eb_hit_lat_sd->Fill(diff_r / cm, hitEnergy / GeV);
158  eb_hit_rz_sd->Fill(diff_z / cm, diff_r / cm, hitEnergy / GeV);
159  }
160  } else { // showers in endcap crystals
161  hitEnergy *= recoEnergyScaleEE_;
162  ee_hit_long->Fill(diff_z / cm, hitEnergy / GeV);
163  ee_hit_lat->Fill(diff_r / cm, hitEnergy / GeV);
164  ee_hit_rz->Fill(diff_z / cm, diff_r / cm, hitEnergy / GeV);
165  if (aSensitive) {
166  ee_hit_long_sd->Fill(diff_z / cm, hitEnergy / GeV);
167  ee_hit_lat_sd->Fill(diff_r / cm, hitEnergy / GeV);
168  ee_hit_rz_sd->Fill(diff_z / cm, diff_r / cm, hitEnergy / GeV);
169  }
170  }
171 }

References funct::abs(), angle(), funct::cos(), change_name::diff, MillePedeFileConverter_cfg::e, GeV, and funct::sin().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

Member Data Documentation

◆ eb_hit_lat

TH1F* GflashG4Watcher::eb_hit_lat
private

Definition at line 56 of file GflashG4Watcher.h.

◆ eb_hit_lat_sd

TH1F* GflashG4Watcher::eb_hit_lat_sd
private

Definition at line 59 of file GflashG4Watcher.h.

◆ eb_hit_long

TH1F* GflashG4Watcher::eb_hit_long
private

Definition at line 55 of file GflashG4Watcher.h.

◆ eb_hit_long_sd

TH1F* GflashG4Watcher::eb_hit_long_sd
private

Definition at line 58 of file GflashG4Watcher.h.

◆ eb_hit_rz

TH2F* GflashG4Watcher::eb_hit_rz
private

Definition at line 57 of file GflashG4Watcher.h.

◆ eb_hit_rz_sd

TH2F* GflashG4Watcher::eb_hit_rz_sd
private

Definition at line 60 of file GflashG4Watcher.h.

◆ eb_ssp_rho

TH1F* GflashG4Watcher::eb_ssp_rho
private

Definition at line 54 of file GflashG4Watcher.h.

◆ ee_hit_lat

TH1F* GflashG4Watcher::ee_hit_lat
private

Definition at line 64 of file GflashG4Watcher.h.

◆ ee_hit_lat_sd

TH1F* GflashG4Watcher::ee_hit_lat_sd
private

Definition at line 67 of file GflashG4Watcher.h.

◆ ee_hit_long

TH1F* GflashG4Watcher::ee_hit_long
private

Definition at line 63 of file GflashG4Watcher.h.

◆ ee_hit_long_sd

TH1F* GflashG4Watcher::ee_hit_long_sd
private

Definition at line 66 of file GflashG4Watcher.h.

◆ ee_hit_rz

TH2F* GflashG4Watcher::ee_hit_rz
private

Definition at line 65 of file GflashG4Watcher.h.

◆ ee_hit_rz_sd

TH2F* GflashG4Watcher::ee_hit_rz_sd
private

Definition at line 68 of file GflashG4Watcher.h.

◆ ee_ssp_z

TH1F* GflashG4Watcher::ee_ssp_z
private

Definition at line 62 of file GflashG4Watcher.h.

◆ em_incE

TH1F* GflashG4Watcher::em_incE
private

Definition at line 50 of file GflashG4Watcher.h.

◆ em_vtx_rho

TH1F* GflashG4Watcher::em_vtx_rho
private

Definition at line 51 of file GflashG4Watcher.h.

◆ em_vtx_z

TH1F* GflashG4Watcher::em_vtx_z
private

Definition at line 52 of file GflashG4Watcher.h.

◆ histFile_

TFile* GflashG4Watcher::histFile_
private

Definition at line 48 of file GflashG4Watcher.h.

◆ histFileName_

std::string GflashG4Watcher::histFileName_
private

Definition at line 44 of file GflashG4Watcher.h.

◆ inc_direction

G4ThreeVector GflashG4Watcher::inc_direction
private

Definition at line 35 of file GflashG4Watcher.h.

◆ inc_energy

G4double GflashG4Watcher::inc_energy
private

Definition at line 32 of file GflashG4Watcher.h.

◆ inc_flag

G4bool GflashG4Watcher::inc_flag
private

Definition at line 31 of file GflashG4Watcher.h.

◆ inc_position

G4ThreeVector GflashG4Watcher::inc_position
private

Definition at line 36 of file GflashG4Watcher.h.

◆ inc_vertex

G4ThreeVector GflashG4Watcher::inc_vertex
private

Definition at line 34 of file GflashG4Watcher.h.

◆ out_energy

G4double GflashG4Watcher::out_energy
private

Definition at line 33 of file GflashG4Watcher.h.

◆ recoEnergyScaleEB_

double GflashG4Watcher::recoEnergyScaleEB_
private

Definition at line 45 of file GflashG4Watcher.h.

◆ recoEnergyScaleEE_

double GflashG4Watcher::recoEnergyScaleEE_
private

Definition at line 46 of file GflashG4Watcher.h.

GflashG4Watcher::eb_hit_rz_sd
TH2F * eb_hit_rz_sd
Definition: GflashG4Watcher.h:60
change_name.diff
diff
Definition: change_name.py:13
GflashG4Watcher::eb_ssp_rho
TH1F * eb_ssp_rho
Definition: GflashG4Watcher.h:54
GflashG4Watcher::recoEnergyScaleEE_
double recoEnergyScaleEE_
Definition: GflashG4Watcher.h:46
GflashG4Watcher::ee_ssp_z
TH1F * ee_ssp_z
Definition: GflashG4Watcher.h:62
GflashG4Watcher::eb_hit_lat
TH1F * eb_hit_lat
Definition: GflashG4Watcher.h:56
GflashG4Watcher::eb_hit_long_sd
TH1F * eb_hit_long_sd
Definition: GflashG4Watcher.h:58
GflashG4Watcher::histFile_
TFile * histFile_
Definition: GflashG4Watcher.h:48
GflashG4Watcher::em_vtx_z
TH1F * em_vtx_z
Definition: GflashG4Watcher.h:52
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
GflashG4Watcher::inc_direction
G4ThreeVector inc_direction
Definition: GflashG4Watcher.h:35
GflashG4Watcher::eb_hit_rz
TH2F * eb_hit_rz
Definition: GflashG4Watcher.h:57
GflashG4Watcher::ee_hit_long
TH1F * ee_hit_long
Definition: GflashG4Watcher.h:63
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
GflashG4Watcher::inc_flag
G4bool inc_flag
Definition: GflashG4Watcher.h:31
GflashG4Watcher::inc_energy
G4double inc_energy
Definition: GflashG4Watcher.h:32
GflashG4Watcher::em_vtx_rho
TH1F * em_vtx_rho
Definition: GflashG4Watcher.h:51
GflashG4Watcher::em_incE
TH1F * em_incE
Definition: GflashG4Watcher.h:50
GflashG4Watcher::recoEnergyScaleEB_
double recoEnergyScaleEB_
Definition: GflashG4Watcher.h:45
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
GflashG4Watcher::inc_vertex
G4ThreeVector inc_vertex
Definition: GflashG4Watcher.h:34
GflashG4Watcher::ee_hit_rz_sd
TH2F * ee_hit_rz_sd
Definition: GflashG4Watcher.h:68
GflashG4Watcher::ee_hit_rz
TH2F * ee_hit_rz
Definition: GflashG4Watcher.h:65
GflashG4Watcher::eb_hit_long
TH1F * eb_hit_long
Definition: GflashG4Watcher.h:55
GflashG4Watcher::ee_hit_long_sd
TH1F * ee_hit_long_sd
Definition: GflashG4Watcher.h:66
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GflashG4Watcher::out_energy
G4double out_energy
Definition: GflashG4Watcher.h:33
GflashG4Watcher::histFileName_
std::string histFileName_
Definition: GflashG4Watcher.h:44
edm::ParameterSet
Definition: ParameterSet.h:36
GflashG4Watcher::ee_hit_lat
TH1F * ee_hit_lat
Definition: GflashG4Watcher.h:64
GeV
const double GeV
Definition: MathUtil.h:16
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
GflashG4Watcher::eb_hit_lat_sd
TH1F * eb_hit_lat_sd
Definition: GflashG4Watcher.h:59
GflashG4Watcher::inc_position
G4ThreeVector inc_position
Definition: GflashG4Watcher.h:36
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
GflashG4Watcher::ee_hit_lat_sd
TH1F * ee_hit_lat_sd
Definition: GflashG4Watcher.h:67
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37