CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
TimingSD Class Reference

#include <TimingSD.h>

Inheritance diagram for TimingSD:
SensitiveTkDetector Observer< const BeginOfEvent * > SensitiveDetector Bcm1fSD BHMSD BscSD FastTimerSD MtdSD PltSD

Public Member Functions

void clearHits () override
 
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
void fillHits (edm::PSimHitContainer &, const std::string &) override
 
void Initialize (G4HCofThisEvent *HCE) override
 
void PrintAll () override
 
bool ProcessHits (G4Step *, G4TouchableHistory *) override
 
 TimingSD (const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, const edm::ParameterSet &, const SimTrackManager *)
 
 ~TimingSD () override
 
- Public Member Functions inherited from SensitiveTkDetector
 SensitiveTkDetector (const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
const std::vector< std::string > & getNames () const
 
void Initialize (G4HCofThisEvent *eventHC) override
 
 SensitiveDetector (const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
virtual uint32_t setDetUnitId (const G4Step *step)=0
 
 ~SensitiveDetector () override
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 

Protected Member Functions

virtual bool checkHit (const G4Step *, BscG4Hit *)
 
const G4ThreeVector & getGlobalEntryPoint () const
 
const G4ThreeVector & getLocalEntryPoint () const
 
void setCuts (double eCut, double historyCut)
 
void setTimeFactor (double)
 
void setToLocal (const G4StepPoint *stepPoint, const G4ThreeVector &globalPoint, G4ThreeVector &localPoint)
 
void update (const BeginOfEvent *) override
 This routine will be called when the appropriate signal arrives. More...
 
- Protected Member Functions inherited from SensitiveDetector
TrackInformationcmsTrackInformation (const G4Track *aTrack)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point) const
 
Local3DPoint FinalStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint InitialStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint LocalPostStepPosition (const G4Step *step) const
 
Local3DPoint LocalPreStepPosition (const G4Step *step) const
 
void NaNTrap (const G4Step *step) const
 
void setNames (const std::vector< std::string > &)
 

Private Member Functions

void createNewHit (const G4Step *)
 
void getStepInfo (const G4Step *)
 
bool hitExists (const G4Step *)
 
void storeHit (BscG4Hit *)
 
void updateHit ()
 

Private Attributes

BscG4HitcurrentHit
 
float edeposit
 
float edepositEM
 
float edepositHAD
 
double energyCut
 
double energyHistoryCut
 
int hcID
 
G4ThreeVector hitPoint
 
G4ThreeVector hitPointExit
 
G4ThreeVector hitPointLocal
 
G4ThreeVector hitPointLocalExit
 
double incidentEnergy
 
const G4StepPoint * postStepPoint
 
const G4StepPoint * preStepPoint
 
uint32_t previousUnitID
 
int primaryID
 
int primID
 
TrackingSlaveSDslave
 
G4ProcessTypeEnumeratortheEnumerator
 
BscG4HitCollectiontheHC
 
const SimTrackManagertheManager
 
const G4Track * theTrack
 
double timeFactor
 
float tof
 
int tsID
 
double tSlice
 
int tSliceID
 
uint32_t unitID
 

Additional Inherited Members

- Protected Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 

Detailed Description

Definition at line 29 of file TimingSD.h.

Constructor & Destructor Documentation

TimingSD::TimingSD ( const std::string &  ,
const DDCompactView ,
const SensitiveDetectorCatalog ,
const edm::ParameterSet ,
const SimTrackManager  
)

Definition at line 40 of file TimingSD.cc.

References slave, and theEnumerator.

42  :
43  SensitiveTkDetector(name, cpv, clg, p),
44  theManager(manager), theHC(nullptr), currentHit(nullptr), theTrack(nullptr),
45  preStepPoint(nullptr),postStepPoint(nullptr),
46  unitID(0), previousUnitID(0), primID(-2), hcID(-1), tsID(-2),
47  primaryID(0), tSliceID(-1),
48  timeFactor(1.0), energyCut(1.e+9), energyHistoryCut(1.e+9) {
49 
50  slave = new TrackingSlaveSD(name);
52 }
uint32_t previousUnitID
Definition: TimingSD.h:90
double timeFactor
Definition: TimingSD.h:104
int hcID
Definition: TimingSD.h:93
int primID
Definition: TimingSD.h:92
BscG4Hit * currentHit
Definition: TimingSD.h:85
int tsID
Definition: TimingSD.h:94
TrackingSlaveSD * slave
Definition: TimingSD.h:79
G4ProcessTypeEnumerator * theEnumerator
Definition: TimingSD.h:80
const G4Track * theTrack
Definition: TimingSD.h:86
double energyHistoryCut
Definition: TimingSD.h:107
const G4StepPoint * preStepPoint
Definition: TimingSD.h:87
int tSliceID
Definition: TimingSD.h:96
double energyCut
Definition: TimingSD.h:106
uint32_t unitID
Definition: TimingSD.h:90
const G4StepPoint * postStepPoint
Definition: TimingSD.h:88
BscG4HitCollection * theHC
Definition: TimingSD.h:83
const SimTrackManager * theManager
Definition: TimingSD.h:82
SensitiveTkDetector(const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
int primaryID
Definition: TimingSD.h:95
TimingSD::~TimingSD ( )
override

Definition at line 54 of file TimingSD.cc.

References slave, and theEnumerator.

54  {
55  delete slave;
56  delete theEnumerator;
57 }
TrackingSlaveSD * slave
Definition: TimingSD.h:79
G4ProcessTypeEnumerator * theEnumerator
Definition: TimingSD.h:80

Member Function Documentation

bool TimingSD::checkHit ( const G4Step *  ,
BscG4Hit hit 
)
protectedvirtual

Reimplemented in Bcm1fSD, and PltSD.

Definition at line 189 of file TimingSD.cc.

References objects.autophobj::float, hitPoint, hitPointLocal, hitPointLocalExit, incidentEnergy, invdeg, invgev, preStepPoint, primaryID, G4ProcessTypeEnumerator::processId(), BscG4Hit::setEntry(), BscG4Hit::setEntryLocalP(), BscG4Hit::setExitLocalP(), BscG4Hit::setIncidentEnergy(), BscG4Hit::setPabs(), BscG4Hit::setParentId(), BscG4Hit::setParticleType(), BscG4Hit::setPhiAtEntry(), BscG4Hit::setProcessId(), BscG4Hit::setThetaAtEntry(), BscG4Hit::setTof(), BscG4Hit::setTrackID(), BscG4Hit::setVertexPosition(), theEnumerator, theTrack, and tof.

Referenced by hitExists().

189  {
190 
191  // change hit info to fastest primary particle
192  if(tof < hit->getTof()) {
193  hit->setTrackID(primaryID);
194  hit->setIncidentEnergy((float)incidentEnergy);
195  hit->setPabs(float(preStepPoint->GetMomentum().mag())*invgev);
196  hit->setTof(tof);
197  hit->setParticleType(theTrack->GetDefinition()->GetPDGEncoding());
198 
199  float ThetaAtEntry = (float)(hitPointLocal.theta()*invdeg);
200  float PhiAtEntry = (float)(hitPointLocal.phi()*invdeg);
201 
202  hit->setThetaAtEntry(ThetaAtEntry);
203  hit->setPhiAtEntry(PhiAtEntry);
204 
205  hit->setEntry(hitPoint);
208 
209  hit->setParentId(theTrack->GetParentID());
210  hit->setProcessId(theEnumerator->processId(theTrack->GetCreatorProcess()));
211 
212  hit->setVertexPosition(theTrack->GetVertexPosition());
213  }
214  return true;
215 }
void setTof(float e)
Definition: BscG4Hit.h:70
void setEntryLocalP(const G4ThreeVector &xyz)
Definition: BscG4Hit.h:36
void setEntry(const G4ThreeVector &xyz)
Definition: BSCG4Hit.cc:97
void setIncidentEnergy(float e)
Definition: BscG4Hit.h:48
G4ThreeVector hitPointLocal
Definition: TimingSD.h:100
void setTrackID(int id)
Definition: BscG4Hit.h:51
void setParentId(int p)
Definition: BscG4Hit.h:96
G4ThreeVector hitPointLocalExit
Definition: TimingSD.h:101
void setParticleType(int i)
Definition: BscG4Hit.h:72
void setThetaAtEntry(float t)
Definition: BscG4Hit.h:77
void setPabs(float e)
Definition: BscG4Hit.h:69
unsigned int processId(const G4VProcess *p) const
static const float invgev
Definition: TimingSD.cc:35
float tof
Definition: TimingSD.h:110
void setPhiAtEntry(float f)
Definition: BscG4Hit.h:78
G4ProcessTypeEnumerator * theEnumerator
Definition: TimingSD.h:80
static const double invdeg
Definition: TimingSD.cc:37
const G4Track * theTrack
Definition: TimingSD.h:86
const G4StepPoint * preStepPoint
Definition: TimingSD.h:87
void setExitLocalP(const G4ThreeVector &xyz)
Definition: BscG4Hit.h:39
void setVertexPosition(const G4ThreeVector &)
Definition: BSCG4Hit.cc:122
double incidentEnergy
Definition: TimingSD.h:109
void setProcessId(int p)
Definition: BscG4Hit.h:97
G4ThreeVector hitPoint
Definition: TimingSD.h:98
int primaryID
Definition: TimingSD.h:95
void TimingSD::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 346 of file TimingSD.cc.

References TrackingSlaveSD::Initialize(), and slave.

Referenced by update().

346  {
347  slave->Initialize();
348 }
virtual void Initialize()
TrackingSlaveSD * slave
Definition: TimingSD.h:79
void TimingSD::createNewHit ( const G4Step *  aStep)
private

Definition at line 228 of file TimingSD.cc.

References currentHit, hitPoint, hitPointLocal, hitPointLocalExit, incidentEnergy, invdeg, invgev, preStepPoint, primaryID, G4ProcessTypeEnumerator::processId(), BscG4Hit::setEntry(), BscG4Hit::setEntryLocalP(), BscG4Hit::setExitLocalP(), BscG4Hit::setIncidentEnergy(), BscG4Hit::setPabs(), BscG4Hit::setParentId(), BscG4Hit::setParticleType(), BscG4Hit::setPhiAtEntry(), BscG4Hit::setProcessId(), BscG4Hit::setThetaAtEntry(), BscG4Hit::setTimeSlice(), BscG4Hit::setTof(), BscG4Hit::setTrackID(), BscG4Hit::setUnitID(), BscG4Hit::setVertexPosition(), storeHit(), theEnumerator, theTrack, tof, tSlice, tSliceID, unitID, and updateHit().

Referenced by getGlobalEntryPoint(), and ProcessHits().

228  {
229 
230 #ifdef debug
231  const G4VPhysicsVolume* currentPV = preStepPoint->GetPhysicalVolume();
232  edm::LogVerbatim("TimingSim")
233  << "TimingSD CreateNewHit for " << GetName()
234  << " PV " << currentPV->GetName()
235  << " PVid = " << currentPV->GetCopyNo()
236  << " Unit " << unitID <<
237  << "\n primary " << primaryID
238  << " Tof(ns)= " << tof
239  << " time slice " << tSliceID
240  << " E(GeV)= " << incidentEnergy
241  << " trackID " << theTrack->GetTrackID()
242  << " " << theTrack->GetDefinition()->GetParticleName()
243  << " parentID " << theTrack->GetParentID();
244 
245  if (theTrack->GetCreatorProcess()!=nullptr) {
246  edm::LogVerbatim("TimingSim")
247  << theTrack->GetCreatorProcess()->GetProcessName();
248  } else {
249  edm::LogVerbatim("TimingSim") << " is primary particle";
250  }
251 #endif
252 
253  currentHit = new BscG4Hit;
258 
259  currentHit->setPabs(float(preStepPoint->GetMomentum().mag()*invgev));
261  currentHit->setParticleType(theTrack->GetDefinition()->GetPDGEncoding());
262 
263  float ThetaAtEntry = hitPointLocal.theta()*invdeg;
264  float PhiAtEntry = hitPointLocal.phi()*invdeg;
265 
266  currentHit->setThetaAtEntry(ThetaAtEntry);
267  currentHit->setPhiAtEntry(PhiAtEntry);
268 
272 
273  currentHit->setParentId(theTrack->GetParentID());
274  currentHit->setProcessId(theEnumerator->processId(theTrack->GetCreatorProcess()));
275 
276  currentHit->setVertexPosition(theTrack->GetVertexPosition());
277 
278  updateHit();
280 }
void setTof(float e)
Definition: BscG4Hit.h:70
void setEntryLocalP(const G4ThreeVector &xyz)
Definition: BscG4Hit.h:36
void setEntry(const G4ThreeVector &xyz)
Definition: BSCG4Hit.cc:97
void setIncidentEnergy(float e)
Definition: BscG4Hit.h:48
G4ThreeVector hitPointLocal
Definition: TimingSD.h:100
void setTrackID(int id)
Definition: BscG4Hit.h:51
void setParentId(int p)
Definition: BscG4Hit.h:96
G4ThreeVector hitPointLocalExit
Definition: TimingSD.h:101
BscG4Hit * currentHit
Definition: TimingSD.h:85
void setParticleType(int i)
Definition: BscG4Hit.h:72
void setThetaAtEntry(float t)
Definition: BscG4Hit.h:77
void storeHit(BscG4Hit *)
Definition: TimingSD.cc:217
void setPabs(float e)
Definition: BscG4Hit.h:69
unsigned int processId(const G4VProcess *p) const
static const float invgev
Definition: TimingSD.cc:35
void setUnitID(uint32_t id)
Definition: BscG4Hit.h:54
float tof
Definition: TimingSD.h:110
void setPhiAtEntry(float f)
Definition: BscG4Hit.h:78
G4ProcessTypeEnumerator * theEnumerator
Definition: TimingSD.h:80
static const double invdeg
Definition: TimingSD.cc:37
const G4Track * theTrack
Definition: TimingSD.h:86
const G4StepPoint * preStepPoint
Definition: TimingSD.h:87
int tSliceID
Definition: TimingSD.h:96
void setTimeSlice(double d)
Definition: BscG4Hit.h:57
uint32_t unitID
Definition: TimingSD.h:90
void setExitLocalP(const G4ThreeVector &xyz)
Definition: BscG4Hit.h:39
double tSlice
Definition: TimingSD.h:103
void setVertexPosition(const G4ThreeVector &)
Definition: BSCG4Hit.cc:122
void updateHit()
Definition: TimingSD.cc:282
double incidentEnergy
Definition: TimingSD.h:109
void setProcessId(int p)
Definition: BscG4Hit.h:97
G4ThreeVector hitPoint
Definition: TimingSD.h:98
int primaryID
Definition: TimingSD.h:95
void TimingSD::EndOfEvent ( G4HCofThisEvent *  eventHC)
override

Definition at line 308 of file TimingSD.cc.

References SensitiveDetector::ConvertToLocal3DPoint(), BscG4Hit::getEnergyLoss(), BscG4Hit::getEntryLocalP(), BscG4Hit::getExitLocalP(), BscG4Hit::getPabs(), BscG4Hit::getParticleType(), BscG4Hit::getPhiAtEntry(), BscG4Hit::getProcessId(), BscG4Hit::getThetaAtEntry(), BscG4Hit::getTof(), BscG4Hit::getTrackID(), BscG4Hit::getUnitID(), nhits, TrackingSlaveSD::processHits(), slave, and theHC.

308  {
309 
310  int nhits = theHC->entries();
311  if(0 == nhits) { return; }
312  // here we loop over transient hits and make them persistent
313  for (int j=0; j<nhits; ++j) {
314 
315  BscG4Hit* aHit = (*theHC)[j];
316  Local3DPoint locEntryPoint= ConvertToLocal3DPoint(aHit->getEntryLocalP());
317  Local3DPoint locExitPoint = ConvertToLocal3DPoint(aHit->getExitLocalP());
318 
319  slave->processHits(PSimHit(locEntryPoint,locExitPoint,
320  aHit->getPabs(),
321  aHit->getTof(),
322  aHit->getEnergyLoss(),
323  aHit->getParticleType(),
324  aHit->getUnitID(),
325  aHit->getTrackID(),
326  aHit->getThetaAtEntry(),
327  aHit->getPhiAtEntry(),
328  aHit->getProcessId()));
329  }
330 }
float getPhiAtEntry() const
Definition: BscG4Hit.h:75
int getParticleType() const
Definition: BscG4Hit.h:67
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
int getProcessId() const
Definition: BscG4Hit.h:91
float getTof() const
Definition: BscG4Hit.h:65
float getPabs() const
Definition: BscG4Hit.h:64
int getTrackID() const
Definition: BscG4Hit.h:50
TrackingSlaveSD * slave
Definition: TimingSD.h:79
const G4ThreeVector & getExitLocalP() const
Definition: BscG4Hit.h:38
float getThetaAtEntry() const
Definition: BscG4Hit.h:74
const G4ThreeVector & getEntryLocalP() const
Definition: BscG4Hit.h:35
BscG4HitCollection * theHC
Definition: TimingSD.h:83
virtual bool processHits(const PSimHit &)
uint32_t getUnitID() const
Definition: BscG4Hit.h:53
float getEnergyLoss() const
Definition: BscG4Hit.h:66
void TimingSD::fillHits ( edm::PSimHitContainer cc,
const std::string &  hname 
)
overridevirtual

Implements SensitiveTkDetector.

Definition at line 337 of file TimingSD.cc.

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

337  {
338  if (slave->name() == hname) { cc=slave->hits(); }
339 }
std::string name() const
std::vector< PSimHit > & hits()
TrackingSlaveSD * slave
Definition: TimingSD.h:79
const G4ThreeVector& TimingSD::getGlobalEntryPoint ( ) const
inlineprotected

Definition at line 70 of file TimingSD.h.

References createNewHit(), getStepInfo(), hitExists(), hitPoint, storeHit(), and updateHit().

Referenced by FastTimerSD::setDetUnitId().

70 { return hitPoint; };
G4ThreeVector hitPoint
Definition: TimingSD.h:98
const G4ThreeVector& TimingSD::getLocalEntryPoint ( ) const
inlineprotected

Definition at line 69 of file TimingSD.h.

References hitPointLocal.

Referenced by Bcm1fSD::checkHit(), PltSD::checkHit(), and FastTimerSD::setDetUnitId().

69 { return hitPointLocal; };
G4ThreeVector hitPointLocal
Definition: TimingSD.h:100
void TimingSD::getStepInfo ( const G4Step *  aStep)
private

Definition at line 111 of file TimingSD.cc.

References SensitiveDetector::cmsTrackInformation(), edeposit, edepositEM, edepositHAD, energyCut, energyHistoryCut, objects.autophobj::float, hitPoint, hitPointExit, hitPointLocal, hitPointLocalExit, incidentEnergy, info(), createfilelist::int, invgev, invns, G4TrackToParticleID::isGammaElectronPositron(), postStepPoint, preStepPoint, primaryID, TrackInformation::putInHistory(), SensitiveDetector::setDetUnitId(), setToLocal(), TrackInformation::storeTrack(), theTrack, timeFactor, tof, tSlice, tSliceID, and unitID.

Referenced by getGlobalEntryPoint(), and ProcessHits().

111  {
112 
113  preStepPoint = aStep->GetPreStepPoint();
114  postStepPoint= aStep->GetPostStepPoint();
115  hitPointExit = postStepPoint->GetPosition();
117  const G4Track* newTrack = aStep->GetTrack();
118 
119  // neutral particles deliver energy post step
120  // charged particle start deliver energy pre step
121  if(newTrack->GetDefinition()->GetPDGCharge() == 0.0) {
124  tof = (float)(postStepPoint->GetGlobalTime()*invns);
125  } else {
126  hitPoint = preStepPoint->GetPosition();
128  tof = (float)(preStepPoint->GetGlobalTime()*invns);
129  }
130 
131  incidentEnergy = preStepPoint->GetKineticEnergy();
132 
133  // should MC truth be saved
134  if (newTrack != theTrack) {
135  theTrack = newTrack;
136  TrackInformation* info = nullptr;
137  if (incidentEnergy > energyCut) {
139  info->storeTrack(true);
140  }
142  if(!info) { info = cmsTrackInformation(theTrack); }
143  info->putInHistory();
144  }
145  }
146 
147  edeposit *= invgev;
150  } else {
152  }
153  // time slice is defined for the entry point
154  tSlice = timeFactor*preStepPoint->GetGlobalTime()*invns;
155  tSliceID = (int) tSlice;
156 
157  unitID = setDetUnitId(aStep);
158  primaryID = theTrack->GetTrackID();
159 }
static const TGPicture * info(bool iBackgroundIsBlack)
bool storeTrack() const
double timeFactor
Definition: TimingSD.h:104
float edepositHAD
Definition: TimingSD.h:112
G4ThreeVector hitPointLocal
Definition: TimingSD.h:100
virtual uint32_t setDetUnitId(const G4Step *step)=0
G4ThreeVector hitPointLocalExit
Definition: TimingSD.h:101
float edepositEM
Definition: TimingSD.h:112
void setToLocal(const G4StepPoint *stepPoint, const G4ThreeVector &globalPoint, G4ThreeVector &localPoint)
Definition: TimingSD.cc:299
static const float invgev
Definition: TimingSD.cc:35
float tof
Definition: TimingSD.h:110
float edeposit
Definition: TimingSD.h:111
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
const G4Track * theTrack
Definition: TimingSD.h:86
double energyHistoryCut
Definition: TimingSD.h:107
const G4StepPoint * preStepPoint
Definition: TimingSD.h:87
int tSliceID
Definition: TimingSD.h:96
double energyCut
Definition: TimingSD.h:106
uint32_t unitID
Definition: TimingSD.h:90
double tSlice
Definition: TimingSD.h:103
static const double invns
Definition: TimingSD.cc:36
const G4StepPoint * postStepPoint
Definition: TimingSD.h:88
static bool isGammaElectronPositron(int pdgCode)
double incidentEnergy
Definition: TimingSD.h:109
G4ThreeVector hitPointExit
Definition: TimingSD.h:99
G4ThreeVector hitPoint
Definition: TimingSD.h:98
int primaryID
Definition: TimingSD.h:95
bool TimingSD::hitExists ( const G4Step *  aStep)
private

