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

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

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

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

Referenced by createHit(), and updateHit().

425 {
426  double z = p.z();
427  if (std::abs(z)<0.3*mm) return;
428  bool sendExc = false;
429  //static SimpleConfigurable<bool> sendExc(false,"TrackerSim:ThrowOnBadHits");
430  edm::LogWarning("TrackerSimInfo")<< " ************ Hit outside the detector ; Local z " << z
431  << "; skipping event = " << sendExc;
432  if (sendExc == true)
433  {
434  G4EventManager::GetEventManager()->AbortCurrentEvent();
435  G4EventManager::GetEventManager()->GetNonconstCurrentEvent()->SetEventAborted();
436  }
437 }
#define abs(x)
Definition: mlp_lapack.h:159
double double double z
T z() const
Definition: PV3DBase.h:63
void TkAccumulatingSensitiveDetector::clearHits ( )
privatevirtual
bool TkAccumulatingSensitiveDetector::closeHit ( G4Step *  aStep)
privatevirtual

Definition at line 377 of file TkAccumulatingSensitiveDetector.cc.

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

Referenced by newHit().

378 {
379  if (mySimHit == 0) return false;
380  const float tolerance = 0.05 * mm; // 50 micron are allowed between the exit
381  // point of the current hit and the entry point of the new hit
382  G4VPhysicalVolume * v = aStep->GetPreStepPoint()->GetPhysicalVolume();
384  LogDebug("TrackerSimDebug")<< " closeHit: distance = " << (mySimHit->exitPoint()-theEntryPoint).mag();
385 
386  if ((mySimHit->exitPoint()-theEntryPoint).mag()<tolerance) return true;
387  return false;
388 }
#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
mathSSE::Vec4< T > v
Local3DPoint InitialStepPosition(G4Step *s, coordinates)
void TkAccumulatingSensitiveDetector::createHit ( G4Step *  aStep)
privatevirtual

Definition at line 255 of file TkAccumulatingSensitiveDetector.cc.

References checkExitPoint(), SensitiveDetector::ConvertToLocal3DPoint(), PSimHit::detUnitId(), PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::exitPoint(), SensitiveDetector::FinalStepPosition(), 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(), v, and SensitiveDetector::WorldCoordinates.

Referenced by ProcessHits().

256 {
257  if (mySimHit != 0)
258  {
259  delete mySimHit;
260  mySimHit=0;
261  }
262 
263  G4Track * theTrack = aStep->GetTrack();
264 
265  G4VPhysicalVolume * v = aStep->GetPreStepPoint()->GetPhysicalVolume();
268  //
269  // This allows to send he skipEvent if it is outside!
270  //
271  checkExitPoint(theExitPoint);
272  float thePabs = aStep->GetPreStepPoint()->GetMomentum().mag()/GeV;
273  float theTof = aStep->GetPreStepPoint()->GetGlobalTime()/nanosecond;
274  float theEnergyLoss = aStep->GetTotalEnergyDeposit()/GeV;
275  int theParticleType = myG4TrackToParticleID->particleID(theTrack);
276  uint32_t theDetUnitId = setDetUnitId(aStep);
277 
280  pname = theTrack->GetDynamicParticle()->GetDefinition()->GetParticleName();
281 
282  if (theDetUnitId == 0)
283  {
284  edm::LogError("TrackerSimInfo") << " Error: theDetUnitId is not valid.";
285  abort();
286  }
287  unsigned int theTrackID = theTrack->GetTrackID();
288 
289  // To whom assign the Hit?
290  // First iteration: if the track is to be stored, use the current number;
291  // otherwise, get to the mother
292  unsigned int theTrackIDInsideTheSimHit=theTrackID;
293 
294 
295  G4VUserTrackInformation * info = theTrack->GetUserInformation();
296  if (info == 0) edm::LogError("TrackerSimInfo")<< " Error: no UserInformation available ";
297  else
298  {
299  TrackInformation * temp = dynamic_cast<TrackInformation* >(info);
300  if (temp ==0) edm::LogError("TrackerSimInfo")<< " Error:G4VUserTrackInformation is not a TrackInformation.";
301  if (temp->storeTrack() == false)
302  {
303  // Go to the mother!
304  LogDebug("TrackerSimDebug")<< " TkAccumulatingSensitiveDetector:createHit(): setting the TrackID from "
305  << theTrackIDInsideTheSimHit;
306  theTrackIDInsideTheSimHit = theTrack->GetParentID();
307  LogDebug("TrackerSimDebug")<< " to the mother one " << theTrackIDInsideTheSimHit << " " << theEnergyLoss;
308  }
309  else
310  {
311  LogDebug("TrackerSimDebug")<< " TkAccumulatingSensitiveDetector:createHit(): leaving the current TrackID "
312  << theTrackIDInsideTheSimHit;
313  }
314  }
315 
316 
317  px = aStep->GetPreStepPoint()->GetMomentum().x()/GeV;
318  py = aStep->GetPreStepPoint()->GetMomentum().y()/GeV;
319  pz = aStep->GetPreStepPoint()->GetMomentum().z()/GeV;
320 
321  G4ThreeVector gmd = aStep->GetPreStepPoint()->GetMomentumDirection();
322  // convert it to local frame
323  G4ThreeVector lmd = ((G4TouchableHistory *)(aStep->GetPreStepPoint()->GetTouchable()))->GetHistory()
324  ->GetTopTransform().TransformAxis(gmd);
326  float theThetaAtEntry = lnmd.theta();
327  float thePhiAtEntry = lnmd.phi();
328 
329  mySimHit = new UpdatablePSimHit(theEntryPoint,theExitPoint,thePabs,theTof,
330  theEnergyLoss,theParticleType,theDetUnitId,
331  theTrackIDInsideTheSimHit,theThetaAtEntry,thePhiAtEntry,
332  theG4ProcessTypeEnumerator->processId(theTrack->GetCreatorProcess()));
333  LogDebug("TrackerSimDebug")<< " Created PSimHit: " << pname << " " << mySimHit->detUnitId() << " " << mySimHit->trackId()
334  << " " << mySimHit->energyLoss() << " " << mySimHit->entryPoint()
335  << " " << mySimHit->exitPoint();
336  lastId = theDetUnitId;
337  lastTrack = theTrackID;
338  oldVolume = v;
339 }
#define LogDebug(id)
bool storeTrack() const
Local3DPoint toOrcaRef(Local3DPoint, G4VPhysicalVolume *)
Local3DPoint ConvertToLocal3DPoint(G4ThreeVector point)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
Geom::Theta< T > theta() const
Definition: PV3DBase.h:74
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
int particleID(const G4Track *)
unsigned int processId(const G4VProcess *)
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
mathSSE::Vec4< T > v
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 390 of file TkAccumulatingSensitiveDetector.cc.

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

