CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MtdSD Class Reference

#include <MtdSD.h>

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

Public Member Functions

 MtdSD (const std::string &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
uint32_t setDetUnitId (const G4Step *) override
 
 ~MtdSD () override
 
- Public Member Functions inherited from TimingSD
void clearHits () override
 
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
void fillHits (edm::PSimHitContainer &, const std::string &) override
 
void Initialize (G4HCofThisEvent *HCE) override
 
void PrintAll () override
 
bool ProcessHits (G4Step *, G4TouchableHistory *) override
 
 TimingSD (const std::string &, const SensitiveDetectorCatalog &, const SimTrackManager *)
 
 ~TimingSD () 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 ()
 

Private Member Functions

void getBaseNumber (const G4Step *)
 
void setNumberingScheme (MTDNumberingScheme *)
 

Private Attributes

bool isBTL
 
bool isETL
 
MTDNumberingSchemenumberingScheme
 
MTDBaseNumber theBaseNumber
 

Additional Inherited Members

- Protected Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- Protected Member Functions inherited from TimingSD
virtual bool checkHit (const G4Step *, BscG4Hit *)
 
const G4ThreeVector & getGlobalEntryPoint () const
 
const G4ThreeVector & getLocalEntryPoint () const
 
void setCuts (double eCut, double historyCut)
 
void setTimeFactor (double)
 
void setToLocal (const G4StepPoint *stepPoint, const G4ThreeVector &globalPoint, G4ThreeVector &localPoint)
 
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 > &)
 

Detailed Description

Definition at line 19 of file MtdSD.h.

Constructor & Destructor Documentation

◆ MtdSD()

MtdSD::MtdSD ( const std::string &  name,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 18 of file MtdSD.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), isBTL, isETL, Skims_PA_cff::name, AlCaHLTBitMon_ParallelJobs::p, generator_cfi::scheme, setNumberingScheme(), and TimingSD::setTimeFactor().