Definition at line 161 of file TimingSD.cc.

References checkHit(), currentHit, runEdmFileComparison::found, BscG4Hit::getTimeSliceID(), BscG4Hit::getUnitID(), previousUnitID, theHC, tsID, tSliceID, unitID, and updateHit().

Referenced by getGlobalEntryPoint(), and ProcessHits().

161  {
162 
163  if(!currentHit) { return false; }
164 
165  // Update if in the same detector and time-slice
166  if (tSliceID == tsID && unitID == previousUnitID) {
167  updateHit();
168  return true;
169  }
170 
171  //look in the HitContainer whether a hit with the same primID, unitID,
172  //tSliceID already exists:
173 
174  bool found = false;
175  for (int j=0; j<theHC->entries(); ++j) {
176  BscG4Hit* aHit = (*theHC)[j];
177  if (aHit->getTimeSliceID() == tSliceID && aHit->getUnitID() == unitID) {
178  if(checkHit(aStep, aHit)) {
179  currentHit = aHit;
180  found = true;
181  break;
182  }
183  }
184  }
185  if (found) { updateHit(); }
186  return found;
187 }
uint32_t previousUnitID
Definition: TimingSD.h:90
virtual bool checkHit(const G4Step *, BscG4Hit *)
Definition: TimingSD.cc:189
BscG4Hit * currentHit
Definition: TimingSD.h:85
int getTimeSliceID() const
Definition: BscG4Hit.h:58
int tsID
Definition: TimingSD.h:94
int tSliceID
Definition: TimingSD.h:96
uint32_t unitID
Definition: TimingSD.h:90
void updateHit()
Definition: TimingSD.cc:282
BscG4HitCollection * theHC
Definition: TimingSD.h:83
uint32_t getUnitID() const
Definition: BscG4Hit.h:53
void TimingSD::Initialize ( G4HCofThisEvent *  HCE)
override

