CMS 3D CMS Logo

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

#include <BscSD.h>

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

Public Member Functions

 BscSD (const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
void clear () override
 
void clearHits () override
 
void DrawAll () override
 
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
void fillHits (edm::PSimHitContainer &, const std::string &) override
 
double getEnergyDeposit (const G4Step *step)
 
void Initialize (G4HCofThisEvent *HCE) override
 
void PrintAll () override
 
bool ProcessHits (G4Step *, G4TouchableHistory *) override
 
uint32_t setDetUnitId (const G4Step *) override
 
 ~BscSD () 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)
 
 ~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 (BscG4Hit *)
 
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

BscG4HitcurrentHit
 
G4VPhysicalVolume * currentPV
 
float edeposit
 
float Eloss
 
G4ThreeVector entrancePoint
 
int eventno
 
G4ThreeVector exitPoint
 
G4int hcID
 
G4ThreeVector hitPoint
 
G4ThreeVector hitPointExit
 
G4ThreeVector hitPointLocal
 
G4ThreeVector hitPointLocalExit
 
float incidentEnergy
 
BscNumberingSchemenumberingScheme
 
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
 
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
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 35 of file BscSD.h.

Constructor & Destructor Documentation

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

Definition at line 45 of file BscSD.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), numberingScheme, and slave.

