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

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

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::LogInfo("TrackerSimInfo") << " 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 }
T getParameter(std::string const &) const
const double GeV
Definition: MathUtil.h:16
SensitiveTkDetector(const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
std::unique_ptr< TrackingSlaveSD > slaveHighTof
std::unique_ptr< FrameRotation > theRotation
std::unique_ptr< const G4ProcessTypeEnumerator > theG4ProcTypeEnumerator
std::unique_ptr< TrackingSlaveSD > slaveLowTof
double f[11][100]
void setNames(const std::vector< std::string > &)
TrackerG4SimHitNumberingScheme * theNumberingScheme
TkAccumulatingSensitiveDetector::~TkAccumulatingSensitiveDetector ( )
override

Definition at line 104 of file TkAccumulatingSensitiveDetector.cc.

104 {}

Member Function Documentation

void TkAccumulatingSensitiveDetector::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 362 of file TkAccumulatingSensitiveDetector.cc.

References slaveHighTof, and slaveLowTof.

Referenced by update().

362  {
363  slaveLowTof.get()->Initialize();
364  slaveHighTof.get()->Initialize();
365 }
std::unique_ptr< TrackingSlaveSD > slaveHighTof
std::unique_ptr< TrackingSlaveSD > slaveLowTof
bool TkAccumulatingSensitiveDetector::closeHit ( const G4Step *  aStep)
private

Definition at line 333 of file TkAccumulatingSensitiveDetector.cc.

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

Referenced by newHit().

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 }
#define LogDebug(id)
std::unique_ptr< FrameRotation > theRotation
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:46
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Local3DPoint LocalPreStepPosition(const G4Step *step) const
void TkAccumulatingSensitiveDetector::createHit ( const G4Step *  aStep)
private

Definition at line 206 of file TkAccumulatingSensitiveDetector.cc.

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(), TrackInformation::storeTrack(), groupFilesInBlocks::temp, theG4ProcTypeEnumerator, theRotation, PV3DBase< T, PVType, FrameType >::theta(), and PSimHit::trackId().

Referenced by ProcessHits().

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 }
#define LogDebug(id)
const double GeV
Definition: MathUtil.h:16
bool storeTrack() const
std::unique_ptr< FrameRotation > theRotation
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
std::unique_ptr< const G4ProcessTypeEnumerator > theG4ProcTypeEnumerator
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
uint32_t setDetUnitId(const G4Step *) override
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:46
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
static int particleID(const G4Track *)
Local3DPoint LocalPostStepPosition(const G4Step *step) const
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:79
Local3DPoint LocalPreStepPosition(const G4Step *step) const
unsigned int trackId() const
Definition: PSimHit.h:106
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
unsigned int detUnitId() const
Definition: PSimHit.h:97
void TkAccumulatingSensitiveDetector::EndOfEvent ( G4HCofThisEvent *  )
override

Definition at line 341 of file TkAccumulatingSensitiveDetector.cc.

References LogDebug, mySimHit, and sendHit().

341  {
342  LogDebug("TrackerSimDebug") << " Saving the last hit in a ROU " << GetName();
343  if (mySimHit != nullptr)
344  sendHit();
345 }
#define LogDebug(id)
void TkAccumulatingSensitiveDetector::fillHits ( edm::PSimHitContainer cc,
const std::string &  hname 
)
overridevirtual

Implements SensitiveTkDetector.

Definition at line 367 of file TkAccumulatingSensitiveDetector.cc.

References slaveHighTof, and slaveLowTof.

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 }
std::unique_ptr< TrackingSlaveSD > slaveHighTof
std::unique_ptr< TrackingSlaveSD > slaveLowTof
bool TkAccumulatingSensitiveDetector::newHit ( const G4Step *  aStep)
private

Definition at line 316 of file TkAccumulatingSensitiveDetector.cc.

References closeHit(), lastId, lastTrack, LogDebug, and setDetUnitId().

Referenced by ProcessHits().

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 }
#define LogDebug(id)
uint32_t setDetUnitId(const G4Step *) override
bool TkAccumulatingSensitiveDetector::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
overridevirtual

Implements SensitiveDetector.

Definition at line 106 of file TkAccumulatingSensitiveDetector.cc.

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

Referenced by LaserAlignmentSimulation::update().

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 }
#define LogDebug(id)
void TkAccumulatingSensitiveDetector::sendHit ( )
private

Definition at line 173 of file TkAccumulatingSensitiveDetector.cc.

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

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 }
#define LogDebug(id)
std::unique_ptr< TrackingSlaveSD > slaveHighTof
std::unique_ptr< TrackingSlaveSD > slaveLowTof
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:46
float timeOfFlight() const
Definition: PSimHit.h:73
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:67
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:79
unsigned int trackId() const
Definition: PSimHit.h:106
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
unsigned int detUnitId() const
Definition: PSimHit.h:97
uint32_t TkAccumulatingSensitiveDetector::setDetUnitId ( const G4Step *  step)
overridevirtual

Implements SensitiveDetector.

Definition at line 124 of file TkAccumulatingSensitiveDetector.cc.

References TrackerG4SimHitNumberingScheme::g4ToNumberingScheme(), and theNumberingScheme.

Referenced by createHit(), and newHit().

