CMS 3D CMS Logo

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

#include <FP420SD.h>

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

Public Member Functions

void clear () override
 
void clearHits () override
 
void DrawAll () override
 
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
void fillHits (edm::PSimHitContainer &, const std::string &) override
 
 FP420SD (const std::string &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
virtual double getEnergyDeposit (G4Step *step)
 
void Initialize (G4HCofThisEvent *HCE) override
 
void PrintAll () override
 
bool ProcessHits (G4Step *, G4TouchableHistory *) override
 
uint32_t setDetUnitId (const G4Step *) override
 
 ~FP420SD () override
 
- Public Member Functions inherited from SensitiveTkDetector
 SensitiveTkDetector (const std::string &iname, const SensitiveDetectorCatalog &clg)
 
- Public Member Functions inherited from SensitiveDetector
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
const std::vector< std::string > & getNames () const
 
void Initialize (G4HCofThisEvent *eventHC) override
 
bool isCaloSD () const
 
 SensitiveDetector (const std::string &iname, const SensitiveDetectorCatalog &, bool calo, const std::string &newcollname="")
 
 ~SensitiveDetector () override
 
- 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

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

Private Attributes

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

Additional Inherited Members

- Protected Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- 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 > &)
 
- 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 44 of file FP420SD.h.

Constructor & Destructor Documentation

◆ FP420SD()

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

Definition at line 46 of file FP420SD.cc.

References edm::ParameterSet::getUntrackedParameter(), mergeVDriftHistosByStation::name, numberingScheme, AlCaHLTBitMon_ParallelJobs::p, and slave.

50  : SensitiveTkDetector(name, clg),
51  numberingScheme(nullptr),
52  hcID(-1),
53  theHC(nullptr),
54  theManager(manager),
55  currentHit(nullptr),
56  theTrack(nullptr),
57  currentPV(nullptr),
58  unitID(0),
59  previousUnitID(0),
60  preStepPoint(nullptr),
61  postStepPoint(nullptr),
62  eventno(0) {
63  //Parameters
64  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("FP420SD");
65  int verbn = m_p.getUntrackedParameter<int>("Verbosity");
66  //int verbn = 1;
67 
68  SetVerboseLevel(verbn);
69 
70  slave = new TrackingSlaveSD(name);
71 
72  if (name == "FP420SI") {
73  if (verbn > 0) {
74  edm::LogInfo("FP420Sim") << "name = FP420SI and new FP420NumberingSchem";
75  }
77  } else {
78  edm::LogWarning("FP420Sim") << "FP420SD: ReadoutName not supported\n";
79  }
80 }
int eventno
Definition: FP420SD.h:130
TrackingSlaveSD * slave
Definition: FP420SD.h:83
G4StepPoint * preStepPoint
Definition: FP420SD.h:107
G4int hcID
Definition: FP420SD.h:92
T getUntrackedParameter(std::string const &, T const &) const
FP420G4HitCollection * theHC
Definition: FP420SD.h:93
G4Track * theTrack
Definition: FP420SD.h:98
Log< level::Info, false > LogInfo
uint32_t previousUnitID
Definition: FP420SD.h:101
G4VPhysicalVolume * currentPV
Definition: FP420SD.h:99
uint32_t unitID
Definition: FP420SD.h:101
FP420NumberingScheme * numberingScheme
Definition: FP420SD.h:84
Log< level::Warning, false > LogWarning
const SimTrackManager * theManager
Definition: FP420SD.h:94
SensitiveTkDetector(const std::string &iname, const SensitiveDetectorCatalog &clg)
G4StepPoint * postStepPoint
Definition: FP420SD.h:108
FP420G4Hit * currentHit
Definition: FP420SD.h:97

◆ ~FP420SD()

FP420SD::~FP420SD ( )
override

Definition at line 82 of file FP420SD.cc.

References numberingScheme, and slave.

82  {
83  delete slave;
84  delete numberingScheme;
85 }
TrackingSlaveSD * slave
Definition: FP420SD.h:83
FP420NumberingScheme * numberingScheme
Definition: FP420SD.h:84

Member Function Documentation

◆ clear()

void FP420SD::clear ( void  )
override

Definition at line 402 of file FP420SD.cc.

