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

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 unsigned int tofBin, const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield)=0
 
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)
 
void loadAccumulator (unsigned int detId, const std::map< int, float > &accumulator)
 
 Phase2TrackerDigitizerAlgorithm (const edm::ParameterSet &conf_common, const edm::ParameterSet &conf_specific)
 
virtual ~Phase2TrackerDigitizerAlgorithm ()
 

Protected Types

using Frame = GloballyPositioned< double >
 
using Parameters = std::vector< edm::ParameterSet >
 
using signal_map_const_iterator = signal_map_type::const_iterator
 
using signal_map_iterator = signal_map_type::iterator
 
using signal_map_type = std::map< int, DigitizerUtility::Amplitude, std::less< int > >
 
using signalMaps = std::map< uint32_t, signal_map_type >
 
using simlink_map = std::map< unsigned int, std::vector< float >, std::less< unsigned int > >
 

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)
 
double calcQ (float x) const
 
int convertSignalToAdc (uint32_t detID, float signal_in_elec, float threshold)
 
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
 
LocalVector DriftDirection (const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield, const DetId &detId) const
 
void fluctuateEloss (int particleId, float momentum, float eloss, float length, int NumberOfSegments, std::vector< float > &elossVector) const
 
void induce_signal (const PSimHit &hit, const size_t hitIndex, const unsigned int tofBin, const Phase2TrackerGeomDetUnit *pixdet, const std::vector< DigitizerUtility::SignalPoint > &collection_points)
 
virtual void module_killing_conf (uint32_t detID)
 
virtual void module_killing_DB (uint32_t detID)
 
virtual void pixel_inefficiency (const SubdetEfficiencies &eff, const Phase2TrackerGeomDetUnit *pixdet, const TrackerTopology *tTopo)
 
virtual void pixel_inefficiency_db (uint32_t detID)
 
void primary_ionization (const PSimHit &hit, std::vector< DigitizerUtility::EnergyDepositUnit > &ionization_points) const
 

Protected Attributes

signalMaps _signal
 
const bool addNoise
 
const bool addNoisyPixels
 
const bool AddPixelInefficiency
 
const bool addThresholdSmearing
 
const bool addXtalk
 
const bool alpha2Order
 
std::vector< edm::ParameterSetbadPixels
 
const float ClusterWidth
 
const Parameters DeadModules
 
const std::unique_ptr< SiG4UniversalFluctuationfluctuate
 
const bool fluctuateCharge
 
std::unique_ptr< CLHEP::RandGaussQ > gaussDistribution_
 
edm::ESHandle< TrackerGeometrygeom_
 
const float GeVperElectron
 
const float interstripCoupling
 
const bool makeDigiSimLinks_
 
edm::ESHandle< SiPixelFedCablingMapmap_
 
bool pixelFlag
 
const double pseudoRadDamage
 
const double pseudoRadDamageRadius
 
CLHEP::HepRandomEngine * rengine_
 
const float Sigma0
 
const float SigmaCoeff
 
edm::ESHandle< SiPixelQualitySiPixelBadModule_
 
edm::ESHandle< 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 45 of file Phase2TrackerDigitizerAlgorithm.h.

Member Typedef Documentation

Definition at line 89 of file Phase2TrackerDigitizerAlgorithm.h.

Definition at line 90 of file Phase2TrackerDigitizerAlgorithm.h.

using Phase2TrackerDigitizerAlgorithm::signal_map_const_iterator = signal_map_type::const_iterator
protected

Definition at line 86 of file Phase2TrackerDigitizerAlgorithm.h.

using Phase2TrackerDigitizerAlgorithm::signal_map_iterator = signal_map_type::iterator
protected

Definition at line 85 of file Phase2TrackerDigitizerAlgorithm.h.

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

Definition at line 84 of file Phase2TrackerDigitizerAlgorithm.h.

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

Definition at line 88 of file Phase2TrackerDigitizerAlgorithm.h.

using Phase2TrackerDigitizerAlgorithm::simlink_map = std::map<unsigned int, std::vector<float>, std::less<unsigned int> >
protected

Definition at line 87 of file Phase2TrackerDigitizerAlgorithm.h.

Constructor & Destructor Documentation

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

Definition at line 59 of file Phase2TrackerDigitizerAlgorithm.cc.

References AddPixelInefficiency, theAdcFullScale, theElectronPerADC, theThresholdInE_Barrel, theThresholdInE_Endcap, and tMax.

