CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public 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

virtual void EndOfEvent (G4HCofThisEvent *)
 
void fillHits (edm::PSimHitContainer &, std::string use)
 
std::vector< std::string > getNames ()
 
virtual bool ProcessHits (G4Step *, G4TouchableHistory *)
 
virtual uint32_t setDetUnitId (G4Step *)
 
 TkAccumulatingSensitiveDetector (std::string, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
std::string type ()
 
virtual ~TkAccumulatingSensitiveDetector ()
 
- Public Member Functions inherited from SensitiveTkDetector
 SensitiveTkDetector (std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
virtual void AssignSD (std::string &vname)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point)
 
Local3DPoint FinalStepPosition (G4Step *s, coordinates)
 
virtual void Initialize (G4HCofThisEvent *eventHC)
 
Local3DPoint InitialStepPosition (G4Step *s, coordinates)
 
std::string nameOfSD ()
 
void NaNTrap (G4Step *step)
 
void Register ()
 
 SensitiveDetector (std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
virtual ~SensitiveDetector ()
 
- Public Member Functions inherited from Observer< const 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 ()
 

Private Member Functions

void checkExitPoint (Local3DPoint)
 
virtual void clearHits ()
 
virtual bool closeHit (G4Step *)
 
virtual void createHit (G4Step *)
 
TrackInformationgetOrCreateTrackInformation (const G4Track *)
 
virtual bool newHit (G4Step *)
 
virtual void sendHit ()
 
int tofBin (float)
 
Local3DPoint toOrcaRef (Local3DPoint, G4VPhysicalVolume *)
 
void update (const BeginOfEvent *)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfTrack *)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfJob *)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void updateHit (G4Step *)
 

Private Attributes

bool allowZeroEnergyLoss
 
float energyCut
 
float energyHistoryCut
 
int eventno
 
Local3DPoint globalEntryPoint
 
Local3DPoint globalExitPoint
 
uint32_t lastId
 
unsigned int lastTrack
 
G4TrackToParticleIDmyG4TrackToParticleID
 
std::string myName
 
FrameRotationmyRotation
 
UpdatablePSimHitmySimHit
 
bool neverAccumulate
 
TrackerG4SimHitNumberingSchemenumberingScheme_
 
G4VPhysicalVolume * oldVolume
 
std::string pname
 
bool printHits
 
float px
 
float py
 
float pz
 
float rTracker
 
TrackingSlaveSDslaveHighTof
 
TrackingSlaveSDslaveLowTof
 
G4ProcessTypeEnumeratortheG4ProcessTypeEnumerator
 
const SimTrackManagertheManager
 
double theSigma
 
float zTracker
 

Additional Inherited Members

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

Detailed Description

Definition at line 30 of file TkAccumulatingSensitiveDetector.h.

Constructor & Destructor Documentation

TkAccumulatingSensitiveDetector::TkAccumulatingSensitiveDetector ( std::string  ,
const DDCompactView ,
SensitiveDetectorCatalog ,
edm::ParameterSet const &  ,
const SimTrackManager  
)

Definition at line 64 of file TkAccumulatingSensitiveDetector.cc.

References allowZeroEnergyLoss, SensitiveDetector::AssignSD(), energyCut, energyHistoryCut, edm::ParameterSet::getParameter(), GeV, SensitiveDetectorCatalog::logicalNames(), myG4TrackToParticleID, myName, myRotation, neverAccumulate, printHits, SensitiveDetector::Register(), slaveHighTof, slaveLowTof, theG4ProcessTypeEnumerator, and theSigma.