Definition at line 59 of file TimingSD.cc.

References ecaldqm::collectionName, energyCut, energyHistoryCut, GeV, hcID, primID, theHC, timeFactor, and tsID.

59  {
60 
61  edm::LogVerbatim("TimingSim")
62  << "TimingSD : Initialize called for " << GetName()
63  << " time slice factor " << timeFactor
64  << "\n MC truth cuts in are " << energyCut/CLHEP::GeV
65  << " GeV and " << energyHistoryCut/CLHEP::GeV << " GeV";
66 
67  theHC = new BscG4HitCollection(GetName(), collectionName[0]);
68  if (hcID<0) {
69  hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
70  }
71  HCE->AddHitsCollection(hcID, theHC);
72 
73  tsID = -2;
74  primID = -2;
75 }
const double GeV
Definition: MathUtil.h:16
double timeFactor
Definition: TimingSD.h:104
int hcID
Definition: TimingSD.h:93
int primID
Definition: TimingSD.h:92
std::string const collectionName[nCollections]
Definition: Collections.h:47
int tsID
Definition: TimingSD.h:94
double energyHistoryCut
Definition: TimingSD.h:107
double energyCut
Definition: TimingSD.h:106
BscG4HitCollection * theHC
Definition: TimingSD.h:83
G4THitsCollection< BscG4Hit > BscG4HitCollection
void TimingSD::PrintAll ( )
override

