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::EDProducer &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 47 of file HcalTB06Analysis.cc.

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

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

Definition at line 82 of file HcalTB06Analysis.cc.

References count, and histo.

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

Member Function Documentation

void HcalTB06Analysis::clear ( void  )
private

Definition at line 519 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().

519  {
520 
521  pvFound = false;
522  pvType =-2;
523  pvPosition = G4ThreeVector();
524  pvMomentum = G4ThreeVector();
525  pvUVW = G4ThreeVector();
526  secTrackID.clear();
527  secPartID.clear();
528  secMomentum.clear();
529  secEkin.clear();
530  shortLivedSecondaries.clear();
531 
532  ecalHitCache.erase(ecalHitCache.begin(), ecalHitCache.end());
533  hcalHitCache.erase(hcalHitCache.begin(), hcalHitCache.end());
534  nPrimary = particleType = 0;
535  pInit = etaInit = phiInit = 0;
536 }
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 264 of file HcalTB06Analysis.cc.

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

Referenced by update().

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

Definition at line 491 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, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by produce().

491  {
492 
493  //Beam Information
495 
496  // Total Energy
497  product.setEdep(etots, eecals, ehcals);
498 
499  //Energy deposits in the crystals and towers
500  for (unsigned int i=0; i<hcalHitCache.size(); i++)
501  product.saveHit(hcalHitCache[i].id(), hcalHitCache[i].eta(),
502  hcalHitCache[i].phi(), hcalHitCache[i].e(),
503  hcalHitCache[i].t());
504  for (unsigned int i=0; i<ecalHitCache.size(); i++)
505  product.saveHit(ecalHitCache[i].id(), ecalHitCache[i].eta(),
506  ecalHitCache[i].phi(), ecalHitCache[i].e(),
507  ecalHitCache[i].t());
508 
509  //Vertex associated quantities
510  product.setVtxPrim(evNum, pvType, pvPosition.x(), pvPosition.y(),
511  pvPosition.z(), pvUVW.x(), pvUVW.y(), pvUVW.z(),
512  pvMomentum.x(), pvMomentum.y(), pvMomentum.z());
513  for (unsigned int i = 0; i < secTrackID.size(); i++) {
514  product.setVtxSec(secTrackID[i], secPartID[i], secMomentum[i].x(),
515  secMomentum[i].y(), secMomentum[i].z(), secEkin[i]);
516  }
517 }
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)
double double double z
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
Definition: DDAxes.h:10
std::vector< int > secPartID
std::vector< int > secTrackID
G4ThreeVector pvUVW
void HcalTB06Analysis::finalAnalysis ( )
private

Definition at line 470 of file HcalTB06Analysis.cc.

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

Referenced by update().

470  {
471 
472  //Beam Information
474 
475  // Total Energy
476  eecals = ehcals = 0.;
477  for (unsigned int i=0; i<hcalHitCache.size(); i++) {
478  ehcals += hcalHitCache[i].e();
479  }
480  for (unsigned int i=0; i<ecalHitCache.size(); i++) {
481  eecals += ecalHitCache[i].e();
482  }
483  etots = eecals + ehcals;
484  LogDebug("HcalTBSim") << "HcalTB06Analysis:: Energy deposit at Sim Level "
485  << "(Total) " << etots << " (ECal) " << eecals
486  << " (HCal) " << ehcals;
487  histo->fillEdep(etots, eecals, ehcals);
488 }
#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 103 of file HcalTB06Analysis.cc.

References clear(), count, and evNum.

Referenced by HcalTB06Analysis().

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

Implements SimProducer.

Definition at line 96 of file HcalTB06Analysis.cc.

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

96  {
97 
98  std::auto_ptr<PHcalTB06Info> product(new PHcalTB06Info);
99  fillEvent(*product);
100  e.put(product);
101 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
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 111 of file HcalTB06Analysis.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().

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

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 118 of file HcalTB06Analysis.cc.

References clear(), and evNum.

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

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

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 126 of file HcalTB06Analysis.cc.

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

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

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

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

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

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