CMS 3D CMS Logo

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

#include <TkAccumulatingSensitiveDetector.h>

Inheritance diagram for TkAccumulatingSensitiveDetector:
SensitiveTkDetector Observer< const BeginOfEvent * > Observer< const BeginOfTrack * > Observer< const BeginOfJob * > SensitiveDetector

Public Member Functions

void clearHits () override
 
void EndOfEvent (G4HCofThisEvent *) override
 
void fillHits (edm::PSimHitContainer &, const std::string &) override
 
bool ProcessHits (G4Step *, G4TouchableHistory *) override
 
uint32_t setDetUnitId (const G4Step *) override
 
 TkAccumulatingSensitiveDetector (const std::string &, const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
 ~TkAccumulatingSensitiveDetector () override
 
- Public Member Functions inherited from SensitiveTkDetector
 SensitiveTkDetector (const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
const std::vector< std::string > & getNames () const
 
void Initialize (G4HCofThisEvent *eventHC) override
 
bool isCaloSD () const
 
 SensitiveDetector (const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &, edm::ParameterSet const &p, bool calo)
 
 ~SensitiveDetector () override
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack * >
 Observer ()
 
void slotForUpdate (const BeginOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfJob * >
 Observer ()
 
void slotForUpdate (const BeginOfJob * iT)
 
virtual ~Observer ()
 

Protected Member Functions

void update (const BeginOfEvent *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfJob *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfTrack *) override
 This routine will be called when the appropriate signal arrives. More...
 
- Protected Member Functions inherited from SensitiveDetector
TrackInformationcmsTrackInformation (const G4Track *aTrack)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point) const
 
Local3DPoint FinalStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint InitialStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint LocalPostStepPosition (const G4Step *step) const
 
Local3DPoint LocalPreStepPosition (const G4Step *step) const
 
void NaNTrap (const G4Step *step) const
 
void setNames (const std::vector< std::string > &)
 

Private Member Functions

bool closeHit (const G4Step *)
 
void createHit (const G4Step *)
 
bool newHit (const G4Step *)
 
void sendHit ()
 
void updateHit (const G4Step *)
 

Private Attributes

bool allowZeroEnergyLoss
 
float energyCut
 
float energyHistoryCut
 
int eventno
 
Local3DPoint globalEntryPoint
 
Local3DPoint globalExitPoint
 
uint32_t lastId
 
int lastTrack
 
UpdatablePSimHitmySimHit
 
bool neverAccumulate
 
const G4VPhysicalVolume * oldVolume
 
std::string pname
 
bool printHits
 
float px
 
float py
 
float pz
 
double rTracker
 
double rTracker2
 
std::unique_ptr< TrackingSlaveSDslaveHighTof
 
std::unique_ptr< TrackingSlaveSDslaveLowTof
 
std::unique_ptr< const G4ProcessTypeEnumeratortheG4ProcTypeEnumerator
 
const SimTrackManagertheManager
 
TrackerG4SimHitNumberingSchemetheNumberingScheme
 
std::unique_ptr< FrameRotationtheRotation
 
float theTofLimit
 
double zTracker
 

Additional Inherited Members

- Protected Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 

Detailed Description

Definition at line 28 of file TkAccumulatingSensitiveDetector.h.

Constructor & Destructor Documentation

◆ TkAccumulatingSensitiveDetector()

TkAccumulatingSensitiveDetector::TkAccumulatingSensitiveDetector ( const std::string &  name,
const edm::EventSetup es,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 46 of file TkAccumulatingSensitiveDetector.cc.

51  : SensitiveTkDetector(name, es, clg, p),
52  theManager(manager),
53  rTracker(1200. * CLHEP::mm),
54  zTracker(3000. * CLHEP::mm),
55  mySimHit(nullptr),
56  lastId(0),
57  lastTrack(0),
58  oldVolume(nullptr),
59  px(0.0f),
60  py(0.0f),
61  pz(0.0f),
62  eventno(0),
63  pname("") {
64  edm::ParameterSet m_TrackerSD = p.getParameter<edm::ParameterSet>("TrackerSD");
65  allowZeroEnergyLoss = m_TrackerSD.getParameter<bool>("ZeroEnergyLoss");
66  neverAccumulate = m_TrackerSD.getParameter<bool>("NeverAccumulate");
67  printHits = m_TrackerSD.getParameter<bool>("PrintHits");
68  theTofLimit = m_TrackerSD.getParameter<double>("ElectronicSigmaInNanoSeconds") * 3 * CLHEP::ns; // 3 sigma
69  energyCut =
70  m_TrackerSD.getParameter<double>("EnergyThresholdForPersistencyInGeV") * CLHEP::GeV; //default must be 0.5
72  m_TrackerSD.getParameter<double>("EnergyThresholdForHistoryInGeV") * CLHEP::GeV; //default must be 0.05
74 
75  // No Rotation given in input, automagically choose one based upon the name
76  std::string rotType;
77  theRotation = std::make_unique<TrackerFrameRotation>();
78  rotType = "TrackerFrameRotation";
79 
80 #ifdef FAKEFRAMEROTATION
81  theRotation.reset(new FakeFrameRotation());
82  rotType = "FakeFrameRotation";
83 #endif
84 
85  edm::LogVerbatim("TrackerSim") << " TkAccumulatingSensitiveDetector: "
86  << " Criteria for Saving Tracker SimTracks: \n"
87  << " History: " << energyHistoryCut << " MeV; Persistency: " << energyCut
88  << " MeV; TofLimit: " << theTofLimit << " ns"
89  << "\n FrameRotation type " << rotType << " rTracker(cm)= " << rTracker / CLHEP::cm
90  << " zTracker(cm)= " << zTracker / CLHEP::cm
91  << " allowZeroEnergyLoss: " << allowZeroEnergyLoss
92  << " neverAccumulate: " << neverAccumulate << " printHits: " << printHits;
93 
94  slaveLowTof = std::make_unique<TrackingSlaveSD>(name + "LowTof");
95  slaveHighTof = std::make_unique<TrackingSlaveSD>(name + "HighTof");
96 
97  std::vector<std::string> temp;
98  temp.push_back(slaveLowTof.get()->name());
99  temp.push_back(slaveHighTof.get()->name());
100  setNames(temp);
101 
102  theG4ProcTypeEnumerator = std::make_unique<G4ProcessTypeEnumerator>();
103  theNumberingScheme = nullptr;
104 }

References allowZeroEnergyLoss, energyCut, energyHistoryCut, edm::ParameterSet::getParameter(), GeV, Skims_PA_cff::name, neverAccumulate, AlCaHLTBitMon_ParallelJobs::p, printHits, rTracker, rTracker2, SensitiveDetector::setNames(), slaveHighTof, slaveLowTof, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, theG4ProcTypeEnumerator, theNumberingScheme, theRotation, theTofLimit, and zTracker.

◆ ~TkAccumulatingSensitiveDetector()

TkAccumulatingSensitiveDetector::~TkAccumulatingSensitiveDetector ( )
override

Definition at line 106 of file TkAccumulatingSensitiveDetector.cc.

106 {}

Member Function Documentation

◆ clearHits()

void TkAccumulatingSensitiveDetector::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 364 of file TkAccumulatingSensitiveDetector.cc.

364  {
365  slaveLowTof.get()->Initialize();
366  slaveHighTof.get()->Initialize();
367 }

References slaveHighTof, and slaveLowTof.

Referenced by update().

◆ closeHit()

bool TkAccumulatingSensitiveDetector::closeHit ( const G4Step *  aStep)
private

Definition at line 335 of file TkAccumulatingSensitiveDetector.cc.

335  {
336  const float tolerance2 = 0.0025f; // (0.5 mm)^2 are allowed between entry and exit
337  Local3DPoint theEntryPoint = theRotation.get()->transformPoint(LocalPreStepPosition(aStep));
338  LogDebug("TrackerSimDebug") << " closeHit: distance = " << (mySimHit->exitPoint() - theEntryPoint).mag();
339 
340  return ((mySimHit->exitPoint() - theEntryPoint).mag2() < tolerance2) ? true : false;
341 }

References PSimHit::exitPoint(), SensitiveDetector::LocalPreStepPosition(), LogDebug, mag(), mag2(), mySimHit, and theRotation.

Referenced by newHit().

◆ createHit()

void TkAccumulatingSensitiveDetector::createHit ( const G4Step *  aStep)
private

Definition at line 208 of file TkAccumulatingSensitiveDetector.cc.

208  {
209  // VI: previous hit should be already deleted
210  // in past here was a check if a hit is inside a sensitive detector,
211  // this is not needed, because call to senstive detector happens
212  // only inside the volume
213  const G4Track* theTrack = aStep->GetTrack();
214  Local3DPoint theExitPoint = theRotation.get()->transformPoint(LocalPostStepPosition(aStep));
215  Local3DPoint theEntryPoint;
216  //
217  // Check particle type - for gamma and neutral hadrons energy deposition
218  // should be local (VI)
219  //
220  if (0.0 == theTrack->GetDefinition()->GetPDGCharge()) {
221  theEntryPoint = theExitPoint;
222  } else {
223  theEntryPoint = theRotation.get()->transformPoint(LocalPreStepPosition(aStep));
224  }
225 
226  //
227  // This allows to send he skipEvent if it is outside!
228  //
229  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
230  float thePabs = preStepPoint->GetMomentum().mag() / GeV;
231  float theTof = preStepPoint->GetGlobalTime() / nanosecond;
232  float theEnergyLoss = aStep->GetTotalEnergyDeposit() / GeV;
233  int theParticleType = G4TrackToParticleID::particleID(theTrack);
234  uint32_t theDetUnitId = setDetUnitId(aStep);
235  int theTrackID = theTrack->GetTrackID();
236  if (theDetUnitId == 0) {
237  edm::LogWarning("TkAccumulatingSensitiveDetector::createHit") << " theDetUnitId is not valid for " << GetName();
238  throw cms::Exception("TkAccumulatingSensitiveDetector::createHit")
239  << "cannot get theDetUnitId for G4Track " << theTrackID;
240  }
241 
242  // To whom assign the Hit?
243  // First iteration: if the track is to be stored, use the current number;
244  // otherwise, get to the mother
245  unsigned int theTrackIDInsideTheSimHit = theTrackID;
246 
247  const TrackInformation* temp = cmsTrackInformation(theTrack);
248  if (!temp->storeTrack()) {
249  // Go to the mother!
250  theTrackIDInsideTheSimHit = theTrack->GetParentID();
251  LogDebug("TrackerSimDebug") << " TkAccumulatingSensitiveDetector::createHit(): setting the TrackID from "
252  << theTrackIDInsideTheSimHit << " to the mother one " << theTrackIDInsideTheSimHit
253  << " " << theEnergyLoss;
254  } else {
255  LogDebug("TrackerSimDebug") << " TkAccumulatingSensitiveDetector:createHit(): leaving the current TrackID "
256  << theTrackIDInsideTheSimHit;
257  }
258 
259  const G4ThreeVector& gmd = preStepPoint->GetMomentumDirection();
260  // convert it to local frame
261  G4ThreeVector lmd =
262  ((G4TouchableHistory*)(preStepPoint->GetTouchable()))->GetHistory()->GetTopTransform().TransformAxis(gmd);
263  Local3DPoint lnmd = theRotation.get()->transformPoint(ConvertToLocal3DPoint(lmd));
264  float theThetaAtEntry = lnmd.theta();
265  float thePhiAtEntry = lnmd.phi();
266 
267  mySimHit = new UpdatablePSimHit(theEntryPoint,
268  theExitPoint,
269  thePabs,
270  theTof,
271  theEnergyLoss,
272  theParticleType,
273  theDetUnitId,
274  theTrackIDInsideTheSimHit,
275  theThetaAtEntry,
276  thePhiAtEntry,
277  theG4ProcTypeEnumerator.get()->processId(theTrack->GetCreatorProcess()));
278  lastId = theDetUnitId;
279  lastTrack = theTrackID;
280 
281  // only for debugging
282  if (printHits) {
283  // point on Geant4 unit (mm)
284  globalEntryPoint = ConvertToLocal3DPoint(preStepPoint->GetPosition());
285  globalExitPoint = ConvertToLocal3DPoint(aStep->GetPostStepPoint()->GetPosition());
286  // in CMS unit (GeV)
287  px = preStepPoint->GetMomentum().x() / CLHEP::GeV;
288  py = preStepPoint->GetMomentum().y() / CLHEP::GeV;
289  pz = preStepPoint->GetMomentum().z() / CLHEP::GeV;
290  oldVolume = preStepPoint->GetPhysicalVolume();
291  pname = theTrack->GetDefinition()->GetParticleName();
292  LogDebug("TrackerSimDebug") << " Created PSimHit: " << pname << " " << mySimHit->detUnitId() << " "
293  << mySimHit->trackId() << " " << theTrackID
294  << " p= " << aStep->GetPreStepPoint()->GetMomentum().mag() << " "
295  << mySimHit->energyLoss() << " " << mySimHit->entryPoint() << " "
296  << mySimHit->exitPoint();
297  }
298 }

References SensitiveDetector::cmsTrackInformation(), SensitiveDetector::ConvertToLocal3DPoint(), PSimHit::detUnitId(), PSimHit::energyLoss(), PSimHit::entryPoint(), Exception, PSimHit::exitPoint(), GeV, globalEntryPoint, globalExitPoint, lastId, lastTrack, SensitiveDetector::LocalPostStepPosition(), SensitiveDetector::LocalPreStepPosition(), LogDebug, mySimHit, oldVolume, G4TrackToParticleID::particleID(), PV3DBase< T, PVType, FrameType >::phi(), pname, printHits, px, py, pz, setDetUnitId(), groupFilesInBlocks::temp, theG4ProcTypeEnumerator, theRotation, PV3DBase< T, PVType, FrameType >::theta(), and PSimHit::trackId().

Referenced by ProcessHits().

◆ EndOfEvent()

void TkAccumulatingSensitiveDetector::EndOfEvent ( G4HCofThisEvent *  )
override

Definition at line 343 of file TkAccumulatingSensitiveDetector.cc.

343  {
344  LogDebug("TrackerSimDebug") << " Saving the last hit in a ROU " << GetName();
345  if (mySimHit != nullptr)
346  sendHit();
347 }

References LogDebug, mySimHit, and sendHit().

◆ fillHits()

void TkAccumulatingSensitiveDetector::fillHits ( edm::PSimHitContainer cc,
const std::string &  hname 
)
overridevirtual

Implements SensitiveTkDetector.

Definition at line 369 of file TkAccumulatingSensitiveDetector.cc.

369  {
370  if (slaveLowTof.get()->name() == hname) {
371  cc = slaveLowTof.get()->hits();
372  } else if (slaveHighTof.get()->name() == hname) {
373  cc = slaveHighTof.get()->hits();
374  }
375 }

References slaveHighTof, and slaveLowTof.

◆ newHit()

bool TkAccumulatingSensitiveDetector::newHit ( const G4Step *  aStep)
private

Definition at line 318 of file TkAccumulatingSensitiveDetector.cc.

318  {
319  const G4Track* theTrack = aStep->GetTrack();
320 
321  // for neutral particles do not merge hits (V.I.)
322  if (0.0 == theTrack->GetDefinition()->GetPDGCharge())
323  return true;
324 
325  uint32_t theDetUnitId = setDetUnitId(aStep);
326  int theTrackID = theTrack->GetTrackID();
327 
328  LogDebug("TrackerSimDebug") << "newHit: OLD(detID,trID) = (" << lastId << "," << lastTrack << "), NEW = ("
329  << theDetUnitId << "," << theTrackID << ") Step length(mm)= " << aStep->GetStepLength()
330  << " Edep= " << aStep->GetTotalEnergyDeposit()
331  << " p= " << aStep->GetPreStepPoint()->GetMomentum().mag();
332  return ((theTrackID == lastTrack) && (lastId == theDetUnitId) && closeHit(aStep)) ? false : true;
333 }

References closeHit(), funct::false, lastId, lastTrack, LogDebug, and setDetUnitId().

Referenced by ProcessHits().

◆ ProcessHits()

bool TkAccumulatingSensitiveDetector::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
overridevirtual

Implements SensitiveDetector.

Definition at line 108 of file TkAccumulatingSensitiveDetector.cc.

108  {
109  LogDebug("TrackerSimDebug") << " Entering a new Step " << aStep->GetTotalEnergyDeposit() << " "
110  << aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();
111 
112  if (aStep->GetTotalEnergyDeposit() > 0. || allowZeroEnergyLoss) {
113  if (!mySimHit) {
114  createHit(aStep);
115  } else if (neverAccumulate || newHit(aStep)) {
116  sendHit();
117  createHit(aStep);
118  } else {
119  updateHit(aStep);
120  }
121  return true;
122  }
123  return false;
124 }

References allowZeroEnergyLoss, createHit(), LogDebug, mySimHit, neverAccumulate, newHit(), sendHit(), and updateHit().

Referenced by LaserAlignmentSimulation::update().

◆ sendHit()

void TkAccumulatingSensitiveDetector::sendHit ( )
private

Definition at line 175 of file TkAccumulatingSensitiveDetector.cc.

175  {
176  if (mySimHit == nullptr)
177  return;
178  if (printHits) {
179  TkSimHitPrinter thePrinter("TkHitPositionOSCAR.dat");
180  thePrinter.startNewSimHit(GetName(),
181  oldVolume->GetLogicalVolume()->GetName(),
182  mySimHit->detUnitId(),
183  mySimHit->trackId(),
184  lastTrack,
185  eventno);
186  thePrinter.printLocal(mySimHit->entryPoint(), mySimHit->exitPoint());
187  thePrinter.printGlobal(globalEntryPoint, globalExitPoint);
188  thePrinter.printHitData(pname, mySimHit->pabs(), mySimHit->energyLoss(), mySimHit->timeOfFlight());
189  thePrinter.printGlobalMomentum(px, py, pz);
190  LogDebug("TrackerSimDebug") << " Storing PSimHit: " << mySimHit->detUnitId() << " " << mySimHit->trackId() << " "
191  << mySimHit->energyLoss() << " " << mySimHit->entryPoint() << " "
192  << mySimHit->exitPoint();
193  }
194 
195  if (mySimHit->timeOfFlight() < theTofLimit) {
196  slaveLowTof.get()->processHits(*mySimHit); // implicit conversion (slicing) to PSimHit!!!
197  } else {
198  slaveHighTof.get()->processHits(*mySimHit); // implicit conversion (slicing) to PSimHit!!!
199  }
200  //
201  // clean up
202  delete mySimHit;
203  mySimHit = nullptr;
204  lastTrack = 0;
205  lastId = 0;
206 }

References PSimHit::detUnitId(), PSimHit::energyLoss(), PSimHit::entryPoint(), eventno, PSimHit::exitPoint(), globalEntryPoint, globalExitPoint, lastId, lastTrack, LogDebug, mySimHit, oldVolume, PSimHit::pabs(), pname, TkSimHitPrinter::printGlobal(), TkSimHitPrinter::printGlobalMomentum(), TkSimHitPrinter::printHitData(), printHits, TkSimHitPrinter::printLocal(), px, py, pz, slaveHighTof, slaveLowTof, TkSimHitPrinter::startNewSimHit(), theTofLimit, PSimHit::timeOfFlight(), and PSimHit::trackId().

Referenced by EndOfEvent(), and ProcessHits().

◆ setDetUnitId()

uint32_t TkAccumulatingSensitiveDetector::setDetUnitId ( const G4Step *  step)
overridevirtual

Implements SensitiveDetector.

Definition at line 126 of file TkAccumulatingSensitiveDetector.cc.

126  {
127  return theNumberingScheme->g4ToNumberingScheme(step->GetPreStepPoint()->GetTouchable());
128 }

References TrackerG4SimHitNumberingScheme::g4ToNumberingScheme(), and theNumberingScheme.

Referenced by createHit(), and newHit().

◆ update() [1/3]

void TkAccumulatingSensitiveDetector::update ( const BeginOfEvent )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 349 of file TkAccumulatingSensitiveDetector.cc.

349  {
350  clearHits();
351  eventno = (*i)()->GetEventID();
352  delete mySimHit;
353  mySimHit = nullptr;
354 }

References clearHits(), eventno, and mySimHit.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [2/3]

void TkAccumulatingSensitiveDetector::update ( const BeginOfJob )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob * >.

Definition at line 356 of file TkAccumulatingSensitiveDetector.cc.

356  {
358  const edm::EventSetup* es = (*i)();
359  es->get<IdealGeometryRecord>().get(pDD);
360 
362 }

References edm::EventSetup::get(), get, numberingScheme(), and theNumberingScheme.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [3/3]

void TkAccumulatingSensitiveDetector::update ( const BeginOfTrack )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 130 of file TkAccumulatingSensitiveDetector.cc.

130  {
131  const G4Track* gTrack = (*bot)();
132 
133 #ifdef DUMPPROCESSES
134  if (gTrack->GetCreatorProcess()) {
135  edm::LogVerbatim("TrackerSim") << " -> PROCESS CREATOR : " << gTrack->GetCreatorProcess()->GetProcessName();
136  } else {
137  edm::LogVerbatim("TrackerSim") << " -> No Creator process";
138  }
139 #endif
140 
141  //
142  //Position
143  //
144  const G4ThreeVector& pos = gTrack->GetPosition();
145  LogDebug("TrackerSimDebug") << " update(..) of " << gTrack->GetDefinition()->GetParticleName()
146  << " trackID= " << gTrack->GetTrackID() << " E(MeV)= " << gTrack->GetKineticEnergy()
147  << " Ecut= " << energyCut << " R(mm)= " << pos.perp() << " Z(mm)= " << pos.z();
148 
149  //
150  // Check if in Tracker Volume
151  //
152  if (pos.x() * pos.x() + pos.y() * pos.y() < rTracker2 && std::abs(pos.z()) < zTracker) {
153  //
154  // inside the Tracker
155  //
156  TrackInformation* info = nullptr;
157  if (gTrack->GetKineticEnergy() > energyCut) {
158  info = cmsTrackInformation(gTrack);
159  info->storeTrack(true);
160  }
161  //
162  // Save History?
163  //
164  if (gTrack->GetKineticEnergy() > energyHistoryCut) {
165  if (!info) {
166  info = cmsTrackInformation(gTrack);
167  }
168  info->putInHistory();
169  LogDebug("TrackerSimDebug") << " Track inside the tracker selected for HISTORY"
170  << " Track ID= " << gTrack->GetTrackID();
171  }
172  }
173 }

References funct::abs(), SensitiveDetector::cmsTrackInformation(), energyCut, energyHistoryCut, info(), LogDebug, rTracker2, and zTracker.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ updateHit()

void TkAccumulatingSensitiveDetector::updateHit ( const G4Step *  aStep)
private

Definition at line 300 of file TkAccumulatingSensitiveDetector.cc.

300  {
301  // VI: in past here was a check if a hit is inside a sensitive detector,
302  // this is not needed, because call to senstive detector happens
303  // only inside the volume
304  Local3DPoint theExitPoint = theRotation.get()->transformPoint(LocalPostStepPosition(aStep));
305  float theEnergyLoss = aStep->GetTotalEnergyDeposit() / GeV;
306  mySimHit->setExitPoint(theExitPoint);
307  mySimHit->addEnergyLoss(theEnergyLoss);
308  if (printHits) {
309  globalExitPoint = ConvertToLocal3DPoint(aStep->GetPostStepPoint()->GetPosition());
310  LogDebug("TrackerSimDebug") << " updateHit: for " << aStep->GetTrack()->GetDefinition()->GetParticleName()
311  << " trackID= " << aStep->GetTrack()->GetTrackID() << " deltaEloss= " << theEnergyLoss
312  << "\n Updated PSimHit: " << mySimHit->detUnitId() << " " << mySimHit->trackId() << " "
313  << mySimHit->energyLoss() << " " << mySimHit->entryPoint() << " "
314  << mySimHit->exitPoint();
315  }
316 }

References UpdatablePSimHit::addEnergyLoss(), SensitiveDetector::ConvertToLocal3DPoint(), PSimHit::detUnitId(), PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::exitPoint(), GeV, globalExitPoint, SensitiveDetector::LocalPostStepPosition(), LogDebug, mySimHit, printHits, UpdatablePSimHit::setExitPoint(), theRotation, and PSimHit::trackId().

Referenced by ProcessHits().

Member Data Documentation

◆ allowZeroEnergyLoss

bool TkAccumulatingSensitiveDetector::allowZeroEnergyLoss
private

◆ energyCut

float TkAccumulatingSensitiveDetector::energyCut
private

Definition at line 73 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector(), and update().

◆ energyHistoryCut

float TkAccumulatingSensitiveDetector::energyHistoryCut
private

Definition at line 74 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector(), and update().

◆ eventno

int TkAccumulatingSensitiveDetector::eventno
private

Definition at line 86 of file TkAccumulatingSensitiveDetector.h.

Referenced by sendHit(), and update().

◆ globalEntryPoint

Local3DPoint TkAccumulatingSensitiveDetector::globalEntryPoint
private

Definition at line 82 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

◆ globalExitPoint

Local3DPoint TkAccumulatingSensitiveDetector::globalExitPoint
private

Definition at line 83 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), sendHit(), and updateHit().

◆ lastId

uint32_t TkAccumulatingSensitiveDetector::lastId
private

Definition at line 78 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), newHit(), and sendHit().

◆ lastTrack

int TkAccumulatingSensitiveDetector::lastTrack
private

Definition at line 79 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), newHit(), and sendHit().

