CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
Phase2TrackerDigitizerAlgorithm Class Referenceabstract

#include <Phase2TrackerDigitizerAlgorithm.h>

Inheritance diagram for Phase2TrackerDigitizerAlgorithm:
PixelDigitizerAlgorithm PSPDigitizerAlgorithm PSSDigitizerAlgorithm SSDigitizerAlgorithm Pixel3DDigitizerAlgorithm PixelBrickedDigitizerAlgorithm

Classes

struct  SubdetEfficiencies
 

Public Member Functions

virtual 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)
 
virtual void digitize (const Phase2TrackerGeomDetUnit *pixdet, std::map< int, DigitizerUtility::DigiSimInfo > &digi_map, const TrackerTopology *tTopo)
 
virtual void init (const edm::EventSetup &es)=0
 
virtual void initializeEvent (CLHEP::HepRandomEngine &eng)
 
virtual bool isAboveThreshold (const DigitizerUtility::SimHitInfo *hitInfo, float charge, float thr) const
 
void loadAccumulator (uint32_t detId, const std::map< int, float > &accumulator)
 
 Phase2TrackerDigitizerAlgorithm (const edm::ParameterSet &conf_common, const edm::ParameterSet &conf_specific, edm::ConsumesCollector iC)
 
virtual bool select_hit (const PSimHit &hit, double tCorr, double &sigScale) const
 
virtual ~Phase2TrackerDigitizerAlgorithm ()
 

Protected Types

using Frame = GloballyPositioned< double >
 
using Parameters = std::vector< edm::ParameterSet >
 
using signal_map_type = std::map< int, DigitizerUtility::Amplitude, std::less< int > >
 
using signalMaps = std::map< uint32_t, signal_map_type >
 

Protected Member Functions

virtual void add_cross_talk (const Phase2TrackerGeomDetUnit *pixdet)
 
virtual void add_noise (const Phase2TrackerGeomDetUnit *pixdet)
 
virtual void add_noisy_cells (const Phase2TrackerGeomDetUnit *pixdet, float thePixelThreshold)
 
float calcQ (float x)
 
int convertSignalToAdc (uint32_t detID, float signal_in_elec, float threshold)
 
virtual std::vector< DigitizerUtility::SignalPointdrift (const PSimHit &hit, const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield, const std::vector< DigitizerUtility::EnergyDepositUnit > &ionization_points) const
 
LocalVector DriftDirection (const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield, const DetId &detId) const
 
virtual std::vector< float > fluctuateEloss (int particleId, float momentum, float eloss, float length, int NumberOfSegments) const
 
virtual void induce_signal (const PSimHit &hit, const size_t hitIndex, const uint32_t tofBin, const Phase2TrackerGeomDetUnit *pixdet, const std::vector< DigitizerUtility::SignalPoint > &collection_points)
 
virtual void module_killing_conf (uint32_t detID)
 
virtual void module_killing_DB (const Phase2TrackerGeomDetUnit *pixdet)=0
 
virtual void pixel_inefficiency (const SubdetEfficiencies &eff, const Phase2TrackerGeomDetUnit *pixdet, const TrackerTopology *tTopo)
 
virtual void pixel_inefficiency_db (uint32_t detID)
 
virtual std::vector< DigitizerUtility::EnergyDepositUnitprimary_ionization (const PSimHit &hit) const
 

Protected Attributes

signalMaps _signal
 
const bool addNoise_
 
const bool addNoisyPixels_
 
const bool addPixelInefficiency_
 
const bool addThresholdSmearing_
 
const bool addXtalk_
 
const bool alpha2Order_
 
Parameters badPixels_
 
const float clusterWidth_
 
const Parameters deadModules_
 
const SiPixelFedCablingMapfedCablingMap_
 
const std::unique_ptr< SiG4UniversalFluctuationfluctuate_
 
const bool fluctuateCharge_
 
std::unique_ptr< CLHEP::RandGaussQ > gaussDistribution_
 
const TrackerGeometrygeom_
 
const float GeVperElectron_
 
const float interstripCoupling_
 
const bool makeDigiSimLinks_
 
bool pixelFlag_
 
const double pseudoRadDamage_
 
const double pseudoRadDamageRadius_
 
CLHEP::HepRandomEngine * rengine_
 
const float Sigma0_
 
const float SigmaCoeff_
 
const SiPhase2OuterTrackerLorentzAnglesiPhase2OTLorentzAngle_
 
const SiPixelQualitysiPixelBadModule_
 
const SiPixelLorentzAnglesiPixelLorentzAngle_
 
std::unique_ptr< CLHEP::RandGaussQ > smearedThreshold_Barrel_
 
std::unique_ptr< CLHEP::RandGaussQ > smearedThreshold_Endcap_
 
const SubdetEfficiencies subdetEfficiencies_
 
const float tanLorentzAnglePerTesla_Barrel_
 
const float tanLorentzAnglePerTesla_Endcap_
 
const int theAdcFullScale_
 
const float theElectronPerADC_
 
const double theHIPThresholdInE_Barrel_
 
const double theHIPThresholdInE_Endcap_
 
const float theNoiseInElectrons_
 
const std::unique_ptr< GaussianTailNoiseGeneratortheNoiser_
 
const int thePhase2ReadoutMode_
 
const float theReadoutNoise_
 
const std::unique_ptr< SiPixelGainCalibrationOfflineSimServicetheSiPixelGainCalibrationService_
 
const float theThresholdInE_Barrel_
 
const float theThresholdInE_Endcap_
 
const double theThresholdSmearing_Barrel_
 
const double theThresholdSmearing_Endcap_
 
const float theTofLowerCut_
 
const float theTofUpperCut_
 
const double tMax_
 
const bool use_deadmodule_DB_
 
const bool use_ineff_from_db_
 
const bool use_LorentzAngle_DB_
 
const bool use_module_killing_
 

Detailed Description

Definition at line 54 of file Phase2TrackerDigitizerAlgorithm.h.

Member Typedef Documentation

◆ Frame

Definition at line 105 of file Phase2TrackerDigitizerAlgorithm.h.

◆ Parameters

Definition at line 106 of file Phase2TrackerDigitizerAlgorithm.h.

◆ signal_map_type

using Phase2TrackerDigitizerAlgorithm::signal_map_type = std::map<int, DigitizerUtility::Amplitude, std::less<int> >
protected

Definition at line 103 of file Phase2TrackerDigitizerAlgorithm.h.

◆ signalMaps

using Phase2TrackerDigitizerAlgorithm::signalMaps = std::map<uint32_t, signal_map_type>
protected

Definition at line 104 of file Phase2TrackerDigitizerAlgorithm.h.

Constructor & Destructor Documentation

◆ Phase2TrackerDigitizerAlgorithm()

Phase2TrackerDigitizerAlgorithm::Phase2TrackerDigitizerAlgorithm ( const edm::ParameterSet conf_common,
const edm::ParameterSet conf_specific,
edm::ConsumesCollector  iC 
)

Definition at line 44 of file Phase2TrackerDigitizerAlgorithm.cc.

References addPixelInefficiency_, LogDebug, theAdcFullScale_, theElectronPerADC_, theThresholdInE_Barrel_, theThresholdInE_Endcap_, and tMax_.

