CMS 3D CMS Logo

PSPDigitizerAlgorithm.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <cmath>
3 
5 
9 
10 // Geometry
13 
14 using namespace edm;
15 
18  : Phase2TrackerDigitizerAlgorithm(conf.getParameter<ParameterSet>("AlgorithmCommon"),
19  conf.getParameter<ParameterSet>("PSPDigitizerAlgorithm")) {
20  pixelFlag_ = false;
21  LogDebug("PSPDigitizerAlgorithm") << "Algorithm constructed "
22  << "Configuration parameters:"
23  << "Threshold/Gain = "
24  << "threshold in electron Endcap = " << theThresholdInE_Endcap_
25  << "threshold in electron Barrel = " << theThresholdInE_Barrel_ << " "
26  << theElectronPerADC_ << " " << theAdcFullScale_ << " The delta cut-off is set to "
27  << tMax_ << " pix-inefficiency " << addPixelInefficiency_;
28 }
29 PSPDigitizerAlgorithm::~PSPDigitizerAlgorithm() { LogDebug("PSPDigitizerAlgorithm") << "Algorithm deleted"; }
30 void PSPDigitizerAlgorithm::accumulateSimHits(std::vector<PSimHit>::const_iterator inputBegin,
31  std::vector<PSimHit>::const_iterator inputEnd,
32  const size_t inputBeginGlobalIndex,
33  const uint32_t tofBin,
34  const Phase2TrackerGeomDetUnit* pixdet,
35  const GlobalVector& bfield) {
36  // produce SignalPoint's for all SimHit's in detector
37  // Loop over hits
38  uint32_t detId = pixdet->geographicalId().rawId();
39  size_t simHitGlobalIndex = inputBeginGlobalIndex; // This needs to be stored to create the digi-sim link later
40 
41  // find the relevant hits
42  std::vector<PSimHit> matchedSimHits;
43  std::copy_if(inputBegin, inputEnd, std::back_inserter(matchedSimHits), [detId](auto const& hit) -> bool {
44  return hit.detUnitId() == detId;
45  });
46  // loop over a much reduced set of SimHits
47  for (auto const& hit : matchedSimHits) {
48  LogDebug("PSPDigitizerAlgorithm") << hit.particleType() << " " << hit.pabs() << " " << hit.energyLoss() << " "
49  << hit.tof() << " " << hit.trackId() << " " << hit.processType() << " "
50  << hit.detUnitId() << hit.entryPoint() << " " << hit.exitPoint();
51 
52  std::vector<DigitizerUtility::EnergyDepositUnit> ionization_points;
53  std::vector<DigitizerUtility::SignalPoint> collection_points;
54 
55  double signalScale = 1.0;
56  // fill collection_points for this SimHit, indpendent of topology
57  if (select_hit(hit, (pixdet->surface().toGlobal(hit.localPosition()).mag() * c_inv), signalScale)) {
58  primary_ionization(hit, ionization_points); // fills ionization_points
59 
60  // transforms ionization_points -> collection_points
61  drift(hit, pixdet, bfield, ionization_points, collection_points);
62 
63  // compute induced signal on readout elements and add to _signal
64  // hit needed only for SimHit<-->Digi link
65  induce_signal(hit, simHitGlobalIndex, tofBin, pixdet, collection_points);
66  }
67  ++simHitGlobalIndex;
68  }
69 }
70 //
71 // -- Select the Hit for Digitization (sigScale will be implemented in future)
72 //
73 bool PSPDigitizerAlgorithm::select_hit(const PSimHit& hit, double tCorr, double& sigScale) {
74  double toa = hit.tof() - tCorr;
75  return (toa > theTofLowerCut_ && toa < theTofUpperCut_);
76 }
77 //
78 // -- Compare Signal with Threshold
79 //
81  return (charge >= thr);
82 }
Vector3DBase
Definition: Vector3DBase.h:8
Phase2TrackerDigitizerAlgorithm::theThresholdInE_Barrel_
const float theThresholdInE_Barrel_
Definition: Phase2TrackerDigitizerAlgorithm.h:141
MessageLogger.h
PSPDigitizerAlgorithm::select_hit
bool select_hit(const PSimHit &hit, double tCorr, double &sigScale) override
Definition: PSPDigitizerAlgorithm.cc:73
Phase2TrackerDigitizerAlgorithm::theTofUpperCut_
const float theTofUpperCut_
Definition: Phase2TrackerDigitizerAlgorithm.h:150
PSPDigitizerAlgorithm::~PSPDigitizerAlgorithm
~PSPDigitizerAlgorithm() override
Definition: PSPDigitizerAlgorithm.cc:29
PSPDigitizerAlgorithm::PSPDigitizerAlgorithm
PSPDigitizerAlgorithm(const edm::ParameterSet &conf)
Definition: PSPDigitizerAlgorithm.cc:17
edm
HLT enums.
Definition: AlignableModifier.h:19
PSPDigitizerAlgorithm::accumulateSimHits
void accumulateSimHits(const std::vector< PSimHit >::const_iterator inputBegin, const std::vector< PSimHit >::const_iterator inputEnd, const size_t inputBeginGlobalIndex, const uint32_t tofBin, const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield) override
Definition: PSPDigitizerAlgorithm.cc:30
Phase2TrackerDigitizerAlgorithm::theTofLowerCut_
const float theTofLowerCut_
Definition: Phase2TrackerDigitizerAlgorithm.h:149
PSPDigitizerAlgorithm::isAboveThreshold
bool isAboveThreshold(const DigitizerUtility::SimHitInfo *hitInfo, float charge, float thr) override
Definition: PSPDigitizerAlgorithm.cc:80
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
Phase2TrackerDigitizerAlgorithm::primary_ionization
void primary_ionization(const PSimHit &hit, std::vector< DigitizerUtility::EnergyDepositUnit > &ionization_points) const
Definition: Phase2TrackerDigitizerAlgorithm.cc:183
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
PSPDigitizerAlgorithm::init
void init(const edm::EventSetup &es) override
Definition: PSPDigitizerAlgorithm.cc:16
Phase2TrackerDigitizerAlgorithm::theAdcFullScale_
const int theAdcFullScale_
Definition: Phase2TrackerDigitizerAlgorithm.h:135
Service.h
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Phase2TrackerDigitizerAlgorithm::induce_signal
void induce_signal(const PSimHit &hit, const size_t hitIndex, const uint32_t tofBin, const Phase2TrackerGeomDetUnit *pixdet, const std::vector< DigitizerUtility::SignalPoint > &collection_points)
Definition: Phase2TrackerDigitizerAlgorithm.cc:389
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
TrackerDigiGeometryRecord.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
Phase2TrackerDigitizerAlgorithm
Definition: Phase2TrackerDigitizerAlgorithm.h:58
Phase2TrackerDigitizerAlgorithm::pixelFlag_
bool pixelFlag_
Definition: Phase2TrackerDigitizerAlgorithm.h:241
Phase2TrackerDigitizerAlgorithm::tMax_
const double tMax_
Definition: Phase2TrackerDigitizerAlgorithm.h:173
edm::get
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition: Event.h:669
Phase2TrackerDigitizerAlgorithm::theElectronPerADC_
const float theElectronPerADC_
Definition: Phase2TrackerDigitizerAlgorithm.h:134
edm::EventSetup
Definition: EventSetup.h:57
Phase2TrackerDigitizerAlgorithm::theThresholdInE_Endcap_
const float theThresholdInE_Endcap_
Definition: Phase2TrackerDigitizerAlgorithm.h:140
DigitizerUtility::SimHitInfo
Definition: DigitizerUtility.h:14
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
c_inv
constexpr double c_inv
Definition: Phase2TrackerDigitizerAlgorithm.h:56
PixelGeomDetUnit.h
PSPDigitizerAlgorithm.h
Phase2TrackerDigitizerAlgorithm::drift
void drift(const PSimHit &hit, const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield, const std::vector< DigitizerUtility::EnergyDepositUnit > &ionization_points, std::vector< DigitizerUtility::SignalPoint > &collection_points) const
Definition: Phase2TrackerDigitizerAlgorithm.cc:293
ParameterSet.h
PSimHit
Definition: PSimHit.h:15
Phase2TrackerDigitizerAlgorithm::addPixelInefficiency_
const bool addPixelInefficiency_
Definition: Phase2TrackerDigitizerAlgorithm.h:160
hit
Definition: SiStripHitEffFromCalibTree.cc:88