402 {}

◆ clearHits()

void FP420SD::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 441 of file FP420SD.cc.

References TrackingSlaveSD::Initialize(), and slave.

Referenced by update().

441  {
442  //AZ:
443  slave->Initialize();
444 }
TrackingSlaveSD * slave
Definition: FP420SD.h:83
virtual void Initialize()

◆ CreateNewHit()

void FP420SD::CreateNewHit ( )
private

Definition at line 233 of file FP420SD.cc.

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

Referenced by ProcessHits().

233  {
234 #ifdef debug
235  // << " MVid = " << currentPV->GetMother()->GetCopyNo()
236  LogDebug("FP420Sim") << "FP420SD CreateNewHit for"
237  << " PV " << currentPV->GetName() << " PVid = " << currentPV->GetCopyNo() << " Unit " << unitID
238  << std::endl;
239  LogDebug("FP420Sim") << " primary " << primaryID << " time slice " << tSliceID << " For Track "
240  << theTrack->GetTrackID() << " which is a " << theTrack->GetDefinition()->GetParticleName();
241 
242  if (theTrack->GetTrackID() == 1) {
243  LogDebug("FP420Sim") << " of energy " << theTrack->GetTotalEnergy();
244  } else {
245  LogDebug("FP420Sim") << " daughter of part. " << theTrack->GetParentID();
246  }
247 
248  LogDebug("FP420Sim") << " and created by ";
249  if (theTrack->GetCreatorProcess() != NULL)
250  LogDebug("FP420Sim") << theTrack->GetCreatorProcess()->GetProcessName();
251  else
252  LogDebug("FP420Sim") << "NO process";
253  LogDebug("FP420Sim") << std::endl;
254 #endif
255 
256  currentHit = new FP420G4Hit;
261 
268 
269  // currentHit->setEntry(entrancePoint);
271 
274 
276  currentHit->setVx(Vx);
277  currentHit->setVy(Vy);
278  currentHit->setVz(Vz);
279 
280  currentHit->setX(X);
281  currentHit->setY(Y);
282  currentHit->setZ(Z);
283  //AZ:12.10.2007
284  // UpdateHit();
285  // buffer for next steps:
286  tsID = tSliceID;
287  primID = primaryID;
289 
291 }
void setY(float t)
Definition: FP420G4Hit.cc:160
void setPhiAtEntry(float f)
Definition: FP420G4Hit.cc:154
float ThetaAtEntry
Definition: FP420SD.h:120
void setVz(float p)
Definition: FP420G4Hit.cc:175
void setEntry(const G4ThreeVector &xyz)
Definition: FP420G4Hit.cc:105
void setZ(float t)
Definition: FP420G4Hit.cc:163
float Pabs
Definition: FP420SD.h:115
void setPabs(float e)
Definition: FP420G4Hit.cc:144
void setVx(float p)
Definition: FP420G4Hit.cc:169
void setTrackID(int i)
Definition: FP420G4Hit.cc:123
G4int tsID
Definition: FP420SD.h:96
unsigned int primaryID
Definition: FP420SD.h:103
float Eloss
Definition: FP420SD.h:117
unsigned int primID
Definition: FP420SD.h:103
void setEnergyLoss(float e)
Definition: FP420G4Hit.cc:147
void setTof(float e)
Definition: FP420G4Hit.cc:145
float Vz
Definition: FP420SD.h:124
G4Track * theTrack
Definition: FP420SD.h:98
G4int tSliceID
Definition: FP420SD.h:102
void setTimeSlice(double d)
Definition: FP420G4Hit.cc:129
void setEntryLocalP(const G4ThreeVector &xyz1)
Definition: FP420G4Hit.cc:108
void setIncidentEnergy(double e)
Definition: FP420G4Hit.cc:120
uint32_t previousUnitID
Definition: FP420SD.h:101
G4VPhysicalVolume * currentPV
Definition: FP420SD.h:99
void setX(float t)
Definition: FP420G4Hit.cc:157
float Tof
Definition: FP420SD.h:116
void setExitLocalP(const G4ThreeVector &xyz1)
Definition: FP420G4Hit.cc:111
uint32_t unitID
Definition: FP420SD.h:101
float PhiAtEntry
Definition: FP420SD.h:121
short ParticleType
Definition: FP420SD.h:118
void setParticleType(short i)
Definition: FP420G4Hit.cc:148
void setThetaAtEntry(float t)
Definition: FP420G4Hit.cc:153
G4ThreeVector hitPointLocalExit
Definition: FP420SD.h:114
G4double tSlice
Definition: FP420SD.h:105
float incidentEnergy
Definition: FP420SD.h:90
void setUnitID(unsigned int i)
Definition: FP420G4Hit.cc:126
int ParentId
Definition: FP420SD.h:123
float Z
Definition: FP420SD.h:125
float Vy
Definition: FP420SD.h:124
void setParentId(int p)
Definition: FP420G4Hit.cc:166
float X
Definition: FP420SD.h:125
FP420G4Hit * currentHit
Definition: FP420SD.h:97
G4ThreeVector hitPointLocal
Definition: FP420SD.h:113
G4ThreeVector hitPoint
Definition: FP420SD.h:111
float Y
Definition: FP420SD.h:125
void StoreHit(FP420G4Hit *)
Definition: FP420SD.cc:223
void setVy(float p)
Definition: FP420G4Hit.cc:172
#define LogDebug(id)
float Vx
Definition: FP420SD.h:124