391 {
392 
393  LogDebug("TrackerSimDebug")<< " Saving the last hit in a ROU " << myName;
394 
395  if (mySimHit == 0) return;
396  sendHit();
397 }
#define LogDebug(id)
void TkAccumulatingSensitiveDetector::fillHits ( edm::PSimHitContainer c,
std::string  use 
)
virtual

Implements SensitiveTkDetector.

Definition at line 454 of file TkAccumulatingSensitiveDetector.cc.

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

454  {
455  //
456  // do it once for low, once for High
457  //
458 
459  if (slaveLowTof->name() == n) c=slaveLowTof->hits();
460  if (slaveHighTof->name() == n) c=slaveHighTof->hits();
461 
462 }
std::string name() const
std::vector< PSimHit > & hits()
std::vector< string > TkAccumulatingSensitiveDetector::getNames ( )
virtual

Reimplemented from SensitiveDetector.

Definition at line 464 of file TkAccumulatingSensitiveDetector.cc.

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

464  {
465  std::vector<string> temp;
466  temp.push_back(slaveLowTof->name());
467  temp.push_back(slaveHighTof->name());
468  return temp;
469 }
std::string name() const
TrackInformation * TkAccumulatingSensitiveDetector::getOrCreateTrackInformation ( const G4Track *  gTrack)
private

Definition at line 439 of file TkAccumulatingSensitiveDetector.cc.

References info, and groupFilesInBlocks::temp.

Referenced by update().

439  {
440  G4VUserTrackInformation* temp = gTrack->GetUserInformation();
441  if (temp == 0){
442  edm::LogError("TrackerSimInfo") <<" ERROR: no G4VUserTrackInformation available";
443  abort();
444  }else{
445  TrackInformation* info = dynamic_cast<TrackInformation*>(temp);
446  if (info ==0){
447  edm::LogError("TrackerSimInfo")<<" ERROR: TkSimTrackSelection: the UserInformation does not appear to be a TrackInformation";
448  abort();
449  }
450  return info;
451  }
452 }
bool TkAccumulatingSensitiveDetector::newHit ( G4Step *  aStep)
privatevirtual

Definition at line 362 of file TkAccumulatingSensitiveDetector.cc.

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

Referenced by ProcessHits().

