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
HcalTB06Analysis Class Reference

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

Inheritance diagram for HcalTB06Analysis:
SimProducer Observer< const BeginOfRun * > Observer< const BeginOfEvent * > Observer< const EndOfEvent * > Observer< const G4Step * > SimWatcher

Public Member Functions

 HcalTB06Analysis (const edm::ParameterSet &p)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~HcalTB06Analysis ()
 
- 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 BeginOfRun * >
 Observer ()
 
void slotForUpdate (const BeginOfRun *iT)
 
virtual ~Observer ()
 
- 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 clear ()
 
void fillBuffer (const EndOfEvent *evt)
 
void fillEvent (PHcalTB06Info &)
 
void finalAnalysis ()
 
 HcalTB06Analysis (const HcalTB06Analysis &)
 
void init ()
 
const HcalTB06Analysisoperator= (const HcalTB06Analysis &)
 
void update (const BeginOfRun *run)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfEvent *evt)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *step)
 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

G4RotationMatrix * beamline_RM
 
double beamOffset
 
int count
 
std::vector< CaloHitecalHitCache
 
double eecals
 
double ehcals
 
double etaInit
 
double etots
 
int evNum
 
std::vector< CaloHithcalHitCache
 
std::vector< CaloHithcalHitLayer
 
HcalTB06Histohisto
 
int iceta
 
int icphi
 
std::vector< std::string > names
 
int nPrimary
 
int particleType
 
double phiInit
 
double pInit
 
bool pvFound
 
G4ThreeVector pvMomentum
 
G4ThreeVector pvPosition
 
int pvType
 
G4ThreeVector pvUVW
 
std::vector< double > secEkin
 
std::vector< G4ThreeVector > secMomentum
 
std::vector< int > secPartID
 
std::vector< int > secTrackID
 
std::vector< int > shortLivedSecondaries
 

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 44 of file HcalTB06Analysis.h.

Constructor & Destructor Documentation

HcalTB06Analysis::HcalTB06Analysis ( const edm::ParameterSet p)

Definition at line 49 of file HcalTB06Analysis.cc.

References beamline_RM, beamOffset, create_public_lumi_plots::exp, edm::ParameterSet::getParameter(), histo, iceta, icphi, init(), and names.

49  : histo(0) {
50 
51  edm::ParameterSet m_Anal = p.getParameter<edm::ParameterSet>("HcalTB06Analysis");
52  names = m_Anal.getParameter<std::vector<std::string> >("Names");
53  beamOffset =-m_Anal.getParameter<double>("BeamPosition")*cm;
54  double fMinEta = m_Anal.getParameter<double>("MinEta");
55  double fMaxEta = m_Anal.getParameter<double>("MaxEta");
56  double fMinPhi = m_Anal.getParameter<double>("MinPhi");
57  double fMaxPhi = m_Anal.getParameter<double>("MaxPhi");
58  double beamEta = (fMaxEta+fMinEta)/2.;
59  double beamPhi = (fMaxPhi+fMinPhi)/2.;
60  double beamThet= 2*atan(exp(-beamEta));
61  if (beamPhi < 0) beamPhi += twopi;
62  iceta = (int)(beamEta/0.087) + 1;
63  icphi = (int)(fabs(beamPhi)/0.087) + 5;
64  if (icphi > 72) icphi -= 73;
65 
66  produces<PHcalTB06Info>();
67 
68  beamline_RM = new G4RotationMatrix;
69  beamline_RM->rotateZ(-beamPhi);
70  beamline_RM->rotateY(-beamThet);
71 
72  edm::LogInfo("HcalTBSim") << "HcalTB06:: Initialised as observer of BeginOf"
73  << "Job/BeginOfRun/BeginOfEvent/G4Step/EndOfEvent"
74  << " with Parameter values:\n \tbeamOffset = "
75  << beamOffset << "\ticeta = " << iceta
76  << "\ticphi = " << icphi << "\n\tbeamline_RM = "
77  << *beamline_RM;
78 
79  init();
80 
81  histo = new HcalTB06Histo(m_Anal);
82 }
T getParameter(std::string const &) const
std::vector< std::string > names
HcalTB06Histo * histo
G4RotationMatrix * beamline_RM
HcalTB06Analysis::~HcalTB06Analysis ( )
virtual

Definition at line 84 of file HcalTB06Analysis.cc.

References count, and histo.