◆ DrawAll()

void FP420SD::DrawAll ( )
override

Definition at line 404 of file FP420SD.cc.

404 {}

◆ EndOfEvent()

void FP420SD::EndOfEvent ( G4HCofThisEvent *  eventHC)
override

Definition at line 326 of file FP420SD.cc.

References FP420G4Hit::getEnergyLoss(), FP420G4Hit::getEntry(), FP420G4Hit::getEntryLocalP(), FP420G4Hit::getExitLocalP(), FP420G4Hit::getPabs(), FP420G4Hit::getParticleType(), FP420G4Hit::getPhiAtEntry(), FP420G4Hit::getThetaAtEntry(), FP420G4Hit::getTof(), FP420G4Hit::getTrackID(), FP420G4Hit::getUnitID(), dqmiolumiharvest::j, LogDebug, TrackingDataMCValidation_Standalone_cff::nhits, TrackingSlaveSD::processHits(), slave, Summarize(), and theHC.

326  {
327  // here we loop over transient hits and make them persistent
328 
329  // if(theHC->entries() > 100){
330  // LogDebug("FP420Sim") << "FP420SD: warning!!! Number of hits exceed 100 and =" << theHC->entries() << "\n";
331  // }
332  // for (int j=0; j<theHC->entries() && j<100; j++) {
333  int nhitsHPS240 = 0;
334  int nhitsFP420 = 0;
335  int nhits = theHC->entries();
336  for (int j = 0; j < nhits; j++) {
337  FP420G4Hit* aHit = (*theHC)[j];
338  if ((fabs(aHit->getTof()) > 780. && fabs(aHit->getTof()) < 840.))
339  ++nhitsHPS240;
340  if ((fabs(aHit->getTof()) > 1380. && fabs(aHit->getTof()) < 1450.))
341  ++nhitsFP420;
342  // if(fabs(aHit->getTof()) < 1700.) {
343  if ((fabs(aHit->getTof()) > 780. && fabs(aHit->getTof()) < 840. && nhitsHPS240 < 200.) ||
344  (fabs(aHit->getTof()) > 1380. && fabs(aHit->getTof()) < 1450. && nhitsFP420 < 200.)) {
345 #ifdef ddebug
346  // LogDebug("FP420SD") << " FP420Hit " << j << " " << *aHit << std::endl;
347  LogDebug("FP420Sim") << "hit number" << j << "unit ID = " << aHit->getUnitID() << "\n";
348  LogDebug("FP420Sim") << "entry z " << aHit->getEntry().z() << "\n";
349  LogDebug("FP420Sim") << "entr theta " << aHit->getThetaAtEntry() << "\n";
350 #endif
351 
352  // Local3DPoint locExitPoint(0,0,0);
353  // Local3DPoint locEntryPoint(aHit->getEntry().x(),
354  // aHit->getEntry().y(),
355  // aHit->getEntry().z());
356  Local3DPoint locExitPoint(aHit->getExitLocalP().x(), aHit->getExitLocalP().y(), aHit->getExitLocalP().z());
357  Local3DPoint locEntryPoint(aHit->getEntryLocalP().x(), aHit->getEntryLocalP().y(), aHit->getEntryLocalP().z());
358  // implicit conversion (slicing) to PSimHit!!!
359  slave->processHits(PSimHit(locEntryPoint,
360  locExitPoint, //entryPoint(), exitPoint() Local3DPoint
361  aHit->getPabs(), // pabs() float
362  aHit->getTof(), // tof() float
363  aHit->getEnergyLoss(), // energyLoss() float
364  aHit->getParticleType(), // particleType() int
365  aHit->getUnitID(), // detUnitId() unsigned int
366  aHit->getTrackID(), // trackId() unsigned int
367  aHit->getThetaAtEntry(), // thetaAtEntry() float
368  aHit->getPhiAtEntry())); // phiAtEntry() float
369 
370  //PSimHit( const Local3DPoint& entry, const Local3DPoint& exit,
371  // float pabs, float tof, float eloss, int particleType,
372  // unsigned int detId, unsigned int trackId,
373  // float theta, float phi, unsigned short processType=0) :
374 
375  // LocalVector direction = hit.exitPoint() - hit.entryPoint();
376  //hit.energyLoss
377 
378  /*
379  aHit->getEM(), -
380  aHit->getHadr(), -
381  aHit->getIncidentEnergy(), -
382  aHit->getTimeSlice(), -
383  aHit->getEntry(), -
384  aHit->getParentId(),
385  aHit->getEntryLocalP(), -
386  aHit->getExitLocalP(), -
387  aHit->getX(), -
388  aHit->getY(), -
389  aHit->getZ(), -
390  aHit->getVx(), -
391  aHit->getVy(), -
392  aHit->getVz())); -
393  */
394  } //if Tof<1600. if nhits<100
395  } // for loop on hits
396 
397  Summarize();
398 }
float getThetaAtEntry() const
Definition: FP420G4Hit.cc:150
TrackingSlaveSD * slave
Definition: FP420SD.h:83
unsigned int getUnitID() const
Definition: FP420G4Hit.cc:125
G4ThreeVector getEntry() const
Definition: FP420G4Hit.cc:104
FP420G4HitCollection * theHC
Definition: FP420SD.h:93
unsigned int getTrackID() const
Definition: FP420G4Hit.cc:122
void Summarize()
Definition: FP420SD.cc:400
int getParticleType() const
Definition: FP420G4Hit.cc:142
G4ThreeVector getEntryLocalP() const
Definition: FP420G4Hit.cc:107
float getTof() const
Definition: FP420G4Hit.cc:140
float getPhiAtEntry() const
Definition: FP420G4Hit.cc:151
float getPabs() const
Definition: FP420G4Hit.cc:139
virtual bool processHits(const PSimHit &)
float getEnergyLoss() const
Definition: FP420G4Hit.cc:141
G4ThreeVector getExitLocalP() const
Definition: FP420G4Hit.cc:110
#define LogDebug(id)