◆ mySimHit

UpdatablePSimHit* TkAccumulatingSensitiveDetector::mySimHit
private

◆ neverAccumulate

bool TkAccumulatingSensitiveDetector::neverAccumulate
private

◆ oldVolume

const G4VPhysicalVolume* TkAccumulatingSensitiveDetector::oldVolume
private

Definition at line 84 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

◆ pname

std::string TkAccumulatingSensitiveDetector::pname
private

Definition at line 87 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

◆ printHits

bool TkAccumulatingSensitiveDetector::printHits
private

◆ px

float TkAccumulatingSensitiveDetector::px
private

Definition at line 85 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

◆ py

float TkAccumulatingSensitiveDetector::py
private

Definition at line 85 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

◆ pz

float TkAccumulatingSensitiveDetector::pz
private

Definition at line 85 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

◆ rTracker

double TkAccumulatingSensitiveDetector::rTracker
private

Definition at line 70 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector().

◆ rTracker2

double TkAccumulatingSensitiveDetector::rTracker2
private

Definition at line 69 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector(), and update().

◆ slaveHighTof

std::unique_ptr<TrackingSlaveSD> TkAccumulatingSensitiveDetector::slaveHighTof
private

◆ slaveLowTof

std::unique_ptr<TrackingSlaveSD> TkAccumulatingSensitiveDetector::slaveLowTof
private

