CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
MuonSensitiveDetector Class Reference

#include <MuonSensitiveDetector.h>

Inheritance diagram for MuonSensitiveDetector:
SensitiveTkDetector Observer< const BeginOfEvent * > SensitiveDetector

Public Member Functions

void clearHits () override
 
void EndOfEvent (G4HCofThisEvent *) override
 
void fillHits (edm::PSimHitContainer &, const std::string &) override
 
const MuonSlaveSDGetSlaveMuon () const
 
 MuonSensitiveDetector (const std::string &, const MuonOffsetMap *, const MuonGeometryConstants &, const SensitiveDetectorCatalog &, double ePersistentCutGeV, bool allMuonsPersistent, bool aPrintHits, bool dd4hep, const SimTrackManager *)
 
G4bool ProcessHits (G4Step *, G4TouchableHistory *) override
 
uint32_t setDetUnitId (const G4Step *) override
 
 ~MuonSensitiveDetector () override
 
- Public Member Functions inherited from SensitiveTkDetector
 SensitiveTkDetector (const std::string &iname, const SensitiveDetectorCatalog &clg)
 
- 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 SensitiveDetectorCatalog &, bool calo)
 
 ~SensitiveDetector () override
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent *iT)
 
virtual ~Observer ()
 

Protected Member Functions

void update (const BeginOfEvent *) 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

Local3DPoint cmsUnits (const Local3DPoint &v)
 
void createHit (const G4Step *)
 
Local3DPoint FinalStepPositionVsParent (const G4Step *currentStep, G4int levelsUp)
 
Local3DPoint InitialStepPositionVsParent (const G4Step *currentStep, G4int levelsUp)
 
bool newHit (const G4Step *)
 
void saveHit ()
 
void updateHit (const G4Step *)
 

Private Attributes

bool allMuonsPersistent
 
MuonSubDetectordetector
 
float ePersistentCutGeV
 
MuonG4Numberingg4numbering
 
uint32_t newDetUnitId
 
MuonSimHitNumberingSchemenumbering
 
bool printHits
 
MuonSlaveSDslaveMuon
 
uint32_t theDetUnitId
 
G4ProcessTypeEnumeratortheG4ProcessTypeEnumerator
 
UpdatablePSimHittheHit
 
const SimTrackManagertheManager
 
SimHitPrinterthePrinter
 
const G4VPhysicalVolume * thePV
 
const MuonFrameRotationtheRotation
 
int theTrackID
 

Additional Inherited Members

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

Detailed Description

implementation of SensitiveDetector for the muon detector; a MuonSlaveSD handles the interfacing to the database; numbering scheme are booked according to the detector name

Author
Arno Straessner, CERN arno..nosp@m.stra.nosp@m.essne.nosp@m.r@ce.nosp@m.rn.ch

Modification: 19/05/03. P.Arce Add SimTracks selection

Definition at line 38 of file MuonSensitiveDetector.h.

Constructor & Destructor Documentation

MuonSensitiveDetector::MuonSensitiveDetector ( const std::string &  name,
const MuonOffsetMap offmap,
const MuonGeometryConstants constants,
const SensitiveDetectorCatalog clg,
double  ePersistentCutGeV,
bool  allMuonsPersistent,
bool  aPrintHits,
bool  dd4hep,
const SimTrackManager manager 
)
explicit

Definition at line 35 of file MuonSensitiveDetector.cc.

References allMuonsPersistent, dd4hep_cff::dd4hep, detector, ePersistentCutGeV, g4numbering, GeV, MuonSubDetector::isBarrel(), MuonSubDetector::isEndcap(), MuonSubDetector::isGEM(), MuonSubDetector::isME0(), MuonSubDetector::isRPC(), numbering, printHits, slaveMuon, theG4ProcessTypeEnumerator, theManager, thePrinter, and theRotation.

