CMS 3D CMS Logo

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

#include <BHMSD.h>

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

Public Member Functions

 BHMSD (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
 
 ~BHMSD () 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
 
BHMNumberingSchemenumberingScheme
 
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 BHMSD.h.

Constructor & Destructor Documentation

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

Definition at line 30 of file BHMSD.cc.

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

32  :
33  SensitiveTkDetector(name, cpv, clg, p), numberingScheme(nullptr),
34  hcID(-1), theHC(nullptr), theManager(manager), currentHit(nullptr), theTrack(nullptr),
35  currentPV(nullptr), unitID(0), previousUnitID(0), preStepPoint(nullptr),
36  postStepPoint(nullptr), eventno(0){
37 
38  //Parameters
39  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("BHMSD");
40  int verbn = m_p.getUntrackedParameter<int>("Verbosity");
41  //int verbn = 1;
42 
43  SetVerboseLevel(verbn);
44 
45  slave = new TrackingSlaveSD(name);
46 
47  if (verbn > 0) {
48  edm::LogInfo("BHMSim") << "name = " <<name <<" and new BHMNumberingScheme";
49  }
51 }
T getUntrackedParameter(std::string const &, T const &) const
BHMNumberingScheme * numberingScheme
Definition: BHMSD.h:80
G4StepPoint * preStepPoint
Definition: BHMSD.h:100
int eventno
Definition: BHMSD.h:117
TrackingSlaveSD * slave
Definition: BHMSD.h:79
uint32_t previousUnitID
Definition: BHMSD.h:96
uint32_t unitID
Definition: BHMSD.h:96
G4Track * theTrack
Definition: BHMSD.h:94
const SimTrackManager * theManager
Definition: BHMSD.h:90
G4StepPoint * postStepPoint
Definition: BHMSD.h:101
BscG4Hit * currentHit
Definition: BHMSD.h:93
BscG4HitCollection * theHC
Definition: BHMSD.h:89
G4VPhysicalVolume * currentPV
Definition: BHMSD.h:95
G4int hcID
Definition: BHMSD.h:88
SensitiveTkDetector(const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
BHMSD::~BHMSD ( )
override

Definition at line 53 of file BHMSD.cc.

References numberingScheme, and slave.

53  {
54 
55  if (slave) delete slave;
56  if (numberingScheme) delete numberingScheme;
57 }
BHMNumberingScheme * numberingScheme
Definition: BHMSD.h:80
TrackingSlaveSD * slave
Definition: BHMSD.h:79

Member Function Documentation

void BHMSD::clear ( void  )
override

Definition at line 323 of file BHMSD.cc.

323  {
324 }
void BHMSD::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 358 of file BHMSD.cc.

References TrackingSlaveSD::Initialize(), and slave.

Referenced by update().

358  {
359  slave->Initialize();
360 }
TrackingSlaveSD * slave
Definition: BHMSD.h:79
virtual void Initialize()
void BHMSD::CreateNewHit ( )
private

Definition at line 203 of file BHMSD.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().

203  {
204 
205 #ifdef debug
206  LogDebug("BHMSim") << "BHMSD CreateNewHit for"
207  << " PV " << currentPV->GetName()
208  << " PVid = " << currentPV->GetCopyNo()
209  << " Unit " << unitID <<std::endl;
210  LogDebug("BHMSim") << " primary " << primaryID
211  << " time slice " << tSliceID
212  << " For Track " << theTrack->GetTrackID()
213  << " which is a " << theTrack->GetDefinition()->GetParticleName();
214 
215  if (theTrack->GetTrackID()==1) {
216  LogDebug("BHMSim") << " of energy " << theTrack->GetTotalEnergy();
217  } else {
218  LogDebug("BHMSim") << " daughter of part. " << theTrack->GetParentID();
219  }
220 
221  LogDebug("BHMSim") << " and created by " ;
222  if (theTrack->GetCreatorProcess()!=nullptr)
223  LogDebug("BHMSim") << theTrack->GetCreatorProcess()->GetProcessName() ;
224  else
225  LogDebug("BHMSim") << "NO process";
226  LogDebug("BHMSim") << std::endl;
227 #endif
228 
229  currentHit = new BscG4Hit;
234 
241 
243 
246 
248  currentHit->setVx(Vx);
249  currentHit->setVy(Vy);
250  currentHit->setVz(Vz);
251 
252  currentHit->setX(X);
253  currentHit->setY(Y);
254  currentHit->setZ(Z);
255 
256  UpdateHit();
257 
259 }
#define LogDebug(id)
float Z
Definition: BHMSD.h:115
void setTof(float e)
Definition: BSCG4Hit.cc:154
float incidentEnergy
Definition: BHMSD.h:85
G4double tSlice
Definition: BHMSD.h:98
void setEntry(const G4ThreeVector &xyz)
Definition: BSCG4Hit.cc:116
float PhiAtEntry
Definition: BHMSD.h:111
void setVx(float p)
Definition: BSCG4Hit.cc:177
float Eloss
Definition: BHMSD.h:109
void setTrackID(int i)
Definition: BSCG4Hit.cc:134
void setEnergyLoss(float e)
Definition: BSCG4Hit.cc:155
void setParentId(int p)
Definition: BSCG4Hit.cc:174
G4ThreeVector hitPoint
Definition: BHMSD.h:104
void setUnitID(unsigned int i)
Definition: BSCG4Hit.cc:137
G4int tSliceID
Definition: BHMSD.h:97
G4ThreeVector hitPointLocal
Definition: BHMSD.h:106
void setVy(float p)
Definition: BSCG4Hit.cc:180
void setY(float t)
Definition: BSCG4Hit.cc:168
float X
Definition: BHMSD.h:115
void setThetaAtEntry(float t)
Definition: BSCG4Hit.cc:161
void setX(float t)
Definition: BSCG4Hit.cc:165
void setPabs(float e)
Definition: BSCG4Hit.cc:153
void setEntryLocalP(const G4ThreeVector &xyz1)
Definition: BSCG4Hit.cc:119
float Vx
Definition: BHMSD.h:114
float Vz
Definition: BHMSD.h:114
float Y
Definition: BHMSD.h:115
void setPhiAtEntry(float f)
Definition: BSCG4Hit.cc:162
uint32_t unitID
Definition: BHMSD.h:96
float Vy
Definition: BHMSD.h:114
float Tof
Definition: BHMSD.h:109
G4Track * theTrack
Definition: BHMSD.h:94
void setTimeSlice(double d)
Definition: BSCG4Hit.cc:140
void setParticleType(short i)
Definition: BSCG4Hit.cc:156
void setVz(float p)
Definition: BSCG4Hit.cc:183
short ParticleType
Definition: BHMSD.h:110
G4int primaryID
Definition: BHMSD.h:97
BscG4Hit * currentHit
Definition: BHMSD.h:93
int ParentId
Definition: BHMSD.h:113
void UpdateHit()
Definition: BHMSD.cc:261
float ThetaAtEntry
Definition: BHMSD.h:111
void setZ(float t)
Definition: BSCG4Hit.cc:171
G4ThreeVector hitPointLocalExit
Definition: BHMSD.h:107
G4VPhysicalVolume * currentPV
Definition: BHMSD.h:95
void setExitLocalP(const G4ThreeVector &xyz1)
Definition: BSCG4Hit.cc:122
float Pabs
Definition: BHMSD.h:109
void setIncidentEnergy(double e)
Definition: BSCG4Hit.cc:131
void StoreHit(BscG4Hit *)
Definition: BHMSD.cc:192
void BHMSD::DrawAll ( )
override

Definition at line 326 of file BHMSD.cc.

326  {
327 }
void BHMSD::EndOfEvent ( G4HCofThisEvent *  eventHC)
override

Definition at line 294 of file BHMSD.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.

294  {
295 
296  // here we loop over transient hits and make them persistent
297  for (int j=0; j<theHC->entries(); j++) {
298  BscG4Hit* aHit = (*theHC)[j];
299  LogDebug("BHMSim") << "hit number" << j << "unit ID = "<<aHit->getUnitID()<< "\n";
300  LogDebug("BHMSim") << "entry z " << aHit->getEntry().z()<< "\n";
301  LogDebug("BHMSim") << "entr theta " << aHit->getThetaAtEntry()<< "\n";
302 
303  Local3DPoint locExitPoint(0,0,0);
304  Local3DPoint locEntryPoint(aHit->getEntry().x(),
305  aHit->getEntry().y(),
306  aHit->getEntry().z());
307  slave->processHits(PSimHit(locEntryPoint,locExitPoint,
308  aHit->getPabs(),
309  aHit->getTof(),
310  aHit->getEnergyLoss(),
311  aHit->getParticleType(),
312  aHit->getUnitID(),
313  aHit->getTrackID(),
314  aHit->getThetaAtEntry(),
315  aHit->getPhiAtEntry()));
316  }
317  Summarize();
318 }
#define LogDebug(id)
float getPhiAtEntry() const
Definition: BSCG4Hit.cc:159
int getParticleType() const
Definition: BSCG4Hit.cc:151
G4int getTrackID() const
Definition: BSCG4Hit.cc:133
float getTof() const
Definition: BSCG4Hit.cc:149
float getPabs() const
Definition: BSCG4Hit.cc:148
unsigned int getUnitID() const
Definition: BSCG4Hit.cc:136
TrackingSlaveSD * slave
Definition: BHMSD.h:79
void Summarize()
Definition: BHMSD.cc:320
float getThetaAtEntry() const
Definition: BSCG4Hit.cc:158
BscG4HitCollection * theHC
Definition: BHMSD.h:89
G4ThreeVector getEntry() const
Definition: BSCG4Hit.cc:115
virtual bool processHits(const PSimHit &)
float getEnergyLoss() const
Definition: BSCG4Hit.cc:150
void BHMSD::fillHits ( edm::PSimHitContainer cc,
const std::string &  hname 
)
overridevirtual

Implements SensitiveTkDetector.

Definition at line 334 of file BHMSD.cc.

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

334  {
335  if (slave->name() == hname) { cc=slave->hits(); }
336 }
std::string name() const
TrackingSlaveSD * slave
Definition: BHMSD.h:79
std::vector< PSimHit > & hits()
double BHMSD::getEnergyDeposit ( const G4Step *  step)

Definition at line 59 of file BHMSD.cc.

Referenced by GetStepInfo().

59  {
60  return aStep->GetTotalEnergyDeposit();
61 }
void BHMSD::GetStepInfo ( G4Step *  aStep)
private

Definition at line 95 of file BHMSD.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().

95  {
96 
97  preStepPoint = aStep->GetPreStepPoint();
98  postStepPoint= aStep->GetPostStepPoint();
99  theTrack = aStep->GetTrack();
100  hitPoint = preStepPoint->GetPosition();
101  currentPV = preStepPoint->GetPhysicalVolume();
102  hitPointExit = postStepPoint->GetPosition();
103 
104  hitPointLocal = preStepPoint->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
105  hitPointLocalExit = preStepPoint->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(hitPointExit);
106 
107 
108  G4int particleCode = theTrack->GetDefinition()->GetPDGEncoding();
109  LogDebug("BHMSim") << " BHMSD :particleType = " << theTrack->GetDefinition()->GetParticleName() <<std::endl;
110  if (particleCode == emPDG ||
111  particleCode == epPDG ||
112  particleCode == gammaPDG ) {
113  edepositEM = getEnergyDeposit(aStep); edepositHAD = 0.;
114  } else {
115  edepositEM = 0.; edepositHAD = getEnergyDeposit(aStep);
116  }
117  edeposit = aStep->GetTotalEnergyDeposit();
118  tSlice = (postStepPoint->GetGlobalTime() )/CLHEP::nanosecond;
119  tSliceID = (int) tSlice;
120  unitID = setDetUnitId(aStep);
121 #ifdef debug
122  LogDebug("BHMSim") << "unitID=" << unitID <<std::endl;
123 #endif
124  primaryID = theTrack->GetTrackID();
125  // Position = hitPoint;
126  Pabs = aStep->GetPreStepPoint()->GetMomentum().mag()/CLHEP::GeV;
127  Tof = aStep->GetPostStepPoint()->GetGlobalTime()/CLHEP::nanosecond;
128  Eloss = aStep->GetTotalEnergyDeposit()/CLHEP::GeV;
129  ParticleType = theTrack->GetDefinition()->GetPDGEncoding();
130  ThetaAtEntry = aStep->GetPreStepPoint()->GetPosition().theta()/CLHEP::deg;
131  PhiAtEntry = aStep->GetPreStepPoint()->GetPosition().phi()/CLHEP::deg;
132 
133  ParentId = theTrack->GetParentID();
134  Vx = theTrack->GetVertexPosition().x();
135  Vy = theTrack->GetVertexPosition().y();
136  Vz = theTrack->GetVertexPosition().z();
137  X = hitPoint.x();
138  Y = hitPoint.y();
139  Z = hitPoint.z();
140 }
#define LogDebug(id)
float Z
Definition: BHMSD.h:115
G4double tSlice
Definition: BHMSD.h:98
G4ThreeVector hitPointExit
Definition: BHMSD.h:105
const double GeV
Definition: MathUtil.h:16
float PhiAtEntry
Definition: BHMSD.h:111
float Eloss
Definition: BHMSD.h:109
G4StepPoint * preStepPoint
Definition: BHMSD.h:100
G4ThreeVector hitPoint
Definition: BHMSD.h:104
G4int tSliceID
Definition: BHMSD.h:97
G4ThreeVector hitPointLocal
Definition: BHMSD.h:106
float X
Definition: BHMSD.h:115
float edepositEM
Definition: BHMSD.h:121
float edepositHAD
Definition: BHMSD.h:121
float Vx
Definition: BHMSD.h:114
float Vz
Definition: BHMSD.h:114
float Y
Definition: BHMSD.h:115
uint32_t unitID
Definition: BHMSD.h:96
float Vy
Definition: BHMSD.h:114
float Tof
Definition: BHMSD.h:109
G4Track * theTrack
Definition: BHMSD.h:94
float edeposit
Definition: BHMSD.h:102
G4StepPoint * postStepPoint
Definition: BHMSD.h:101
short ParticleType
Definition: BHMSD.h:110
G4int primaryID
Definition: BHMSD.h:97
G4int gammaPDG
Definition: BHMSD.h:124
int ParentId
Definition: BHMSD.h:113
float ThetaAtEntry
Definition: BHMSD.h:111
uint32_t setDetUnitId(const G4Step *) override
Definition: BHMSD.cc:142
double getEnergyDeposit(const G4Step *step)
Definition: BHMSD.cc:59
G4ThreeVector hitPointLocalExit
Definition: BHMSD.h:107
G4VPhysicalVolume * currentPV
Definition: BHMSD.h:95
float Pabs
Definition: BHMSD.h:109
G4int epPDG
Definition: BHMSD.h:123
G4int emPDG
Definition: BHMSD.h:122
G4bool BHMSD::HitExists ( )
private

Definition at line 146 of file BHMSD.cc.

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

Referenced by ProcessHits().

146  {
147  if (primaryID<1) {
148  edm::LogWarning("BHMSim") << "***** BHMSD error: primaryID = "
149  << primaryID
150  << " maybe detector name changed";
151  }
152 
153  // Update if in the same detector, time-slice and for same track
154  if (tSliceID == tsID && unitID==previousUnitID) {
155  UpdateHit();
156  return true;
157  }
158  // Reset entry point for new primary
159  if (primaryID != primID)
161 
162  //look in the HitContainer whether a hit with the same primID, unitID,
163  //tSliceID already exists:
164 
165  G4bool found = false;
166 
167  for (int j=0; j<theHC->entries()&&!found; j++) {
168  BscG4Hit* aPreviousHit = (*theHC)[j];
169  if (aPreviousHit->getTrackID() == primaryID &&
170  aPreviousHit->getTimeSliceID() == tSliceID &&
171  aPreviousHit->getUnitID() == unitID ) {
172  currentHit = aPreviousHit;
173  found = true;
174  }
175  }
176 
177  if (found) {
178  UpdateHit();
179  return true;
180  } else {
181  return false;
182  }
183 }
void ResetForNewPrimary()
Definition: BHMSD.cc:185
G4int getTrackID() const
Definition: BSCG4Hit.cc:133
G4int tSliceID
Definition: BHMSD.h:97
unsigned int getUnitID() const
Definition: BSCG4Hit.cc:136
int getTimeSliceID() const
Definition: BSCG4Hit.cc:141
uint32_t previousUnitID
Definition: BHMSD.h:96
G4int tsID
Definition: BHMSD.h:92
uint32_t unitID
Definition: BHMSD.h:96
G4int primaryID
Definition: BHMSD.h:97
G4int primID
Definition: BHMSD.h:86
BscG4Hit * currentHit
Definition: BHMSD.h:93
BscG4HitCollection * theHC
Definition: BHMSD.h:89
void UpdateHit()
Definition: BHMSD.cc:261
void BHMSD::Initialize ( G4HCofThisEvent *  HCE)
override

Definition at line 63 of file BHMSD.cc.

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

63  {
64 #ifdef debug
65  LogDebug("BHMSim") << "BHMSD : Initialize called for " << GetName();
66 #endif
67 
68  theHC = new BscG4HitCollection(GetName(), collectionName[0]);
69  if (hcID<0)
70  hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
71  HCE->AddHitsCollection(hcID, theHC);
72 
73  tsID = -2;
74  primID = -2;
75 }
#define LogDebug(id)
std::string const collectionName[nCollections]
Definition: Collections.h:47
G4int tsID
Definition: BHMSD.h:92
G4int primID
Definition: BHMSD.h:86
BscG4HitCollection * theHC
Definition: BHMSD.h:89
G4int hcID
Definition: BHMSD.h:88
G4THitsCollection< BscG4Hit > BscG4HitCollection
void BHMSD::PrintAll ( )
override

Definition at line 329 of file BHMSD.cc.

References LogDebug, and theHC.

329  {
330  LogDebug("BHMSim") << "BHMSD: Collection " << theHC->GetName() << "\n";
331  theHC->PrintAllHits();
332 }
#define LogDebug(id)
BscG4HitCollection * theHC
Definition: BHMSD.h:89
bool BHMSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
overridevirtual

Implements SensitiveDetector.

Definition at line 78 of file BHMSD.cc.

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

78  {
79 
80  if (aStep == nullptr) {
81  return true;
82  } else {
83  GetStepInfo(aStep);
84 #ifdef debug
85  LogDebug("BHMSim") << "BHMSD : number of hits = " << theHC->entries() << std::endl;
86 #endif
87  if (HitExists() == false && edeposit>0. ){
88  CreateNewHit();
89  return true;
90  }
91  }
92  return true;
93 }
#define LogDebug(id)
void CreateNewHit()
Definition: BHMSD.cc:203
float edeposit
Definition: BHMSD.h:102
BscG4HitCollection * theHC
Definition: BHMSD.h:89
void GetStepInfo(G4Step *aStep)
Definition: BHMSD.cc:95
G4bool HitExists()
Definition: BHMSD.cc:146
void BHMSD::ResetForNewPrimary ( )
private

Definition at line 185 of file BHMSD.cc.

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

Referenced by HitExists().

185  {
186 
189  incidentEnergy = preStepPoint->GetKineticEnergy();
190 }
float incidentEnergy
Definition: BHMSD.h:85
G4ThreeVector hitPointExit
Definition: BHMSD.h:105
G4StepPoint * preStepPoint
Definition: BHMSD.h:100
G4ThreeVector hitPoint
Definition: BHMSD.h:104
G4ThreeVector SetToLocalExit(const G4ThreeVector &globalPoint)
Definition: BHMSD.cc:287
G4ThreeVector entrancePoint
Definition: BHMSD.h:82
G4ThreeVector SetToLocal(const G4ThreeVector &global)
Definition: BHMSD.cc:280
G4ThreeVector exitPoint
Definition: BHMSD.h:82
uint32_t BHMSD::setDetUnitId ( const G4Step *  aStep)
overridevirtual

Implements SensitiveDetector.

Definition at line 142 of file BHMSD.cc.

References BHMNumberingScheme::getUnitID(), and numberingScheme.

Referenced by GetStepInfo().

142  {
143  return (numberingScheme == nullptr ? 0 : numberingScheme->getUnitID(aStep));
144 }
BHMNumberingScheme * numberingScheme
Definition: BHMSD.h:80
virtual unsigned int getUnitID(const G4Step *aStep) const
G4ThreeVector BHMSD::SetToLocal ( const G4ThreeVector &  global)
private

Definition at line 280 of file BHMSD.cc.

References preStepPoint, and theEntryPoint.

Referenced by ResetForNewPrimary().

280  {
281 
282  const G4VTouchable* touch= preStepPoint->GetTouchable();
283  theEntryPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
284  return theEntryPoint;
285 }
G4ThreeVector theEntryPoint
Definition: BHMSD.h:83
G4StepPoint * preStepPoint
Definition: BHMSD.h:100
G4ThreeVector BHMSD::SetToLocalExit ( const G4ThreeVector &  globalPoint)
private

Definition at line 287 of file BHMSD.cc.

References postStepPoint, and theExitPoint.

Referenced by ResetForNewPrimary().

287  {
288 
289  const G4VTouchable* touch= postStepPoint->GetTouchable();
290  theExitPoint = touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
291  return theExitPoint;
292 }
G4ThreeVector theExitPoint
Definition: BHMSD.h:83
G4StepPoint * postStepPoint
Definition: BHMSD.h:101
void BHMSD::StoreHit ( BscG4Hit hit)
private

Definition at line 192 of file BHMSD.cc.

References primID, and theHC.

Referenced by CreateNewHit().

192  {
193 
194  if (primID<0) return;
195  if (hit == nullptr ) {
196  edm::LogWarning("BHMSim") << "BHMSD: hit to be stored is NULL !!";
197  return;
198  }
199 
200  theHC->insert( hit );
201 }
G4int primID
Definition: BHMSD.h:86
BscG4HitCollection * theHC
Definition: BHMSD.h:89
void BHMSD::Summarize ( )
private

Definition at line 320 of file BHMSD.cc.

Referenced by EndOfEvent().

320  {
321 }
void BHMSD::update ( const BeginOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 345 of file BHMSD.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().

345  {
346 
347  G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
348  G4String particleName;
349  emPDG = theParticleTable->FindParticle(particleName="e-")->GetPDGEncoding();
350  epPDG = theParticleTable->FindParticle(particleName="e+")->GetPDGEncoding();
351  gammaPDG = theParticleTable->FindParticle(particleName="gamma")->GetPDGEncoding();
352 
353 }
G4int gammaPDG
Definition: BHMSD.h:124
G4int epPDG
Definition: BHMSD.h:123
G4int emPDG
Definition: BHMSD.h:122
void BHMSD::update ( const BeginOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 338 of file BHMSD.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().

338  {
339  LogDebug("BHMSim") << " Dispatched BeginOfEvent for " << GetName()
340  << " !" ;
341  clearHits();
342  eventno = (*i)()->GetEventID();
343 }
#define LogDebug(id)
int eventno
Definition: BHMSD.h:117
void clearHits() override
Definition: BHMSD.cc:358
void BHMSD::update ( const ::EndOfEvent )
overrideprivate
void BHMSD::UpdateHit ( )
private

Definition at line 261 of file BHMSD.cc.

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

Referenced by CreateNewHit(), and HitExists().

261  {
262 
263  if (Eloss > 0.) {
265 
266 #ifdef debug
267  LogDebug("BHMSim") << "updateHit: add eloss " << Eloss <<std::endl;
268  LogDebug("BHMSim") << "CurrentHit=" << currentHit
269  << ", PostStepPoint=" << postStepPoint->GetPosition();
270 #endif
272  }
273 
274  // buffer for next steps:
275  tsID = tSliceID;
276  primID = primaryID;
278 }
#define LogDebug(id)
float Eloss
Definition: BHMSD.h:109
void setEnergyLoss(float e)
Definition: BSCG4Hit.cc:155
G4int tSliceID
Definition: BHMSD.h:97
float edepositEM
Definition: BHMSD.h:121
float edepositHAD
Definition: BHMSD.h:121
uint32_t previousUnitID
Definition: BHMSD.h:96
G4int tsID
Definition: BHMSD.h:92
uint32_t unitID
Definition: BHMSD.h:96
void addEnergyDeposit(double em, double hd)
Definition: BSCG4Hit.cc:143
G4StepPoint * postStepPoint
Definition: BHMSD.h:101
G4int primaryID
Definition: BHMSD.h:97
G4int primID
Definition: BHMSD.h:86
BscG4Hit * currentHit
Definition: BHMSD.h:93

Member Data Documentation

BscG4Hit* BHMSD::currentHit
private

Definition at line 93 of file BHMSD.h.

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

G4VPhysicalVolume* BHMSD::currentPV
private

Definition at line 95 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::edeposit
private

Definition at line 102 of file BHMSD.h.

Referenced by GetStepInfo(), and ProcessHits().

float BHMSD::edepositEM
protected

Definition at line 121 of file BHMSD.h.

Referenced by GetStepInfo(), and UpdateHit().

float BHMSD::edepositHAD
protected

Definition at line 121 of file BHMSD.h.

Referenced by GetStepInfo(), and UpdateHit().

float BHMSD::Eloss
private

Definition at line 109 of file BHMSD.h.

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

G4int BHMSD::emPDG
protected

Definition at line 122 of file BHMSD.h.

Referenced by GetStepInfo(), and update().

G4ThreeVector BHMSD::entrancePoint
private

Definition at line 82 of file BHMSD.h.

Referenced by ResetForNewPrimary().

G4int BHMSD::epPDG
protected

Definition at line 123 of file BHMSD.h.

Referenced by GetStepInfo(), and update().

int BHMSD::eventno
private

Definition at line 117 of file BHMSD.h.

Referenced by update().

G4ThreeVector BHMSD::exitPoint
private

Definition at line 82 of file BHMSD.h.

Referenced by ResetForNewPrimary().

G4int BHMSD::gammaPDG
protected

Definition at line 124 of file BHMSD.h.

Referenced by GetStepInfo(), and update().

G4int BHMSD::hcID
private

Definition at line 88 of file BHMSD.h.

Referenced by Initialize().

G4ThreeVector BHMSD::hitPoint
private

Definition at line 104 of file BHMSD.h.

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

G4ThreeVector BHMSD::hitPointExit
private

Definition at line 105 of file BHMSD.h.

Referenced by GetStepInfo(), and ResetForNewPrimary().

G4ThreeVector BHMSD::hitPointLocal
private

Definition at line 106 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4ThreeVector BHMSD::hitPointLocalExit
private

Definition at line 107 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::incidentEnergy
private

Definition at line 85 of file BHMSD.h.

Referenced by CreateNewHit(), and ResetForNewPrimary().

BHMNumberingScheme* BHMSD::numberingScheme
private

Definition at line 80 of file BHMSD.h.

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

float BHMSD::Pabs
private

Definition at line 109 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

int BHMSD::ParentId
private

Definition at line 113 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

short BHMSD::ParticleType
private

Definition at line 110 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::PhiAtEntry
private

Definition at line 111 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4StepPoint* BHMSD::postStepPoint
private

Definition at line 101 of file BHMSD.h.

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

G4StepPoint* BHMSD::preStepPoint
private

Definition at line 100 of file BHMSD.h.

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

uint32_t BHMSD::previousUnitID
private

Definition at line 96 of file BHMSD.h.

Referenced by HitExists(), and UpdateHit().

G4int BHMSD::primaryID
private

Definition at line 97 of file BHMSD.h.

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

G4int BHMSD::primID
private

Definition at line 86 of file BHMSD.h.

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

TrackingSlaveSD* BHMSD::slave
private

Definition at line 79 of file BHMSD.h.

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

G4ThreeVector BHMSD::theEntryPoint
private

Definition at line 83 of file BHMSD.h.

Referenced by SetToLocal().

G4ThreeVector BHMSD::theExitPoint
private

Definition at line 83 of file BHMSD.h.

Referenced by SetToLocalExit().

BscG4HitCollection* BHMSD::theHC
private

Definition at line 89 of file BHMSD.h.

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

const SimTrackManager* BHMSD::theManager
private

Definition at line 90 of file BHMSD.h.

float BHMSD::ThetaAtEntry
private

Definition at line 111 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4Track* BHMSD::theTrack
private

Definition at line 94 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::Tof
private

Definition at line 109 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4int BHMSD::tsID
private

Definition at line 92 of file BHMSD.h.

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

G4double BHMSD::tSlice
private

Definition at line 98 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4int BHMSD::tSliceID
private

Definition at line 97 of file BHMSD.h.

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

uint32_t BHMSD::unitID
private

Definition at line 96 of file BHMSD.h.

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

float BHMSD::Vx
private

Definition at line 114 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::Vy
private

Definition at line 114 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::Vz
private

Definition at line 114 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::X
private

Definition at line 115 of file BHMSD.h.

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

float BHMSD::Y
private

Definition at line 115 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::Z
private

Definition at line 115 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().