84  {
85 
86  edm::LogInfo("HcalTBSim") << "\n --------> Total number of selected entries"
87  << " : " << count << "\nPointers:: Histo " <<histo;
88  if (histo) {
89  delete histo;
90  histo = 0;
91  }
92 }
HcalTB06Histo * histo
HcalTB06Analysis::HcalTB06Analysis ( const HcalTB06Analysis )
private

Member Function Documentation

void HcalTB06Analysis::clear ( void  )
private

Definition at line 521 of file HcalTB06Analysis.cc.

References ecalHitCache, etaInit, hcalHitCache, nPrimary, particleType, phiInit, pInit, pvFound, pvMomentum, pvPosition, pvType, pvUVW, secEkin, secMomentum, secPartID, secTrackID, and shortLivedSecondaries.

Referenced by init(), and update().

521  {
522 
523  pvFound = false;
524  pvType =-2;
525  pvPosition = G4ThreeVector();
526  pvMomentum = G4ThreeVector();
527  pvUVW = G4ThreeVector();
528  secTrackID.clear();
529  secPartID.clear();
530  secMomentum.clear();
531  secEkin.clear();
532  shortLivedSecondaries.clear();
533 
534  ecalHitCache.erase(ecalHitCache.begin(), ecalHitCache.end());
535  hcalHitCache.erase(hcalHitCache.begin(), hcalHitCache.end());
536  nPrimary = particleType = 0;
537  pInit = etaInit = phiInit = 0;
538 }
G4ThreeVector pvMomentum
std::vector< CaloHit > ecalHitCache
G4ThreeVector pvPosition
std::vector< CaloHit > hcalHitCache
std::vector< G4ThreeVector > secMomentum
std::vector< int > shortLivedSecondaries
std::vector< double > secEkin
std::vector< int > secPartID
std::vector< int > secTrackID
G4ThreeVector pvUVW
void HcalTB06Analysis::fillBuffer ( const EndOfEvent evt)
private

Definition at line 266 of file HcalTB06Analysis.cc.

References TauDecayModes::dec, alignCSCRings::e, ecalHitCache, eta, etaInit, evNum, CaloG4Hit::getEnergyDeposit(), CaloG4Hit::getEntry(), CaloG4Hit::getTimeSlice(), CaloG4Hit::getTrackID(), CaloG4Hit::getUnitID(), GeV, hcalHitCache, i, j, relval_steps::k2, cmsBatch::log, LogDebug, bookConverter::max, min(), names, npart, nPrimary, AlCaHLTBitMon_ParallelJobs::p, particleType, phi, phiInit, pInit, funct::pow(), python.multivaluedict::sort(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), theta(), and cond::rpcobgas::time.

Referenced by update().

