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 | Protected Attributes | Private Member Functions | Private Attributes
FastTimerSD Class Reference

#include <FastTimerSD.h>

Inheritance diagram for FastTimerSD:
SensitiveTkDetector Observer< const BeginOfRun * > Observer< const BeginOfEvent * > Observer< const EndOfEvent * > SensitiveDetector

Public Member Functions

virtual void clear ()
 
virtual void DrawAll ()
 
virtual void EndOfEvent (G4HCofThisEvent *eventHC)
 
 FastTimerSD (std::string, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
void fillHits (edm::PSimHitContainer &, std::string use)
 
virtual double getEnergyDeposit (G4Step *step)
 
std::vector< std::string > getNames ()
 
virtual void Initialize (G4HCofThisEvent *HCE)
 
virtual void PrintAll ()
 
virtual bool ProcessHits (G4Step *, G4TouchableHistory *)
 
virtual uint32_t setDetUnitId (G4Step *)
 
virtual ~FastTimerSD ()
 
- Public Member Functions inherited from SensitiveTkDetector
 SensitiveTkDetector (std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
virtual void AssignSD (const std::string &vname)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point)
 
Local3DPoint FinalStepPosition (G4Step *s, coordinates)
 
Local3DPoint InitialStepPosition (G4Step *s, coordinates)
 
std::string nameOfSD ()
 
void NaNTrap (G4Step *step)
 
void Register ()
 
 SensitiveDetector (std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
virtual ~SensitiveDetector ()
 
- 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 ()
 

Protected Attributes

float edepositEM
 
float edepositHAD
 
G4int emPDG
 
G4int epPDG
 
G4int gammaPDG
 

Private Member Functions

virtual void clearHits ()
 
void CreateNewHit ()
 
void GetStepInfo (G4Step *aStep)
 
G4bool HitExists ()
 
void ResetForNewPrimary ()
 
G4ThreeVector SetToLocal (const G4ThreeVector &global)
 
G4ThreeVector SetToLocalExit (const G4ThreeVector &globalPoint)
 
void StoreHit (BscG4Hit *)
 
void Summarize ()
 
void update (const BeginOfRun *)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfEvent *)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const ::EndOfEvent *)
 
void UpdateHit ()
 

Private Attributes

BscG4HitcurrentHit
 
G4VPhysicalVolume * currentPV
 
float edeposit
 
float Eloss
 
G4ThreeVector entrancePoint
 
int eventno
 
G4ThreeVector exitPoint
 
FastTimeDDDConstantsftcons
 
G4int hcID
 
G4ThreeVector hitPoint
 
G4ThreeVector hitPointExit
 
G4ThreeVector hitPointLocal
 
G4ThreeVector hitPointLocalExit
 
float incidentEnergy
 
std::string name
 
float Pabs
 
int ParentId
 
short ParticleType
 
float PhiAtEntry
 
G4StepPoint * postStepPoint
 
G4StepPoint * preStepPoint
 
uint32_t previousUnitID
 
G4int primaryID
 
G4int primID
 
TrackingSlaveSDslave
 
G4ThreeVector theEntryPoint
 
G4ThreeVector theExitPoint
 
BscG4HitCollectiontheHC
 
const SimTrackManagertheManager
 
float ThetaAtEntry
 
G4Track * theTrack
 
float Tof
 
G4int tsID
 
G4double tSlice
 
G4int tSliceID
 
int type
 
uint32_t unitID
 
float Vx
 
float Vy
 
float Vz
 
float X
 
float Y
 
float Z
 

Additional Inherited Members

- Public Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- Protected Member Functions inherited from Observer< const EndOfEvent * >
virtual void update (const EndOfEvent *)=0
 This routine will be called when the appropriate signal arrives. More...
 

Detailed Description

Definition at line 34 of file FastTimerSD.h.

Constructor & Destructor Documentation

