test
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
HcalTB02Analysis Class Reference

#include <SimG4CMS/HcalTestBeam/interface/HcalTB02Analysis.h>

Inheritance diagram for HcalTB02Analysis:
SimProducer Observer< const BeginOfEvent * > Observer< const EndOfEvent * > SimWatcher

Public Member Functions

 HcalTB02Analysis (const edm::ParameterSet &p)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~HcalTB02Analysis ()
 
- Public Member Functions inherited from SimProducer
void registerProducts (edm::ProducerBase &iProd)
 
 SimProducer ()
 
- 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 ()
 

Private Member Functions

void clear ()
 
void fillEvent (HcalTB02HistoClass &)
 
void finish ()
 
 HcalTB02Analysis (const HcalTB02Analysis &)
 
const HcalTB02Analysisoperator= (const HcalTB02Analysis &)
 
void update (const BeginOfEvent *evt)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfEvent *evt)
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

float E5x5Matrix
 
float E5x5MatrixN
 
float E7x7Matrix
 
float E7x7MatrixN
 
std::map< int, float > energyInCrystals
 
std::map< int, float > energyInScints
 
double eta
 
std::string fileNameTuple
 
bool hcalOnly
 
HcalTB02Histohisto
 
double incidentEnergy
 
int maxTime
 
std::vector< std::string > names
 
int particleType
 
double phi
 
double pInit
 
std::map< int, float > primaries
 
float SEnergy
 
float SEnergyN
 
float xE3x3Matrix
 
float xE3x3MatrixN
 
float xE5x5Matrix
 
float xE5x5MatrixN
 
double xIncidentEnergy
 
float xSEnergy
 
float xSEnergyN
 

Additional Inherited Members

- Protected Member Functions inherited from SimProducer
template<class T >
void produces ()
 
template<class T >
void produces (const std::string &instanceName)
 

Detailed Description

Description: Analysis of 2004 Hcal Test beam simulation

Usage: A Simwatcher class and can be activated from Oscarproducer module

Definition at line 40 of file HcalTB02Analysis.h.

Constructor & Destructor Documentation

HcalTB02Analysis::HcalTB02Analysis ( const edm::ParameterSet p)

Definition at line 49 of file HcalTB02Analysis.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hcalOnly, histo, and names.

