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 44 of file TkAccumulatingSensitiveDetector.cc.

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

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 104 of file TkAccumulatingSensitiveDetector.cc.

104 {}

Member Function Documentation

◆ clearHits()

void TkAccumulatingSensitiveDetector::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 362 of file TkAccumulatingSensitiveDetector.cc.

362  {
363  slaveLowTof.get()->Initialize();
364  slaveHighTof.get()->Initialize();
365 }

References slaveHighTof, and slaveLowTof.

Referenced by update().

◆ closeHit()

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

Definition at line 333 of file TkAccumulatingSensitiveDetector.cc.

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

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 206 of file TkAccumulatingSensitiveDetector.cc.

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

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 341 of file TkAccumulatingSensitiveDetector.cc.

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

References LogDebug, mySimHit, and sendHit().

◆ fillHits()

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

Implements SensitiveTkDetector.

Definition at line 367 of file TkAccumulatingSensitiveDetector.cc.

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

References slaveHighTof, and slaveLowTof.

◆ newHit()

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

Definition at line 316 of file TkAccumulatingSensitiveDetector.cc.

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

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 106 of file TkAccumulatingSensitiveDetector.cc.

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

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

Referenced by LaserAlignmentSimulation::update().

◆ sendHit()

void TkAccumulatingSensitiveDetector::sendHit ( )
private

Definition at line 173 of file TkAccumulatingSensitiveDetector.cc.

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

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 124 of file TkAccumulatingSensitiveDetector.cc.

124  {
125  return theNumberingScheme->g4ToNumberingScheme(step->GetPreStepPoint()->GetTouchable());
126 }

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 347 of file TkAccumulatingSensitiveDetector.cc.

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

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 354 of file TkAccumulatingSensitiveDetector.cc.

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

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 128 of file TkAccumulatingSensitiveDetector.cc.

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

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 298 of file TkAccumulatingSensitiveDetector.cc.

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

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:173
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:206
PSimHit::timeOfFlight
float timeOfFlight() const
Definition: PSimHit.h:73
TkAccumulatingSensitiveDetector::px
float px
Definition: TkAccumulatingSensitiveDetector.h:85
funct::false
false
Definition: Factorize.h:34
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:152
TrackerFrameRotation
Definition: TrackerFrameRotation.h:12
TkAccumulatingSensitiveDetector::lastTrack
int lastTrack
Definition: TkAccumulatingSensitiveDetector.h:79
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
PSimHit::entryPoint
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
G4ProcessTypeEnumerator
Definition: G4ProcessTypeEnumerator.h:6
G4TrackToParticleID::particleID
static int particleID(const G4Track *)
Definition: G4TrackToParticleID.cc:7
TkAccumulatingSensitiveDetector::newHit
bool newHit(const G4Step *)
Definition: TkAccumulatingSensitiveDetector.cc:316
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:333
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
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:124
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
edm::LogWarning
Definition: MessageLogger.h:141
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
numberingScheme
static TrackerG4SimHitNumberingScheme & numberingScheme(const GeometricDet &det)
Definition: TkAccumulatingSensitiveDetector.cc:39
UpdatablePSimHit
Definition: UpdatablePSimHit.h:12
GeV
const double GeV
Definition: MathUtil.h:16
TkAccumulatingSensitiveDetector::clearHits
void clearHits() override
Definition: TkAccumulatingSensitiveDetector.cc:362
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
edm::LogVerbatim
Definition: MessageLogger.h:297
TkAccumulatingSensitiveDetector::neverAccumulate
bool neverAccumulate
Definition: TkAccumulatingSensitiveDetector.h:68
TrackingSlaveSD
Definition: TrackingSlaveSD.h:11
edm::EventSetup
Definition: EventSetup.h:57
TkAccumulatingSensitiveDetector::eventno
int eventno
Definition: TkAccumulatingSensitiveDetector.h:86
get
#define get
cc
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
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
TkAccumulatingSensitiveDetector::updateHit
void updateHit(const G4Step *)
Definition: TkAccumulatingSensitiveDetector.cc:298
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
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:27
TkAccumulatingSensitiveDetector::rTracker
double rTracker
Definition: TkAccumulatingSensitiveDetector.h:70