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
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 (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 ~BscSD ()
 
- 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
 
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

- 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 54 of file BscSD.h.

Constructor & Destructor Documentation

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

Definition at line 48 of file BscSD.cc.

References SensitiveDetector::AssignSD(), ecaldqm::collectionName, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, SensitiveDetectorCatalog::logicalNames(), numberingScheme, SensitiveDetector::Register(), and slave.

50  :
52  hcID(-1), theHC(0), theManager(manager), currentHit(0), theTrack(0),
54  postStepPoint(0), eventno(0){
55 
56  //Add Bsc Sentitive Detector Name
57  collectionName.insert(name);
58 
59 
60  //Parameters
61  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("BscSD");
62  int verbn = m_p.getUntrackedParameter<int>("Verbosity");
63  //int verbn = 1;
64 
65  SetVerboseLevel(verbn);
66  LogDebug("BscSim")
67  << "*******************************************************\n"
68  << "* *\n"
69  << "* Constructing a BscSD with name " << name << "\n"
70  << "* *\n"
71  << "*******************************************************";
72 
73 
74  slave = new TrackingSlaveSD(name);
75 
76  //
77  // attach detectors (LogicalVolumes)
78  //
79  const std::vector<std::string>& lvNames = clg.logicalNames(name);
80 
81  this->Register();
82 
83  for (std::vector<std::string>::const_iterator it=lvNames.begin();
84  it !=lvNames.end(); it++) {
85  this->AssignSD(*it);
86  edm::LogInfo("BscSim") << "BscSD : Assigns SD to LV " << (*it);
87  }
88 
89  if (name == "BSCHits") {
90  if (verbn > 0) {
91  edm::LogInfo("BscSim") << "name = BSCHits and new BscNumberingSchem";
92  }
94  } else {
95  edm::LogWarning("BscSim") << "BscSD: ReadoutName "<<name<<" not supported";
96  }
97 
98  edm::LogInfo("BscSim") << "BscSD: Instantiation completed";
99 }
#define LogDebug(id)
T getUntrackedParameter(std::string const &, T const &) const
uint32_t previousUnitID
Definition: BscSD.h:131
TrackingSlaveSD * slave
Definition: BscSD.h:110
const std::vector< std::string > & logicalNames(const std::string &readoutName) const
BscG4HitCollection * theHC
Definition: BscSD.h:123
virtual void AssignSD(const std::string &vname)
G4VPhysicalVolume * currentPV
Definition: BscSD.h:129
uint32_t unitID
Definition: BscSD.h:131
std::string const collectionName[nCollections]
Definition: Collections.h:45
G4StepPoint * preStepPoint
Definition: BscSD.h:135
std::string name
Definition: BscSD.h:121
G4int hcID
Definition: BscSD.h:122
G4StepPoint * postStepPoint
Definition: BscSD.h:136
SensitiveTkDetector(std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
BscNumberingScheme * numberingScheme
Definition: BscSD.h:111
G4Track * theTrack
Definition: BscSD.h:128
int eventno
Definition: BscSD.h:160
BscG4Hit * currentHit
Definition: BscSD.h:127
const SimTrackManager * theManager
Definition: BscSD.h:124
BscSD::~BscSD ( )
virtual

Definition at line 104 of file BscSD.cc.

References numberingScheme, and slave.

104  {
105  //AZ:
106  if (slave) delete slave;
107 
108  if (numberingScheme)
109  delete numberingScheme;
110 
111 }
TrackingSlaveSD * slave
Definition: BscSD.h:110
BscNumberingScheme * numberingScheme
Definition: BscSD.h:111

Member Function Documentation

void BscSD::clear ( void  )
virtual

Definition at line 403 of file BscSD.cc.

403  {
404 }
void BscSD::clearHits ( )
privatevirtual

Implements SensitiveDetector.

Definition at line 441 of file BscSD.cc.

References TrackingSlaveSD::Initialize(), and slave.

Referenced by update().

441  {
442  //AZ:
443  slave->Initialize();
444 }
TrackingSlaveSD * slave
Definition: BscSD.h:110
virtual void Initialize()
void BscSD::CreateNewHit ( )
private

Definition at line 275 of file BscSD.cc.

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

275  {
276 
277 #ifdef debug
278  LogDebug("BscSim") << "BscSD CreateNewHit for"
279  << " PV " << currentPV->GetName()
280  << " PVid = " << currentPV->GetCopyNo()
281  << " Unit " << unitID <<std::endl;
282  LogDebug("BscSim") << " primary " << primaryID
283  << " time slice " << tSliceID
284  << " For Track " << theTrack->GetTrackID()
285  << " which is a " << theTrack->GetDefinition()->GetParticleName();
286 
287  if (theTrack->GetTrackID()==1) {
288  LogDebug("BscSim") << " of energy " << theTrack->GetTotalEnergy();
289  } else {
290  LogDebug("BscSim") << " daughter of part. " << theTrack->GetParentID();
291  }
292 
293  LogDebug("BscSim") << " and created by " ;
294  if (theTrack->GetCreatorProcess()!=NULL)
295  LogDebug("BscSim") << theTrack->GetCreatorProcess()->GetProcessName() ;
296  else
297  LogDebug("BscSim") << "NO process";
298  LogDebug("BscSim") << std::endl;
299 #endif
300 
301  currentHit = new BscG4Hit;
306 
313 
315 
318 
320  currentHit->setVx(Vx);
321  currentHit->setVy(Vy);
322  currentHit->setVz(Vz);
323 
324  currentHit->setX(X);
325  currentHit->setY(Y);
326  currentHit->setZ(Z);
327 
328  UpdateHit();
329 
331 }
#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:154
float PhiAtEntry
Definition: BscSD.h:150
float Vx
Definition: BscSD.h:153
G4int tSliceID
Definition: BscSD.h:132
float Tof
Definition: BscSD.h:145
void setTrackID(int i)
Definition: BSCG4Hit.cc:134
void setEnergyLoss(float e)
Definition: BSCG4Hit.cc:155
int ParentId
Definition: BscSD.h:152
void setParentId(int p)
Definition: BSCG4Hit.cc:174
float X
Definition: BscSD.h:154
#define NULL
Definition: scimark2.h:8
void setUnitID(unsigned int i)
Definition: BSCG4Hit.cc:137
float Eloss
Definition: BscSD.h:146
void setVy(float p)
Definition: BSCG4Hit.cc:180
void setY(float t)
Definition: BSCG4Hit.cc:168
G4ThreeVector hitPointLocalExit
Definition: BscSD.h:143
void UpdateHit()
Definition: BscSD.cc:334
G4VPhysicalVolume * currentPV
Definition: BscSD.h:129
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:131
G4int primaryID
Definition: BscSD.h:132
void setPhiAtEntry(float f)
Definition: BSCG4Hit.cc:162
ParticleType
float ThetaAtEntry
Definition: BscSD.h:149
float Z
Definition: BscSD.h:154
G4ThreeVector hitPoint
Definition: BscSD.h:139
void setTimeSlice(double d)
Definition: BSCG4Hit.cc:140
void setParticleType(short i)
Definition: BSCG4Hit.cc:156
void StoreHit(BscG4Hit *)
Definition: BscSD.cc:263
void setVz(float p)
Definition: BSCG4Hit.cc:183
float incidentEnergy
Definition: BscSD.h:117
G4Track * theTrack
Definition: BscSD.h:128
G4double tSlice
Definition: BscSD.h:133
void setZ(float t)
Definition: BSCG4Hit.cc:171
void setExitLocalP(const G4ThreeVector &xyz1)
Definition: BSCG4Hit.cc:122
float Vz
Definition: BscSD.h:153
void setIncidentEnergy(double e)
Definition: BSCG4Hit.cc:131
float Pabs
Definition: BscSD.h:144
float Vy
Definition: BscSD.h:153
G4ThreeVector hitPointLocal
Definition: BscSD.h:142
BscG4Hit * currentHit
Definition: BscSD.h:127
void BscSD::DrawAll ( )
virtual

Definition at line 407 of file BscSD.cc.

407  {
408 }
void BscSD::EndOfEvent ( G4HCofThisEvent *  eventHC)
virtual

Reimplemented from SensitiveDetector.

Definition at line 371 of file BscSD.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.

371  {
372 
373  // here we loop over transient hits and make them persistent
374  for (int j=0; j<theHC->entries(); j++) {
375  //AZ:
376  BscG4Hit* aHit = (*theHC)[j];
377  LogDebug("BscSim") << "hit number" << j << "unit ID = "<<aHit->getUnitID()<< "\n";
378  LogDebug("BscSim") << "entry z " << aHit->getEntry().z()<< "\n";
379  LogDebug("BscSim") << "entr theta " << aHit->getThetaAtEntry()<< "\n";
380 
381  Local3DPoint locExitPoint(0,0,0);
382  Local3DPoint locEntryPoint(aHit->getEntry().x(),
383  aHit->getEntry().y(),
384  aHit->getEntry().z());
385  slave->processHits(PSimHit(locEntryPoint,locExitPoint,
386  aHit->getPabs(),
387  aHit->getTof(),
388  aHit->getEnergyLoss(),
389  aHit->getParticleType(),
390  aHit->getUnitID(),
391  aHit->getTrackID(),
392  aHit->getThetaAtEntry(),
393  aHit->getPhiAtEntry()));
394  }
395  Summarize();
396 }
#define LogDebug(id)
void Summarize()
Definition: BscSD.cc:399
float getPhiAtEntry() const
Definition: BSCG4Hit.cc:159
TrackingSlaveSD * slave
Definition: BscSD.h:110
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:123
unsigned int getUnitID() const
Definition: BSCG4Hit.cc:136
int j
Definition: DBlmapReader.cc:9
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 c,
std::string  use 
)
virtual

Implements SensitiveTkDetector.

Definition at line 417 of file BscSD.cc.

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

417  {
418  if (slave->name() == n) c=slave->hits();
419 }
TrackingSlaveSD * slave
Definition: BscSD.h:110
std::string name() const
std::vector< PSimHit > & hits()
double BscSD::getEnergyDeposit ( G4Step *  step)
virtual

Definition at line 113 of file BscSD.cc.

Referenced by GetStepInfo().

113  {
114  return aStep->GetTotalEnergyDeposit();
115 }
std::vector< std::string > BscSD::getNames ( )
virtual

Reimplemented from SensitiveDetector.

Definition at line 446 of file BscSD.cc.

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

446  {
447  std::vector<std::string> temp;
448  temp.push_back(slave->name());
449  return temp;
450 }
TrackingSlaveSD * slave
Definition: BscSD.h:110
std::string name() const
void BscSD::GetStepInfo ( G4Step *  aStep)
private

Definition at line 155 of file BscSD.cc.

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

Referenced by ProcessHits().

155  {
156 
157  preStepPoint = aStep->GetPreStepPoint();
158  postStepPoint= aStep->GetPostStepPoint();
159  theTrack = aStep->GetTrack();
160  hitPoint = preStepPoint->GetPosition();
161  currentPV = preStepPoint->GetPhysicalVolume();
162  hitPointExit = postStepPoint->GetPosition();
163 
164  hitPointLocal = preStepPoint->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
165  hitPointLocalExit = preStepPoint->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(hitPointExit);
166 
167 
168  G4int particleCode = theTrack->GetDefinition()->GetPDGEncoding();
169  LogDebug("BscSim") << " BscSD :particleType = " << theTrack->GetDefinition()->GetParticleName() <<std::endl;
170  if (particleCode == emPDG ||
171  particleCode == epPDG ||
172  particleCode == gammaPDG ) {
173  edepositEM = getEnergyDeposit(aStep); edepositHAD = 0.;
174  } else {
175  edepositEM = 0.; edepositHAD = getEnergyDeposit(aStep);
176  }
177  edeposit = aStep->GetTotalEnergyDeposit();
178  tSlice = (postStepPoint->GetGlobalTime() )/nanosecond;
179  tSliceID = (int) tSlice;
180  unitID = setDetUnitId(aStep);
181 #ifdef debug
182  LogDebug("BscSim") << "unitID=" << unitID <<std::endl;
183 #endif
184  primaryID = theTrack->GetTrackID();
185  // Position = hitPoint;
186  Pabs = aStep->GetPreStepPoint()->GetMomentum().mag()/GeV;
187  Tof = aStep->GetPostStepPoint()->GetGlobalTime()/nanosecond;
188  Eloss = aStep->GetTotalEnergyDeposit()/GeV;
189  ParticleType = theTrack->GetDefinition()->GetPDGEncoding();
190  ThetaAtEntry = aStep->GetPreStepPoint()->GetPosition().theta()/deg;
191  PhiAtEntry = aStep->GetPreStepPoint()->GetPosition().phi()/deg;
192 
193  ParentId = theTrack->GetParentID();
194  Vx = theTrack->GetVertexPosition().x();
195  Vy = theTrack->GetVertexPosition().y();
196  Vz = theTrack->GetVertexPosition().z();
197  X = hitPoint.x();
198  Y = hitPoint.y();
199  Z = hitPoint.z();
200 }
#define LogDebug(id)
G4int gammaPDG
Definition: BscSD.h:167
G4int emPDG
Definition: BscSD.h:165
G4int epPDG
Definition: BscSD.h:166
const double GeV
Definition: MathUtil.h:16
float Y
Definition: BscSD.h:154
float PhiAtEntry
Definition: BscSD.h:150
float Vx
Definition: BscSD.h:153
float edeposit
Definition: BscSD.h:137
G4int tSliceID
Definition: BscSD.h:132
float Tof
Definition: BscSD.h:145
virtual double getEnergyDeposit(G4Step *step)
Definition: BscSD.cc:113
int ParentId
Definition: BscSD.h:152
float X
Definition: BscSD.h:154
float edepositEM
Definition: BscSD.h:164
float Eloss
Definition: BscSD.h:146
G4ThreeVector hitPointLocalExit
Definition: BscSD.h:143
virtual uint32_t setDetUnitId(G4Step *)
Definition: BscSD.cc:202
G4VPhysicalVolume * currentPV
Definition: BscSD.h:129
uint32_t unitID
Definition: BscSD.h:131
G4int primaryID
Definition: BscSD.h:132
G4StepPoint * preStepPoint
Definition: BscSD.h:135
ParticleType
float ThetaAtEntry
Definition: BscSD.h:149
float Z
Definition: BscSD.h:154
float edepositHAD
Definition: BscSD.h:164
G4ThreeVector hitPoint
Definition: BscSD.h:139
G4StepPoint * postStepPoint
Definition: BscSD.h:136
G4ThreeVector hitPointExit
Definition: BscSD.h:141
G4Track * theTrack
Definition: BscSD.h:128
G4double tSlice
Definition: BscSD.h:133
float Vz
Definition: BscSD.h:153
float Pabs
Definition: BscSD.h:144
float Vy
Definition: BscSD.h:153
G4ThreeVector hitPointLocal
Definition: BscSD.h:142
G4bool BscSD::HitExists ( )
private

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

208  {
209  if (primaryID<1) {
210  edm::LogWarning("BscSim") << "***** BscSD error: primaryID = "
211  << primaryID
212  << " maybe detector name changed";
213  }
214 
215  // Update if in the same detector, time-slice and for same track
216  // if (primaryID == primID && tSliceID == tsID && unitID==previousUnitID) {
217  if (tSliceID == tsID && unitID==previousUnitID) {
218  //AZ:
219  UpdateHit();
220  return true;
221  }
222  // Reset entry point for new primary
223  if (primaryID != primID)
225 
226  //look in the HitContainer whether a hit with the same primID, unitID,
227  //tSliceID already exists:
228 
229  G4bool found = false;
230 
231  // LogDebug("BscSim") << "BscSD: HCollection= " << theHC->entries() <<std::endl;
232 
233  for (int j=0; j<theHC->entries()&&!found; j++) {
234  BscG4Hit* aPreviousHit = (*theHC)[j];
235  if (aPreviousHit->getTrackID() == primaryID &&
236  aPreviousHit->getTimeSliceID() == tSliceID &&
237  aPreviousHit->getUnitID() == unitID ) {
238  //AZ:
239  currentHit = aPreviousHit;
240  found = true;
241  }
242  }
243 
244  if (found) {
245  //AZ:
246  UpdateHit();
247  return true;
248  } else {
249  return false;
250  }
251 }
uint32_t previousUnitID
Definition: BscSD.h:131
G4int getTrackID() const
Definition: BSCG4Hit.cc:133
G4int tSliceID
Definition: BscSD.h:132
G4int primID
Definition: BscSD.h:118
BscG4HitCollection * theHC
Definition: BscSD.h:123
unsigned int getUnitID() const
Definition: BSCG4Hit.cc:136
G4int tsID
Definition: BscSD.h:126
void UpdateHit()
Definition: BscSD.cc:334
int getTimeSliceID() const
Definition: BSCG4Hit.cc:141
uint32_t unitID
Definition: BscSD.h:131
G4int primaryID
Definition: BscSD.h:132
int j
Definition: DBlmapReader.cc:9
BscG4Hit * currentHit
Definition: BscSD.h:127
void ResetForNewPrimary()
Definition: BscSD.cc:254
void BscSD::Initialize ( G4HCofThisEvent *  HCE)
virtual

Reimplemented from SensitiveDetector.

Definition at line 117 of file BscSD.cc.

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

117  {
118 #ifdef debug
119  LogDebug("BscSim") << "BscSD : Initialize called for " << name << std::endl;
120 #endif
121 
123  if (hcID<0)
124  hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
125  HCE->AddHitsCollection(hcID, theHC);
126 
127  tsID = -2;
128  primID = -2;
129 
131 }
#define LogDebug(id)
G4int primID
Definition: BscSD.h:118
BscG4HitCollection * theHC
Definition: BscSD.h:123
G4int tsID
Definition: BscSD.h:126
std::string const collectionName[nCollections]
Definition: Collections.h:45
std::string name
Definition: BscSD.h:121
G4int hcID
Definition: BscSD.h:122
G4THitsCollection< BscG4Hit > BscG4HitCollection
void BscSD::PrintAll ( )
virtual

Definition at line 411 of file BscSD.cc.

References LogDebug, and theHC.

411  {
412  LogDebug("BscSim") << "BscSD: Collection " << theHC->GetName() << "\n";
413  theHC->PrintAllHits();
414 }
#define LogDebug(id)
BscG4HitCollection * theHC
Definition: BscSD.h:123
bool BscSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
virtual

Implements SensitiveDetector.

Definition at line 134 of file BscSD.cc.

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

134  {
135 
136  if (aStep == NULL) {
137  return true;
138  } else {
139  GetStepInfo(aStep);
140  // LogDebug("BscSim") << edeposit <<std::endl;
141 
142  //AZ
143 #ifdef debug
144  LogDebug("BscSim") << "BscSD : number of hits = " << theHC->entries() << std::endl;
145 #endif
146 
147  if (HitExists() == false && edeposit>0. ){
148  CreateNewHit();
149  return true;
150  }
151  }
152  return true;
153 }
#define LogDebug(id)
G4bool HitExists()
Definition: BscSD.cc:208
float edeposit
Definition: BscSD.h:137
void GetStepInfo(G4Step *aStep)
Definition: BscSD.cc:155
void CreateNewHit()
Definition: BscSD.cc:275
#define NULL
Definition: scimark2.h:8
BscG4HitCollection * theHC
Definition: BscSD.h:123
void BscSD::ResetForNewPrimary ( )
private

Definition at line 254 of file BscSD.cc.

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

Referenced by HitExists().

254  {
255 
258  incidentEnergy = preStepPoint->GetKineticEnergy();
259 
260 }
G4ThreeVector SetToLocal(const G4ThreeVector &global)
Definition: BscSD.cc:355
G4StepPoint * preStepPoint
Definition: BscSD.h:135
G4ThreeVector hitPoint
Definition: BscSD.h:139
G4ThreeVector hitPointExit
Definition: BscSD.h:141
float incidentEnergy
Definition: BscSD.h:117
G4ThreeVector exitPoint
Definition: BscSD.h:113
G4ThreeVector SetToLocalExit(const G4ThreeVector &globalPoint)
Definition: BscSD.cc:363
G4ThreeVector entrancePoint
Definition: BscSD.h:113
uint32_t BscSD::setDetUnitId ( G4Step *  aStep)
virtual

Implements SensitiveDetector.

Definition at line 202 of file BscSD.cc.

References BscNumberingScheme::getUnitID(), and numberingScheme.

Referenced by GetStepInfo().

202  {
203 
204  return (numberingScheme == 0 ? 0 : numberingScheme->getUnitID(aStep));
205 }
virtual unsigned int getUnitID(const G4Step *aStep) const
BscNumberingScheme * numberingScheme
Definition: BscSD.h:111
G4ThreeVector BscSD::SetToLocal ( const G4ThreeVector &  global)
private

Definition at line 355 of file BscSD.cc.

References preStepPoint, and theEntryPoint.

Referenced by ResetForNewPrimary().

355  {
356 
357  const G4VTouchable* touch= preStepPoint->GetTouchable();
358  theEntryPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
359  return theEntryPoint;
360 }
G4StepPoint * preStepPoint
Definition: BscSD.h:135
G4ThreeVector theEntryPoint
Definition: BscSD.h:114
G4ThreeVector BscSD::SetToLocalExit ( const G4ThreeVector &  globalPoint)
private

Definition at line 363 of file BscSD.cc.

References postStepPoint, and theExitPoint.

Referenced by ResetForNewPrimary().

363  {
364 
365  const G4VTouchable* touch= postStepPoint->GetTouchable();
366  theExitPoint = touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
367  return theExitPoint;
368 }
G4StepPoint * postStepPoint
Definition: BscSD.h:136
G4ThreeVector theExitPoint
Definition: BscSD.h:115
void BscSD::StoreHit ( BscG4Hit hit)
private

Definition at line 263 of file BscSD.cc.

References primID, and theHC.

Referenced by CreateNewHit().

263  {
264 
265  if (primID<0) return;
266  if (hit == 0 ) {
267  edm::LogWarning("BscSim") << "BscSD: hit to be stored is NULL !!";
268  return;
269  }
270 
271  theHC->insert( hit );
272 }
G4int primID
Definition: BscSD.h:118
BscG4HitCollection * theHC
Definition: BscSD.h:123
void BscSD::Summarize ( )
private

Definition at line 399 of file BscSD.cc.

Referenced by EndOfEvent().

399  {
400 }
void BscSD::update ( const BeginOfRun )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

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

428  {
429 
430  G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
431  G4String particleName;
432  emPDG = theParticleTable->FindParticle(particleName="e-")->GetPDGEncoding();
433  epPDG = theParticleTable->FindParticle(particleName="e+")->GetPDGEncoding();
434  gammaPDG = theParticleTable->FindParticle(particleName="gamma")->GetPDGEncoding();
435 
436 }
G4int gammaPDG
Definition: BscSD.h:167
G4int emPDG
Definition: BscSD.h:165
G4int epPDG
Definition: BscSD.h:166
void BscSD::update ( const BeginOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

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

421  {
422  LogDebug("BscSim") << " Dispatched BeginOfEvent for " << GetName()
423  << " !" ;
424  clearHits();
425  eventno = (*i)()->GetEventID();
426 }
#define LogDebug(id)
virtual void clearHits()
Definition: BscSD.cc:441
int eventno
Definition: BscSD.h:160
void BscSD::update ( const ::EndOfEvent )
private
void BscSD::UpdateHit ( )
private

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

334  {
335 
336  if (Eloss > 0.) {
338 
339 #ifdef debug
340  LogDebug("BscSim") << "updateHit: add eloss " << Eloss <<std::endl;
341  LogDebug("BscSim") << "CurrentHit=" << currentHit
342  << ", PostStepPoint=" << postStepPoint->GetPosition();
343 #endif
344  //AZ
346  }
347 
348  // buffer for next steps:
349  tsID = tSliceID;
350  primID = primaryID;
352 }
#define LogDebug(id)
uint32_t previousUnitID
Definition: BscSD.h:131
G4int tSliceID
Definition: BscSD.h:132
void setEnergyLoss(float e)
Definition: BSCG4Hit.cc:155
float edepositEM
Definition: BscSD.h:164
float Eloss
Definition: BscSD.h:146
G4int primID
Definition: BscSD.h:118
G4int tsID
Definition: BscSD.h:126
uint32_t unitID
Definition: BscSD.h:131
G4int primaryID
Definition: BscSD.h:132
float edepositHAD
Definition: BscSD.h:164
void addEnergyDeposit(double em, double hd)
Definition: BSCG4Hit.cc:143
G4StepPoint * postStepPoint
Definition: BscSD.h:136
BscG4Hit * currentHit
Definition: BscSD.h:127

Member Data Documentation

BscG4Hit* BscSD::currentHit
private

Definition at line 127 of file BscSD.h.

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

G4VPhysicalVolume* BscSD::currentPV
private

Definition at line 129 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::edeposit
private

Definition at line 137 of file BscSD.h.

Referenced by GetStepInfo(), and ProcessHits().

float BscSD::edepositEM
protected

Definition at line 164 of file BscSD.h.

Referenced by GetStepInfo(), and UpdateHit().

float BscSD::edepositHAD
protected

Definition at line 164 of file BscSD.h.

Referenced by GetStepInfo(), and UpdateHit().

float BscSD::Eloss
private

Definition at line 146 of file BscSD.h.

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

G4int BscSD::emPDG
protected

Definition at line 165 of file BscSD.h.

Referenced by GetStepInfo(), and update().

G4ThreeVector BscSD::entrancePoint
private

Definition at line 113 of file BscSD.h.

Referenced by ResetForNewPrimary().

G4int BscSD::epPDG
protected

Definition at line 166 of file BscSD.h.

Referenced by GetStepInfo(), and update().

int BscSD::eventno
private

Definition at line 160 of file BscSD.h.

Referenced by update().

G4ThreeVector BscSD::exitPoint
private

Definition at line 113 of file BscSD.h.

Referenced by ResetForNewPrimary().

G4int BscSD::gammaPDG
protected

Definition at line 167 of file BscSD.h.

Referenced by GetStepInfo(), and update().

G4int BscSD::hcID
private

Definition at line 122 of file BscSD.h.

Referenced by Initialize().

G4ThreeVector BscSD::hitPoint
private

Definition at line 139 of file BscSD.h.

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

G4ThreeVector BscSD::hitPointExit
private

Definition at line 141 of file BscSD.h.

Referenced by GetStepInfo(), and ResetForNewPrimary().

G4ThreeVector BscSD::hitPointLocal
private

Definition at line 142 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4ThreeVector BscSD::hitPointLocalExit
private

Definition at line 143 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::incidentEnergy
private

Definition at line 117 of file BscSD.h.

Referenced by CreateNewHit(), and ResetForNewPrimary().

std::string BscSD::name
private
BscNumberingScheme* BscSD::numberingScheme
private

Definition at line 111 of file BscSD.h.

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

float BscSD::Pabs
private

Definition at line 144 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

int BscSD::ParentId
private

Definition at line 152 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

short BscSD::ParticleType
private

Definition at line 147 of file BscSD.h.

float BscSD::PhiAtEntry
private

Definition at line 150 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4StepPoint* BscSD::postStepPoint
private

Definition at line 136 of file BscSD.h.

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

G4StepPoint* BscSD::preStepPoint
private

Definition at line 135 of file BscSD.h.

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

uint32_t BscSD::previousUnitID
private

Definition at line 131 of file BscSD.h.

Referenced by HitExists(), and UpdateHit().

G4int BscSD::primaryID
private

Definition at line 132 of file BscSD.h.

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

G4int BscSD::primID
private

Definition at line 118 of file BscSD.h.

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

TrackingSlaveSD* BscSD::slave
private

Definition at line 110 of file BscSD.h.

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

G4ThreeVector BscSD::theEntryPoint
private

Definition at line 114 of file BscSD.h.

Referenced by SetToLocal().

G4ThreeVector BscSD::theExitPoint
private

Definition at line 115 of file BscSD.h.

Referenced by SetToLocalExit().

BscG4HitCollection* BscSD::theHC
private

Definition at line 123 of file BscSD.h.

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

const SimTrackManager* BscSD::theManager
private

Definition at line 124 of file BscSD.h.

float BscSD::ThetaAtEntry
private

Definition at line 149 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4Track* BscSD::theTrack
private

Definition at line 128 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::Tof
private

Definition at line 145 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4int BscSD::tsID
private

Definition at line 126 of file BscSD.h.

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

G4double BscSD::tSlice
private

Definition at line 133 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

G4int BscSD::tSliceID
private

Definition at line 132 of file BscSD.h.

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

uint32_t BscSD::unitID
private

Definition at line 131 of file BscSD.h.

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

float BscSD::Vx
private

Definition at line 153 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::Vy
private

Definition at line 153 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::Vz
private

Definition at line 153 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::X
private

Definition at line 154 of file BscSD.h.

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

float BscSD::Y
private

Definition at line 154 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float BscSD::Z
private

Definition at line 154 of file BscSD.h.

Referenced by CreateNewHit(), and GetStepInfo().