◆ fillHits()

void FP420SD::fillHits ( edm::PSimHitContainer cc,
const std::string &  hname 
)
overridevirtual

Implements SensitiveTkDetector.

Definition at line 419 of file FP420SD.cc.

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

419  {
420  if (slave->name() == hname) {
421  cc = slave->hits();
422  }
423 }
std::string name() const
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
TrackingSlaveSD * slave
Definition: FP420SD.h:83
std::vector< PSimHit > & hits()

◆ getEnergyDeposit()

double FP420SD::getEnergyDeposit ( G4Step *  step)
virtual

Definition at line 87 of file FP420SD.cc.

Referenced by GetStepInfo().

87 { return aStep->GetTotalEnergyDeposit(); }

◆ GetStepInfo()

void FP420SD::GetStepInfo ( G4Step *  aStep)
private

Definition at line 126 of file FP420SD.cc.

References currentPV, edeposit, edepositEM, edepositHAD, Eloss, emPDG, epPDG, gammaPDG, getEnergyDeposit(), hitPoint, hitPointExit, hitPointLocal, hitPointLocalExit, createfilelist::int, 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().

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

◆ HitExists()

G4bool FP420SD::HitExists ( )
private

Definition at line 175 of file FP420SD.cc.

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

Referenced by ProcessHits().