44  : SensitiveTkDetector(name, clg),
45  thePV(nullptr),
46  theHit(nullptr),
47  theDetUnitId(0),
48  newDetUnitId(0),
49  theTrackID(0),
50  printHits(aPrintHits),
51  thePrinter(nullptr),
52  ePersistentCutGeV(aEPersistentCutGeV),
53  allMuonsPersistent(aAllMuonsPersistent),
54  theManager(manager) {
55  // Here simply create 1 MuonSlaveSD for the moment
56  //
57 #ifdef EDM_ML_DEBUG
58  edm::LogVerbatim("MuonSim") << "create MuonSubDetector " << name << " with dd4hep flag " << dd4hep;
59 #endif
61 
62  G4String sdet = "unknown";
63  if (detector->isEndcap()) {
65  sdet = "Endcap";
66  } else if (detector->isRPC()) {
67  theRotation = new MuonRPCFrameRotation(constants, offmap, dd4hep);
68  sdet = "RPC";
69  } else if (detector->isGEM()) {
70  theRotation = new MuonGEMFrameRotation(constants);
71  sdet = "GEM";
72  } else if (detector->isME0()) {
73  theRotation = new MuonME0FrameRotation(constants);
74  sdet = "ME0";
75  } else {
77  if (detector->isBarrel())
78  sdet = "Barrel";
79  }
82  g4numbering = new MuonG4Numbering(constants, offmap, dd4hep);
83 
84  if (printHits) {
85  thePrinter = new SimHitPrinter("HitPositionOSCAR.dat");
86  }
87 
88  edm::LogVerbatim("MuonSim") << " of type " << sdet << " <" << GetName() << "> EnergyThresholdForPersistency(GeV) "
89  << ePersistentCutGeV / CLHEP::GeV << " allMuonsPersistent: " << allMuonsPersistent;
90 
92 }
Log< level::Info, true > LogVerbatim
const G4VPhysicalVolume * thePV
const double GeV
Definition: MathUtil.h:16
MuonSubDetector * detector
tuple dd4hep
Definition: dd4hep_cff.py:3
G4ProcessTypeEnumerator * theG4ProcessTypeEnumerator
const MuonFrameRotation * theRotation
const SimTrackManager * theManager
MuonSimHitNumberingScheme * numbering
SensitiveTkDetector(const std::string &iname, const SensitiveDetectorCatalog &clg)
UpdatablePSimHit * theHit
MuonG4Numbering * g4numbering
MuonSensitiveDetector::~MuonSensitiveDetector ( )
override

Definition at line 94 of file MuonSensitiveDetector.cc.

References detector, g4numbering, numbering, slaveMuon, theG4ProcessTypeEnumerator, and theRotation.

94  {
95  delete g4numbering;
96  delete numbering;
97  delete slaveMuon;
98  delete theRotation;
99  delete detector;
101 }
MuonSubDetector * detector
G4ProcessTypeEnumerator * theG4ProcessTypeEnumerator
const MuonFrameRotation * theRotation
MuonSimHitNumberingScheme * numbering
MuonG4Numbering * g4numbering

Member Function Documentation

void MuonSensitiveDetector::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 111 of file MuonSensitiveDetector.cc.

References TrackingSlaveSD::Initialize(), and slaveMuon.

Referenced by update().

111  {
112 #ifdef EDM_ML_DEBUG
113  edm::LogVerbatim("MuonSim") << "MuonSensitiveDetector::clearHits";
114 #endif
116 }
Log< level::Info, true > LogVerbatim
virtual void Initialize()
Local3DPoint MuonSensitiveDetector::cmsUnits ( const Local3DPoint v)
inlineprivate

Definition at line 63 of file MuonSensitiveDetector.h.

References PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by createHit(), and updateHit().

63 { return Local3DPoint(v.x() * 0.1, v.y() * 0.1, v.z() * 0.1); }
T y() const
Definition: PV3DBase.h:60
T z() const
Definition: PV3DBase.h:61
T x() const
Definition: PV3DBase.h:59
Point3DBase< float, LocalTag > Local3DPoint
Definition: LocalPoint.h:9
void MuonSensitiveDetector::createHit ( const G4Step *  aStep)
private

Definition at line 163 of file MuonSensitiveDetector.cc.

