CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- 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 *)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfEvent *)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *)
 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 ( const edm::ParameterSet p)

Definition at line 23 of file GflashG4Watcher.cc.

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

23  {
24 
25  edm::ParameterSet myP = p.getParameter<edm::ParameterSet>("GflashG4Watcher");
26  histFileName_ = myP.getParameter<std::string>("histFileName");
27  recoEnergyScaleEB_ = myP.getParameter<double>("recoEnergyScaleEB");
28  recoEnergyScaleEE_ = myP.getParameter<double>("recoEnergyScaleEE");
29 
30 
31  histFile_ = new TFile(histFileName_.c_str(),"RECREATE");
32 
33  TH1::AddDirectory(kTRUE);
34 
35 
36  em_incE = new TH1F("em_incE","Incoming energy at Ecal;E (GeV);Number of Events",500,0.0,500.0);
37  em_vtx_rho = new TH1F("em_vtx_rho","vertex position;#rho (cm);Number of Events",100,0.0,10.0);
38  em_vtx_z = new TH1F("em_vtx_z","vertex position;z (cm);Number of Events",100,-10.0,10.0);
39 
40  eb_ssp_rho = new TH1F("eb_ssp_rho","Shower starting position;#rho (cm);Number of Events",200,0.0,200.0);
41  eb_hit_long = new TH1F("eb_hit_long","longitudinal hit position;shower depth (cm);Number of energy weighted hits",400,0.0,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("eb_hit_rz","hit position along the shower direction;shower depth (cm);arm (cm)",400,0.0,200.0,100,0.0,5.0);
44  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);
45  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);
46  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);
47 
48  ee_ssp_z = new TH1F("ee_ssp_z","Shower starting position;z (cm);Number of Events",800,-400.0,400.0);
49  ee_hit_long = new TH1F("ee_hit_long","longitudinal hit position;shower depth (cm);Number of energy weighted hits",800,0.0,400.0);
50  ee_hit_lat = new TH1F("ee_hit_lat","lateral hit position;arm (cm);Number of energy weighted hits",100,0.0,5.0);
51  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);
52  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);
53  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);
54  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);
55 
56 }
T getParameter(std::string const &) const
double recoEnergyScaleEE_
std::string histFileName_
double recoEnergyScaleEB_
GflashG4Watcher::~GflashG4Watcher ( )

Definition at line 59 of file GflashG4Watcher.cc.

59  {
60  histFile_->cd();
61  histFile_->Write();
62  histFile_->Close();
63 }

Member Function Documentation

