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
 
 SensitiveDetector (const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
 ~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), theHit(nullptr), theDetUnitId(0), newDetUnitId(0),
42  theTrackID(0), theManager(manager)
43 {
44  edm::ParameterSet m_MuonSD = p.getParameter<edm::ParameterSet>("MuonSD");
45  ePersistentCutGeV = m_MuonSD.getParameter<double>("EnergyThresholdForPersistency")/CLHEP::GeV;//Default 1. GeV
46  allMuonsPersistent = m_MuonSD.getParameter<bool>("AllMuonsPersistent");
47  printHits = m_MuonSD.getParameter<bool>("PrintHits");
48 
49  //
50  // Here simply create 1 MuonSlaveSD for the moment
51  //
52  LogDebug("MuonSimDebug") << "create MuonSubDetector "<<name;
53  detector = new MuonSubDetector(name);
54 
55  //The constants take time to calculate and are needed by many helpers
57  G4String sdet = "unknown";
58  if (detector->isEndcap()) {
60  sdet = "Endcap";
61  } else if (detector->isRPC()) {
63  sdet = "RPC";
64  } else if (detector->isGEM()) {
66  sdet = "GEM";
67  } else if (detector->isME0()) {
69  sdet = "ME0";
70  } else {
72  }
76 
77  if (printHits) {
78  thePrinter = new SimHitPrinter("HitPositionOSCAR.dat");
79  }
80 
81  edm::LogVerbatim("MuonSensitiveDetector")
82  << " of type " << sdet << " <" << GetName()
83  << "> EnergyThresholdForPersistency(GeV) " << ePersistentCutGeV/CLHEP::GeV
84  << " allMuonsPersistent: " << allMuonsPersistent;
85 
87 }
#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 89 of file MuonSensitiveDetector.cc.

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

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

Member Function Documentation

void MuonSensitiveDetector::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 106 of file MuonSensitiveDetector.cc.

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

Referenced by update().

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

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