References funct::abs(), allMuonsPersistent, SensitiveDetector::cmsTrackInformation(), cmsUnits(), SensitiveDetector::ConvertToLocal3DPoint(), detector, ePersistentCutGeV, SensitiveDetector::FinalStepPosition(), FinalStepPositionVsParent(), GeV, info(), SensitiveDetector::InitialStepPosition(), InitialStepPositionVsParent(), MuonSubDetector::isBarrel(), MuonSubDetector::isEndcap(), SensitiveDetector::LocalCoordinates, PV3DBase< T, PVType, FrameType >::mag(), newDetUnitId, AlCaHLTBitMon_ParallelJobs::p, fireworks::p2, G4TrackToParticleID::particleID(), PV3DBase< T, PVType, FrameType >::phi(), G4ProcessTypeEnumerator::processId(), TrackInformation::storeTrack(), theDetUnitId, theG4ProcessTypeEnumerator, theHit, thePV, theRotation, PV3DBase< T, PVType, FrameType >::theta(), theTrackID, MuonFrameRotation::transformPoint(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by ProcessHits().

163  {
164  Local3DPoint theEntryPoint;
165  Local3DPoint theExitPoint;
166 
167  if (detector->isBarrel()) {
168  // 1 levels up
169  theEntryPoint = cmsUnits(theRotation->transformPoint(InitialStepPositionVsParent(aStep, 1), aStep));
170  theExitPoint = cmsUnits(theRotation->transformPoint(FinalStepPositionVsParent(aStep, 1), aStep));
171  } else if (detector->isEndcap()) {
172  // save local z at current level
173  theEntryPoint = theRotation->transformPoint(InitialStepPosition(aStep, LocalCoordinates), aStep);
174  theExitPoint = theRotation->transformPoint(FinalStepPosition(aStep, LocalCoordinates), aStep);
175  float zentry = theEntryPoint.z();
176  float zexit = theExitPoint.z();
177  // 4 levels up
180  // reset local z from z wrt deep-parent volume to z wrt low-level volume
181  theEntryPoint = cmsUnits(Local3DPoint(tempEntry.x(), tempEntry.y(), zentry));
182  theExitPoint = cmsUnits(Local3DPoint(tempExit.x(), tempExit.y(), zexit));
183  } else {
184  theEntryPoint = cmsUnits(theRotation->transformPoint(InitialStepPosition(aStep, LocalCoordinates), aStep));
185  theExitPoint = cmsUnits(theRotation->transformPoint(FinalStepPosition(aStep, LocalCoordinates), aStep));
186  }
187 
188  const G4Track* theTrack = aStep->GetTrack();
189  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
190 
191  float thePabs = preStepPoint->GetMomentum().mag() / CLHEP::GeV;
192  float theTof = preStepPoint->GetGlobalTime() / CLHEP::nanosecond;
193  float theEnergyLoss = aStep->GetTotalEnergyDeposit() / CLHEP::GeV;
194  int theParticleType = G4TrackToParticleID::particleID(theTrack);
195 
197  thePV = preStepPoint->GetPhysicalVolume();
198  theTrackID = theTrack->GetTrackID();
199 
200  // convert momentum direction it to local frame
201  const G4ThreeVector& gmd = preStepPoint->GetMomentumDirection();
202  G4ThreeVector lmd = static_cast<const G4TouchableHistory*>(preStepPoint->GetTouchable())
203  ->GetHistory()
204  ->GetTopTransform()
205  .TransformAxis(gmd);
207  lnmd = theRotation->transformPoint(lnmd, aStep);
208  float theThetaAtEntry = lnmd.theta();
209  float thePhiAtEntry = lnmd.phi();
210 
211  theHit = new UpdatablePSimHit(theEntryPoint,
212  theExitPoint,
213  thePabs,
214  theTof,
215  theEnergyLoss,
216  theParticleType,
217  theDetUnitId,
218  theTrackID,
219  theThetaAtEntry,
220  thePhiAtEntry,
221  theG4ProcessTypeEnumerator->processId(theTrack->GetCreatorProcess()));
222 
223  // Make track persistent
224  int thePID = std::abs(theTrack->GetDefinition()->GetPDGEncoding());
225  //---VI - in parameters cut in energy is declared but applied to momentum
226  if (thePabs > ePersistentCutGeV || (thePID == 13 && allMuonsPersistent)) {
228  info->storeTrack(true);
229  }
230 
231 #ifdef EDM_ML_DEBUG
232  edm::LogVerbatim("MuonSim") << "=== NEW Muon hit for " << GetName() << " Edep(GeV)= " << theEnergyLoss << " "
233  << thePV->GetLogicalVolume()->GetName();
234  const G4VProcess* p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
235  const G4VProcess* p2 = aStep->GetPreStepPoint()->GetProcessDefinedStep();
236  G4String sss = "";
237  if (p)
238  sss += " POST PROCESS: " + p->GetProcessName();
239  if (p2)
240  sss += "; PRE PROCESS: " + p2->GetProcessName();
241  if (!sss.empty())
242  edm::LogVerbatim("MuonSim") << sss;
243  edm::LogVerbatim("MuonSim") << " theta= " << theThetaAtEntry << " phi= " << thePhiAtEntry << " Pabs(GeV/c) "
244  << thePabs << " Eloss(GeV)= " << theEnergyLoss << " Tof(ns)= " << theTof
245  << " trackID= " << theTrackID << " detID= " << theDetUnitId << "\n Local: entry "
246  << theEntryPoint << " exit " << theExitPoint << " delta "
247  << (theExitPoint - theEntryPoint) << "\n Global: entry "
248  << aStep->GetPreStepPoint()->GetPosition() << " exit "
249  << aStep->GetPostStepPoint()->GetPosition();
250 #endif
251 }
Log< level::Info, true > LogVerbatim
const G4VPhysicalVolume * thePV
static const TGPicture * info(bool iBackgroundIsBlack)
const double GeV
Definition: MathUtil.h:16
Local3DPoint FinalStepPositionVsParent(const G4Step *currentStep, G4int levelsUp)
bool storeTrack() const
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
const TString p2
Definition: fwPaths.cc:13
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T y() const
Definition: PV3DBase.h:60
MuonSubDetector * detector
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
Local3DPoint cmsUnits(const Local3DPoint &v)
unsigned int processId(const G4VProcess *p) const
T mag() const
Definition: PV3DBase.h:64
G4ProcessTypeEnumerator * theG4ProcessTypeEnumerator
Local3DPoint FinalStepPosition(const G4Step *step, coordinates) const
T z() const
Definition: PV3DBase.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const MuonFrameRotation * theRotation
virtual Local3DPoint transformPoint(const Local3DPoint &, const G4Step *) const
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
static int particleID(const G4Track *)
T x() const
Definition: PV3DBase.h:59
Local3DPoint InitialStepPositionVsParent(const G4Step *currentStep, G4int levelsUp)
UpdatablePSimHit * theHit
Local3DPoint InitialStepPosition(const G4Step *step, coordinates) const
Point3DBase< float, LocalTag > Local3DPoint
Definition: LocalPoint.h:9
void MuonSensitiveDetector::EndOfEvent ( G4HCofThisEvent *  )
override

Definition at line 305 of file MuonSensitiveDetector.cc.

References saveHit().

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

Implements SensitiveTkDetector.

Definition at line 307 of file MuonSensitiveDetector.cc.

References TrackingSlaveSD::hits(), TrackingSlaveSD::name(), and slaveMuon.

307  {
308  if (slaveMuon->name() == hname) {
309  cc = slaveMuon->hits();
310  }
311 }
std::string name() const
std::vector< PSimHit > & hits()
Local3DPoint MuonSensitiveDetector::FinalStepPositionVsParent ( const G4Step *  currentStep,
G4int  levelsUp 
)
private

Definition at line 326 of file MuonSensitiveDetector.cc.

References SensitiveDetector::ConvertToLocal3DPoint(), and HLT_FULL_cff::depth.

Referenced by createHit(), and updateHit().

326  {
327  const G4StepPoint* postStepPoint = currentStep->GetPostStepPoint();
328  const G4StepPoint* preStepPoint = currentStep->GetPreStepPoint();
329  const G4ThreeVector& globalCoordinates = postStepPoint->GetPosition();
330 
331  const G4TouchableHistory* theTouchable = (const G4TouchableHistory*)(preStepPoint->GetTouchable());
332 
333  G4int depth = theTouchable->GetHistory()->GetDepth();
334  G4ThreeVector localCoordinates =
335  theTouchable->GetHistory()->GetTransform(depth - levelsUp).TransformPoint(globalCoordinates);
336 
337  return ConvertToLocal3DPoint(localCoordinates);
338 }
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
const MuonSlaveSD* MuonSensitiveDetector::GetSlaveMuon ( ) const
inline

Definition at line 57 of file MuonSensitiveDetector.h.

References slaveMuon.

57 { return slaveMuon; }
Local3DPoint MuonSensitiveDetector::InitialStepPositionVsParent ( const G4Step *  currentStep,
G4int  levelsUp 
)
private

Transform from local coordinates of a volume to local coordinates of a parent volume one or more levels up the volume hierarchy: e.g. levelsUp = 1 for immediate parent. This is done by moving from local_1 -> global -> local_2.

Definition at line 313 of file MuonSensitiveDetector.cc.

References SensitiveDetector::ConvertToLocal3DPoint(), and HLT_FULL_cff::depth.

Referenced by createHit().

313  {
314  const G4StepPoint* preStepPoint = currentStep->GetPreStepPoint();
315  const G4ThreeVector& globalCoordinates = preStepPoint->GetPosition();
316 
317  const G4TouchableHistory* theTouchable = (const G4TouchableHistory*)(preStepPoint->GetTouchable());
318 
319  G4int depth = theTouchable->GetHistory()->GetDepth();
320  G4ThreeVector localCoordinates =
321  theTouchable->GetHistory()->GetTransform(depth - levelsUp).TransformPoint(globalCoordinates);
322 
323  return ConvertToLocal3DPoint(localCoordinates);
324 }
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
bool MuonSensitiveDetector::newHit ( const G4Step *  aStep)
private

Definition at line 158 of file MuonSensitiveDetector.cc.

References newDetUnitId, theDetUnitId, theHit, thePV, and theTrackID.

Referenced by ProcessHits().

158  {
159  return (!theHit || (aStep->GetTrack()->GetTrackID() != theTrackID) ||
160  (aStep->GetPreStepPoint()->GetPhysicalVolume() != thePV) || newDetUnitId != theDetUnitId);
161 }
const G4VPhysicalVolume * thePV
UpdatablePSimHit * theHit
bool MuonSensitiveDetector::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *  ROhist 
)
overridevirtual