47  :
48  SensitiveTkDetector(name, cpv, clg, p), numberingScheme(nullptr),
49  hcID(-1), theHC(nullptr), theManager(manager), currentHit(nullptr), theTrack(nullptr),
50  currentPV(nullptr), unitID(0), previousUnitID(0), preStepPoint(nullptr),
51  postStepPoint(nullptr), eventno(0){
52 
53  //Parameters
54  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("BscSD");
55  int verbn = m_p.getUntrackedParameter<int>("Verbosity");
56  //int verbn = 1;
57 
58  SetVerboseLevel(verbn);
59 
60  slave = new TrackingSlaveSD(name);
61 
62  if (name == "BSCHits") {
63  if (verbn > 0) {
64  edm::LogInfo("BscSim") << "name = BSCHits and new BscNumberingSchem";
65  }
67  } else {
68  edm::LogWarning("BscSim") << "BscSD: ReadoutName "<<name<<" not supported";
69  }
70 }
T getUntrackedParameter(std::string const &, T const &) const
uint32_t previousUnitID
Definition: BscSD.h:96
TrackingSlaveSD * slave
Definition: BscSD.h:78
BscG4HitCollection * theHC
Definition: BscSD.h:89
G4VPhysicalVolume * currentPV
Definition: BscSD.h:95
uint32_t unitID
Definition: BscSD.h:96
G4StepPoint * preStepPoint
Definition: BscSD.h:100
G4int hcID
Definition: BscSD.h:88
G4StepPoint * postStepPoint
Definition: BscSD.h:101
BscNumberingScheme * numberingScheme
Definition: BscSD.h:79
G4Track * theTrack
Definition: BscSD.h:94
int eventno
Definition: BscSD.h:122
SensitiveTkDetector(const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
BscG4Hit * currentHit
Definition: BscSD.h:93
const SimTrackManager * theManager
Definition: BscSD.h:90
BscSD::~BscSD ( )
override

Definition at line 72 of file BscSD.cc.

References numberingScheme, and slave.

72  {
73  //AZ:
74  if (slave) delete slave;
75 
76  if (numberingScheme)
77  delete numberingScheme;
78 
79 }
TrackingSlaveSD * slave
Definition: BscSD.h:78
BscNumberingScheme * numberingScheme
Definition: BscSD.h:79

Member Function Documentation

void BscSD::clear ( void  )
override

Definition at line 360 of file BscSD.cc.

360  {
361 }
void BscSD::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 395 of file BscSD.cc.

References TrackingSlaveSD::Initialize(), and slave.

Referenced by update().

395  {
396  //AZ:
397  slave->Initialize();
398 }
TrackingSlaveSD * slave
Definition: BscSD.h:78
virtual void Initialize()
void BscSD::CreateNewHit ( )
private

Definition at line 237 of file BscSD.cc.

References currentHit, currentPV, Eloss, hitPoint, hitPointLocal, hitPointLocalExit, incidentEnergy, LogDebug, 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().

237  {
238 
239 #ifdef debug
240  LogDebug("BscSim") << "BscSD CreateNewHit for"
241  << " PV " << currentPV->GetName()
242  << " PVid = " << currentPV->GetCopyNo()
243  << " Unit " << unitID <<std::endl;
244  LogDebug("BscSim") << " primary " << primaryID
245  << " time slice " << tSliceID
246  << " For Track " << theTrack->GetTrackID()
247  << " which is a " << theTrack->GetDefinition()->GetParticleName();
248 
249  if (theTrack->GetTrackID()==1) {
250  LogDebug("BscSim") << " of energy " << theTrack->GetTotalEnergy();
251  } else {
252  LogDebug("BscSim") << " daughter of part. " << theTrack->GetParentID();
253  }
254 
255  LogDebug("BscSim") << " and created by " ;
256  if (theTrack->GetCreatorProcess()!=nullptr)
257  LogDebug("BscSim") << theTrack->GetCreatorProcess()->GetProcessName() ;
258  else
259  LogDebug("BscSim") << "NO process";
260  LogDebug("BscSim") << std::endl;
261 #endif
262 
263  currentHit = new BscG4Hit;
268 
275 
277 
280 
282  currentHit->setVx(Vx);
283  currentHit->setVy(Vy);
284  currentHit->setVz(Vz);
285 
286  currentHit->setX(X);
287  currentHit->setY(Y);
288  currentHit->setZ(Z);
289 
290  UpdateHit();
291 
293 }
#define LogDebug(id)
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
float Y
Definition: BscSD.h:118
float PhiAtEntry
Definition: BscSD.h:114
float Vx
Definition: BscSD.h:117
G4int tSliceID
Definition: BscSD.h:97
float Tof
Definition: BscSD.h:109
void setTrackID(int i)
Definition: BSCG4Hit.cc:134
void setEnergyLoss(float e)
Definition: BSCG4Hit.cc:155
int ParentId
Definition: BscSD.h:116
void setParentId(int p)
Definition: BSCG4Hit.cc:174
float X
Definition: BscSD.h:118
void setUnitID(unsigned int i)
Definition: BSCG4Hit.cc:137
float Eloss
Definition: BscSD.h:110
void setVy(float p)
Definition: BSCG4Hit.cc:180
void setY(float t)
Definition: BSCG4Hit.cc:168
G4ThreeVector hitPointLocalExit
Definition: BscSD.h:107
void UpdateHit()
Definition: BscSD.cc:295
G4VPhysicalVolume * currentPV
Definition: BscSD.h:95
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
uint32_t unitID
Definition: BscSD.h:96
G4int primaryID
Definition: BscSD.h:97
void setPhiAtEntry(float f)
Definition: BSCG4Hit.cc:162
float ThetaAtEntry
Definition: BscSD.h:113
float Z
Definition: BscSD.h:118
G4ThreeVector hitPoint
Definition: BscSD.h:104
void setTimeSlice(double d)
Definition: BSCG4Hit.cc:140
void setParticleType(short i)
Definition: BSCG4Hit.cc:156
void StoreHit(BscG4Hit *)
Definition: BscSD.cc:226
void setVz(float p)
Definition: BSCG4Hit.cc:183
short ParticleType
Definition: BscSD.h:111
float incidentEnergy
Definition: BscSD.h:85
G4Track * theTrack
Definition: BscSD.h:94
G4double tSlice
Definition: BscSD.h:98
void setZ(float t)
Definition: BSCG4Hit.cc:171
void setExitLocalP(const G4ThreeVector &xyz1)
Definition: BSCG4Hit.cc:122
float Vz
Definition: BscSD.h:117
void setIncidentEnergy(double e)
Definition: BSCG4Hit.cc:131
float Pabs
Definition: BscSD.h:108
float Vy
Definition: BscSD.h:117
G4ThreeVector hitPointLocal
Definition: BscSD.h:106
BscG4Hit * currentHit
Definition: BscSD.h:93
void BscSD::DrawAll ( )
override

Definition at line 363 of file BscSD.cc.

363  {
364 }
void BscSD::EndOfEvent ( G4HCofThisEvent *  eventHC)
override

Definition at line 330 of file BscSD.cc.

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

330  {
331 
332  // here we loop over transient hits and make them persistent
333  for (int j=0; j<theHC->entries(); j++) {
334  //AZ:
335  BscG4Hit* aHit = (*theHC)[j];
336  LogDebug("BscSim") << "hit number" << j << "unit ID = "<<aHit->getUnitID()<< "\n";
337  LogDebug("BscSim") << "entry z " << aHit->getEntry().z()<< "\n";
338  LogDebug("BscSim") << "entr theta " << aHit->getThetaAtEntry()<< "\n";
339 
340  Local3DPoint locExitPoint(0,0,0);
341  Local3DPoint locEntryPoint(aHit->getEntry().x(),
342  aHit->getEntry().y(),
343  aHit->getEntry().z());
344  slave->processHits(PSimHit(locEntryPoint,locExitPoint,
345  aHit->getPabs(),
346  aHit->getTof(),
347  aHit->getEnergyLoss(),
348  aHit->getParticleType(),
349  aHit->getUnitID(),
350  aHit->getTrackID(),
351  aHit->getThetaAtEntry(),
352  aHit->getPhiAtEntry()));
353  }
354  Summarize();
355 }
#define LogDebug(id)
void Summarize()
Definition: BscSD.cc:357
float getPhiAtEntry() const
Definition: BSCG4Hit.cc:159
TrackingSlaveSD * slave
Definition: BscSD.h:78
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
BscG4HitCollection * theHC
Definition: BscSD.h:89
unsigned int getUnitID() const
Definition: BSCG4Hit.cc:136
float getThetaAtEntry() const
Definition: BSCG4Hit.cc:158
G4ThreeVector getEntry() const
Definition: BSCG4Hit.cc:115
virtual bool processHits(const PSimHit &)
float getEnergyLoss() const
Definition: BSCG4Hit.cc:150
void BscSD::fillHits ( edm::PSimHitContainer cc,
const std::string &  hname 
)
overridevirtual

Implements SensitiveTkDetector.

Definition at line 371 of file BscSD.cc.

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

371  {
372  if (slave->name() == hname) { cc=slave->hits(); }
373 }
TrackingSlaveSD * slave
Definition: BscSD.h:78
std::string name() const
std::vector< PSimHit > & hits()
double BscSD::getEnergyDeposit ( const G4Step *  step)

Definition at line 81 of file BscSD.cc.

Referenced by GetStepInfo().

81  {
82  return aStep->GetTotalEnergyDeposit();
83 }
void BscSD::GetStepInfo ( G4Step *  aStep)
private

Definition at line 122 of file BscSD.cc.

References currentPV, edeposit, edepositEM, edepositHAD, Eloss, emPDG, epPDG, gammaPDG, getEnergyDeposit(), GeV, 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().

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

Definition at line 173 of file BscSD.cc.

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

Referenced by ProcessHits().

173  {
174  if (primaryID<1) {
175  edm::LogWarning("BscSim") << "***** BscSD error: primaryID = "
176  << primaryID
177  << " 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("BscSim") << "BscSD: HCollection= " << theHC->entries() <<std::endl;
197 
198  for (int j=0; j<theHC->entries()&&!found; j++) {
199  BscG4Hit* aPreviousHit = (*theHC)[j];
200  if (aPreviousHit->getTrackID() == primaryID &&
201  aPreviousHit->getTimeSliceID() == tSliceID &&
202  aPreviousHit->getUnitID() == unitID ) {
203  //AZ:
204  currentHit = aPreviousHit;
205  found = true;
206  }
207  }
208 
209  if (found) {
210  //AZ:
211  UpdateHit();
212  return true;
213  } else {
214  return false;
215  }
216 }
uint32_t previousUnitID
Definition: BscSD.h:96
G4int getTrackID() const
Definition: BSCG4Hit.cc:133
G4int tSliceID
Definition: BscSD.h:97
G4int primID
Definition: BscSD.h:86
BscG4HitCollection * theHC
Definition: BscSD.h:89
unsigned int getUnitID() const
Definition: BSCG4Hit.cc:136
G4int tsID
Definition: BscSD.h:92
void UpdateHit()
Definition: BscSD.cc:295
int getTimeSliceID() const
Definition: BSCG4Hit.cc:141
uint32_t unitID
Definition: BscSD.h:96
G4int primaryID
Definition: BscSD.h:97
BscG4Hit * currentHit
Definition: BscSD.h:93
void ResetForNewPrimary()
Definition: BscSD.cc:218
void BscSD::Initialize ( G4HCofThisEvent *  HCE)
override

Definition at line 85 of file BscSD.cc.

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

85  {
86 #ifdef debug
87  LogDebug("BscSim") << "BscSD : Initialize called for " << GetName();
88 #endif
89 
90  theHC = new BscG4HitCollection(GetName(), collectionName[0]);
91  if (hcID<0)
92  hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
93  HCE->AddHitsCollection(hcID, theHC);
94 
95  tsID = -2;
96  primID = -2;
97 
99 }
#define LogDebug(id)
G4int primID
Definition: BscSD.h:86
BscG4HitCollection * theHC
Definition: BscSD.h:89
G4int tsID
Definition: BscSD.h:92
std::string const collectionName[nCollections]
Definition: Collections.h:47
G4int hcID
Definition: BscSD.h:88
G4THitsCollection< BscG4Hit > BscG4HitCollection
void BscSD::PrintAll ( )
override

Definition at line 366 of file BscSD.cc.

References LogDebug, and theHC.

366  {
367  LogDebug("BscSim") << "BscSD: Collection " << theHC->GetName() << "\n";
368  theHC->PrintAllHits();
369 }
#define LogDebug(id)
BscG4HitCollection * theHC
Definition: BscSD.h:89
bool BscSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
overridevirtual

Implements SensitiveDetector.

Definition at line 101 of file BscSD.cc.

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

101  {
102 
103  if (aStep == nullptr) {
104  return true;
105  } else {
106  GetStepInfo(aStep);
107  // LogDebug("BscSim") << edeposit <<std::endl;
108 
109  //AZ
110 #ifdef debug
111  LogDebug("BscSim") << "BscSD : number of hits = " << theHC->entries() << std::endl;
112 #endif
113 
114  if (HitExists() == false && edeposit>0. ){
115  CreateNewHit();
116  return true;
117  }
118  }
119  return true;
120 }
#define LogDebug(id)
G4bool HitExists()
Definition: BscSD.cc:173
float edeposit
Definition: BscSD.h:102
void GetStepInfo(G4Step *aStep)
Definition: BscSD.cc:122
void CreateNewHit()
Definition: BscSD.cc:237
BscG4HitCollection * theHC
Definition: BscSD.h:89
void BscSD::ResetForNewPrimary ( )
private

Definition at line 218 of file BscSD.cc.

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

Referenced by HitExists().

218  {
219 
222  incidentEnergy = preStepPoint->GetKineticEnergy();
223 
224 }
G4ThreeVector SetToLocal(const G4ThreeVector &global)
Definition: BscSD.cc:315
G4StepPoint * preStepPoint
Definition: BscSD.h:100
G4ThreeVector hitPoint
Definition: BscSD.h:104
G4ThreeVector hitPointExit
Definition: BscSD.h:105
float incidentEnergy
Definition: BscSD.h:85
G4ThreeVector exitPoint
Definition: BscSD.h:81
G4ThreeVector SetToLocalExit(const G4ThreeVector &globalPoint)
Definition: BscSD.cc:322
G4ThreeVector entrancePoint
Definition: BscSD.h:81
uint32_t BscSD::setDetUnitId ( const G4Step *  aStep)
overridevirtual

Implements SensitiveDetector.

Definition at line 169 of file BscSD.cc.

References BscNumberingScheme::getUnitID(), and numberingScheme.

Referenced by GetStepInfo().

169  {
170  return (numberingScheme == nullptr ? 0 : numberingScheme->getUnitID(aStep));
171 }
virtual unsigned int getUnitID(const G4Step *aStep) const
BscNumberingScheme * numberingScheme
Definition: BscSD.h:79
G4ThreeVector BscSD::SetToLocal ( const G4ThreeVector &  global)
private

Definition at line 315 of file BscSD.cc.

References preStepPoint, and theEntryPoint.

Referenced by ResetForNewPrimary().

315  {
316 
317  const G4VTouchable* touch= preStepPoint->GetTouchable();
318  theEntryPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
319  return theEntryPoint;
320 }
G4StepPoint * preStepPoint
Definition: BscSD.h:100
G4ThreeVector theEntryPoint
Definition: BscSD.h:82
G4ThreeVector BscSD::SetToLocalExit ( const G4ThreeVector &  globalPoint)
private

Definition at line 322 of file BscSD.cc.

References postStepPoint, and theExitPoint.

Referenced by ResetForNewPrimary().

322  {
323 
324  const G4VTouchable* touch= postStepPoint->GetTouchable();
325  theExitPoint = touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
326  return theExitPoint;
327 }
G4StepPoint * postStepPoint
Definition: BscSD.h:101
G4ThreeVector theExitPoint
Definition: BscSD.h:83
void BscSD::StoreHit ( BscG4Hit hit)
private

Definition at line 226 of file BscSD.cc.

References primID, and theHC.

Referenced by CreateNewHit().

226  {
227 
228  if (primID<0) return;
229  if (hit == nullptr ) {
230  edm::LogWarning("BscSim") << "BscSD: hit to be stored is NULL !!";
231  return;
232  }
233 
234  theHC->insert( hit );
235 }
G4int primID
Definition: BscSD.h:86
BscG4HitCollection * theHC
Definition: BscSD.h:89
void BscSD::Summarize ( )
private

Definition at line 357 of file BscSD.cc.

Referenced by EndOfEvent().

357  {
358 }
void BscSD::update ( const BeginOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 382 of file BscSD.cc.

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

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

382  {
383 
384  G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
385  G4String particleName;
386  emPDG = theParticleTable->FindParticle(particleName="e-")->GetPDGEncoding();
387  epPDG = theParticleTable->FindParticle(particleName="e+")->GetPDGEncoding();
388  gammaPDG = theParticleTable->FindParticle(particleName="gamma")->GetPDGEncoding();
389 
390 }
G4int gammaPDG
Definition: BscSD.h:129
G4int emPDG
Definition: BscSD.h:127
G4int epPDG
Definition: BscSD.h:128
void BscSD::update ( const BeginOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 375 of file BscSD.cc.

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

375  {
376  LogDebug("BscSim") << " Dispatched BeginOfEvent for " << GetName()
377  << " !" ;
378  clearHits();
379  eventno = (*i)()->GetEventID();
380 }
#define LogDebug(id)
void clearHits() override
Definition: BscSD.cc:395
int eventno
Definition: BscSD.h:122
void BscSD::update ( const ::EndOfEvent )
overrideprivate
void BscSD::UpdateHit ( )
private

Definition at line 295 of file BscSD.cc.

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

Referenced by CreateNewHit(), and HitExists().

295  {
296 
297  if (Eloss > 0.) {
299 
300 #ifdef debug
301  LogDebug("BscSim") << "updateHit: add eloss " << Eloss <<std::endl;
302  LogDebug("BscSim") << "CurrentHit=" << currentHit
303  << ", PostStepPoint=" << postStepPoint->GetPosition();
304 #endif
305  //AZ
307  }
308 
309  // buffer for next steps:
310  tsID = tSliceID;
311  primID = primaryID;
313 }
#define LogDebug(id)
uint32_t previousUnitID
Definition: BscSD.h:96
G4int tSliceID
Definition: BscSD.h:97
void setEnergyLoss(float e)
Definition: BSCG4Hit.cc:155
float edepositEM
Definition: BscSD.h:126
float Eloss
Definition: BscSD.h:110
G4int primID
Definition: BscSD.h:86
G4int tsID
Definition: BscSD.h:92
uint32_t unitID
Definition: BscSD.h:96
G4int primaryID
Definition: BscSD.h:97
float edepositHAD
Definition: BscSD.h:126
void addEnergyDeposit(double em, double hd)
Definition: BSCG4Hit.cc:143
G4StepPoint * postStepPoint
Definition: BscSD.h:101
BscG4Hit * currentHit
Definition: BscSD.h:93

Member Data Documentation

BscG4Hit* BscSD::currentHit
private

Definition at line 93 of file BscSD.h.

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

G4VPhysicalVolume* BscSD::currentPV
private

Definition at line 95 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::edeposit
private

Definition at line 102 of file BscSD.h.

Referenced by GetStepInfo(), and ProcessHits().

float BscSD::edepositEM
protected

Definition at line 126 of file BscSD.h.

Referenced by GetStepInfo(), and UpdateHit().

float BscSD::edepositHAD
protected

Definition at line 126 of file BscSD.h.

Referenced by GetStepInfo(), and UpdateHit().

float BscSD::Eloss
private

Definition at line 110 of file BscSD.h.

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

G4int BscSD::emPDG
protected

Definition at line 127 of file BscSD.h.

Referenced by GetStepInfo(), and update().

G4ThreeVector BscSD::entrancePoint
private

Definition at line 81 of file BscSD.h.

Referenced by ResetForNewPrimary().

G4int BscSD::epPDG
protected

Definition at line 128 of file BscSD.h.

Referenced by GetStepInfo(), and update().

int BscSD::eventno
private

Definition at line 122 of file BscSD.h.

Referenced by update().

G4ThreeVector BscSD::exitPoint
private

Definition at line 81 of file BscSD.h.

Referenced by ResetForNewPrimary().

G4int BscSD::gammaPDG
protected

Definition at line 129 of file BscSD.h.

Referenced by GetStepInfo(), and update().

G4int BscSD::hcID
private

Definition at line 88 of file BscSD.h.

Referenced by Initialize().

G4ThreeVector BscSD::hitPoint
private

Definition at line 104 of file BscSD.h.

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

G4ThreeVector BscSD::hitPointExit
private

Definition at line 105 of file BscSD.h.

Referenced by GetStepInfo(), and ResetForNewPrimary().

G4ThreeVector BscSD::hitPointLocal
private

Definition at line 106 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4ThreeVector BscSD::hitPointLocalExit
private

Definition at line 107 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::incidentEnergy
private

Definition at line 85 of file BscSD.h.

Referenced by CreateNewHit(), and ResetForNewPrimary().

BscNumberingScheme* BscSD::numberingScheme
private

Definition at line 79 of file BscSD.h.

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

float BscSD::Pabs
private

Definition at line 108 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

int BscSD::ParentId
private

Definition at line 116 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

short BscSD::ParticleType
private

Definition at line 111 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::PhiAtEntry
private

Definition at line 114 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4StepPoint* BscSD::postStepPoint
private

Definition at line 101 of file BscSD.h.

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

G4StepPoint* BscSD::preStepPoint
private

Definition at line 100 of file BscSD.h.

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

uint32_t BscSD::previousUnitID
private

Definition at line 96 of file BscSD.h.

Referenced by HitExists(), and UpdateHit().

G4int BscSD::primaryID
private

Definition at line 97 of file BscSD.h.

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

G4int BscSD::primID
private

Definition at line 86 of file BscSD.h.

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

TrackingSlaveSD* BscSD::slave
private

Definition at line 78 of file BscSD.h.

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

G4ThreeVector BscSD::theEntryPoint
private

Definition at line 82 of file BscSD.h.

Referenced by SetToLocal().

G4ThreeVector BscSD::theExitPoint
private

Definition at line 83 of file BscSD.h.

Referenced by SetToLocalExit().

BscG4HitCollection* BscSD::theHC
private

Definition at line 89 of file BscSD.h.

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

const SimTrackManager* BscSD::theManager
private

Definition at line 90 of file BscSD.h.

float BscSD::ThetaAtEntry
private

Definition at line 113 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4Track* BscSD::theTrack
private

Definition at line 94 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::Tof
private

Definition at line 109 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4int BscSD::tsID
private

Definition at line 92 of file BscSD.h.

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

G4double BscSD::tSlice
private

Definition at line 98 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4int BscSD::tSliceID
private

Definition at line 97 of file BscSD.h.

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

uint32_t BscSD::unitID
private

Definition at line 96 of file BscSD.h.

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

float BscSD::Vx
private

Definition at line 117 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::Vy
private

Definition at line 117 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::Vz
private

Definition at line 117 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::X
private

Definition at line 118 of file BscSD.h.

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

float BscSD::Y
private

Definition at line 118 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::Z
private

Definition at line 118 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().