CMS 3D CMS Logo

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 DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, 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 DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
const std::vector< std::string > & getNames () const
 
void Initialize (G4HCofThisEvent *eventHC) override
 
bool isCaloSD () const
 
 SensitiveDetector (const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p, bool calo)
 
 ~SensitiveDetector () override
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 

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
 
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 36 of file MuonSensitiveDetector.h.

Constructor & Destructor Documentation

MuonSensitiveDetector::MuonSensitiveDetector ( const std::string &  name,
const DDCompactView cpv,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)
explicit

Definition at line 35 of file MuonSensitiveDetector.cc.

References allMuonsPersistent, detector, ePersistentCutGeV, g4numbering, edm::ParameterSet::getParameter(), GeV, MuonSubDetector::isEndcap(), MuonSubDetector::isGEM(), MuonSubDetector::isME0(), MuonSubDetector::isRPC(), LogDebug, dataset::name, numbering, printHits, slaveMuon, theG4ProcessTypeEnumerator, theManager, thePrinter, and theRotation.

40  : SensitiveTkDetector(name, cpv, clg, p),
41  thePV(nullptr),
42  theHit(nullptr),
43  theDetUnitId(0),
44  newDetUnitId(0),
45  theTrackID(0),
46  theManager(manager) {
47  edm::ParameterSet m_MuonSD = p.getParameter<edm::ParameterSet>("MuonSD");
48  ePersistentCutGeV = m_MuonSD.getParameter<double>("EnergyThresholdForPersistency") / CLHEP::GeV; //Default 1. GeV
49  allMuonsPersistent = m_MuonSD.getParameter<bool>("AllMuonsPersistent");
50  printHits = m_MuonSD.getParameter<bool>("PrintHits");
51 
52  //
53  // Here simply create 1 MuonSlaveSD for the moment
54  //
55  LogDebug("MuonSimDebug") << "create MuonSubDetector " << name;
56  detector = new MuonSubDetector(name);
57 
58  //The constants take time to calculate and are needed by many helpers
60  G4String sdet = "unknown";
61  if (detector->isEndcap()) {
63  sdet = "Endcap";
64  } else if (detector->isRPC()) {
66  sdet = "RPC";
67  } else if (detector->isGEM()) {
69  sdet = "GEM";
70  } else if (detector->isME0()) {
72  sdet = "ME0";
73  } else {
75  }
79 
80  if (printHits) {
81  thePrinter = new SimHitPrinter("HitPositionOSCAR.dat");
82  }
83 
84  edm::LogVerbatim("MuonSensitiveDetector")
85  << " of type " << sdet << " <" << GetName() << "> EnergyThresholdForPersistency(GeV) "
86  << ePersistentCutGeV / CLHEP::GeV << " allMuonsPersistent: " << allMuonsPersistent;
87 
89 }
#define LogDebug(id)
T getParameter(std::string const &) const
const G4VPhysicalVolume * thePV
const double GeV
Definition: MathUtil.h:16
MuonSubDetector * detector
G4ProcessTypeEnumerator * theG4ProcessTypeEnumerator
const SimTrackManager * theManager
MuonFrameRotation * theRotation
MuonSimHitNumberingScheme * numbering
SensitiveTkDetector(const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
UpdatablePSimHit * theHit
MuonG4Numbering * g4numbering
MuonSensitiveDetector::~MuonSensitiveDetector ( )
override

Definition at line 91 of file MuonSensitiveDetector.cc.

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

91  {
92  delete g4numbering;
93  delete numbering;
94  delete slaveMuon;
95  delete theRotation;
96  delete detector;
98 }
MuonSubDetector * detector
G4ProcessTypeEnumerator * theG4ProcessTypeEnumerator
MuonFrameRotation * theRotation
MuonSimHitNumberingScheme * numbering
MuonG4Numbering * g4numbering

Member Function Documentation

void MuonSensitiveDetector::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 108 of file MuonSensitiveDetector.cc.

References TrackingSlaveSD::Initialize(), LogDebug, and slaveMuon.

Referenced by update().

108  {
109  LogDebug("MuonSimDebug") << "MuonSensitiveDetector::clearHits";
111 }
#define LogDebug(id)
virtual void Initialize()
Local3DPoint MuonSensitiveDetector::cmsUnits ( const Local3DPoint v)
inlineprivate

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

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

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

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

Definition at line 304 of file MuonSensitiveDetector.cc.

References saveHit().

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

Implements SensitiveTkDetector.

Definition at line 306 of file MuonSensitiveDetector.cc.

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

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

Definition at line 325 of file MuonSensitiveDetector.cc.

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

Referenced by createHit(), and updateHit().

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

Definition at line 51 of file MuonSensitiveDetector.h.

References slaveMuon, and update().

51 { 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 312 of file MuonSensitiveDetector.cc.

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

Referenced by createHit().

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

Definition at line 157 of file MuonSensitiveDetector.cc.

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

Referenced by ProcessHits().

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

Implements SensitiveDetector.

Definition at line 113 of file MuonSensitiveDetector.cc.

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

113  {
114  LogDebug("MuonSimDebug") << " MuonSensitiveDetector::ProcessHits " << InitialStepPosition(aStep, WorldCoordinates);
115 
116  if (aStep->GetTotalEnergyDeposit() > 0.) {
117  newDetUnitId = setDetUnitId(aStep);
118 
119  // do not count neutrals that are killed by User Limits MinEKine
120  //---VI: this is incorrect, neutral particle, like neutron may have local
121  // energy deposit, which potentially may make a hit
122  if (aStep->GetTrack()->GetDynamicParticle()->GetCharge() != 0) {
123  if (newHit(aStep)) {
124  saveHit();
125  createHit(aStep);
126  } else {
127  updateHit(aStep);
128  }
129  } else {
130  thePV = aStep->GetPreStepPoint()->GetPhysicalVolume();
131  theTrackID = aStep->GetTrack()->GetTrackID();
133  }
134  }
135  return true;
136 }
#define LogDebug(id)
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 290 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().

290  {
291  if (theHit) {
292  if (printHits) {
296  }
297  // hit is included into hit collection
299  delete theHit;
300  theHit = nullptr;
301  }
302 }
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 138 of file MuonSensitiveDetector.cc.

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

Referenced by ProcessHits().

138  {
140 
141 #ifdef DebugLog
142  std::stringstream MuonBaseNumber;
143  MuonBaseNumber << "MuonNumbering :: number of levels = " << num.getLevels() << std::endl;
144  MuonBaseNumber << "Level \t SuperNo \t BaseNo" << std::endl;
145  for (int level = 1; level <= num.getLevels(); level++) {
146  MuonBaseNumber << level << " \t " << num.getSuperNo(level) << " \t " << num.getBaseNo(level) << std::endl;
147  }
148  std::string MuonBaseNumbr = MuonBaseNumber.str();
149 
150  LogDebug("MuonSimDebug") << "MuonSensitiveDetector::setDetUnitId :: " << MuonBaseNumbr;
151  LogDebug("MuonSimDebug") << "MuonSensitiveDetector::setDetUnitId :: MuonDetUnitId = "
153 #endif
154  return numbering->baseNumberToUnitNumber(num);
155 }
#define LogDebug(id)
int getBaseNo(int level) const
MuonBaseNumber PhysicalVolumeToBaseNumber(const G4Step *aStep)
MuonSimHitNumberingScheme * numbering
int getLevels() const
int getSuperNo(int level) const
int baseNumberToUnitNumber(const MuonBaseNumber &) override
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 100 of file MuonSensitiveDetector.cc.

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

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

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

Definition at line 252 of file MuonSensitiveDetector.cc.

References UpdatablePSimHit::addEnergyLoss(), cmsUnits(), detector, SensitiveDetector::FinalStepPosition(), FinalStepPositionVsParent(), GeV, MuonSubDetector::isBarrel(), MuonSubDetector::isEndcap(), SensitiveDetector::LocalCoordinates, AlCaHLTBitMon_ParallelJobs::p, 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().

252  {
253  Local3DPoint theExitPoint;
254 
255  if (detector->isBarrel()) {
256  theExitPoint = cmsUnits(theRotation->transformPoint(FinalStepPositionVsParent(aStep, 1), aStep));
257  } else if (detector->isEndcap()) {
258  // save local z at current level
259  theExitPoint = theRotation->transformPoint(FinalStepPosition(aStep, LocalCoordinates), aStep);
260  float zexit = theExitPoint.z();
261  Local3DPoint tempExitPoint = theRotation->transformPoint(FinalStepPositionVsParent(aStep, 4), aStep);
262  theExitPoint = cmsUnits(Local3DPoint(tempExitPoint.x(), tempExitPoint.y(), zexit));
263  } else {
264  theExitPoint = cmsUnits(theRotation->transformPoint(FinalStepPosition(aStep, LocalCoordinates), aStep));
265  }
266 
267  float theEnergyLoss = aStep->GetTotalEnergyDeposit() / CLHEP::GeV;
268 
269  theHit->updateExitPoint(theExitPoint);
270  theHit->addEnergyLoss(theEnergyLoss);
271 
272 #ifdef DebugLog
273  edm::LogVerbatim("MuonSimDebug") << "=== NEW Update muon hit for " << GetName() << " Edep(GeV)= " << theEnergyLoss
274  << " " << thePV->GetLogicalVolume()->GetName();
275  const G4VProcess* p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
276  const G4VProcess* p2 = preStepPoint->GetProcessDefinedStep();
277  G4String sss = "";
278  if (p)
279  sss += " POST PROCESS: " + p->GetProcessName();
280  if (p2)
281  sss += "; PRE PROCESS: " + p2->GetProcessName();
282  if ("" != sss)
283  edm::LogVerbatim("MuonSimDebug") << sss;
284  edm::LogVerbatim("MuonSimDebug") << " delEloss(GeV)= " << theEnergyLoss << " Tof(ns)= " << theTof
285  << " trackID= " << theTrackID << " detID= " << theDetUnitId << " exit "
286  << theExitPoint;
287 #endif
288 }
const G4VPhysicalVolume * thePV
const double GeV
Definition: MathUtil.h:16
Local3DPoint FinalStepPositionVsParent(const G4Step *currentStep, G4int levelsUp)
T y() const
Definition: PV3DBase.h:63
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:64
virtual Local3DPoint transformPoint(const Local3DPoint &, const G4Step *) const
double p2[4]
Definition: TauolaWrapper.h:90
MuonFrameRotation * theRotation
Point3DBase< float, LocalTag > Local3DPoint
Definition: LocalPoint.h:9
void addEnergyLoss(float eloss)
T x() const
Definition: PV3DBase.h:62
UpdatablePSimHit * theHit

Member Data Documentation

bool MuonSensitiveDetector::allMuonsPersistent
private

Definition at line 89 of file MuonSensitiveDetector.h.

Referenced by createHit(), and MuonSensitiveDetector().

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

Definition at line 88 of file MuonSensitiveDetector.h.

Referenced by createHit(), and MuonSensitiveDetector().

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

Definition at line 81 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 80 of file MuonSensitiveDetector.h.

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

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

Definition at line 79 of file MuonSensitiveDetector.h.

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

const SimTrackManager* MuonSensitiveDetector::theManager
private

Definition at line 93 of file MuonSensitiveDetector.h.

Referenced by MuonSensitiveDetector().

SimHitPrinter* MuonSensitiveDetector::thePrinter
private

Definition at line 85 of file MuonSensitiveDetector.h.

Referenced by MuonSensitiveDetector(), and saveHit().

const G4VPhysicalVolume* MuonSensitiveDetector::thePV
private

Definition at line 78 of file MuonSensitiveDetector.h.

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

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

Definition at line 82 of file MuonSensitiveDetector.h.

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