Implements SensitiveDetector.

Definition at line 118 of file MuonSensitiveDetector.cc.

References createHit(), SensitiveDetector::InitialStepPosition(), newDetUnitId, newHit(), saveHit(), setDetUnitId(), theDetUnitId, thePV, theTrackID, updateHit(), and SensitiveDetector::WorldCoordinates.

118  {
119 #ifdef EDM_ML_DEBUG
120  edm::LogVerbatim("MuonSim") << " MuonSensitiveDetector::ProcessHits " << InitialStepPosition(aStep, WorldCoordinates);
121 #endif
122 
123  if (aStep->GetTotalEnergyDeposit() > 0.) {
124  newDetUnitId = setDetUnitId(aStep);
125 
126  if (newHit(aStep)) {
127  saveHit();
128  createHit(aStep);
129  } else {
130  updateHit(aStep);
131  }
132  thePV = aStep->GetPreStepPoint()->GetPhysicalVolume();
133  theTrackID = aStep->GetTrack()->GetTrackID();
135  }
136  return true;
137 }
Log< level::Info, true > LogVerbatim
const G4VPhysicalVolume * thePV
void updateHit(const G4Step *)
void createHit(const G4Step *)
bool newHit(const G4Step *)
uint32_t setDetUnitId(const G4Step *) override
Local3DPoint InitialStepPosition(const G4Step *step, coordinates) const
void MuonSensitiveDetector::saveHit ( )
private