47  : _signal(),
48  makeDigiSimLinks_(conf_common.getUntrackedParameter<bool>("makeDigiSimLinks", true)),
49  use_ineff_from_db_(conf_specific.getParameter<bool>("Inefficiency_DB")),
50  use_module_killing_(conf_specific.getParameter<bool>("KillModules")), // boolean to kill or not modules
51  use_deadmodule_DB_(conf_specific.getParameter<bool>("DeadModules_DB")), // boolean to access dead modules from DB
52  // boolean to access Lorentz angle from DB
53  use_LorentzAngle_DB_(conf_specific.getParameter<bool>("LorentzAngle_DB")),
54 
55  // get dead module from cfg file
56  deadModules_(use_deadmodule_DB_ ? Parameters() : conf_specific.getParameter<Parameters>("DeadModules")),
57 
58  // Common pixel parameters
59  // These are parameters which are not likely to be changed
60  GeVperElectron_(3.61E-09), // 1 electron(3.61eV, 1keV(277e, mod 9/06 d.k.
61  alpha2Order_(conf_specific.getParameter<bool>("Alpha2Order")), // switch on/off of E.B effect
62  addXtalk_(conf_specific.getParameter<bool>("AddXTalk")),
63  // Interstrip Coupling - Not used in PixelDigitizerAlgorithm
64  interstripCoupling_(conf_specific.getParameter<double>("InterstripCoupling")),
65 
66  Sigma0_(conf_specific.getParameter<double>("SigmaZero")), // Charge diffusion constant 7->3.7
67  SigmaCoeff_(conf_specific.getParameter<double>("SigmaCoeff")), // delta in the diffusion across the strip pitch
68  // (set between 0 to 0.9, 0-->flat Sigma0, 1-->Sigma_min=0 & Sigma_max=2*Sigma0
69  // D.B.: Dist300 replaced by moduleThickness, may not work with partially depleted sensors but works otherwise
70  // Dist300(0.0300), // normalized to 300micron Silicon
71 
72  // Charge integration spread on the collection plane
73  clusterWidth_(conf_specific.getParameter<double>("ClusterWidth")),
74 
75  // Allowed modes of readout which has following values :
76  // 0 ---> Digital or binary readout
77  // -1 ---> Analog readout, current digitizer (Inner Pixel) (TDR version) with no threshold subtraction
78  // Analog readout with dual slope with the "second" slope being 1/2^(n-1) and threshold subtraction (n = 1, 2, 3,4)
79  thePhase2ReadoutMode_(conf_specific.getParameter<int>("Phase2ReadoutMode")),
80 
81  // ADC calibration 1adc count(135e.
82  // Corresponds to 2adc/kev, 270[e/kev]/135[e/adc](2[adc/kev]
83  // Be careful, this parameter is also used in SiPixelDet.cc to
84  // calculate the noise in adc counts from noise in electrons.
85  // Both defaults should be the same.
86  theElectronPerADC_(conf_specific.getParameter<double>("ElectronPerAdc")),
87 
88  // ADC saturation value, 255(8bit adc.
89  theAdcFullScale_(conf_specific.getParameter<int>("AdcFullScale")),
90 
91  // Noise in electrons:
92  // Pixel cell noise, relevant for generating noisy pixels
93  theNoiseInElectrons_(conf_specific.getParameter<double>("NoiseInElectrons")),
94 
95  // Fill readout noise, including all readout chain, relevant for smearing
96  theReadoutNoise_(conf_specific.getParameter<double>("ReadoutNoiseInElec")),
97 
98  // Threshold in units of noise:
99  // thePixelThreshold(conf.getParameter<double>("ThresholdInNoiseUnits")),
100  // Pixel threshold in electron units.
101  theThresholdInE_Endcap_(conf_specific.getParameter<double>("ThresholdInElectrons_Endcap")),
102  theThresholdInE_Barrel_(conf_specific.getParameter<double>("ThresholdInElectrons_Barrel")),
103 
104  // Add threshold gaussian smearing:
105  theThresholdSmearing_Endcap_(conf_specific.getParameter<double>("ThresholdSmearing_Endcap")),
106  theThresholdSmearing_Barrel_(conf_specific.getParameter<double>("ThresholdSmearing_Barrel")),
107 
108  // Add HIP Threshold in electron units.
109  theHIPThresholdInE_Endcap_(conf_specific.getParameter<double>("HIPThresholdInElectrons_Endcap")),
110  theHIPThresholdInE_Barrel_(conf_specific.getParameter<double>("HIPThresholdInElectrons_Barrel")),
111 
112  // theTofCut 12.5, cut in particle TOD +/- 12.5ns
113  theTofLowerCut_(conf_specific.getParameter<double>("TofLowerCut")),
114  theTofUpperCut_(conf_specific.getParameter<double>("TofUpperCut")),
115 
116  // Get the Lorentz angle from the cfg file:
118  use_LorentzAngle_DB_ ? 0.0 : conf_specific.getParameter<double>("TanLorentzAnglePerTesla_Endcap")),
120  use_LorentzAngle_DB_ ? 0.0 : conf_specific.getParameter<double>("TanLorentzAnglePerTesla_Barrel")),
121 
122  // Add noise
123  addNoise_(conf_specific.getParameter<bool>("AddNoise")),
124 
125  // Add noisy pixels
126  addNoisyPixels_(conf_specific.getParameter<bool>("AddNoisyPixels")),
127 
128  // Fluctuate charge in track subsegments
129  fluctuateCharge_(conf_specific.getUntrackedParameter<bool>("FluctuateCharge", true)),
130 
131  // Control the pixel inefficiency
132  addPixelInefficiency_(conf_specific.getParameter<bool>("AddInefficiency")),
133 
134  // Add threshold gaussian smearing:
135  addThresholdSmearing_(conf_specific.getParameter<bool>("AddThresholdSmearing")),
136 
137  // Add some pseudo-red damage
138  pseudoRadDamage_(conf_specific.exists("PseudoRadDamage") ? conf_specific.getParameter<double>("PseudoRadDamage")
139  : double(0.0)),
140  pseudoRadDamageRadius_(conf_specific.exists("PseudoRadDamageRadius")
141  ? conf_specific.getParameter<double>("PseudoRadDamageRadius")
142  : double(0.0)),
143 
144  // delta cutoff in MeV, has to be same as in OSCAR(0.030/cmsim=1.0 MeV
145  // tMax(0.030), // In MeV.
146  // tMax(conf.getUntrackedParameter<double>("DeltaProductionCut",0.030)),
147  tMax_(conf_common.getParameter<double>("DeltaProductionCut")),
148 
149  badPixels_(conf_specific.getParameter<Parameters>("CellsToKill")),
150 
151  fluctuate_(fluctuateCharge_ ? std::make_unique<SiG4UniversalFluctuation>() : nullptr),
152  theNoiser_(addNoise_ ? std::make_unique<GaussianTailNoiseGenerator>() : nullptr),
154  use_ineff_from_db_ ? std::make_unique<SiPixelGainCalibrationOfflineSimService>(conf_specific, iC) : nullptr),
155  subdetEfficiencies_(conf_specific) {
156  LogDebug("Phase2TrackerDigitizerAlgorithm")
157  << "Phase2TrackerDigitizerAlgorithm constructed\n"
158  << "Configuration parameters:\n"
159  << "Threshold/Gain = "
160  << "threshold in electron Endcap = " << theThresholdInE_Endcap_
161  << "\nthreshold in electron Barrel = " << theThresholdInE_Barrel_ << " ElectronPerADC " << theElectronPerADC_
162  << " ADC Scale (in bits) " << theAdcFullScale_ << " The delta cut-off is set to " << tMax_ << " pix-inefficiency "
164 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool exists(std::string const &parameterName) const
checks if a parameter exists
const std::unique_ptr< SiG4UniversalFluctuation > fluctuate_
T getUntrackedParameter(std::string const &, T const &) const
const std::unique_ptr< SiPixelGainCalibrationOfflineSimService > theSiPixelGainCalibrationService_
vector< ParameterSet > Parameters
const std::unique_ptr< GaussianTailNoiseGenerator > theNoiser_
std::vector< edm::ParameterSet > Parameters
#define LogDebug(id)

◆ ~Phase2TrackerDigitizerAlgorithm()

Phase2TrackerDigitizerAlgorithm::~Phase2TrackerDigitizerAlgorithm ( )
virtual

Definition at line 166 of file Phase2TrackerDigitizerAlgorithm.cc.

References LogDebug.

166  {
167  LogDebug("Phase2TrackerDigitizerAlgorithm") << "Phase2TrackerDigitizerAlgorithm deleted";
168 }
#define LogDebug(id)

Member Function Documentation

◆ accumulateSimHits()

void Phase2TrackerDigitizerAlgorithm::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 
)
virtual

Definition at line 174 of file Phase2TrackerDigitizerAlgorithm.cc.

References c_inv, drift(), GeomDet::geographicalId(), induce_signal(), LogDebug, mag(), primary_ionization(), DetId::rawId(), select_hit(), GeomDet::surface(), and Surface::toGlobal().

179  {
180  // produce SignalPoint's for all SimHit's in detector
181  // Loop over hits
182  uint32_t detId = pixdet->geographicalId().rawId();
183  size_t simHitGlobalIndex = inputBeginGlobalIndex; // This needs to be stored to create the digi-sim link later
184 
185  // find the relevant hits
186  std::vector<PSimHit> matchedSimHits;
187  std::copy_if(inputBegin, inputEnd, std::back_inserter(matchedSimHits), [detId](auto const& hit) -> bool {
188  return hit.detUnitId() == detId;
189  });
190  // loop over a much reduced set of SimHits
191  for (auto const& hit : matchedSimHits) {
192  LogDebug("Phase2DigitizerAlgorithm") << hit.particleType() << " " << hit.pabs() << " " << hit.energyLoss() << " "
193  << hit.tof() << " " << hit.trackId() << " " << hit.processType() << " "
194  << hit.detUnitId() << hit.entryPoint() << " " << hit.exitPoint();
195  double signalScale = 1.0;
196  // fill collection_points for this SimHit, indpendent of topology
197  if (select_hit(hit, (pixdet->surface().toGlobal(hit.localPosition()).mag() * c_inv), signalScale)) {
198  const auto& ionization_points = primary_ionization(hit); // fills ionization_points
199 
200  // transforms ionization_points -> collection_points
201  const auto& collection_points = drift(hit, pixdet, bfield, ionization_points);
202 
203  // compute induced signal on readout elements and add to _signal
204  // hit needed only for SimHit<-->Digi link
205  induce_signal(hit, simHitGlobalIndex, tofBin, pixdet, collection_points);
206  }
207  ++simHitGlobalIndex;
208  }
209 }
virtual bool select_hit(const PSimHit &hit, double tCorr, double &sigScale) const
virtual std::vector< DigitizerUtility::EnergyDepositUnit > primary_ionization(const PSimHit &hit) const
virtual std::vector< DigitizerUtility::SignalPoint > drift(const PSimHit &hit, const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield, const std::vector< DigitizerUtility::EnergyDepositUnit > &ionization_points) const
virtual void induce_signal(const PSimHit &hit, const size_t hitIndex, const uint32_t tofBin, const Phase2TrackerGeomDetUnit *pixdet, const std::vector< DigitizerUtility::SignalPoint > &collection_points)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
constexpr double c_inv
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
#define LogDebug(id)

◆ add_cross_talk()

void Phase2TrackerDigitizerAlgorithm::add_cross_talk ( const Phase2TrackerGeomDetUnit pixdet)
protectedvirtual

Reimplemented in PixelDigitizerAlgorithm.

Definition at line 595 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, officialStyle::chan, Phase2TrackerDigi::channelToPixel(), PixelDigi::channelToPixel(), GeomDet::geographicalId(), interstripCoupling_, MainPageGenerator::l, PixelTopology::nrows(), pixelFlag_, Phase2TrackerDigi::pixelToChannel(), PixelDigi::pixelToChannel(), DetId::rawId(), alignCSCRings::s, and PixelGeomDetUnit::specificTopology().

Referenced by digitize().