Definition at line 332 of file TimingSD.cc.

References LogDebug, and theHC.

332  {
333  LogDebug("TimingSim") << "TimingSD: Collection " << theHC->GetName() << "\n";
334  theHC->PrintAllHits();
335 }
#define LogDebug(id)
BscG4HitCollection * theHC
Definition: TimingSD.h:83
bool TimingSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
overridevirtual

Implements SensitiveDetector.

Definition at line 99 of file TimingSD.cc.

References createNewHit(), edeposit, f, getStepInfo(), and hitExists().

99  {
100 
101  edeposit = aStep->GetTotalEnergyDeposit();
102  if (edeposit>0.f){
103  getStepInfo(aStep);
104  if (!hitExists(aStep)){
105  createNewHit(aStep);
106  }
107  }
108  return true;
109 }
void createNewHit(const G4Step *)
Definition: TimingSD.cc:228
void getStepInfo(const G4Step *)
Definition: TimingSD.cc:111
float edeposit
Definition: TimingSD.h:111
double f[11][100]
bool hitExists(const G4Step *)
Definition: TimingSD.cc:161
void TimingSD::setCuts ( double  eCut,
double  historyCut 
)
protected

Definition at line 87 of file TimingSD.cc.

References energyCut, energyHistoryCut, and GeV.

