CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
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 (std::string, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
virtual void clear ()
 
virtual void DrawAll ()
 
virtual void EndOfEvent (G4HCofThisEvent *eventHC)
 
void fillHits (edm::PSimHitContainer &, std::string use)
 
virtual double getEnergyDeposit (G4Step *step)
 
std::vector< std::string > getNames ()
 
virtual void Initialize (G4HCofThisEvent *HCE)
 
virtual void PrintAll ()
 
virtual bool ProcessHits (G4Step *, G4TouchableHistory *)
 
virtual uint32_t setDetUnitId (G4Step *)
 
virtual ~BHMSD ()
 
- Public Member Functions inherited from SensitiveTkDetector
 SensitiveTkDetector (std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
virtual void AssignSD (const std::string &vname)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point)
 
Local3DPoint FinalStepPosition (G4Step *s, coordinates)
 
Local3DPoint InitialStepPosition (G4Step *s, coordinates)
 
std::string nameOfSD ()
 
void NaNTrap (G4Step *step)
 
void Register ()
 
 SensitiveDetector (std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
virtual ~SensitiveDetector ()
 
- Public Member Functions inherited from Observer< const BeginOfRun * >
 Observer ()
 
void slotForUpdate (const BeginOfRun *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent * >
 Observer ()
 
void slotForUpdate (const EndOfEvent *iT)
 
virtual ~Observer ()
 

Protected Attributes

float edepositEM
 
float edepositHAD
 
G4int emPDG
 
G4int epPDG
 
G4int gammaPDG
 

Private Member Functions

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

Private Attributes

BscG4HitcurrentHit
 
G4VPhysicalVolume * currentPV
 
float edeposit
 
float Eloss
 
G4ThreeVector entrancePoint
 
int eventno
 
G4ThreeVector exitPoint
 
G4int hcID
 
G4ThreeVector hitPoint
 
G4ThreeVector hitPointExit
 
G4ThreeVector hitPointLocal
 
G4ThreeVector hitPointLocalExit
 
float incidentEnergy
 
std::string name
 
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

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

Detailed Description

Definition at line 35 of file BHMSD.h.

Constructor & Destructor Documentation

BHMSD::BHMSD ( 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 SensitiveDetector::AssignSD(), ecaldqm::collectionName, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, SensitiveDetectorCatalog::logicalNames(), numberingScheme, SensitiveDetector::Register(), and slave.

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

Definition at line 80 of file BHMSD.cc.

References numberingScheme, and slave.

80  {
81 
82  if (slave) delete slave;
83  if (numberingScheme) delete numberingScheme;
84 }
BHMNumberingScheme * numberingScheme
Definition: BHMSD.h:84
TrackingSlaveSD * slave
Definition: BHMSD.h:83

Member Function Documentation

void BHMSD::clear ( void  )
virtual

Definition at line 360 of file BHMSD.cc.

360  {
361 }
void BHMSD::clearHits ( )
privatevirtual

Implements SensitiveDetector.

Definition at line 398 of file BHMSD.cc.

References TrackingSlaveSD::Initialize(), and slave.

Referenced by update().

398  {
399  slave->Initialize();
400 }
TrackingSlaveSD * slave
Definition: BHMSD.h:83
virtual void Initialize()
void BHMSD::CreateNewHit ( )
private

Definition at line 234 of file BHMSD.cc.

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

Referenced by ProcessHits().

234  {
235 
236 #ifdef debug
237  LogDebug("BHMSim") << "BHMSD CreateNewHit for"
238  << " PV " << currentPV->GetName()
239  << " PVid = " << currentPV->GetCopyNo()
240  << " Unit " << unitID <<std::endl;
241  LogDebug("BHMSim") << " primary " << primaryID
242  << " time slice " << tSliceID
243  << " For Track " << theTrack->GetTrackID()
244  << " which is a " << theTrack->GetDefinition()->GetParticleName();
245 
246  if (theTrack->GetTrackID()==1) {
247  LogDebug("BHMSim") << " of energy " << theTrack->GetTotalEnergy();
248  } else {
249  LogDebug("BHMSim") << " daughter of part. " << theTrack->GetParentID();
250  }
251 
252  LogDebug("BHMSim") << " and created by " ;
253  if (theTrack->GetCreatorProcess()!=NULL)
254  LogDebug("BHMSim") << theTrack->GetCreatorProcess()->GetProcessName() ;
255  else
256  LogDebug("BHMSim") << "NO process";
257  LogDebug("BHMSim") << std::endl;
258 #endif
259 
260  currentHit = new BscG4Hit;
265 
272 
274 
277 
279  currentHit->setVx(Vx);
280  currentHit->setVy(Vy);
281  currentHit->setVz(Vz);
282 
283  currentHit->setX(X);
284  currentHit->setY(Y);
285  currentHit->setZ(Z);
286 
287  UpdateHit();
288 
290 }
#define LogDebug(id)
float Z
Definition: BHMSD.h:120
void setTof(float e)
Definition: BSCG4Hit.cc:154
float incidentEnergy
Definition: BHMSD.h:89
G4double tSlice
Definition: BHMSD.h:103
void setEntry(const G4ThreeVector &xyz)
Definition: BSCG4Hit.cc:116
float PhiAtEntry
Definition: BHMSD.h:116
void setVx(float p)
Definition: BSCG4Hit.cc:177
float Eloss
Definition: BHMSD.h:114
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:109
#define NULL
Definition: scimark2.h:8
void setUnitID(unsigned int i)
Definition: BSCG4Hit.cc:137
G4int tSliceID
Definition: BHMSD.h:102
G4ThreeVector hitPointLocal
Definition: BHMSD.h:111
void setVy(float p)
Definition: BSCG4Hit.cc:180
void setY(float t)
Definition: BSCG4Hit.cc:168
float X
Definition: BHMSD.h:120
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:119
float Vz
Definition: BHMSD.h:119
float Y
Definition: BHMSD.h:120
void setPhiAtEntry(float f)
Definition: BSCG4Hit.cc:162
uint32_t unitID
Definition: BHMSD.h:101
float Vy
Definition: BHMSD.h:119
float Tof
Definition: BHMSD.h:114
G4Track * theTrack
Definition: BHMSD.h:99
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:115
G4int primaryID
Definition: BHMSD.h:102
BscG4Hit * currentHit
Definition: BHMSD.h:98
int ParentId
Definition: BHMSD.h:118
void UpdateHit()
Definition: BHMSD.cc:293
float ThetaAtEntry
Definition: BHMSD.h:116
void setZ(float t)
Definition: BSCG4Hit.cc:171
G4ThreeVector hitPointLocalExit
Definition: BHMSD.h:112
G4VPhysicalVolume * currentPV
Definition: BHMSD.h:100
void setExitLocalP(const G4ThreeVector &xyz1)
Definition: BSCG4Hit.cc:122
float Pabs
Definition: BHMSD.h:114
void setIncidentEnergy(double e)
Definition: BSCG4Hit.cc:131
void StoreHit(BscG4Hit *)
Definition: BHMSD.cc:222
void BHMSD::DrawAll ( )
virtual

Definition at line 364 of file BHMSD.cc.

364  {
365 }
void BHMSD::EndOfEvent ( G4HCofThisEvent *  eventHC)
virtual

Reimplemented from SensitiveDetector.

Definition at line 329 of file BHMSD.cc.

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

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

Implements SensitiveTkDetector.

Definition at line 374 of file BHMSD.cc.

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

374  {
375  if (slave->name() == n) c=slave->hits();
376 }
std::string name() const
TrackingSlaveSD * slave
Definition: BHMSD.h:83
std::vector< PSimHit > & hits()
double BHMSD::getEnergyDeposit ( G4Step *  step)
virtual

Definition at line 86 of file BHMSD.cc.

Referenced by GetStepInfo().

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

Reimplemented from SensitiveDetector.

Definition at line 402 of file BHMSD.cc.

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

402  {
403  std::vector<std::string> temp;
404  temp.push_back(slave->name());
405  return temp;
406 }
std::string name() const
TrackingSlaveSD * slave
Definition: BHMSD.h:83
void BHMSD::GetStepInfo ( G4Step *  aStep)
private

Definition at line 122 of file BHMSD.cc.

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

Referenced by ProcessHits().

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("BHMSim") << " BHMSD :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() )/CLHEP::nanosecond;
146  tSliceID = (int) tSlice;
147  unitID = setDetUnitId(aStep);
148 #ifdef debug
149  LogDebug("BHMSim") << "unitID=" << unitID <<std::endl;
150 #endif
151  primaryID = theTrack->GetTrackID();
152  // Position = hitPoint;
153  Pabs = aStep->GetPreStepPoint()->GetMomentum().mag()/CLHEP::GeV;
154  Tof = aStep->GetPostStepPoint()->GetGlobalTime()/CLHEP::nanosecond;
155  Eloss = aStep->GetTotalEnergyDeposit()/CLHEP::GeV;
156  ParticleType = theTrack->GetDefinition()->GetPDGEncoding();
157  ThetaAtEntry = aStep->GetPreStepPoint()->GetPosition().theta()/CLHEP::deg;
158  PhiAtEntry = aStep->GetPreStepPoint()->GetPosition().phi()/CLHEP::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)
float Z
Definition: BHMSD.h:120
G4double tSlice
Definition: BHMSD.h:103
G4ThreeVector hitPointExit
Definition: BHMSD.h:110
const double GeV
Definition: MathUtil.h:16
float PhiAtEntry
Definition: BHMSD.h:116
float Eloss
Definition: BHMSD.h:114
G4StepPoint * preStepPoint
Definition: BHMSD.h:105
G4ThreeVector hitPoint
Definition: BHMSD.h:109
G4int tSliceID
Definition: BHMSD.h:102
G4ThreeVector hitPointLocal
Definition: BHMSD.h:111
virtual double getEnergyDeposit(G4Step *step)
Definition: BHMSD.cc:86
float X
Definition: BHMSD.h:120
float edepositEM
Definition: BHMSD.h:126
float edepositHAD
Definition: BHMSD.h:126
float Vx
Definition: BHMSD.h:119
float Vz
Definition: BHMSD.h:119
float Y
Definition: BHMSD.h:120
uint32_t unitID
Definition: BHMSD.h:101
float Vy
Definition: BHMSD.h:119
float Tof
Definition: BHMSD.h:114
G4Track * theTrack
Definition: BHMSD.h:99
float edeposit
Definition: BHMSD.h:107
G4StepPoint * postStepPoint
Definition: BHMSD.h:106
short ParticleType
Definition: BHMSD.h:115
G4int primaryID
Definition: BHMSD.h:102
G4int gammaPDG
Definition: BHMSD.h:129
int ParentId
Definition: BHMSD.h:118
float ThetaAtEntry
Definition: BHMSD.h:116
G4ThreeVector hitPointLocalExit
Definition: BHMSD.h:112
G4VPhysicalVolume * currentPV
Definition: BHMSD.h:100
float Pabs
Definition: BHMSD.h:114
G4int epPDG
Definition: BHMSD.h:128
virtual uint32_t setDetUnitId(G4Step *)
Definition: BHMSD.cc:169
G4int emPDG
Definition: BHMSD.h:127
G4bool BHMSD::HitExists ( )
private

Definition at line 174 of file BHMSD.cc.

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

Referenced by ProcessHits().

174  {
175  if (primaryID<1) {
176  edm::LogWarning("BHMSim") << "***** BHMSD error: primaryID = "
177  << primaryID
178  << " maybe detector name changed";
179  }
180 
181  // Update if in the same detector, time-slice and for same track
182  if (tSliceID == tsID && unitID==previousUnitID) {
183  UpdateHit();
184  return true;
185  }
186  // Reset entry point for new primary
187  if (primaryID != primID)
189 
190  //look in the HitContainer whether a hit with the same primID, unitID,
191  //tSliceID already exists:
192 
193  G4bool found = false;
194 
195  for (int j=0; j<theHC->entries()&&!found; j++) {
196  BscG4Hit* aPreviousHit = (*theHC)[j];
197  if (aPreviousHit->getTrackID() == primaryID &&
198  aPreviousHit->getTimeSliceID() == tSliceID &&
199  aPreviousHit->getUnitID() == unitID ) {
200  currentHit = aPreviousHit;
201  found = true;
202  }
203  }
204 
205  if (found) {
206  UpdateHit();
207  return true;
208  } else {
209  return false;
210  }
211 }
void ResetForNewPrimary()
Definition: BHMSD.cc:214
G4int getTrackID() const
Definition: BSCG4Hit.cc:133
G4int tSliceID
Definition: BHMSD.h:102
unsigned int getUnitID() const
Definition: BSCG4Hit.cc:136
int getTimeSliceID() const
Definition: BSCG4Hit.cc:141
uint32_t previousUnitID
Definition: BHMSD.h:101
G4int tsID
Definition: BHMSD.h:97
uint32_t unitID
Definition: BHMSD.h:101
int j
Definition: DBlmapReader.cc:9
G4int primaryID
Definition: BHMSD.h:102
G4int primID
Definition: BHMSD.h:90
BscG4Hit * currentHit
Definition: BHMSD.h:98
BscG4HitCollection * theHC
Definition: BHMSD.h:94
void UpdateHit()
Definition: BHMSD.cc:293
void BHMSD::Initialize ( G4HCofThisEvent *  HCE)
virtual

Reimplemented from SensitiveDetector.

Definition at line 90 of file BHMSD.cc.

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

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

Definition at line 368 of file BHMSD.cc.

References LogDebug, and theHC.

368  {
369  LogDebug("BHMSim") << "BHMSD: Collection " << theHC->GetName() << "\n";
370  theHC->PrintAllHits();
371 }
#define LogDebug(id)
BscG4HitCollection * theHC
Definition: BHMSD.h:94
bool BHMSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
virtual

Implements SensitiveDetector.

Definition at line 105 of file BHMSD.cc.

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

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

Definition at line 214 of file BHMSD.cc.

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

Referenced by HitExists().

214  {
215 
218  incidentEnergy = preStepPoint->GetKineticEnergy();
219 }
float incidentEnergy
Definition: BHMSD.h:89
G4ThreeVector hitPointExit
Definition: BHMSD.h:110
G4StepPoint * preStepPoint
Definition: BHMSD.h:105
G4ThreeVector hitPoint
Definition: BHMSD.h:109
G4ThreeVector SetToLocalExit(const G4ThreeVector &globalPoint)
Definition: BHMSD.cc:321
G4ThreeVector entrancePoint
Definition: BHMSD.h:86
G4ThreeVector SetToLocal(const G4ThreeVector &global)
Definition: BHMSD.cc:313
G4ThreeVector exitPoint
Definition: BHMSD.h:86
uint32_t BHMSD::setDetUnitId ( G4Step *  aStep)
virtual

Implements SensitiveDetector.

Definition at line 169 of file BHMSD.cc.

References BHMNumberingScheme::getUnitID(), and numberingScheme.

Referenced by GetStepInfo().

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

Definition at line 313 of file BHMSD.cc.

References preStepPoint, and theEntryPoint.

Referenced by ResetForNewPrimary().

313  {
314 
315  const G4VTouchable* touch= preStepPoint->GetTouchable();
316  theEntryPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
317  return theEntryPoint;
318 }
G4ThreeVector theEntryPoint
Definition: BHMSD.h:87
G4StepPoint * preStepPoint
Definition: BHMSD.h:105
G4ThreeVector BHMSD::SetToLocalExit ( const G4ThreeVector &  globalPoint)
private

Definition at line 321 of file BHMSD.cc.

References postStepPoint, and theExitPoint.

Referenced by ResetForNewPrimary().

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

Definition at line 222 of file BHMSD.cc.

References primID, and theHC.

Referenced by CreateNewHit().

222  {
223 
224  if (primID<0) return;
225  if (hit == 0 ) {
226  edm::LogWarning("BHMSim") << "BHMSD: hit to be stored is NULL !!";
227  return;
228  }
229 
230  theHC->insert( hit );
231 }
G4int primID
Definition: BHMSD.h:90
BscG4HitCollection * theHC
Definition: BHMSD.h:94
void BHMSD::Summarize ( )
private

Definition at line 356 of file BHMSD.cc.

Referenced by EndOfEvent().

356  {
357 }
void BHMSD::update ( const BeginOfRun )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 385 of file BHMSD.cc.

References emPDG, epPDG, and gammaPDG.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

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

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 378 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().

378  {
379  LogDebug("BHMSim") << " Dispatched BeginOfEvent for " << GetName()
380  << " !" ;
381  clearHits();
382  eventno = (*i)()->GetEventID();
383 }
#define LogDebug(id)
int eventno
Definition: BHMSD.h:122
virtual void clearHits()
Definition: BHMSD.cc:398
void BHMSD::update ( const ::EndOfEvent )
private
void BHMSD::UpdateHit ( )
private

Definition at line 293 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().

293  {
294 
295  if (Eloss > 0.) {
297 
298 #ifdef debug
299  LogDebug("BHMSim") << "updateHit: add eloss " << Eloss <<std::endl;
300  LogDebug("BHMSim") << "CurrentHit=" << currentHit
301  << ", PostStepPoint=" << postStepPoint->GetPosition();
302 #endif
304  }
305 
306  // buffer for next steps:
307  tsID = tSliceID;
308  primID = primaryID;
310 }
#define LogDebug(id)
float Eloss
Definition: BHMSD.h:114
void setEnergyLoss(float e)
Definition: BSCG4Hit.cc:155
G4int tSliceID
Definition: BHMSD.h:102
float edepositEM
Definition: BHMSD.h:126
float edepositHAD
Definition: BHMSD.h:126
uint32_t previousUnitID
Definition: BHMSD.h:101
G4int tsID
Definition: BHMSD.h:97
uint32_t unitID
Definition: BHMSD.h:101
void addEnergyDeposit(double em, double hd)
Definition: BSCG4Hit.cc:143
G4StepPoint * postStepPoint
Definition: BHMSD.h:106
G4int primaryID
Definition: BHMSD.h:102
G4int primID
Definition: BHMSD.h:90
BscG4Hit * currentHit
Definition: BHMSD.h:98

Member Data Documentation

BscG4Hit* BHMSD::currentHit
private

Definition at line 98 of file BHMSD.h.

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

G4VPhysicalVolume* BHMSD::currentPV
private

Definition at line 100 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::edeposit
private

Definition at line 107 of file BHMSD.h.

Referenced by GetStepInfo(), and ProcessHits().

float BHMSD::edepositEM
protected

Definition at line 126 of file BHMSD.h.

Referenced by GetStepInfo(), and UpdateHit().

float BHMSD::edepositHAD
protected

Definition at line 126 of file BHMSD.h.

Referenced by GetStepInfo(), and UpdateHit().

float BHMSD::Eloss
private

Definition at line 114 of file BHMSD.h.

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

G4int BHMSD::emPDG
protected

Definition at line 127 of file BHMSD.h.

Referenced by GetStepInfo(), and update().

G4ThreeVector BHMSD::entrancePoint
private

Definition at line 86 of file BHMSD.h.

Referenced by ResetForNewPrimary().

G4int BHMSD::epPDG
protected

Definition at line 128 of file BHMSD.h.

Referenced by GetStepInfo(), and update().

int BHMSD::eventno
private

Definition at line 122 of file BHMSD.h.

Referenced by update().

G4ThreeVector BHMSD::exitPoint
private

Definition at line 86 of file BHMSD.h.

Referenced by ResetForNewPrimary().

G4int BHMSD::gammaPDG
protected

Definition at line 129 of file BHMSD.h.

Referenced by GetStepInfo(), and update().

G4int BHMSD::hcID
private

Definition at line 93 of file BHMSD.h.

Referenced by Initialize().

G4ThreeVector BHMSD::hitPoint
private

Definition at line 109 of file BHMSD.h.

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

G4ThreeVector BHMSD::hitPointExit
private

Definition at line 110 of file BHMSD.h.

Referenced by GetStepInfo(), and ResetForNewPrimary().

G4ThreeVector BHMSD::hitPointLocal
private

Definition at line 111 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4ThreeVector BHMSD::hitPointLocalExit
private

Definition at line 112 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::incidentEnergy
private

Definition at line 89 of file BHMSD.h.

Referenced by CreateNewHit(), and ResetForNewPrimary().

std::string BHMSD::name
private
BHMNumberingScheme* BHMSD::numberingScheme
private

Definition at line 84 of file BHMSD.h.

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

float BHMSD::Pabs
private

Definition at line 114 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

int BHMSD::ParentId
private

Definition at line 118 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

short BHMSD::ParticleType
private

Definition at line 115 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::PhiAtEntry
private

Definition at line 116 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4StepPoint* BHMSD::postStepPoint
private

Definition at line 106 of file BHMSD.h.

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

G4StepPoint* BHMSD::preStepPoint
private

Definition at line 105 of file BHMSD.h.

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

uint32_t BHMSD::previousUnitID
private

Definition at line 101 of file BHMSD.h.

Referenced by HitExists(), and UpdateHit().

G4int BHMSD::primaryID
private

Definition at line 102 of file BHMSD.h.

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

G4int BHMSD::primID
private

Definition at line 90 of file BHMSD.h.

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

TrackingSlaveSD* BHMSD::slave
private

Definition at line 83 of file BHMSD.h.

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

G4ThreeVector BHMSD::theEntryPoint
private

Definition at line 87 of file BHMSD.h.

Referenced by SetToLocal().

G4ThreeVector BHMSD::theExitPoint
private

Definition at line 87 of file BHMSD.h.

Referenced by SetToLocalExit().

BscG4HitCollection* BHMSD::theHC
private

Definition at line 94 of file BHMSD.h.

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

const SimTrackManager* BHMSD::theManager
private

Definition at line 95 of file BHMSD.h.

float BHMSD::ThetaAtEntry
private

Definition at line 116 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4Track* BHMSD::theTrack
private

Definition at line 99 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::Tof
private

Definition at line 114 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4int BHMSD::tsID
private

Definition at line 97 of file BHMSD.h.

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

G4double BHMSD::tSlice
private

Definition at line 103 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4int BHMSD::tSliceID
private

Definition at line 102 of file BHMSD.h.

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

uint32_t BHMSD::unitID
private

Definition at line 101 of file BHMSD.h.

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

float BHMSD::Vx
private

Definition at line 119 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::Vy
private

Definition at line 119 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::Vz
private

Definition at line 119 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::X
private

Definition at line 120 of file BHMSD.h.

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

float BHMSD::Y
private

Definition at line 120 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BHMSD::Z
private

Definition at line 120 of file BHMSD.h.

Referenced by CreateNewHit(), and GetStepInfo().