595  {
596  uint32_t detID = pixdet->geographicalId().rawId();
597  signal_map_type& theSignal = _signal[detID];
598  signal_map_type signalNew;
599  const Phase2TrackerTopology* topol = &pixdet->specificTopology();
600  int numRows = topol->nrows();
601 
602  for (auto& s : theSignal) {
603  float signalInElectrons = s.second.ampl(); // signal in electrons
604 
605  std::pair<int, int> hitChan;
606  if (pixelFlag_)
607  hitChan = PixelDigi::channelToPixel(s.first);
608  else
609  hitChan = Phase2TrackerDigi::channelToPixel(s.first);
610 
611  float signalInElectrons_Xtalk = signalInElectrons * interstripCoupling_;
612  // subtract the charge which will be shared
613  s.second.set(signalInElectrons - signalInElectrons_Xtalk);
614 
615  if (hitChan.first != 0) {
616  auto XtalkPrev = std::make_pair(hitChan.first - 1, hitChan.second);
617  int chanXtalkPrev = pixelFlag_ ? PixelDigi::pixelToChannel(XtalkPrev.first, XtalkPrev.second)
618  : Phase2TrackerDigi::pixelToChannel(XtalkPrev.first, XtalkPrev.second);
619  signalNew.emplace(chanXtalkPrev, DigitizerUtility::Amplitude(signalInElectrons_Xtalk, nullptr, -1.0));
620  }
621  if (hitChan.first < numRows - 1) {
622  auto XtalkNext = std::make_pair(hitChan.first + 1, hitChan.second);
623  int chanXtalkNext = pixelFlag_ ? PixelDigi::pixelToChannel(XtalkNext.first, XtalkNext.second)
624  : Phase2TrackerDigi::pixelToChannel(XtalkNext.first, XtalkNext.second);
625  signalNew.emplace(chanXtalkNext, DigitizerUtility::Amplitude(signalInElectrons_Xtalk, nullptr, -1.0));
626  }
627  }
628  for (auto const& l : signalNew) {
629  int chan = l.first;
630  auto iter = theSignal.find(chan);
631  if (iter != theSignal.end()) {
632  theSignal[chan] += l.second.ampl();
633  } else {
634  theSignal.emplace(chan, DigitizerUtility::Amplitude(l.second.ampl(), nullptr, -1.0));
635  }
636  }
637 }
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:69
virtual int nrows() const =0
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:75
U second(std::pair< T, U > const &p)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
static std::pair< unsigned int, unsigned int > channelToPixel(unsigned int ch)
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
constexpr uint32_t pixelToChannel(int row, int col)

◆ add_noise()

void Phase2TrackerDigitizerAlgorithm::add_noise ( const Phase2TrackerGeomDetUnit pixdet)
protectedvirtual

Definition at line 579 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, gaussDistribution_, GeomDet::geographicalId(), hgchebackDigitizer_cfi::noise, DetId::rawId(), and alignCSCRings::s.

Referenced by digitize().

579  {
580  uint32_t detID = pixdet->geographicalId().rawId();
581  signal_map_type& theSignal = _signal[detID];
582  for (auto& s : theSignal) {
583  float noise = gaussDistribution_->fire();
584  if ((s.second.ampl() + noise) < 0.)
585  s.second.set(0);
586  else
587  s.second += noise;
588  }
589 }
std::unique_ptr< CLHEP::RandGaussQ > gaussDistribution_
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57

◆ add_noisy_cells()

void Phase2TrackerDigitizerAlgorithm::add_noisy_cells ( const Phase2TrackerGeomDetUnit pixdet,
float  thePixelThreshold 
)
protectedvirtual

Definition at line 644 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, LaserClient_cfi::Amplitude, officialStyle::chan, GeomDet::geographicalId(), LogDebug, PixelTopology::ncolumns(), PixelTopology::nrows(), pixelFlag_, Phase2TrackerDigi::pixelToChannel(), PixelDigi::pixelToChannel(), DetId::rawId(), rengine_, PixelGeomDetUnit::specificTopology(), theNoiseInElectrons_, theNoiser_, theThresholdInE_Barrel_, and theThresholdInE_Endcap_.

Referenced by digitize().

644  {
645  uint32_t detID = pixdet->geographicalId().rawId();
646  signal_map_type& theSignal = _signal[detID];
647  const Phase2TrackerTopology* topol = &pixdet->specificTopology();
648 
649  int numColumns = topol->ncolumns(); // det module number of cols&rows
650  int numRows = topol->nrows();
651 
652  int numberOfPixels = numRows * numColumns;
653  std::map<int, float, std::less<int> > otherPixels;
654 
655  theNoiser_->generate(numberOfPixels,
656  thePixelThreshold, //thr. in un. of nois
657  theNoiseInElectrons_, // noise in elec.
658  otherPixels,
659  rengine_);
660 
661  LogDebug("Phase2TrackerDigitizerAlgorithm")
662  << " Add noisy pixels " << numRows << " " << numColumns << " " << theNoiseInElectrons_ << " "
663  << theThresholdInE_Endcap_ << " " << theThresholdInE_Barrel_ << " " << numberOfPixels << " "
664  << otherPixels.size();
665 
666  // Add noisy pixels
667  for (auto const& el : otherPixels) {
668  int iy = el.first / numRows;
669  if (iy < 0 || iy > numColumns - 1)
670  LogWarning("Phase2TrackerDigitizerAlgorithm") << " error in iy " << iy;
671 
672  int ix = el.first - iy * numRows;
673  if (ix < 0 || ix > numRows - 1)
674  LogWarning("Phase2TrackerDigitizerAlgorithm") << " error in ix " << ix;
675 
677 
678  LogDebug("Phase2TrackerDigitizerAlgorithm")
679  << " Storing noise = " << el.first << " " << el.second << " " << ix << " " << iy << " " << chan;
680 
681  if (theSignal[chan] == 0)
682  theSignal[chan] = DigitizerUtility::Amplitude(el.second, nullptr, -1.);
683  }
684 }
virtual int ncolumns() const =0
virtual int nrows() const =0
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:75
const std::unique_ptr< GaussianTailNoiseGenerator > theNoiser_
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Log< level::Warning, false > LogWarning
constexpr uint32_t pixelToChannel(int row, int col)
#define LogDebug(id)

◆ calcQ()

float Phase2TrackerDigitizerAlgorithm::calcQ ( float  x)
protected

Definition at line 966 of file Phase2TrackerDigitizerAlgorithm.cc.

References f, SiStripPI::min, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, chargedHadronTrackResolutionFilter_cfi::p3, mathSSE::sqrt(), x, and geometryCSVtoXML::xx.

Referenced by PixelBrickedDigitizerAlgorithm::induce_signal(), and induce_signal().

966  {
967  constexpr float p1 = 12.5f;
968  constexpr float p2 = 0.2733f;
969  constexpr float p3 = 0.147f;
970 
971  auto xx = std::min(0.5f * x * x, p1);
972  return 0.5f * (1.f - std::copysign(std::sqrt(1.f - unsafe_expf<4>(-xx * (1.f + p2 / (1.f + p3 * xx)))), x));
973 }
T sqrt(T t)
Definition: SSEVec.h:19
double f[11][100]

◆ convertSignalToAdc()

int Phase2TrackerDigitizerAlgorithm::convertSignalToAdc ( uint32_t  detID,
float  signal_in_elec,
float  threshold 
)
protected

Definition at line 939 of file Phase2TrackerDigitizerAlgorithm.cc.

References funct::abs(), LogTrace, SiStripPI::min, funct::pow(), theAdcFullScale_, theElectronPerADC_, thePhase2ReadoutMode_, and remoteMonitoring_LASER_era2018_cfg::threshold.

Referenced by digitize().

939  {
940  int signal_in_adc;
941  int temp_signal;
942  const int max_limit = 10;
943  if (thePhase2ReadoutMode_ == 0) {
944  signal_in_adc = theAdcFullScale_;
945  } else {
946  if (thePhase2ReadoutMode_ == -1) {
947  temp_signal = std::min(static_cast<int>(signal_in_elec / theElectronPerADC_), theAdcFullScale_);
948  } else {
949  // calculate the kink point and the slope
950  int dualslope_param = std::min(std::abs(thePhase2ReadoutMode_), max_limit);
951  int kink_point = static_cast<int>(theAdcFullScale_ / 2) + 1;
952  // C-ROC: first valid ToT code above threshold is 0b0000
953  temp_signal = std::floor((signal_in_elec - threshold) / theElectronPerADC_);
954  if (temp_signal > kink_point)
955  temp_signal = std::floor((temp_signal - kink_point) / (pow(2, dualslope_param - 1))) + kink_point;
956  }
957  signal_in_adc = std::min(temp_signal, theAdcFullScale_);
958  LogTrace("Phase2TrackerDigitizerAlgorithm")
959  << " DetId " << detID << " signal_in_elec " << signal_in_elec << " threshold " << threshold
960  << " signal_above_thr " << signal_in_elec - threshold << " temp conversion "
961  << std::floor((signal_in_elec - threshold) / theElectronPerADC_) + 1 << " signal after slope correction "
962  << temp_signal << " signal_in_adc " << signal_in_adc;
963  }
964  return signal_in_adc;
965 }
#define LogTrace(id)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ digitize()

void Phase2TrackerDigitizerAlgorithm::digitize ( const Phase2TrackerGeomDetUnit pixdet,
std::map< int, DigitizerUtility::DigiSimInfo > &  digi_map,
const TrackerTopology tTopo 
)
virtual

