CMS 3D CMS Logo

PSSDigitizerAlgorithm.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <cmath>
3 
5 
9 
10 // Geometry
12 
14 
15 using namespace edm;
16 
18  if (use_LorentzAngle_DB_) // Get Lorentz angle from DB record
19  siPhase2OTLorentzAngle_ = &es.getData(siPhase2OTLorentzAngleToken_);
20 
21  if (use_deadmodule_DB_) // Get Bad Channel (SiStripBadStrip) from DB
22  badChannelPayload_ = &es.getData(badChannelToken_);
23 
24  geom_ = &es.getData(geomToken_);
25 }
27  : Phase2TrackerDigitizerAlgorithm(conf.getParameter<ParameterSet>("AlgorithmCommon"),
28  conf.getParameter<ParameterSet>("PSSDigitizerAlgorithm"),
29  iC),
30  geomToken_(iC.esConsumes()) {
33 
34  if (use_deadmodule_DB_) {
35  std::string badChannelLabel_ = conf.getParameter<ParameterSet>("SSDigitizerAlgorithm")
36  .getUntrackedParameter<std::string>("BadChannelLabel", "");
37  badChannelToken_ = iC.esConsumes(edm::ESInputTag{"", badChannelLabel_});
38  }
39 
40  pixelFlag_ = false;
41  LogDebug("PSSDigitizerAlgorithm") << "Algorithm constructed "
42  << "Configuration parameters: "
43  << "Threshold/Gain = "
44  << "threshold in electron Endcap = " << theThresholdInE_Endcap_
45  << "threshold in electron Barrel = " << theThresholdInE_Barrel_ << " "
46  << theElectronPerADC_ << " " << theAdcFullScale_ << " The delta cut-off is set to "
47  << tMax_ << " pix-inefficiency " << addPixelInefficiency_;
48 }
49 PSSDigitizerAlgorithm::~PSSDigitizerAlgorithm() { LogDebug("PSSDigitizerAlgorithm") << "Algorithm deleted"; }
50 //
51 // -- Select the Hit for Digitization (sigScale will be implemented in future)
52 //
53 bool PSSDigitizerAlgorithm::select_hit(const PSimHit& hit, double tCorr, double& sigScale) const {
54  double toa = hit.tof() - tCorr;
55  return (toa > theTofLowerCut_ && toa < theTofUpperCut_);
56 }
57 //
58 // -- Compare Signal with Threshold
59 //
61  float charge,
62  float thr) const {
63  return (charge >= thr);
64 }
65 //
66 // -- Read Bad Channels from the Condidion DB and kill channels/module accordingly
67 //
69  uint32_t detId = pixdet->geographicalId().rawId();
70 
71  signal_map_type& theSignal = _signal[detId];
72  signal_map_type signalNew;
73 
75  for (std::vector<unsigned int>::const_iterator badChannel = range.first; badChannel != range.second; ++badChannel) {
76  const auto& firstStrip = badChannelPayload_->decodePhase2(*badChannel).firstStrip;
77  const auto& channelRange = badChannelPayload_->decodePhase2(*badChannel).range;
78 
79  for (int index = 0; index < channelRange; index++) {
80  for (auto& s : theSignal) {
81  auto& channel = s.first;
82  if (channel == firstStrip + index)
83  s.second.set(0.);
84  }
85  }
86  }
87 }
unsigned short range
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
bool select_hit(const PSimHit &hit, double tCorr, double &sigScale) const override
void init(const edm::EventSetup &es) override
edm::ESGetToken< SiPhase2OuterTrackerLorentzAngle, SiPhase2OuterTrackerLorentzAngleSimRcd > siPhase2OTLorentzAngleToken_
const Range getRange(const uint32_t detID) const
std::map< int, digitizerUtility::Ph2Amplitude, std::less< int > > signal_map_type
const SiStripBadStrip * badChannelPayload_
void module_killing_DB(const Phase2TrackerGeomDetUnit *pixdet) override
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
unsigned short firstStrip
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HLT enums.
data decodePhase2(const unsigned int &value) const
std::pair< ContainerIterator, ContainerIterator > Range
edm::ESGetToken< SiStripBadStrip, SiPhase2OuterTrackerBadStripRcd > badChannelToken_
PSSDigitizerAlgorithm(const edm::ParameterSet &conf, edm::ConsumesCollector iC)
bool isAboveThreshold(const digitizerUtility::SimHitInfo *hitInfo, float charge, float thr) const override
#define LogDebug(id)