Referenced by Bcm1fSD::Bcm1fSD(), and PltSD::PltSD().

88 {
89  if(eCut > 0.) { energyCut = eCut; }
90  if(historyCut > 0.) { energyHistoryCut = historyCut; }
91 #ifdef debug
92  edm::LogVerbatim("TimingSim")
93  << "TimingSD : for " << GetName()
94  << " MC truth cuts in are " << energyCut/CLHEP::GeV
95  << " GeV and " << energyHistoryCut/CLHEP::GeV << " GeV";
96 #endif
97 }
const double GeV
Definition: MathUtil.h:16
double energyHistoryCut
Definition: TimingSD.h:107
double energyCut
Definition: TimingSD.h:106
void TimingSD::setTimeFactor ( double  val)
protected

Definition at line 77 of file TimingSD.cc.

References timeFactor.

Referenced by FastTimerSD::FastTimerSD(), and MtdSD::MtdSD().

78 {
79  if(val <= 0.0) { return; }
80 #ifdef debug
81  edm::LogVerbatim("TimingSim")
82  << "TimingSD : for " << GetName()
83  << " time slice factor is set to " << timeFactor;
84 #endif
85 }
double timeFactor
Definition: TimingSD.h:104
void TimingSD::setToLocal ( const G4StepPoint *  stepPoint,
const G4ThreeVector &  globalPoint,
G4ThreeVector &  localPoint 
)
protected