Definition at line 864 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, add_cross_talk(), add_noise(), add_noisy_cells(), addNoise_, addNoisyPixels_, addPixelInefficiency_, addThresholdSmearing_, addXtalk_, DigitizerUtility::Amplitude::ampl(), convertSignalToAdc(), GeomDet::geographicalId(), info(), isAboveThreshold(), MainPageGenerator::l, makeDigiSimLinks_, module_killing_conf(), module_killing_DB(), pixel_inefficiency(), pixel_inefficiency_db(), PixelSubdetector::PixelBarrel, DetId::rawId(), alignCSCRings::s, edm::second(), DigitizerUtility::Amplitude::simInfoList(), smearedThreshold_Barrel_, smearedThreshold_Endcap_, subdetEfficiencies_, DetId::subdetId(), theElectronPerADC_, theHIPThresholdInE_Barrel_, theHIPThresholdInE_Endcap_, theThresholdInE_Barrel_, theThresholdInE_Endcap_, StripSubdetector::TOB, funct::true, use_deadmodule_DB_, use_ineff_from_db_, and use_module_killing_.

866  {
867  uint32_t detID = pixdet->geographicalId().rawId();
868  auto it = _signal.find(detID);
869  if (it == _signal.end())
870  return;
871 
872  const signal_map_type& theSignal = _signal[detID];
873 
874  uint32_t Sub_detid = DetId(detID).subdetId();
875 
876  float theThresholdInE = 0.;
877  float theHIPThresholdInE = 0.;
878  // Define Threshold
879  if (Sub_detid == PixelSubdetector::PixelBarrel || Sub_detid == StripSubdetector::TOB) { // Barrel modules
880  theThresholdInE = addThresholdSmearing_ ? smearedThreshold_Barrel_->fire() // gaussian smearing
881  : theThresholdInE_Barrel_; // no smearing
882  theHIPThresholdInE = theHIPThresholdInE_Barrel_;
883  } else { // Forward disks modules
884  theThresholdInE = addThresholdSmearing_ ? smearedThreshold_Endcap_->fire() // gaussian smearing
885  : theThresholdInE_Endcap_; // no smearing
886  theHIPThresholdInE = theHIPThresholdInE_Endcap_;
887  }
888 
889  // if (addNoise) add_noise(pixdet, theThresholdInE/theNoiseInElectrons_); // generate noise
890  if (addNoise_)
891  add_noise(pixdet); // generate noise
892  if (addXtalk_)
893  add_cross_talk(pixdet);
894  if (addNoisyPixels_)
895  add_noisy_cells(pixdet, theHIPThresholdInE / theElectronPerADC_);
896 
897  // Do only if needed
898  if (addPixelInefficiency_ && !theSignal.empty()) {
899  if (use_ineff_from_db_)
900  pixel_inefficiency_db(detID);
901  else
902  pixel_inefficiency(subdetEfficiencies_, pixdet, tTopo);
903  }
904  if (use_module_killing_) {
905  if (use_deadmodule_DB_) // remove dead modules using DB
906  module_killing_DB(pixdet);
907  else // remove dead modules using the list in cfg file
908  module_killing_conf(detID);
909  }
910 
911  // Digitize if the signal is greater than threshold
912  for (auto const& s : theSignal) {
913  const DigitizerUtility::Amplitude& sig_data = s.second;
914  float signalInElectrons = sig_data.ampl();
915 
916  const auto& info_list = sig_data.simInfoList();
917  const DigitizerUtility::SimHitInfo* hitInfo = nullptr;
918  if (!info_list.empty())
919  hitInfo = std::max_element(info_list.begin(), info_list.end())->second.get();
920 
921  if (isAboveThreshold(hitInfo, signalInElectrons, theThresholdInE)) { // check threshold
923  info.sig_tot = convertSignalToAdc(detID, signalInElectrons, theThresholdInE); // adc
924  info.ot_bit = signalInElectrons > theHIPThresholdInE ? true : false;
925  if (makeDigiSimLinks_) {
926  for (auto const& l : sig_data.simInfoList()) {
927  float charge_frac = l.first / signalInElectrons;
928  if (l.first > -5.0)
929  info.simInfoList.push_back({charge_frac, l.second.get()});
930  }
931  }
932  digi_map.insert({s.first, info});
933  }
934  }
935 }
static const TGPicture * info(bool iBackgroundIsBlack)
const std::vector< std::pair< float, std::unique_ptr< SimHitInfo > > > & simInfoList() const
virtual bool isAboveThreshold(const DigitizerUtility::SimHitInfo *hitInfo, float charge, float thr) const
virtual void add_cross_talk(const Phase2TrackerGeomDetUnit *pixdet)
virtual void add_noise(const Phase2TrackerGeomDetUnit *pixdet)
virtual void module_killing_conf(uint32_t detID)
U second(std::pair< T, U > const &p)
virtual void add_noisy_cells(const Phase2TrackerGeomDetUnit *pixdet, float thePixelThreshold)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
virtual void pixel_inefficiency_db(uint32_t detID)
static constexpr auto TOB
std::unique_ptr< CLHEP::RandGaussQ > smearedThreshold_Endcap_
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::unique_ptr< CLHEP::RandGaussQ > smearedThreshold_Barrel_
virtual void pixel_inefficiency(const SubdetEfficiencies &eff, const Phase2TrackerGeomDetUnit *pixdet, const TrackerTopology *tTopo)
virtual void module_killing_DB(const Phase2TrackerGeomDetUnit *pixdet)=0
int convertSignalToAdc(uint32_t detID, float signal_in_elec, float threshold)

◆ drift()

std::vector< DigitizerUtility::SignalPoint > Phase2TrackerDigitizerAlgorithm::drift ( const PSimHit hit,
const Phase2TrackerGeomDetUnit pixdet,
const GlobalVector bfield,
const std::vector< DigitizerUtility::EnergyDepositUnit > &  ionization_points 
) const
protectedvirtual

Reimplemented in Pixel3DDigitizerAlgorithm.

Definition at line 322 of file Phase2TrackerDigitizerAlgorithm.cc.

References alpha2Order_, Surface::bounds(), funct::cos(), DriftDirection(), JetChargeProducer_cfi::exp, LogDebug, M_PI, PV3DBase< T, PVType, FrameType >::perp(), PixelTopology::pitch(), GloballyPositioned< T >::position(), funct::pow(), pseudoRadDamage_, pseudoRadDamageRadius_, Sigma0_, SigmaCoeff_, GeomDet::specificSurface(), PixelGeomDetUnit::specificTopology(), mathSSE::sqrt(), GeomDet::surface(), Bounds::thickness(), heppy_batch::val, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by accumulateSimHits().

326  {
327  LogDebug("Phase2TrackerDigitizerAlgorithm") << "enter drift ";
328 
329  std::vector<DigitizerUtility::SignalPoint> collection_points;
330  collection_points.reserve(ionization_points.size()); // set size
331  LocalVector driftDir = DriftDirection(pixdet, bfield, hit.detUnitId()); // get the charge drift direction
332  if (driftDir.z() == 0.) {
333  LogWarning("Phase2TrackerDigitizerAlgorithm") << " pxlx: drift in z is zero ";
334  return collection_points;
335  }
336 
337  float TanLorenzAngleX = driftDir.x(); // tangent of Lorentz angle
338  float TanLorenzAngleY = 0.; // force to 0, driftDir.y()/driftDir.z();
339  float dir_z = driftDir.z(); // The z drift direction
340  float CosLorenzAngleX = 1. / std::sqrt(1. + std::pow(TanLorenzAngleX, 2)); // cosine to estimate the path length
341  float CosLorenzAngleY = 1.;
342  if (alpha2Order_) {
343  TanLorenzAngleY = driftDir.y();
344  CosLorenzAngleY = 1. / std::sqrt(1. + std::pow(TanLorenzAngleY, 2)); // cosine
345  }
346 
347  float moduleThickness = pixdet->specificSurface().bounds().thickness();
348  float stripPitch = pixdet->specificTopology().pitch().first;
349 
350  LogDebug("Phase2TrackerDigitizerAlgorithm")
351  << " Lorentz Tan " << TanLorenzAngleX << " " << TanLorenzAngleY << " " << CosLorenzAngleX << " "
352  << CosLorenzAngleY << " " << moduleThickness * TanLorenzAngleX << " " << driftDir;
353 
354  for (auto const& val : ionization_points) {
355  // position
356  float SegX = val.x(), SegY = val.y(), SegZ = val.z();
357 
358  // Distance from the collection plane
359  // DriftDistance = (moduleThickness/2. + SegZ); // Drift to -z
360  // Include explixitely the E drift direction (for CMS dir_z=-1)
361 
362  // Distance between charge generation and collection
363  float driftDistance = moduleThickness / 2. - (dir_z * SegZ); // Drift to -z
364 
365  if (driftDistance < 0.)
366  driftDistance = 0.;
367  else if (driftDistance > moduleThickness)
368  driftDistance = moduleThickness;
369 
370  // Assume full depletion now, partial depletion will come later.
371  float XDriftDueToMagField = driftDistance * TanLorenzAngleX;
372  float YDriftDueToMagField = driftDistance * TanLorenzAngleY;
373 
374  // Shift cloud center
375  float CloudCenterX = SegX + XDriftDueToMagField;
376  float CloudCenterY = SegY + YDriftDueToMagField;
377 
378  // Calculate how long is the charge drift path
379  // Actual Drift Lentgh
380  float driftLength =
381  std::sqrt(std::pow(driftDistance, 2) + std::pow(XDriftDueToMagField, 2) + std::pow(YDriftDueToMagField, 2));
382 
383  // What is the charge diffusion after this path
384  // Sigma0=0.00037 is for 300um thickness (make sure moduleThickness is in [cm])
385  float Sigma = std::sqrt(driftLength / moduleThickness) * Sigma0_ * moduleThickness / 0.0300;
386  // D.B.: sigmaCoeff=0 means no modulation
387  if (SigmaCoeff_)
388  Sigma *= (SigmaCoeff_ * std::pow(cos(SegX * M_PI / stripPitch), 2) + 1);
389  // NB: divided by 4 to get a periodicity of stripPitch
390 
391  // Project the diffusion sigma on the collection plane
392  float Sigma_x = Sigma / CosLorenzAngleX;
393  float Sigma_y = Sigma / CosLorenzAngleY;
394 
395  // Insert a charge loss due to Rad Damage here
396  float energyOnCollector = val.energy(); // The energy that reaches the collector
397 
398  // pseudoRadDamage
399  if (pseudoRadDamage_) {
400  float moduleRadius = pixdet->surface().position().perp();
401  if (moduleRadius <= pseudoRadDamageRadius_) {
402  float kValue = pseudoRadDamage_ / std::pow(moduleRadius, 2);
403  energyOnCollector *= exp(-1 * kValue * driftDistance / moduleThickness);
404  }
405  }
406  LogDebug("Phase2TrackerDigitizerAlgorithm")
407  << "Dift DistanceZ = " << driftDistance << " module thickness = " << moduleThickness
408  << " Start Energy = " << val.energy() << " Energy after loss= " << energyOnCollector;
409  DigitizerUtility::SignalPoint sp(CloudCenterX, CloudCenterY, Sigma_x, Sigma_y, hit.tof(), energyOnCollector);
410 
411  // Load the Charge distribution parameters
412  collection_points.push_back(sp);
413  }
414  return collection_points;
415 }
T perp() const
Definition: PV3DBase.h:69
LocalVector DriftDirection(const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield, const DetId &detId) const
T z() const
Definition: PV3DBase.h:61
virtual float thickness() const =0
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define M_PI
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const PositionType & position() const
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
virtual std::pair< float, float > pitch() const =0
Log< level::Warning, false > LogWarning
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
#define LogDebug(id)
const Bounds & bounds() const
Definition: Surface.h:87