void GflashG4Watcher::update ( const BeginOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 66 of file GflashG4Watcher.cc.

References funct::abs().

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

66  {
67 
68  inc_flag = false;
69 
70  const G4Event* evt = (*g4Event)();
71  inc_vertex = evt->GetPrimaryVertex(0)->GetPosition();
73  inc_direction = evt->GetPrimaryVertex(0)->GetPrimary(0)->GetMomentum().unit();
74  inc_energy = evt->GetPrimaryVertex(0)->GetPrimary(0)->GetMomentum().mag();
75  out_energy = 0;
76 
77  em_incE->Fill(inc_energy/GeV);
78  em_vtx_rho->Fill(inc_vertex.rho()/cm);
79  em_vtx_z->Fill(inc_vertex.z()/cm);
80 
81  if(std::abs(inc_direction.eta()) < 1.5) eb_ssp_rho->Fill(inc_position.rho()/cm);
82  else ee_ssp_z->Fill(inc_position.z()/cm);
83 
84 }
G4ThreeVector inc_position
G4ThreeVector inc_direction
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
G4ThreeVector inc_vertex
void GflashG4Watcher::update ( const EndOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent * >.

Definition at line 87 of file GflashG4Watcher.cc.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

87 { }
void GflashG4Watcher::update ( const G4Step *  )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 90 of file GflashG4Watcher.cc.

References funct::abs(), angle(), funct::cos(), diffTreeTool::diff, alignCSCRings::e, NULL, and funct::sin().

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

90  {
91 
92  if(aStep == NULL) return;
93 
94  double hitEnergy = aStep->GetTotalEnergyDeposit();
95 
96  if(hitEnergy < 1.0e-6) return;
97 
98  bool inEB = std::abs(inc_direction.eta()) < 1.5;
99 
100  out_energy += hitEnergy; // to check outgoing energy
101 
102  // This is to calculate shower depth and arm of hits from the shower direction
103  G4ThreeVector hitPosition = aStep->GetPreStepPoint()->GetPosition();
104  G4ThreeVector diff = hitPosition - inc_position;
105  double angle = diff.angle(inc_direction);
106  double diff_z = std::abs(diff.mag() * std::cos(angle));
107  double diff_r = std::abs(diff.mag() * std::sin(angle));
108 
109  G4VSensitiveDetector* aSensitive = aStep->GetPreStepPoint()->GetSensitiveDetector();
110 
111  if(inEB){ // showers in barrel crystals
112  hitEnergy *= recoEnergyScaleEB_;
113  eb_hit_long->Fill(diff_z/cm,hitEnergy/GeV);
114  eb_hit_lat->Fill(diff_r/cm,hitEnergy/GeV);
115  eb_hit_rz->Fill(diff_z/cm,diff_r/cm,hitEnergy/GeV);
116  if(aSensitive){
117  eb_hit_long_sd->Fill(diff_z/cm,hitEnergy/GeV);
118  eb_hit_lat_sd->Fill(diff_r/cm,hitEnergy/GeV);
119  eb_hit_rz_sd->Fill(diff_z/cm,diff_r/cm,hitEnergy/GeV);
120  }
121  }
122  else{ // showers in endcap crystals
123  hitEnergy *= recoEnergyScaleEE_;
124  ee_hit_long->Fill(diff_z/cm,hitEnergy/GeV);
125  ee_hit_lat->Fill(diff_r/cm,hitEnergy/GeV);
126  ee_hit_rz->Fill(diff_z/cm,diff_r/cm,hitEnergy/GeV);
127  if(aSensitive){
128  ee_hit_long_sd->Fill(diff_z/cm,hitEnergy/GeV);
129  ee_hit_lat_sd->Fill(diff_r/cm,hitEnergy/GeV);
130  ee_hit_rz_sd->Fill(diff_z/cm,diff_r/cm,hitEnergy/GeV);
131  }
132  }
133 
134 
135 }
G4ThreeVector inc_position
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
G4ThreeVector inc_direction
#define NULL
Definition: scimark2.h:8
double recoEnergyScaleEE_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double recoEnergyScaleEB_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

Member Data Documentation

TH1F* GflashG4Watcher::eb_hit_lat
private

Definition at line 58 of file GflashG4Watcher.h.

TH1F* GflashG4Watcher::eb_hit_lat_sd
private

Definition at line 61 of file GflashG4Watcher.h.

TH1F* GflashG4Watcher::eb_hit_long
private

Definition at line 57 of file GflashG4Watcher.h.

TH1F* GflashG4Watcher::eb_hit_long_sd
private

Definition at line 60 of file GflashG4Watcher.h.

TH2F* GflashG4Watcher::eb_hit_rz
private

Definition at line 59 of file GflashG4Watcher.h.

TH2F* GflashG4Watcher::eb_hit_rz_sd
private

Definition at line 62 of file GflashG4Watcher.h.

TH1F* GflashG4Watcher::eb_ssp_rho
private

Definition at line 56 of file GflashG4Watcher.h.

TH1F* GflashG4Watcher::ee_hit_lat
private

Definition at line 66 of file GflashG4Watcher.h.

TH1F* GflashG4Watcher::ee_hit_lat_sd
private

Definition at line 69 of file GflashG4Watcher.h.

TH1F* GflashG4Watcher::ee_hit_long
private

Definition at line 65 of file GflashG4Watcher.h.

TH1F* GflashG4Watcher::ee_hit_long_sd
private

Definition at line 68 of file GflashG4Watcher.h.

TH2F* GflashG4Watcher::ee_hit_rz
private

Definition at line 67 of file GflashG4Watcher.h.

TH2F* GflashG4Watcher::ee_hit_rz_sd
private

Definition at line 70 of file GflashG4Watcher.h.

TH1F* GflashG4Watcher::ee_ssp_z
private

Definition at line 64 of file GflashG4Watcher.h.

TH1F* GflashG4Watcher::em_incE
private

Definition at line 52 of file GflashG4Watcher.h.

TH1F* GflashG4Watcher::em_vtx_rho
private

Definition at line 53 of file GflashG4Watcher.h.

TH1F* GflashG4Watcher::em_vtx_z
private

Definition at line 54 of file GflashG4Watcher.h.

TFile* GflashG4Watcher::histFile_
private

Definition at line 50 of file GflashG4Watcher.h.

std::string GflashG4Watcher::histFileName_
private

Definition at line 46 of file GflashG4Watcher.h.

G4ThreeVector GflashG4Watcher::inc_direction
private

Definition at line 37 of file GflashG4Watcher.h.

G4double GflashG4Watcher::inc_energy
private

Definition at line 34 of file GflashG4Watcher.h.

G4bool GflashG4Watcher::inc_flag
private

Definition at line 33 of file GflashG4Watcher.h.

G4ThreeVector GflashG4Watcher::inc_position
private

Definition at line 38 of file GflashG4Watcher.h.

G4ThreeVector GflashG4Watcher::inc_vertex
private

Definition at line 36 of file GflashG4Watcher.h.

G4double GflashG4Watcher::out_energy
private

Definition at line 35 of file GflashG4Watcher.h.

double GflashG4Watcher::recoEnergyScaleEB_
private

Definition at line 47 of file GflashG4Watcher.h.

double GflashG4Watcher::recoEnergyScaleEE_
private

Definition at line 48 of file GflashG4Watcher.h.