◆ theG4ProcTypeEnumerator

std::unique_ptr<const G4ProcessTypeEnumerator> TkAccumulatingSensitiveDetector::theG4ProcTypeEnumerator
private

Definition at line 64 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and TkAccumulatingSensitiveDetector().

◆ theManager

const SimTrackManager* TkAccumulatingSensitiveDetector::theManager
private

Definition at line 60 of file TkAccumulatingSensitiveDetector.h.

◆ theNumberingScheme

TrackerG4SimHitNumberingScheme* TkAccumulatingSensitiveDetector::theNumberingScheme
private

◆ theRotation

std::unique_ptr<FrameRotation> TkAccumulatingSensitiveDetector::theRotation
private

◆ theTofLimit

float TkAccumulatingSensitiveDetector::theTofLimit
private

Definition at line 72 of file TkAccumulatingSensitiveDetector.h.

Referenced by sendHit(), and TkAccumulatingSensitiveDetector().

◆ zTracker

double TkAccumulatingSensitiveDetector::zTracker
private

Definition at line 71 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector(), and update().

TkAccumulatingSensitiveDetector::sendHit
void sendHit()
Definition: TkAccumulatingSensitiveDetector.cc:175
TkAccumulatingSensitiveDetector::printHits
bool printHits
Definition: TkAccumulatingSensitiveDetector.h:67
TkAccumulatingSensitiveDetector::energyCut
float energyCut
Definition: TkAccumulatingSensitiveDetector.h:73
TkAccumulatingSensitiveDetector::lastId
uint32_t lastId
Definition: TkAccumulatingSensitiveDetector.h:78
TkAccumulatingSensitiveDetector::theManager
const SimTrackManager * theManager
Definition: TkAccumulatingSensitiveDetector.h:60
TkAccumulatingSensitiveDetector::createHit
void createHit(const G4Step *)
Definition: TkAccumulatingSensitiveDetector.cc:208
PSimHit::timeOfFlight
float timeOfFlight() const
Definition: PSimHit.h:73
TkAccumulatingSensitiveDetector::px
float px
Definition: TkAccumulatingSensitiveDetector.h:85
funct::false
false
Definition: Factorize.h:29
TkAccumulatingSensitiveDetector::zTracker
double zTracker
Definition: TkAccumulatingSensitiveDetector.h:71
step
step
Definition: StallMonitor.cc:94
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
TkAccumulatingSensitiveDetector::theTofLimit
float theTofLimit
Definition: TkAccumulatingSensitiveDetector.h:72
FakeFrameRotation
Definition: FakeFrameRotation.h:12
TkAccumulatingSensitiveDetector::theNumberingScheme
TrackerG4SimHitNumberingScheme * theNumberingScheme
Definition: TkAccumulatingSensitiveDetector.h:65
TkAccumulatingSensitiveDetector::slaveHighTof
std::unique_ptr< TrackingSlaveSD > slaveHighTof
Definition: TkAccumulatingSensitiveDetector.h:62
UpdatablePSimHit::setExitPoint
void setExitPoint(const Local3DPoint &exit)
Definition: UpdatablePSimHit.h:29
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PV3DBase::theta
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
TkAccumulatingSensitiveDetector::pname
std::string pname
Definition: TkAccumulatingSensitiveDetector.h:87
pos
Definition: PixelAliasList.h:18
TkAccumulatingSensitiveDetector::slaveLowTof
std::unique_ptr< TrackingSlaveSD > slaveLowTof
Definition: TkAccumulatingSensitiveDetector.h:61
TkAccumulatingSensitiveDetector::energyHistoryCut
float energyHistoryCut
Definition: TkAccumulatingSensitiveDetector.h:74
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
TkAccumulatingSensitiveDetector::lastTrack
int lastTrack
Definition: TkAccumulatingSensitiveDetector.h:79
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
PSimHit::entryPoint
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
G4TrackToParticleID::particleID
static int particleID(const G4Track *)
Definition: G4TrackToParticleID.cc:7
TkAccumulatingSensitiveDetector::newHit
bool newHit(const G4Step *)
Definition: TkAccumulatingSensitiveDetector.cc:318
PSimHit::detUnitId
unsigned int detUnitId() const
Definition: PSimHit.h:97
TkAccumulatingSensitiveDetector::theRotation
std::unique_ptr< FrameRotation > theRotation
Definition: TkAccumulatingSensitiveDetector.h:63
PSimHit::pabs
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:67
TkAccumulatingSensitiveDetector::closeHit
bool closeHit(const G4Step *)
Definition: TkAccumulatingSensitiveDetector.cc:335
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
PSimHit::exitPoint
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:46
TkAccumulatingSensitiveDetector::py
float py
Definition: TkAccumulatingSensitiveDetector.h:85
TkAccumulatingSensitiveDetector::globalEntryPoint
Local3DPoint globalEntryPoint
Definition: TkAccumulatingSensitiveDetector.h:82
SensitiveTkDetector::SensitiveTkDetector
SensitiveTkDetector(const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
Definition: SensitiveTkDetector.h:10
TkAccumulatingSensitiveDetector::setDetUnitId
uint32_t setDetUnitId(const G4Step *) override
Definition: TkAccumulatingSensitiveDetector.cc:126
TkAccumulatingSensitiveDetector::globalExitPoint
Local3DPoint globalExitPoint
Definition: TkAccumulatingSensitiveDetector.h:83
edm::ESHandle< GeometricDet >
Point3DBase< float, LocalTag >
SensitiveDetector::LocalPreStepPosition
Local3DPoint LocalPreStepPosition(const G4Step *step) const
Definition: SensitiveDetector.cc:82
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
numberingScheme
static TrackerG4SimHitNumberingScheme & numberingScheme(const GeometricDet &det)
Definition: TkAccumulatingSensitiveDetector.cc:41
UpdatablePSimHit
Definition: UpdatablePSimHit.h:12
GeV
const double GeV
Definition: MathUtil.h:16
TkAccumulatingSensitiveDetector::clearHits
void clearHits() override
Definition: TkAccumulatingSensitiveDetector.cc:364
UpdatablePSimHit::addEnergyLoss
void addEnergyLoss(float eloss)
Definition: UpdatablePSimHit.h:34
TrackerG4SimHitNumberingScheme::g4ToNumberingScheme
unsigned int g4ToNumberingScheme(const G4VTouchable *)
Definition: TrackerG4SimHitNumberingScheme.cc:81
SensitiveDetector::ConvertToLocal3DPoint
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
Definition: SensitiveDetector.h:56
TrackInformation
Definition: TrackInformation.h:8
mag2
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Definition: Basic3DVectorLD.h:124
TkAccumulatingSensitiveDetector::neverAccumulate
bool neverAccumulate
Definition: TkAccumulatingSensitiveDetector.h:68
edm::EventSetup
Definition: EventSetup.h:57
TkAccumulatingSensitiveDetector::eventno
int eventno
Definition: TkAccumulatingSensitiveDetector.h:86
get
#define get
cc
SensitiveDetector::setNames
void setNames(const std::vector< std::string > &)
Definition: SensitiveDetector.cc:105
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
SensitiveDetector::cmsTrackInformation
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
Definition: SensitiveDetector.cc:96
TkAccumulatingSensitiveDetector::theG4ProcTypeEnumerator
std::unique_ptr< const G4ProcessTypeEnumerator > theG4ProcTypeEnumerator
Definition: TkAccumulatingSensitiveDetector.h:64
TkAccumulatingSensitiveDetector::allowZeroEnergyLoss
bool allowZeroEnergyLoss
Definition: TkAccumulatingSensitiveDetector.h:66
TkAccumulatingSensitiveDetector::mySimHit
UpdatablePSimHit * mySimHit
Definition: TkAccumulatingSensitiveDetector.h:77
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
TkAccumulatingSensitiveDetector::updateHit
void updateHit(const G4Step *)
Definition: TkAccumulatingSensitiveDetector.cc:300
Exception
Definition: hltDiff.cc:246
SensitiveDetector::LocalPostStepPosition
Local3DPoint LocalPostStepPosition(const G4Step *step) const
Definition: SensitiveDetector.cc:89
PSimHit::energyLoss
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:79
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PSimHit::trackId
unsigned int trackId() const
Definition: PSimHit.h:106
TkAccumulatingSensitiveDetector::rTracker2
double rTracker2
Definition: TkAccumulatingSensitiveDetector.h:69
TkSimHitPrinter
Definition: TkSimHitPrinter.h:12
TkAccumulatingSensitiveDetector::pz
float pz
Definition: TkAccumulatingSensitiveDetector.h:85
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TkAccumulatingSensitiveDetector::oldVolume
const G4VPhysicalVolume * oldVolume
Definition: TkAccumulatingSensitiveDetector.h:84
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
TkAccumulatingSensitiveDetector::rTracker
double rTracker
Definition: TkAccumulatingSensitiveDetector.h:70