Definition at line 299 of file TimingSD.cc.

Referenced by getStepInfo().

301  {
302 
303  const G4VTouchable* touch= stepPoint->GetTouchable();
304  localPoint =
305  touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
306 }
void TimingSD::storeHit ( BscG4Hit hit)
private

Definition at line 217 of file TimingSD.cc.

References primID, and theHC.

Referenced by createNewHit(), and getGlobalEntryPoint().

217  {
218 
219  if (primID<0) return;
220  if (hit == nullptr ) {
221  edm::LogWarning("BscSim") << "BscSD: hit to be stored is NULL !!";
222  return;
223  }
224 
225  theHC->insert( hit );
226 }
int primID
Definition: TimingSD.h:92
BscG4HitCollection * theHC
Definition: TimingSD.h:83
void TimingSD::update ( const BeginOfEvent )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 341 of file TimingSD.cc.

References clearHits(), 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().

341  {
342  LogDebug("TimingSim") << " Dispatched BeginOfEvent for " << GetName();
343  clearHits();
344 }
#define LogDebug(id)
void clearHits() override
Definition: TimingSD.cc:346
void TimingSD::updateHit ( )
private

Definition at line 282 of file TimingSD.cc.

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

Referenced by createNewHit(), getGlobalEntryPoint(), and hitExists().