62  { 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 168 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().

168  {
169 
170  Local3DPoint theEntryPoint;
171  Local3DPoint theExitPoint;
172 
173  if (detector->isBarrel()) {
174  // 1 levels up
175  theEntryPoint = cmsUnits(theRotation->transformPoint(InitialStepPositionVsParent(aStep,1),aStep));
176  theExitPoint = cmsUnits(theRotation->transformPoint(FinalStepPositionVsParent(aStep,1),aStep));
177  } else if (detector->isEndcap()) {
178  // save local z at current level
179  theEntryPoint = theRotation->transformPoint(InitialStepPosition(aStep,LocalCoordinates),aStep);
180  theExitPoint = theRotation->transformPoint(FinalStepPosition(aStep,LocalCoordinates),aStep);
181  float zentry = theEntryPoint.z();
182  float zexit = theExitPoint.z();
183  // 4 levels up
186  // reset local z from z wrt deep-parent volume to z wrt low-level volume
187  theEntryPoint = cmsUnits(Local3DPoint( tempEntry.x(), tempEntry.y(), zentry ));
188  theExitPoint = cmsUnits(Local3DPoint( tempExit.x(), tempExit.y(), zexit ));
189  } else {
191  theExitPoint = cmsUnits(theRotation->transformPoint(FinalStepPosition(aStep,LocalCoordinates),aStep));
192  }
193 
194  const G4Track* theTrack = aStep->GetTrack();
195  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
196 
197  float thePabs = preStepPoint->GetMomentum().mag()/CLHEP::GeV;
198  float theTof = preStepPoint->GetGlobalTime()/CLHEP::nanosecond;
199  float theEnergyLoss = aStep->GetTotalEnergyDeposit()/CLHEP::GeV;
200  int theParticleType = G4TrackToParticleID::particleID(theTrack);
201 
203  thePV = preStepPoint->GetPhysicalVolume();
204  theTrackID = theTrack->GetTrackID();
205 
206  // convert momentum direction it to local frame
207  const G4ThreeVector& gmd = preStepPoint->GetMomentumDirection();
208  G4ThreeVector lmd = ((G4TouchableHistory *)(preStepPoint->GetTouchable()))->GetHistory()
209  ->GetTopTransform().TransformAxis(gmd);
211  lnmd = theRotation->transformPoint(lnmd, aStep);
212  float theThetaAtEntry = lnmd.theta();
213  float thePhiAtEntry = lnmd.phi();
214 
215  theHit = new UpdatablePSimHit(theEntryPoint,theExitPoint,thePabs,theTof,
216  theEnergyLoss,theParticleType,theDetUnitId,
217  theTrackID,theThetaAtEntry,thePhiAtEntry,
218  theG4ProcessTypeEnumerator->processId(theTrack->GetCreatorProcess()));
219 
220  // Make track persistent
221  int thePID = std::abs(theTrack->GetDefinition()->GetPDGEncoding());
222  //---VI - in parameters cut in energy is declared but applied to momentum
223  if(thePabs > ePersistentCutGeV || ( thePID == 13 && allMuonsPersistent ) ){
225  info->storeTrack(true);
226  }
227 
228 #ifdef DebugLog
229  edm::LogVerbatim("MuonSimDebug") <<"=== NEW Muon hit for "<< GetName()
230  << " Edep(GeV)= " << theEnergyLoss
231  <<" " <<thePV->GetLogicalVolume()->GetName();
232  const G4VProcess* p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
233  const G4VProcess* p2 = preStepPoint->GetProcessDefinedStep();
234  G4String sss = "";
235  if (p) sss += " POST PROCESS: " + p->GetProcessName();
236  if (p2)sss += "; PRE PROCESS: " + p2->GetProcessName();
237  if("" != sss) edm::LogVerbatim("MuonSimDebug") << sss;
238  edm::LogVerbatim("MuonSimDebug") << " theta= " << theThetaAtEntry
239  << " phi= " << thePhiAtEntry
240  << " Pabs(GeV/c) " << thePabs
241  << " Eloss(GeV)= " << theEnergyLoss
242  << " Tof(ns)= " << theTof
243  << " trackID= " << theTrackID
244  << " detID= " << theDetUnitId
245  << "\n Local: entry " << theEntryPoint
246  << " exit " << theExitPoint
247  << " delta " << (theExitPoint-theEntryPoint)
248  << "\n Global: entry " << preStepPoint->GetPosition()
249  << " exit " << aStep->GetPostStepPoint()->GetPosition();
250 #endif
251 }
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 306 of file MuonSensitiveDetector.cc.

References saveHit().

307 {
308  saveHit();
309 }
void MuonSensitiveDetector::fillHits ( edm::PSimHitContainer cc,
const std::string &  hname 
)
overridevirtual

Implements SensitiveTkDetector.

Definition at line 311 of file MuonSensitiveDetector.cc.

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

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

Definition at line 330 of file MuonSensitiveDetector.cc.

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

Referenced by createHit(), and updateHit().

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

Definition at line 52 of file MuonSensitiveDetector.h.

References slaveMuon, and update().

52  {
53  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 315 of file MuonSensitiveDetector.cc.

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

Referenced by createHit().

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

Definition at line 161 of file MuonSensitiveDetector.cc.

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

Referenced by ProcessHits().

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

Implements SensitiveDetector.

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

292  {
293  if (theHit) {
294  if (printHits) {
298  }
299  // hit is included into hit collection
301  delete theHit;
302  theHit = nullptr;
303  }
304 }
void printLocal(LocalPoint, LocalPoint) const
std::string name()
MuonSubDetector * detector
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
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:35
unsigned int detUnitId() const
Definition: PSimHit.h:93
UpdatablePSimHit * theHit
uint32_t MuonSensitiveDetector::setDetUnitId ( const G4Step *  aStep)
overridevirtual

Implements SensitiveDetector.

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

141 {
143 
144 #ifdef DebugLog
145  std::stringstream MuonBaseNumber;
146  MuonBaseNumber << "MuonNumbering :: number of levels = "<<num.getLevels()<<std::endl;
147  MuonBaseNumber << "Level \t SuperNo \t BaseNo"<<std::endl;
148  for (int level=1;level<=num.getLevels();level++) {
149  MuonBaseNumber << level << " \t " << num.getSuperNo(level)
150  << " \t " << num.getBaseNo(level) << std::endl;
151  }
152  std::string MuonBaseNumbr = MuonBaseNumber.str();
153 
154  LogDebug("MuonSimDebug") <<"MuonSensitiveDetector::setDetUnitId :: "<<MuonBaseNumbr;
155  LogDebug("MuonSimDebug") <<"MuonSensitiveDetector::setDetUnitId :: MuonDetUnitId = "
157 #endif
158  return numbering->baseNumberToUnitNumber(num);
159 }
#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 98 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().

98  {
99  clearHits();
100  //----- Initialize variables to check if two steps belong to same hit
101  thePV = nullptr;
102  theDetUnitId = 0;
103  theTrackID = 0;
104 }
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, 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 
255  Local3DPoint theExitPoint;
256 
257  if (detector->isBarrel()) {
258  theExitPoint = cmsUnits(theRotation->transformPoint(FinalStepPositionVsParent(aStep,1),aStep));
259  } else if (detector->isEndcap()) {
260  // save local z at current level
261  theExitPoint = theRotation->transformPoint(FinalStepPosition(aStep,LocalCoordinates),aStep);
262  float zexit = theExitPoint.z();
263  Local3DPoint tempExitPoint = theRotation->transformPoint(FinalStepPositionVsParent(aStep,4),aStep);
264  theExitPoint = cmsUnits(Local3DPoint( tempExitPoint.x(), tempExitPoint.y(), zexit));
265  } else {
266  theExitPoint = cmsUnits(theRotation->transformPoint(FinalStepPosition(aStep,LocalCoordinates),aStep));
267  }
268 
269  float theEnergyLoss = aStep->GetTotalEnergyDeposit()/CLHEP::GeV;
270 
271  theHit->updateExitPoint(theExitPoint);
272  theHit->addEnergyLoss(theEnergyLoss);
273 
274 #ifdef DebugLog
275  edm::LogVerbatim("MuonSimDebug") <<"=== NEW Update muon hit for "<< GetName()
276  << " Edep(GeV)= " << theEnergyLoss
277  <<" " <<thePV->GetLogicalVolume()->GetName();
278  const G4VProcess* p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
279  const G4VProcess* p2 = preStepPoint->GetProcessDefinedStep();
280  G4String sss = "";
281  if (p) sss += " POST PROCESS: " + p->GetProcessName();
282  if (p2)sss += "; PRE PROCESS: " + p2->GetProcessName();
283  if("" != sss) edm::LogVerbatim("MuonSimDebug") << sss;
284  edm::LogVerbatim("MuonSimDebug") << " delEloss(GeV)= " << theEnergyLoss
285  << " Tof(ns)= " << theTof
286  << " trackID= " << theTrackID
287  << " detID= " << theDetUnitId
288  << " exit " << theExitPoint;
289 #endif
290 }
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 94 of file MuonSensitiveDetector.h.

Referenced by createHit(), and MuonSensitiveDetector().

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

Definition at line 93 of file MuonSensitiveDetector.h.

Referenced by createHit(), and MuonSensitiveDetector().

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

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

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

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

Definition at line 84 of file MuonSensitiveDetector.h.

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

const SimTrackManager* MuonSensitiveDetector::theManager
private

Definition at line 98 of file MuonSensitiveDetector.h.

Referenced by MuonSensitiveDetector().

SimHitPrinter* MuonSensitiveDetector::thePrinter
private

Definition at line 90 of file MuonSensitiveDetector.h.

Referenced by MuonSensitiveDetector(), and saveHit().

const G4VPhysicalVolume* MuonSensitiveDetector::thePV
private

Definition at line 83 of file MuonSensitiveDetector.h.

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

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

Definition at line 87 of file MuonSensitiveDetector.h.

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