Definition at line 291 of file MuonSensitiveDetector.cc.

References detector, PSimHit::detUnitId(), PSimHit::entryPoint(), PSimHit::exitPoint(), MuonSubDetector::name(), printHits, SimHitPrinter::printId(), SimHitPrinter::printLocal(), TrackingSlaveSD::processHits(), slaveMuon, SimHitPrinter::startNewSimHit(), theHit, and thePrinter.

Referenced by EndOfEvent(), and ProcessHits().

291  {
292  if (theHit) {
293  if (printHits) {
297  }
298  // hit is included into hit collection
300  delete theHit;
301  theHit = nullptr;
302  }
303 }
void printLocal(LocalPoint, LocalPoint) const
std::string name()
MuonSubDetector * detector
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:46
void startNewSimHit(std::string)
void printId(int) const
virtual bool processHits(const PSimHit &)
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
unsigned int detUnitId() const
Definition: PSimHit.h:97
UpdatablePSimHit * theHit
uint32_t MuonSensitiveDetector::setDetUnitId ( const G4Step *  aStep)
overridevirtual

Implements SensitiveDetector.

Definition at line 139 of file MuonSensitiveDetector.cc.

References MuonSimHitNumberingScheme::baseNumberToUnitNumber(), g4numbering, MuonBaseNumber::getBaseNo(), MuonBaseNumber::getLevels(), MuonBaseNumber::getSuperNo(), testEve_cfg::level, pileupDistInMC::num, numbering, MuonG4Numbering::PhysicalVolumeToBaseNumber(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ProcessHits().

139  {
141 
142 #ifdef EDM_ML_DEBUG
143  std::stringstream MuonBaseNumber;
144  MuonBaseNumber << "MuonNumbering :: number of levels = " << num.getLevels() << std::endl;
145  MuonBaseNumber << "Level \t SuperNo \t BaseNo" << std::endl;
146  for (int level = 1; level <= num.getLevels(); level++) {
147  MuonBaseNumber << level << " \t " << num.getSuperNo(level) << " \t " << num.getBaseNo(level) << std::endl;
148  }
149  std::string MuonBaseNumbr = MuonBaseNumber.str();
150 
151  edm::LogVerbatim("MuonSim") << "MuonSensitiveDetector::setDetUnitId :: " << MuonBaseNumbr;
152  edm::LogVerbatim("MuonSim") << "MuonSensitiveDetector::setDetUnitId :: MuonDetUnitId = "
154 #endif
155  return numbering->baseNumberToUnitNumber(num);
156 }
Log< level::Info, true > LogVerbatim
int baseNumberToUnitNumber(const MuonBaseNumber &) const override
int getBaseNo(int level) const
MuonBaseNumber PhysicalVolumeToBaseNumber(const G4Step *aStep)
MuonSimHitNumberingScheme * numbering
int getLevels() const
int getSuperNo(int level) const
tuple level
Definition: testEve_cfg.py:47
MuonG4Numbering * g4numbering
void MuonSensitiveDetector::update ( const BeginOfEvent )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 103 of file MuonSensitiveDetector.cc.

References clearHits(), theDetUnitId, thePV, and theTrackID.

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

103  {
104  clearHits();
105  //----- Initialize variables to check if two steps belong to same hit
106  thePV = nullptr;
107  theDetUnitId = 0;
108  theTrackID = 0;
109 }
const G4VPhysicalVolume * thePV
void MuonSensitiveDetector::updateHit ( const G4Step *  aStep)
private

Definition at line 253 of file MuonSensitiveDetector.cc.

References UpdatablePSimHit::addEnergyLoss(), cmsUnits(), detector, SensitiveDetector::FinalStepPosition(), FinalStepPositionVsParent(), GeV, MuonSubDetector::isBarrel(), MuonSubDetector::isEndcap(), SensitiveDetector::LocalCoordinates, AlCaHLTBitMon_ParallelJobs::p, fireworks::p2, theDetUnitId, theHit, thePV, theRotation, theTrackID, MuonFrameRotation::transformPoint(), UpdatablePSimHit::updateExitPoint(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by ProcessHits().

253  {
254  Local3DPoint theExitPoint;
255 
256  if (detector->isBarrel()) {
257  theExitPoint = cmsUnits(theRotation->transformPoint(FinalStepPositionVsParent(aStep, 1), aStep));
258  } else if (detector->isEndcap()) {
259  // save local z at current level
260  theExitPoint = theRotation->transformPoint(FinalStepPosition(aStep, LocalCoordinates), aStep);
261  float zexit = theExitPoint.z();
262  Local3DPoint tempExitPoint = theRotation->transformPoint(FinalStepPositionVsParent(aStep, 4), aStep);
263  theExitPoint = cmsUnits(Local3DPoint(tempExitPoint.x(), tempExitPoint.y(), zexit));
264  } else {
265  theExitPoint = cmsUnits(theRotation->transformPoint(FinalStepPosition(aStep, LocalCoordinates), aStep));
266  }
267 
268  float theEnergyLoss = aStep->GetTotalEnergyDeposit() / CLHEP::GeV;
269 
270  theHit->updateExitPoint(theExitPoint);
271  theHit->addEnergyLoss(theEnergyLoss);
272 
273 #ifdef EDM_ML_DEBUG
274  edm::LogVerbatim("MuonSim") << "=== NEW Update muon hit for " << GetName() << " Edep(GeV)= " << theEnergyLoss << " "
275  << thePV->GetLogicalVolume()->GetName();
276  const G4VProcess* p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
277  const G4VProcess* p2 = aStep->GetPreStepPoint()->GetProcessDefinedStep();
278  G4String sss = "";
279  if (p)
280  sss += " POST PROCESS: " + p->GetProcessName();
281  if (p2)
282  sss += "; PRE PROCESS: " + p2->GetProcessName();
283  if (!sss.empty())
284  edm::LogVerbatim("MuonSim") << sss;
285  edm::LogVerbatim("MuonSim") << " delEloss(GeV)= " << theEnergyLoss
286  << " Tof(ns)= " << aStep->GetPreStepPoint()->GetGlobalTime() / CLHEP::nanosecond
287  << " trackID= " << theTrackID << " detID= " << theDetUnitId << " exit " << theExitPoint;
288 #endif
289 }
Log< level::Info, true > LogVerbatim
const G4VPhysicalVolume * thePV
const double GeV
Definition: MathUtil.h:16
Local3DPoint FinalStepPositionVsParent(const G4Step *currentStep, G4int levelsUp)
const TString p2
Definition: fwPaths.cc:13
T y() const
Definition: PV3DBase.h:60
MuonSubDetector * detector
Local3DPoint cmsUnits(const Local3DPoint &v)
void updateExitPoint(const Local3DPoint &exit)
Local3DPoint FinalStepPosition(const G4Step *step, coordinates) const
T z() const
Definition: PV3DBase.h:61
const MuonFrameRotation * theRotation
virtual Local3DPoint transformPoint(const Local3DPoint &, const G4Step *) const
void addEnergyLoss(float eloss)
T x() const
Definition: PV3DBase.h:59
UpdatablePSimHit * theHit
Point3DBase< float, LocalTag > Local3DPoint
Definition: LocalPoint.h:9

Member Data Documentation

bool MuonSensitiveDetector::allMuonsPersistent
private

Definition at line 95 of file MuonSensitiveDetector.h.

Referenced by createHit(), and MuonSensitiveDetector().

MuonSubDetector* MuonSensitiveDetector::detector
private
float MuonSensitiveDetector::ePersistentCutGeV
private

Definition at line 94 of file MuonSensitiveDetector.h.

Referenced by createHit(), and MuonSensitiveDetector().

MuonG4Numbering* MuonSensitiveDetector::g4numbering
private
uint32_t MuonSensitiveDetector::newDetUnitId
private

Definition at line 87 of file MuonSensitiveDetector.h.

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

MuonSimHitNumberingScheme* MuonSensitiveDetector::numbering
private
bool MuonSensitiveDetector::printHits
private
MuonSlaveSD* MuonSensitiveDetector::slaveMuon
private
uint32_t MuonSensitiveDetector::theDetUnitId
private

Definition at line 86 of file MuonSensitiveDetector.h.

Referenced by createHit(), newHit(), ProcessHits(), update(), and updateHit().

G4ProcessTypeEnumerator* MuonSensitiveDetector::theG4ProcessTypeEnumerator
private
UpdatablePSimHit* MuonSensitiveDetector::theHit
private

Definition at line 85 of file MuonSensitiveDetector.h.

Referenced by createHit(), newHit(), saveHit(), and updateHit().

const SimTrackManager* MuonSensitiveDetector::theManager
private

Definition at line 99 of file MuonSensitiveDetector.h.

Referenced by MuonSensitiveDetector().

SimHitPrinter* MuonSensitiveDetector::thePrinter
private

Definition at line 91 of file MuonSensitiveDetector.h.

Referenced by MuonSensitiveDetector(), and saveHit().

const G4VPhysicalVolume* MuonSensitiveDetector::thePV
private

Definition at line 84 of file MuonSensitiveDetector.h.

Referenced by createHit(), newHit(), ProcessHits(), update(), and updateHit().

const MuonFrameRotation* MuonSensitiveDetector::theRotation
private
int MuonSensitiveDetector::theTrackID
private

Definition at line 88 of file MuonSensitiveDetector.h.

Referenced by createHit(), newHit(), ProcessHits(), update(), and updateHit().