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("EcalSim") << "MtdSD: ReadoutName not supported";
58  }
59  if (scheme) setNumberingScheme(scheme);
60 
61  setTimeFactor(100.);
62 
63  edm::LogVerbatim("MtdSim") << "MtdSD: Instantiation completed for "
64  << name << " of type " << type;
65 }
type
Definition: HCALResponse.h:21
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
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:20
void setNumberingScheme(MTDNumberingScheme *)
Definition: MtdSD.cc:98
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< double > getDDDArray(const std::string &, const DDsvalues_type &)
Definition: MtdSD.cc:79
MtdSD::~MtdSD ( )
override

Definition at line 67 of file MtdSD.cc.

67  {
68 }

Member Function Documentation

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

Definition at line 107 of file MtdSD.cc.

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

Referenced by setDetUnitId().

107  {
108 
110  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
111  int theSize = touch->GetHistoryDepth()+1;
112  if ( theBaseNumber.getCapacity() < theSize ) theBaseNumber.setSize(theSize);
113  //Get name and copy numbers
114  if ( theSize > 1 ) {
115  for (int ii = 0; ii < theSize ; ii++) {
116  theBaseNumber.addLevel(touch->GetVolume(ii)->GetName(),touch->GetReplicaNumber(ii));
117 #ifdef EDM_ML_DEBUG
118  edm::LogInfo("MtdSim") << "MtdSD::getBaseNumber(): Adding level " << ii
119  << ": " << touch->GetVolume(ii)->GetName() << "["
120  << touch->GetReplicaNumber(ii) << "]";
121 #endif
122  }
123  }
124 }
MTDBaseNumber theBaseNumber
Definition: MtdSD.h:38
ii
Definition: cuy.py:589
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 79 of file MtdSD.cc.

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

Referenced by MtdSD().

80  {
81 
82  DDValue value(str);
83  if (DDfetch(&sv,value)) {
84  const std::vector<double> & fvec = value.doubles();
85  int nval = fvec.size();
86  if (nval < 1) {
87  edm::LogError("MtdSim") << "MtdSD : # of " << str
88  << " bins " << nval << " < 1 ==> illegal";
89  throw cms::Exception("DDException") << "MtdSD: cannot get array " << str;
90  }
91  return fvec;
92  } else {
93  edm::LogError("MtdSim") << "MtdSD: cannot get array " << str;
94  throw cms::Exception("DDException") << "MtdSD: cannot get array " << str;
95  }
96 }
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 70 of file MtdSD.cc.

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

70  {
71  if (numberingScheme == nullptr) {
72  return MTDDetId();
73  } else {
74  getBaseNumber(aStep);
76  }
77 }
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:107
MTDNumberingScheme * numberingScheme
Definition: MtdSD.h:37
void MtdSD::setNumberingScheme ( MTDNumberingScheme scheme)
private

Definition at line 98 of file MtdSD.cc.

References numberingScheme.

Referenced by MtdSD().

98  {
99  if (scheme != nullptr) {
100  edm::LogInfo("MtdSim") << "MtdSD: updates numbering scheme for "
101  << GetName();
102  if (numberingScheme) delete numberingScheme;
103  numberingScheme = scheme;
104  }
105 }
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().