175  {
176  if (primaryID < 1) {
177  edm::LogWarning("FP420Sim") << "***** FP420SD error: primaryID = " << primaryID << " maybe detector name changed";
178  }
179 
180  // Update if in the same detector, time-slice and for same track
181  // if (primaryID == primID && tSliceID == tsID && unitID==previousUnitID) {
182  if (tSliceID == tsID && unitID == previousUnitID) {
183  //AZ:
184  UpdateHit();
185  return true;
186  }
187  // Reset entry point for new primary
188  if (primaryID != primID)
190 
191  //look in the HitContainer whether a hit with the same primID, unitID,
192  //tSliceID already exists:
193 
194  G4bool found = false;
195 
196  // LogDebug("FP420Sim") << "FP420SD: HCollection= " << theHC->entries() <<std::endl;
197  int nhits = theHC->entries();
198  for (int j = 0; j < nhits && !found; j++) {
199  FP420G4Hit* aPreviousHit = (*theHC)[j];
200  if (aPreviousHit->getTrackID() == primaryID && aPreviousHit->getTimeSliceID() == tSliceID &&
201  aPreviousHit->getUnitID() == unitID) {
202  //AZ:
203  currentHit = aPreviousHit;
204  found = true;
205  }
206  }
207 
208  if (found) {
209  //AZ:
210  UpdateHit();
211  return true;
212  } else {
213  return false;
214  }
215 }
void ResetForNewPrimary()
Definition: FP420SD.cc:217
unsigned int getUnitID() const
Definition: FP420G4Hit.cc:125
G4int tsID
Definition: FP420SD.h:96
unsigned int primaryID
Definition: FP420SD.h:103
unsigned int primID
Definition: FP420SD.h:103
int getTimeSliceID() const
Definition: FP420G4Hit.cc:130
FP420G4HitCollection * theHC
Definition: FP420SD.h:93
unsigned int getTrackID() const
Definition: FP420G4Hit.cc:122
G4int tSliceID
Definition: FP420SD.h:102
uint32_t previousUnitID
Definition: FP420SD.h:101
uint32_t unitID
Definition: FP420SD.h:101
void UpdateHit()
Definition: FP420SD.cc:293
Log< level::Warning, false > LogWarning
FP420G4Hit * currentHit
Definition: FP420SD.h:97

◆ Initialize()

void FP420SD::Initialize ( G4HCofThisEvent *  HCE)
override

Definition at line 89 of file FP420SD.cc.

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

89  {
90 #ifdef debug
91  LogDebug("FP420Sim") << "FP420SD : Initialize called for " << name << std::endl;
92 #endif
93 
94  theHC = new FP420G4HitCollection(GetName(), collectionName[0]);
95  if (hcID < 0)
96  hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
97  HCE->AddHitsCollection(hcID, theHC);
98 
99  tsID = -2;
100  // primID = -2;
101  primID = 0;
102 
104 }
G4int hcID
Definition: FP420SD.h:92
G4int tsID
Definition: FP420SD.h:96
unsigned int primID
Definition: FP420SD.h:103
FP420G4HitCollection * theHC
Definition: FP420SD.h:93
G4THitsCollection< FP420G4Hit > FP420G4HitCollection
#define LogDebug(id)

◆ PrintAll()

void FP420SD::PrintAll ( )
override

Definition at line 406 of file FP420SD.cc.

References LogDebug, and theHC.

406  {
407  LogDebug("FP420Sim") << "FP420SD: Collection " << theHC->GetName() << "\n";
408  theHC->PrintAllHits();
409 }
FP420G4HitCollection * theHC
Definition: FP420SD.h:93
#define LogDebug(id)

◆ ProcessHits()

bool FP420SD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
overridevirtual

Implements SensitiveDetector.

Definition at line 106 of file FP420SD.cc.

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