◆ DriftDirection()

LocalVector Phase2TrackerDigitizerAlgorithm::DriftDirection ( const Phase2TrackerGeomDetUnit pixdet,
const GlobalVector bfield,
const DetId detId 
) const
protected

Definition at line 745 of file Phase2TrackerDigitizerAlgorithm.cc.

References alpha2Order_, mkfit::Config::Bfield, GeomDet::geographicalId(), SiPixelLorentzAngle::getLorentzAngle(), SiPhase2OuterTrackerLorentzAngle::getLorentzAngle(), fastTrackerRecHitType::isPixel(), LogDebug, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, GloballyPositioned< T >::position(), funct::pow(), DetId::rawId(), GloballyPositioned< T >::rotation(), L1EGammaClusterEmuProducer_cfi::scale, siPhase2OTLorentzAngle_, siPixelLorentzAngle_, DetId::subdetId(), GeomDet::surface(), tanLorentzAnglePerTesla_Barrel_, tanLorentzAnglePerTesla_Endcap_, StripSubdetector::TOB, and use_LorentzAngle_DB_.

Referenced by drift().

747  {
748  Frame detFrame(pixdet->surface().position(), pixdet->surface().rotation());
749  LocalVector Bfield = detFrame.toLocal(bfield);
750 
751  float dir_x = 0.0;
752  float dir_y = 0.0;
753  float dir_z = 0.0;
754  float scale = 1.0;
755 
756  uint32_t detID = pixdet->geographicalId().rawId();
757  uint32_t Sub_detid = DetId(detID).subdetId();
758 
759  // Read Lorentz angle from DB:
760  if (use_LorentzAngle_DB_) {
761  bool isPixel = (Sub_detid == PixelSubdetector::PixelBarrel || Sub_detid == PixelSubdetector::PixelEndcap);
762 
763  float lorentzAngle =
765  float alpha2 = std::pow(lorentzAngle, 2);
766 
767  dir_x = -(lorentzAngle * Bfield.y() + alpha2 * Bfield.z() * Bfield.x());
768  dir_y = +(lorentzAngle * Bfield.x() - alpha2 * Bfield.z() * Bfield.y());
769  dir_z = -(1 + alpha2 * std::pow(Bfield.z(), 2));
770  scale = (1 + alpha2 * std::pow(Bfield.z(), 2));
771  } else {
772  // Read Lorentz angle from cfg file:
773  float alpha2_Endcap = 0.0;
774  float alpha2_Barrel = 0.0;
775  if (alpha2Order_) {
776  alpha2_Endcap = std::pow(tanLorentzAnglePerTesla_Endcap_, 2);
777  alpha2_Barrel = std::pow(tanLorentzAnglePerTesla_Barrel_, 2);
778  }
779 
780  if (Sub_detid == PixelSubdetector::PixelBarrel || Sub_detid == StripSubdetector::TOB) { // barrel layers
781  dir_x = -(tanLorentzAnglePerTesla_Barrel_ * Bfield.y() + alpha2_Barrel * Bfield.z() * Bfield.x());
782  dir_y = +(tanLorentzAnglePerTesla_Barrel_ * Bfield.x() - alpha2_Barrel * Bfield.z() * Bfield.y());
783  dir_z = -(1 + alpha2_Barrel * std::pow(Bfield.z(), 2));
784  scale = (1 + alpha2_Barrel * std::pow(Bfield.z(), 2));
785 
786  } else { // forward disks
787  dir_x = -(tanLorentzAnglePerTesla_Endcap_ * Bfield.y() + alpha2_Endcap * Bfield.z() * Bfield.x());
788  dir_y = +(tanLorentzAnglePerTesla_Endcap_ * Bfield.x() - alpha2_Endcap * Bfield.z() * Bfield.y());
789  dir_z = -(1 + alpha2_Endcap * std::pow(Bfield.z(), 2));
790  scale = (1 + alpha2_Endcap * std::pow(Bfield.z(), 2));
791  }
792  }
793 
794  LocalVector theDriftDirection = LocalVector(dir_x / scale, dir_y / scale, dir_z / scale);
795  LogDebug("Phase2TrackerDigitizerAlgorithm") << " The drift direction in local coordinate is " << theDriftDirection;
796  return theDriftDirection;
797 }
Local3DVector LocalVector
Definition: LocalVector.h:12
const SiPixelLorentzAngle * siPixelLorentzAngle_
constexpr float Bfield
Definition: Config.h:88
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const PositionType & position() const
const SiPhase2OuterTrackerLorentzAngle * siPhase2OTLorentzAngle_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
bool isPixel(HitType hitType)
const RotationType & rotation() const
float getLorentzAngle(const uint32_t &) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
#define LogDebug(id)

◆ fluctuateEloss()

std::vector< float > Phase2TrackerDigitizerAlgorithm::fluctuateEloss ( int  particleId,
float  momentum,
float  eloss,
float  length,
int  NumberOfSegments 
) const
protectedvirtual

Definition at line 265 of file Phase2TrackerDigitizerAlgorithm.cc.

References funct::abs(), c, mps_fire::end, fluctuate_, mps_fire::i, ph2tkdigialgo::m_electron, ph2tkdigialgo::m_kaon, ph2tkdigialgo::m_muon, ph2tkdigialgo::m_pion, ph2tkdigialgo::m_proton, particleFlowDisplacedVertex_cfi::ratio, rengine_, tMax_, and HcalDetIdTransform::transform().

Referenced by primary_ionization().

266  {
267  double particleMass = ph2tkdigialgo::m_pion; // Mass in MeV, assume pion
268  pid = std::abs(pid);
269  if (pid != 211) { // Mass in MeV
270  if (pid == 11)
271  particleMass = ph2tkdigialgo::m_electron;
272  else if (pid == 13)
273  particleMass = ph2tkdigialgo::m_muon;
274  else if (pid == 321)
275  particleMass = ph2tkdigialgo::m_kaon;
276  else if (pid == 2212)
277  particleMass = ph2tkdigialgo::m_proton;
278  }
279  // What is the track segment length.
280  float segmentLength = length / NumberOfSegs;
281 
282  // Generate charge fluctuations.
283  float sum = 0.;
284  double segmentEloss = (1000. * eloss) / NumberOfSegs; //eloss in MeV
285  std::vector<float> elossVector;
286  elossVector.reserve(NumberOfSegs);
287  for (int i = 0; i < NumberOfSegs; ++i) {
288  // The G4 routine needs momentum in MeV, mass in Mev, delta-cut in MeV,
289  // track segment length in mm, segment eloss in MeV
290  // Returns fluctuated eloss in MeV
291  double deltaCutoff = tMax_; // the cutoff is sometimes redefined inside, so fix it.
292  float de = fluctuate_->SampleFluctuations(particleMomentum * 1000.,
293  particleMass,
294  deltaCutoff,
295  segmentLength * 10.,
296  segmentEloss,
297  rengine_) /
298  1000.; //convert to GeV
299  elossVector.push_back(de);
300  sum += de;
301  }
302  if (sum > 0.) { // if fluctuations give eloss>0.
303  // Rescale to the same total eloss
304  float ratio = eloss / sum;
306  std::begin(elossVector), std::end(elossVector), std::begin(elossVector), [&ratio](auto const& c) -> float {
307  return c * ratio;
308  }); // use a simple lambda expression
309  } else { // if fluctuations gives 0 eloss
310  float averageEloss = eloss / NumberOfSegs;
311  elossVector.resize(NumberOfSegs, averageEloss);
312  }
313  return elossVector;
314 }
const std::unique_ptr< SiG4UniversalFluctuation > fluctuate_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ induce_signal()

void Phase2TrackerDigitizerAlgorithm::induce_signal ( const PSimHit hit,
const size_t  hitIndex,
const uint32_t  tofBin,
const Phase2TrackerGeomDetUnit pixdet,
const std::vector< DigitizerUtility::SignalPoint > &  collection_points 
)
protectedvirtual

Reimplemented in Pixel3DDigitizerAlgorithm.