FastTimerSD::FastTimerSD ( std::string  name,
const DDCompactView cpv,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 31 of file FastTimerSD.cc.

References SensitiveDetector::AssignSD(), ecaldqm::collectionName, ftcons, edm::ParameterSet::getParameter(), FastTimeDDDConstants::getType(), edm::ParameterSet::getUntrackedParameter(), LogDebug, SensitiveDetectorCatalog::logicalNames(), SensitiveDetector::Register(), and slave.

34  :
35  SensitiveTkDetector(name, cpv, clg, p), ftcons(0), name(name),
36  hcID(-1), theHC(0), theManager(manager), currentHit(0), theTrack(0),
38  postStepPoint(0), eventno(0){
39 
40  //Add FastTimer Sentitive Detector Name
41  collectionName.insert(name);
42 
43 
44  //Parameters
45  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("FastTimerSD");
46  int verbn = m_p.getUntrackedParameter<int>("Verbosity");
47  //int verbn = 1;
48 
49  SetVerboseLevel(verbn);
50 #ifdef DebugLog
51  LogDebug("FastTimerSim")
52  << "*******************************************************\n"
53  << "* *\n"
54  << "* Constructing a FastTimerSD with name " << name << "\n"
55  << "* *\n"
56  << "*******************************************************";
57 #endif
58 
59  slave = new TrackingSlaveSD(name);
60 
61  //
62  // attach detectors (LogicalVolumes)
63  //
64  std::vector<std::string> lvNames = clg.logicalNames(name);
65 
66  this->Register();
67 
68  for (std::vector<std::string>::iterator it=lvNames.begin();
69  it !=lvNames.end(); it++) {
70  this->AssignSD(*it);
71  edm::LogInfo("FastTimerSim") << "FastTimerSD : Assigns SD to LV " << (*it);
72  }
73 
74  ftcons = new FastTimeDDDConstants(cpv) ;
75  type = ftcons->getType();
76 
77  edm::LogInfo("FastTimerSim") << "FastTimerSD: Instantiation completed";
78 }
#define LogDebug(id)
std::string name
Definition: FastTimerSD.h:92
type
Definition: HCALResponse.h:21
T getUntrackedParameter(std::string const &, T const &) const
BscG4Hit * currentHit
Definition: FastTimerSD.h:98
uint32_t unitID
Definition: FastTimerSD.h:101
const std::vector< std::string > & logicalNames(const std::string &readoutName) const
virtual void AssignSD(const std::string &vname)
TrackingSlaveSD * slave
Definition: FastTimerSD.h:82
std::string const collectionName[nCollections]
Definition: Collections.h:45
G4StepPoint * postStepPoint
Definition: FastTimerSD.h:106
const SimTrackManager * theManager
Definition: FastTimerSD.h:95
G4VPhysicalVolume * currentPV
Definition: FastTimerSD.h:100
FastTimeDDDConstants * ftcons
Definition: FastTimerSD.h:83
G4Track * theTrack
Definition: FastTimerSD.h:99
BscG4HitCollection * theHC
Definition: FastTimerSD.h:94
G4StepPoint * preStepPoint
Definition: FastTimerSD.h:105
SensitiveTkDetector(std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
uint32_t previousUnitID
Definition: FastTimerSD.h:101
G4int hcID
Definition: FastTimerSD.h:93
FastTimerSD::~FastTimerSD ( )
virtual

Definition at line 81 of file FastTimerSD.cc.

References ftcons, and slave.

81  {
82 
83  if (slave) delete slave;
84  if (ftcons) delete ftcons;
85 }
TrackingSlaveSD * slave
Definition: FastTimerSD.h:82
FastTimeDDDConstants * ftcons
Definition: FastTimerSD.h:83

Member Function Documentation

void FastTimerSD::clear ( void  )
virtual

Definition at line 382 of file FastTimerSD.cc.

382 {}
void FastTimerSD::clearHits ( )
privatevirtual

Implements SensitiveDetector.

Definition at line 418 of file FastTimerSD.cc.

References TrackingSlaveSD::Initialize(), and slave.

Referenced by update().

418  {
419  slave->Initialize();
420 }
TrackingSlaveSD * slave
Definition: FastTimerSD.h:82
virtual void Initialize()
void FastTimerSD::CreateNewHit ( )
private

Definition at line 257 of file FastTimerSD.cc.

References currentHit, currentPV, Eloss, hitPoint, hitPointLocal, hitPointLocalExit, incidentEnergy, LogDebug, NULL, Pabs, ParentId, ParticleType, PhiAtEntry, primaryID, BscG4Hit::setEnergyLoss(), BscG4Hit::setEntry(), BscG4Hit::setEntryLocalP(), BscG4Hit::setExitLocalP(), BscG4Hit::setIncidentEnergy(), BscG4Hit::setPabs(), BscG4Hit::setParentId(), BscG4Hit::setParticleType(), BscG4Hit::setPhiAtEntry(), BscG4Hit::setThetaAtEntry(), BscG4Hit::setTimeSlice(), BscG4Hit::setTof(), BscG4Hit::setTrackID(), BscG4Hit::setUnitID(), BscG4Hit::setVx(), BscG4Hit::setVy(), BscG4Hit::setVz(), BscG4Hit::setX(), BscG4Hit::setY(), BscG4Hit::setZ(), StoreHit(), ThetaAtEntry, theTrack, Tof, tSlice, tSliceID, unitID, UpdateHit(), Vx, Vy, Vz, X, Y, and Z.

Referenced by ProcessHits().

257  {
258 
259 #ifdef DebugLog
260  LogDebug("FastTimerSim") << "FastTimerSD CreateNewHit for"
261  << " PV " << currentPV->GetName()
262  << " PVid = " << currentPV->GetCopyNo()
263  << " Unit " << unitID <<std::endl;
264  LogDebug("FastTimerSim") << " primary " << primaryID
265  << " time slice " << tSliceID
266  << " For Track " << theTrack->GetTrackID()
267  << " which is a " << theTrack->GetDefinition()->GetParticleName();
268 
269  if (theTrack->GetTrackID()==1) {
270  LogDebug("FastTimerSim") << " of energy " << theTrack->GetTotalEnergy();
271  } else {
272  LogDebug("FastTimerSim") << " daughter of part. " << theTrack->GetParentID();
273  }
274 
275  LogDebug("FastTimerSim") << " and created by " ;
276  if (theTrack->GetCreatorProcess()!=NULL)
277  LogDebug("FastTimerSim") << theTrack->GetCreatorProcess()->GetProcessName() ;
278  else
279  LogDebug("FastTimerSim") << "NO process";
280  LogDebug("FastTimerSim") << std::endl;
281 #endif
282 
283  currentHit = new BscG4Hit;
288 
295 
297 
300 
302  currentHit->setVx(Vx);
303  currentHit->setVy(Vy);
304  currentHit->setVz(Vz);
305 
306  currentHit->setX(X);
307  currentHit->setY(Y);
308  currentHit->setZ(Z);
309 
310  UpdateHit();
311 
313 }
#define LogDebug(id)
G4ThreeVector hitPoint
Definition: FastTimerSD.h:109
void setTof(float e)
Definition: BSCG4Hit.cc:154
void setEntry(const G4ThreeVector &xyz)
Definition: BSCG4Hit.cc:116
void setVx(float p)
Definition: BSCG4Hit.cc:177
G4int tSliceID
Definition: FastTimerSD.h:102
void setTrackID(int i)
Definition: BSCG4Hit.cc:134
void setEnergyLoss(float e)
Definition: BSCG4Hit.cc:155
void setParentId(int p)
Definition: BSCG4Hit.cc:174
void UpdateHit()
Definition: FastTimerSD.cc:316
#define NULL
Definition: scimark2.h:8
BscG4Hit * currentHit
Definition: FastTimerSD.h:98
void setUnitID(unsigned int i)
Definition: BSCG4Hit.cc:137
uint32_t unitID
Definition: FastTimerSD.h:101
void setVy(float p)
Definition: BSCG4Hit.cc:180
void setY(float t)
Definition: BSCG4Hit.cc:168
short ParticleType
Definition: FastTimerSD.h:115
void setThetaAtEntry(float t)
Definition: BSCG4Hit.cc:161
void setX(float t)
Definition: BSCG4Hit.cc:165
void setPabs(float e)
Definition: BSCG4Hit.cc:153
void setEntryLocalP(const G4ThreeVector &xyz1)
Definition: BSCG4Hit.cc:119
void setPhiAtEntry(float f)
Definition: BSCG4Hit.cc:162
G4ThreeVector hitPointLocalExit
Definition: FastTimerSD.h:112
G4VPhysicalVolume * currentPV
Definition: FastTimerSD.h:100
void StoreHit(BscG4Hit *)
Definition: FastTimerSD.cc:246
G4ThreeVector hitPointLocal
Definition: FastTimerSD.h:111
G4Track * theTrack
Definition: FastTimerSD.h:99
float incidentEnergy
Definition: FastTimerSD.h:89
void setTimeSlice(double d)
Definition: BSCG4Hit.cc:140
void setParticleType(short i)
Definition: BSCG4Hit.cc:156
void setVz(float p)
Definition: BSCG4Hit.cc:183
float PhiAtEntry
Definition: FastTimerSD.h:116
G4double tSlice
Definition: FastTimerSD.h:103
void setZ(float t)
Definition: BSCG4Hit.cc:171
void setExitLocalP(const G4ThreeVector &xyz1)
Definition: BSCG4Hit.cc:122
void setIncidentEnergy(double e)
Definition: BSCG4Hit.cc:131
float ThetaAtEntry
Definition: FastTimerSD.h:116
G4int primaryID
Definition: FastTimerSD.h:102
void FastTimerSD::DrawAll ( )
virtual

Definition at line 384 of file FastTimerSD.cc.

384 {}
void FastTimerSD::EndOfEvent ( G4HCofThisEvent *  eventHC)
virtual

Reimplemented from SensitiveDetector.

Definition at line 352 of file FastTimerSD.cc.

References TauDecayModes::dec, BscG4Hit::getEnergyLoss(), BscG4Hit::getEntry(), BscG4Hit::getPabs(), BscG4Hit::getParticleType(), BscG4Hit::getPhiAtEntry(), BscG4Hit::getThetaAtEntry(), BscG4Hit::getTof(), BscG4Hit::getTrackID(), BscG4Hit::getUnitID(), j, TrackingSlaveSD::processHits(), slave, Summarize(), and theHC.

352  {
353 
354  // here we loop over transient hits and make them persistent
355  for (int j=0; j<theHC->entries(); j++) {
356  BscG4Hit* aHit = (*theHC)[j];
357 #ifdef DebugLog
358  edm::LogInfo("FastTimerSim") << "hit number " << j << " unit ID = "
359  << std::hex << aHit->getUnitID() << std::dec
360  << " entry z " << aHit->getEntry().z()
361  << " entry theta " << aHit->getThetaAtEntry();
362 #endif
363  Local3DPoint locExitPoint(0,0,0);
364  Local3DPoint locEntryPoint(aHit->getEntry().x(),
365  aHit->getEntry().y(),
366  aHit->getEntry().z());
367  slave->processHits(PSimHit(locEntryPoint,locExitPoint,
368  aHit->getPabs(),
369  aHit->getTof(),
370  aHit->getEnergyLoss(),
371  aHit->getParticleType(),
372  aHit->getUnitID(),
373  aHit->getTrackID(),
374  aHit->getThetaAtEntry(),
375  aHit->getPhiAtEntry()));
376  }
377  Summarize();
378 }
float getPhiAtEntry() const
Definition: BSCG4Hit.cc:159
int getParticleType() const
Definition: BSCG4Hit.cc:151
G4int getTrackID() const
Definition: BSCG4Hit.cc:133
float getTof() const
Definition: BSCG4Hit.cc:149
float getPabs() const
Definition: BSCG4Hit.cc:148
unsigned int getUnitID() const
Definition: BSCG4Hit.cc:136
TrackingSlaveSD * slave
Definition: FastTimerSD.h:82
int j
Definition: DBlmapReader.cc:9
float getThetaAtEntry() const
Definition: BSCG4Hit.cc:158
BscG4HitCollection * theHC
Definition: FastTimerSD.h:94
G4ThreeVector getEntry() const
Definition: BSCG4Hit.cc:115
virtual bool processHits(const PSimHit &)
void Summarize()
Definition: FastTimerSD.cc:380
float getEnergyLoss() const
Definition: BSCG4Hit.cc:150
void FastTimerSD::fillHits ( edm::PSimHitContainer c,
std::string  use 
)
virtual

Implements SensitiveTkDetector.

Definition at line 393 of file FastTimerSD.cc.

References TrackingSlaveSD::hits(), gen::n, TrackingSlaveSD::name(), and slave.

393  {
394  if (slave->name() == n) c=slave->hits();
395 }
std::string name() const
std::vector< PSimHit > & hits()
TrackingSlaveSD * slave
Definition: FastTimerSD.h:82
double FastTimerSD::getEnergyDeposit ( G4Step *  step)
virtual

Definition at line 87 of file FastTimerSD.cc.

Referenced by GetStepInfo().

87  {
88  return aStep->GetTotalEnergyDeposit();
89 }
std::vector< std::string > FastTimerSD::getNames ( )
virtual

Reimplemented from SensitiveDetector.

Definition at line 422 of file FastTimerSD.cc.

References TrackingSlaveSD::name(), slave, and groupFilesInBlocks::temp.

422  {
423  std::vector<std::string> temp;
424  temp.push_back(slave->name());
425  return temp;
426 }
std::string name() const
TrackingSlaveSD * slave
Definition: FastTimerSD.h:82
void FastTimerSD::GetStepInfo ( G4Step *  aStep)
private

Definition at line 124 of file FastTimerSD.cc.

References currentPV, TauDecayModes::dec, edeposit, edepositEM, edepositHAD, Eloss, emPDG, epPDG, gammaPDG, getEnergyDeposit(), GeV, hitPoint, hitPointExit, hitPointLocal, hitPointLocalExit, LogDebug, Pabs, ParentId, ParticleType, PhiAtEntry, postStepPoint, preStepPoint, primaryID, setDetUnitId(), ThetaAtEntry, theTrack, Tof, tSlice, tSliceID, unitID, Vx, Vy, Vz, X, Y, and Z.

Referenced by ProcessHits().

124  {
125 
126  preStepPoint = aStep->GetPreStepPoint();
127  postStepPoint= aStep->GetPostStepPoint();
128  theTrack = aStep->GetTrack();
129  hitPoint = preStepPoint->GetPosition();
130  currentPV = preStepPoint->GetPhysicalVolume();
131  hitPointExit = postStepPoint->GetPosition();
132 
133  hitPointLocal = preStepPoint->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
134  hitPointLocalExit = preStepPoint->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(hitPointExit);
135 
136 
137  G4int particleCode = theTrack->GetDefinition()->GetPDGEncoding();
138 #ifdef DebugLog
139  edm::LogInfo("FastTimerSim") << "FastTimerSD :particleType = "
140  << theTrack->GetDefinition()->GetParticleName();
141 #endif
142  if (particleCode == emPDG ||
143  particleCode == epPDG ||
144  particleCode == gammaPDG ) {
145  edepositEM = getEnergyDeposit(aStep); edepositHAD = 0.;
146  } else {
147  edepositEM = 0.; edepositHAD = getEnergyDeposit(aStep);
148  }
149  edeposit = aStep->GetTotalEnergyDeposit();
150  tSlice = (100*postStepPoint->GetGlobalTime() )/CLHEP::nanosecond;
151  tSliceID = (int) tSlice;
152  unitID = setDetUnitId(aStep);
153 #ifdef DebugLog
154  LogDebug("FastTimerSim") << "FastTimerSD:unitID = " << std::hex << unitID
155  << std::dec;
156 #endif
157  primaryID = theTrack->GetTrackID();
158  // Position = hitPoint;
159  Pabs = aStep->GetPreStepPoint()->GetMomentum().mag()/CLHEP::GeV;
160  Tof = aStep->GetPostStepPoint()->GetGlobalTime()/CLHEP::nanosecond;
161  Eloss = aStep->GetTotalEnergyDeposit()/CLHEP::GeV;
162  ParticleType = theTrack->GetDefinition()->GetPDGEncoding();
163  ThetaAtEntry = aStep->GetPreStepPoint()->GetPosition().theta()/CLHEP::deg;
164  PhiAtEntry = aStep->GetPreStepPoint()->GetPosition().phi()/CLHEP::deg;
165 
166  ParentId = theTrack->GetParentID();
167  Vx = theTrack->GetVertexPosition().x();
168  Vy = theTrack->GetVertexPosition().y();
169  Vz = theTrack->GetVertexPosition().z();
170  X = hitPoint.x();
171  Y = hitPoint.y();
172  Z = hitPoint.z();
173 }
#define LogDebug(id)
G4ThreeVector hitPoint
Definition: FastTimerSD.h:109
G4ThreeVector hitPointExit
Definition: FastTimerSD.h:110
const double GeV
Definition: MathUtil.h:16
float edepositHAD
Definition: FastTimerSD.h:126
G4int tSliceID
Definition: FastTimerSD.h:102
virtual double getEnergyDeposit(G4Step *step)
Definition: FastTimerSD.cc:87
uint32_t unitID
Definition: FastTimerSD.h:101
float edeposit
Definition: FastTimerSD.h:107
short ParticleType
Definition: FastTimerSD.h:115
G4int gammaPDG
Definition: FastTimerSD.h:129
G4StepPoint * postStepPoint
Definition: FastTimerSD.h:106
G4ThreeVector hitPointLocalExit
Definition: FastTimerSD.h:112
G4VPhysicalVolume * currentPV
Definition: FastTimerSD.h:100
G4ThreeVector hitPointLocal
Definition: FastTimerSD.h:111
G4Track * theTrack
Definition: FastTimerSD.h:99
G4StepPoint * preStepPoint
Definition: FastTimerSD.h:105
float PhiAtEntry
Definition: FastTimerSD.h:116
float edepositEM
Definition: FastTimerSD.h:126
G4double tSlice
Definition: FastTimerSD.h:103
virtual uint32_t setDetUnitId(G4Step *)
Definition: FastTimerSD.cc:175
float ThetaAtEntry
Definition: FastTimerSD.h:116
G4int primaryID
Definition: FastTimerSD.h:102
G4bool FastTimerSD::HitExists ( )
private

Definition at line 198 of file FastTimerSD.cc.

References currentHit, newFWLiteAna::found, BscG4Hit::getTimeSliceID(), BscG4Hit::getTrackID(), BscG4Hit::getUnitID(), j, previousUnitID, primaryID, primID, ResetForNewPrimary(), theHC, tsID, tSliceID, unitID, and UpdateHit().

Referenced by ProcessHits().

198  {
199  if (primaryID<1) {
200  edm::LogWarning("FastTimerSim") << "***** FastTimerSD error: primaryID = "
201  << primaryID
202  << " maybe detector name changed";
203  }
204 
205  // Update if in the same detector, time-slice and for same track
206  if (tSliceID == tsID && unitID==previousUnitID) {
207  UpdateHit();
208  return true;
209  }
210  // Reset entry point for new primary
211  if (primaryID != primID)
213 
214  //look in the HitContainer whether a hit with the same primID, unitID,
215  //tSliceID already exists:
216 
217  G4bool found = false;
218 
219  for (int j=0; j<theHC->entries()&&!found; j++) {
220  BscG4Hit* aPreviousHit = (*theHC)[j];
221  if (aPreviousHit->getTrackID() == primaryID &&
222  aPreviousHit->getTimeSliceID() == tSliceID &&
223  aPreviousHit->getUnitID() == unitID ) {
224  currentHit = aPreviousHit;
225  found = true;
226  }
227  }
228 
229  if (found) {
230  UpdateHit();
231  return true;
232  } else {
233  return false;
234  }
235 }
G4int getTrackID() const
Definition: BSCG4Hit.cc:133
G4int tSliceID
Definition: FastTimerSD.h:102
void UpdateHit()
Definition: FastTimerSD.cc:316
BscG4Hit * currentHit
Definition: FastTimerSD.h:98
uint32_t unitID
Definition: FastTimerSD.h:101
unsigned int getUnitID() const
Definition: BSCG4Hit.cc:136
int getTimeSliceID() const
Definition: BSCG4Hit.cc:141
G4int tsID
Definition: FastTimerSD.h:97
G4int primID
Definition: FastTimerSD.h:90
int j
Definition: DBlmapReader.cc:9
void ResetForNewPrimary()
Definition: FastTimerSD.cc:238
BscG4HitCollection * theHC
Definition: FastTimerSD.h:94
uint32_t previousUnitID
Definition: FastTimerSD.h:101
G4int primaryID
Definition: FastTimerSD.h:102
void FastTimerSD::Initialize ( G4HCofThisEvent *  HCE)
virtual

Reimplemented from SensitiveDetector.

Definition at line 91 of file FastTimerSD.cc.

References ecaldqm::collectionName, hcID, LogDebug, name, primID, theHC, and tsID.

91  {
92 #ifdef DebugLog
93  LogDebug("FastTimerSim") << "FastTimerSD : Initialize called for " << name;
94 #endif
95 
97  if (hcID<0)
98  hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
99  HCE->AddHitsCollection(hcID, theHC);
100 
101  tsID = -2;
102  primID = -2;
103 }
#define LogDebug(id)
std::string name
Definition: FastTimerSD.h:92
G4int tsID
Definition: FastTimerSD.h:97
std::string const collectionName[nCollections]
Definition: Collections.h:45
G4int primID
Definition: FastTimerSD.h:90
BscG4HitCollection * theHC
Definition: FastTimerSD.h:94
G4THitsCollection< BscG4Hit > BscG4HitCollection
G4int hcID
Definition: FastTimerSD.h:93
void FastTimerSD::PrintAll ( )
virtual

Definition at line 386 of file FastTimerSD.cc.

References theHC.

386  {
387 #ifdef DebugLog
388  edm::LogInfo("FastTimerSim") << "FastTimerSD: Collection "<<theHC->GetName();
389 #endif
390  theHC->PrintAllHits();
391 }
BscG4HitCollection * theHC
Definition: FastTimerSD.h:94
bool FastTimerSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
virtual

Implements SensitiveDetector.

Definition at line 106 of file FastTimerSD.cc.

References CreateNewHit(), edeposit, GetStepInfo(), HitExists(), LogDebug, NULL, and theHC.

106  {
107 
108  if (aStep == NULL) {
109  return true;
110  } else {
111  GetStepInfo(aStep);
112 #ifdef DebugLog
113  LogDebug("FastTimerSim") << "FastTimerSD : number of hits = "
114  << theHC->entries();
115 #endif
116  if (HitExists() == false && edeposit>0. ){
117  CreateNewHit();
118  return true;
119  }
120  }
121  return true;
122 }
#define LogDebug(id)
#define NULL
Definition: scimark2.h:8
float edeposit
Definition: FastTimerSD.h:107
G4bool HitExists()
Definition: FastTimerSD.cc:198
BscG4HitCollection * theHC
Definition: FastTimerSD.h:94
void CreateNewHit()
Definition: FastTimerSD.cc:257
void GetStepInfo(G4Step *aStep)
Definition: FastTimerSD.cc:124
void FastTimerSD::ResetForNewPrimary ( )
private

Definition at line 238 of file FastTimerSD.cc.

References entrancePoint, exitPoint, hitPoint, hitPointExit, incidentEnergy, preStepPoint, SetToLocal(), and SetToLocalExit().

Referenced by HitExists().

238  {
239 
242  incidentEnergy = preStepPoint->GetKineticEnergy();
243 }
G4ThreeVector hitPoint
Definition: FastTimerSD.h:109
G4ThreeVector hitPointExit
Definition: FastTimerSD.h:110
G4ThreeVector SetToLocalExit(const G4ThreeVector &globalPoint)
Definition: FastTimerSD.cc:344
G4ThreeVector SetToLocal(const G4ThreeVector &global)
Definition: FastTimerSD.cc:336
float incidentEnergy
Definition: FastTimerSD.h:89
G4StepPoint * preStepPoint
Definition: FastTimerSD.h:105
G4ThreeVector entrancePoint
Definition: FastTimerSD.h:86
G4ThreeVector exitPoint
Definition: FastTimerSD.h:86
uint32_t FastTimerSD::setDetUnitId ( G4Step *  aStep)
virtual

Implements SensitiveDetector.

Definition at line 175 of file FastTimerSD.cc.

References TauDecayModes::dec, ftcons, FastTimeDDDConstants::getXY(), hitPointLocal, and DetId::rawId().

Referenced by GetStepInfo().

175  {
176 
177  //Find the depth segment
178  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
179  float globalZ = aStep->GetPreStepPoint()->GetPosition().z();
180  int iz = (globalZ > 0) ? 1 : -1;
181  std::pair<int,int> ixy;
182  if (type == 1) {
183  ixy = ftcons->getXY(touch->GetReplicaNumber(0));
184  } else {
185  ixy = ftcons->getXY(hitPointLocal.x(),hitPointLocal.y());
186  }
187  uint32_t id = FastTimeDetId(ixy.first,ixy.second,iz).rawId();
188 #ifdef DebugLog
189  edm::LogInfo("FastTimerSim") << "Levels " << touch->GetReplicaNumber(0) <<":"
190  << globalZ << " Ixyz " << ixy.first << ":"
191  << ixy.second << ":" << iz << " id "
192  << std::hex << id << std::dec;
193 #endif
194  return id;
195 }
type
Definition: HCALResponse.h:21
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
FastTimeDDDConstants * ftcons
Definition: FastTimerSD.h:83
G4ThreeVector hitPointLocal
Definition: FastTimerSD.h:111
std::pair< int, int > getXY(int copy) const
G4ThreeVector FastTimerSD::SetToLocal ( const G4ThreeVector &  global)
private

Definition at line 336 of file FastTimerSD.cc.

References preStepPoint, and theEntryPoint.

Referenced by ResetForNewPrimary().

336  {
337 
338  const G4VTouchable* touch= preStepPoint->GetTouchable();
339  theEntryPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
340  return theEntryPoint;
341 }
G4ThreeVector theEntryPoint
Definition: FastTimerSD.h:87
G4StepPoint * preStepPoint
Definition: FastTimerSD.h:105
G4ThreeVector FastTimerSD::SetToLocalExit ( const G4ThreeVector &  globalPoint)
private

Definition at line 344 of file FastTimerSD.cc.

References postStepPoint, and theExitPoint.

Referenced by ResetForNewPrimary().

344  {
345 
346  const G4VTouchable* touch= postStepPoint->GetTouchable();
347  theExitPoint = touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
348  return theExitPoint;
349 }
G4StepPoint * postStepPoint
Definition: FastTimerSD.h:106
G4ThreeVector theExitPoint
Definition: FastTimerSD.h:87
void FastTimerSD::StoreHit ( BscG4Hit hit)
private

Definition at line 246 of file FastTimerSD.cc.

References primID, and theHC.

Referenced by CreateNewHit().

246  {
247 
248  if (primID<0) return;
249  if (hit == 0) {
250  edm::LogWarning("FastTimerSim") << "FastTimerSD: hit to be stored is NULL !!";
251  } else {
252  theHC->insert( hit );
253  }
254 }
G4int primID
Definition: FastTimerSD.h:90
BscG4HitCollection * theHC
Definition: FastTimerSD.h:94
void FastTimerSD::Summarize ( )
private

Definition at line 380 of file FastTimerSD.cc.

Referenced by EndOfEvent().

380 {}
void FastTimerSD::update ( const BeginOfRun )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 406 of file FastTimerSD.cc.

References emPDG, epPDG, and gammaPDG.

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

406  {
407 
408  G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
409  G4String particleName;
410  emPDG = theParticleTable->FindParticle(particleName="e-")->GetPDGEncoding();
411  epPDG = theParticleTable->FindParticle(particleName="e+")->GetPDGEncoding();
412  gammaPDG = theParticleTable->FindParticle(particleName="gamma")->GetPDGEncoding();
413 
414 }
G4int gammaPDG
Definition: FastTimerSD.h:129
void FastTimerSD::update ( const BeginOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 397 of file FastTimerSD.cc.

References clearHits(), and eventno.

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

397  {
398 #ifdef DebugLog
399  edm::LogInfo("FastTimerSim") << "Dispatched BeginOfEvent for " << GetName()
400  << " !" ;
401 #endif
402  clearHits();
403  eventno = (*i)()->GetEventID();
404 }
virtual void clearHits()
Definition: FastTimerSD.cc:418
void FastTimerSD::update ( const ::EndOfEvent )
private
void FastTimerSD::UpdateHit ( )
private

Definition at line 316 of file FastTimerSD.cc.

References BscG4Hit::addEnergyDeposit(), currentHit, edepositEM, edepositHAD, Eloss, LogDebug, postStepPoint, previousUnitID, primaryID, primID, BscG4Hit::setEnergyLoss(), tsID, tSliceID, and unitID.

Referenced by CreateNewHit(), and HitExists().

316  {
317 
318  if (Eloss > 0.) {
320 
321 #ifdef DebugLog
322  LogDebug("FastTimerSim") << "updateHit: add eloss " << Eloss <<std::endl;
323  LogDebug("FastTimerSim") << "CurrentHit="<< currentHit<< ", PostStepPoint="
324  << postStepPoint->GetPosition();
325 #endif
327  }
328 
329  // buffer for next steps:
330  tsID = tSliceID;
331  primID = primaryID;
333 }
#define LogDebug(id)
float edepositHAD
Definition: FastTimerSD.h:126
G4int tSliceID
Definition: FastTimerSD.h:102
void setEnergyLoss(float e)
Definition: BSCG4Hit.cc:155
BscG4Hit * currentHit
Definition: FastTimerSD.h:98
uint32_t unitID
Definition: FastTimerSD.h:101
G4int tsID
Definition: FastTimerSD.h:97
G4int primID
Definition: FastTimerSD.h:90
G4StepPoint * postStepPoint
Definition: FastTimerSD.h:106
void addEnergyDeposit(double em, double hd)
Definition: BSCG4Hit.cc:143
uint32_t previousUnitID
Definition: FastTimerSD.h:101
float edepositEM
Definition: FastTimerSD.h:126
G4int primaryID
Definition: FastTimerSD.h:102

Member Data Documentation

BscG4Hit* FastTimerSD::currentHit
private

Definition at line 98 of file FastTimerSD.h.

Referenced by CreateNewHit(), HitExists(), and UpdateHit().

G4VPhysicalVolume* FastTimerSD::currentPV
private

Definition at line 100 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float FastTimerSD::edeposit
private

Definition at line 107 of file FastTimerSD.h.

Referenced by GetStepInfo(), and ProcessHits().

float FastTimerSD::edepositEM
protected

Definition at line 126 of file FastTimerSD.h.

Referenced by GetStepInfo(), and UpdateHit().

float FastTimerSD::edepositHAD
protected

Definition at line 126 of file FastTimerSD.h.

Referenced by GetStepInfo(), and UpdateHit().

float FastTimerSD::Eloss
private

Definition at line 114 of file FastTimerSD.h.

Referenced by CreateNewHit(), GetStepInfo(), and UpdateHit().

G4int FastTimerSD::emPDG
protected

Definition at line 127 of file FastTimerSD.h.

Referenced by GetStepInfo(), and update().

G4ThreeVector FastTimerSD::entrancePoint
private

Definition at line 86 of file FastTimerSD.h.

Referenced by ResetForNewPrimary().

G4int FastTimerSD::epPDG
protected

Definition at line 128 of file FastTimerSD.h.

Referenced by GetStepInfo(), and update().

int FastTimerSD::eventno
private

Definition at line 122 of file FastTimerSD.h.

Referenced by update().

G4ThreeVector FastTimerSD::exitPoint
private

Definition at line 86 of file FastTimerSD.h.

Referenced by ResetForNewPrimary().

FastTimeDDDConstants* FastTimerSD::ftcons
private

Definition at line 83 of file FastTimerSD.h.

Referenced by FastTimerSD(), setDetUnitId(), and ~FastTimerSD().

G4int FastTimerSD::gammaPDG
protected

Definition at line 129 of file FastTimerSD.h.

Referenced by GetStepInfo(), and update().

G4int FastTimerSD::hcID
private

Definition at line 93 of file FastTimerSD.h.

Referenced by Initialize().

G4ThreeVector FastTimerSD::hitPoint
private

Definition at line 109 of file FastTimerSD.h.

Referenced by CreateNewHit(), GetStepInfo(), and ResetForNewPrimary().

G4ThreeVector FastTimerSD::hitPointExit
private

Definition at line 110 of file FastTimerSD.h.

Referenced by GetStepInfo(), and ResetForNewPrimary().

G4ThreeVector FastTimerSD::hitPointLocal
private

Definition at line 111 of file FastTimerSD.h.

Referenced by CreateNewHit(), GetStepInfo(), and setDetUnitId().

G4ThreeVector FastTimerSD::hitPointLocalExit
private

Definition at line 112 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float FastTimerSD::incidentEnergy
private

Definition at line 89 of file FastTimerSD.h.

Referenced by CreateNewHit(), and ResetForNewPrimary().

std::string FastTimerSD::name
private
float FastTimerSD::Pabs
private

Definition at line 114 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

int FastTimerSD::ParentId
private

Definition at line 118 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

short FastTimerSD::ParticleType
private

Definition at line 115 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float FastTimerSD::PhiAtEntry
private

Definition at line 116 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4StepPoint* FastTimerSD::postStepPoint
private

Definition at line 106 of file FastTimerSD.h.

Referenced by GetStepInfo(), SetToLocalExit(), and UpdateHit().

G4StepPoint* FastTimerSD::preStepPoint
private

Definition at line 105 of file FastTimerSD.h.

Referenced by GetStepInfo(), ResetForNewPrimary(), and SetToLocal().

uint32_t FastTimerSD::previousUnitID
private

Definition at line 101 of file FastTimerSD.h.

Referenced by HitExists(), and UpdateHit().

G4int FastTimerSD::primaryID
private

Definition at line 102 of file FastTimerSD.h.

Referenced by CreateNewHit(), GetStepInfo(), HitExists(), and UpdateHit().

G4int FastTimerSD::primID
private

Definition at line 90 of file FastTimerSD.h.

Referenced by HitExists(), Initialize(), StoreHit(), and UpdateHit().

TrackingSlaveSD* FastTimerSD::slave
private

Definition at line 82 of file FastTimerSD.h.

Referenced by clearHits(), EndOfEvent(), FastTimerSD(), fillHits(), getNames(), and ~FastTimerSD().

G4ThreeVector FastTimerSD::theEntryPoint
private

Definition at line 87 of file FastTimerSD.h.

Referenced by SetToLocal().

G4ThreeVector FastTimerSD::theExitPoint
private

Definition at line 87 of file FastTimerSD.h.

Referenced by SetToLocalExit().

BscG4HitCollection* FastTimerSD::theHC
private

Definition at line 94 of file FastTimerSD.h.

Referenced by EndOfEvent(), HitExists(), Initialize(), PrintAll(), ProcessHits(), and StoreHit().

const SimTrackManager* FastTimerSD::theManager
private

Definition at line 95 of file FastTimerSD.h.

float FastTimerSD::ThetaAtEntry
private

Definition at line 116 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4Track* FastTimerSD::theTrack
private

Definition at line 99 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float FastTimerSD::Tof
private

Definition at line 114 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4int FastTimerSD::tsID
private

Definition at line 97 of file FastTimerSD.h.

Referenced by HitExists(), Initialize(), and UpdateHit().

G4double FastTimerSD::tSlice
private

Definition at line 103 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4int FastTimerSD::tSliceID
private

Definition at line 102 of file FastTimerSD.h.

Referenced by CreateNewHit(), GetStepInfo(), HitExists(), and UpdateHit().

int FastTimerSD::type
private
uint32_t FastTimerSD::unitID
private

Definition at line 101 of file FastTimerSD.h.

Referenced by CreateNewHit(), GetStepInfo(), HitExists(), and UpdateHit().

float FastTimerSD::Vx
private

Definition at line 119 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float FastTimerSD::Vy
private

Definition at line 119 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float FastTimerSD::Vz
private

Definition at line 119 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float FastTimerSD::X
private

Definition at line 120 of file FastTimerSD.h.

Referenced by svgfig.Curve.Sample::__repr__(), CreateNewHit(), and GetStepInfo().

float FastTimerSD::Y
private

Definition at line 120 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float FastTimerSD::Z
private

Definition at line 120 of file FastTimerSD.h.

Referenced by CreateNewHit(), and GetStepInfo().