106  {
107  if (aStep == nullptr) {
108  return true;
109  } else {
110  GetStepInfo(aStep);
111  // LogDebug("FP420Sim") << edeposit <<std::endl;
112 
113  //AZ
114 #ifdef debug
115  LogDebug("FP420Sim") << "FP420SD : number of hits = " << theHC->entries() << std::endl;
116 #endif
117 
118  if (HitExists() == false && edeposit > 0. && theHC->entries() < 200) {
119  CreateNewHit();
120  return true;
121  }
122  }
123  return true;
124 }
float edeposit
Definition: FP420SD.h:109
void GetStepInfo(G4Step *aStep)
Definition: FP420SD.cc:126
FP420G4HitCollection * theHC
Definition: FP420SD.h:93
void CreateNewHit()
Definition: FP420SD.cc:233
G4bool HitExists()
Definition: FP420SD.cc:175
#define LogDebug(id)

◆ ResetForNewPrimary()

void FP420SD::ResetForNewPrimary ( )
private

Definition at line 217 of file FP420SD.cc.

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

Referenced by HitExists().

217  {
220  incidentEnergy = preStepPoint->GetKineticEnergy();
221 }
G4ThreeVector SetToLocalExit(const G4ThreeVector &globalPoint)
Definition: FP420SD.cc:320
G4ThreeVector hitPointExit
Definition: FP420SD.h:112
G4StepPoint * preStepPoint
Definition: FP420SD.h:107
G4ThreeVector exitPoint
Definition: FP420SD.h:86
G4ThreeVector SetToLocal(const G4ThreeVector &global)
Definition: FP420SD.cc:314
float incidentEnergy
Definition: FP420SD.h:90
G4ThreeVector entrancePoint
Definition: FP420SD.h:86
G4ThreeVector hitPoint
Definition: FP420SD.h:111

◆ setDetUnitId()

uint32_t FP420SD::setDetUnitId ( const G4Step *  aStep)
overridevirtual

Implements SensitiveDetector.

Definition at line 171 of file FP420SD.cc.

References FP420NumberingScheme::getUnitID(), and numberingScheme.

Referenced by GetStepInfo().

171  {
172  return (numberingScheme == nullptr ? 0 : numberingScheme->getUnitID(aStep));
173 }
unsigned int getUnitID(const G4Step *aStep) const
FP420NumberingScheme * numberingScheme
Definition: FP420SD.h:84

◆ SetToLocal()

G4ThreeVector FP420SD::SetToLocal ( const G4ThreeVector &  global)
private

Definition at line 314 of file FP420SD.cc.

References preStepPoint, and theEntryPoint.

Referenced by ResetForNewPrimary().

314  {
315  const G4VTouchable* touch = preStepPoint->GetTouchable();
316  theEntryPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
317  return theEntryPoint;
318 }
G4StepPoint * preStepPoint
Definition: FP420SD.h:107
G4ThreeVector theEntryPoint
Definition: FP420SD.h:87

◆ SetToLocalExit()

G4ThreeVector FP420SD::SetToLocalExit ( const G4ThreeVector &  globalPoint)
private

Definition at line 320 of file FP420SD.cc.

References postStepPoint, and theExitPoint.

Referenced by ResetForNewPrimary().

320  {
321  const G4VTouchable* touch = postStepPoint->GetTouchable();
322  theExitPoint = touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
323  return theExitPoint;
324 }
G4ThreeVector theExitPoint
Definition: FP420SD.h:88
G4StepPoint * postStepPoint
Definition: FP420SD.h:108

◆ StoreHit()

void FP420SD::StoreHit ( FP420G4Hit hit)
private

Definition at line 223 of file FP420SD.cc.

References theHC.

Referenced by CreateNewHit().

223  {
224  // if (primID<0) return;
225  if (hit == nullptr) {
226  edm::LogWarning("FP420Sim") << "FP420SD: hit to be stored is NULL !!";
227  return;
228  }
229 
230  theHC->insert(hit);
231 }
FP420G4HitCollection * theHC
Definition: FP420SD.h:93
Log< level::Warning, false > LogWarning

◆ Summarize()

void FP420SD::Summarize ( )
private

Definition at line 400 of file FP420SD.cc.

Referenced by EndOfEvent().

400 {}

◆ update() [1/3]