22  : TimingSD(name, clg, manager), numberingScheme(nullptr) {
23  //Parameters
24  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("MtdSD");
25  int verbn = m_p.getUntrackedParameter<int>("Verbosity");
26 
27  SetVerboseLevel(verbn);
28 
29  MTDNumberingScheme* scheme = nullptr;
30  if (name == "FastTimerHitsBarrel") {
31  scheme = dynamic_cast<MTDNumberingScheme*>(new BTLNumberingScheme());
32  isBTL = true;
33  } else if (name == "FastTimerHitsEndcap") {
34  scheme = dynamic_cast<MTDNumberingScheme*>(new ETLNumberingScheme());
35  isETL = true;
36  } else {
37  scheme = nullptr;
38  edm::LogWarning("MtdSim") << "MtdSD: ReadoutName not supported";
39  }
40  if (scheme)
42 
43  double newTimeFactor = 1. / m_p.getParameter<double>("TimeSliceUnit");
44  edm::LogVerbatim("MtdSim") << "New time factor = " << newTimeFactor;
45  setTimeFactor(newTimeFactor);
46 
47  edm::LogVerbatim("MtdSim") << "MtdSD: Instantiation completed for " << name;
48 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void setTimeFactor(double)
Definition: TimingSD.cc:79
bool isBTL
Definition: MtdSD.h:33
bool isETL
Definition: MtdSD.h:34
T getUntrackedParameter(std::string const &, T const &) const
TimingSD(const std::string &, const SensitiveDetectorCatalog &, const SimTrackManager *)
Definition: TimingSD.cc:37
void setNumberingScheme(MTDNumberingScheme *)
Definition: MtdSD.cc:64
MTDNumberingScheme * numberingScheme
Definition: MtdSD.h:31
Log< level::Warning, false > LogWarning

◆ ~MtdSD()

MtdSD::~MtdSD ( )
override

Definition at line 50 of file MtdSD.cc.

50 {}

Member Function Documentation

◆ getBaseNumber()

void MtdSD::getBaseNumber ( const G4Step *  aStep)
private

Definition at line 73 of file MtdSD.cc.

References MTDBaseNumber::addLevel(), MTDBaseNumber::getCapacity(), cuy::ii, MTDBaseNumber::reset(), MTDBaseNumber::setSize(), and theBaseNumber.

Referenced by setDetUnitId().

73  {
75  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
76  int theSize = touch->GetHistoryDepth() + 1;
77  if (theBaseNumber.getCapacity() < theSize)
78  theBaseNumber.setSize(theSize);
79  //Get name and copy numbers
80  if (theSize > 1) {
81 #ifdef EDM_ML_DEBUG
82  edm::LogVerbatim("MtdSim") << "Building MTD basenumber:";
83 #endif
84  for (int ii = 0; ii < theSize; ii++) {
85  theBaseNumber.addLevel(touch->GetVolume(ii)->GetName(), touch->GetReplicaNumber(ii));
86 #ifdef EDM_ML_DEBUG
87  edm::LogVerbatim("MtdSim") << "MtdSD::getBaseNumber(): Adding level " << ii << ": "
88  << touch->GetVolume(ii)->GetName() << "[" << touch->GetReplicaNumber(ii) << "]";
89 #endif
90  }
91  }
92 }
Log< level::Info, true > LogVerbatim
void addLevel(const std::string_view name, const int copyNumber)
MTDBaseNumber theBaseNumber
Definition: MtdSD.h:32
ii
Definition: cuy.py:589
void setSize(const int size)

◆ setDetUnitId()

uint32_t MtdSD::setDetUnitId ( const G4Step *  aStep)
overridevirtual

Implements SensitiveDetector.

Definition at line 52 of file MtdSD.cc.

References getBaseNumber(), MTDNumberingScheme::getUnitID(), numberingScheme, and theBaseNumber.

52  {
53  if (numberingScheme == nullptr) {
54  return MTDDetId();
55  } else {
56  getBaseNumber(aStep);
57 #ifdef EDM_ML_DEBUG
58  edm::LogVerbatim("MtdSim") << "DetId = " << numberingScheme->getUnitID(theBaseNumber);
59 #endif
61  }
62 }
Log< level::Info, true > LogVerbatim
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
MTDBaseNumber theBaseNumber
Definition: MtdSD.h:32
void getBaseNumber(const G4Step *)
Definition: MtdSD.cc:73
MTDNumberingScheme * numberingScheme
Definition: MtdSD.h:31
virtual uint32_t getUnitID(const MTDBaseNumber &baseNumber) const =0

◆ setNumberingScheme()

void MtdSD::setNumberingScheme ( MTDNumberingScheme scheme)
private

Definition at line 64 of file MtdSD.cc.

References numberingScheme, and generator_cfi::scheme.

Referenced by MtdSD().

64  {
65  if (scheme != nullptr) {
66  edm::LogVerbatim("MtdSim") << "MtdSD: updates numbering scheme for " << GetName();
67  if (numberingScheme)
68  delete numberingScheme;
70  }
71 }
Log< level::Info, true > LogVerbatim
MTDNumberingScheme * numberingScheme
Definition: MtdSD.h:31

Member Data Documentation

◆ isBTL

bool MtdSD::isBTL
private

Definition at line 33 of file MtdSD.h.

Referenced by MtdSD().

◆ isETL

bool MtdSD::isETL
private

Definition at line 34 of file MtdSD.h.

Referenced by MtdSD().

◆ numberingScheme

MTDNumberingScheme* MtdSD::numberingScheme
private

Definition at line 31 of file MtdSD.h.

Referenced by setDetUnitId(), and setNumberingScheme().

◆ theBaseNumber

MTDBaseNumber MtdSD::theBaseNumber
private

Definition at line 32 of file MtdSD.h.

Referenced by getBaseNumber(), and setDetUnitId().