Definition at line 420 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, LaserClient_cfi::Amplitude, c_inv, calcQ(), officialStyle::chan, Topology::channel(), PixelTestBeamValidation_cfi::Charge, clusterWidth_, GeomDet::geographicalId(), Topology::localPosition(), LogDebug, mag(), makeDigiSimLinks_, Topology::measurementPosition(), PixelTopology::ncolumns(), PixelTopology::nrows(), PixelTopology::pitch(), pixelFlag_, Phase2TrackerDigi::pixelToChannel(), PixelDigi::pixelToChannel(), DetId::rawId(), VtxSmearedHGCALCloseBy_cfi::SigmaX, VtxSmearedHGCALCloseBy_cfi::SigmaY, PixelGeomDetUnit::specificTopology(), GeomDet::surface(), Surface::toGlobal(), findQualityFiles::v, x, PV2DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::x(), y, PV2DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by accumulateSimHits().

425  {
426  // X - Rows, Left-Right, 160, (1.6cm) for barrel
427  // Y - Columns, Down-Up, 416, (6.4cm)
428  const Phase2TrackerTopology* topol = &pixdet->specificTopology();
429  uint32_t detID = pixdet->geographicalId().rawId();
430  signal_map_type& theSignal = _signal[detID];
431 
432  LogDebug("Phase2TrackerDigitizerAlgorithm")
433  << " enter induce_signal, " << topol->pitch().first << " " << topol->pitch().second;
434 
435  // local map to store pixels hit by 1 Hit.
436  using hit_map_type = std::map<int, float, std::less<int> >;
437  hit_map_type hit_signal;
438 
439  // Assign signals to readout channels and store sorted by channel number
440  // Iterate over collection points on the collection plane
441  for (auto const& v : collection_points) {
442  float CloudCenterX = v.position().x(); // Charge position in x
443  float CloudCenterY = v.position().y(); // in y
444  float SigmaX = v.sigma_x(); // Charge spread in x
445  float SigmaY = v.sigma_y(); // in y
446  float Charge = v.amplitude(); // Charge amplitude
447 
448  LogDebug("Phase2TrackerDigitizerAlgorithm") << " cloud " << v.position().x() << " " << v.position().y() << " "
449  << v.sigma_x() << " " << v.sigma_y() << " " << v.amplitude();
450 
451  // Find the maximum cloud spread in 2D plane , assume 3*sigma
452  float CloudRight = CloudCenterX + clusterWidth_ * SigmaX;
453  float CloudLeft = CloudCenterX - clusterWidth_ * SigmaX;
454  float CloudUp = CloudCenterY + clusterWidth_ * SigmaY;
455  float CloudDown = CloudCenterY - clusterWidth_ * SigmaY;
456 
457  // Define 2D cloud limit points
458  LocalPoint PointRightUp = LocalPoint(CloudRight, CloudUp);
459  LocalPoint PointLeftDown = LocalPoint(CloudLeft, CloudDown);
460 
461  // This points can be located outside the sensor area.
462  // The conversion to measurement point does not check for that
463  // so the returned pixel index might be wrong (outside range).
464  // We rely on the limits check below to fix this.
465  // But remember whatever we do here THE CHARGE OUTSIDE THE ACTIVE
466  // PIXEL ARE IS LOST, it should not be collected.
467 
468  // Convert the 2D points to pixel indices
469  MeasurementPoint mp = topol->measurementPosition(PointRightUp);
470  int IPixRightUpX = static_cast<int>(std::floor(mp.x())); // cast reqd.
471  int IPixRightUpY = static_cast<int>(std::floor(mp.y()));
472  LogDebug("Phase2TrackerDigitizerAlgorithm")
473  << " right-up " << PointRightUp << " " << mp.x() << " " << mp.y() << " " << IPixRightUpX << " " << IPixRightUpY;
474 
475  mp = topol->measurementPosition(PointLeftDown);
476  int IPixLeftDownX = static_cast<int>(std::floor(mp.x()));
477  int IPixLeftDownY = static_cast<int>(std::floor(mp.y()));
478  LogDebug("Phase2TrackerDigitizerAlgorithm") << " left-down " << PointLeftDown << " " << mp.x() << " " << mp.y()
479  << " " << IPixLeftDownX << " " << IPixLeftDownY;
480 
481  // Check detector limits to correct for pixels outside range.
482  int numColumns = topol->ncolumns(); // det module number of cols&rows
483  int numRows = topol->nrows();
484 
485  IPixRightUpX = numRows > IPixRightUpX ? IPixRightUpX : numRows - 1;
486  IPixRightUpY = numColumns > IPixRightUpY ? IPixRightUpY : numColumns - 1;
487  IPixLeftDownX = 0 < IPixLeftDownX ? IPixLeftDownX : 0;
488  IPixLeftDownY = 0 < IPixLeftDownY ? IPixLeftDownY : 0;
489 
490  // First integrate charge strips in x
491  hit_map_type x;
492  for (int ix = IPixLeftDownX; ix <= IPixRightUpX; ++ix) { // loop over x index
493  float xLB, LowerBound;
494  // Why is set to 0 if ix=0, does it meen that we accept charge
495  // outside the sensor?
496  if (ix == 0 || SigmaX == 0.) { // skip for surface segemnts
497  LowerBound = 0.;
498  } else {
499  mp = MeasurementPoint(ix, 0.0);
500  xLB = topol->localPosition(mp).x();
501  LowerBound = 1 - calcQ((xLB - CloudCenterX) / SigmaX);
502  }
503 
504  float xUB, UpperBound;
505  if (ix == numRows - 1 || SigmaX == 0.) {
506  UpperBound = 1.;
507  } else {
508  mp = MeasurementPoint(ix + 1, 0.0);
509  xUB = topol->localPosition(mp).x();
510  UpperBound = 1. - calcQ((xUB - CloudCenterX) / SigmaX);
511  }
512  float TotalIntegrationRange = UpperBound - LowerBound; // get strip
513  x.emplace(ix, TotalIntegrationRange); // save strip integral
514  }
515 
516  // Now integrate strips in y
517  hit_map_type y;
518  for (int iy = IPixLeftDownY; iy <= IPixRightUpY; ++iy) { // loop over y index
519  float yLB, LowerBound;
520  if (iy == 0 || SigmaY == 0.) {
521  LowerBound = 0.;
522  } else {
523  mp = MeasurementPoint(0.0, iy);
524  yLB = topol->localPosition(mp).y();
525  LowerBound = 1. - calcQ((yLB - CloudCenterY) / SigmaY);
526  }
527 
528  float yUB, UpperBound;
529  if (iy == numColumns - 1 || SigmaY == 0.) {
530  UpperBound = 1.;
531  } else {
532  mp = MeasurementPoint(0.0, iy + 1);
533  yUB = topol->localPosition(mp).y();
534  UpperBound = 1. - calcQ((yUB - CloudCenterY) / SigmaY);
535  }
536 
537  float TotalIntegrationRange = UpperBound - LowerBound;
538  y.emplace(iy, TotalIntegrationRange); // save strip integral
539  }
540 
541  // Get the 2D charge integrals by folding x and y strips
542  for (int ix = IPixLeftDownX; ix <= IPixRightUpX; ++ix) { // loop over x index
543  for (int iy = IPixLeftDownY; iy <= IPixRightUpY; ++iy) { // loop over y index
544  float ChargeFraction = Charge * x[ix] * y[iy];
545  int chanFired = -1;
546  if (ChargeFraction > 0.) {
547  chanFired =
548  pixelFlag_ ? PixelDigi::pixelToChannel(ix, iy) : Phase2TrackerDigi::pixelToChannel(ix, iy); // Get index
549  // Load the amplitude
550  hit_signal[chanFired] += ChargeFraction;
551  }
552 
553  mp = MeasurementPoint(ix, iy);
554  LocalPoint lp = topol->localPosition(mp);
555  int chan = topol->channel(lp);
556 
557  LogDebug("Phase2TrackerDigitizerAlgorithm")
558  << " pixel " << ix << " " << iy << " - "
559  << " " << chanFired << " " << ChargeFraction << " " << mp.x() << " " << mp.y() << " " << lp.x() << " "
560  << lp.y() << " " // givex edge position
561  << chan; // edge belongs to previous ?
562  }
563  }
564  }
565  // Fill the global map with all hit pixels from this event
566  float corr_time = hit.tof() - pixdet->surface().toGlobal(hit.localPosition()).mag() * c_inv;
567  for (auto const& hit_s : hit_signal) {
568  int chan = hit_s.first;
569  theSignal[chan] +=
570  (makeDigiSimLinks_ ? DigitizerUtility::Amplitude(hit_s.second, &hit, hit_s.second, corr_time, hitIndex, tofBin)
571  : DigitizerUtility::Amplitude(hit_s.second, nullptr, hit_s.second));
572  }
573 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
virtual int ncolumns() const =0
virtual int nrows() const =0
T x() const
Definition: PV2DBase.h:43
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:75
T y() const
Definition: PV2DBase.h:44
U second(std::pair< T, U > const &p)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
virtual int channel(const LocalPoint &p) const =0
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
constexpr double c_inv
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
virtual std::pair< float, float > pitch() const =0
constexpr uint32_t pixelToChannel(int row, int col)
#define LogDebug(id)

◆ init()

virtual void Phase2TrackerDigitizerAlgorithm::init ( const edm::EventSetup es)
pure virtual

◆ initializeEvent()

void Phase2TrackerDigitizerAlgorithm::initializeEvent ( CLHEP::HepRandomEngine &  eng)
virtual

Definition at line 722 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, addNoise_, addPixelInefficiency_, addThresholdSmearing_, fluctuateCharge_, gaussDistribution_, rengine_, smearedThreshold_Barrel_, smearedThreshold_Endcap_, theReadoutNoise_, theThresholdInE_Barrel_, theThresholdInE_Endcap_, theThresholdSmearing_Barrel_, and theThresholdSmearing_Endcap_.

722  {
724  gaussDistribution_ = std::make_unique<CLHEP::RandGaussQ>(eng, 0., theReadoutNoise_);
725  }
726  // Threshold smearing with gaussian distribution:
727  if (addThresholdSmearing_) {
729  std::make_unique<CLHEP::RandGaussQ>(eng, theThresholdInE_Endcap_, theThresholdSmearing_Endcap_);
731  std::make_unique<CLHEP::RandGaussQ>(eng, theThresholdInE_Barrel_, theThresholdSmearing_Barrel_);
732  }
733  rengine_ = &eng;
734  _signal.clear();
735 }
std::unique_ptr< CLHEP::RandGaussQ > gaussDistribution_
std::unique_ptr< CLHEP::RandGaussQ > smearedThreshold_Endcap_
std::unique_ptr< CLHEP::RandGaussQ > smearedThreshold_Barrel_