266  {
267 
268  std::vector<CaloHit> hhits;
269  int idHC, j;
270  CaloG4HitCollection* theHC;
271  std::map<int,float,std::less<int> > primaries;
272  double etot1=0, etot2=0;
273 
274  // Look for the Hit Collection of HCal
275  G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
276  std::string sdName = names[0];
277  idHC = G4SDManager::GetSDMpointer()->GetCollectionID(sdName);
278  theHC = (CaloG4HitCollection*) allHC->GetHC(idHC);
279  LogDebug("HcalTBSim") << "HcalTB06Analysis:: Hit Collection for " << sdName
280  << " of ID " << idHC << " is obtained at " << theHC;
281 
282  if (idHC >= 0 && theHC > 0) {
283  hhits.reserve(theHC->entries());
284  for (j = 0; j < theHC->entries(); j++) {
285  CaloG4Hit* aHit = (*theHC)[j];
286  double e = aHit->getEnergyDeposit()/GeV;
287  double time = aHit->getTimeSlice();
288  math::XYZPoint pos = aHit->getEntry();
289  unsigned int id = aHit->getUnitID();
290  double theta = pos.theta();
291  double eta = -log(tan(theta * 0.5));
292  double phi = pos.phi();
293  CaloHit hit(2,1,e,eta,phi,time,id);
294  hhits.push_back(hit);
295  primaries[aHit->getTrackID()]+= e;
296  etot1 += e;
297 #ifdef ddebug
298  LogDebug("HcalTBSim") << "HcalTB06Analysis:: Hcal Hit i/p " << j
299  << " ID 0x" << std::hex << id << std::dec
300  << " time " << std::setw(6) << time << " theta "
301  << std::setw(8) << theta << " eta " << std::setw(8)
302  << eta << " phi " << std::setw(8) << phi << " e "
303  << std::setw(8) << e;
304 #endif
305  }
306  }
307 
308  // Add hits in the same channel within same time slice
309  std::vector<CaloHit>::iterator itr;
310  int nHit = hhits.size();
311  std::vector<CaloHit*> hits(nHit);
312  for (j = 0, itr = hhits.begin(); itr != hhits.end(); j++, itr++) {
313  hits[j] = &hhits[j];
314  }
315  sort(hits.begin(),hits.end(),CaloHitIdMore());
316  std::vector<CaloHit*>::iterator k1, k2;
317  int nhit = 0;
318  for (k1 = hits.begin(); k1 != hits.end(); k1++) {
319  int det = (**k1).det();
320  int layer = (**k1).layer();
321  double ehit = (**k1).e();
322  double eta = (**k1).eta();
323  double phi = (**k1).phi();
324  double jitter = (**k1).t();
325  uint32_t unitID = (**k1).id();
326  int jump = 0;
327  for (k2 = k1+1; k2 != hits.end() && fabs(jitter-(**k2).t())<1 &&
328  unitID==(**k2).id(); k2++) {
329  ehit += (**k2).e();
330  jump++;
331  }
332  nhit++;
333  CaloHit hit(det, layer, ehit, eta, phi, jitter, unitID);
334  hcalHitCache.push_back(hit);
335  etot2 += ehit;
336  k1 += jump;
337 #ifdef ddebug
338  LogDebug("HcalTBSim") << "HcalTB06Analysis:: Hcal Hit store " << nhit
339  << " ID 0x" << std::hex << unitID << std::dec
340  << " time " << std::setw(6) << jitter << " eta "
341  << std::setw(8) << eta << " phi " << std::setw(8)
342  << phi << " e " << std::setw(8) << ehit;
343 #endif
344  }
345  LogDebug("HcalTBSim") << "HcalTB06Analysis:: Stores " << nhit << " HCal hits"
346  << " from " << nHit << " input hits E(Hcal) " << etot1
347  << " " << etot2;
348 
349  // Look for the Hit Collection of ECal
350  std::vector<CaloHit> ehits;
351  sdName= names[1];
352  idHC = G4SDManager::GetSDMpointer()->GetCollectionID(sdName);
353  theHC = (CaloG4HitCollection*) allHC->GetHC(idHC);
354  etot1 = etot2 = 0;
355  LogDebug("HcalTBSim") << "HcalTB06Analysis:: Hit Collection for " << sdName
356  << " of ID " << idHC << " is obtained at " << theHC;
357  if (idHC >= 0 && theHC > 0) {
358  ehits.reserve(theHC->entries());
359  for (j = 0; j < theHC->entries(); j++) {
360  CaloG4Hit* aHit = (*theHC)[j];
361  double e = aHit->getEnergyDeposit()/GeV;
362  double time = aHit->getTimeSlice();
363  math::XYZPoint pos = aHit->getEntry();
364  unsigned int id = aHit->getUnitID();
365  double theta = pos.theta();
366  double eta = -log(tan(theta * 0.5));
367  double phi = pos.phi();
368  if (e < 0 || e > 100000.) e = 0;
369  CaloHit hit(1,0,e,eta,phi,time,id);
370  ehits.push_back(hit);
371  primaries[aHit->getTrackID()]+= e;
372  etot1 += e;
373 #ifdef ddebug
374  LogDebug("HcalTBSim") << "HcalTB06Analysis:: Ecal Hit i/p " << j
375  << " ID 0x" << std::hex << id << std::dec
376  << " time " << std::setw(6) << time << " theta "
377  << std::setw(8) << theta << " eta " <<std::setw(8)
378  << eta << " phi " << std::setw(8) << phi << " e "
379  << std::setw(8) << e;
380 #endif
381  }
382  }
383 
384  // Add hits in the same channel within same time slice
385  nHit = ehits.size();
386  std::vector<CaloHit*> hite(nHit);
387  for (j = 0, itr = ehits.begin(); itr != ehits.end(); j++, itr++) {
388  hite[j] = &ehits[j];
389  }
390  sort(hite.begin(),hite.end(),CaloHitIdMore());
391  nhit = 0;
392  for (k1 = hite.begin(); k1 != hite.end(); k1++) {
393  int det = (**k1).det();
394  int layer = (**k1).layer();
395  double ehit = (**k1).e();
396  double eta = (**k1).eta();
397  double phi = (**k1).phi();
398  double jitter = (**k1).t();
399  uint32_t unitID = (**k1).id();
400  int jump = 0;
401  for (k2 = k1+1; k2 != hite.end() && fabs(jitter-(**k2).t())<1 &&
402  unitID==(**k2).id(); k2++) {
403  ehit += (**k2).e();
404  jump++;
405  }
406  nhit++;
407  CaloHit hit(det, layer, ehit, eta, phi, jitter, unitID);
408  ecalHitCache.push_back(hit);
409  etot2 += ehit;
410  k1 += jump;
411 #ifdef ddebug
412  LogDebug("HcalTBSim") << "HcalTB06Analysis:: Ecal Hit store " << nhit
413  << " ID 0x" << std::hex << unitID << std::dec
414  << " time " << std::setw(6) << jitter << " eta "
415  << std::setw(8) << eta << " phi " << std::setw(8)
416  << phi << " e " << std::setw(8) << ehit;
417 #endif
418  }
419  LogDebug("HcalTBSim") << "HcalTB06Analysis:: Stores " << nhit << " ECal hits"
420  << " from " << nHit << " input hits E(Ecal) " << etot1
421  << " " << etot2;
422 
423  // Find Primary info:
424  nPrimary = (int)(primaries.size());
425  int trackID = 0;
426  G4PrimaryParticle* thePrim=0;
427  int nvertex = (*evt)()->GetNumberOfPrimaryVertex();
428  LogDebug("HcalTBSim") << "HcalTB06Analysis:: Event has " << nvertex
429  << " verteices";
430  if (nvertex<=0)
431  edm::LogInfo("HcalTBSim") << "HcalTB06Analysis::EndOfEvent ERROR: no "
432  << "vertex found for event " << evNum;
433 
434  for (int i = 0 ; i<nvertex; i++) {
435  G4PrimaryVertex* avertex = (*evt)()->GetPrimaryVertex(i);
436  if (avertex == 0) {
437  edm::LogInfo("HcalTBSim") << "HcalTB06Analysis::EndOfEvent ERR: pointer "
438  << "to vertex = 0 for event " << evNum;
439  } else {
440  LogDebug("HcalTBSim") << "HcalTB06Analysis::Vertex number :" << i << " "
441  << avertex->GetPosition();
442  int npart = avertex->GetNumberOfParticle();
443  if (npart == 0)
444  edm::LogWarning("HcalTBSim") << "HcalTB06Analysis::End Of Event ERR: "
445  << "no primary!";
446  if (thePrim==0) thePrim=avertex->GetPrimary(trackID);
447  }
448  }
449 
450  if (thePrim != 0) {
451  double px = thePrim->GetPx();
452  double py = thePrim->GetPy();
453  double pz = thePrim->GetPz();
454  double p = std::sqrt(pow(px,2.)+pow(py,2.)+pow(pz,2.));
455  pInit = p/GeV;
456  if (p==0)
457  edm::LogWarning("HcalTBSim") << "HcalTB06Analysis:: EndOfEvent ERR: "
458  << "primary has p=0 ";
459  else {
460  double costheta = pz/p;
461  double theta = acos(std::min(std::max(costheta,-1.),1.));
462  etaInit = -log(tan(theta/2));
463  if (px != 0 || py != 0) phiInit = atan2(py,px);
464  }
465  particleType = thePrim->GetPDGcode();
466  } else
467  edm::LogWarning("HcalTBSim") << "HcalTB06Analysis::EndOfEvent ERR: could "
468  << "not find primary";
469 
470 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
const double GeV
Definition: MathUtil.h:16
std::vector< std::string > names
std::vector< CaloHit > ecalHitCache
Geom::Theta< T > theta() const
double npart
Definition: HydjetWrapper.h:49
T sqrt(T t)
Definition: SSEVec.h:48
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
int j
Definition: DBlmapReader.cc:9
T min(T a, T b)
Definition: MathUtil.h:58
int getTrackID() const
Definition: CaloG4Hit.h:68
std::vector< CaloHit > hcalHitCache
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
G4THitsCollection< CaloG4Hit > CaloG4HitCollection
double getTimeSlice() const
Definition: CaloG4Hit.h:70
math::XYZPoint getEntry() const
Definition: CaloG4Hit.h:50
uint32_t getUnitID() const
Definition: CaloG4Hit.h:69
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double getEnergyDeposit() const
Definition: CaloG4Hit.h:81
tuple log
Definition: cmsBatch.py:341
void HcalTB06Analysis::fillEvent ( PHcalTB06Info product)
private

Definition at line 493 of file HcalTB06Analysis.cc.

References ecalHitCache, eecals, ehcals, etaInit, etots, evNum, hcalHitCache, i, nPrimary, particleType, phiInit, pInit, pvMomentum, pvPosition, pvType, pvUVW, PHcalTB06Info::saveHit(), secEkin, secMomentum, secPartID, secTrackID, PHcalTB06Info::setEdep(), PHcalTB06Info::setPrimary(), PHcalTB06Info::setVtxPrim(), PHcalTB06Info::setVtxSec(), x, y, and z.

Referenced by produce().

493  {
494 
495  //Beam Information
497 
498  // Total Energy
499  product.setEdep(etots, eecals, ehcals);
500 
501  //Energy deposits in the crystals and towers
502  for (unsigned int i=0; i<hcalHitCache.size(); i++)
503  product.saveHit(hcalHitCache[i].id(), hcalHitCache[i].eta(),
504  hcalHitCache[i].phi(), hcalHitCache[i].e(),
505  hcalHitCache[i].t());
506  for (unsigned int i=0; i<ecalHitCache.size(); i++)
507  product.saveHit(ecalHitCache[i].id(), ecalHitCache[i].eta(),
508  ecalHitCache[i].phi(), ecalHitCache[i].e(),
509  ecalHitCache[i].t());
510 
511  //Vertex associated quantities
512  product.setVtxPrim(evNum, pvType, pvPosition.x(), pvPosition.y(),
513  pvPosition.z(), pvUVW.x(), pvUVW.y(), pvUVW.z(),
514  pvMomentum.x(), pvMomentum.y(), pvMomentum.z());
515  for (unsigned int i = 0; i < secTrackID.size(); i++) {
516  product.setVtxSec(secTrackID[i], secPartID[i], secMomentum[i].x(),
517  secMomentum[i].y(), secMomentum[i].z(), secEkin[i]);
518  }
519 }
G4ThreeVector pvMomentum
int i
Definition: DBlmapReader.cc:9
std::vector< CaloHit > ecalHitCache
void setEdep(double simtot, double sime, double simh)
void setVtxPrim(int evNum, int type, double x, double y, double z, double u, double v, double w, double px, double py, double pz)
G4ThreeVector pvPosition
void setVtxSec(int id, int pdg, double px, double py, double pz, double ek)
void saveHit(unsigned int det, double eta, double phi, double e, double t)
std::vector< CaloHit > hcalHitCache
std::vector< G4ThreeVector > secMomentum
void setPrimary(int primary, int id, double energy, double eta, double phi)
std::vector< double > secEkin
std::vector< int > secPartID
std::vector< int > secTrackID
G4ThreeVector pvUVW
void HcalTB06Analysis::finalAnalysis ( )
private

Definition at line 472 of file HcalTB06Analysis.cc.

References ecalHitCache, eecals, ehcals, etaInit, etots, HcalTB06Histo::fillEdep(), HcalTB06Histo::fillPrimary(), hcalHitCache, histo, i, LogDebug, phiInit, and pInit.

Referenced by update().

472  {
473 
474  //Beam Information
476 
477  // Total Energy
478  eecals = ehcals = 0.;
479  for (unsigned int i=0; i<hcalHitCache.size(); i++) {
480  ehcals += hcalHitCache[i].e();
481  }
482  for (unsigned int i=0; i<ecalHitCache.size(); i++) {
483  eecals += ecalHitCache[i].e();
484  }
485  etots = eecals + ehcals;
486  LogDebug("HcalTBSim") << "HcalTB06Analysis:: Energy deposit at Sim Level "
487  << "(Total) " << etots << " (ECal) " << eecals
488  << " (HCal) " << ehcals;
489  histo->fillEdep(etots, eecals, ehcals);
490 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< CaloHit > ecalHitCache
void fillEdep(double etots, double eecals, double ehcals)
HcalTB06Histo * histo
std::vector< CaloHit > hcalHitCache
void fillPrimary(double energy, double eta, double phi)
void HcalTB06Analysis::init ( void  )
private

Definition at line 105 of file HcalTB06Analysis.cc.

References clear(), count, and evNum.

Referenced by HcalTB06Analysis().

105  {
106 
107  // counter
108  count = 0;
109  evNum = 0;
110  clear();
111 }
const HcalTB06Analysis& HcalTB06Analysis::operator= ( const HcalTB06Analysis )
private
void HcalTB06Analysis::produce ( edm::Event e,
const edm::EventSetup  
)
virtual

Implements SimProducer.

Definition at line 98 of file HcalTB06Analysis.cc.

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

98  {
99 
100  std::auto_ptr<PHcalTB06Info> product(new PHcalTB06Info);
101  fillEvent(*product);
102  e.put(product);
103 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
void fillEvent(PHcalTB06Info &)
void HcalTB06Analysis::update ( const BeginOfRun )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 113 of file HcalTB06Analysis.cc.

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().

113  {
114 
115  int irun = (*run)()->GetRunID();
116  edm::LogInfo("HcalTBSim") <<" =====> Begin of Run = " << irun;
117 
118 }
void HcalTB06Analysis::update ( const BeginOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 120 of file HcalTB06Analysis.cc.

References clear(), and evNum.

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().

120  {
121 
122  evNum = (*evt) ()->GetEventID ();
123  clear();
124  edm::LogInfo("HcalTBSim") << "HcalTB06Analysis: =====> Begin of event = "
125  << evNum;
126 }
void HcalTB06Analysis::update ( const G4Step *  )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 128 of file HcalTB06Analysis.cc.

References LogDebug, NULL, sysUtil::pid, position, pvFound, pvMomentum, pvPosition, pvType, pvUVW, secEkin, secMomentum, secPartID, secTrackID, and shortLivedSecondaries.

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().

128  {
129 
130  if (aStep != NULL) {
131  //Get Step properties
132  G4ThreeVector thePreStepPoint = aStep->GetPreStepPoint()->GetPosition();
133  G4ThreeVector thePostStepPoint;
134 
135  // Get Tracks properties
136  G4Track* aTrack = aStep->GetTrack();
137  int trackID = aTrack->GetTrackID();
138  int parentID = aTrack->GetParentID();
139  G4ThreeVector position = aTrack->GetPosition();
140  G4ThreeVector momentum = aTrack->GetMomentum();
141  G4String partType = aTrack->GetDefinition()->GetParticleType();
142  G4String partSubType = aTrack->GetDefinition()->GetParticleSubType();
143  int partPDGEncoding = aTrack->GetDefinition()->GetPDGEncoding();
144 #ifdef ddebug
145  bool isPDGStable = aTrack->GetDefinition()->GetPDGStable();
146 #endif
147  double pDGlifetime = aTrack->GetDefinition()->GetPDGLifeTime();
148  double gammaFactor = aStep->GetPreStepPoint()->GetGamma();
149 
150  if (!pvFound) { //search for v1
151  double stepDeltaEnergy = aStep->GetDeltaEnergy ();
152  double kinEnergy = aTrack->GetKineticEnergy ();
153 
154  // look for DeltaE > 10% kinEnergy of particle, or particle death - Ek=0
155  if (trackID == 1 && parentID == 0 &&
156  ((kinEnergy == 0.) || (fabs (stepDeltaEnergy / kinEnergy) > 0.1))) {
157  pvType = -1;
158  if (kinEnergy == 0.) {
159  pvType = 0;
160  } else {
161  if (fabs (stepDeltaEnergy / kinEnergy) > 0.1) pvType = 1;
162  }
163  pvFound = true;
165  pvMomentum = momentum;
166  // Rotated coord.system:
167  pvUVW = (*beamline_RM)*(pvPosition);
168 
169  //Volume name requires some checks:
170  G4String thePostPVname = "NoName";
171  G4StepPoint * thePostPoint = aStep->GetPostStepPoint ();
172  if (thePostPoint) {
173  thePostStepPoint = thePostPoint->GetPosition();
174  G4VPhysicalVolume * thePostPV = thePostPoint->GetPhysicalVolume ();
175  if (thePostPV) thePostPVname = thePostPV->GetName ();
176  }
177 #ifdef ddebug
178  LogDebug("HcalTBSim") << "HcalTB06Analysis:: V1 found at: "
179  << thePostStepPoint << " G4VPhysicalVolume: "
180  << thePostPVname;
181 #endif
182  LogDebug("HcalTBSim") << "HcalTB06Analysis::fill_v1Pos: Primary Track "
183  << "momentum: " << pvMomentum << " psoition "
184  << pvPosition << " u/v/w " << pvUVW;
185  }
186  } else {
187  // watch for secondaries originating @v1, including the surviving primary
188  if ((trackID != 1 && parentID == 1 &&
189  (aTrack->GetCurrentStepNumber () == 1) &&
190  (thePreStepPoint == pvPosition)) ||
191  (trackID == 1 && thePreStepPoint == pvPosition)) {
192 #ifdef ddebug
193  LogDebug("HcalTBSim") << "HcalTB06Analysis::A secondary... PDG:"
194  << partPDGEncoding << " TrackID:" << trackID
195  << " ParentID:" << parentID << " stable: "
196  << isPDGStable << " Tau: " << pDGlifetime
197  << " cTauGamma="
198  << c_light*pDGlifetime*gammaFactor*1000.
199  << "um" << " GammaFactor: " << gammaFactor;
200 #endif
201  secTrackID.push_back(trackID);
202  secPartID.push_back(partPDGEncoding);
203  secMomentum.push_back(momentum);
204  secEkin.push_back(aTrack->GetKineticEnergy());
205 
206  // Check for short-lived secondaries: cTauGamma<100um
207  double ctaugamma_um = c_light * pDGlifetime * gammaFactor * 1000.;
208  if ((ctaugamma_um>0.) && (ctaugamma_um<100.)) {//short-lived secondary
209  shortLivedSecondaries.push_back(trackID);
210  } else {//normal secondary - enter into the V1-calorimetric tree
211  // histos->fill_v1cSec (aTrack);
212  }
213  }
214  // Also watch for tertiary particles coming from
215  // short-lived secondaries from V1
216  if (aTrack->GetCurrentStepNumber() == 1) {
217  if (shortLivedSecondaries.size() > 0) {
218  int pid = parentID;
219  std::vector<int>::iterator pos1= shortLivedSecondaries.begin();
220  std::vector<int>::iterator pos2 = shortLivedSecondaries.end();
221  std::vector<int>::iterator pos;
222  for (pos = pos1; pos != pos2; pos++) {
223  if (*pos == pid) {//ParentID is on the list of short-lived
224  // secondary
225 #ifdef ddebug
226  LogDebug("HcalTBSim") << "HcalTB06Analysis:: A tertiary... PDG:"
227  << partPDGEncoding << " TrackID:" <<trackID
228  << " ParentID:" << parentID << " stable: "
229  << isPDGStable << " Tau: " << pDGlifetime
230  << " cTauGamma="
231  << c_light*pDGlifetime*gammaFactor*1000.
232  << "um GammaFactor: " << gammaFactor;
233 #endif
234  }
235  }
236  }
237  }
238  }
239  }
240 }
#define LogDebug(id)
G4ThreeVector pvMomentum
#define NULL
Definition: scimark2.h:8
G4ThreeVector pvPosition
std::vector< G4ThreeVector > secMomentum
std::vector< int > shortLivedSecondaries
tuple pid
Definition: sysUtil.py:22
std::vector< double > secEkin
static int position[264][3]
Definition: ReadPGInfo.cc:509
std::vector< int > secPartID
std::vector< int > secTrackID
G4ThreeVector pvUVW
void HcalTB06Analysis::update ( const EndOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent * >.

Definition at line 242 of file HcalTB06Analysis.cc.

References count, fillBuffer(), finalAnalysis(), and LogDebug.

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().

242  {
243 
244  count++;
245 
246  //fill the buffer
247  LogDebug("HcalTBSim") << "HcalTB06Analysis::Fill event "
248  << (*evt)()->GetEventID();
249  fillBuffer (evt);
250 
251  //Final Analysis
252  LogDebug("HcalTBSim") << "HcalTB06Analysis::Final analysis";
253  finalAnalysis();
254 
255  int iEvt = (*evt)()->GetEventID();
256  if (iEvt < 10)
257  edm::LogInfo("HcalTBSim") << "HcalTB06Analysis:: Event " << iEvt;
258  else if ((iEvt < 100) && (iEvt%10 == 0))
259  edm::LogInfo("HcalTBSim") << "HcalTB06Analysis:: Event " << iEvt;
260  else if ((iEvt < 1000) && (iEvt%100 == 0))
261  edm::LogInfo("HcalTBSim") << "HcalTB06Analysis:: Event " << iEvt;
262  else if ((iEvt < 10000) && (iEvt%1000 == 0))
263  edm::LogInfo("HcalTBSim") << "HcalTB06Analysis:: Event " << iEvt;
264 }
#define LogDebug(id)
void fillBuffer(const EndOfEvent *evt)

Member Data Documentation

G4RotationMatrix* HcalTB06Analysis::beamline_RM
private

Definition at line 85 of file HcalTB06Analysis.h.

Referenced by HcalTB06Analysis().

double HcalTB06Analysis::beamOffset
private

Definition at line 82 of file HcalTB06Analysis.h.

Referenced by HcalTB06Analysis().

int HcalTB06Analysis::count
private

Definition at line 88 of file HcalTB06Analysis.h.

Referenced by init(), update(), and ~HcalTB06Analysis().

std::vector<CaloHit> HcalTB06Analysis::ecalHitCache
private

Definition at line 93 of file HcalTB06Analysis.h.

Referenced by clear(), fillBuffer(), fillEvent(), and finalAnalysis().

double HcalTB06Analysis::eecals
private

Definition at line 95 of file HcalTB06Analysis.h.

Referenced by fillEvent(), and finalAnalysis().

double HcalTB06Analysis::ehcals
private

Definition at line 95 of file HcalTB06Analysis.h.

Referenced by fillEvent(), and finalAnalysis().

double HcalTB06Analysis::etaInit
private

Definition at line 92 of file HcalTB06Analysis.h.

Referenced by clear(), fillBuffer(), fillEvent(), and finalAnalysis().

double HcalTB06Analysis::etots
private

Definition at line 95 of file HcalTB06Analysis.h.

Referenced by fillEvent(), and finalAnalysis().

int HcalTB06Analysis::evNum
private

Definition at line 98 of file HcalTB06Analysis.h.

Referenced by fillBuffer(), fillEvent(), init(), and update().

std::vector<CaloHit> HcalTB06Analysis::hcalHitCache
private

Definition at line 94 of file HcalTB06Analysis.h.

Referenced by clear(), fillBuffer(), fillEvent(), and finalAnalysis().

std::vector<CaloHit> HcalTB06Analysis::hcalHitLayer
private

Definition at line 94 of file HcalTB06Analysis.h.

HcalTB06Histo* HcalTB06Analysis::histo
private

Definition at line 79 of file HcalTB06Analysis.h.

Referenced by finalAnalysis(), HcalTB06Analysis(), and ~HcalTB06Analysis().

int HcalTB06Analysis::iceta
private

Definition at line 83 of file HcalTB06Analysis.h.

Referenced by HcalTB06Analysis().

int HcalTB06Analysis::icphi
private

Definition at line 83 of file HcalTB06Analysis.h.

Referenced by HcalTB06Analysis().

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

Definition at line 84 of file HcalTB06Analysis.h.

Referenced by fillBuffer(), and HcalTB06Analysis().

int HcalTB06Analysis::nPrimary
private

Definition at line 91 of file HcalTB06Analysis.h.

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

int HcalTB06Analysis::particleType
private

Definition at line 91 of file HcalTB06Analysis.h.

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

double HcalTB06Analysis::phiInit
private

Definition at line 92 of file HcalTB06Analysis.h.

Referenced by clear(), fillBuffer(), fillEvent(), and finalAnalysis().

double HcalTB06Analysis::pInit
private

Definition at line 92 of file HcalTB06Analysis.h.

Referenced by clear(), fillBuffer(), fillEvent(), and finalAnalysis().

bool HcalTB06Analysis::pvFound
private

Definition at line 97 of file HcalTB06Analysis.h.

Referenced by clear(), and update().

G4ThreeVector HcalTB06Analysis::pvMomentum
private

Definition at line 99 of file HcalTB06Analysis.h.

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

G4ThreeVector HcalTB06Analysis::pvPosition
private

Definition at line 99 of file HcalTB06Analysis.h.

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

int HcalTB06Analysis::pvType
private

Definition at line 98 of file HcalTB06Analysis.h.

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

G4ThreeVector HcalTB06Analysis::pvUVW
private

Definition at line 99 of file HcalTB06Analysis.h.

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

std::vector<double> HcalTB06Analysis::secEkin
private

Definition at line 102 of file HcalTB06Analysis.h.

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

std::vector<G4ThreeVector> HcalTB06Analysis::secMomentum
private

Definition at line 101 of file HcalTB06Analysis.h.

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

std::vector<int> HcalTB06Analysis::secPartID
private

Definition at line 100 of file HcalTB06Analysis.h.

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

std::vector<int> HcalTB06Analysis::secTrackID
private

Definition at line 100 of file HcalTB06Analysis.h.

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

std::vector<int> HcalTB06Analysis::shortLivedSecondaries
private

Definition at line 103 of file HcalTB06Analysis.h.

Referenced by clear(), and update().