61  : _signal(),
62  makeDigiSimLinks_(conf_common.getUntrackedParameter<bool>("makeDigiSimLinks", true)),
63  use_ineff_from_db_(conf_specific.getParameter<bool>("Inefficiency_DB")),
64  use_module_killing_(conf_specific.getParameter<bool>("KillModules")), // boolean to kill or not modules
65  use_deadmodule_DB_(conf_specific.getParameter<bool>("DeadModules_DB")), // boolean to access dead modules from DB
66  // boolean to access Lorentz angle from DB
67  use_LorentzAngle_DB_(conf_specific.getParameter<bool>("LorentzAngle_DB")),
68 
69  // get dead module from cfg file
70  DeadModules(use_deadmodule_DB_ ? Parameters() : conf_specific.getParameter<Parameters>("DeadModules")),
71 
72  // Common pixel parameters
73  // These are parameters which are not likely to be changed
74  GeVperElectron(3.61E-09), // 1 electron(3.61eV, 1keV(277e, mod 9/06 d.k.
75  alpha2Order(conf_specific.getParameter<bool>("Alpha2Order")), // switch on/off of E.B effect
76  addXtalk(conf_specific.getParameter<bool>("AddXTalk")),
77  // Interstrip Coupling - Not used in PixelDigitizerAlgorithm
78  interstripCoupling(conf_specific.getParameter<double>("InterstripCoupling")),
79 
80  Sigma0(conf_specific.getParameter<double>("SigmaZero")), // Charge diffusion constant 7->3.7
81  SigmaCoeff(conf_specific.getParameter<double>("SigmaCoeff")), // delta in the diffusion across the strip pitch
82  // (set between 0 to 0.9, 0-->flat Sigma0, 1-->Sigma_min=0 & Sigma_max=2*Sigma0
83  // D.B.: Dist300 replaced by moduleThickness, may not work with partially depleted sensors but works otherwise
84  // Dist300(0.0300), // normalized to 300micron Silicon
85 
86  // Charge integration spread on the collection plane
87  ClusterWidth(conf_specific.getParameter<double>("ClusterWidth")),
88 
89  // Allowed modes of readout which has following values :
90  // 0 ---> Digital or binary readout
91  // -1 ---> Analog readout, current digitizer (Inner Pixel) (TDR version) with no threshold subtraction
92  // Analog readout with dual slope with the "second" slope being 1/2^(n-1) and threshold subtraction (n = 1, 2, 3,4)
93  thePhase2ReadoutMode(conf_specific.getParameter<int>("Phase2ReadoutMode")),
94 
95  // ADC calibration 1adc count(135e.
96  // Corresponds to 2adc/kev, 270[e/kev]/135[e/adc](2[adc/kev]
97  // Be careful, this parameter is also used in SiPixelDet.cc to
98  // calculate the noise in adc counts from noise in electrons.
99  // Both defaults should be the same.
100  theElectronPerADC(conf_specific.getParameter<double>("ElectronPerAdc")),
101 
102  // ADC saturation value, 255(8bit adc.
103  theAdcFullScale(conf_specific.getParameter<int>("AdcFullScale")),
104 
105  // Noise in electrons:
106  // Pixel cell noise, relevant for generating noisy pixels
107  theNoiseInElectrons(conf_specific.getParameter<double>("NoiseInElectrons")),
108 
109  // Fill readout noise, including all readout chain, relevant for smearing
110  theReadoutNoise(conf_specific.getParameter<double>("ReadoutNoiseInElec")),
111 
112  // Threshold in units of noise:
113  // thePixelThreshold(conf.getParameter<double>("ThresholdInNoiseUnits")),
114  // Pixel threshold in electron units.
115  theThresholdInE_Endcap(conf_specific.getParameter<double>("ThresholdInElectrons_Endcap")),
116  theThresholdInE_Barrel(conf_specific.getParameter<double>("ThresholdInElectrons_Barrel")),
117 
118  // Add threshold gaussian smearing:
119  theThresholdSmearing_Endcap(conf_specific.getParameter<double>("ThresholdSmearing_Endcap")),
120  theThresholdSmearing_Barrel(conf_specific.getParameter<double>("ThresholdSmearing_Barrel")),
121 
122  // Add HIP Threshold in electron units.
123  theHIPThresholdInE_Endcap(conf_specific.getParameter<double>("HIPThresholdInElectrons_Endcap")),
124  theHIPThresholdInE_Barrel(conf_specific.getParameter<double>("HIPThresholdInElectrons_Barrel")),
125 
126  // theTofCut 12.5, cut in particle TOD +/- 12.5ns
127  theTofLowerCut(conf_specific.getParameter<double>("TofLowerCut")),
128  theTofUpperCut(conf_specific.getParameter<double>("TofUpperCut")),
129 
130  // Get the Lorentz angle from the cfg file:
132  use_LorentzAngle_DB_ ? 0.0 : conf_specific.getParameter<double>("TanLorentzAnglePerTesla_Endcap")),
134  use_LorentzAngle_DB_ ? 0.0 : conf_specific.getParameter<double>("TanLorentzAnglePerTesla_Barrel")),
135 
136  // Add noise
137  addNoise(conf_specific.getParameter<bool>("AddNoise")),
138 
139  // Add noisy pixels
140  addNoisyPixels(conf_specific.getParameter<bool>("AddNoisyPixels")),
141 
142  // Fluctuate charge in track subsegments
143  fluctuateCharge(conf_specific.getUntrackedParameter<bool>("FluctuateCharge", true)),
144 
145  // Control the pixel inefficiency
146  AddPixelInefficiency(conf_specific.getParameter<bool>("AddInefficiency")),
147 
148  // Add threshold gaussian smearing:
149  addThresholdSmearing(conf_specific.getParameter<bool>("AddThresholdSmearing")),
150 
151  // Add some pseudo-red damage
152  pseudoRadDamage(conf_specific.exists("PseudoRadDamage") ? conf_specific.getParameter<double>("PseudoRadDamage")
153  : double(0.0)),
154  pseudoRadDamageRadius(conf_specific.exists("PseudoRadDamageRadius")
155  ? conf_specific.getParameter<double>("PseudoRadDamageRadius")
156  : double(0.0)),
157 
158  // delta cutoff in MeV, has to be same as in OSCAR(0.030/cmsim=1.0 MeV
159  // tMax(0.030), // In MeV.
160  // tMax(conf.getUntrackedParameter<double>("DeltaProductionCut",0.030)),
161  tMax(conf_common.getParameter<double>("DeltaProductionCut")),
162 
163  badPixels(conf_specific.getParameter<std::vector<edm::ParameterSet> >("CellsToKill")),
167  : nullptr),
168  subdetEfficiencies_(conf_specific) {
169  LogInfo("Phase2TrackerDigitizerAlgorithm")
170  << "Phase2TrackerDigitizerAlgorithm constructed\n"
171  << "Configuration parameters:\n"
172  << "Threshold/Gain = "
173  << "threshold in electron Endcap = " << theThresholdInE_Endcap
174  << "\nthreshold in electron Barrel = " << theThresholdInE_Barrel << " ElectronPerADC " << theElectronPerADC
175  << " ADC Scale (in bits) " << theAdcFullScale << " The delta cut-off is set to " << tMax << " pix-inefficiency "
177 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::unique_ptr< SiG4UniversalFluctuation > fluctuate
#define nullptr
bool exists(std::string const &parameterName) const
checks if a parameter exists
const std::unique_ptr< SiPixelGainCalibrationOfflineSimService > theSiPixelGainCalibrationService_
vector< ParameterSet > Parameters
std::vector< edm::ParameterSet > badPixels
std::vector< edm::ParameterSet > Parameters
const std::unique_ptr< GaussianTailNoiseGenerator > theNoiser
Phase2TrackerDigitizerAlgorithm::~Phase2TrackerDigitizerAlgorithm ( )
virtual

Definition at line 179 of file Phase2TrackerDigitizerAlgorithm.cc.

References LogDebug.

179  {
180  LogDebug("Phase2TrackerDigitizerAlgorithm") << "Phase2TrackerDigitizerAlgorithm deleted";
181 }
#define LogDebug(id)

Member Function Documentation

virtual void Phase2TrackerDigitizerAlgorithm::accumulateSimHits ( const std::vector< PSimHit >::const_iterator  inputBegin,
const std::vector< PSimHit >::const_iterator  inputEnd,
const size_t  inputBeginGlobalIndex,
const unsigned int  tofBin,
const Phase2TrackerGeomDetUnit pixdet,
const GlobalVector bfield 
)
pure virtual
void Phase2TrackerDigitizerAlgorithm::add_cross_talk ( const Phase2TrackerGeomDetUnit pixdet)
protectedvirtual

Reimplemented in PixelDigitizerAlgorithm.

Definition at line 606 of file Phase2TrackerDigitizerAlgorithm.cc.

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

Referenced by digitize().

606  {
607  uint32_t detID = pixdet->geographicalId().rawId();
608  signal_map_type& theSignal = _signal[detID];
609  signal_map_type signalNew;
610  const Phase2TrackerTopology* topol = &pixdet->specificTopology();
611  int numRows = topol->nrows();
612 
613  for (auto& s : theSignal) {
614  float signalInElectrons = s.second.ampl(); // signal in electrons
615 
616  std::pair<int, int> hitChan;
617  if (pixelFlag)
618  hitChan = PixelDigi::channelToPixel(s.first);
619  else
620  hitChan = Phase2TrackerDigi::channelToPixel(s.first);
621 
622  float signalInElectrons_Xtalk = signalInElectrons * interstripCoupling;
623  //subtract the charge which will be shared
624  s.second.set(signalInElectrons - signalInElectrons_Xtalk);
625 
626  if (hitChan.first != 0) {
627  auto XtalkPrev = std::make_pair(hitChan.first - 1, hitChan.second);
628  int chanXtalkPrev = (pixelFlag) ? PixelDigi::pixelToChannel(XtalkPrev.first, XtalkPrev.second)
629  : Phase2TrackerDigi::pixelToChannel(XtalkPrev.first, XtalkPrev.second);
630  signalNew.emplace(chanXtalkPrev, DigitizerUtility::Amplitude(signalInElectrons_Xtalk, nullptr, -1.0));
631  }
632  if (hitChan.first < (numRows - 1)) {
633  auto XtalkNext = std::make_pair(hitChan.first + 1, hitChan.second);
634  int chanXtalkNext = (pixelFlag) ? PixelDigi::pixelToChannel(XtalkNext.first, XtalkNext.second)
635  : Phase2TrackerDigi::pixelToChannel(XtalkNext.first, XtalkNext.second);
636  signalNew.emplace(chanXtalkNext, DigitizerUtility::Amplitude(signalInElectrons_Xtalk, nullptr, -1.0));
637  }
638  }
639  for (auto const& l : signalNew) {
640  int chan = l.first;
641  auto iter = theSignal.find(chan);
642  if (iter != theSignal.end()) {
643  theSignal[chan] += l.second.ampl();
644  } else {
645  theSignal.emplace(chan, DigitizerUtility::Amplitude(l.second.ampl(), nullptr, -1.0));
646  }
647  }
648 }
virtual int nrows() const =0
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:65
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:71
static PackedDigiType pixelToChannel(unsigned int row, unsigned int col)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
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)
void Phase2TrackerDigitizerAlgorithm::add_noise ( const Phase2TrackerGeomDetUnit pixdet)
protectedvirtual