68  :
69  SensitiveTkDetector(name, cpv, clg, p), myName(name), myRotation(0), mySimHit(0),theManager(manager),
70  oldVolume(0), lastId(0), lastTrack(0), eventno(0) ,rTracker(1200.*mm),zTracker(3000.*mm),
72 {
73 
74  edm::ParameterSet m_TrackerSD = p.getParameter<edm::ParameterSet>("TrackerSD");
75  allowZeroEnergyLoss = m_TrackerSD.getParameter<bool>("ZeroEnergyLoss");
76  neverAccumulate = m_TrackerSD.getParameter<bool>("NeverAccumulate");
77  printHits = m_TrackerSD.getParameter<bool>("PrintHits");
78  theSigma = m_TrackerSD.getParameter<double>("ElectronicSigmaInNanoSeconds");
79  energyCut = m_TrackerSD.getParameter<double>("EnergyThresholdForPersistencyInGeV")*GeV; //default must be 0.5
80  energyHistoryCut = m_TrackerSD.getParameter<double>("EnergyThresholdForHistoryInGeV")*GeV;//default must be 0.05
81 
82  edm::LogInfo("TrackerSimInfo") <<"Criteria for Saving Tracker SimTracks: ";
83  edm::LogInfo("TrackerSimInfo")<<" History: "<<energyHistoryCut<< " MeV ; Persistency: "<< energyCut<<" MeV ";
84  edm::LogInfo("TrackerSimInfo")<<" Constructing a TkAccumulatingSensitiveDetector with ";
85 
86 #ifndef FAKEFRAMEROTATION
87  // No Rotation given in input, automagically choose one based upon the name
88  if (name.find("TrackerHits") != string::npos)
89  {
90  edm::LogInfo("TrackerSimInfo")<<" TkAccumulatingSensitiveDetector: using TrackerFrameRotation for "<<myName;
92  }
93  // Just in case (test beam etc)
94  if (myRotation == 0)
95  {
96  edm::LogInfo("TrackerSimInfo")<<" TkAccumulatingSensitiveDetector: using StandardFrameRotation for "<<myName;
98  }
99 #else
101  edm::LogWarning("TrackerSimInfo")<< " WARNING - Using FakeFrameRotation in TkAccumulatingSensitiveDetector;";
102 #endif
103 
104  slaveLowTof = new TrackingSlaveSD(name+"LowTof");
105  slaveHighTof = new TrackingSlaveSD(name+"HighTof");
106 
107  // Now attach the right detectors (LogicalVolumes) to me
108  vector<string> lvNames = clg.logicalNames(name);
109  this->Register();
110  for (vector<string>::iterator it = lvNames.begin(); it != lvNames.end(); it++)
111  {
112  edm::LogInfo("TrackerSimInfo")<< name << " attaching LV " << *it;
113  this->AssignSD(*it);
114  }
115 
118 }
T getParameter(std::string const &) const
const double GeV
Definition: MathUtil.h:16
SensitiveTkDetector(std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
TrackerG4SimHitNumberingScheme * numberingScheme_
virtual void AssignSD(std::string &vname)
G4ProcessTypeEnumerator * theG4ProcessTypeEnumerator
TkAccumulatingSensitiveDetector::~TkAccumulatingSensitiveDetector ( )
virtual

Member Function Documentation

void TkAccumulatingSensitiveDetector::checkExitPoint ( Local3DPoint  p)
private

Definition at line 447 of file TkAccumulatingSensitiveDetector.cc.

References funct::abs(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by createHit(), and updateHit().

448 {
449  double z = p.z();
450  if (std::abs(z)<0.3*mm) return;
451  bool sendExc = false;
452  //static SimpleConfigurable<bool> sendExc(false,"TrackerSim:ThrowOnBadHits");
453  edm::LogWarning("TrackerSimInfo")<< " ************ Hit outside the detector ; Local z " << z
454  << "; skipping event = " << sendExc;
455  if (sendExc == true)
456  {
457  G4EventManager::GetEventManager()->AbortCurrentEvent();
458  G4EventManager::GetEventManager()->GetNonconstCurrentEvent()->SetEventAborted();
459  }
460 }
float float float z
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void TkAccumulatingSensitiveDetector::clearHits ( )
privatevirtual
bool TkAccumulatingSensitiveDetector::closeHit ( G4Step *  aStep)
privatevirtual

Definition at line 400 of file TkAccumulatingSensitiveDetector.cc.

References PSimHit::exitPoint(), SensitiveDetector::InitialStepPosition(), SensitiveDetector::LocalCoordinates, LogDebug, mag(), mySimHit, toOrcaRef(), and findQualityFiles::v.

Referenced by newHit().

401 {
402  if (mySimHit == 0) return false;
403  const float tolerance = 0.05 * mm; // 50 micron are allowed between the exit
404  // point of the current hit and the entry point of the new hit
405  G4VPhysicalVolume * v = aStep->GetPreStepPoint()->GetPhysicalVolume();
407  LogDebug("TrackerSimDebug")<< " closeHit: distance = " << (mySimHit->exitPoint()-theEntryPoint).mag();
408 
409  if ((mySimHit->exitPoint()-theEntryPoint).mag()<tolerance) return true;
410  return false;
411 }
#define LogDebug(id)
Local3DPoint toOrcaRef(Local3DPoint, G4VPhysicalVolume *)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
Local3DPoint InitialStepPosition(G4Step *s, coordinates)
void TkAccumulatingSensitiveDetector::createHit ( G4Step *  aStep)
privatevirtual

Definition at line 258 of file TkAccumulatingSensitiveDetector.cc.

References checkExitPoint(), SensitiveDetector::ConvertToLocal3DPoint(), PSimHit::detUnitId(), PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::exitPoint(), SensitiveDetector::FinalStepPosition(), GeV, globalEntryPoint, globalExitPoint, info(), SensitiveDetector::InitialStepPosition(), lastId, lastTrack, SensitiveDetector::LocalCoordinates, LogDebug, myG4TrackToParticleID, mySimHit, oldVolume, G4TrackToParticleID::particleID(), PV3DBase< T, PVType, FrameType >::phi(), pname, G4ProcessTypeEnumerator::processId(), px, py, pz, setDetUnitId(), TrackInformation::storeTrack(), groupFilesInBlocks::temp, theG4ProcessTypeEnumerator, PV3DBase< T, PVType, FrameType >::theta(), toOrcaRef(), PSimHit::trackId(), findQualityFiles::v, and SensitiveDetector::WorldCoordinates.

Referenced by ProcessHits().

259 {
260  if (mySimHit != 0)
261  {
262  delete mySimHit;
263  mySimHit=0;
264  }
265 
266  G4Track * theTrack = aStep->GetTrack();
267 
268  G4VPhysicalVolume * v = aStep->GetPreStepPoint()->GetPhysicalVolume();
269  Local3DPoint theEntryPoint;
270  Local3DPoint theExitPoint =
272 
273  //
274  // Check particle type - for gamma and neutral hadrons energy deposition
275  // should be local (V.I.)
276  //
277  if(0.0 == theTrack->GetDefinition()->GetPDGCharge()) {
278  theEntryPoint = theExitPoint;
279  } else {
281  }
282 
283  //
284  // This allows to send he skipEvent if it is outside!
285  //
286  checkExitPoint(theExitPoint);
287  float thePabs = aStep->GetPreStepPoint()->GetMomentum().mag()/GeV;
288  float theTof = aStep->GetPreStepPoint()->GetGlobalTime()/nanosecond;
289  float theEnergyLoss = aStep->GetTotalEnergyDeposit()/GeV;
290  int theParticleType = myG4TrackToParticleID->particleID(theTrack);
291  uint32_t theDetUnitId = setDetUnitId(aStep);
292 
293  //
294  // Check on particle charge is not applied because these points are not stored
295  // in hits (V.I.)
296  //
299 
300  pname = theTrack->GetDynamicParticle()->GetDefinition()->GetParticleName();
301 
302  if (theDetUnitId == 0)
303  {
304  edm::LogError("TrackerSimInfo") << " Error: theDetUnitId is not valid.";
305  abort();
306  }
307  unsigned int theTrackID = theTrack->GetTrackID();
308 
309  // To whom assign the Hit?
310  // First iteration: if the track is to be stored, use the current number;
311  // otherwise, get to the mother
312  unsigned int theTrackIDInsideTheSimHit=theTrackID;
313 
314 
315  G4VUserTrackInformation * info = theTrack->GetUserInformation();
316  if (info == 0) edm::LogError("TrackerSimInfo")<< " Error: no UserInformation available ";
317  else
318  {
319  TrackInformation * temp = dynamic_cast<TrackInformation* >(info);
320  if (temp ==0) edm::LogError("TrackerSimInfo")<< " Error:G4VUserTrackInformation is not a TrackInformation.";
321  if (temp->storeTrack() == false)
322  {
323  // Go to the mother!
324  LogDebug("TrackerSimDebug")<< " TkAccumulatingSensitiveDetector:createHit(): setting the TrackID from "
325  << theTrackIDInsideTheSimHit;
326  theTrackIDInsideTheSimHit = theTrack->GetParentID();
327  LogDebug("TrackerSimDebug")<< " to the mother one " << theTrackIDInsideTheSimHit << " " << theEnergyLoss;
328  }
329  else
330  {
331  LogDebug("TrackerSimDebug")<< " TkAccumulatingSensitiveDetector:createHit(): leaving the current TrackID "
332  << theTrackIDInsideTheSimHit;
333  }
334  }
335 
336  px = aStep->GetPreStepPoint()->GetMomentum().x()/GeV;
337  py = aStep->GetPreStepPoint()->GetMomentum().y()/GeV;
338  pz = aStep->GetPreStepPoint()->GetMomentum().z()/GeV;
339 
340  G4ThreeVector gmd = aStep->GetPreStepPoint()->GetMomentumDirection();
341  // convert it to local frame
342  G4ThreeVector lmd = ((G4TouchableHistory *)(aStep->GetPreStepPoint()->GetTouchable()))->GetHistory()
343  ->GetTopTransform().TransformAxis(gmd);
345  float theThetaAtEntry = lnmd.theta();
346  float thePhiAtEntry = lnmd.phi();
347 
348  mySimHit = new UpdatablePSimHit(theEntryPoint,theExitPoint,thePabs,theTof,
349  theEnergyLoss,theParticleType,theDetUnitId,
350  theTrackIDInsideTheSimHit,theThetaAtEntry,thePhiAtEntry,
351  theG4ProcessTypeEnumerator->processId(theTrack->GetCreatorProcess()));
352  LogDebug("TrackerSimDebug")<< " Created PSimHit: " << pname << " " << mySimHit->detUnitId() << " " << mySimHit->trackId()
353  << " " << mySimHit->energyLoss() << " " << mySimHit->entryPoint()
354  << " " << mySimHit->exitPoint();
355  lastId = theDetUnitId;
356  lastTrack = theTrackID;
357  oldVolume = v;
358 }
#define LogDebug(id)
static const TGPicture * info(bool iBackgroundIsBlack)
const double GeV
Definition: MathUtil.h:16
bool storeTrack() const
Local3DPoint toOrcaRef(Local3DPoint, G4VPhysicalVolume *)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
unsigned int processId(const G4VProcess *p)
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point)
static int particleID(const G4Track *)
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:75
unsigned int trackId() const
Definition: PSimHit.h:102
Local3DPoint FinalStepPosition(G4Step *s, coordinates)
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
Local3DPoint InitialStepPosition(G4Step *s, coordinates)
unsigned int detUnitId() const
Definition: PSimHit.h:93
G4ProcessTypeEnumerator * theG4ProcessTypeEnumerator
void TkAccumulatingSensitiveDetector::EndOfEvent ( G4HCofThisEvent *  )
virtual

Reimplemented from SensitiveDetector.

Definition at line 413 of file TkAccumulatingSensitiveDetector.cc.

References LogDebug, myName, mySimHit, and sendHit().

414 {
415 
416  LogDebug("TrackerSimDebug")<< " Saving the last hit in a ROU " << myName;
417 
418  if (mySimHit == 0) return;
419  sendHit();
420 }
#define LogDebug(id)
void TkAccumulatingSensitiveDetector::fillHits ( edm::PSimHitContainer c,
std::string  use 
)
virtual

Implements SensitiveTkDetector.

Definition at line 477 of file TkAccumulatingSensitiveDetector.cc.

References TrackingSlaveSD::hits(), n, TrackingSlaveSD::name(), slaveHighTof, and slaveLowTof.

477  {
478  //
479  // do it once for low, once for High
480  //
481 
482  if (slaveLowTof->name() == n) c=slaveLowTof->hits();
483  if (slaveHighTof->name() == n) c=slaveHighTof->hits();
484 
485 }
std::string name() const
std::vector< PSimHit > & hits()
std::vector< string > TkAccumulatingSensitiveDetector::getNames ( )
virtual

Reimplemented from SensitiveDetector.

Definition at line 487 of file TkAccumulatingSensitiveDetector.cc.

References TrackingSlaveSD::name(), slaveHighTof, slaveLowTof, and groupFilesInBlocks::temp.

487  {
488  std::vector<string> temp;
489  temp.push_back(slaveLowTof->name());
490  temp.push_back(slaveHighTof->name());
491  return temp;
492 }
std::string name() const
TrackInformation * TkAccumulatingSensitiveDetector::getOrCreateTrackInformation ( const G4Track *  gTrack)
private

Definition at line 462 of file TkAccumulatingSensitiveDetector.cc.

References info(), and groupFilesInBlocks::temp.

Referenced by update().

462  {
463  G4VUserTrackInformation* temp = gTrack->GetUserInformation();
464  if (temp == 0){
465  edm::LogError("TrackerSimInfo") <<" ERROR: no G4VUserTrackInformation available";
466  abort();
467  }else{
468  TrackInformation* info = dynamic_cast<TrackInformation*>(temp);
469  if (info ==0){
470  edm::LogError("TrackerSimInfo")<<" ERROR: TkSimTrackSelection: the UserInformation does not appear to be a TrackInformation";
471  abort();
472  }
473  return info;
474  }
475 }
static const TGPicture * info(bool iBackgroundIsBlack)
bool TkAccumulatingSensitiveDetector::newHit ( G4Step *  aStep)
privatevirtual

Definition at line 381 of file TkAccumulatingSensitiveDetector.cc.

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

Referenced by ProcessHits().

382 {
383  if (neverAccumulate == true) return true;
384  G4Track * theTrack = aStep->GetTrack();
385 
386  // for neutral particles do not merge hits (V.I.)
387  if(0.0 == theTrack->GetDefinition()->GetPDGCharge()) return true;
388 
389  uint32_t theDetUnitId = setDetUnitId(aStep);
390  unsigned int theTrackID = theTrack->GetTrackID();
391 
392  LogDebug("TrackerSimDebug")<< " OLD (d,t) = (" << lastId << "," << lastTrack
393  << "), new = (" << theDetUnitId << "," << theTrackID << ") return "
394  << ((theTrackID == lastTrack) && (lastId == theDetUnitId));
395  if ((mySimHit != 0) && (theTrackID == lastTrack) && (lastId == theDetUnitId) && closeHit(aStep))
396  return false;
397  return true;
398 }
#define LogDebug(id)
bool TkAccumulatingSensitiveDetector::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *  ROhist 
)
virtual