124  {
125  return theNumberingScheme->g4ToNumberingScheme(step->GetPreStepPoint()->GetTouchable());
126 }
unsigned int g4ToNumberingScheme(const G4VTouchable *)
step
Definition: StallMonitor.cc:94
TrackerG4SimHitNumberingScheme * theNumberingScheme
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.

References clearHits(), eventno, and mySimHit.

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

347  {
348  clearHits();
349  eventno = (*i)()->GetEventID();
350  delete mySimHit;
351  mySimHit = nullptr;
352 }
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.

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

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

128  {
129  const G4Track* gTrack = (*bot)();
130 
131 #ifdef DUMPPROCESSES
132  if (gTrack->GetCreatorProcess()) {
133  edm::LogVerbatim("TrackerSimInfo") << " -> PROCESS CREATOR : " << gTrack->GetCreatorProcess()->GetProcessName();
134  } else {
135  edm::LogVerbatim("TrackerSimInfo") << " -> 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 }
#define LogDebug(id)
static const TGPicture * info(bool iBackgroundIsBlack)
bool storeTrack() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
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.

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

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

354  {
356  const edm::EventSetup* es = (*i)();
357  es->get<IdealGeometryRecord>().get(pDD);
358 
360 }
T get() const
Definition: EventSetup.h:73
static TrackerG4SimHitNumberingScheme & numberingScheme(const GeometricDet &det)
TrackerG4SimHitNumberingScheme * theNumberingScheme
void TkAccumulatingSensitiveDetector::updateHit ( const G4Step *  aStep)
private

Definition at line 298 of file TkAccumulatingSensitiveDetector.cc.

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

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 }
#define LogDebug(id)
const double GeV
Definition: MathUtil.h:16
std::unique_ptr< FrameRotation > theRotation
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
void setExitPoint(const Local3DPoint &exit)
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:46
void addEnergyLoss(float eloss)
Local3DPoint LocalPostStepPosition(const G4Step *step) const
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:79
unsigned int trackId() const
Definition: PSimHit.h:106
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
unsigned int detUnitId() const
Definition: PSimHit.h:97

Member Data Documentation

bool TkAccumulatingSensitiveDetector::allowZeroEnergyLoss
private
float TkAccumulatingSensitiveDetector::energyCut
private

Definition at line 73 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector(), and update().

float TkAccumulatingSensitiveDetector::energyHistoryCut
private

Definition at line 74 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector(), and update().

int TkAccumulatingSensitiveDetector::eventno
private

Definition at line 86 of file TkAccumulatingSensitiveDetector.h.

Referenced by sendHit(), and update().

Local3DPoint TkAccumulatingSensitiveDetector::globalEntryPoint
private

Definition at line 82 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

Local3DPoint TkAccumulatingSensitiveDetector::globalExitPoint
private

Definition at line 83 of file TkAccumulatingSensitiveDetector.h.

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

uint32_t TkAccumulatingSensitiveDetector::lastId
private

Definition at line 78 of file TkAccumulatingSensitiveDetector.h.

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

int TkAccumulatingSensitiveDetector::lastTrack
private

Definition at line 79 of file TkAccumulatingSensitiveDetector.h.

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

UpdatablePSimHit* TkAccumulatingSensitiveDetector::mySimHit
private
bool TkAccumulatingSensitiveDetector::neverAccumulate
private
const G4VPhysicalVolume* TkAccumulatingSensitiveDetector::oldVolume
private

Definition at line 84 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

std::string TkAccumulatingSensitiveDetector::pname
private

Definition at line 87 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

bool TkAccumulatingSensitiveDetector::printHits
private
float TkAccumulatingSensitiveDetector::px
private

Definition at line 85 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

float TkAccumulatingSensitiveDetector::py
private

Definition at line 85 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

float TkAccumulatingSensitiveDetector::pz
private

Definition at line 85 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

double TkAccumulatingSensitiveDetector::rTracker
private

Definition at line 70 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector().

double TkAccumulatingSensitiveDetector::rTracker2
private

Definition at line 69 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector(), and update().

std::unique_ptr<TrackingSlaveSD> TkAccumulatingSensitiveDetector::slaveHighTof
private
std::unique_ptr<TrackingSlaveSD> TkAccumulatingSensitiveDetector::slaveLowTof
private
std::unique_ptr<const G4ProcessTypeEnumerator> TkAccumulatingSensitiveDetector::theG4ProcTypeEnumerator
private

Definition at line 64 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and TkAccumulatingSensitiveDetector().

const SimTrackManager* TkAccumulatingSensitiveDetector::theManager
private

Definition at line 60 of file TkAccumulatingSensitiveDetector.h.

TrackerG4SimHitNumberingScheme* TkAccumulatingSensitiveDetector::theNumberingScheme
private
std::unique_ptr<FrameRotation> TkAccumulatingSensitiveDetector::theRotation
private
float TkAccumulatingSensitiveDetector::theTofLimit
private

Definition at line 72 of file TkAccumulatingSensitiveDetector.h.

Referenced by sendHit(), and TkAccumulatingSensitiveDetector().

double TkAccumulatingSensitiveDetector::zTracker
private

Definition at line 71 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector(), and update().