Definition at line 590 of file Phase2TrackerDigitizerAlgorithm.cc.

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

Referenced by digitize().

590  {
591  uint32_t detID = pixdet->geographicalId().rawId();
592  signal_map_type& theSignal = _signal[detID];
593  for (auto& s : theSignal) {
594  float noise = gaussDistribution_->fire();
595  if ((s.second.ampl() + noise) < 0.)
596  s.second.set(0);
597  else
598  s.second += noise;
599  }
600 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
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
void Phase2TrackerDigitizerAlgorithm::add_noisy_cells ( const Phase2TrackerGeomDetUnit pixdet,
float  thePixelThreshold 
)
protectedvirtual

Definition at line 655 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, LaserClient_cfi::Amplitude, officialStyle::chan, GeomDet::geographicalId(), createfilelist::int, LogDebug, PixelTopology::ncolumns(), hgcalDigitizer_cfi::noise, PixelTopology::nrows(), pixelFlag, Phase2TrackerDigi::pixelToChannel(), PixelDigi::pixelToChannel(), DetId::rawId(), rengine_, PixelGeomDetUnit::specificTopology(), theNoiseInElectrons, theNoiser, theThresholdInE_Barrel, and theThresholdInE_Endcap.

Referenced by digitize().

655  {
656  uint32_t detID = pixdet->geographicalId().rawId();
657  signal_map_type& theSignal = _signal[detID];
658  const Phase2TrackerTopology* topol = &pixdet->specificTopology();
659  int numColumns = topol->ncolumns(); // det module number of cols&rows
660  int numRows = topol->nrows();
661 
662  int numberOfPixels = numRows * numColumns;
663  std::map<int, float, std::less<int> > otherPixels;
664  std::map<int, float, std::less<int> >::iterator mapI;
665 
666  theNoiser->generate(numberOfPixels,
667  thePixelThreshold, //thr. in un. of nois
668  theNoiseInElectrons, // noise in elec.
669  otherPixels,
670  rengine_);
671 
672  LogDebug("Phase2TrackerDigitizerAlgorithm")
673  << " Add noisy pixels " << numRows << " " << numColumns << " " << theNoiseInElectrons << " "
674  << theThresholdInE_Endcap << " " << theThresholdInE_Barrel << " " << numberOfPixels << " " << otherPixels.size();
675 
676  // Add noisy pixels
677  for (mapI = otherPixels.begin(); mapI != otherPixels.end(); mapI++) {
678  int iy = ((*mapI).first) / numRows;
679  int ix = ((*mapI).first) - (iy * numRows);
680  // Keep for a while for testing.
681  if (iy < 0 || iy > (numColumns - 1))
682  LogWarning("Phase2TrackerDigitizerAlgorithm") << " error in iy " << iy;
683  if (ix < 0 || ix > (numRows - 1))
684  LogWarning("Phase2TrackerDigitizerAlgorithm") << " error in ix " << ix;
685 
686  int chan;
688 
689  LogDebug("Phase2TrackerDigitizerAlgorithm")
690  << " Storing noise = " << (*mapI).first << " " << (*mapI).second << " " << ix << " " << iy << " " << chan;
691 
692  if (theSignal[chan] == 0) {
693  int noise = int((*mapI).second);
694  theSignal[chan] = DigitizerUtility::Amplitude(noise, nullptr, -1.);
695  }
696  }
697 }
#define LogDebug(id)
virtual int nrows() const =0
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:71
static PackedDigiType pixelToChannel(unsigned int row, unsigned int col)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
virtual int ncolumns() const =0
const std::unique_ptr< GaussianTailNoiseGenerator > theNoiser
double Phase2TrackerDigitizerAlgorithm::calcQ ( float  x) const
inlineprotected

Definition at line 223 of file Phase2TrackerDigitizerAlgorithm.h.

References f, min(), mathSSE::sqrt(), and geometryCSVtoXML::xx.

Referenced by induce_signal().

223  {
224  auto xx = std::min(0.5f * x * x, 12.5f);
225  return 0.5 * (1.0 - std::copysign(std::sqrt(1.f - unsafe_expf<4>(-xx * (1.f + 0.2733f / (1.f + 0.147f * xx)))), x));
226  }
T sqrt(T t)
Definition: SSEVec.h:19
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
int Phase2TrackerDigitizerAlgorithm::convertSignalToAdc ( uint32_t  detID,
float  signal_in_elec,
float  threshold 
)
protected

Definition at line 1024 of file Phase2TrackerDigitizerAlgorithm.cc.

References funct::abs(), createfilelist::int, min(), funct::pow(), theAdcFullScale, theElectronPerADC, thePhase2ReadoutMode, and MessageLogger_cff::threshold.

Referenced by digitize().

1024  {
1025  int signal_in_adc;
1026  int temp_signal;
1027  const int max_limit = 10;
1028  if (thePhase2ReadoutMode == 0)
1029  signal_in_adc = theAdcFullScale;
1030  else {
1031  if (thePhase2ReadoutMode == -1) {
1032  temp_signal = std::min(int(signal_in_elec / theElectronPerADC), theAdcFullScale);
1033  } else {
1034  // calculate the kink point and the slope
1035  const int dualslope_param = std::min(abs(thePhase2ReadoutMode), max_limit);
1036  const int kink_point = int(theAdcFullScale / 2) + 1;
1037  temp_signal = std::floor((signal_in_elec - threshold) / theElectronPerADC) + 1;
1038  if (temp_signal > kink_point)
1039  temp_signal = std::floor((temp_signal - kink_point) / (pow(2, dualslope_param - 1))) + kink_point;
1040  }
1041  signal_in_adc = std::min(temp_signal, theAdcFullScale);
1042  LogInfo("Phase2TrackerDigitizerAlgorithm")
1043  << " DetId " << detID << " signal_in_elec " << signal_in_elec << " threshold " << threshold
1044  << " signal_above_thr " << (signal_in_elec - threshold) << " temp conversion "
1045  << std::floor((signal_in_elec - threshold) / theElectronPerADC) + 1 << " signal after slope correction "
1046  << temp_signal << " signal_in_adc " << signal_in_adc;
1047  }
1048  return signal_in_adc;
1049 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
void Phase2TrackerDigitizerAlgorithm::digitize ( const Phase2TrackerGeomDetUnit pixdet,
std::map< int, DigitizerUtility::DigiSimInfo > &  digi_map,
const TrackerTopology tTopo 
)
virtual

Definition at line 948 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, ecalMGPA::adc(), add_cross_talk(), add_noise(), add_noisy_cells(), addNoise, addNoisyPixels, AddPixelInefficiency, addThresholdSmearing, addXtalk, DigitizerUtility::Amplitude::ampl(), convertSignalToAdc(), GeomDet::geographicalId(), info(), cmsLHEtoEOSManager::l, makeDigiSimLinks_, module_killing_conf(), module_killing_DB(), DigitizerUtility::DigiSimInfo::ot_bit, pixel_inefficiency(), pixel_inefficiency_db(), PixelSubdetector::PixelBarrel, DetId::rawId(), alignCSCRings::s, DigitizerUtility::DigiSimInfo::sig_tot, DigitizerUtility::Amplitude::simInfoList(), DigitizerUtility::DigiSimInfo::simInfoList, smearedThreshold_Barrel_, smearedThreshold_Endcap_, subdetEfficiencies_, DetId::subdetId(), theElectronPerADC, theHIPThresholdInE_Barrel, theHIPThresholdInE_Endcap, theThresholdInE_Barrel, theThresholdInE_Endcap, StripSubdetector::TOB, use_deadmodule_DB_, use_ineff_from_db_, and use_module_killing_.

950  {
951  uint32_t detID = pixdet->geographicalId().rawId();
952  auto it = _signal.find(detID);
953  if (it == _signal.end())
954  return;
955 
956  const signal_map_type& theSignal = _signal[detID];
957 
958  unsigned int Sub_detid = DetId(detID).subdetId();
959 
960  float theThresholdInE = 0.;
961  float theHIPThresholdInE = 0.;
962  // Define Threshold
963  if (Sub_detid == PixelSubdetector::PixelBarrel || Sub_detid == StripSubdetector::TOB) { // Barrel modules
965  theThresholdInE = smearedThreshold_Barrel_->fire(); // gaussian smearing
966  else
967  theThresholdInE = theThresholdInE_Barrel; // no smearing
968  theHIPThresholdInE = theHIPThresholdInE_Barrel;
969  } else { // Forward disks modules
971  theThresholdInE = smearedThreshold_Endcap_->fire(); // gaussian smearing
972  else
973  theThresholdInE = theThresholdInE_Endcap; // no smearing
974  theHIPThresholdInE = theHIPThresholdInE_Endcap;
975  }
976 
977  // if (addNoise) add_noise(pixdet, theThresholdInE/theNoiseInElectrons); // generate noise
978  if (addNoise)
979  add_noise(pixdet); // generate noise
980  if (addXtalk)
981  add_cross_talk(pixdet);
982  if (addNoisyPixels)
983  add_noisy_cells(pixdet, theHIPThresholdInE / theElectronPerADC);
984 
985  // Do only if needed
986  if (AddPixelInefficiency && !theSignal.empty()) {
987  if (use_ineff_from_db_)
988  pixel_inefficiency_db(detID);
989  else
990  pixel_inefficiency(subdetEfficiencies_, pixdet, tTopo);
991  }
992  if (use_module_killing_) {
993  if (use_deadmodule_DB_) // remove dead modules using DB
994  module_killing_DB(detID);
995  else // remove dead modules using the list in cfg file
996  module_killing_conf(detID);
997  }
998 
999  // Digitize if the signal is greater than threshold
1000  for (auto const& s : theSignal) {
1001  // DigitizerUtility::Amplitude sig_data = s.second;
1002  const DigitizerUtility::Amplitude& sig_data = s.second;
1003  float signalInElectrons = sig_data.ampl();
1004  unsigned short adc;
1005  if (signalInElectrons >= theThresholdInE) { // check threshold
1006  adc = convertSignalToAdc(detID, signalInElectrons, theThresholdInE);
1008  info.sig_tot = adc;
1009  info.ot_bit = (signalInElectrons > theHIPThresholdInE ? true : false);
1010  if (makeDigiSimLinks_) {
1011  for (auto const& l : sig_data.simInfoList()) {
1012  float charge_frac = l.first / signalInElectrons;
1013  if (l.first > -5.0)
1014  info.simInfoList.push_back({charge_frac, l.second.get()});
1015  }
1016  }
1017  digi_map.insert({s.first, info});
1018  }
1019  }
1020 }
static const TGPicture * info(bool iBackgroundIsBlack)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
virtual void add_cross_talk(const Phase2TrackerGeomDetUnit *pixdet)
virtual void add_noise(const Phase2TrackerGeomDetUnit *pixdet)
virtual void module_killing_conf(uint32_t detID)
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
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
virtual void pixel_inefficiency_db(uint32_t detID)
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
static constexpr auto TOB
std::unique_ptr< CLHEP::RandGaussQ > smearedThreshold_Endcap_
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
Definition: DetId.h:17
std::unique_ptr< CLHEP::RandGaussQ > smearedThreshold_Barrel_
std::vector< std::pair< float, SimHitInfoForLinks * > > simInfoList
virtual void pixel_inefficiency(const SubdetEfficiencies &eff, const Phase2TrackerGeomDetUnit *pixdet, const TrackerTopology *tTopo)
const std::vector< std::pair< float, std::unique_ptr< SimHitInfoForLinks > > > & simInfoList() const
int convertSignalToAdc(uint32_t detID, float signal_in_elec, float threshold)
void Phase2TrackerDigitizerAlgorithm::drift ( const PSimHit hit,
const Phase2TrackerGeomDetUnit pixdet,
const GlobalVector bfield,
const std::vector< DigitizerUtility::EnergyDepositUnit > &  ionization_points,
std::vector< DigitizerUtility::SignalPoint > &  collection_points 
) const
protected

Definition at line 312 of file Phase2TrackerDigitizerAlgorithm.cc.

References alpha2Order, Surface::bounds(), funct::cos(), PSimHit::detUnitId(), DriftDirection(), JetChargeProducer_cfi::exp, mps_fire::i, LogDebug, M_PI, PV3DBase< T, PVType, FrameType >::perp(), PixelTopology::pitch(), GloballyPositioned< T >::position(), pseudoRadDamage, pseudoRadDamageRadius, Sigma0, SigmaCoeff, GeomDet::specificSurface(), PixelGeomDetUnit::specificTopology(), mathSSE::sqrt(), GeomDet::surface(), Bounds::thickness(), PSimHit::tof(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by SSDigitizerAlgorithm::accumulateSimHits(), PSPDigitizerAlgorithm::accumulateSimHits(), PSSDigitizerAlgorithm::accumulateSimHits(), and PixelDigitizerAlgorithm::accumulateSimHits().

316  {
317  LogDebug("Phase2TrackerDigitizerAlgorithm") << "enter drift ";
318 
319  collection_points.resize(ionization_points.size()); // set size
320  LocalVector driftDir = DriftDirection(pixdet, bfield, hit.detUnitId()); // get the charge drift direction
321  if (driftDir.z() == 0.) {
322  LogWarning("Phase2TrackerDigitizerAlgorithm") << " pxlx: drift in z is zero ";
323  return;
324  }
325 
326  float TanLorenzAngleX, TanLorenzAngleY, dir_z, CosLorenzAngleX, CosLorenzAngleY;
327  if (alpha2Order) {
328  TanLorenzAngleX = driftDir.x(); // tangen of Lorentz angle
329  TanLorenzAngleY = driftDir.y();
330  dir_z = driftDir.z(); // The z drift direction
331  CosLorenzAngleX = 1. / std::sqrt(1. + TanLorenzAngleX * TanLorenzAngleX); // cosine
332  CosLorenzAngleY = 1. / std::sqrt(1. + TanLorenzAngleY * TanLorenzAngleY); // cosine;
333  } else {
334  TanLorenzAngleX = driftDir.x();
335  TanLorenzAngleY = 0.; // force to 0, driftDir.y()/driftDir.z();
336  dir_z = driftDir.z(); // The z drift direction
337  CosLorenzAngleX = 1. / std::sqrt(1. + TanLorenzAngleX * TanLorenzAngleX); // cosine to estimate the path length
338  CosLorenzAngleY = 1.;
339  }
340 
341  float moduleThickness = pixdet->specificSurface().bounds().thickness();
342  float stripPitch = pixdet->specificTopology().pitch().first;
343 
344  LogDebug("Phase2TrackerDigitizerAlgorithm")
345  << " Lorentz Tan " << TanLorenzAngleX << " " << TanLorenzAngleY << " " << CosLorenzAngleX << " "
346  << CosLorenzAngleY << " " << moduleThickness * TanLorenzAngleX << " " << driftDir;
347 
348  float Sigma_x = 1.; // Charge spread
349  float Sigma_y = 1.;
350  float DriftDistance; // Distance between charge generation and collection
351  float DriftLength; // Actual Drift Lentgh
352  float Sigma;
353 
354  for (unsigned int i = 0; i != ionization_points.size(); ++i) {
355  float SegX, SegY, SegZ; // position
356  SegX = ionization_points[i].x();
357  SegY = ionization_points[i].y();
358  SegZ = ionization_points[i].z();
359 
360  // Distance from the collection plane
361  // DriftDistance = (moduleThickness/2. + SegZ); // Drift to -z
362  // Include explixitely the E drift direction (for CMS dir_z=-1)
363  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  DriftLength = std::sqrt(DriftDistance * DriftDistance + XDriftDueToMagField * XDriftDueToMagField +
380  YDriftDueToMagField * YDriftDueToMagField);
381 
382  // What is the charge diffusion after this path
383  // Sigma0=0.00037 is for 300um thickness (make sure moduleThickness is in [cm])
384  Sigma = std::sqrt(DriftLength / moduleThickness) * (Sigma0 * moduleThickness / 0.0300);
385  // D.B.: sigmaCoeff=0 means no modulation
386  if (SigmaCoeff)
387  Sigma *= (SigmaCoeff * cos(SegX * M_PI / stripPitch) * cos(SegX * M_PI / stripPitch) + 1);
388  // NB: divided by 4 to get a periodicity of stripPitch
389 
390  // Project the diffusion sigma on the collection plane
391  Sigma_x = Sigma / CosLorenzAngleX;
392  Sigma_y = Sigma / CosLorenzAngleY;
393 
394  // Insert a charge loss due to Rad Damage here
395  float energyOnCollector = ionization_points[i].energy(); // The energy that reaches the collector
396 
397  // pseudoRadDamage
398  if (pseudoRadDamage >= 0.001) {
399  float moduleRadius = pixdet->surface().position().perp();
400  if (moduleRadius <= pseudoRadDamageRadius) {
401  float kValue = pseudoRadDamage / (moduleRadius * moduleRadius);
402  energyOnCollector = energyOnCollector * exp(-1 * kValue * DriftDistance / moduleThickness);
403  }
404  }
405  LogDebug("Phase2TrackerDigitizerAlgorithm")
406  << "Dift DistanceZ = " << DriftDistance << " module thickness = " << moduleThickness
407  << " Start Energy = " << ionization_points[i].energy() << " Energy after loss= " << energyOnCollector;
408  DigitizerUtility::SignalPoint sp(CloudCenterX, CloudCenterY, Sigma_x, Sigma_y, hit.tof(), energyOnCollector);
409  // Load the Charge distribution parameters
410  collection_points[i] = sp;
411  }
412 }
#define LogDebug(id)
LocalVector DriftDirection(const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield, const DetId &detId) const
float tof() const
deprecated name for timeOfFlight()
Definition: PSimHit.h:76
T perp() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:60
const Bounds & bounds() const
Definition: Surface.h:89
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
virtual std::pair< float, float > pitch() const =0
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define M_PI
virtual float thickness() const =0
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
T x() const
Definition: PV3DBase.h:59
const PositionType & position() const
unsigned int detUnitId() const
Definition: PSimHit.h:97
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40
LocalVector Phase2TrackerDigitizerAlgorithm::DriftDirection ( const Phase2TrackerGeomDetUnit pixdet,
const GlobalVector bfield,
const DetId detId 
) const
protected

Definition at line 759 of file Phase2TrackerDigitizerAlgorithm.cc.

References alpha2Order, GeomDet::geographicalId(), SiPixelLorentzAngle::getLorentzAngle(), LogDebug, PixelSubdetector::PixelBarrel, GloballyPositioned< T >::position(), DetId::rawId(), GloballyPositioned< T >::rotation(), Scenarios_cff::scale, SiPixelLorentzAngle_, DetId::subdetId(), GeomDet::surface(), tanLorentzAnglePerTesla_Barrel, tanLorentzAnglePerTesla_Endcap, StripSubdetector::TOB, and use_LorentzAngle_DB_.

Referenced by drift().

761  {
762  Frame detFrame(pixdet->surface().position(), pixdet->surface().rotation());
763  LocalVector Bfield = detFrame.toLocal(bfield);
764  float alpha2_Endcap;
765  float alpha2_Barrel;
766  float alpha2;
767 
768  float dir_x = 0.0;
769  float dir_y = 0.0;
770  float dir_z = 0.0;
771  float scale = 0.0;
772 
773  uint32_t detID = pixdet->geographicalId().rawId();
774  unsigned int Sub_detid = DetId(detID).subdetId();
775 
776  // Read Lorentz angle from cfg file:
777  if (!use_LorentzAngle_DB_) {
778  if (alpha2Order) {
781  } else {
782  alpha2_Endcap = 0.0;
783  alpha2_Barrel = 0.0;
784  }
785 
786  if (Sub_detid == PixelSubdetector::PixelBarrel || Sub_detid == StripSubdetector::TOB) { // barrel layers
787  dir_x = -(tanLorentzAnglePerTesla_Barrel * Bfield.y() + alpha2_Barrel * Bfield.z() * Bfield.x());
788  dir_y = +(tanLorentzAnglePerTesla_Barrel * Bfield.x() - alpha2_Barrel * Bfield.z() * Bfield.y());
789  dir_z = -(1 + alpha2_Barrel * Bfield.z() * Bfield.z());
790  scale = (1 + alpha2_Barrel * Bfield.z() * Bfield.z());
791 
792  } else { // forward disks
793  dir_x = -(tanLorentzAnglePerTesla_Endcap * Bfield.y() + alpha2_Endcap * Bfield.z() * Bfield.x());
794  dir_y = +(tanLorentzAnglePerTesla_Endcap * Bfield.x() - alpha2_Endcap * Bfield.z() * Bfield.y());
795  dir_z = -(1 + alpha2_Endcap * Bfield.z() * Bfield.z());
796  scale = (1 + alpha2_Endcap * Bfield.z() * Bfield.z());
797  }
798  }
799 
800  // Read Lorentz angle from DB:
801  if (use_LorentzAngle_DB_) {
802  float lorentzAngle = SiPixelLorentzAngle_->getLorentzAngle(detId);
803  alpha2 = lorentzAngle * lorentzAngle;
804 
805  dir_x = -(lorentzAngle * Bfield.y() + alpha2 * Bfield.z() * Bfield.x());
806  dir_y = +(lorentzAngle * Bfield.x() - alpha2 * Bfield.z() * Bfield.y());
807  dir_z = -(1 + alpha2 * Bfield.z() * Bfield.z());
808  scale = (1 + alpha2 * Bfield.z() * Bfield.z());
809  }
810 
811  LocalVector theDriftDirection = LocalVector(dir_x / scale, dir_y / scale, dir_z / scale);
812 
813  LogDebug("Phase2TrackerDigitizerAlgorithm") << " The drift direction in local coordinate is " << theDriftDirection;
814  return theDriftDirection;
815 }
#define LogDebug(id)
Local3DVector LocalVector
Definition: LocalVector.h:12
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
edm::ESHandle< SiPixelLorentzAngle > SiPixelLorentzAngle_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
static constexpr auto TOB
Definition: DetId.h:17
float getLorentzAngle(const uint32_t &) const
const RotationType & rotation() const
const PositionType & position() const
void Phase2TrackerDigitizerAlgorithm::fluctuateEloss ( int  particleId,
float  momentum,
float  eloss,
float  length,
int  NumberOfSegments,
std::vector< float > &  elossVector 
) const
protected

Definition at line 247 of file Phase2TrackerDigitizerAlgorithm.cc.

References funct::abs(), fluctuate, mps_fire::i, cuy::ii, particleFlowDisplacedVertex_cfi::ratio, rengine_, and tMax.

Referenced by primary_ionization().

252  {
253  // Get dedx for this track
254  //float dedx;
255  //if( length > 0.) dedx = eloss/length;
256  //else dedx = eloss;
257 
258  double particleMass = 139.6; // Mass in MeV, Assume pion
259  pid = std::abs(pid);
260  if (pid != 211) { // Mass in MeV
261  if (pid == 11)
262  particleMass = 0.511;
263  else if (pid == 13)
264  particleMass = 105.7;
265  else if (pid == 321)
266  particleMass = 493.7;
267  else if (pid == 2212)
268  particleMass = 938.3;
269  }
270  // What is the track segment length.
271  float segmentLength = length / NumberOfSegs;
272 
273  // Generate charge fluctuations.
274  float de = 0.;
275  float sum = 0.;
276  double segmentEloss = (1000. * eloss) / NumberOfSegs; //eloss in MeV
277  for (int i = 0; i < NumberOfSegs; ++i) {
278  // material,*, momentum,energy,*, *, mass
279  //myglandz_(14.,segmentLength,2.,2.,dedx,de,0.14);
280  // The G4 routine needs momentum in MeV, mass in Mev, delta-cut in MeV,
281  // track segment length in mm, segment eloss in MeV
282  // Returns fluctuated eloss in MeV
283  double deltaCutoff = tMax; // the cutoff is sometimes redefined inside, so fix it.
284  de = fluctuate->SampleFluctuations(static_cast<double>(particleMomentum * 1000.),
285  particleMass,
286  deltaCutoff,
287  static_cast<double>(segmentLength * 10.),
288  segmentEloss,
289  rengine_) /
290  1000.; //convert to GeV
291  elossVector.push_back(de);
292  sum += de;
293  }
294  if (sum > 0.) { // If fluctuations give eloss>0.
295  // Rescale to the same total eloss
296  float ratio = eloss / sum;
297  for (int ii = 0; ii < NumberOfSegs; ++ii)
298  elossVector[ii] = ratio * elossVector[ii];
299  } else { // If fluctuations gives 0 eloss
300  float averageEloss = eloss / NumberOfSegs;
301  for (int ii = 0; ii < NumberOfSegs; ++ii)
302  elossVector[ii] = averageEloss;
303  }
304 }
const std::unique_ptr< SiG4UniversalFluctuation > fluctuate
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ii
Definition: cuy.py:590
void Phase2TrackerDigitizerAlgorithm::induce_signal ( const PSimHit hit,
const size_t  hitIndex,
const unsigned int  tofBin,
const Phase2TrackerGeomDetUnit pixdet,
const std::vector< DigitizerUtility::SignalPoint > &  collection_points 
)
protected

Definition at line 417 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, LaserClient_cfi::Amplitude, calcQ(), officialStyle::chan, Topology::channel(), ClusterWidth, GeomDet::geographicalId(), createfilelist::int, Topology::localPosition(), LogDebug, makeDigiSimLinks_, Topology::measurementPosition(), PixelTopology::ncolumns(), PixelTopology::nrows(), PixelTopology::pitch(), pixelFlag, Phase2TrackerDigi::pixelToChannel(), PixelDigi::pixelToChannel(), DetId::rawId(), VtxSmearedParameters_cfi::SigmaX, VtxSmearedParameters_cfi::SigmaY, PixelGeomDetUnit::specificTopology(), 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 SSDigitizerAlgorithm::accumulateSimHits(), PSPDigitizerAlgorithm::accumulateSimHits(), PSSDigitizerAlgorithm::accumulateSimHits(), and PixelDigitizerAlgorithm::accumulateSimHits().

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

Definition at line 736 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.

736  {
738  gaussDistribution_ = std::make_unique<CLHEP::RandGaussQ>(eng, 0., theReadoutNoise);
739  }
740  // Threshold smearing with gaussian distribution:
741  if (addThresholdSmearing) {
743  std::make_unique<CLHEP::RandGaussQ>(eng, theThresholdInE_Endcap, theThresholdSmearing_Endcap);
745  std::make_unique<CLHEP::RandGaussQ>(eng, theThresholdInE_Barrel, theThresholdSmearing_Barrel);
746  }
747  rengine_ = (&eng);
748  _signal.clear();
749 }
std::unique_ptr< CLHEP::RandGaussQ > gaussDistribution_
std::unique_ptr< CLHEP::RandGaussQ > smearedThreshold_Endcap_
std::unique_ptr< CLHEP::RandGaussQ > smearedThreshold_Barrel_
void Phase2TrackerDigitizerAlgorithm::loadAccumulator ( unsigned int  detId,
const std::map< int, float > &  accumulator 
)

Definition at line 936 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, HTMLExport::elem(), and Exception.

936  {
937  auto& theSignal = _signal[detId];
938  // the input channel is always with PixelDigi definition
939  // if needed, that has to be converted to Phase2TrackerDigi convention
940  for (const auto& elem : accumulator) {
941  auto inserted = theSignal.emplace(elem.first, DigitizerUtility::Amplitude(elem.second, nullptr));
942  if (!inserted.second) {
943  throw cms::Exception("LogicError") << "Signal was already set for DetId " << detId;
944  }
945  }
946 }
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19
void Phase2TrackerDigitizerAlgorithm::module_killing_conf ( uint32_t  detID)
protectedvirtual

Definition at line 840 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, Phase2TrackerDigi::channelToPixel(), PixelDigi::channelToPixel(), DeadModules, Module, pixelFlag, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by digitize().

840  {
841  bool isbad = false;
842  int detid = detID;
844  for (auto const& det_m : DeadModules) {
845  int Dead_detID = det_m.getParameter<int>("Dead_detID");
846  Module = det_m.getParameter<std::string>("Module");
847  if (detid == Dead_detID) {
848  isbad = true;
849  break;
850  }
851  }
852 
853  if (!isbad)
854  return;
855 
856  signal_map_type& theSignal = _signal[detID]; // check validity
857 
858  for (auto& s : theSignal) {
859  std::pair<int, int> ip;
860  if (pixelFlag)
861  ip = PixelDigi::channelToPixel(s.first);
862  else
863  ip = Phase2TrackerDigi::channelToPixel(s.first); //get pixel pos
864 
865  if (Module == "whole")
866  s.second.set(0.); // reset amplitude
867  else if (Module == "tbmA" && ip.first >= 80 && ip.first <= 159)
868  s.second.set(0.);
869  else if (Module == "tbmB" && ip.first <= 79)
870  s.second.set(0.);
871  }
872 }
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:65
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
#define Module(md)
Definition: vmac.h:203
static std::pair< unsigned int, unsigned int > channelToPixel(unsigned int ch)
void Phase2TrackerDigitizerAlgorithm::module_killing_DB ( uint32_t  detID)
protectedvirtual

Definition at line 874 of file Phase2TrackerDigitizerAlgorithm.cc.

References _signal, funct::abs(), badPixels, Phase2TrackerDigi::channelToPixel(), PixelDigi::channelToPixel(), SiPixelQuality::disabledModuleType::errorType, SiPixelFedCablingMap::findItem(), SiPixelQuality::getBadComponentList(), triggerObjects_cff::id, sipixelobjects::PixelROC::idInDetUnit(), SiPixelQuality::IsRocBad(), dqmiolumiharvest::j, dqmdumpme::k, DTRecHitClients_cfi::local, map_, AlCaHLTBitMon_ParallelJobs::p, castor_dqm_sourceclient_file_cfg::path, SiPixelFedCablingMap::pathToDetUnit(), pixelFlag, edm::ESHandle< T >::product(), alignCSCRings::s, SiPixelBadModule_, and sipixelobjects::PixelROC::toGlobal().

Referenced by digitize().

874  {
875  bool isbad = false;
876 
877  std::vector<SiPixelQuality::disabledModuleType> disabledModules = SiPixelBadModule_->getBadComponentList();
878 
880  for (size_t id = 0; id < disabledModules.size(); id++) {
881  if (detID == disabledModules[id].DetID) {
882  isbad = true;
883  badmodule = disabledModules[id];
884  break;
885  }
886  }
887 
888  if (!isbad)
889  return;
890 
891  signal_map_type& theSignal = _signal[detID]; // check validity
892 
893  if (badmodule.errorType == 0) { // this is a whole dead module.
894  for (auto& s : theSignal) {
895  s.second.set(0.); // reset amplitude
896  }
897  } else { // all other module types: half-modules and single ROCs.
898  // Get Bad ROC position:
899  // follow the example of getBadRocPositions in CondFormats/SiPixelObjects/src/SiPixelQuality.cc
900  std::vector<GlobalPixel> badrocpositions(0);
901  for (unsigned int j = 0; j < 16; j++) {
902  if (SiPixelBadModule_->IsRocBad(detID, j) == true) {
903  std::vector<CablingPathToDetUnit> path = map_.product()->pathToDetUnit(detID);
904  for (auto const& p : path) {
905  const PixelROC* myroc = map_.product()->findItem(p);
906  if (myroc->idInDetUnit() == j) {
907  LocalPixel::RocRowCol local = {39, 25}; //corresponding to center of ROC row, col
908  GlobalPixel global = myroc->toGlobal(LocalPixel(local));
909  badrocpositions.push_back(global);
910  break;
911  }
912  }
913  }
914  }
915 
916  for (auto& s : theSignal) {
917  std::pair<int, int> ip;
918  if (pixelFlag)
919  ip = PixelDigi::channelToPixel(s.first);
920  else
922 
923  for (auto const& p : badrocpositions) {
924  for (auto& k : badPixels) {
925  if (p.row == k.getParameter<int>("row") && ip.first == k.getParameter<int>("row") &&
926  std::abs(ip.second - p.col) < k.getParameter<int>("col")) {
927  s.second.set(0.);
928  }
929  }
930  }
931  }
932  }
933 }
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:65
edm::ESHandle< SiPixelFedCablingMap > map_
bool IsRocBad(const uint32_t &detid, const short &rocNb) const
identify pixel inside single ROC
Definition: LocalPixel.h:7
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
std::vector< edm::ParameterSet > badPixels
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:37
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const std::vector< disabledModuleType > getBadComponentList() const
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
row and collumn in ROC representation
Definition: LocalPixel.h:13
const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &path) const final
std::vector< sipixelobjects::CablingPathToDetUnit > pathToDetUnit(uint32_t rawDetId) const final
static std::pair< unsigned int, unsigned int > channelToPixel(unsigned int ch)
T const * product() const
Definition: ESHandle.h:86
GlobalPixel toGlobal(const LocalPixel &loc) const
Definition: PixelROC.h:55
edm::ESHandle< SiPixelQuality > SiPixelBadModule_
void Phase2TrackerDigitizerAlgorithm::pixel_inefficiency ( const SubdetEfficiencies eff,
const Phase2TrackerGeomDetUnit pixdet,
const TrackerTopology tTopo 
)
protectedvirtual

Definition at line 702 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(), rand(), DetId::rawId(), rengine_, alignCSCRings::s, DetId::subdetId(), and StripSubdetector::TOB.

Referenced by digitize().

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

Definition at line 819 of file Phase2TrackerDigitizerAlgorithm.cc.

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

Referenced by digitize().

819  {
820  signal_map_type& theSignal = _signal[detID]; // check validity
821 
822  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
823  for (auto& s : theSignal) {
824  std::pair<int, int> ip;
825  if (pixelFlag)
826  ip = PixelDigi::channelToPixel(s.first); //get pixel pos
827  else
828  ip = Phase2TrackerDigi::channelToPixel(s.first); //get pixel pos
829  int row = ip.first; // X in row
830  int col = ip.second; // Y is in col
831  //transform to ROC index coordinates
832  if (theSiPixelGainCalibrationService_->isDead(detID, col, row)) {
833  s.second.set(0.); // reset amplitude,
834  }
835  }
836 }
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:65
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:1010
void Phase2TrackerDigitizerAlgorithm::primary_ionization ( const PSimHit hit,
std::vector< DigitizerUtility::EnergyDepositUnit > &  ionization_points 
) const
protected

Definition at line 193 of file Phase2TrackerDigitizerAlgorithm.cc.

References simKBmtfDigis_cfi::eLoss, HCALHighEnergyHPDFilter_cfi::energy, PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::exitPoint(), dqmMemoryStats::float, fluctuateCharge, fluctuateEloss(), GeVperElectron, mps_fire::i, createfilelist::int, LogDebug, PV3DBase< T, PVType, FrameType >::mag(), PSimHit::pabs(), PSimHit::particleType(), point, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by SSDigitizerAlgorithm::accumulateSimHits(), PSPDigitizerAlgorithm::accumulateSimHits(), PSSDigitizerAlgorithm::accumulateSimHits(), and PixelDigitizerAlgorithm::accumulateSimHits().

194  {
195  // Straight line approximation for trajectory inside active media
196  const float SegmentLength = 0.0010; // in cm (10 microns)
197  float energy;
198 
199  // Get the 3D segment direction vector
200  LocalVector direction = hit.exitPoint() - hit.entryPoint();
201 
202  float eLoss = hit.energyLoss(); // Eloss in GeV
203  float length = direction.mag(); // Track length in Silicon
204 
205  int NumberOfSegments = int(length / SegmentLength); // Number of segments
206  if (NumberOfSegments < 1)
207  NumberOfSegments = 1;
208  LogDebug("Phase2TrackerDigitizerAlgorithm")
209  << "enter primary_ionzation " << NumberOfSegments << " shift = " << hit.exitPoint().x() - hit.entryPoint().x()
210  << " " << hit.exitPoint().y() - hit.entryPoint().y() << " " << hit.exitPoint().z() - hit.entryPoint().z() << " "
211  << hit.particleType() << " " << hit.pabs();
212 
213  std::vector<float> elossVector; // Eloss vector
214  elossVector.reserve(NumberOfSegments);
215  if (fluctuateCharge) {
216  int pid = hit.particleType();
217  // int pid=211; // assume it is a pion
218 
219  float momentum = hit.pabs();
220  // Generate fluctuated charge points
221  fluctuateEloss(pid, momentum, eLoss, length, NumberOfSegments, elossVector);
222  }
223  ionization_points.reserve(NumberOfSegments); // set size
224 
225  // loop over segments
226  for (int i = 0; i != NumberOfSegments; ++i) {
227  // Divide the segment into equal length subsegments
228  Local3DPoint point = hit.entryPoint() + float((i + 0.5) / NumberOfSegments) * direction;
229  if (fluctuateCharge)
230  energy = elossVector[i] / GeVperElectron; // Convert charge to elec.
231  else
232  energy = hit.energyLoss() / GeVperElectron / float(NumberOfSegments);
233 
234  DigitizerUtility::EnergyDepositUnit edu(energy, point); // define position,energy point
235  ionization_points.push_back(edu); // save
236  LogDebug("Phase2TrackerDigitizerAlgorithm")
237  << i << " " << ionization_points[i].x() << " " << ionization_points[i].y() << " " << ionization_points[i].z()
238  << " " << ionization_points[i].energy();
239  }
240 }
#define LogDebug(id)
T y() const
Definition: PV3DBase.h:60
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:46
T mag() const
Definition: PV3DBase.h:64
T z() const
Definition: PV3DBase.h:61
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:67
void fluctuateEloss(int particleId, float momentum, float eloss, float length, int NumberOfSegments, std::vector< float > &elossVector) const
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:79
int particleType() const
Definition: PSimHit.h:89
T x() const
Definition: PV3DBase.h:59
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
*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

Member Data Documentation

signalMaps Phase2TrackerDigitizerAlgorithm::_signal
protected
const bool Phase2TrackerDigitizerAlgorithm::addNoise
protected

Definition at line 142 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize(), and initializeEvent().

const bool Phase2TrackerDigitizerAlgorithm::addNoisyPixels
protected

Definition at line 143 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

const bool Phase2TrackerDigitizerAlgorithm::AddPixelInefficiency
protected
const bool Phase2TrackerDigitizerAlgorithm::addThresholdSmearing
protected

Definition at line 149 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize(), and initializeEvent().

const bool Phase2TrackerDigitizerAlgorithm::addXtalk
protected

Definition at line 111 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

const bool Phase2TrackerDigitizerAlgorithm::alpha2Order
protected

Definition at line 110 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by drift(), and DriftDirection().

std::vector<edm::ParameterSet> Phase2TrackerDigitizerAlgorithm::badPixels
protected

Definition at line 163 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by module_killing_DB().

const float Phase2TrackerDigitizerAlgorithm::ClusterWidth
protected

Definition at line 117 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by induce_signal().

const Parameters Phase2TrackerDigitizerAlgorithm::DeadModules
protected

Definition at line 102 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by module_killing_conf().

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

Definition at line 166 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by fluctuateEloss().

const bool Phase2TrackerDigitizerAlgorithm::fluctuateCharge
protected

Definition at line 144 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by initializeEvent(), and primary_ionization().

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

Definition at line 211 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by add_noise(), and initializeEvent().

edm::ESHandle<TrackerGeometry> Phase2TrackerDigitizerAlgorithm::geom_
protected

Definition at line 76 of file Phase2TrackerDigitizerAlgorithm.h.

const float Phase2TrackerDigitizerAlgorithm::GeVperElectron
protected

Definition at line 107 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by primary_ionization().

const float Phase2TrackerDigitizerAlgorithm::interstripCoupling
protected

Definition at line 112 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by add_cross_talk().

const bool Phase2TrackerDigitizerAlgorithm::makeDigiSimLinks_
protected

Definition at line 95 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize(), and induce_signal().

edm::ESHandle<SiPixelFedCablingMap> Phase2TrackerDigitizerAlgorithm::map_
protected

Definition at line 75 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by module_killing_DB().

bool Phase2TrackerDigitizerAlgorithm::pixelFlag
protected
const double Phase2TrackerDigitizerAlgorithm::pseudoRadDamage
protected

Definition at line 152 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by drift().

const double Phase2TrackerDigitizerAlgorithm::pseudoRadDamageRadius
protected

Definition at line 153 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by drift().

CLHEP::HepRandomEngine* Phase2TrackerDigitizerAlgorithm::rengine_
protected
const float Phase2TrackerDigitizerAlgorithm::Sigma0
protected

Definition at line 113 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by drift().

const float Phase2TrackerDigitizerAlgorithm::SigmaCoeff
protected

Definition at line 114 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by drift().

edm::ESHandle<SiPixelQuality> Phase2TrackerDigitizerAlgorithm::SiPixelBadModule_
protected

Definition at line 72 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by module_killing_DB().

edm::ESHandle<SiPixelLorentzAngle> Phase2TrackerDigitizerAlgorithm::SiPixelLorentzAngle_
protected

Definition at line 69 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by DriftDirection().

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

Definition at line 215 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize(), and initializeEvent().

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

Definition at line 214 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize(), and initializeEvent().

const SubdetEfficiencies Phase2TrackerDigitizerAlgorithm::subdetEfficiencies_
protected

Definition at line 208 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

const float Phase2TrackerDigitizerAlgorithm::tanLorentzAnglePerTesla_Barrel
protected

Definition at line 139 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by DriftDirection().

const float Phase2TrackerDigitizerAlgorithm::tanLorentzAnglePerTesla_Endcap
protected

Definition at line 138 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by DriftDirection().

const int Phase2TrackerDigitizerAlgorithm::theAdcFullScale
protected
const float Phase2TrackerDigitizerAlgorithm::theElectronPerADC
protected
const double Phase2TrackerDigitizerAlgorithm::theHIPThresholdInE_Barrel
protected

Definition at line 134 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

const double Phase2TrackerDigitizerAlgorithm::theHIPThresholdInE_Endcap
protected

Definition at line 133 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

const float Phase2TrackerDigitizerAlgorithm::theNoiseInElectrons
protected

Definition at line 123 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by add_noisy_cells().

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

Definition at line 167 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by add_noisy_cells().

const int Phase2TrackerDigitizerAlgorithm::thePhase2ReadoutMode
protected

Definition at line 120 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by convertSignalToAdc().

const float Phase2TrackerDigitizerAlgorithm::theReadoutNoise
protected

Definition at line 124 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by initializeEvent().

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

Definition at line 199 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by pixel_inefficiency_db().

const float Phase2TrackerDigitizerAlgorithm::theThresholdInE_Barrel
protected
const float Phase2TrackerDigitizerAlgorithm::theThresholdInE_Endcap
protected
const double Phase2TrackerDigitizerAlgorithm::theThresholdSmearing_Barrel
protected

Definition at line 131 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by initializeEvent().

const double Phase2TrackerDigitizerAlgorithm::theThresholdSmearing_Endcap
protected

Definition at line 130 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by initializeEvent().

const float Phase2TrackerDigitizerAlgorithm::theTofLowerCut
protected
const float Phase2TrackerDigitizerAlgorithm::theTofUpperCut
protected
const double Phase2TrackerDigitizerAlgorithm::tMax
protected
const bool Phase2TrackerDigitizerAlgorithm::use_deadmodule_DB_
protected

Definition at line 99 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

const bool Phase2TrackerDigitizerAlgorithm::use_ineff_from_db_
protected

Definition at line 97 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().

const bool Phase2TrackerDigitizerAlgorithm::use_LorentzAngle_DB_
protected

Definition at line 100 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by DriftDirection().

const bool Phase2TrackerDigitizerAlgorithm::use_module_killing_
protected

Definition at line 98 of file Phase2TrackerDigitizerAlgorithm.h.

Referenced by digitize().