◆ isAboveThreshold()

virtual bool Phase2TrackerDigitizerAlgorithm::isAboveThreshold ( const DigitizerUtility::SimHitInfo hitInfo,
float  charge,
float  thr 
) const
inlinevirtual

Reimplemented in PixelDigitizerAlgorithm, PSSDigitizerAlgorithm, SSDigitizerAlgorithm, and PSPDigitizerAlgorithm.

Definition at line 76 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

76  {
77  return true;
78  }

◆ loadAccumulator()

void Phase2TrackerDigitizerAlgorithm::loadAccumulator ( uint32_t  detId,
const std::map< int, float > &  accumulator 
)

Definition at line 852 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, mixOne_premix_on_sim_cfi::accumulator, and Exception.

852  {
853  auto& theSignal = _signal[detId];
854  // the input channel is always with PixelDigi definition
855  // if needed, that has to be converted to Phase2TrackerDigi convention
856  for (const auto& elem : accumulator) {
857  auto inserted = theSignal.emplace(elem.first, DigitizerUtility::Amplitude(elem.second, nullptr));
858  if (!inserted.second) {
859  throw cms::Exception("LogicError") << "Signal was already set for DetId " << detId;
860  }
861  }
862 }

◆ module_killing_conf()

void Phase2TrackerDigitizerAlgorithm::module_killing_conf ( uint32_t  detID)
protectedvirtual

Definition at line 822 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, Phase2TrackerDigi::channelToPixel(), PixelDigi::channelToPixel(), deadModules_, pixelFlag_, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by digitize().

822  {
823  bool isbad = false;
824  int detid = detID;
826  for (auto const& det_m : deadModules_) {
827  int Dead_detID = det_m.getParameter<int>("Dead_detID");
828  Module = det_m.getParameter<std::string>("Module");
829  if (detid == Dead_detID) {
830  isbad = true;
831  break;
832  }
833  }
834 
835  if (!isbad)
836  return;
837 
838  signal_map_type& theSignal = _signal[detID]; // check validity
839  for (auto& s : theSignal) {
840  std::pair<int, int> ip;
841  if (pixelFlag_)
842  ip = PixelDigi::channelToPixel(s.first);
843  else
844  ip = Phase2TrackerDigi::channelToPixel(s.first); //get pixel pos
845 
846  if (Module == "whole" || (Module == "tbmA" && ip.first >= 80 && ip.first <= 159) ||
847  (Module == "tbmB" && ip.first <= 79))
848  s.second.set(0.);
849  }
850 }
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:69
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
static std::pair< unsigned int, unsigned int > channelToPixel(unsigned int ch)

◆ module_killing_DB()

virtual void Phase2TrackerDigitizerAlgorithm::module_killing_DB ( const Phase2TrackerGeomDetUnit pixdet)
protectedpure virtual

◆ pixel_inefficiency()

void Phase2TrackerDigitizerAlgorithm::pixel_inefficiency ( const SubdetEfficiencies eff,
const Phase2TrackerGeomDetUnit pixdet,
const TrackerTopology tTopo 
)
protectedvirtual

Definition at line 689 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, Phase2TrackerDigitizerAlgorithm::SubdetEfficiencies::barrel_efficiencies, Phase2TrackerDigitizerAlgorithm::SubdetEfficiencies::endcap_efficiencies, GeomDet::geographicalId(), LogDebug, PixelSubdetector::PixelBarrel, TrackerTopology::pxbLayer(), TrackerTopology::pxfDisk(), TrackerTopology::pxfSide(), DetId::rawId(), rengine_, alignCSCRings::s, DetId::subdetId(), and StripSubdetector::TOB.

Referenced by digitize().