void FP420SD::update ( const BeginOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun *>.

Definition at line 431 of file FP420SD.cc.

References emPDG, epPDG, gammaPDG, and HiggsValidation_cfi::particleName.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

431  {
432  G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
433  G4String particleName;
434  emPDG = theParticleTable->FindParticle(particleName = "e-")->GetPDGEncoding();
435  epPDG = theParticleTable->FindParticle(particleName = "e+")->GetPDGEncoding();
436  gammaPDG = theParticleTable->FindParticle(particleName = "gamma")->GetPDGEncoding();
437 }
G4int emPDG
Definition: FP420SD.h:134
G4int gammaPDG
Definition: FP420SD.h:136
G4int epPDG
Definition: FP420SD.h:135

◆ update() [2/3]

void FP420SD::update ( const BeginOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent *>.

Definition at line 425 of file FP420SD.cc.

References clearHits(), eventno, and LogDebug.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

425  {
426  LogDebug("ForwardSim") << " Dispatched BeginOfEvent for " << GetName() << " !";
427  clearHits();
428  eventno = (*i)()->GetEventID();
429 }
int eventno
Definition: FP420SD.h:130
void clearHits() override
Definition: FP420SD.cc:441
#define LogDebug(id)

◆ update() [3/3]

void FP420SD::update ( const ::EndOfEvent )
overrideprivate

◆ UpdateHit()

void FP420SD::UpdateHit ( )
private

Definition at line 293 of file FP420SD.cc.

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

Referenced by HitExists().

293  {
294  //
295  if (Eloss > 0.) {
297 
298 #ifdef debug
299  LogDebug("FP420Sim") << "updateHit: add eloss " << Eloss << std::endl;
300  LogDebug("FP420Sim") << "CurrentHit=" << currentHit << ", PostStepPoint=" << postStepPoint->GetPosition()
301  << std::endl;
302 #endif
303  //AZ
304  // currentHit->setEnergyLoss(Eloss);
306  }
307 
308  // buffer for next steps:
309  tsID = tSliceID;
310  primID = primaryID;
312 }
void addEnergyDeposit(double em, double hd)
Definition: FP420G4Hit.cc:132
G4int tsID
Definition: FP420SD.h:96
unsigned int primaryID
Definition: FP420SD.h:103
float Eloss
Definition: FP420SD.h:117
unsigned int primID
Definition: FP420SD.h:103
float edepositHAD
Definition: FP420SD.h:133
G4int tSliceID
Definition: FP420SD.h:102
uint32_t previousUnitID
Definition: FP420SD.h:101
uint32_t unitID
Definition: FP420SD.h:101
float edepositEM
Definition: FP420SD.h:133
G4StepPoint * postStepPoint
Definition: FP420SD.h:108
FP420G4Hit * currentHit
Definition: FP420SD.h:97
void addEnergyLoss(float e)
Definition: FP420G4Hit.cc:146
#define LogDebug(id)

Member Data Documentation

◆ currentHit

FP420G4Hit* FP420SD::currentHit
private

Definition at line 97 of file FP420SD.h.

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

◆ currentPV

G4VPhysicalVolume* FP420SD::currentPV
private

Definition at line 99 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ edeposit

float FP420SD::edeposit
private

Definition at line 109 of file FP420SD.h.

Referenced by GetStepInfo(), and ProcessHits().

◆ edepositEM

float FP420SD::edepositEM
protected

Definition at line 133 of file FP420SD.h.

Referenced by GetStepInfo(), and UpdateHit().

◆ edepositHAD

float FP420SD::edepositHAD
protected

Definition at line 133 of file FP420SD.h.

Referenced by GetStepInfo(), and UpdateHit().

◆ Eloss

float FP420SD::Eloss
private

Definition at line 117 of file FP420SD.h.

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

◆ emPDG

G4int FP420SD::emPDG
protected

Definition at line 134 of file FP420SD.h.

Referenced by GetStepInfo(), and update().

◆ entrancePoint

G4ThreeVector FP420SD::entrancePoint
private

Definition at line 86 of file FP420SD.h.

Referenced by ResetForNewPrimary().

◆ epPDG

G4int FP420SD::epPDG
protected

Definition at line 135 of file FP420SD.h.

Referenced by GetStepInfo(), and update().

◆ eventno

int FP420SD::eventno
private

Definition at line 130 of file FP420SD.h.

Referenced by update().

◆ exitPoint

G4ThreeVector FP420SD::exitPoint
private

Definition at line 86 of file FP420SD.h.

Referenced by ResetForNewPrimary().

◆ gammaPDG

G4int FP420SD::gammaPDG
protected

Definition at line 136 of file FP420SD.h.

Referenced by GetStepInfo(), and update().

◆ hcID

G4int FP420SD::hcID
private

Definition at line 92 of file FP420SD.h.

Referenced by Initialize().

◆ hitPoint

G4ThreeVector FP420SD::hitPoint
private

Definition at line 111 of file FP420SD.h.

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

◆ hitPointExit

G4ThreeVector FP420SD::hitPointExit
private

Definition at line 112 of file FP420SD.h.

Referenced by GetStepInfo(), and ResetForNewPrimary().

◆ hitPointLocal

G4ThreeVector FP420SD::hitPointLocal
private

Definition at line 113 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ hitPointLocalExit

G4ThreeVector FP420SD::hitPointLocalExit
private

Definition at line 114 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ incidentEnergy

float FP420SD::incidentEnergy
private

Definition at line 90 of file FP420SD.h.

Referenced by CreateNewHit(), and ResetForNewPrimary().

◆ numberingScheme

FP420NumberingScheme* FP420SD::numberingScheme
private

Definition at line 84 of file FP420SD.h.

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

◆ Pabs

float FP420SD::Pabs
private

Definition at line 115 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ ParentId

int FP420SD::ParentId
private

Definition at line 123 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ ParticleType

short FP420SD::ParticleType
private

Definition at line 118 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ PhiAtEntry

float FP420SD::PhiAtEntry
private

Definition at line 121 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ postStepPoint

G4StepPoint* FP420SD::postStepPoint
private

Definition at line 108 of file FP420SD.h.

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

◆ preStepPoint

G4StepPoint* FP420SD::preStepPoint
private

Definition at line 107 of file FP420SD.h.

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

◆ previousUnitID

uint32_t FP420SD::previousUnitID
private

Definition at line 101 of file FP420SD.h.

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

◆ primaryID

unsigned int FP420SD::primaryID
private

Definition at line 103 of file FP420SD.h.

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

◆ primID

unsigned int FP420SD::primID
private

Definition at line 103 of file FP420SD.h.

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

◆ slave

TrackingSlaveSD* FP420SD::slave
private

Definition at line 83 of file FP420SD.h.

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

◆ theEntryPoint

G4ThreeVector FP420SD::theEntryPoint
private

Definition at line 87 of file FP420SD.h.

Referenced by SetToLocal().

◆ theExitPoint

G4ThreeVector FP420SD::theExitPoint
private

Definition at line 88 of file FP420SD.h.

Referenced by SetToLocalExit().

◆ theHC

FP420G4HitCollection* FP420SD::theHC
private

Definition at line 93 of file FP420SD.h.

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

◆ theManager

const SimTrackManager* FP420SD::theManager
private

Definition at line 94 of file FP420SD.h.

◆ ThetaAtEntry

float FP420SD::ThetaAtEntry
private

Definition at line 120 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ theTrack

G4Track* FP420SD::theTrack
private

Definition at line 98 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ Tof

float FP420SD::Tof
private

Definition at line 116 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ tsID

G4int FP420SD::tsID
private

Definition at line 96 of file FP420SD.h.

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

◆ tSlice

G4double FP420SD::tSlice
private

Definition at line 105 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ tSliceID

G4int FP420SD::tSliceID
private

Definition at line 102 of file FP420SD.h.

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

◆ unitID

uint32_t FP420SD::unitID
private

Definition at line 101 of file FP420SD.h.

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

◆ Vx

float FP420SD::Vx
private

Definition at line 124 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ Vy

float FP420SD::Vy
private

Definition at line 124 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ Vz

float FP420SD::Vz
private

Definition at line 124 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ X

float FP420SD::X
private

Definition at line 125 of file FP420SD.h.

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

◆ Y

float FP420SD::Y
private

Definition at line 125 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().

◆ Z

float FP420SD::Z
private

Definition at line 125 of file FP420SD.h.

Referenced by CreateNewHit(), and GetStepInfo().