282  {
283 
285 
286 #ifdef debug
287  edm::LogVerbatim("TimingSim")
288  << "updateHit: " << GetName() << " add eloss(GeV) " << edeposit
289  << "CurrentHit=" << currentHit
290  << ", PostStepPoint= " << postStepPoint->GetPosition();
291 #endif
292 
293  // buffer for next steps:
294  tsID = tSliceID;
295  primID = primaryID;
297 }
uint32_t previousUnitID
Definition: TimingSD.h:90
float edepositHAD
Definition: TimingSD.h:112
int primID
Definition: TimingSD.h:92
BscG4Hit * currentHit
Definition: TimingSD.h:85
float edepositEM
Definition: TimingSD.h:112
int tsID
Definition: TimingSD.h:94
float edeposit
Definition: TimingSD.h:111
int tSliceID
Definition: TimingSD.h:96
void addEnergyDeposit(float em, float hd)
Definition: BSCG4Hit.cc:112
uint32_t unitID
Definition: TimingSD.h:90
const G4StepPoint * postStepPoint
Definition: TimingSD.h:88
int primaryID
Definition: TimingSD.h:95

Member Data Documentation

BscG4Hit* TimingSD::currentHit
private

Definition at line 85 of file TimingSD.h.

Referenced by createNewHit(), hitExists(), and updateHit().