691  {
692  uint32_t detID = pixdet->geographicalId().rawId();
693  signal_map_type& theSignal = _signal[detID]; // check validity
694 
695  // Predefined efficiencies
696  float subdetEfficiency = 1.0;
697 
698  // setup the chip indices conversion
699  uint32_t Subid = DetId(detID).subdetId();
700  if (Subid == PixelSubdetector::PixelBarrel || Subid == StripSubdetector::TOB) { // barrel layers
701  uint32_t layerIndex = tTopo->pxbLayer(detID);
702  if (layerIndex - 1 < eff.barrel_efficiencies.size())
703  subdetEfficiency = eff.barrel_efficiencies[layerIndex - 1];
704  } else { // forward disks
705  uint32_t diskIndex = 2 * tTopo->pxfDisk(detID) - tTopo->pxfSide(detID);
706  if (diskIndex - 1 < eff.endcap_efficiencies.size())
707  subdetEfficiency = eff.endcap_efficiencies[diskIndex - 1];
708  }
709 
710  LogDebug("Phase2TrackerDigitizerAlgorithm") << " enter pixel_inefficiency " << subdetEfficiency;
711 
712  // Now loop again over pixels to kill some of them.
713  // Loop over hits, amplitude in electrons, channel = coded row,col
714  for (auto& s : theSignal) {
715  float rand = rengine_->flat();
716  if (rand > subdetEfficiency) {
717  // make amplitude =0
718  s.second.set(0.); // reset amplitude
719  }
720  }
721 }
unsigned int pxbLayer(const DetId &id) const
unsigned int pxfDisk(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
Definition: DetId.h:17
unsigned int pxfSide(const DetId &id) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
#define LogDebug(id)

◆ pixel_inefficiency_db()

void Phase2TrackerDigitizerAlgorithm::pixel_inefficiency_db ( uint32_t  detID)
protectedvirtual

Definition at line 801 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, Phase2TrackerDigi::channelToPixel(), PixelDigi::channelToPixel(), cuy::col, pixelFlag_, alignCSCRings::s, and theSiPixelGainCalibrationService_.

Referenced by digitize().

801  {
802  signal_map_type& theSignal = _signal[detID]; // check validity
803 
804  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
805  for (auto& s : theSignal) {
806  std::pair<int, int> ip;
807  if (pixelFlag_)
808  ip = PixelDigi::channelToPixel(s.first); //get pixel pos
809  else
810  ip = Phase2TrackerDigi::channelToPixel(s.first); //get pixel pos
811 
812  int row = ip.first; // X in row
813  int col = ip.second; // Y is in col
814  // transform to ROC index coordinates
815  if (theSiPixelGainCalibrationService_->isDead(detID, col, row))
816  s.second.set(0.); // reset amplitude
817  }
818 }
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:69
const std::unique_ptr< SiPixelGainCalibrationOfflineSimService > theSiPixelGainCalibrationService_
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
static std::pair< unsigned int, unsigned int > channelToPixel(unsigned int ch)
col
Definition: cuy.py:1009

◆ primary_ionization()

std::vector< DigitizerUtility::EnergyDepositUnit > Phase2TrackerDigitizerAlgorithm::primary_ionization ( const PSimHit hit) const
protectedvirtual

Definition at line 216 of file Phase2TrackerDigitizerAlgorithm.cc.

References simKBmtfDigis_cfi::eLoss, HCALHighEnergyHPDFilter_cfi::energy, DigitizerUtility::EnergyDepositUnit::energy(), fluctuateCharge_, fluctuateEloss(), GeVperElectron_, mps_fire::i, LogDebug, PV3DBase< T, PVType, FrameType >::mag(), point, DigitizerUtility::EnergyDepositUnit::x(), hit::x, DigitizerUtility::EnergyDepositUnit::y(), hit::y, DigitizerUtility::EnergyDepositUnit::z(), and hit::z.

Referenced by accumulateSimHits().

217  {
218  // Straight line approximation for trajectory inside active media
219  constexpr float SegmentLength = 0.0010; // in cm (10 microns)
220  // Get the 3D segment direction vector
221  LocalVector direction = hit.exitPoint() - hit.entryPoint();
222 
223  float eLoss = hit.energyLoss(); // Eloss in GeV
224  float length = direction.mag(); // Track length in Silicon
225 
226  int NumberOfSegments = static_cast<int>(length / SegmentLength); // Number of segments
227  if (NumberOfSegments < 1)
228  NumberOfSegments = 1;
229  LogDebug("Phase2TrackerDigitizerAlgorithm")
230  << "enter primary_ionzation " << NumberOfSegments << " shift = " << hit.exitPoint().x() - hit.entryPoint().x()
231  << " " << hit.exitPoint().y() - hit.entryPoint().y() << " " << hit.exitPoint().z() - hit.entryPoint().z() << " "
232  << hit.particleType() << " " << hit.pabs();
233 
234  std::vector<float> elossVector;
235  elossVector.reserve(NumberOfSegments);
236  if (fluctuateCharge_) {
237  // Generate fluctuated charge points
238  elossVector = fluctuateEloss(hit.particleType(), hit.pabs(), eLoss, length, NumberOfSegments);
239  } else {
240  float averageEloss = eLoss / NumberOfSegments;
241  elossVector.resize(NumberOfSegments, averageEloss);
242  }
243 
244  std::vector<DigitizerUtility::EnergyDepositUnit> ionization_points;
245  ionization_points.reserve(NumberOfSegments); // set size
246  // loop over segments
247  for (size_t i = 0; i < elossVector.size(); ++i) {
248  // Divide the segment into equal length subsegments
249  Local3DPoint point = hit.entryPoint() + ((i + 0.5) / NumberOfSegments) * direction;
250  float energy = elossVector[i] / GeVperElectron_; // Convert charge to elec.
251 
252  DigitizerUtility::EnergyDepositUnit edu(energy, point); // define position,energy point
253  ionization_points.push_back(edu); // save
254  LogDebug("Phase2TrackerDigitizerAlgorithm")
255  << i << " " << edu.x() << " " << edu.y() << " " << edu.z() << " " << edu.energy();
256  }
257  return ionization_points;
258 }
T mag() const
Definition: PV3DBase.h:64
virtual std::vector< float > fluctuateEloss(int particleId, float momentum, float eloss, float length, int NumberOfSegments) const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
#define LogDebug(id)

◆ select_hit()

virtual bool Phase2TrackerDigitizerAlgorithm::select_hit ( const PSimHit hit,
double  tCorr,
double &  sigScale 
) const
inlinevirtual

Member Data Documentation

◆ _signal

signalMaps Phase2TrackerDigitizerAlgorithm::_signal
protected

◆ addNoise_

const bool Phase2TrackerDigitizerAlgorithm::addNoise_
protected

Definition at line 158 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize(), and initializeEvent().

◆ addNoisyPixels_

const bool Phase2TrackerDigitizerAlgorithm::addNoisyPixels_
protected

Definition at line 159 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

◆ addPixelInefficiency_

const bool Phase2TrackerDigitizerAlgorithm::addPixelInefficiency_
protected

◆ addThresholdSmearing_

const bool Phase2TrackerDigitizerAlgorithm::addThresholdSmearing_
protected

Definition at line 165 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize(), and initializeEvent().

◆ addXtalk_

const bool Phase2TrackerDigitizerAlgorithm::addXtalk_
protected

Definition at line 127 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

◆ alpha2Order_

const bool Phase2TrackerDigitizerAlgorithm::alpha2Order_
protected

Definition at line 126 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by drift(), and DriftDirection().

◆ badPixels_

Parameters Phase2TrackerDigitizerAlgorithm::badPixels_
protected

◆ clusterWidth_

const float Phase2TrackerDigitizerAlgorithm::clusterWidth_
protected

◆ deadModules_

const Parameters Phase2TrackerDigitizerAlgorithm::deadModules_
protected

Definition at line 118 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by module_killing_conf().

◆ fedCablingMap_

const SiPixelFedCablingMap* Phase2TrackerDigitizerAlgorithm::fedCablingMap_
protected

◆ fluctuate_

const std::unique_ptr<SiG4UniversalFluctuation> Phase2TrackerDigitizerAlgorithm::fluctuate_
protected

Definition at line 182 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by fluctuateEloss().

◆ fluctuateCharge_

const bool Phase2TrackerDigitizerAlgorithm::fluctuateCharge_
protected

Definition at line 160 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by initializeEvent(), and primary_ionization().

◆ gaussDistribution_

std::unique_ptr<CLHEP::RandGaussQ> Phase2TrackerDigitizerAlgorithm::gaussDistribution_
protected

Definition at line 224 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by add_noise(), and initializeEvent().

◆ geom_

const TrackerGeometry* Phase2TrackerDigitizerAlgorithm::geom_
protected

Definition at line 95 of file Phase2TrackerDigitizerAlgorithm.h.

◆ GeVperElectron_

const float Phase2TrackerDigitizerAlgorithm::GeVperElectron_
protected

◆ interstripCoupling_

const float Phase2TrackerDigitizerAlgorithm::interstripCoupling_
protected

Definition at line 128 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by add_cross_talk().

◆ makeDigiSimLinks_

const bool Phase2TrackerDigitizerAlgorithm::makeDigiSimLinks_
protected

◆ pixelFlag_

bool Phase2TrackerDigitizerAlgorithm::pixelFlag_
protected

◆ pseudoRadDamage_

const double Phase2TrackerDigitizerAlgorithm::pseudoRadDamage_
protected

Definition at line 168 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by Pixel3DDigitizerAlgorithm::drift(), and drift().

◆ pseudoRadDamageRadius_

const double Phase2TrackerDigitizerAlgorithm::pseudoRadDamageRadius_
protected

Definition at line 169 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by Pixel3DDigitizerAlgorithm::drift(), and drift().

◆ rengine_

CLHEP::HepRandomEngine* Phase2TrackerDigitizerAlgorithm::rengine_
protected

◆ Sigma0_

const float Phase2TrackerDigitizerAlgorithm::Sigma0_
protected

Definition at line 129 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by drift().

◆ SigmaCoeff_

const float Phase2TrackerDigitizerAlgorithm::SigmaCoeff_
protected

Definition at line 130 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by drift().

◆ siPhase2OTLorentzAngle_

const SiPhase2OuterTrackerLorentzAngle* Phase2TrackerDigitizerAlgorithm::siPhase2OTLorentzAngle_
protected

Definition at line 88 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by DriftDirection().

◆ siPixelBadModule_

const SiPixelQuality* Phase2TrackerDigitizerAlgorithm::siPixelBadModule_
protected

◆ siPixelLorentzAngle_

const SiPixelLorentzAngle* Phase2TrackerDigitizerAlgorithm::siPixelLorentzAngle_
protected

Definition at line 85 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by DriftDirection().

◆ smearedThreshold_Barrel_

std::unique_ptr<CLHEP::RandGaussQ> Phase2TrackerDigitizerAlgorithm::smearedThreshold_Barrel_
protected

Definition at line 228 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize(), and initializeEvent().

◆ smearedThreshold_Endcap_

std::unique_ptr<CLHEP::RandGaussQ> Phase2TrackerDigitizerAlgorithm::smearedThreshold_Endcap_
protected

Definition at line 227 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize(), and initializeEvent().

◆ subdetEfficiencies_

const SubdetEfficiencies Phase2TrackerDigitizerAlgorithm::subdetEfficiencies_
protected

Definition at line 220 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

◆ tanLorentzAnglePerTesla_Barrel_

const float Phase2TrackerDigitizerAlgorithm::tanLorentzAnglePerTesla_Barrel_
protected

Definition at line 155 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by DriftDirection().

◆ tanLorentzAnglePerTesla_Endcap_

const float Phase2TrackerDigitizerAlgorithm::tanLorentzAnglePerTesla_Endcap_
protected

Definition at line 154 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by DriftDirection().

◆ theAdcFullScale_

const int Phase2TrackerDigitizerAlgorithm::theAdcFullScale_
protected

◆ theElectronPerADC_

const float Phase2TrackerDigitizerAlgorithm::theElectronPerADC_
protected

◆ theHIPThresholdInE_Barrel_

const double Phase2TrackerDigitizerAlgorithm::theHIPThresholdInE_Barrel_
protected

Definition at line 150 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

◆ theHIPThresholdInE_Endcap_

const double Phase2TrackerDigitizerAlgorithm::theHIPThresholdInE_Endcap_
protected

Definition at line 149 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

◆ theNoiseInElectrons_

const float Phase2TrackerDigitizerAlgorithm::theNoiseInElectrons_
protected

Definition at line 139 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by add_noisy_cells().

◆ theNoiser_

const std::unique_ptr<GaussianTailNoiseGenerator> Phase2TrackerDigitizerAlgorithm::theNoiser_
protected

Definition at line 183 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by add_noisy_cells().

◆ thePhase2ReadoutMode_

const int Phase2TrackerDigitizerAlgorithm::thePhase2ReadoutMode_
protected

Definition at line 136 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by convertSignalToAdc().

◆ theReadoutNoise_

const float Phase2TrackerDigitizerAlgorithm::theReadoutNoise_
protected

Definition at line 140 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by initializeEvent().

◆ theSiPixelGainCalibrationService_

const std::unique_ptr<SiPixelGainCalibrationOfflineSimService> Phase2TrackerDigitizerAlgorithm::theSiPixelGainCalibrationService_
protected

Definition at line 210 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by pixel_inefficiency_db().

◆ theThresholdInE_Barrel_

const float Phase2TrackerDigitizerAlgorithm::theThresholdInE_Barrel_
protected

◆ theThresholdInE_Endcap_

const float Phase2TrackerDigitizerAlgorithm::theThresholdInE_Endcap_
protected

◆ theThresholdSmearing_Barrel_

const double Phase2TrackerDigitizerAlgorithm::theThresholdSmearing_Barrel_
protected

Definition at line 147 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by initializeEvent().

◆ theThresholdSmearing_Endcap_

const double Phase2TrackerDigitizerAlgorithm::theThresholdSmearing_Endcap_
protected

Definition at line 146 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by initializeEvent().

◆ theTofLowerCut_

const float Phase2TrackerDigitizerAlgorithm::theTofLowerCut_
protected

◆ theTofUpperCut_

const float Phase2TrackerDigitizerAlgorithm::theTofUpperCut_
protected

◆ tMax_

const double Phase2TrackerDigitizerAlgorithm::tMax_
protected

◆ use_deadmodule_DB_

const bool Phase2TrackerDigitizerAlgorithm::use_deadmodule_DB_
protected

◆ use_ineff_from_db_

const bool Phase2TrackerDigitizerAlgorithm::use_ineff_from_db_
protected

Definition at line 113 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

◆ use_LorentzAngle_DB_

const bool Phase2TrackerDigitizerAlgorithm::use_LorentzAngle_DB_
protected

◆ use_module_killing_

const bool Phase2TrackerDigitizerAlgorithm::use_module_killing_
protected

Definition at line 114 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().