Implements SensitiveDetector.

Definition at line 129 of file TkAccumulatingSensitiveDetector.cc.

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

Referenced by LaserAlignmentSimulation::update().

130 {
131 
132  LogDebug("TrackerSimDebug")<< " Entering a new Step " << aStep->GetTotalEnergyDeposit() << " "
133  << aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();
134 
135  //TimeMe t1(theTimer, false);
136  if (aStep->GetTotalEnergyDeposit()>0. || allowZeroEnergyLoss == true)
137  {
138  if (newHit(aStep) == true)
139  {
140  sendHit();
141  createHit(aStep);
142  }
143  else
144  {
145  updateHit(aStep);
146  }
147  return true;
148  }
149  return false;
150 }
#define LogDebug(id)
void TkAccumulatingSensitiveDetector::sendHit ( )
privatevirtual

Definition at line 227 of file TkAccumulatingSensitiveDetector.cc.

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

Referenced by EndOfEvent(), and ProcessHits().

228 {
229  if (mySimHit == 0) return;
230  LogDebug("TrackerSimDebug")<< " Storing PSimHit: " << pname << " " << mySimHit->detUnitId()
231  << " " << mySimHit->trackId() << " " << mySimHit->energyLoss()
232  << " " << mySimHit->entryPoint() << " " << mySimHit->exitPoint();
233  if (printHits)
234  {
235  TkSimHitPrinter thePrinter("TkHitPositionOSCAR.dat");
236  thePrinter.startNewSimHit(myName,oldVolume->GetLogicalVolume()->GetName(),
238  thePrinter.printLocal(mySimHit->entryPoint(),mySimHit->exitPoint());
239  thePrinter.printGlobal(globalEntryPoint,globalExitPoint);
240  thePrinter.printHitData(mySimHit->energyLoss(),mySimHit->timeOfFlight());
241  thePrinter.printMomentumOfTrack(mySimHit->pabs(),pname,
242  thePrinter.getPropagationSign(globalEntryPoint,globalExitPoint));
243  thePrinter.printGlobalMomentum(px,py,pz);
244  }
245 
246  if (tofBin(mySimHit->timeOfFlight()) == 1)
247  slaveLowTof->processHits(*mySimHit); // implicit conversion (slicing) to PSimHit!!!
248  else
249  slaveHighTof->processHits(*mySimHit); // implicit conversion (slicing) to PSimHit!!!
250  //
251  // clean up
252  delete mySimHit;
253  mySimHit = 0;
254  lastTrack = 0;
255  lastId = 0;
256 }
#define LogDebug(id)
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
float timeOfFlight() const
Definition: PSimHit.h:69
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:63
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:75
unsigned int trackId() const
Definition: PSimHit.h:102
virtual bool processHits(const PSimHit &)
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
unsigned int detUnitId() const
Definition: PSimHit.h:93
uint32_t TkAccumulatingSensitiveDetector::setDetUnitId ( G4Step *  s)
virtual

Implements SensitiveDetector.

Definition at line 152 of file TkAccumulatingSensitiveDetector.cc.

References TrackerG4SimHitNumberingScheme::g4ToNumberingScheme(), LogDebug, and numberingScheme_.

Referenced by createHit(), and newHit().

153 {
154  unsigned int detId = numberingScheme_->g4ToNumberingScheme(s->GetPreStepPoint()->GetTouchable());
155 
156  LogDebug("TrackerSimDebug")<< " DetID = "<<detId;
157 
158  return detId;
159 }
#define LogDebug(id)
unsigned int g4ToNumberingScheme(const G4VTouchable *)
TrackerG4SimHitNumberingScheme * numberingScheme_
int TkAccumulatingSensitiveDetector::tofBin ( float  tof)
private

Definition at line 162 of file TkAccumulatingSensitiveDetector.cc.

References theSigma, and dtDQMClient_cfg::threshold.

Referenced by sendHit().

163 {
164 
165  float threshold = 3. * theSigma;
166  if (tof < threshold) return 1;
167  return 2;
168 }
Local3DPoint TkAccumulatingSensitiveDetector::toOrcaRef ( Local3DPoint  in,
G4VPhysicalVolume *  v 
)
private

Definition at line 170 of file TkAccumulatingSensitiveDetector.cc.

References myRotation, and FrameRotation::transformPoint().

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

171 {
172  if (myRotation !=0) return myRotation->transformPoint(in,v);
173  return (in);
174 }
virtual Local3DPoint transformPoint(Local3DPoint &, G4VPhysicalVolume *) const =0
std::string TkAccumulatingSensitiveDetector::type ( )
void TkAccumulatingSensitiveDetector::update ( const BeginOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 422 of file TkAccumulatingSensitiveDetector.cc.

References clearHits(), eventno, and mySimHit.

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

void TkAccumulatingSensitiveDetector::update ( const BeginOfTrack )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 177 of file TkAccumulatingSensitiveDetector.cc.

References energyCut, energyHistoryCut, getOrCreateTrackInformation(), info(), LogDebug, TrackInformation::putInHistory(), rTracker, TrackInformation::storeTrack(), and zTracker.

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

177  {
178  const G4Track* gTrack = (*bot)();
179 #ifdef DUMPPROCESSES
180  edm::LogInfo("TrackerSimInfo") <<" -> process creator pointer "<<gTrack->GetCreatorProcess();
181  if (gTrack->GetCreatorProcess())
182  edm::LogInfo("TrackerSimInfo")<<" -> PROCESS CREATOR : "<<gTrack->GetCreatorProcess()->GetProcessName();
183 #endif
184 
185 
186  //
187  //Position
188  //
189  const G4ThreeVector pos = gTrack->GetPosition();
190  //LogDebug("TrackerSimDebug")<<" ENERGY MeV "<<gTrack->GetKineticEnergy()<<" Energy Cut" << energyCut;
191  //LogDebug("TrackerSimDebug")<<" TOTAL ENERGY "<<gTrack->GetTotalEnergy();
192  //LogDebug("TrackerSimDebug")<<" WEIGHT "<<gTrack->GetWeight();
193 
194  //
195  // Check if in Tracker Volume
196  //
197  if (pos.perp() < rTracker &&std::fabs(pos.z()) < zTracker){
198  //
199  // inside the Tracker
200  //
201  LogDebug("TrackerSimDebug")<<" INSIDE TRACKER";
202 
203  if (gTrack->GetKineticEnergy() > energyCut){
205  //LogDebug("TrackerSimDebug")<<" POINTER "<<info;
206  //LogDebug("TrackerSimDebug")<<" track inside the tracker selected for STORE";
207  //LogDebug("TrackerSimDebug")<<"Track ID (persistent track) = "<<gTrack->GetTrackID();
208 
209  info->storeTrack(true);
210  }
211  //
212  // Save History?
213  //
214  if (gTrack->GetKineticEnergy() > energyHistoryCut){
216  info->putInHistory();
217  //LogDebug("TrackerSimDebug")<<" POINTER "<<info;
218  //LogDebug("TrackerSimDebug")<<" track inside the tracker selected for HISTORY";
219  //LogDebug("TrackerSimDebug")<<"Track ID (history track) = "<<gTrack->GetTrackID();
220  }
221 
222  }
223 }
#define LogDebug(id)
TrackInformation * getOrCreateTrackInformation(const G4Track *)
static const TGPicture * info(bool iBackgroundIsBlack)
bool storeTrack() const
void TkAccumulatingSensitiveDetector::update ( const BeginOfJob )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob * >.

Definition at line 429 of file TkAccumulatingSensitiveDetector.cc.

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

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

430 {
432  const edm::EventSetup* es = (*i)();
433  es->get<IdealGeometryRecord>().get( pDD );
434 
436  es->get<IdealGeometryRecord>().get(pView);
437 
438  numberingScheme_=&(numberingScheme(*pView,*pDD));
439 }
static TrackerG4SimHitNumberingScheme & numberingScheme(const DDCompactView &cpv, const GeometricDet &det)
const T & get() const
Definition: EventSetup.h:55
TrackerG4SimHitNumberingScheme * numberingScheme_
void TkAccumulatingSensitiveDetector::updateHit ( G4Step *  aStep)
privatevirtual

Definition at line 360 of file TkAccumulatingSensitiveDetector.cc.

References UpdatablePSimHit::addEnergyLoss(), checkExitPoint(), PSimHit::detUnitId(), PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::exitPoint(), SensitiveDetector::FinalStepPosition(), GeV, globalExitPoint, SensitiveDetector::LocalCoordinates, LogDebug, mySimHit, pname, UpdatablePSimHit::setExitPoint(), toOrcaRef(), PSimHit::trackId(), findQualityFiles::v, and SensitiveDetector::WorldCoordinates.

Referenced by ProcessHits().

361 {
362  G4VPhysicalVolume * v = aStep->GetPreStepPoint()->GetPhysicalVolume();
364  //
365  // This allows to send he skipEvent if it is outside!
366  //
367  checkExitPoint(theExitPoint);
368  float theEnergyLoss = aStep->GetTotalEnergyDeposit()/GeV;
369  mySimHit->setExitPoint(theExitPoint);
370  LogDebug("TrackerSimDebug")<< " Before : " << mySimHit->energyLoss();
371  mySimHit->addEnergyLoss(theEnergyLoss);
373 
374  LogDebug("TrackerSimDebug")<< " Updating: new exitpoint " << pname << " " << theExitPoint
375  << " new energy loss " << theEnergyLoss;
376  LogDebug("TrackerSimDebug")<< " Updated PSimHit: " << mySimHit->detUnitId() << " " << mySimHit->trackId()
377  << " " << mySimHit->energyLoss() << " " << mySimHit->entryPoint()
378  << " " << mySimHit->exitPoint();
379 }
#define LogDebug(id)
const double GeV
Definition: MathUtil.h:16
Local3DPoint toOrcaRef(Local3DPoint, G4VPhysicalVolume *)
void setExitPoint(const Local3DPoint &exit)
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
void addEnergyLoss(float eloss)
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:75
unsigned int trackId() const
Definition: PSimHit.h:102
Local3DPoint FinalStepPosition(G4Step *s, coordinates)
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
unsigned int detUnitId() const
Definition: PSimHit.h:93

Member Data Documentation

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

Definition at line 85 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector(), and update().

float TkAccumulatingSensitiveDetector::energyHistoryCut
private

Definition at line 86 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector(), and update().

int TkAccumulatingSensitiveDetector::eventno
private

Definition at line 77 of file TkAccumulatingSensitiveDetector.h.

Referenced by sendHit(), and update().

Local3DPoint TkAccumulatingSensitiveDetector::globalEntryPoint
private

Definition at line 69 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

Local3DPoint TkAccumulatingSensitiveDetector::globalExitPoint
private

Definition at line 70 of file TkAccumulatingSensitiveDetector.h.

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

uint32_t TkAccumulatingSensitiveDetector::lastId
private

Definition at line 75 of file TkAccumulatingSensitiveDetector.h.

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

unsigned int TkAccumulatingSensitiveDetector::lastTrack
private

Definition at line 76 of file TkAccumulatingSensitiveDetector.h.

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

G4TrackToParticleID* TkAccumulatingSensitiveDetector::myG4TrackToParticleID
private
std::string TkAccumulatingSensitiveDetector::myName
private
FrameRotation* TkAccumulatingSensitiveDetector::myRotation
private

Definition at line 66 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector(), and toOrcaRef().

UpdatablePSimHit* TkAccumulatingSensitiveDetector::mySimHit
private
bool TkAccumulatingSensitiveDetector::neverAccumulate
private

Definition at line 82 of file TkAccumulatingSensitiveDetector.h.

Referenced by newHit(), and TkAccumulatingSensitiveDetector().

TrackerG4SimHitNumberingScheme* TkAccumulatingSensitiveDetector::numberingScheme_
private

Definition at line 93 of file TkAccumulatingSensitiveDetector.h.

Referenced by setDetUnitId(), and update().

G4VPhysicalVolume* TkAccumulatingSensitiveDetector::oldVolume
private

Definition at line 72 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

std::string TkAccumulatingSensitiveDetector::pname
private

Definition at line 68 of file TkAccumulatingSensitiveDetector.h.

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

bool TkAccumulatingSensitiveDetector::printHits
private

Definition at line 81 of file TkAccumulatingSensitiveDetector.h.

Referenced by sendHit(), and TkAccumulatingSensitiveDetector().

float TkAccumulatingSensitiveDetector::px
private

Definition at line 79 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

float TkAccumulatingSensitiveDetector::py
private

Definition at line 79 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

float TkAccumulatingSensitiveDetector::pz
private

Definition at line 79 of file TkAccumulatingSensitiveDetector.h.

Referenced by createHit(), and sendHit().

float TkAccumulatingSensitiveDetector::rTracker
private

Definition at line 90 of file TkAccumulatingSensitiveDetector.h.

Referenced by update().

TrackingSlaveSD* TkAccumulatingSensitiveDetector::slaveHighTof
private
TrackingSlaveSD* TkAccumulatingSensitiveDetector::slaveLowTof
private
G4ProcessTypeEnumerator* TkAccumulatingSensitiveDetector::theG4ProcessTypeEnumerator
private
const SimTrackManager* TkAccumulatingSensitiveDetector::theManager
private

Definition at line 71 of file TkAccumulatingSensitiveDetector.h.

double TkAccumulatingSensitiveDetector::theSigma
private

Definition at line 74 of file TkAccumulatingSensitiveDetector.h.

Referenced by TkAccumulatingSensitiveDetector(), and tofBin().

float TkAccumulatingSensitiveDetector::zTracker
private

Definition at line 91 of file TkAccumulatingSensitiveDetector.h.

Referenced by update().