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 DDCompactView &, 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 DDCompactView &, const SensitiveDetectorCatalog &, const edm::ParameterSet &, const SimTrackManager *)
 
 ~TimingSD () 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 ()
 

Private Member Functions

void getBaseNumber (const G4Step *)
 
std::vector< double > getDDDArray (const std::string &, const DDsvalues_type &)
 
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 18 of file MtdSD.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file MtdSD.cc.

References dbl_to_int(), ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), getDDDArray(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), isBTL, isETL, DDFilteredView::mergedSpecifics(), setNumberingScheme(), TimingSD::setTimeFactor(), AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, and groupFilesInBlocks::temp.

31  :
32  TimingSD(name, cpv, clg, p, manager), numberingScheme(nullptr) {
33 
34  //Parameters
35  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("MtdSD");
36  int verbn = m_p.getUntrackedParameter<int>("Verbosity");
37 
38  SetVerboseLevel(verbn);
39 
40  std::string attribute = "ReadOutName";
42  DDFilteredView fv(cpv,filter);
43  fv.firstChild();
44  DDsvalues_type sv(fv.mergedSpecifics());
45  std::vector<int> temp = dbl_to_int(getDDDArray("Type",sv));
46  int type = temp[0];
47 
48  MTDNumberingScheme* scheme=nullptr;
49  if (name == "FastTimerHitsBarrel") {
50  scheme = dynamic_cast<MTDNumberingScheme*>(new BTLNumberingScheme());
51  isBTL=true;
52  } else if (name == "FastTimerHitsEndcap") {
53  scheme = dynamic_cast<MTDNumberingScheme*>(new ETLNumberingScheme());
54  isETL=true;
55  } else {
56  scheme = nullptr;
57  edm::LogWarning("MtdSim") << "MtdSD: ReadoutName not supported";
58  }
59  if (scheme) setNumberingScheme(scheme);
60 
61  double newTimeFactor = 1./m_p.getParameter<double>("TimeSliceUnit");
62  edm::LogInfo("MtdSim") << "New time factor = " << newTimeFactor;
63  setTimeFactor(newTimeFactor);
64 
65  edm::LogVerbatim("MtdSim") << "MtdSD: Instantiation completed for "
66  << name << " of type " << type;
67 }
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setTimeFactor(double)
Definition: TimingSD.cc:77
bool isBTL
Definition: MtdSD.h:39
bool isETL
Definition: MtdSD.h:40
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
void setNumberingScheme(MTDNumberingScheme *)
Definition: MtdSD.cc:100
MTDNumberingScheme * numberingScheme
Definition: MtdSD.h:37
TimingSD(const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, const edm::ParameterSet &, const SimTrackManager *)
Definition: TimingSD.cc:40
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
Definition: MtdSD.cc:81
MtdSD::~MtdSD ( )
override

Definition at line 69 of file MtdSD.cc.

69  {
70 }

Member Function Documentation

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

Definition at line 109 of file MtdSD.cc.

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

Referenced by setDetUnitId().

109  {
110 
112  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
113  int theSize = touch->GetHistoryDepth()+1;
114  if ( theBaseNumber.getCapacity() < theSize ) theBaseNumber.setSize(theSize);
115  //Get name and copy numbers
116  if ( theSize > 1 ) {
117  for (int ii = 0; ii < theSize ; ii++) {
118  theBaseNumber.addLevel(touch->GetVolume(ii)->GetName(),touch->GetReplicaNumber(ii));
119 #ifdef EDM_ML_DEBUG
120  edm::LogInfo("MtdSim") << "MtdSD::getBaseNumber(): Adding level " << ii
121  << ": " << touch->GetVolume(ii)->GetName() << "["
122  << touch->GetReplicaNumber(ii) << "]";
123 #endif
124  }
125  }
126 }
MTDBaseNumber theBaseNumber
Definition: MtdSD.h:38
ii
Definition: cuy.py:590
void setSize(const int &size)
void addLevel(const std::string &name, const int &copyNumber)
std::vector< double > MtdSD::getDDDArray ( const std::string &  str,
const DDsvalues_type sv 
)
private

Definition at line 81 of file MtdSD.cc.

References DDfetch(), DDValue::doubles(), Exception, str, and relativeConstraints::value.

Referenced by MtdSD().

82  {
83 
84  DDValue value(str);
85  if (DDfetch(&sv,value)) {
86  const std::vector<double> & fvec = value.doubles();
87  int nval = fvec.size();
88  if (nval < 1) {
89  edm::LogError("MtdSim") << "MtdSD : # of " << str
90  << " bins " << nval << " < 1 ==> illegal";
91  throw cms::Exception("DDException") << "MtdSD: cannot get array " << str;
92  }
93  return fvec;
94  } else {
95  edm::LogError("MtdSim") << "MtdSD: cannot get array " << str;
96  throw cms::Exception("DDException") << "MtdSD: cannot get array " << str;
97  }
98 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
Definition: value.py:1
#define str(s)
uint32_t MtdSD::setDetUnitId ( const G4Step *  aStep)
overridevirtual

Implements SensitiveDetector.

Definition at line 72 of file MtdSD.cc.

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

72  {
73  if (numberingScheme == nullptr) {
74  return MTDDetId();
75  } else {
76  getBaseNumber(aStep);
78  }
79 }
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
virtual uint32_t getUnitID(const MTDBaseNumber &baseNumber) const =0
MTDBaseNumber theBaseNumber
Definition: MtdSD.h:38
void getBaseNumber(const G4Step *)
Definition: MtdSD.cc:109
MTDNumberingScheme * numberingScheme
Definition: MtdSD.h:37
void MtdSD::setNumberingScheme ( MTDNumberingScheme scheme)
private

Definition at line 100 of file MtdSD.cc.

References numberingScheme.

Referenced by MtdSD().

100  {
101  if (scheme != nullptr) {
102  edm::LogInfo("MtdSim") << "MtdSD: updates numbering scheme for "
103  << GetName();
104  if (numberingScheme) delete numberingScheme;
105  numberingScheme = scheme;
106  }
107 }
MTDNumberingScheme * numberingScheme
Definition: MtdSD.h:37

Member Data Documentation

bool MtdSD::isBTL
private

Definition at line 39 of file MtdSD.h.

Referenced by MtdSD().

bool MtdSD::isETL
private

Definition at line 40 of file MtdSD.h.

Referenced by MtdSD().

MTDNumberingScheme* MtdSD::numberingScheme
private

Definition at line 37 of file MtdSD.h.

Referenced by setDetUnitId(), and setNumberingScheme().

MTDBaseNumber MtdSD::theBaseNumber
private

Definition at line 38 of file MtdSD.h.

Referenced by getBaseNumber(), and setDetUnitId().