363 {
364  if (neverAccumulate == true) return true;
365  G4Track * theTrack = aStep->GetTrack();
366  uint32_t theDetUnitId = setDetUnitId(aStep);
367  unsigned int theTrackID = theTrack->GetTrackID();
368 
369  LogDebug("TrackerSimDebug")<< " OLD (d,t) = (" << lastId << "," << lastTrack
370  << "), new = (" << theDetUnitId << "," << theTrackID << ") return "
371  << ((theTrackID == lastTrack) && (lastId == theDetUnitId));
372  if ((mySimHit != 0) && (theTrackID == lastTrack) && (lastId == theDetUnitId) && closeHit(aStep))
373  return false;
374  return true;
375 }
#define LogDebug(id)
bool TkAccumulatingSensitiveDetector::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *  ROhist 
)
virtual

Implements SensitiveDetector.

Definition at line 126 of file TkAccumulatingSensitiveDetector.cc.

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

Referenced by LaserAlignmentSimulation::update().

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

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

225 {
226  if (mySimHit == 0) return;
227  LogDebug("TrackerSimDebug")<< " Storing PSimHit: " << pname << " " << mySimHit->detUnitId()
228  << " " << mySimHit->trackId() << " " << mySimHit->energyLoss()
229  << " " << mySimHit->entryPoint() << " " << mySimHit->exitPoint();
230  if (printHits)
231  {
232  TkSimHitPrinter thePrinter("TkHitPositionOSCAR.dat");
233  thePrinter.startNewSimHit(myName,oldVolume->GetLogicalVolume()->GetName(),
235  thePrinter.printLocal(mySimHit->entryPoint(),mySimHit->exitPoint());
236  thePrinter.printGlobal(globalEntryPoint,globalExitPoint);
237  thePrinter.printHitData(mySimHit->energyLoss(),mySimHit->timeOfFlight());
238  thePrinter.printMomentumOfTrack(mySimHit->pabs(),pname,
239  thePrinter.getPropagationSign(globalEntryPoint,globalExitPoint));
240  thePrinter.printGlobalMomentum(px,py,pz);
241  }
242 
243  if (tofBin(mySimHit->timeOfFlight()) == 1)
244  slaveLowTof->processHits(*mySimHit); // implicit conversion (slicing) to PSimHit!!!
245  else
246  slaveHighTof->processHits(*mySimHit); // implicit conversion (slicing) to PSimHit!!!
247  //
248  // clean up
249  delete mySimHit;
250  mySimHit = 0;
251  lastTrack = 0;
252  lastId = 0;
253 }
#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 149 of file TkAccumulatingSensitiveDetector.cc.

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

Referenced by createHit(), and newHit().

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

Definition at line 159 of file TkAccumulatingSensitiveDetector.cc.

References theSigma, and dtDQMClient_cfg::threshold.

Referenced by sendHit().

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

Definition at line 167 of file TkAccumulatingSensitiveDetector.cc.

References myRotation, and FrameRotation::transformPoint().

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

168 {
169  if (myRotation !=0) return myRotation->transformPoint(in,v);
170  return (in);
171 }
virtual Local3DPoint transformPoint(Local3DPoint &, G4VPhysicalVolume *) const =0
mathSSE::Vec4< T > v
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 399 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 174 of file TkAccumulatingSensitiveDetector.cc.

References energyCut, energyHistoryCut, getOrCreateTrackInformation(), info, LogDebug, pos, 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().

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

407 {
409  const edm::EventSetup* es = (*i)();
410  es->get<IdealGeometryRecord>().get( pDD );
411 
413  es->get<IdealGeometryRecord>().get(pView);
414 
415  numberingScheme_=&(numberingScheme(*pView,*pDD));
416 }
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 341 of file TkAccumulatingSensitiveDetector.cc.

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

Referenced by ProcessHits().

342 {
343  G4VPhysicalVolume * v = aStep->GetPreStepPoint()->GetPhysicalVolume();
345  //
346  // This allows to send he skipEvent if it is outside!
347  //
348  checkExitPoint(theExitPoint);
349  float theEnergyLoss = aStep->GetTotalEnergyDeposit()/GeV;
350  mySimHit->setExitPoint(theExitPoint);
351  LogDebug("TrackerSimDebug")<< " Before : " << mySimHit->energyLoss();
352  mySimHit->addEnergyLoss(theEnergyLoss);
354 
355  LogDebug("TrackerSimDebug")<< " Updating: new exitpoint " << pname << " " << theExitPoint
356  << " new energy loss " << theEnergyLoss;
357  LogDebug("TrackerSimDebug")<< " Updated PSimHit: " << mySimHit->detUnitId() << " " << mySimHit->trackId()
358  << " " << mySimHit->energyLoss() << " " << mySimHit->entryPoint()
359  << " " << mySimHit->exitPoint();
360 }
#define LogDebug(id)
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
mathSSE::Vec4< T > v
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().