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 &, 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, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
virtual void AssignSD (std::string &vname)
 
Local3DPoint ConvertToLocal3DPoint (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, 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 (G4ThreeVector global)
 
G4ThreeVector SetToLocalExit (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,
SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 45 of file BscSD.cc.

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

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

References numberingScheme, and slave.

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

Member Function Documentation

void BscSD::clear ( void  )
virtual

Definition at line 400 of file BscSD.cc.

400  {
401 }
void BscSD::clearHits ( )
privatevirtual

Implements SensitiveDetector.

Definition at line 438 of file BscSD.cc.

References TrackingSlaveSD::Initialize(), and slave.

Referenced by update().

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

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

272  {
273 
274 #ifdef debug
275  LogDebug("BscSim") << "BscSD CreateNewHit for"
276  << " PV " << currentPV->GetName()
277  << " PVid = " << currentPV->GetCopyNo()
278  << " Unit " << unitID <<std::endl;
279  LogDebug("BscSim") << " primary " << primaryID
280  << " time slice " << tSliceID
281  << " For Track " << theTrack->GetTrackID()
282  << " which is a " << theTrack->GetDefinition()->GetParticleName();
283 
284  if (theTrack->GetTrackID()==1) {
285  LogDebug("BscSim") << " of energy " << theTrack->GetTotalEnergy();
286  } else {
287  LogDebug("BscSim") << " daughter of part. " << theTrack->GetParentID();
288  }
289 
290  LogDebug("BscSim") << " and created by " ;
291  if (theTrack->GetCreatorProcess()!=NULL)
292  LogDebug("BscSim") << theTrack->GetCreatorProcess()->GetProcessName() ;
293  else
294  LogDebug("BscSim") << "NO process";
295  LogDebug("BscSim") << std::endl;
296 #endif
297 
298  currentHit = new BscG4Hit;
303 
310 
312 
315 
317  currentHit->setVx(Vx);
318  currentHit->setVy(Vy);
319  currentHit->setVz(Vz);
320 
321  currentHit->setX(X);
322  currentHit->setY(Y);
323  currentHit->setZ(Z);
324 
325  UpdateHit();
326 
328 }
#define LogDebug(id)
void setTof(float e)
Definition: BSCG4Hit.cc:154
void setVx(float p)
Definition: BSCG4Hit.cc:177
float Y
Definition: BscSD.h:154
float PhiAtEntry
Definition: BscSD.h:150
void setEntry(G4ThreeVector xyz)
Definition: BSCG4Hit.cc:116
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:331
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
uint32_t unitID
Definition: BscSD.h:131
void setEntryLocalP(G4ThreeVector xyz1)
Definition: BSCG4Hit.cc:119
G4int primaryID
Definition: BscSD.h:132
void setPhiAtEntry(float f)
Definition: BSCG4Hit.cc:162
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:260
void setVz(float p)
Definition: BSCG4Hit.cc:183
short ParticleType
Definition: BscSD.h:147
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
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 setExitLocalP(G4ThreeVector xyz1)
Definition: BSCG4Hit.cc:122
void BscSD::DrawAll ( )
virtual

Definition at line 404 of file BscSD.cc.

404  {
405 }
void BscSD::EndOfEvent ( G4HCofThisEvent *  eventHC)
virtual

Reimplemented from SensitiveDetector.

Definition at line 368 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.

368  {
369 
370  // here we loop over transient hits and make them persistent
371  for (int j=0; j<theHC->entries(); j++) {
372  //AZ:
373  BscG4Hit* aHit = (*theHC)[j];
374  LogDebug("BscSim") << "hit number" << j << "unit ID = "<<aHit->getUnitID()<< "\n";
375  LogDebug("BscSim") << "entry z " << aHit->getEntry().z()<< "\n";
376  LogDebug("BscSim") << "entr theta " << aHit->getThetaAtEntry()<< "\n";
377 
378  Local3DPoint locExitPoint(0,0,0);
379  Local3DPoint locEntryPoint(aHit->getEntry().x(),
380  aHit->getEntry().y(),
381  aHit->getEntry().z());
382  slave->processHits(PSimHit(locEntryPoint,locExitPoint,
383  aHit->getPabs(),
384  aHit->getTof(),
385  aHit->getEnergyLoss(),
386  aHit->getParticleType(),
387  aHit->getUnitID(),
388  aHit->getTrackID(),
389  aHit->getThetaAtEntry(),
390  aHit->getPhiAtEntry()));
391  }
392  Summarize();
393 }
#define LogDebug(id)
void Summarize()
Definition: BscSD.cc:396
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 414 of file BscSD.cc.

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

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

Definition at line 110 of file BscSD.cc.

Referenced by GetStepInfo().

110  {
111  return aStep->GetTotalEnergyDeposit();
112 }
std::vector< std::string > BscSD::getNames ( )
virtual

Reimplemented from SensitiveDetector.

Definition at line 443 of file BscSD.cc.

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

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

Definition at line 152 of file BscSD.cc.

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

152  {
153 
154  preStepPoint = aStep->GetPreStepPoint();
155  postStepPoint= aStep->GetPostStepPoint();
156  theTrack = aStep->GetTrack();
157  hitPoint = preStepPoint->GetPosition();
158  currentPV = preStepPoint->GetPhysicalVolume();
159  hitPointExit = postStepPoint->GetPosition();
160 
161  hitPointLocal = preStepPoint->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
162  hitPointLocalExit = preStepPoint->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(hitPointExit);
163 
164 
165  G4int particleCode = theTrack->GetDefinition()->GetPDGEncoding();
166  LogDebug("BscSim") << " BscSD :particleType = " << theTrack->GetDefinition()->GetParticleName() <<std::endl;
167  if (particleCode == emPDG ||
168  particleCode == epPDG ||
169  particleCode == gammaPDG ) {
170  edepositEM = getEnergyDeposit(aStep); edepositHAD = 0.;
171  } else {
172  edepositEM = 0.; edepositHAD = getEnergyDeposit(aStep);
173  }
174  edeposit = aStep->GetTotalEnergyDeposit();
175  tSlice = (postStepPoint->GetGlobalTime() )/nanosecond;
176  tSliceID = (int) tSlice;
177  unitID = setDetUnitId(aStep);
178 #ifdef debug
179  LogDebug("BscSim") << "unitID=" << unitID <<std::endl;
180 #endif
181  primaryID = theTrack->GetTrackID();
182  // Position = hitPoint;
183  Pabs = aStep->GetPreStepPoint()->GetMomentum().mag()/GeV;
184  Tof = aStep->GetPostStepPoint()->GetGlobalTime()/nanosecond;
185  Eloss = aStep->GetTotalEnergyDeposit()/GeV;
186  ParticleType = theTrack->GetDefinition()->GetPDGEncoding();
187  ThetaAtEntry = aStep->GetPreStepPoint()->GetPosition().theta()/deg;
188  PhiAtEntry = aStep->GetPreStepPoint()->GetPosition().phi()/deg;
189 
190  ParentId = theTrack->GetParentID();
191  Vx = theTrack->GetVertexPosition().x();
192  Vy = theTrack->GetVertexPosition().y();
193  Vz = theTrack->GetVertexPosition().z();
194  X = hitPoint.x();
195  Y = hitPoint.y();
196  Z = hitPoint.z();
197 }
#define LogDebug(id)
G4int gammaPDG
Definition: BscSD.h:167
G4int emPDG
Definition: BscSD.h:165
G4int epPDG
Definition: BscSD.h:166
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:110
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:199
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
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
short ParticleType
Definition: BscSD.h:147
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 205 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().

205  {
206  if (primaryID<1) {
207  edm::LogWarning("BscSim") << "***** BscSD error: primaryID = "
208  << primaryID
209  << " maybe detector name changed";
210  }
211 
212  // Update if in the same detector, time-slice and for same track
213  // if (primaryID == primID && tSliceID == tsID && unitID==previousUnitID) {
214  if (tSliceID == tsID && unitID==previousUnitID) {
215  //AZ:
216  UpdateHit();
217  return true;
218  }
219  // Reset entry point for new primary
220  if (primaryID != primID)
222 
223  //look in the HitContainer whether a hit with the same primID, unitID,
224  //tSliceID already exists:
225 
226  G4bool found = false;
227 
228  // LogDebug("BscSim") << "BscSD: HCollection= " << theHC->entries() <<std::endl;
229 
230  for (int j=0; j<theHC->entries()&&!found; j++) {
231  BscG4Hit* aPreviousHit = (*theHC)[j];
232  if (aPreviousHit->getTrackID() == primaryID &&
233  aPreviousHit->getTimeSliceID() == tSliceID &&
234  aPreviousHit->getUnitID() == unitID ) {
235  //AZ:
236  currentHit = aPreviousHit;
237  found = true;
238  }
239  }
240 
241  if (found) {
242  //AZ:
243  UpdateHit();
244  return true;
245  } else {
246  return false;
247  }
248 }
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:331
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:251
void BscSD::Initialize ( G4HCofThisEvent *  HCE)
virtual

Reimplemented from SensitiveDetector.

Definition at line 114 of file BscSD.cc.

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

114  {
115 #ifdef debug
116  LogDebug("BscSim") << "BscSD : Initialize called for " << name << std::endl;
117 #endif
118 
120  if (hcID<0)
121  hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
122  HCE->AddHitsCollection(hcID, theHC);
123 
124  tsID = -2;
125  primID = -2;
126 
128 }
#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:39
std::string name
Definition: BscSD.h:121
G4int hcID
Definition: BscSD.h:122
G4THitsCollection< BscG4Hit > BscG4HitCollection
void BscSD::PrintAll ( )
virtual

Definition at line 408 of file BscSD.cc.

References LogDebug, and theHC.

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

Implements SensitiveDetector.

Definition at line 131 of file BscSD.cc.

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

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

Definition at line 251 of file BscSD.cc.

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

Referenced by HitExists().

251  {
252 
255  incidentEnergy = preStepPoint->GetKineticEnergy();
256 
257 }
G4ThreeVector SetToLocal(G4ThreeVector global)
Definition: BscSD.cc:352
G4ThreeVector SetToLocalExit(G4ThreeVector globalPoint)
Definition: BscSD.cc:360
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 entrancePoint
Definition: BscSD.h:113
uint32_t BscSD::setDetUnitId ( G4Step *  aStep)
virtual

Implements SensitiveDetector.

Definition at line 199 of file BscSD.cc.

References BscNumberingScheme::getUnitID(), and numberingScheme.

Referenced by GetStepInfo().

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

Definition at line 352 of file BscSD.cc.

References preStepPoint, and theEntryPoint.

Referenced by ResetForNewPrimary().

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

Definition at line 360 of file BscSD.cc.

References postStepPoint, and theExitPoint.

Referenced by ResetForNewPrimary().

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

Definition at line 260 of file BscSD.cc.

References primID, and theHC.

Referenced by CreateNewHit().

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

Definition at line 396 of file BscSD.cc.

Referenced by EndOfEvent().

396  {
397 }
void BscSD::update ( const BeginOfRun )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 425 of file BscSD.cc.

References emPDG, epPDG, and gammaPDG.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.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(), relval_steps.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().

425  {
426 
427  G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
428  G4String particleName;
429  emPDG = theParticleTable->FindParticle(particleName="e-")->GetPDGEncoding();
430  epPDG = theParticleTable->FindParticle(particleName="e+")->GetPDGEncoding();
431  gammaPDG = theParticleTable->FindParticle(particleName="gamma")->GetPDGEncoding();
432 
433 }
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 418 of file BscSD.cc.

References clearHits(), eventno, and LogDebug.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.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(), relval_steps.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().

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

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

331  {
332 
333  if (Eloss > 0.) {
335 
336 #ifdef debug
337  LogDebug("BscSim") << "updateHit: add eloss " << Eloss <<std::endl;
338  LogDebug("BscSim") << "CurrentHit=" << currentHit
339  << ", PostStepPoint=" << postStepPoint->GetPosition();
340 #endif
341  //AZ
343  }
344 
345  // buffer for next steps:
346  tsID = tSliceID;
347  primID = primaryID;
349 }
#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.

Referenced by CreateNewHit(), and GetStepInfo().

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