CMS 3D CMS Logo

List of all members | Public Member Functions | Protected 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 ()
 

Protected Member Functions

int getTrackID (const G4Track *) override
 
- 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 > &)
 

Private Member Functions

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

Private Attributes

double energyCut
 
double energyHistoryCut
 
bool isBTL
 
bool isETL
 
MTDNumberingSchemenumberingScheme
 
MTDBaseNumber theBaseNumber
 

Additional Inherited Members

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

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 19 of file MtdSD.cc.

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

23  : TimingSD(name, clg, manager), numberingScheme(nullptr) {
24  //Parameters
25  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("MtdSD");
26  int verbn = m_p.getUntrackedParameter<int>("Verbosity");
27 
28  SetVerboseLevel(verbn);
29 
30  MTDNumberingScheme* scheme = nullptr;
31  if (name == "FastTimerHitsBarrel") {
32  scheme = dynamic_cast<MTDNumberingScheme*>(new BTLNumberingScheme());
33  isBTL = true;
34  } else if (name == "FastTimerHitsEndcap") {
35  scheme = dynamic_cast<MTDNumberingScheme*>(new ETLNumberingScheme());
36  isETL = true;
37  } else {
38  scheme = nullptr;
39  edm::LogWarning("MtdSim") << "MtdSD: ReadoutName not supported";
40  }
41  if (scheme)
43 
44  energyCut = m_p.getParameter<double>("EnergyThresholdForPersistencyInGeV") * CLHEP::GeV; //default must be 0.5
45  energyHistoryCut = m_p.getParameter<double>("EnergyThresholdForHistoryInGeV") * CLHEP::GeV; //default must be 0.05
46 
48 
49  double newTimeFactor = 1. / m_p.getParameter<double>("TimeSliceUnit");
50  edm::LogVerbatim("MtdSim") << "New time factor = " << newTimeFactor;
51  setTimeFactor(newTimeFactor);
52 
53  edm::LogVerbatim("MtdSim") << "MtdSD: Instantiation completed for " << name;
54 }
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:39
bool isETL
Definition: MtdSD.h:40
void setCuts(double eCut, double historyCut)
Definition: TimingSD.cc:89
T getUntrackedParameter(std::string const &, T const &) const
TimingSD(const std::string &, const SensitiveDetectorCatalog &, const SimTrackManager *)
Definition: TimingSD.cc:37
double energyCut
Definition: MtdSD.h:31
double energyHistoryCut
Definition: MtdSD.h:32
void setNumberingScheme(MTDNumberingScheme *)
Definition: MtdSD.cc:70
MTDNumberingScheme * numberingScheme
Definition: MtdSD.h:37
Log< level::Warning, false > LogWarning

◆ ~MtdSD()

MtdSD::~MtdSD ( )
override

Definition at line 56 of file MtdSD.cc.

56 {}

Member Function Documentation

◆ getBaseNumber()

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

Definition at line 79 of file MtdSD.cc.

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

Referenced by setDetUnitId().

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

◆ getTrackID()

int MtdSD::getTrackID ( const G4Track *  aTrack)
overrideprotectedvirtual

Reimplemented from TimingSD.

Definition at line 100 of file MtdSD.cc.

References SensitiveDetector::cmsTrackInformation(), Exception, TrackInformation::getIDonCaloSurface(), TrackInformation::idAtBTLentrance(), TrackInformation::isBTLdaughter(), TrackInformation::Print(), and rname.

100  {
101  int theID = aTrack->GetTrackID();
102  TrackInformation* trkInfo = cmsTrackInformation(aTrack);
103  const G4String& rname = aTrack->GetVolume()->GetLogicalVolume()->GetRegion()->GetName();
104  if (trkInfo != nullptr) {
105 #ifdef EDM_ML_DEBUG
106  trkInfo->Print();
107 #endif
108  if (rname == "FastTimerRegionSensBTL") {
109  if (trkInfo->isBTLdaughter()) {
110  theID = trkInfo->idAtBTLentrance();
111  }
112 #ifdef EDM_ML_DEBUG
113  edm::LogVerbatim("MtdSim") << "BTL Track ID: " << trkInfo->idAtBTLentrance() << ":" << theID;
114 #endif
115  } else if (rname == "FastTimerRegionSensETL") {
116  theID = trkInfo->getIDonCaloSurface();
117 #ifdef EDM_ML_DEBUG
118  edm::LogVerbatim("MtdSim") << "ETL Track ID: " << trkInfo->getIDonCaloSurface() << ":" << theID;
119 #endif
120  } else {
121  throw cms::Exception("MtdSDError") << "MtdSD called in incorrect region " << rname;
122  }
123  } else {
124 #ifdef EDM_ML_DEBUG
125  edm::LogWarning("MtdSim") << "MtdSD: Problem with primaryID **** set by force to TkID **** " << theID;
126 #endif
127  }
128  return theID;
129 }
Log< level::Info, true > LogVerbatim
bool isBTLdaughter() const
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
int getIDonCaloSurface() const
void Print() const override
const G4String rname[NREG]
int idAtBTLentrance() const
Log< level::Warning, false > LogWarning

◆ setDetUnitId()

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

Implements SensitiveDetector.

Definition at line 58 of file MtdSD.cc.

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

58  {
59  if (numberingScheme == nullptr) {
60  return MTDDetId();
61  } else {
62  getBaseNumber(aStep);
63 #ifdef EDM_ML_DEBUG
64  edm::LogVerbatim("MtdSim") << "DetId = " << numberingScheme->getUnitID(theBaseNumber);
65 #endif
67  }
68 }
Log< level::Info, true > LogVerbatim
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
MTDBaseNumber theBaseNumber
Definition: MtdSD.h:38
void getBaseNumber(const G4Step *)
Definition: MtdSD.cc:79
MTDNumberingScheme * numberingScheme
Definition: MtdSD.h:37
virtual uint32_t getUnitID(const MTDBaseNumber &baseNumber) const =0

◆ setNumberingScheme()

void MtdSD::setNumberingScheme ( MTDNumberingScheme scheme)
private

Definition at line 70 of file MtdSD.cc.

References numberingScheme, and generator_cfi::scheme.

Referenced by MtdSD().

70  {
71  if (scheme != nullptr) {
72  edm::LogVerbatim("MtdSim") << "MtdSD: updates numbering scheme for " << GetName();
73  if (numberingScheme)
74  delete numberingScheme;
76  }
77 }
Log< level::Info, true > LogVerbatim
MTDNumberingScheme * numberingScheme
Definition: MtdSD.h:37

Member Data Documentation

◆ energyCut

double MtdSD::energyCut
private

Definition at line 31 of file MtdSD.h.

Referenced by MtdSD().

◆ energyHistoryCut

double MtdSD::energyHistoryCut
private

Definition at line 32 of file MtdSD.h.

Referenced by MtdSD().

◆ isBTL

bool MtdSD::isBTL
private

Definition at line 39 of file MtdSD.h.

Referenced by MtdSD().

◆ isETL

bool MtdSD::isETL
private

Definition at line 40 of file MtdSD.h.

Referenced by MtdSD().

◆ numberingScheme

MTDNumberingScheme* MtdSD::numberingScheme
private

Definition at line 37 of file MtdSD.h.

Referenced by setDetUnitId(), and setNumberingScheme().

◆ theBaseNumber

MTDBaseNumber MtdSD::theBaseNumber
private

Definition at line 38 of file MtdSD.h.

Referenced by getBaseNumber(), and setDetUnitId().