49  {
50 
51  edm::ParameterSet m_Anal = p.getParameter<edm::ParameterSet>("HcalTB02Analysis");
52  hcalOnly = m_Anal.getUntrackedParameter<bool>("HcalClusterOnly",true);
53  names = m_Anal.getParameter<std::vector<std::string> >("Names");
54 
55  produces<HcalTB02HistoClass>();
56 
57  edm::LogInfo("HcalTBSim") << "HcalTB02Analysis:: Initialised as observer of "
58  << "BeginOfJob/BeginOfEvent/EndOfEvent with "
59  << "Parameter values:\n \thcalOnly = " << hcalOnly;
60 
61  histo = new HcalTB02Histo(m_Anal);
62 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
HcalTB02Histo * histo
std::vector< std::string > names
HcalTB02Analysis::~HcalTB02Analysis ( )
virtual

Definition at line 64 of file HcalTB02Analysis.cc.

References finish(), and histo.

64  {
65 
66  finish();
67  delete histo;
68 }
HcalTB02Histo * histo
HcalTB02Analysis::HcalTB02Analysis ( const HcalTB02Analysis )
private

Member Function Documentation

void HcalTB02Analysis::clear ( void  )
private

Definition at line 397 of file HcalTB02Analysis.cc.

References E5x5Matrix, E5x5MatrixN, E7x7Matrix, E7x7MatrixN, energyInCrystals, energyInScints, eta, incidentEnergy, maxTime, particleType, phi, pInit, primaries, SEnergy, SEnergyN, xE3x3Matrix, xE3x3MatrixN, xE5x5Matrix, xE5x5MatrixN, xIncidentEnergy, xSEnergy, and xSEnergyN.

Referenced by update().

397  {
398 
399  primaries.clear();
400  particleType = 0;
401  pInit = eta = phi = incidentEnergy = 0;
402 
404  E7x7MatrixN = E5x5MatrixN = 0;
405  energyInScints.clear();
406  maxTime = 0;
407 
408  xIncidentEnergy = 0;
409  energyInCrystals.clear();
412 }
std::map< int, float > energyInCrystals
std::map< int, float > primaries
std::map< int, float > energyInScints
void HcalTB02Analysis::fillEvent ( HcalTB02HistoClass product)
private

Definition at line 366 of file HcalTB02Analysis.cc.

References E5x5Matrix, E5x5MatrixN, E7x7Matrix, E7x7MatrixN, energyInCrystals, energyInScints, eta, GeV, incidentEnergy, maxTime, particleType, phi, pInit, primaries, SEnergy, SEnergyN, HcalTB02HistoClass::set_E5x5(), HcalTB02HistoClass::set_E5x5N(), HcalTB02HistoClass::set_E7x7(), HcalTB02HistoClass::set_E7x7N(), HcalTB02HistoClass::set_Eentry(), HcalTB02HistoClass::set_Einit(), HcalTB02HistoClass::set_eta(), HcalTB02HistoClass::set_ETot(), HcalTB02HistoClass::set_ETotN(), HcalTB02HistoClass::set_Nprim(), HcalTB02HistoClass::set_Ntimesli(), HcalTB02HistoClass::set_NUnit(), HcalTB02HistoClass::set_partType(), HcalTB02HistoClass::set_phi(), HcalTB02HistoClass::set_xE3x3(), HcalTB02HistoClass::set_xE3x3N(), HcalTB02HistoClass::set_xE5x5(), HcalTB02HistoClass::set_xE5x5N(), HcalTB02HistoClass::set_xEentry(), HcalTB02HistoClass::set_xETot(), HcalTB02HistoClass::set_xETotN(), HcalTB02HistoClass::set_xNUnit(), xE3x3Matrix, xE3x3MatrixN, xE5x5Matrix, xE5x5MatrixN, xIncidentEnergy, xSEnergy, and xSEnergyN.

Referenced by produce().

366  {
367 
368  //Beam information
369  product.set_Nprim(float(primaries.size()));
370  product.set_partType(particleType);
371  product.set_Einit(pInit/GeV);
372  product.set_eta(eta);
373  product.set_phi(phi);
374  product.set_Eentry(incidentEnergy);
375 
376  //Calorimeter energy
377  product.set_ETot(SEnergy/GeV );
378  product.set_E7x7(E7x7Matrix/GeV );
379  product.set_E5x5(E5x5Matrix/GeV );
380  product.set_ETotN(SEnergyN/GeV);
381  product.set_E7x7N(E7x7MatrixN/GeV );
382  product.set_E5x5N(E5x5MatrixN/GeV );
383  product.set_NUnit(float(energyInScints.size()));
384  product.set_Ntimesli(float(maxTime));
385 
386  //crystal information
387  product.set_xEentry(xIncidentEnergy);
388  product.set_xNUnit(float(energyInCrystals.size()));
389  product.set_xETot(xSEnergy/GeV);
390  product.set_xETotN(xSEnergyN/GeV);
391  product.set_xE5x5(xE5x5Matrix/GeV);
392  product.set_xE3x3(xE3x3Matrix/GeV);
393  product.set_xE5x5N(xE5x5MatrixN/GeV);
394  product.set_xE3x3N(xE3x3MatrixN/GeV);
395 }
void set_xE3x3N(float v)
void set_E5x5N(float v)
void set_Ntimesli(float v)
void set_NUnit(float v)
void set_Eentry(float v)
const double GeV
Definition: MathUtil.h:16
void set_xEentry(float v)
void set_xETotN(float v)
void set_Nprim(float v)
void set_E7x7(float v)
void set_ETotN(float v)
void set_Einit(float v)
void set_xETot(float v)
void set_E7x7N(float v)
std::map< int, float > energyInCrystals
void set_xE3x3(float v)
void set_xE5x5N(float v)
std::map< int, float > primaries
std::map< int, float > energyInScints
void set_E5x5(float v)
void set_partType(float v)
void set_ETot(float v)
void set_xE5x5(float v)
void set_xNUnit(float v)
void HcalTB02Analysis::finish ( )
private

Definition at line 414 of file HcalTB02Analysis.cc.

Referenced by progressbar.ProgressBar::__next__(), and ~HcalTB02Analysis().

414  {
415 
416  /*
417  //Profile
418  std::ofstream oFile;
419  oFile.open("profile.dat");
420  float st[19] = {0.8,
421  0.4, 0.4, 0.4, 0.4, 0.4,
422  0.4, 0.4, 0.4, 0.4, 0.4,
423  0.4, 0.4, 0.4, 0.4, 0.4,
424  0.8, 1.0, 1.0};
425 
426  //cm of material (brass) in front of scintillator layer i:
427 
428  float w[19] = {7.45, //iron !
429  6.00, 6.00, 6.00, 6.00, 6.00, //brass
430  6.00, 6.00, 6.00, 6.00, 6.60, //brass
431  6.60, 6.60, 6.60, 6.60, 6.60, //brass
432  8.90, 20.65, 19.5}; //brass,iron !
433 
434  for (int ilayer = 0; ilayer<19; ilayer++) {
435 
436  // Histogram mean and sigma calculated from the ROOT histos
437  edm::LogInfo("HcalTBSim") << "Layer number: " << ilayer << " Mean = "
438  << histo->getMean(ilayer) << " sigma = "
439  << histo->getRMS(ilayer) << " LThick= "
440  << w[ilayer] << " SThick= " << st[ilayer];
441 
442  oFile << ilayer << " " << histo->getMean(ilayer) << " "
443  << histo->getRMS(ilayer) << " " << w[ilayer] << " " << st[ilayer]
444  << std::endl;
445 
446  }
447  oFile.close();
448  */
449 }
const HcalTB02Analysis& HcalTB02Analysis::operator= ( const HcalTB02Analysis )
private
void HcalTB02Analysis::produce ( edm::Event e,
const edm::EventSetup  
)
virtual

Implements SimProducer.

Definition at line 74 of file HcalTB02Analysis.cc.

References fillEvent(), eostools::move(), and edm::Event::put().

74  {
75 
76  std::unique_ptr<HcalTB02HistoClass> product(new HcalTB02HistoClass);
77  fillEvent(*product);
78  e.put(std::move(product));
79 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
void fillEvent(HcalTB02HistoClass &)
def move
Definition: eostools.py:510
void HcalTB02Analysis::update ( const BeginOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 81 of file HcalTB02Analysis.cc.

References clear().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.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(), MatrixUtil.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().

81  {
82 
83  edm::LogInfo("HcalTBSim") << "HcalTB02Analysis: =====> Begin of event = "
84  << (*evt) ()->GetEventID();
85  clear();
86 }
void HcalTB02Analysis::update ( const EndOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent * >.

Definition at line 88 of file HcalTB02Analysis.cc.

References gather_cfg::cout, PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, E5x5Matrix, E5x5MatrixN, E7x7Matrix, E7x7MatrixN, energyInCrystals, energyInScints, eta, HcalTB02Histo::fillAllTime(), HcalTB02Histo::fillProfile(), HcalTB02Histo::fillTransProf(), CaloG4Hit::getEM(), HcalTB02HcalNumberingScheme::getetaID(), CaloG4Hit::getHadr(), CaloG4Hit::getIncidentEnergy(), HcalTB02HcalNumberingScheme::getlayerID(), HcalTB02HcalNumberingScheme::getphiID(), CaloG4Hit::getTimeSliceID(), CaloG4Hit::getTrackID(), CaloG4Hit::getUnitID(), GeV, hcalOnly, histo, i, incidentEnergy, dqm-mbProfile::log, LogDebug, bookConverter::max, maxTime, min(), names, particleType, phi, pInit, funct::pow(), primaries, sd, SEnergy, SEnergyN, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), theta(), xE3x3Matrix, xE3x3MatrixN, xE5x5Matrix, xE5x5MatrixN, xIncidentEnergy, and xSEnergy.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.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(), MatrixUtil.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().

88  {
89 
90  CLHEP::HepRandomEngine* engine = G4Random::getTheEngine();
91  CLHEP::RandGaussQ randGauss(*engine);
92 
93  // Look for the Hit Collection
94  LogDebug("HcalTBSim") << "HcalTB02Analysis::Fill event "
95  << (*evt)()->GetEventID();
96 
97  // access to the G4 hit collections
98  G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
99  int ihit = 0;
100 
101  // HCAL
102  std::string sd = names[0];
103  int HCHCid = G4SDManager::GetSDMpointer()->GetCollectionID(sd);
104  CaloG4HitCollection* theHCHC = (CaloG4HitCollection*) allHC->GetHC(HCHCid);
105  LogDebug("HcalTBSim") << "HcalTB02Analysis :: Hit Collection for " << sd
106  << " of ID " << HCHCid << " is obtained at " <<theHCHC;
107 
108  int nentries = 0;
109  nentries = theHCHC->entries();
110  if (nentries==0) return;
111 
112  int xentries = 0;
113  int XTALSid=0;
114  CaloG4HitCollection* theXTHC=0;
115 
116  if (!hcalOnly) {
117  // XTALS
118  sd = names[1];
119  XTALSid = G4SDManager::GetSDMpointer()->GetCollectionID(sd);
120  theXTHC = (CaloG4HitCollection*) allHC->GetHC(XTALSid);
121  LogDebug("HcalTBSim") << "HcalTB02Analysis :: Hit Collection for " << sd
122  << " of ID " << XTALSid << " is obtained at "
123  << theXTHC;
124  xentries = theXTHC->entries();
125  if (xentries==0) return;
126  }
127 
128  LogDebug("HcalTBSim") << "HcalTB02Analysis :: There are " << nentries
129  << " HCal hits, and" << xentries << " xtal hits";
130 
131  float ETot=0., xETot=0.;
132  int scintID=0, xtalID=0;
133 
134  // HCAL
136 
137  if (HCHCid >= 0 && theHCHC > 0) {
138  for ( ihit = 0; ihit < nentries; ihit++) {
139 
140  CaloG4Hit* aHit = (*theHCHC)[ihit];
141  scintID = aHit->getUnitID();
142  int layer = org->getlayerID(scintID);
143  float enEm = aHit->getEM();
144  float enhad = aHit->getHadr();
145 
146  if (layer==0) {
147  enEm =enEm/2.;
148  enhad=enhad/2.;
149  }
150 
151  energyInScints[scintID]+= enEm + enhad;
152  primaries[aHit->getTrackID()]+= enEm + enhad;
153  float time = aHit->getTimeSliceID();
154  if (time > maxTime) maxTime=(int)time;
155  histo->fillAllTime(time);
156 
157  }
158 
159  //
160  // Profile
161  //
162 
163  float TowerEne[8][18], TowerEneCF[8][18], LayerEne[19], EnRing[100];
164  for (int iphi=0 ; iphi<8; iphi++) {
165  for (int jeta=0 ; jeta<18; jeta++) {
166  TowerEne[iphi][jeta]=0.;
167  TowerEneCF[iphi][jeta]=0.;
168  }
169  }
170 
171  for (int ilayer=0; ilayer<19; ilayer++) LayerEne[ilayer]=0.;
172  for (int iring=0; iring<100; iring++) EnRing[iring]=0.;
173 
174  for (std::map<int,float>::iterator is = energyInScints.begin();
175  is!= energyInScints.end(); is++) {
176 
177  ETot = (*is).second;
178 
179  int layer = org->getlayerID((*is).first);
180 
181  if ( (layer!=17) && (layer!=18) ) {
182 
183  float eta = org->getetaID((*is).first);
184  float phi = org->getphiID((*is).first);
185 
186  SEnergy += ETot;
187  TowerEne[(int)phi][(int)eta] += ETot;
188 
189  TowerEneCF[(int)phi][(int)eta] += ETot*(1.+ 0.1*randGauss.fire() );
190  double dR=0.08727*std::sqrt( (eta-8.)*(eta-8.) + (phi-3.)*(phi-3.) );
191  EnRing[(int)(dR/0.01)] += ETot;
192  }
193 
194  LayerEne[layer] += ETot;
195 
196  }
197 
198  for (int ilayer=0 ; ilayer<19 ; ilayer++) {
199  histo->fillProfile(ilayer,LayerEne[ilayer]/GeV);
200  }
201 
202  for (int iring=0; iring<100; iring++)
203  histo->fillTransProf(0.01*iring+0.005,EnRing[iring]/GeV);
204 
205  for (int iphi=0 ; iphi<8; iphi++) {
206  for (int jeta=0 ; jeta<18; jeta++) {
207 
208  SEnergyN += TowerEneCF[iphi][jeta] + 3.*randGauss.fire(); // QGSP
209 
210  double Rand = 3.*randGauss.fire(); // QGSP
211 
212  if ( (iphi>=0) && (iphi<7) ) {
213  if ( (jeta>=5) && (jeta<12) ) {
214 
215  E7x7Matrix += TowerEne[iphi][jeta];
216  E7x7MatrixN += TowerEneCF[iphi][jeta] + Rand;
217 
218  if ( (iphi>=1) && (iphi<6) ) {
219  if ( (jeta>=6) && (jeta<11) ) {
220 
221  E5x5Matrix += TowerEne[iphi][jeta];
222  E5x5MatrixN += TowerEneCF[iphi][jeta] + Rand;
223 
224  }
225  }
226 
227  }
228  }
229 
230  }
231  }
232 
233  //
234  // Find Primary info:
235  //
236  int trackID = 0;
237  G4PrimaryParticle* thePrim=0;
238  G4int nvertex = (*evt)()->GetNumberOfPrimaryVertex();
239  LogDebug("HcalTBSim") << "HcalTB02Analysis :: Event has " << nvertex
240  << " vertex";
241  if (nvertex==0)
242  edm::LogWarning("HcalTBSim") << "HcalTB02Analysis:: End Of Event "
243  << "ERROR: no vertex";
244 
245  for (int i = 0 ; i<nvertex; i++) {
246 
247  G4PrimaryVertex* avertex = (*evt)()->GetPrimaryVertex(i);
248  if (avertex == 0) {
249  edm::LogWarning("HcalTBSim") << "HcalTB02Analysis:: End Of Event "
250  << "ERROR: pointer to vertex = 0";
251  } else {
252  int npart = avertex->GetNumberOfParticle();
253  LogDebug("HcalTBSim") << "HcalTB02Analysis::Vertex number :" << i
254  << " with " << npart << " particles";
255  if (thePrim==0) thePrim=avertex->GetPrimary(trackID);
256  }
257  }
258 
259  double px=0.,py=0.,pz=0.;
260 
261  if (thePrim != 0) {
262  px = thePrim->GetPx();
263  py = thePrim->GetPy();
264  pz = thePrim->GetPz();
265  pInit = std::sqrt(pow(px,2.)+pow(py,2.)+pow(pz,2.));
266  if (pInit==0) {
267  edm::LogWarning("HcalTBSim") << "HcalTB02Analysis:: End Of Event "
268  << " ERROR: primary has p=0 ";
269  } else {
270  float costheta = pz/pInit;
271  float theta = acos(std::min(std::max(costheta,float(-1.)),float(1.)));
272  eta = -log(tan(theta/2));
273  if (px != 0) phi = atan(py/px);
274  }
275  particleType = thePrim->GetPDGcode();
276  } else {
277  LogDebug("HcalTBSim") << "HcalTB02Analysis:: End Of Event ERROR: could"
278  << " not find primary ";
279  }
280 
281  CaloG4Hit* firstHit =(*theHCHC)[0];
282  incidentEnergy = (firstHit->getIncidentEnergy()/GeV);
283 
284  }// number of Hits > 0
285 
286  if (!hcalOnly) {
287 
288  // XTALS
289 
290  if (XTALSid >= 0 && theXTHC > 0) {
291  for (int xihit = 0; xihit < xentries; xihit++) {
292 
293  CaloG4Hit* xaHit = (*theXTHC)[xihit];
294 
295  float xenEm = xaHit->getEM();
296  float xenhad = xaHit->getHadr();
297  xtalID = xaHit->getUnitID();
298 
299  energyInCrystals[xtalID]+= xenEm + xenhad;
300  }
301 
302  float xCrysEne[7][7];
303  for (int irow=0 ; irow<7; irow++) {
304  for (int jcol=0 ; jcol<7; jcol++) {
305  xCrysEne[irow][jcol]=0.;
306  }
307  }
308 
309  for (std::map<int,float>::iterator is = energyInCrystals.begin();
310  is!= energyInCrystals.end(); is++) {
311  int xtalID = (*is).first;
312  xETot = (*is).second;
313 
314  int irow = (int)(xtalID/100.);
315  int jcol = (int)(xtalID-100.*irow);
316 
317  xSEnergy += xETot;
318  xCrysEne[irow][jcol] = xETot;
319 
320  float dR=std::sqrt( 0.01619*0.01619*(jcol-3)*(jcol-3) +
321  0.01606*0.01606*(irow-3)*(irow-3) );
322  histo->fillTransProf(dR,xETot*1.05);
323 
324  if ( (irow>0) && (irow<6) ) {
325  if ( (jcol>0) && (jcol<6) ) {
326 
327  xE5x5Matrix += xCrysEne[irow][jcol];
328  xE5x5MatrixN += xCrysEne[irow][jcol] + 108.5*randGauss.fire();
329 
330  if ( (irow>1) && (irow<5) ) {
331  if ( (jcol>1) && (jcol<5) ) {
332  xE3x3Matrix += xCrysEne[irow][jcol];
333  xE3x3MatrixN += xCrysEne[irow][jcol] +108.5*randGauss.fire();
334  }
335  }
336  }
337  }
338 
339  }
340 
341  if (!hcalOnly) {
342  // assert(theXTHC);
343  if ( theXTHC != 0 ) {
344  CaloG4Hit* xfirstHit =(*theXTHC)[0];
345  xIncidentEnergy = xfirstHit->getIncidentEnergy()/GeV;
346  }
347  }
348 
349  }// number of Hits > 0
350 
351  }
352 
353  int iEvt = (*evt)()->GetEventID();
354  if (iEvt < 10)
355  std::cout << " Event " << iEvt << std::endl;
356  else if ((iEvt < 100) && (iEvt%10 == 0))
357  std::cout << " Event " << iEvt << std::endl;
358  else if ((iEvt < 1000) && (iEvt%100 == 0))
359  std::cout << " Event " << iEvt << std::endl;
360  else if ((iEvt < 10000) && (iEvt%1000 == 0))
361  std::cout << " Event " << iEvt << std::endl;
362 
363  delete org;
364 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
const double GeV
Definition: MathUtil.h:16
void fillTransProf(float u, float v)
Geom::Theta< T > theta() const
double getIncidentEnergy() const
Definition: CaloG4Hit.h:65
std::map< int, float > energyInCrystals
HcalTB02Histo * histo
T sqrt(T t)
Definition: SSEVec.h:18
void fillAllTime(float v)
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::map< int, float > primaries
std::map< int, float > energyInScints
T min(T a, T b)
Definition: MathUtil.h:58
int getTrackID() const
Definition: CaloG4Hit.h:68
double sd
int getTimeSliceID() const
Definition: CaloG4Hit.h:71
double getEM() const
Definition: CaloG4Hit.h:59
std::vector< std::string > names
G4THitsCollection< CaloG4Hit > CaloG4HitCollection
void fillProfile(int ilayer, float value)
tuple cout
Definition: gather_cfg.py:145
uint32_t getUnitID() const
Definition: CaloG4Hit.h:69
for(const auto &isodef:isoDefs)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double getHadr() const
Definition: CaloG4Hit.h:62

Member Data Documentation

float HcalTB02Analysis::E5x5Matrix
private

Definition at line 79 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

float HcalTB02Analysis::E5x5MatrixN
private

Definition at line 80 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

float HcalTB02Analysis::E7x7Matrix
private

Definition at line 79 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

float HcalTB02Analysis::E7x7MatrixN
private

Definition at line 80 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

std::map<int,float> HcalTB02Analysis::energyInCrystals
private

Definition at line 75 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

std::map<int,float> HcalTB02Analysis::energyInScints
private

Definition at line 75 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

double HcalTB02Analysis::eta
private
std::string HcalTB02Analysis::fileNameTuple
private

Definition at line 71 of file HcalTB02Analysis.h.

bool HcalTB02Analysis::hcalOnly
private

Definition at line 70 of file HcalTB02Analysis.h.

Referenced by HcalTB02Analysis(), and update().

HcalTB02Histo* HcalTB02Analysis::histo
private

Definition at line 67 of file HcalTB02Analysis.h.

Referenced by HcalTB02Analysis(), update(), and ~HcalTB02Analysis().

double HcalTB02Analysis::incidentEnergy
private

Definition at line 78 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

int HcalTB02Analysis::maxTime
private

Definition at line 81 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

std::vector<std::string> HcalTB02Analysis::names
private

Definition at line 72 of file HcalTB02Analysis.h.

Referenced by HcalTB02Analysis(), and update().

int HcalTB02Analysis::particleType
private

Definition at line 77 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

double HcalTB02Analysis::phi
private

Definition at line 78 of file HcalTB02Analysis.h.

Referenced by Particle.Particle::__str__(), clear(), fillEvent(), and update().

double HcalTB02Analysis::pInit
private

Definition at line 78 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

std::map<int,float> HcalTB02Analysis::primaries
private

Definition at line 76 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

float HcalTB02Analysis::SEnergy
private

Definition at line 79 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

float HcalTB02Analysis::SEnergyN
private

Definition at line 80 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

float HcalTB02Analysis::xE3x3Matrix
private

Definition at line 84 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

float HcalTB02Analysis::xE3x3MatrixN
private

Definition at line 85 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

float HcalTB02Analysis::xE5x5Matrix
private

Definition at line 84 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

float HcalTB02Analysis::xE5x5MatrixN
private

Definition at line 85 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

double HcalTB02Analysis::xIncidentEnergy
private

Definition at line 82 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

float HcalTB02Analysis::xSEnergy
private

Definition at line 83 of file HcalTB02Analysis.h.

Referenced by clear(), fillEvent(), and update().

float HcalTB02Analysis::xSEnergyN
private

Definition at line 83 of file HcalTB02Analysis.h.

Referenced by clear(), and fillEvent().