float TimingSD::edeposit
private

Definition at line 111 of file TimingSD.h.

Referenced by getStepInfo(), ProcessHits(), and updateHit().

float TimingSD::edepositEM
private

Definition at line 112 of file TimingSD.h.

Referenced by getStepInfo(), and updateHit().

float TimingSD::edepositHAD
private

Definition at line 112 of file TimingSD.h.

Referenced by getStepInfo(), and updateHit().

double TimingSD::energyCut
private

Definition at line 106 of file TimingSD.h.

Referenced by getStepInfo(), Initialize(), and setCuts().

double TimingSD::energyHistoryCut
private

Definition at line 107 of file TimingSD.h.

Referenced by getStepInfo(), Initialize(), and setCuts().

int TimingSD::hcID
private

Definition at line 93 of file TimingSD.h.

Referenced by Initialize().

G4ThreeVector TimingSD::hitPoint
private

Definition at line 98 of file TimingSD.h.

Referenced by checkHit(), createNewHit(), getGlobalEntryPoint(), and getStepInfo().

G4ThreeVector TimingSD::hitPointExit
private

Definition at line 99 of file TimingSD.h.

Referenced by getStepInfo().

G4ThreeVector TimingSD::hitPointLocal
private

Definition at line 100 of file TimingSD.h.

Referenced by checkHit(), createNewHit(), getLocalEntryPoint(), and getStepInfo().

G4ThreeVector TimingSD::hitPointLocalExit
private

Definition at line 101 of file TimingSD.h.

Referenced by checkHit(), createNewHit(), and getStepInfo().

double TimingSD::incidentEnergy
private

Definition at line 109 of file TimingSD.h.

Referenced by checkHit(), createNewHit(), and getStepInfo().

const G4StepPoint* TimingSD::postStepPoint
private

Definition at line 88 of file TimingSD.h.

Referenced by getStepInfo(), and updateHit().

const G4StepPoint* TimingSD::preStepPoint
private

Definition at line 87 of file TimingSD.h.

Referenced by checkHit(), createNewHit(), and getStepInfo().

uint32_t TimingSD::previousUnitID
private

Definition at line 90 of file TimingSD.h.

Referenced by hitExists(), and updateHit().

int TimingSD::primaryID
private

Definition at line 95 of file TimingSD.h.

Referenced by checkHit(), createNewHit(), getStepInfo(), and updateHit().

int TimingSD::primID
private

Definition at line 92 of file TimingSD.h.

Referenced by Initialize(), storeHit(), and updateHit().

TrackingSlaveSD* TimingSD::slave
private

Definition at line 79 of file TimingSD.h.

Referenced by clearHits(), EndOfEvent(), fillHits(), TimingSD(), and ~TimingSD().

G4ProcessTypeEnumerator* TimingSD::theEnumerator
private

Definition at line 80 of file TimingSD.h.

Referenced by checkHit(), createNewHit(), TimingSD(), and ~TimingSD().

BscG4HitCollection* TimingSD::theHC
private

Definition at line 83 of file TimingSD.h.

Referenced by EndOfEvent(), hitExists(), Initialize(), PrintAll(), and storeHit().

const SimTrackManager* TimingSD::theManager
private

Definition at line 82 of file TimingSD.h.

const G4Track* TimingSD::theTrack
private

Definition at line 86 of file TimingSD.h.

Referenced by checkHit(), createNewHit(), and getStepInfo().

double TimingSD::timeFactor
private

Definition at line 104 of file TimingSD.h.

Referenced by getStepInfo(), Initialize(), and setTimeFactor().

float TimingSD::tof
private

Definition at line 110 of file TimingSD.h.

Referenced by checkHit(), createNewHit(), and getStepInfo().

int TimingSD::tsID
private

Definition at line 94 of file TimingSD.h.

Referenced by hitExists(), Initialize(), and updateHit().

double TimingSD::tSlice
private

Definition at line 103 of file TimingSD.h.

Referenced by createNewHit(), and getStepInfo().

int TimingSD::tSliceID
private

Definition at line 96 of file TimingSD.h.

Referenced by createNewHit(), getStepInfo(), hitExists(), and updateHit().

uint32_t TimingSD::unitID
private

Definition at line 90 of file TimingSD.h.

Referenced by createNewHit(), getStepInfo(), hitExists(), and updateHit().