CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
SiPixelDigitizerAlgorithm Class Reference

#include <SiPixelDigitizerAlgorithm.h>

Classes

class  Amplitude
 
class  CalParameters
 
class  EnergyDepositUnit
 
struct  PixelAging
 
struct  PixelEfficiencies
 
class  SignalPoint
 

Public Member Functions

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 PixelGeomDetUnit *pixdet, const GlobalVector &bfield, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
 
void calculateInstlumiFactor (PileupMixingContent *puInfo)
 
void digitize (const PixelGeomDetUnit *pixdet, std::vector< PixelDigi > &digis, std::vector< PixelDigiSimLink > &simlinks, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
 
void init (const edm::EventSetup &es)
 
void init_DynIneffDB (const edm::EventSetup &, const unsigned int &)
 
void initializeEvent ()
 
 SiPixelDigitizerAlgorithm (const edm::ParameterSet &conf)
 
 ~SiPixelDigitizerAlgorithm ()
 

Private Types

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

Private Member Functions

void add_noise (const PixelGeomDetUnit *pixdet, float thePixelThreshold, CLHEP::HepRandomEngine *)
 
double calcQ (float x) const
 
void drift (const PSimHit &hit, const PixelGeomDetUnit *pixdet, const GlobalVector &bfield, const TrackerTopology *tTopo, const std::vector< EnergyDepositUnit > &ionization_points, std::vector< SignalPoint > &collection_points) const
 
LocalVector DriftDirection (const PixelGeomDetUnit *pixdet, const GlobalVector &bfield, const DetId &detId) const
 
void fluctuateEloss (int particleId, float momentum, float eloss, float length, int NumberOfSegments, float elossVector[], CLHEP::HepRandomEngine *) const
 
void induce_signal (const PSimHit &hit, const size_t hitIndex, const unsigned int tofBin, const PixelGeomDetUnit *pixdet, const std::vector< SignalPoint > &collection_points)
 
std::map< int, CalParameters,
std::less< int > > 
initCal () const
 
void make_digis (float thePixelThresholdInE, uint32_t detID, const PixelGeomDetUnit *pixdet, std::vector< PixelDigi > &digis, std::vector< PixelDigiSimLink > &simlinks, const TrackerTopology *tTopo) const
 
float missCalibrate (uint32_t detID, const PixelGeomDetUnit *pixdet, int col, int row, float amp) const
 
void module_killing_conf (uint32_t detID)
 
void module_killing_DB (uint32_t detID)
 
float pixel_aging (const PixelAging &aging, const PixelGeomDetUnit *pixdet, const TrackerTopology *tTopo) const
 
void pixel_inefficiency (const PixelEfficiencies &eff, const PixelGeomDetUnit *pixdet, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
 
void pixel_inefficiency_db (uint32_t detID)
 
void primary_ionization (const PSimHit &hit, std::vector< EnergyDepositUnit > &ionization_points, CLHEP::HepRandomEngine *) const
 

Private Attributes

signalMaps _signal
 
const bool addChargeVCALSmearing
 
const bool addNoise
 
const bool addNoisyPixels
 
const bool AddPixelAging
 
const bool AddPixelInefficiency
 
const bool addThresholdSmearing
 
const bool alpha2Order
 
const float BPix_p0
 
const float BPix_p1
 
const float BPix_p2
 
const float BPix_p3
 
const std::map< int,
CalParameters, std::less< int > > 
calmap
 
const float ClusterWidth
 
const Parameters DeadModules
 
const float Dist300
 
const bool doMissCalibrate
 
const double electronsPerVCAL
 
const double electronsPerVCAL_Offset
 
const std::unique_ptr
< SiG4UniversalFluctuation
fluctuate
 
const bool fluctuateCharge
 
const float FPix_p0
 
const float FPix_p1
 
const float FPix_p2
 
const float FPix_p3
 
edm::ESHandle< TrackerGeometrygeom_
 
const float GeVperElectron
 
const bool makeDigiSimLinks_
 
edm::ESHandle
< SiPixelFedCablingMap
map_
 
const int NumberOfBarrelLayers
 
const int NumberOfEndcapDisks
 
const PixelAging pixelAging_
 
PixelEfficiencies pixelEfficiencies_
 
const float Sigma0
 
edm::ESHandle< SiPixelQualitySiPixelBadModule_
 
edm::ESHandle
< SiPixelDynamicInefficiency
SiPixelDynamicInefficiency_
 
edm::ESHandle
< SiPixelLorentzAngle
SiPixelLorentzAngle_
 
const float tanLorentzAnglePerTesla_BPix
 
const float tanLorentzAnglePerTesla_FPix
 
const int theAdcFullScale
 
const int theAdcFullScaleStack
 
const float theElectronPerADC
 
const float theGainSmearing
 
const float theNoiseInElectrons
 
const std::unique_ptr
< GaussianTailNoiseGenerator
theNoiser
 
const float theOffsetSmearing
 
const float theReadoutNoise
 
const std::unique_ptr
< SiPixelGainCalibrationOfflineSimService
theSiPixelGainCalibrationService_
 
const float theThresholdInE_BPix
 
const float theThresholdInE_BPix_L1
 
const float theThresholdInE_FPix
 
const double theThresholdSmearing_BPix
 
const double theThresholdSmearing_BPix_L1
 
const double theThresholdSmearing_FPix
 
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 44 of file SiPixelDigitizerAlgorithm.h.

Member Typedef Documentation

Definition at line 293 of file SiPixelDigitizerAlgorithm.h.

Definition at line 294 of file SiPixelDigitizerAlgorithm.h.

typedef signal_map_type::const_iterator SiPixelDigitizerAlgorithm::signal_map_const_iterator
private

Definition at line 290 of file SiPixelDigitizerAlgorithm.h.

typedef signal_map_type::iterator SiPixelDigitizerAlgorithm::signal_map_iterator
private

Definition at line 289 of file SiPixelDigitizerAlgorithm.h.

typedef std::map<int, Amplitude, std::less<int> > SiPixelDigitizerAlgorithm::signal_map_type
private

Definition at line 288 of file SiPixelDigitizerAlgorithm.h.

typedef std::map<uint32_t, signal_map_type> SiPixelDigitizerAlgorithm::signalMaps
private

Definition at line 292 of file SiPixelDigitizerAlgorithm.h.

typedef std::map<unsigned int, std::vector<float>,std::less<unsigned int> > SiPixelDigitizerAlgorithm::simlink_map
private

Definition at line 291 of file SiPixelDigitizerAlgorithm.h.

Constructor & Destructor Documentation

SiPixelDigitizerAlgorithm::SiPixelDigitizerAlgorithm ( const edm::ParameterSet conf)

Definition at line 126 of file SiPixelDigitizerAlgorithm.cc.

References AddPixelInefficiency, theAdcFullScale, theElectronPerADC, theThresholdInE_BPix, theThresholdInE_BPix_L1, theThresholdInE_FPix, and tMax.

126  :
127 
128  _signal(),
129  makeDigiSimLinks_(conf.getUntrackedParameter<bool>("makeDigiSimLinks", true)),
130  use_ineff_from_db_(conf.getParameter<bool>("useDB")),
131  use_module_killing_(conf.getParameter<bool>("killModules")), // boolean to kill or not modules
132  use_deadmodule_DB_(conf.getParameter<bool>("DeadModules_DB")), // boolean to access dead modules from DB
133  use_LorentzAngle_DB_(conf.getParameter<bool>("LorentzAngle_DB")), // boolean to access Lorentz angle from DB
134 
135  DeadModules(use_deadmodule_DB_ ? Parameters() : conf.getParameter<Parameters>("DeadModules")), // get dead module from cfg file
136 
137  // Common pixel parameters
138  // These are parameters which are not likely to be changed
139  GeVperElectron(3.61E-09), // 1 electron(3.61eV, 1keV(277e, mod 9/06 d.k.
140  Sigma0(0.00037), // Charge diffusion constant 7->3.7
141  Dist300(0.0300), // normalized to 300micron Silicon
142  alpha2Order(conf.getParameter<bool>("Alpha2Order")), // switch on/off of E.B effect
143  ClusterWidth(3.), // Charge integration spread on the collection plane
144 
145  // get external parameters:
146  // To account for upgrade geometries do not assume the number
147  // of layers or disks.
148  NumberOfBarrelLayers(conf.exists("NumPixelBarrel")?conf.getParameter<int>("NumPixelBarrel"):3),
149  NumberOfEndcapDisks(conf.exists("NumPixelEndcap")?conf.getParameter<int>("NumPixelEndcap"):2),
150 
151  // ADC calibration 1adc count(135e.
152  // Corresponds to 2adc/kev, 270[e/kev]/135[e/adc](2[adc/kev]
153  // Be carefull, this parameter is also used in SiPixelDet.cc to
154  // calculate the noise in adc counts from noise in electrons.
155  // Both defaults should be the same.
156  theElectronPerADC(conf.getParameter<double>("ElectronPerAdc")),
157 
158  // ADC saturation value, 255(8bit adc.
159  //theAdcFullScale(conf.getUntrackedParameter<int>("AdcFullScale",255)),
160  theAdcFullScale(conf.getParameter<int>("AdcFullScale")),
161  theAdcFullScaleStack(conf.exists("AdcFullScaleStack")?conf.getParameter<int>("AdcFullScaleStack"):255),
162 
163  // Noise in electrons:
164  // Pixel cell noise, relevant for generating noisy pixels
165  theNoiseInElectrons(conf.getParameter<double>("NoiseInElectrons")),
166 
167  // Fill readout noise, including all readout chain, relevant for smearing
168  //theReadoutNoise(conf.getUntrackedParameter<double>("ReadoutNoiseInElec",500.)),
169  theReadoutNoise(conf.getParameter<double>("ReadoutNoiseInElec")),
170 
171  // Pixel threshold in units of noise:
172  // thePixelThreshold(conf.getParameter<double>("ThresholdInNoiseUnits")),
173  // Pixel threshold in electron units.
174  theThresholdInE_FPix(conf.getParameter<double>("ThresholdInElectrons_FPix")),
175  theThresholdInE_BPix(conf.getParameter<double>("ThresholdInElectrons_BPix")),
176  theThresholdInE_BPix_L1(conf.exists("ThresholdInElectrons_BPix_L1")?conf.getParameter<double>("ThresholdInElectrons_BPix_L1"):theThresholdInE_BPix),
177 
178  // Add threshold gaussian smearing:
179  theThresholdSmearing_FPix(conf.getParameter<double>("ThresholdSmearing_FPix")),
180  theThresholdSmearing_BPix(conf.getParameter<double>("ThresholdSmearing_BPix")),
181  theThresholdSmearing_BPix_L1(conf.exists("ThresholdSmearing_BPix_L1")?conf.getParameter<double>("ThresholdSmearing_BPix_L1"):theThresholdSmearing_BPix),
182 
183  // electrons to VCAL conversion needed in misscalibrate()
184  electronsPerVCAL(conf.getParameter<double>("ElectronsPerVcal")),
185  electronsPerVCAL_Offset(conf.getParameter<double>("ElectronsPerVcal_Offset")),
186 
187  //theTofCut 12.5, cut in particle TOD +/- 12.5ns
188  //theTofCut(conf.getUntrackedParameter<double>("TofCut",12.5)),
189  theTofLowerCut(conf.getParameter<double>("TofLowerCut")),
190  theTofUpperCut(conf.getParameter<double>("TofUpperCut")),
191 
192  // Get the Lorentz angle from the cfg file:
193  tanLorentzAnglePerTesla_FPix(use_LorentzAngle_DB_ ? 0.0 : conf.getParameter<double>("TanLorentzAnglePerTesla_FPix")),
194  tanLorentzAnglePerTesla_BPix(use_LorentzAngle_DB_ ? 0.0 : conf.getParameter<double>("TanLorentzAnglePerTesla_BPix")),
195 
196  // signal response new parameterization: split Fpix and BPix
197  FPix_p0(conf.getParameter<double>("FPix_SignalResponse_p0")),
198  FPix_p1(conf.getParameter<double>("FPix_SignalResponse_p1")),
199  FPix_p2(conf.getParameter<double>("FPix_SignalResponse_p2")),
200  FPix_p3(conf.getParameter<double>("FPix_SignalResponse_p3")),
201 
202  BPix_p0(conf.getParameter<double>("BPix_SignalResponse_p0")),
203  BPix_p1(conf.getParameter<double>("BPix_SignalResponse_p1")),
204  BPix_p2(conf.getParameter<double>("BPix_SignalResponse_p2")),
205  BPix_p3(conf.getParameter<double>("BPix_SignalResponse_p3")),
206 
207  // Add noise
208  addNoise(conf.getParameter<bool>("AddNoise")),
209 
210  // Smear the pixel charge with a gaussian which RMS is a function of the
211  // pixel charge (Danek's study)
212  addChargeVCALSmearing(conf.getParameter<bool>("ChargeVCALSmearing")),
213 
214  // Add noisy pixels
215  addNoisyPixels(conf.getParameter<bool>("AddNoisyPixels")),
216 
217  // Fluctuate charge in track subsegments
218  fluctuateCharge(conf.getUntrackedParameter<bool>("FluctuateCharge",true)),
219 
220  // Control the pixel inefficiency
221  AddPixelInefficiency(conf.getParameter<bool>("AddPixelInefficiency")),
222 
223  // Add threshold gaussian smearing:
224  addThresholdSmearing(conf.getParameter<bool>("AddThresholdSmearing")),
225 
226  // Get the constants for the miss-calibration studies
227  doMissCalibrate(conf.getParameter<bool>("MissCalibrate")), // Enable miss-calibration
228  theGainSmearing(conf.getParameter<double>("GainSmearing")), // sigma of the gain smearing
229  theOffsetSmearing(conf.getParameter<double>("OffsetSmearing")), //sigma of the offset smearing
230 
231  // Add pixel radiation damage for upgrade studies
232  AddPixelAging(conf.getParameter<bool>("DoPixelAging")),
233 
234  // delta cutoff in MeV, has to be same as in OSCAR(0.030/cmsim=1.0 MeV
235  //tMax(0.030), // In MeV.
236  //tMax(conf.getUntrackedParameter<double>("deltaProductionCut",0.030)),
237  tMax(conf.getParameter<double>("deltaProductionCut")),
238 
241  calmap(doMissCalibrate ? initCal() : std::map<int,CalParameters,std::less<int> >()),
245 {
246  LogInfo ("PixelDigitizer ") <<"SiPixelDigitizerAlgorithm constructed"
247  <<"Configuration parameters:"
248  << "Threshold/Gain = "
249  << "threshold in electron FPix = "
251  << "threshold in electron BPix = "
253  << "threshold in electron BPix Layer1 = "
255  <<" " << theElectronPerADC << " " << theAdcFullScale
256  << " The delta cut-off is set to " << tMax
257  << " pix-inefficiency "<<AddPixelInefficiency;
258 
259 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::map< int, CalParameters, std::less< int > > initCal() const
const std::unique_ptr< SiPixelGainCalibrationOfflineSimService > theSiPixelGainCalibrationService_
const std::unique_ptr< SiG4UniversalFluctuation > fluctuate
bool exists(std::string const &parameterName) const
checks if a parameter exists
const std::map< int, CalParameters, std::less< int > > calmap
const std::unique_ptr< GaussianTailNoiseGenerator > theNoiser
std::vector< edm::ParameterSet > Parameters
SiPixelDigitizerAlgorithm::~SiPixelDigitizerAlgorithm ( )

Definition at line 354 of file SiPixelDigitizerAlgorithm.cc.

References LogDebug.

354  {
355  LogDebug ("PixelDigitizer")<<"SiPixelDigitizerAlgorithm deleted";
356 }
#define LogDebug(id)

Member Function Documentation

void SiPixelDigitizerAlgorithm::accumulateSimHits ( const std::vector< PSimHit >::const_iterator  inputBegin,
const std::vector< PSimHit >::const_iterator  inputEnd,
const size_t  inputBeginGlobalIndex,
const unsigned int  tofBin,
const PixelGeomDetUnit pixdet,
const GlobalVector bfield,
const TrackerTopology tTopo,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 586 of file SiPixelDigitizerAlgorithm.cc.

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

593  {
594  // produce SignalPoint's for all SimHit's in detector
595  // Loop over hits
596 
597  uint32_t detId = pixdet->geographicalId().rawId();
598  size_t simHitGlobalIndex=inputBeginGlobalIndex; // This needs to stored to create the digi-sim link later
599  for (std::vector<PSimHit>::const_iterator ssbegin = inputBegin; ssbegin != inputEnd; ++ssbegin, ++simHitGlobalIndex) {
600  // skip hits not in this detector.
601  if((*ssbegin).detUnitId() != detId) {
602  continue;
603  }
604 
605 #ifdef TP_DEBUG
606  LogDebug ("Pixel Digitizer")
607  << (*ssbegin).particleType() << " " << (*ssbegin).pabs() << " "
608  << (*ssbegin).energyLoss() << " " << (*ssbegin).tof() << " "
609  << (*ssbegin).trackId() << " " << (*ssbegin).processType() << " "
610  << (*ssbegin).detUnitId()
611  << (*ssbegin).entryPoint() << " " << (*ssbegin).exitPoint() ;
612 #endif
613 
614 
615  std::vector<EnergyDepositUnit> ionization_points;
616  std::vector<SignalPoint> collection_points;
617 
618  // fill collection_points for this SimHit, indpendent of topology
619  // Check the TOF cut
620  if ( ((*ssbegin).tof() - pixdet->surface().toGlobal((*ssbegin).localPosition()).mag()/30.)>= theTofLowerCut &&
621  ((*ssbegin).tof()- pixdet->surface().toGlobal((*ssbegin).localPosition()).mag()/30.) <= theTofUpperCut ) {
622  primary_ionization(*ssbegin, ionization_points, engine); // fills _ionization_points
623  drift(*ssbegin, pixdet, bfield, tTopo, ionization_points, collection_points); // transforms _ionization_points to collection_points
624  // compute induced signal on readout elements and add to _signal
625  induce_signal(*ssbegin, simHitGlobalIndex, tofBin, pixdet, collection_points); // 1st 3 args needed only for SimHit<-->Digi link
626  } // end if
627  } // end for
628 
629 }
#define LogDebug(id)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
void induce_signal(const PSimHit &hit, const size_t hitIndex, const unsigned int tofBin, const PixelGeomDetUnit *pixdet, const std::vector< SignalPoint > &collection_points)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
void primary_ionization(const PSimHit &hit, std::vector< EnergyDepositUnit > &ionization_points, CLHEP::HepRandomEngine *) const
void drift(const PSimHit &hit, const PixelGeomDetUnit *pixdet, const GlobalVector &bfield, const TrackerTopology *tTopo, const std::vector< EnergyDepositUnit > &ionization_points, std::vector< SignalPoint > &collection_points) const
void SiPixelDigitizerAlgorithm::add_noise ( const PixelGeomDetUnit pixdet,
float  thePixelThreshold,
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 1341 of file SiPixelDigitizerAlgorithm.cc.

References _signal, addChargeVCALSmearing, addNoisyPixels, GeomDet::geographicalId(), i, LogDebug, PixelTopology::ncolumns(), HLT_25ns14e33_v1_cff::noise, PixelTopology::nrows(), PixelDigi::pixelToChannel(), DetId::rawId(), PixelGeomDetUnit::specificTopology(), theNoiseInElectrons, theNoiser, theReadoutNoise, theThresholdInE_BPix, and theThresholdInE_FPix.

Referenced by digitize().

1343  {
1344 
1345 #ifdef TP_DEBUG
1346  LogDebug ("Pixel Digitizer") << " enter add_noise " << theNoiseInElectrons;
1347 #endif
1348 
1349  uint32_t detID= pixdet->geographicalId().rawId();
1350  signal_map_type& theSignal = _signal[detID];
1351 
1352 
1353  // First add noise to hit pixels
1354  float theSmearedChargeRMS = 0.0;
1355 
1356  for ( signal_map_iterator i = theSignal.begin(); i != theSignal.end(); i++) {
1357 
1359  {
1360  if((*i).second < 3000)
1361  {
1362  theSmearedChargeRMS = 543.6 - (*i).second * 0.093;
1363  } else if((*i).second < 6000){
1364  theSmearedChargeRMS = 307.6 - (*i).second * 0.01;
1365  } else{
1366  theSmearedChargeRMS = -432.4 +(*i).second * 0.123;
1367  }
1368 
1369  // Noise from Vcal smearing:
1370  float noise_ChargeVCALSmearing = theSmearedChargeRMS * CLHEP::RandGaussQ::shoot(engine, 0., 1.);
1371  // Noise from full readout:
1372  float noise = CLHEP::RandGaussQ::shoot(engine, 0., theReadoutNoise);
1373 
1374  if(((*i).second + Amplitude(noise+noise_ChargeVCALSmearing, -1.)) < 0. ) {
1375  (*i).second.set(0);}
1376  else{
1377  (*i).second +=Amplitude(noise+noise_ChargeVCALSmearing, -1.);
1378  }
1379 
1380  } // End if addChargeVCalSmearing
1381  else
1382  {
1383  // Noise: ONLY full READOUT Noise.
1384  // Use here the FULL readout noise, including TBM,ALT,AOH,OPT-REC.
1385  float noise = CLHEP::RandGaussQ::shoot(engine, 0., theReadoutNoise);
1386 
1387  if(((*i).second + Amplitude(noise, -1.)) < 0. ) {
1388  (*i).second.set(0);}
1389  else{
1390  (*i).second +=Amplitude(noise, -1.);
1391  }
1392  } // end if only Noise from full readout
1393 
1394  }
1395 
1396  if(!addNoisyPixels) // Option to skip noise in non-hit pixels
1397  return;
1398 
1399  const PixelTopology* topol=&pixdet->specificTopology();
1400  int numColumns = topol->ncolumns(); // det module number of cols&rows
1401  int numRows = topol->nrows();
1402 
1403  // Add noise on non-hit pixels
1404  // Use here the pixel noise
1405  int numberOfPixels = (numRows * numColumns);
1406  std::map<int,float, std::less<int> > otherPixels;
1407  std::map<int,float, std::less<int> >::iterator mapI;
1408 
1409  theNoiser->generate(numberOfPixels,
1410  thePixelThreshold, //thr. in un. of nois
1411  theNoiseInElectrons, // noise in elec.
1412  otherPixels,
1413  engine );
1414 
1415 #ifdef TP_DEBUG
1416  LogDebug ("Pixel Digitizer")
1417  << " Add noisy pixels " << numRows << " "
1418  << numColumns << " " << theNoiseInElectrons << " "
1419  << theThresholdInE_FPix << theThresholdInE_BPix <<" "<< numberOfPixels<<" "
1420  << otherPixels.size() ;
1421 #endif
1422 
1423  // Add noisy pixels
1424  for (mapI = otherPixels.begin(); mapI!= otherPixels.end(); mapI++) {
1425  int iy = ((*mapI).first) / numRows;
1426  int ix = ((*mapI).first) - (iy*numRows);
1427 
1428  // Keep for a while for testing.
1429  if( iy < 0 || iy > (numColumns-1) )
1430  LogWarning ("Pixel Geometry") << " error in iy " << iy ;
1431  if( ix < 0 || ix > (numRows-1) )
1432  LogWarning ("Pixel Geometry") << " error in ix " << ix ;
1433 
1434  int chan = PixelDigi::pixelToChannel(ix, iy);
1435 
1436 #ifdef TP_DEBUG
1437  LogDebug ("Pixel Digitizer")
1438  <<" Storing noise = " << (*mapI).first << " " << (*mapI).second
1439  << " " << ix << " " << iy << " " << chan ;
1440 #endif
1441 
1442  if(theSignal[chan] == 0){
1443  // float noise = float( (*mapI).second );
1444  int noise=int( (*mapI).second );
1445  theSignal[chan] = Amplitude (noise, -1.);
1446  }
1447  }
1448 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
virtual int ncolumns() const =0
virtual int nrows() const =0
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:68
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
signal_map_type::iterator signal_map_iterator
const std::unique_ptr< GaussianTailNoiseGenerator > theNoiser
std::map< int, Amplitude, std::less< int > > signal_map_type
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
double SiPixelDigitizerAlgorithm::calcQ ( float  x) const
inlineprivate

Definition at line 446 of file SiPixelDigitizerAlgorithm.h.

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

Referenced by induce_signal().

446  {
447  // need erf(x/sqrt2)
448  //float x2=0.5*x*x;
449  //float a=0.147;
450  //double erf=sqrt(1.0f-exp( -1.0f*x2*( (4/M_PI)+a*x2)/(1.0+a*x2)));
451  //if (x<0.) erf*=-1.0;
452  //return 0.5*(1.0-erf);
453 
454  auto xx=std::min(0.5f*x*x,12.5f);
455  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));
456  }
T sqrt(T t)
Definition: SSEVec.h:48
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
void SiPixelDigitizerAlgorithm::calculateInstlumiFactor ( PileupMixingContent puInfo)

Definition at line 632 of file SiPixelDigitizerAlgorithm.cc.

References PileupMixingContent::getMix_bunchCrossing(), PileupMixingContent::getMix_TrueInteractions(), i, j, gen::n, AlCaHLTBitMon_ParallelJobs::p, pixelEfficiencies_, SiPixelDigitizerAlgorithm::PixelEfficiencies::pu_scale, SiPixelDigitizerAlgorithm::PixelEfficiencies::theInstLumiScaleFactor, and SiPixelDigitizerAlgorithm::PixelEfficiencies::thePUEfficiency.

632  {
633  //Instlumi scalefactor calculating for dynamic inefficiency
634 
635  if (puInfo) {
636  const std::vector<int> bunchCrossing = puInfo->getMix_bunchCrossing();
637  const std::vector<float> TrueInteractionList = puInfo->getMix_TrueInteractions();
638  //const int bunchSpacing = puInfo->getMix_bunchSpacing();
639 
640  int pui = 0, p = 0;
641  std::vector<int>::const_iterator pu;
642  std::vector<int>::const_iterator pu0 = bunchCrossing.end();
643 
644  for (pu=bunchCrossing.begin(); pu!=bunchCrossing.end(); ++pu) {
645  if (*pu==0) {
646  pu0 = pu;
647  p = pui;
648  }
649  pui++;
650  }
651  if (pu0!=bunchCrossing.end()) {
652  for (size_t i=0, n = pixelEfficiencies_.thePUEfficiency.size(); i<n; i++) {
653  double instlumi = TrueInteractionList.at(p)*pixelEfficiencies_.theInstLumiScaleFactor;
654  double instlumi_pow=1.;
656  for (size_t j=0; j<pixelEfficiencies_.thePUEfficiency[i].size(); j++){
658  instlumi_pow*=instlumi;
659  }
660  }
661  }
662  }
663  else {
664  for (int i=0, n = pixelEfficiencies_.thePUEfficiency.size(); i<n; i++) {
666  }
667  }
668 }
int i
Definition: DBlmapReader.cc:9
const std::vector< float > & getMix_TrueInteractions() const
const std::vector< int > & getMix_bunchCrossing() const
std::vector< std::vector< double > > thePUEfficiency
int j
Definition: DBlmapReader.cc:9
void SiPixelDigitizerAlgorithm::digitize ( const PixelGeomDetUnit pixdet,
std::vector< PixelDigi > &  digis,
std::vector< PixelDigiSimLink > &  simlinks,
const TrackerTopology tTopo,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 671 of file SiPixelDigitizerAlgorithm.cc.

References _signal, add_noise(), addNoise, AddPixelInefficiency, addThresholdSmearing, Surface::bounds(), Exception, GeomDet::geographicalId(), GeomDetType::isBarrel(), GeomDetType::isTrackerPixel(), TrackerTopology::layer(), LogDebug, make_digis(), module_killing_conf(), module_killing_DB(), PixelTopology::ncolumns(), PixelTopology::nrows(), GeomDetEnumerators::P1PXB, pixel_inefficiency(), pixel_inefficiency_db(), GeomDetEnumerators::PixelBarrel, pixelEfficiencies_, DetId::rawId(), GeomDet::specificSurface(), PixelGeomDetUnit::specificTopology(), GeomDet::subDetector(), theNoiseInElectrons, theThresholdInE_BPix, theThresholdInE_BPix_L1, theThresholdInE_FPix, theThresholdSmearing_BPix, theThresholdSmearing_BPix_L1, theThresholdSmearing_FPix, Bounds::thickness(), PixelGeomDetUnit::type(), use_deadmodule_DB_, use_ineff_from_db_, and use_module_killing_.

675  {
676 
677  // Pixel Efficiency moved from the constructor to this method because
678  // the information of the det are not available in the constructor
679  // Efficiency parameters. 0 - no inefficiency, 1-low lumi, 10-high lumi
680 
681  uint32_t detID = pixdet->geographicalId().rawId();
682  const signal_map_type& theSignal = _signal[detID];
683 
684  const PixelTopology* topol=&pixdet->specificTopology();
685  int numColumns = topol->ncolumns(); // det module number of cols&rows
686  int numRows = topol->nrows();
687 
688  // Noise already defined in electrons
689  // thePixelThresholdInE = thePixelThreshold * theNoiseInElectrons ;
690  // Find the threshold in noise units, needed for the noiser.
691 
692 
693  float thePixelThresholdInE = 0.;
694 
695  if(theNoiseInElectrons>0.){
696  if(pixdet->type().isTrackerPixel() && pixdet->type().isBarrel()){ // Barrel modules
697  int lay = tTopo->layer(detID);
700  thePixelThresholdInE = CLHEP::RandGaussQ::shoot(engine, theThresholdInE_BPix_L1, theThresholdSmearing_BPix_L1); // gaussian smearing
701  } else {
702  thePixelThresholdInE = CLHEP::RandGaussQ::shoot(engine, theThresholdInE_BPix , theThresholdSmearing_BPix); // gaussian smearing
703  }
704  } else {
706  thePixelThresholdInE = theThresholdInE_BPix_L1;
707  } else {
708  thePixelThresholdInE = theThresholdInE_BPix; // no smearing
709  }
710  }
711  } else if(pixdet->type().isTrackerPixel()) { // Forward disks modules
713  thePixelThresholdInE = CLHEP::RandGaussQ::shoot(engine, theThresholdInE_FPix, theThresholdSmearing_FPix); // gaussian smearing
714  } else {
715  thePixelThresholdInE = theThresholdInE_FPix; // no smearing
716  }
717  }
718  else {throw cms::Exception("NotAPixelGeomDetUnit") << "Not a pixel geomdet unit" << detID;}
719  }
720 
721 
722 #ifdef TP_DEBUG
723  // full detector thickness
724  float moduleThickness = pixdet->specificSurface().bounds().thickness();
725  LogDebug ("PixelDigitizer")
726  << " PixelDigitizer "
727  << numColumns << " " << numRows << " " << moduleThickness;
728 #endif
729 
730  if(addNoise) add_noise(pixdet, thePixelThresholdInE/theNoiseInElectrons, engine); // generate noise
731 
732  // Do only if needed
733 
734  if((AddPixelInefficiency) && (theSignal.size()>0))
735  pixel_inefficiency(pixelEfficiencies_, pixdet, tTopo, engine); // Kill some pixels
736 
737  if(use_ineff_from_db_ && (theSignal.size()>0))
738  pixel_inefficiency_db(detID);
739 
740  if(use_module_killing_) {
741  if (use_deadmodule_DB_) { // remove dead modules using DB
742  module_killing_DB(detID);
743  } else { // remove dead modules using the list in cfg file
744  module_killing_conf(detID);
745  }
746  }
747 
748  make_digis(thePixelThresholdInE, detID, pixdet, digis, simlinks, tTopo);
749 
750 #ifdef TP_DEBUG
751  LogDebug ("PixelDigitizer") << "[SiPixelDigitizerAlgorithm] converted " << digis.size() << " PixelDigis in DetUnit" << detID;
752 #endif
753 }
#define LogDebug(id)
void pixel_inefficiency_db(uint32_t detID)
bool isBarrel() const
Definition: GeomDetType.cc:13
virtual int ncolumns() const =0
virtual const GeomDetType & type() const override
virtual int nrows() const =0
const Bounds & bounds() const
Definition: Surface.h:128
void make_digis(float thePixelThresholdInE, uint32_t detID, const PixelGeomDetUnit *pixdet, std::vector< PixelDigi > &digis, std::vector< PixelDigiSimLink > &simlinks, const TrackerTopology *tTopo) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
virtual float thickness() const =0
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
bool isTrackerPixel() const
Definition: GeomDetType.cc:29
std::map< int, Amplitude, std::less< int > > signal_map_type
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
unsigned int layer(const DetId &id) const
virtual SubDetector subDetector() const
Which subdetector.
Definition: GeomDet.cc:49
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:43
void add_noise(const PixelGeomDetUnit *pixdet, float thePixelThreshold, CLHEP::HepRandomEngine *)
void pixel_inefficiency(const PixelEfficiencies &eff, const PixelGeomDetUnit *pixdet, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
void SiPixelDigitizerAlgorithm::drift ( const PSimHit hit,
const PixelGeomDetUnit pixdet,
const GlobalVector bfield,
const TrackerTopology tTopo,
const std::vector< EnergyDepositUnit > &  ionization_points,
std::vector< SignalPoint > &  collection_points 
) const
private

Definition at line 885 of file SiPixelDigitizerAlgorithm.cc.

References AddPixelAging, alpha2Order, Surface::bounds(), PSimHit::detUnitId(), Dist300, DriftDirection(), create_public_lumi_plots::exp, i, LogDebug, pixel_aging(), pixelAging_, Sigma0, GeomDet::specificSurface(), mathSSE::sqrt(), Bounds::thickness(), PSimHit::tof(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by accumulateSimHits().

890  {
891 
892 #ifdef TP_DEBUG
893  LogDebug ("Pixel Digitizer") << " enter drift " ;
894 #endif
895 
896  collection_points.resize(ionization_points.size()); // set size
897 
898  LocalVector driftDir=DriftDirection(pixdet, bfield, hit.detUnitId()); // get the charge drift direction
899  if(driftDir.z() ==0.) {
900  LogWarning("Magnetic field") << " pxlx: drift in z is zero ";
901  return;
902  }
903 
904  // tangent of Lorentz angle
905  //float TanLorenzAngleX = driftDir.x()/driftDir.z();
906  //float TanLorenzAngleY = 0.; // force to 0, driftDir.y()/driftDir.z();
907 
908  float TanLorenzAngleX, TanLorenzAngleY,dir_z, CosLorenzAngleX,
909  CosLorenzAngleY;
910  if( alpha2Order) {
911  TanLorenzAngleX = driftDir.x(); // tangen of Lorentz angle
912  TanLorenzAngleY = driftDir.y();
913  dir_z = driftDir.z(); // The z drift direction
914  CosLorenzAngleX = 1./sqrt(1.+TanLorenzAngleX*TanLorenzAngleX); //cosine
915  CosLorenzAngleY = 1./sqrt(1.+TanLorenzAngleY*TanLorenzAngleY); //cosine;
916 
917  } else{
918  TanLorenzAngleX = driftDir.x();
919  TanLorenzAngleY = 0.; // force to 0, driftDir.y()/driftDir.z();
920  dir_z = driftDir.z(); // The z drift direction
921  CosLorenzAngleX = 1./sqrt(1.+TanLorenzAngleX*TanLorenzAngleX); //cosine to estimate the path length
922  CosLorenzAngleY = 1.;
923  }
924 
925  float moduleThickness = pixdet->specificSurface().bounds().thickness();
926 #ifdef TP_DEBUG
927  LogDebug ("Pixel Digitizer")
928  << " Lorentz Tan " << TanLorenzAngleX << " " << TanLorenzAngleY <<" "
929  << CosLorenzAngleX << " " << CosLorenzAngleY << " "
930  << moduleThickness*TanLorenzAngleX << " " << driftDir;
931 #endif
932 
933  float Sigma_x = 1.; // Charge spread
934  float Sigma_y = 1.;
935  float DriftDistance; // Distance between charge generation and collection
936  float DriftLength; // Actual Drift Lentgh
937  float Sigma;
938 
939  for (unsigned int i = 0; i != ionization_points.size(); i++) {
940 
941  float SegX, SegY, SegZ; // position
942  SegX = ionization_points[i].x();
943  SegY = ionization_points[i].y();
944  SegZ = ionization_points[i].z();
945 
946  // Distance from the collection plane
947  //DriftDistance = (moduleThickness/2. + SegZ); // Drift to -z
948  // Include explixitely the E drift direction (for CMS dir_z=-1)
949  DriftDistance = moduleThickness/2. - (dir_z * SegZ); // Drift to -z
950 
951  //if( DriftDistance <= 0.)
952  //cout<<" <=0 "<<DriftDistance<<" "<<i<<" "<<SegZ<<" "<<dir_z<<" "
953  // <<SegX<<" "<<SegY<<" "<<(moduleThickness/2)<<" "
954  // <<ionization_points[i].energy()<<" "
955  // <<hit.particleType()<<" "<<hit.pabs()<<" "<<hit.energyLoss()<<" "
956  // <<hit.entryPoint()<<" "<<hit.exitPoint()
957  // <<std::endl;
958 
959  if( DriftDistance < 0.) {
960  DriftDistance = 0.;
961  } else if( DriftDistance > moduleThickness )
962  DriftDistance = moduleThickness;
963 
964  // Assume full depletion now, partial depletion will come later.
965  float XDriftDueToMagField = DriftDistance * TanLorenzAngleX;
966  float YDriftDueToMagField = DriftDistance * TanLorenzAngleY;
967 
968  // Shift cloud center
969  float CloudCenterX = SegX + XDriftDueToMagField;
970  float CloudCenterY = SegY + YDriftDueToMagField;
971 
972  // Calculate how long is the charge drift path
973  DriftLength = sqrt( DriftDistance*DriftDistance +
974  XDriftDueToMagField*XDriftDueToMagField +
975  YDriftDueToMagField*YDriftDueToMagField );
976 
977  // What is the charge diffusion after this path
978  Sigma = sqrt(DriftLength/Dist300) * Sigma0;
979 
980  // Project the diffusion sigma on the collection plane
981  Sigma_x = Sigma / CosLorenzAngleX ;
982  Sigma_y = Sigma / CosLorenzAngleY ;
983 
984  // Insert a charge loss due to Rad Damage here
985  float energyOnCollector = ionization_points[i].energy(); // The energy that reaches the collector
986 
987  // add pixel aging
988  if (AddPixelAging) {
989  float kValue = pixel_aging(pixelAging_,pixdet,tTopo);
990  energyOnCollector *= exp( -1*kValue*DriftDistance/moduleThickness );
991  }
992 
993 #ifdef TP_DEBUG
994  LogDebug ("Pixel Digitizer")
995  <<" Dift DistanceZ= "<<DriftDistance<<" module thickness= "<<moduleThickness
996  <<" Start Energy= "<<ionization_points[i].energy()<<" Energy after loss= "<<energyOnCollector;
997 #endif
998  SignalPoint sp( CloudCenterX, CloudCenterY,
999  Sigma_x, Sigma_y, hit.tof(), energyOnCollector );
1000 
1001  // Load the Charge distribution parameters
1002  collection_points[i] = (sp);
1003 
1004  } // loop over ionization points, i.
1005 
1006 } // end drift
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
float tof() const
deprecated name for timeOfFlight()
Definition: PSimHit.h:72
LocalVector DriftDirection(const PixelGeomDetUnit *pixdet, const GlobalVector &bfield, const DetId &detId) const
T y() const
Definition: PV3DBase.h:63
const Bounds & bounds() const
Definition: Surface.h:128
virtual float thickness() const =0
float pixel_aging(const PixelAging &aging, const PixelGeomDetUnit *pixdet, const TrackerTopology *tTopo) const
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
T x() const
Definition: PV3DBase.h:62
unsigned int detUnitId() const
Definition: PSimHit.h:93
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:43
LocalVector SiPixelDigitizerAlgorithm::DriftDirection ( const PixelGeomDetUnit pixdet,
const GlobalVector bfield,
const DetId detId 
) const
private

Definition at line 1741 of file SiPixelDigitizerAlgorithm.cc.

References alpha2Order, Exception, GeomDet::geographicalId(), GeomDetType::isBarrel(), GeomDetType::isTrackerPixel(), LogDebug, GloballyPositioned< T >::position(), DetId::rawId(), GloballyPositioned< T >::rotation(), pileupReCalc_HLTpaths::scale, SiPixelLorentzAngle_, GeomDet::surface(), tanLorentzAnglePerTesla_BPix, tanLorentzAnglePerTesla_FPix, PixelGeomDetUnit::type(), and use_LorentzAngle_DB_.

Referenced by drift().

1743  {
1744  Frame detFrame(pixdet->surface().position(),pixdet->surface().rotation());
1745  LocalVector Bfield=detFrame.toLocal(bfield);
1746 
1747  float alpha2_FPix;
1748  float alpha2_BPix;
1749  float alpha2;
1750 
1751  //float dir_x = -tanLorentzAnglePerTesla * Bfield.y();
1752  //float dir_y = +tanLorentzAnglePerTesla * Bfield.x();
1753  //float dir_z = -1.; // E field always in z direction, so electrons go to -z
1754  // The dir_z has to be +/- 1. !
1755  // LocalVector theDriftDirection = LocalVector(dir_x,dir_y,dir_z);
1756 
1757  float dir_x = 0.0;
1758  float dir_y = 0.0;
1759  float dir_z = 0.0;
1760  float scale = 0.0;
1761 
1762  uint32_t detID= pixdet->geographicalId().rawId();
1763 
1764 
1765  // Read Lorentz angle from cfg file:**************************************************************
1766 
1767  if(!use_LorentzAngle_DB_){
1768 
1769  if( alpha2Order) {
1772  }else {
1773  alpha2_FPix = 0.0;
1774  alpha2_BPix = 0.0;
1775  }
1776 
1777  if(pixdet->type().isTrackerPixel() && pixdet->type().isBarrel()){// barrel layers
1778  dir_x = -( tanLorentzAnglePerTesla_BPix * Bfield.y() + alpha2_BPix* Bfield.z()* Bfield.x() );
1779  dir_y = +( tanLorentzAnglePerTesla_BPix * Bfield.x() - alpha2_BPix* Bfield.z()* Bfield.y() );
1780  dir_z = -(1 + alpha2_BPix* Bfield.z()*Bfield.z() );
1781  scale = -dir_z;
1782  } else if (pixdet->type().isTrackerPixel()) {// forward disks
1783  dir_x = -( tanLorentzAnglePerTesla_FPix * Bfield.y() + alpha2_FPix* Bfield.z()* Bfield.x() );
1784  dir_y = +( tanLorentzAnglePerTesla_FPix * Bfield.x() - alpha2_FPix* Bfield.z()* Bfield.y() );
1785  dir_z = -(1 + alpha2_FPix* Bfield.z()*Bfield.z() );
1786  scale = -dir_z;
1787  } else {
1788  throw cms::Exception("NotAPixelGeomDetUnit") << "Not a pixel geomdet unit" << detID;
1789  }
1790  } // end: Read LA from cfg file.
1791 
1792  //Read Lorentz angle from DB:********************************************************************
1794  float lorentzAngle = SiPixelLorentzAngle_->getLorentzAngle(detId);
1795  alpha2 = lorentzAngle * lorentzAngle;
1796  //std::cout << "detID is: "<< it->first <<"The LA per tesla is: "<< it->second << std::std::endl;
1797  dir_x = -( lorentzAngle * Bfield.y() + alpha2 * Bfield.z()* Bfield.x() );
1798  dir_y = +( lorentzAngle * Bfield.x() - alpha2 * Bfield.z()* Bfield.y() );
1799  dir_z = -(1 + alpha2 * Bfield.z()*Bfield.z() );
1800  scale = -dir_z;
1801  }// end: Read LA from DataBase.
1802 
1803  LocalVector theDriftDirection = LocalVector(dir_x/scale, dir_y/scale, dir_z/scale );
1804 
1805 #ifdef TP_DEBUG
1806  LogDebug ("Pixel Digitizer") << " The drift direction in local coordinate is "
1807  << theDriftDirection ;
1808 #endif
1809 
1810  return theDriftDirection;
1811 }
#define LogDebug(id)
Local3DVector LocalVector
Definition: LocalVector.h:12
bool isBarrel() const
Definition: GeomDetType.cc:13
virtual const GeomDetType & type() const override
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
bool isTrackerPixel() const
Definition: GeomDetType.cc:29
edm::ESHandle< SiPixelLorentzAngle > SiPixelLorentzAngle_
GloballyPositioned< double > Frame
const RotationType & rotation() const
const PositionType & position() const
void SiPixelDigitizerAlgorithm::fluctuateEloss ( int  particleId,
float  momentum,
float  eloss,
float  length,
int  NumberOfSegments,
float  elossVector[],
CLHEP::HepRandomEngine *  engine 
) const
private

Definition at line 830 of file SiPixelDigitizerAlgorithm.cc.

References funct::abs(), fluctuate, i, cuy::ii, and tMax.

Referenced by primary_ionization().

833  {
834 
835  // Get dedx for this track
836  //float dedx;
837  //if( length > 0.) dedx = eloss/length;
838  //else dedx = eloss;
839 
840  double particleMass = 139.6; // Mass in MeV, Assume pion
841  pid = std::abs(pid);
842  if(pid!=211) { // Mass in MeV
843  if(pid==11) particleMass = 0.511;
844  else if(pid==13) particleMass = 105.7;
845  else if(pid==321) particleMass = 493.7;
846  else if(pid==2212) particleMass = 938.3;
847  }
848  // What is the track segment length.
849  float segmentLength = length/NumberOfSegs;
850 
851  // Generate charge fluctuations.
852  float de=0.;
853  float sum=0.;
854  double segmentEloss = (1000.*eloss)/NumberOfSegs; //eloss in MeV
855  for (int i=0;i<NumberOfSegs;i++) {
856  // material,*, momentum,energy,*, *, mass
857  //myglandz_(14.,segmentLength,2.,2.,dedx,de,0.14);
858  // The G4 routine needs momentum in MeV, mass in Mev, delta-cut in MeV,
859  // track segment length in mm, segment eloss in MeV
860  // Returns fluctuated eloss in MeV
861  double deltaCutoff = tMax; // the cutoff is sometimes redefined inside, so fix it.
862  de = fluctuate->SampleFluctuations(double(particleMomentum*1000.),
863  particleMass, deltaCutoff,
864  double(segmentLength*10.),
865  segmentEloss, engine )/1000.; //convert to GeV
866  elossVector[i]=de;
867  sum +=de;
868  }
869 
870  if(sum>0.) { // If fluctuations give eloss>0.
871  // Rescale to the same total eloss
872  float ratio = eloss/sum;
873 
874  for (int ii=0;ii<NumberOfSegs;ii++) elossVector[ii]= ratio*elossVector[ii];
875  } else { // If fluctuations gives 0 eloss
876  float averageEloss = eloss/NumberOfSegs;
877  for (int ii=0;ii<NumberOfSegs;ii++) elossVector[ii]= averageEloss;
878  }
879  return;
880 }
int i
Definition: DBlmapReader.cc:9
const std::unique_ptr< SiG4UniversalFluctuation > fluctuate
int ii
Definition: cuy.py:588
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple pid
Definition: sysUtil.py:22
void SiPixelDigitizerAlgorithm::induce_signal ( const PSimHit hit,
const size_t  hitIndex,
const unsigned int  tofBin,
const PixelGeomDetUnit pixdet,
const std::vector< SignalPoint > &  collection_points 
)
private

Definition at line 1010 of file SiPixelDigitizerAlgorithm.cc.

References _signal, calcQ(), Topology::channel(), PixelDigi::channelToPixel(), ClusterWidth, GeomDet::geographicalId(), i, Topology::localPosition(), LogDebug, makeDigiSimLinks_, Topology::measurementPosition(), PixelTopology::ncolumns(), PixelTopology::nrows(), PixelTopology::pitch(), PixelDigi::pixelToChannel(), DetId::rawId(), PixelGeomDetUnit::specificTopology(), 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().

1014  {
1015 
1016  // X - Rows, Left-Right, 160, (1.6cm) for barrel
1017  // Y - Columns, Down-Up, 416, (6.4cm)
1018 
1019  const PixelTopology* topol=&pixdet->specificTopology();
1020  uint32_t detID= pixdet->geographicalId().rawId();
1021  signal_map_type& theSignal = _signal[detID];
1022 
1023 #ifdef TP_DEBUG
1024  LogDebug ("Pixel Digitizer")
1025  << " enter induce_signal, "
1026  << topol->pitch().first << " " << topol->pitch().second; //OK
1027 #endif
1028 
1029  // local map to store pixels hit by 1 Hit.
1030  typedef std::map< int, float, std::less<int> > hit_map_type;
1031  hit_map_type hit_signal;
1032 
1033  // map to store pixel integrals in the x and in the y directions
1034  std::map<int, float, std::less<int> > x,y;
1035 
1036  // Assign signals to readout channels and store sorted by channel number
1037 
1038  // Iterate over collection points on the collection plane
1039  for ( std::vector<SignalPoint>::const_iterator i=collection_points.begin();
1040  i != collection_points.end(); ++i) {
1041 
1042  float CloudCenterX = i->position().x(); // Charge position in x
1043  float CloudCenterY = i->position().y(); // in y
1044  float SigmaX = i->sigma_x(); // Charge spread in x
1045  float SigmaY = i->sigma_y(); // in y
1046  float Charge = i->amplitude(); // Charge amplitude
1047 
1048 
1049  //if(SigmaX==0 || SigmaY==0) {
1050  //cout<<SigmaX<<" "<<SigmaY
1051  // << " cloud " << i->position().x() << " " << i->position().y() << " "
1052  // << i->sigma_x() << " " << i->sigma_y() << " " << i->amplitude()<<std::endl;
1053  //}
1054 
1055 #ifdef TP_DEBUG
1056  LogDebug ("Pixel Digitizer")
1057  << " cloud " << i->position().x() << " " << i->position().y() << " "
1058  << i->sigma_x() << " " << i->sigma_y() << " " << i->amplitude();
1059 #endif
1060 
1061  // Find the maximum cloud spread in 2D plane , assume 3*sigma
1062  float CloudRight = CloudCenterX + ClusterWidth*SigmaX;
1063  float CloudLeft = CloudCenterX - ClusterWidth*SigmaX;
1064  float CloudUp = CloudCenterY + ClusterWidth*SigmaY;
1065  float CloudDown = CloudCenterY - ClusterWidth*SigmaY;
1066 
1067  // Define 2D cloud limit points
1068  LocalPoint PointRightUp = LocalPoint(CloudRight,CloudUp);
1069  LocalPoint PointLeftDown = LocalPoint(CloudLeft,CloudDown);
1070 
1071  // This points can be located outside the sensor area.
1072  // The conversion to measurement point does not check for that
1073  // so the returned pixel index might be wrong (outside range).
1074  // We rely on the limits check below to fix this.
1075  // But remember whatever we do here THE CHARGE OUTSIDE THE ACTIVE
1076  // PIXEL AREA IS LOST, it should not be collected.
1077 
1078  // Convert the 2D points to pixel indices
1079  MeasurementPoint mp = topol->measurementPosition(PointRightUp ); //OK
1080 
1081  int IPixRightUpX = int( floor( mp.x()));
1082  int IPixRightUpY = int( floor( mp.y()));
1083 
1084 #ifdef TP_DEBUG
1085  LogDebug ("Pixel Digitizer") << " right-up " << PointRightUp << " "
1086  << mp.x() << " " << mp.y() << " "
1087  << IPixRightUpX << " " << IPixRightUpY ;
1088 #endif
1089 
1090  mp = topol->measurementPosition(PointLeftDown ); //OK
1091 
1092  int IPixLeftDownX = int( floor( mp.x()));
1093  int IPixLeftDownY = int( floor( mp.y()));
1094 
1095 #ifdef TP_DEBUG
1096  LogDebug ("Pixel Digitizer") << " left-down " << PointLeftDown << " "
1097  << mp.x() << " " << mp.y() << " "
1098  << IPixLeftDownX << " " << IPixLeftDownY ;
1099 #endif
1100 
1101  // Check detector limits to correct for pixels outside range.
1102  int numColumns = topol->ncolumns(); // det module number of cols&rows
1103  int numRows = topol->nrows();
1104 
1105  IPixRightUpX = numRows>IPixRightUpX ? IPixRightUpX : numRows-1 ;
1106  IPixRightUpY = numColumns>IPixRightUpY ? IPixRightUpY : numColumns-1 ;
1107  IPixLeftDownX = 0<IPixLeftDownX ? IPixLeftDownX : 0 ;
1108  IPixLeftDownY = 0<IPixLeftDownY ? IPixLeftDownY : 0 ;
1109 
1110  x.clear(); // clear temporary integration array
1111  y.clear();
1112 
1113  // First integrate charge strips in x
1114  int ix; // TT for compatibility
1115  for (ix=IPixLeftDownX; ix<=IPixRightUpX; ix++) { // loop over x index
1116  float xUB, xLB, UpperBound, LowerBound;
1117 
1118  // Why is set to 0 if ix=0, does it meen that we accept charge
1119  // outside the sensor? CHeck How it was done in ORCA?
1120  //if(ix == 0) LowerBound = 0.;
1121  if(ix == 0 || SigmaX==0. ) // skip for surface segemnts
1122  LowerBound = 0.;
1123  else {
1124  mp = MeasurementPoint( float(ix), 0.0);
1125  xLB = topol->localPosition(mp).x();
1126  LowerBound = 1-calcQ((xLB-CloudCenterX)/SigmaX);
1127  }
1128 
1129  if(ix == numRows-1 || SigmaX==0. )
1130  UpperBound = 1.;
1131  else {
1132  mp = MeasurementPoint( float(ix+1), 0.0);
1133  xUB = topol->localPosition(mp).x();
1134  UpperBound = 1. - calcQ((xUB-CloudCenterX)/SigmaX);
1135  }
1136 
1137  float TotalIntegrationRange = UpperBound - LowerBound; // get strip
1138  x[ix] = TotalIntegrationRange; // save strip integral
1139  //if(SigmaX==0 || SigmaY==0)
1140  //cout<<TotalIntegrationRange<<" "<<ix<<std::endl;
1141 
1142  }
1143 
1144  // Now integrate strips in y
1145  int iy; // TT for compatibility
1146  for (iy=IPixLeftDownY; iy<=IPixRightUpY; iy++) { //loope over y ind
1147  float yUB, yLB, UpperBound, LowerBound;
1148 
1149  if(iy == 0 || SigmaY==0.)
1150  LowerBound = 0.;
1151  else {
1152  mp = MeasurementPoint( 0.0, float(iy) );
1153  yLB = topol->localPosition(mp).y();
1154  LowerBound = 1. - calcQ((yLB-CloudCenterY)/SigmaY);
1155  }
1156 
1157  if(iy == numColumns-1 || SigmaY==0. )
1158  UpperBound = 1.;
1159  else {
1160  mp = MeasurementPoint( 0.0, float(iy+1) );
1161  yUB = topol->localPosition(mp).y();
1162  UpperBound = 1. - calcQ((yUB-CloudCenterY)/SigmaY);
1163  }
1164 
1165  float TotalIntegrationRange = UpperBound - LowerBound;
1166  y[iy] = TotalIntegrationRange; // save strip integral
1167  //if(SigmaX==0 || SigmaY==0)
1168  //cout<<TotalIntegrationRange<<" "<<iy<<std::endl;
1169  }
1170 
1171  // Get the 2D charge integrals by folding x and y strips
1172  int chan;
1173  for (ix=IPixLeftDownX; ix<=IPixRightUpX; ix++) { // loop over x index
1174  for (iy=IPixLeftDownY; iy<=IPixRightUpY; iy++) { //loope over y ind
1175 
1176  float ChargeFraction = Charge*x[ix]*y[iy];
1177 
1178  if( ChargeFraction > 0. ) {
1179  chan = PixelDigi::pixelToChannel( ix, iy); // Get index
1180  // Load the amplitude
1181  hit_signal[chan] += ChargeFraction;
1182  } // endif
1183 
1184 
1185  mp = MeasurementPoint( float(ix), float(iy) );
1186  LocalPoint lp = topol->localPosition(mp);
1187  chan = topol->channel(lp);
1188 
1189 #ifdef TP_DEBUG
1190  LogDebug ("Pixel Digitizer")
1191  << " pixel " << ix << " " << iy << " - "<<" "
1192  << chan << " " << ChargeFraction<<" "
1193  << mp.x() << " " << mp.y() <<" "
1194  << lp.x() << " " << lp.y() << " " // givex edge position
1195  << chan; // edge belongs to previous ?
1196 #endif
1197 
1198  } // endfor iy
1199  } //endfor ix
1200 
1201 
1202  // Test conversions (THIS IS FOR TESTING ONLY) comment-out.
1203  // mp = topol->measurementPosition( i->position() ); //OK
1204  // LocalPoint lp = topol->localPosition(mp); //OK
1205  // std::pair<float,float> p = topol->pixel( i->position() ); //OK
1206  // chan = PixelDigi::pixelToChannel( int(p.first), int(p.second));
1207  // std::pair<int,int> ip = PixelDigi::channelToPixel(chan);
1208  // MeasurementPoint mp1 = MeasurementPoint( float(ip.first),
1209  // float(ip.second) );
1210  // LogDebug ("Pixel Digitizer") << " Test "<< mp.x() << " " << mp.y()
1211  // << " "<< lp.x() << " " << lp.y() << " "<<" "
1212  // <<p.first <<" "<<p.second<<" "<<chan<< " "
1213  // <<" " << ip.first << " " << ip.second << " "
1214  // << mp1.x() << " " << mp1.y() << " " //OK
1215  // << topol->localPosition(mp1).x() << " " //OK
1216  // << topol->localPosition(mp1).y() << " "
1217  // << topol->channel( i->position() ); //OK
1218 
1219 
1220  } // loop over charge distributions
1221 
1222  // Fill the global map with all hit pixels from this event
1223 
1224  for ( hit_map_type::const_iterator im = hit_signal.begin();
1225  im != hit_signal.end(); ++im) {
1226  int chan = (*im).first;
1227  theSignal[chan] += (makeDigiSimLinks_ ? Amplitude( (*im).second, &hit, hitIndex, tofBin, (*im).second) : Amplitude( (*im).second, (*im).second) ) ;
1228 
1229 #ifdef TP_DEBUG
1230  std::pair<int,int> ip = PixelDigi::channelToPixel(chan);
1231  LogDebug ("Pixel Digitizer")
1232  << " pixel " << ip.first << " " << ip.second << " "
1233  << theSignal[chan];
1234 #endif
1235  }
1236 
1237 } // end induce_signal
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV2DBase.h:46
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
virtual int ncolumns() const =0
T y() const
Definition: PV3DBase.h:63
virtual int nrows() const =0
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:68
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
U second(std::pair< T, U > const &p)
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
virtual int channel(const LocalPoint &p) const =0
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
virtual std::pair< float, float > pitch() const =0
std::map< int, Amplitude, std::less< int > > signal_map_type
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:62
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
T x() const
Definition: PV2DBase.h:45
T x() const
Definition: PV3DBase.h:62
void SiPixelDigitizerAlgorithm::init ( const edm::EventSetup es)

Definition at line 108 of file SiPixelDigitizerAlgorithm.cc.

References edm::EventSetup::get(), and map_.

108  {
109  if(use_ineff_from_db_){// load gain calibration service fromdb...
110  theSiPixelGainCalibrationService_->setESObjects( es );
111  }
112  if(use_deadmodule_DB_) {
114  }
116  // Get Lorentz angle from DB record
118  }
119  //gets the map and geometry from the DB (to kill ROCs)
120  es.get<SiPixelFedCablingMapRcd>().get(map_);
122 }
edm::ESHandle< SiPixelFedCablingMap > map_
const std::unique_ptr< SiPixelGainCalibrationOfflineSimService > theSiPixelGainCalibrationService_
edm::ESHandle< TrackerGeometry > geom_
edm::ESHandle< SiPixelLorentzAngle > SiPixelLorentzAngle_
edm::ESHandle< SiPixelQuality > SiPixelBadModule_
const T & get() const
Definition: EventSetup.h:56
void SiPixelDigitizerAlgorithm::init_DynIneffDB ( const edm::EventSetup es,
const unsigned int &  bunchspace 
)

Definition at line 483 of file SiPixelDigitizerAlgorithm.cc.

References AddPixelInefficiency, SiPixelDigitizerAlgorithm::PixelEfficiencies::FromConfig, geom_, edm::EventSetup::get(), SiPixelDigitizerAlgorithm::PixelEfficiencies::init_from_db(), pixelEfficiencies_, and SiPixelDynamicInefficiency_.

483  {
485  if (bunchspace == 50) es.get<SiPixelDynamicInefficiencyRcd>().get("50ns",SiPixelDynamicInefficiency_);
488  }
489 }
edm::ESHandle< TrackerGeometry > geom_
void init_from_db(const edm::ESHandle< TrackerGeometry > &, const edm::ESHandle< SiPixelDynamicInefficiency > &)
const T & get() const
Definition: EventSetup.h:56
edm::ESHandle< SiPixelDynamicInefficiency > SiPixelDynamicInefficiency_
std::map< int, SiPixelDigitizerAlgorithm::CalParameters, std::less< int > > SiPixelDigitizerAlgorithm::initCal ( ) const
private

Definition at line 262 of file SiPixelDigitizerAlgorithm.cc.

References calmap, ecal_dqm_sourceclient-live_cfg::cerr, PixelIndices::channelToPixelROC(), gather_cfg::cout, lut2db_cfg::filename, i, recoMuon::in, create_public_lumi_plots::in_file, geometryCSVtoXML::line, LogDebug, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, SiPixelDigitizerAlgorithm::CalParameters::p0, SiPixelDigitizerAlgorithm::CalParameters::p1, SiPixelDigitizerAlgorithm::CalParameters::p2, SiPixelDigitizerAlgorithm::CalParameters::p3, fitWZ::par0, PixelIndices::pixelToChannelROC(), and AlCaHLTBitMon_QueryRunRegistry::string.

262  {
263 
264  using std::cerr;
265  using std::cout;
266  using std::endl;
267 
268  std::map<int, SiPixelDigitizerAlgorithm::CalParameters, std::less<int> > calmap;
269  // Prepare for the analog amplitude miss-calibration
270  LogDebug ("PixelDigitizer ")
271  << " miss-calibrate the pixel amplitude ";
272 
273  const bool ReadCalParameters = false;
274  if(ReadCalParameters) { // Read the calibration files from file
275  // read the calibration constants from a file (testing only)
276  std::ifstream in_file; // data file pointer
277  char filename[80] = "phCalibrationFit_C0.dat";
278 
279  in_file.open(filename, std::ios::in ); // in C++
280  if(in_file.bad()) {
281  cout << " File not found " << endl;
282  return calmap; // signal error
283  }
284  cout << " file opened : " << filename << endl;
285 
286  char line[500];
287  for (int i = 0; i < 3; i++) {
288  in_file.getline(line, 500,'\n');
289  cout<<line<<endl;
290  }
291 
292  cout << " test map" << endl;
293 
294  float par0,par1,par2,par3;
295  int colid,rowid;
297  // Read MC tracks
298  for(int i=0;i<(52*80);i++) { // loop over tracks
299  in_file >> par0 >> par1 >> par2 >> par3 >> name >> colid >> rowid;
300  if(in_file.bad()) { // check for errors
301  cerr << "Cannot read data file" << endl;
302  return calmap;
303  }
304  if( in_file.eof() != 0 ) {
305  cerr << in_file.eof() << " " << in_file.gcount() << " "
306  << in_file.fail() << " " << in_file.good() << " end of file "
307  << endl;
308  return calmap;
309  }
310 
311  //cout << " line " << i << " " <<par0<<" "<<par1<<" "<<par2<<" "<<par3<<" "
312  // <<colid<<" "<<rowid<<endl;
313 
314  CalParameters onePix;
315  onePix.p0=par0;
316  onePix.p1=par1;
317  onePix.p2=par2;
318  onePix.p3=par3;
319 
320  // Convert ROC pixel index to channel
321  int chan = PixelIndices::pixelToChannelROC(rowid,colid);
322  calmap.insert(std::pair<int,CalParameters>(chan,onePix));
323 
324  // Testing the index conversion, can be skipped
325  std::pair<int,int> p = PixelIndices::channelToPixelROC(chan);
326  if(rowid!=p.first) cout<<" wrong channel row "<<rowid<<" "<<p.first<<endl;
327  if(colid!=p.second) cout<<" wrong channel col "<<colid<<" "<<p.second<<endl;
328 
329  } // pixel loop in a ROC
330 
331  cout << " map size " << calmap.size() <<" max "<<calmap.max_size() << " "
332  <<calmap.empty()<< endl;
333 
334 // cout << " map size " << calmap.size() << endl;
335 // map<int,CalParameters,std::less<int> >::iterator ix,it;
336 // map<int,CalParameters,std::less<int> >::const_iterator ip;
337 // for (ix = calmap.begin(); ix != calmap.end(); ++ix) {
338 // int i = (*ix).first;
339 // std::pair<int,int> p = channelToPixelROC(i);
340 // it = calmap.find(i);
341 // CalParameters y = (*it).second;
342 // CalParameters z = (*ix).second;
343 // cout << i <<" "<<p.first<<" "<<p.second<<" "<<y.p0<<" "<<z.p0<<" "<<calmap[i].p0<<endl;
344 
345 // //int dummy=0;
346 // //cin>>dummy;
347 // }
348 
349  } // end if readparameters
350  return calmap;
351 } // end initCal()
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
const std::map< int, CalParameters, std::less< int > > calmap
static int pixelToChannelROC(const int rowROC, const int colROC)
Definition: PixelIndices.h:250
static std::pair< int, int > channelToPixelROC(const int chan)
Definition: PixelIndices.h:253
tuple par0
Definition: fitWZ.py:51
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
void SiPixelDigitizerAlgorithm::initializeEvent ( )
inline

Definition at line 52 of file SiPixelDigitizerAlgorithm.h.

References _signal.

52  {
53  _signal.clear();
54  }
void SiPixelDigitizerAlgorithm::make_digis ( float  thePixelThresholdInE,
uint32_t  detID,
const PixelGeomDetUnit pixdet,
std::vector< PixelDigi > &  digis,
std::vector< PixelDigiSimLink > &  simlinks,
const TrackerTopology tTopo 
) const
private

Definition at line 1242 of file SiPixelDigitizerAlgorithm.cc.

References _signal, ecalMGPA::adc(), PixelDigi::channelToPixel(), cuy::col, doMissCalibrate, HLT_25ns14e33_v1_cff::fraction, i, LogDebug, makeDigiSimLinks_, min(), missCalibrate(), GeomDetEnumerators::P2OTB, GeomDet::subDetector(), theAdcFullScale, theAdcFullScaleStack, theElectronPerADC, theThresholdInE_BPix, theThresholdInE_BPix_L1, and theThresholdInE_FPix.

Referenced by digitize().

1247  {
1248 
1249 #ifdef TP_DEBUG
1250  LogDebug ("Pixel Digitizer") << " make digis "<<" "
1251  << " pixel threshold FPix" << theThresholdInE_FPix << " "
1252  << " pixel threshold BPix" << theThresholdInE_BPix << " "
1253  << " pixel threshold BPix Layer1" << theThresholdInE_BPix_L1 << " "
1254  << " List pixels passing threshold ";
1255 #endif
1256 
1257  // Loop over hit pixels
1258 
1259  signalMaps::const_iterator it = _signal.find(detID);
1260  if (it == _signal.end()) {
1261  return;
1262  }
1263 
1264  const signal_map_type& theSignal = (*it).second;
1265 
1266  for (signal_map_const_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
1267 
1268  float signalInElectrons = (*i).second ; // signal in electrons
1269 
1270  // Do the miss calibration for calibration studies only.
1271  //if(doMissCalibrate) signalInElectrons = missCalibrate(signalInElectrons)
1272 
1273  // Do only for pixels above threshold
1274 
1275  if( signalInElectrons >= thePixelThresholdInE) { // check threshold
1276 
1277  int chan = (*i).first; // channel number
1278  std::pair<int,int> ip = PixelDigi::channelToPixel(chan);
1279  int adc=0; // ADC count as integer
1280 
1281  // Do the miss calibration for calibration studies only.
1282  if(doMissCalibrate) {
1283  int row = ip.first; // X in row
1284  int col = ip.second; // Y is in col
1285  adc = int(missCalibrate(detID, pixdet, col, row, signalInElectrons)); //full misscalib.
1286  } else { // Just do a simple electron->adc conversion
1287  adc = int( signalInElectrons / theElectronPerADC ); // calibrate gain
1288  }
1289  adc = std::min(adc, theAdcFullScale); // Check maximum value
1290 // Calculate layerIndex
1292  if(pixdet->subDetector() == GeomDetEnumerators::SubDetector::P2OTB) { // Phase 2 OT Barrel only
1293  // Set to 1 if over the threshold
1294  if (theAdcFullScaleStack==1) {adc=1;}
1295  // Make it a linear fit to the full scale of the normal adc count. Start new adc from 1 not zero.
1297  }
1298  } // Only enter this if the Adc changes for the outer layers
1299 #ifdef TP_DEBUG
1300  LogDebug ("Pixel Digitizer")
1301  << (*i).first << " " << (*i).second << " " << signalInElectrons
1302  << " " << adc << ip.first << " " << ip.second ;
1303 #endif
1304 
1305  // Load digis
1306  digis.emplace_back(ip.first, ip.second, adc);
1307 
1308  if (makeDigiSimLinks_ && (*i).second.hitInfo()!=0) {
1309  //digilink
1310  if((*i).second.trackIds().size()>0){
1311  simlink_map simi;
1312  unsigned int il=0;
1313  for( std::vector<unsigned int>::const_iterator itid = (*i).second.trackIds().begin();
1314  itid != (*i).second.trackIds().end(); ++itid) {
1315  simi[*itid].push_back((*i).second.individualampl()[il]);
1316  il++;
1317  }
1318 
1319  //sum the contribution of the same trackid
1320  for( simlink_map::iterator simiiter=simi.begin();
1321  simiiter!=simi.end();
1322  simiiter++){
1323 
1324  float sum_samechannel=0;
1325  for (unsigned int iii=0;iii<(*simiiter).second.size();iii++){
1326  sum_samechannel+=(*simiiter).second[iii];
1327  }
1328  float fraction=sum_samechannel/(*i).second;
1329  if(fraction>1.) fraction=1.;
1330  simlinks.emplace_back((*i).first, (*simiiter).first, (*i).second.hitIndex(), (*i).second.tofBin(), (*i).second.eventId(), fraction);
1331  }
1332  }
1333  }
1334  }
1335  }
1336 }
int adc(sample_type sample)
get the ADC sample (12 bits)
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
signal_map_type::const_iterator signal_map_const_iterator
std::map< unsigned int, std::vector< float >, std::less< unsigned int > > simlink_map
float missCalibrate(uint32_t detID, const PixelGeomDetUnit *pixdet, int col, int row, float amp) const
T min(T a, T b)
Definition: MathUtil.h:58
std::map< int, Amplitude, std::less< int > > signal_map_type
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:62
int col
Definition: cuy.py:1008
virtual SubDetector subDetector() const
Which subdetector.
Definition: GeomDet.cc:49
float SiPixelDigitizerAlgorithm::missCalibrate ( uint32_t  detID,
const PixelGeomDetUnit pixdet,
int  col,
int  row,
float  amp 
) const
private

Definition at line 1659 of file SiPixelDigitizerAlgorithm.cc.

References BPix_p0, BPix_p1, BPix_p2, BPix_p3, electronsPerVCAL, electronsPerVCAL_Offset, Exception, FPix_p0, FPix_p1, FPix_p2, FPix_p3, GeomDetType::isBarrel(), GeomDetType::isTrackerPixel(), p1, p2, p3, and PixelGeomDetUnit::type().

Referenced by make_digis().

1660  {
1661  // Central values
1662  //const float p0=0.00352, p1=0.868, p2=112., p3=113.; // pix(0,0,0)
1663  // const float p0=0.00382, p1=0.886, p2=112.7, p3=113.0; // average roc=0
1664  //const float p0=0.00492, p1=1.998, p2=90.6, p3=134.1; // average roc=6
1665  // Smeared (rms)
1666  //const float s0=0.00020, s1=0.051, s2=5.4, s3=4.4; // average roc=0
1667  //const float s0=0.00015, s1=0.043, s2=3.2, s3=3.1; // col average roc=0
1668 
1669  // Make 2 sets of parameters for Fpix and BPIx:
1670 
1671  float p0=0.0;
1672  float p1=0.0;
1673  float p2=0.0;
1674  float p3=0.0;
1675 
1676  if(pixdet->type().isTrackerPixel() && pixdet->type().isBarrel()){// barrel layers
1677  p0 = BPix_p0;
1678  p1 = BPix_p1;
1679  p2 = BPix_p2;
1680  p3 = BPix_p3;
1681  } else if(pixdet->type().isTrackerPixel()) {// forward disks
1682  p0 = FPix_p0;
1683  p1 = FPix_p1;
1684  p2 = FPix_p2;
1685  p3 = FPix_p3;
1686  } else {
1687  throw cms::Exception("NotAPixelGeomDetUnit") << "Not a pixel geomdet unit" << detID;
1688  }
1689 
1690  // const float electronsPerVCAL = 65.5; // our present VCAL calibration (feb 2009)
1691  // const float electronsPerVCAL_Offset = -414.0; // our present VCAL calibration (feb 2009)
1692  float newAmp = 0.; //Modified signal
1693 
1694  // Convert electrons to VCAL units
1695  float signal = (signalInElectrons-electronsPerVCAL_Offset)/electronsPerVCAL;
1696 
1697  // Simulate the analog response with fixed parametrization
1698  newAmp = p3 + p2 * tanh(p0*signal - p1);
1699 
1700 
1701  // Use the pixel-by-pixel calibrations
1702  //transform to ROC index coordinates
1703  //int chipIndex=0, colROC=0, rowROC=0;
1704  //std::auto_ptr<PixelIndices> pIndexConverter(new PixelIndices(numColumns,numRows));
1705  //pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
1706 
1707  // Use calibration from a file
1708  //int chanROC = PixelIndices::pixelToChannelROC(rowROC,colROC); // use ROC coordinates
1709  //float pp0=0, pp1=0,pp2=0,pp3=0;
1710  //map<int,CalParameters,std::less<int> >::const_iterator it=calmap.find(chanROC);
1711  //CalParameters y = (*it).second;
1712  //pp0 = y.p0;
1713  //pp1 = y.p1;
1714  //pp2 = y.p2;
1715  //pp3 = y.p3;
1716 
1717  //
1718  // Use random smearing
1719  // Randomize the pixel response
1720  //float pp0 = RandGaussQ::shoot(p0,s0);
1721  //float pp1 = RandGaussQ::shoot(p1,s1);
1722  //float pp2 = RandGaussQ::shoot(p2,s2);
1723  //float pp3 = RandGaussQ::shoot(p3,s3);
1724 
1725  //newAmp = pp3 + pp2 * tanh(pp0*signal - pp1); // Final signal
1726 
1727  //cout<<" misscalibrate "<<col<<" "<<row<<" "<<chipIndex<<" "<<colROC<<" "
1728  // <<rowROC<<" "<<signalInElectrons<<" "<<signal<<" "<<newAmp<<" "
1729  // <<(signalInElectrons/theElectronPerADC)<<std::endl;
1730 
1731  return newAmp;
1732 }
bool isBarrel() const
Definition: GeomDetType.cc:13
virtual const GeomDetType & type() const override
bool isTrackerPixel() const
Definition: GeomDetType.cc:29
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
double p3[4]
Definition: TauolaWrapper.h:91
void SiPixelDigitizerAlgorithm::module_killing_conf ( uint32_t  detID)
private

Definition at line 1838 of file SiPixelDigitizerAlgorithm.cc.

References _signal, PixelDigi::channelToPixel(), DeadModules, cond::rpcobgas::detid, i, Module, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by digitize().

1838  {
1839 
1840  bool isbad=false;
1841 
1842  Parameters::const_iterator itDeadModules=DeadModules.begin();
1843 
1844  int detid = detID;
1845  for(; itDeadModules != DeadModules.end(); ++itDeadModules){
1846  int Dead_detID = itDeadModules->getParameter<int>("Dead_detID");
1847  if(detid == Dead_detID){
1848  isbad=true;
1849  break;
1850  }
1851  }
1852 
1853  if(!isbad)
1854  return;
1855 
1856  signal_map_type& theSignal = _signal[detID];
1857 
1858  std::string Module = itDeadModules->getParameter<std::string>("Module");
1859 
1860  if(Module=="whole"){
1861  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
1862  i->second.set(0.); // reset amplitude
1863  }
1864  }
1865 
1866  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
1867  std::pair<int,int> ip = PixelDigi::channelToPixel(i->first);//get pixel pos
1868 
1869  if(Module=="tbmA" && ip.first>=80 && ip.first<=159){
1870  i->second.set(0.);
1871  }
1872 
1873  if( Module=="tbmB" && ip.first<=79){
1874  i->second.set(0.);
1875  }
1876  }
1877 }
int i
Definition: DBlmapReader.cc:9
#define Module(md)
Definition: vmac.h:201
signal_map_type::iterator signal_map_iterator
std::map< int, Amplitude, std::less< int > > signal_map_type
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:62
void SiPixelDigitizerAlgorithm::module_killing_DB ( uint32_t  detID)
private

Definition at line 1879 of file SiPixelDigitizerAlgorithm.cc.

References _signal, PixelDigi::channelToPixel(), SiPixelQuality::disabledModuleType::errorType, i, sipixelobjects::PixelROC::idInDetUnit(), j, map_, fed_dqm_sourceclient-live_cfg::path, edm::ESHandle< class >::product(), SiPixelBadModule_, and sipixelobjects::PixelROC::toGlobal().

Referenced by digitize().

1879  {
1880 // Not SLHC safe for now
1881 
1882  bool isbad=false;
1883 
1884  std::vector<SiPixelQuality::disabledModuleType>disabledModules = SiPixelBadModule_->getBadComponentList();
1885 
1887 
1888  for (size_t id=0;id<disabledModules.size();id++)
1889  {
1890  if(detID==disabledModules[id].DetID){
1891  isbad=true;
1892  badmodule = disabledModules[id];
1893  break;
1894  }
1895  }
1896 
1897  if(!isbad)
1898  return;
1899 
1900  signal_map_type& theSignal = _signal[detID];
1901 
1902  //std::cout<<"Hit in: "<< detID <<" errorType "<< badmodule.errorType<<" BadRocs="<<std::hex<<SiPixelBadModule_->getBadRocs(detID)<<dec<<" "<<std::endl;
1903  if(badmodule.errorType == 0){ // this is a whole dead module.
1904 
1905  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
1906  i->second.set(0.); // reset amplitude
1907  }
1908  }
1909  else { // all other module types: half-modules and single ROCs.
1910  // Get Bad ROC position:
1911  //follow the example of getBadRocPositions in CondFormats/SiPixelObjects/src/SiPixelQuality.cc
1912  std::vector<GlobalPixel> badrocpositions (0);
1913  for(unsigned int j = 0; j < 16; j++){
1914  if(SiPixelBadModule_->IsRocBad(detID, j) == true){
1915 
1916  std::vector<CablingPathToDetUnit> path = map_.product()->pathToDetUnit(detID);
1917  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
1918  for (IT it = path.begin(); it != path.end(); ++it) {
1919  const PixelROC* myroc = map_.product()->findItem(*it);
1920  if( myroc->idInDetUnit() == j) {
1921  LocalPixel::RocRowCol local = { 39, 25}; //corresponding to center of ROC row, col
1922  GlobalPixel global = myroc->toGlobal( LocalPixel(local) );
1923  badrocpositions.push_back(global);
1924  break;
1925  }
1926  }
1927  }
1928  }// end of getBadRocPositions
1929 
1930 
1931  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
1932  std::pair<int,int> ip = PixelDigi::channelToPixel(i->first);//get pixel pos
1933 
1934  for(std::vector<GlobalPixel>::const_iterator it = badrocpositions.begin(); it != badrocpositions.end(); ++it){
1935  if(it->row >= 80 && ip.first >= 80 ){
1936  if((fabs(ip.second - it->col) < 26) ) {i->second.set(0.);}
1937  else if(it->row==120 && ip.second-it->col==26){i->second.set(0.);}
1938  else if(it->row==119 && it->col-ip.second==26){i->second.set(0.);}
1939  }
1940  else if(it->row < 80 && ip.first < 80 ){
1941  if((fabs(ip.second - it->col) < 26) ){i->second.set(0.);}
1942  else if(it->row==40 && ip.second-it->col==26){i->second.set(0.);}
1943  else if(it->row==39 && it->col-ip.second==26){i->second.set(0.);}
1944  }
1945  }
1946  }
1947  }
1948 }
int i
Definition: DBlmapReader.cc:9
edm::ESHandle< SiPixelFedCablingMap > map_
identify pixel inside single ROC
Definition: LocalPixel.h:7
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:39
int j
Definition: DBlmapReader.cc:9
std::vector< LinkConnSpec >::const_iterator IT
signal_map_type::iterator signal_map_iterator
std::map< int, Amplitude, std::less< int > > signal_map_type
edm::ESHandle< SiPixelQuality > SiPixelBadModule_
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:62
T const * product() const
Definition: ESHandle.h:86
row and collumn in ROC representation
Definition: LocalPixel.h:15
GlobalPixel toGlobal(const LocalPixel &loc) const
Definition: PixelROC.h:58
float SiPixelDigitizerAlgorithm::pixel_aging ( const PixelAging aging,
const PixelGeomDetUnit pixdet,
const TrackerTopology tTopo 
) const
private

Definition at line 1606 of file SiPixelDigitizerAlgorithm.cc.

References SiPixelDigitizerAlgorithm::PixelAging::FPixIndex, GeomDet::geographicalId(), TrackerTopology::layer(), LogDebug, GeomDetEnumerators::P1PXB, GeomDetEnumerators::P1PXEC, GeomDetEnumerators::P2OTB, GeomDetEnumerators::P2OTEC, GeomDetEnumerators::P2PXEC, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, DetId::rawId(), GeomDet::subDetector(), and SiPixelDigitizerAlgorithm::PixelAging::thePixelPseudoRadDamage.

Referenced by drift().

1608  {
1609 
1610  uint32_t detID= pixdet->geographicalId().rawId();
1611 
1612 
1613  // Predefined damage parameter (no aging)
1614  float pseudoRadDamage = 0.0;
1615 
1616  // setup the chip indices conversion
1618  pixdet->subDetector() == GeomDetEnumerators::SubDetector::P1PXB){// barrel layers
1619  int layerIndex=tTopo->layer(detID);
1620 
1621  pseudoRadDamage = aging.thePixelPseudoRadDamage[layerIndex-1];
1622 
1623  // std::cout << "pixel_aging: " << std::endl;
1624  // std::cout << "Subid " << Subid << " layerIndex " << layerIndex << " ladder " << tTopo->pxbLadder(detID) << " module " << tTopo->pxbModule(detID) << std::endl;
1625 
1628  pixdet->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC) { // forward disks
1629  unsigned int diskIndex=tTopo->layer(detID)+aging.FPixIndex; // Use diskIndex-1 later to stay consistent with BPix
1630 
1631  pseudoRadDamage = aging.thePixelPseudoRadDamage[diskIndex-1];
1632 
1633  // std::cout << "pixel_aging: " << std::endl;
1634  // std::cout << "Subid " << Subid << " diskIndex " << diskIndex << std::endl;
1636  // if phase 2 OT hardcoded value as it has always been
1637  pseudoRadDamage = 0.;
1638  } // if barrel/forward
1639 
1640  // std::cout << " pseudoRadDamage " << pseudoRadDamage << std::endl;
1641  // std::cout << " end pixel_aging " << std::endl;
1642 
1643  return pseudoRadDamage;
1644 #ifdef TP_DEBUG
1645  LogDebug ("Pixel Digitizer") << " enter pixel_aging " << pseudoRadDamage;
1646 #endif
1647 
1648 }
#define LogDebug(id)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
unsigned int layer(const DetId &id) const
virtual SubDetector subDetector() const
Which subdetector.
Definition: GeomDet.cc:49
void SiPixelDigitizerAlgorithm::pixel_inefficiency ( const PixelEfficiencies eff,
const PixelGeomDetUnit pixdet,
const TrackerTopology tTopo,
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 1454 of file SiPixelDigitizerAlgorithm.cc.

References _signal, PixelDigi::channelToPixel(), SiPixelDigitizerAlgorithm::PixelEfficiencies::ChipGeomFactors, cuy::col, SiPixelDigitizerAlgorithm::PixelEfficiencies::ColGeomFactors, SiPixelDigitizerAlgorithm::PixelEfficiencies::FPixIndex, SiPixelDigitizerAlgorithm::PixelEfficiencies::FromConfig, GeomDet::geographicalId(), i, SiPixelDigitizerAlgorithm::PixelEfficiencies::iPU, TrackerTopology::layer(), LogDebug, python.rootplot.argparse::module, PixelTopology::ncolumns(), PixelTopology::nrows(), NumberOfBarrelLayers, GeomDetEnumerators::P1PXB, GeomDetEnumerators::P1PXEC, GeomDetEnumerators::P2OTB, GeomDetEnumerators::P2OTEC, GeomDetEnumerators::P2PXEC, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, SiPixelDigitizerAlgorithm::PixelEfficiencies::PixelGeomFactors, SiPixelDigitizerAlgorithm::PixelEfficiencies::pu_scale, TrackerTopology::pxbLadder(), TrackerTopology::pxbModule(), TrackerTopology::pxfModule(), TrackerTopology::pxfPanel(), rand(), DetId::rawId(), PixelGeomDetUnit::specificTopology(), GeomDet::subDetector(), SiPixelDigitizerAlgorithm::PixelEfficiencies::theInnerEfficiency_FPix, SiPixelDigitizerAlgorithm::PixelEfficiencies::theLadderEfficiency_BPix, SiPixelDigitizerAlgorithm::PixelEfficiencies::theModuleEfficiency_BPix, SiPixelDigitizerAlgorithm::PixelEfficiencies::theOuterEfficiency_FPix, SiPixelDigitizerAlgorithm::PixelEfficiencies::thePixelChipEfficiency, SiPixelDigitizerAlgorithm::PixelEfficiencies::thePixelColEfficiency, and SiPixelDigitizerAlgorithm::PixelEfficiencies::thePixelEfficiency.

Referenced by digitize().

1457  {
1458 
1459  uint32_t detID= pixdet->geographicalId().rawId();
1460  signal_map_type& theSignal = _signal[detID];
1461  const PixelTopology* topol=&pixdet->specificTopology();
1462  int numColumns = topol->ncolumns(); // det module number of cols&rows
1463  int numRows = topol->nrows();
1464 
1465  // Predefined efficiencies
1466  double pixelEfficiency = 1.0;
1467  double columnEfficiency = 1.0;
1468  double chipEfficiency = 1.0;
1469 
1470  if (eff.FromConfig) {
1471  // setup the chip indices conversion
1473  pixdet->subDetector()==GeomDetEnumerators::SubDetector::P1PXB){// barrel layers
1474  int layerIndex=tTopo->layer(detID);
1475  pixelEfficiency = eff.thePixelEfficiency[layerIndex-1];
1476  columnEfficiency = eff.thePixelColEfficiency[layerIndex-1];
1477  chipEfficiency = eff.thePixelChipEfficiency[layerIndex-1];
1478  //std::cout <<"Using BPix columnEfficiency = "<<columnEfficiency<< " for layer = "<<layerIndex <<"\n";
1479  // This should never happen, but only check if it is not an upgrade geometry
1480  if (NumberOfBarrelLayers==3){
1481  if(numColumns>416) LogWarning ("Pixel Geometry") <<" wrong columns in barrel "<<numColumns;
1482  if(numRows>160) LogWarning ("Pixel Geometry") <<" wrong rows in barrel "<<numRows;
1483 
1484  int ladder=tTopo->pxbLadder(detID);
1485  int module=tTopo->pxbModule(detID);
1486  if (module<=4) module=5-module;
1487  else module-=4;
1488 
1489  columnEfficiency *= eff.theLadderEfficiency_BPix[layerIndex-1][ladder-1]*eff.theModuleEfficiency_BPix[layerIndex-1][module-1]*eff.pu_scale[layerIndex-1];
1490  }
1493  pixdet->subDetector()==GeomDetEnumerators::SubDetector::P2PXEC){ // forward disks
1494 
1495  unsigned int diskIndex=tTopo->layer(detID)+eff.FPixIndex; // Use diskIndex-1 later to stay consistent with BPix
1496  unsigned int panelIndex=tTopo->pxfPanel(detID);
1497  unsigned int moduleIndex=tTopo->pxfModule(detID);
1498  //if (eff.FPixIndex>diskIndex-1){throw cms::Exception("Configuration") <<"SiPixelDigitizer is using the wrong efficiency value. index = "
1499  // <<diskIndex-1<<" , MinIndex = "<<eff.FPixIndex<<" ... "<<tTopo->pxfDisk(detID);}
1500  pixelEfficiency = eff.thePixelEfficiency[diskIndex-1];
1501  columnEfficiency = eff.thePixelColEfficiency[diskIndex-1];
1502  chipEfficiency = eff.thePixelChipEfficiency[diskIndex-1];
1503  //std::cout <<"Using FPix columnEfficiency = "<<columnEfficiency<<" for Disk = "<< tTopo->pxfDisk(detID)<<"\n";
1504  // Sometimes the forward pixels have wrong size,
1505  // this crashes the index conversion, so exit, but only check if it is not an upgrade geometry
1506  if (NumberOfBarrelLayers==3){ // whether it is the present or the phase 1 detector can be checked using GeomDetEnumerators::SubDetector
1507  if(numColumns>260 || numRows>160) {
1508  if(numColumns>260) LogWarning ("Pixel Geometry") <<" wrong columns in endcaps "<<numColumns;
1509  if(numRows>160) LogWarning ("Pixel Geometry") <<" wrong rows in endcaps "<<numRows;
1510  return;
1511  }
1512  if ((panelIndex==1 && (moduleIndex==1 || moduleIndex==2)) || (panelIndex==2 && moduleIndex==1)) { //inner modules
1513  columnEfficiency*=eff.theInnerEfficiency_FPix[diskIndex-1]*eff.pu_scale[3];
1514  } else { //outer modules
1515  columnEfficiency*=eff.theOuterEfficiency_FPix[diskIndex-1]*eff.pu_scale[4];
1516  }
1517  } // current detector, forward
1519  // If phase 2 outer tracker, hardcoded values as they have been so far
1520  pixelEfficiency = 0.999;
1521  columnEfficiency = 0.999;
1522  chipEfficiency = 0.999;
1523  } // if barrel/forward
1524  } else { // Load precomputed factors from Database
1525  pixelEfficiency = eff.PixelGeomFactors.at(detID);
1526  columnEfficiency = eff.ColGeomFactors.at(detID)*eff.pu_scale[eff.iPU.at(detID)];
1527  chipEfficiency = eff.ChipGeomFactors.at(detID);
1528  }
1529 
1530 #ifdef TP_DEBUG
1531  LogDebug ("Pixel Digitizer") << " enter pixel_inefficiency " << pixelEfficiency << " "
1532  << columnEfficiency << " " << chipEfficiency;
1533 #endif
1534 
1535  // Initilize the index converter
1536  //PixelIndices indexConverter(numColumns,numRows);
1537  std::auto_ptr<PixelIndices> pIndexConverter(new PixelIndices(numColumns,numRows));
1538 
1539  int chipIndex = 0;
1540  int rowROC = 0;
1541  int colROC = 0;
1542  std::map<int, int, std::less<int> >chips, columns;
1543  std::map<int, int, std::less<int> >::iterator iter;
1544 
1545  // Find out the number of columns and rocs hits
1546  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
1547  for (signal_map_const_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
1548 
1549  int chan = i->first;
1550  std::pair<int,int> ip = PixelDigi::channelToPixel(chan);
1551  int row = ip.first; // X in row
1552  int col = ip.second; // Y is in col
1553  //transform to ROC index coordinates
1554  pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
1555  int dColInChip = pIndexConverter->DColumn(colROC); // get ROC dcol from ROC col
1556  //dcol in mod
1557  int dColInDet = pIndexConverter->DColumnInModule(dColInChip,chipIndex);
1558 
1559  chips[chipIndex]++;
1560  columns[dColInDet]++;
1561  }
1562 
1563  // Delete some ROC hits.
1564  for ( iter = chips.begin(); iter != chips.end() ; iter++ ) {
1565  //float rand = RandFlat::shoot();
1566  float rand = CLHEP::RandFlat::shoot(engine);
1567  if( rand > chipEfficiency ) chips[iter->first]=0;
1568  }
1569 
1570  // Delete some Dcol hits.
1571  for ( iter = columns.begin(); iter != columns.end() ; iter++ ) {
1572  //float rand = RandFlat::shoot();
1573  float rand = CLHEP::RandFlat::shoot(engine);
1574  if( rand > columnEfficiency ) columns[iter->first]=0;
1575  }
1576 
1577  // Now loop again over pixels to kill some of them.
1578  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
1579  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
1580 
1581  // int chan = i->first;
1582  std::pair<int,int> ip = PixelDigi::channelToPixel(i->first);//get pixel pos
1583  int row = ip.first; // X in row
1584  int col = ip.second; // Y is in col
1585  //transform to ROC index coordinates
1586  pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
1587  int dColInChip = pIndexConverter->DColumn(colROC); //get ROC dcol from ROC col
1588  //dcol in mod
1589  int dColInDet = pIndexConverter->DColumnInModule(dColInChip,chipIndex);
1590 
1591  //float rand = RandFlat::shoot();
1592  float rand = CLHEP::RandFlat::shoot(engine);
1593  if( chips[chipIndex]==0 || columns[dColInDet]==0
1594  || rand>pixelEfficiency ) {
1595  // make pixel amplitude =0, pixel will be lost at clusterization
1596  i->second.set(0.); // reset amplitude,
1597  } // end if
1598 
1599  } // end pixel loop
1600 } // end pixel_indefficiency
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
signal_map_type::const_iterator signal_map_const_iterator
virtual int ncolumns() const =0
unsigned int pxbLadder(const DetId &id) const
virtual int nrows() const =0
unsigned int pxbModule(const DetId &id) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
signal_map_type::iterator signal_map_iterator
unsigned int pxfModule(const DetId &id) const
std::map< int, Amplitude, std::less< int > > signal_map_type
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:62
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
unsigned int layer(const DetId &id) const
Signal rand(Signal arg)
Definition: vlib.cc:442
int col
Definition: cuy.py:1008
virtual SubDetector subDetector() const
Which subdetector.
Definition: GeomDet.cc:49
Definition: vlib.h:208
unsigned int pxfPanel(const DetId &id) const
void SiPixelDigitizerAlgorithm::pixel_inefficiency_db ( uint32_t  detID)
private

Definition at line 1815 of file SiPixelDigitizerAlgorithm.cc.

References _signal, PixelDigi::channelToPixel(), cuy::col, i, and theSiPixelGainCalibrationService_.

Referenced by digitize().

1815  {
1816 
1817  signal_map_type& theSignal = _signal[detID];
1818 
1819  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
1820  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
1821 
1822  // int chan = i->first;
1823  std::pair<int,int> ip = PixelDigi::channelToPixel(i->first);//get pixel pos
1824  int row = ip.first; // X in row
1825  int col = ip.second; // Y is in col
1826  //transform to ROC index coordinates
1827  if(theSiPixelGainCalibrationService_->isDead(detID, col, row)){
1828  // std::cout << "now in isdead check, row " << detID << " " << col << "," << row << std::std::endl;
1829  // make pixel amplitude =0, pixel will be lost at clusterization
1830  i->second.set(0.); // reset amplitude,
1831  } // end if
1832  } // end pixel loop
1833 } // end pixel_indefficiency
int i
Definition: DBlmapReader.cc:9
const std::unique_ptr< SiPixelGainCalibrationOfflineSimService > theSiPixelGainCalibrationService_
signal_map_type::iterator signal_map_iterator
std::map< int, Amplitude, std::less< int > > signal_map_type
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:62
int col
Definition: cuy.py:1008
void SiPixelDigitizerAlgorithm::primary_ionization ( const PSimHit hit,
std::vector< EnergyDepositUnit > &  ionization_points,
CLHEP::HepRandomEngine *  engine 
) const
private

Definition at line 758 of file SiPixelDigitizerAlgorithm.cc.

References relval_parameters_module::energy, PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::exitPoint(), fluctuateCharge, fluctuateEloss(), GeVperElectron, i, LogDebug, PV3DBase< T, PVType, FrameType >::mag(), PSimHit::pabs(), PSimHit::particleType(), sysUtil::pid, point, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by accumulateSimHits().

758  {
759 
760  // Straight line approximation for trajectory inside active media
761 
762  const float SegmentLength = 0.0010; //10microns in cm
763  float energy;
764 
765  // Get the 3D segment direction vector
766  LocalVector direction = hit.exitPoint() - hit.entryPoint();
767 
768  float eLoss = hit.energyLoss(); // Eloss in GeV
769  float length = direction.mag(); // Track length in Silicon
770 
771  int NumberOfSegments = int ( length / SegmentLength); // Number of segments
772  if(NumberOfSegments < 1) NumberOfSegments = 1;
773 
774 #ifdef TP_DEBUG
775  LogDebug ("Pixel Digitizer")
776  << " enter primary_ionzation " << NumberOfSegments
777  << " shift = "
778  << (hit.exitPoint().x()-hit.entryPoint().x()) << " "
779  << (hit.exitPoint().y()-hit.entryPoint().y()) << " "
780  << (hit.exitPoint().z()-hit.entryPoint().z()) << " "
781  << hit.particleType() <<" "<< hit.pabs() ;
782 #endif
783 
784  float* elossVector = new float[NumberOfSegments]; // Eloss vector
785 
786  if( fluctuateCharge ) {
787  //MP DA RIMUOVERE ASSOLUTAMENTE
788  int pid = hit.particleType();
789  //int pid=211; // assume it is a pion
790 
791  float momentum = hit.pabs();
792  // Generate fluctuated charge points
793  fluctuateEloss(pid, momentum, eLoss, length, NumberOfSegments,
794  elossVector, engine);
795  }
796 
797  ionization_points.resize( NumberOfSegments); // set size
798 
799  // loop over segments
800  for ( int i = 0; i != NumberOfSegments; i++) {
801  // Divide the segment into equal length subsegments
802  Local3DPoint point = hit.entryPoint() +
803  float((i+0.5)/NumberOfSegments) * direction;
804 
805  if( fluctuateCharge )
806  energy = elossVector[i]/GeVperElectron; // Convert charge to elec.
807  else
808  energy = hit.energyLoss()/GeVperElectron/float(NumberOfSegments);
809 
810  EnergyDepositUnit edu( energy, point); //define position,energy point
811  ionization_points[i] = edu; // save
812 
813 #ifdef TP_DEBUG
814  LogDebug ("Pixel Digitizer")
815  << i << " " << ionization_points[i].x() << " "
816  << ionization_points[i].y() << " "
817  << ionization_points[i].z() << " "
818  << ionization_points[i].energy();
819 #endif
820 
821  } // end for loop
822 
823  delete[] elossVector;
824 
825 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV3DBase.h:63
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
T mag() const
Definition: PV3DBase.h:67
T z() const
Definition: PV3DBase.h:64
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:63
void fluctuateEloss(int particleId, float momentum, float eloss, float length, int NumberOfSegments, float elossVector[], CLHEP::HepRandomEngine *) const
tuple pid
Definition: sysUtil.py:22
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:75
int particleType() const
Definition: PSimHit.h:85
T x() const
Definition: PV3DBase.h:62
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
*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 SiPixelDigitizerAlgorithm::_signal
private
const bool SiPixelDigitizerAlgorithm::addChargeVCALSmearing
private

Definition at line 362 of file SiPixelDigitizerAlgorithm.h.

Referenced by add_noise().

const bool SiPixelDigitizerAlgorithm::addNoise
private

Definition at line 361 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const bool SiPixelDigitizerAlgorithm::addNoisyPixels
private

Definition at line 363 of file SiPixelDigitizerAlgorithm.h.

Referenced by add_noise().

const bool SiPixelDigitizerAlgorithm::AddPixelAging
private

Definition at line 376 of file SiPixelDigitizerAlgorithm.h.

Referenced by drift().

const bool SiPixelDigitizerAlgorithm::AddPixelInefficiency
private
const bool SiPixelDigitizerAlgorithm::addThresholdSmearing
private

Definition at line 368 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const bool SiPixelDigitizerAlgorithm::alpha2Order
private

Definition at line 316 of file SiPixelDigitizerAlgorithm.h.

Referenced by drift(), and DriftDirection().

const float SiPixelDigitizerAlgorithm::BPix_p0
private

Definition at line 354 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const float SiPixelDigitizerAlgorithm::BPix_p1
private

Definition at line 355 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const float SiPixelDigitizerAlgorithm::BPix_p2
private

Definition at line 356 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const float SiPixelDigitizerAlgorithm::BPix_p3
private

Definition at line 357 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const std::map<int,CalParameters,std::less<int> > SiPixelDigitizerAlgorithm::calmap
private

Definition at line 391 of file SiPixelDigitizerAlgorithm.h.

Referenced by initCal().

const float SiPixelDigitizerAlgorithm::ClusterWidth
private

Definition at line 321 of file SiPixelDigitizerAlgorithm.h.

Referenced by induce_signal().

const Parameters SiPixelDigitizerAlgorithm::DeadModules
private

Definition at line 306 of file SiPixelDigitizerAlgorithm.h.

Referenced by module_killing_conf().

const float SiPixelDigitizerAlgorithm::Dist300
private

Definition at line 315 of file SiPixelDigitizerAlgorithm.h.

Referenced by drift().

const bool SiPixelDigitizerAlgorithm::doMissCalibrate
private

Definition at line 371 of file SiPixelDigitizerAlgorithm.h.

Referenced by make_digis().

const double SiPixelDigitizerAlgorithm::electronsPerVCAL
private

Definition at line 342 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const double SiPixelDigitizerAlgorithm::electronsPerVCAL_Offset
private

Definition at line 343 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const std::unique_ptr<SiG4UniversalFluctuation> SiPixelDigitizerAlgorithm::fluctuate
private

Definition at line 387 of file SiPixelDigitizerAlgorithm.h.

Referenced by fluctuateEloss().

const bool SiPixelDigitizerAlgorithm::fluctuateCharge
private

Definition at line 364 of file SiPixelDigitizerAlgorithm.h.

Referenced by primary_ionization().

const float SiPixelDigitizerAlgorithm::FPix_p0
private

Definition at line 350 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const float SiPixelDigitizerAlgorithm::FPix_p1
private

Definition at line 351 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const float SiPixelDigitizerAlgorithm::FPix_p2
private

Definition at line 352 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const float SiPixelDigitizerAlgorithm::FPix_p3
private

Definition at line 353 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

edm::ESHandle<TrackerGeometry> SiPixelDigitizerAlgorithm::geom_
private

Definition at line 83 of file SiPixelDigitizerAlgorithm.h.

Referenced by init_DynIneffDB().

const float SiPixelDigitizerAlgorithm::GeVperElectron
private

Definition at line 311 of file SiPixelDigitizerAlgorithm.h.

Referenced by primary_ionization().

const bool SiPixelDigitizerAlgorithm::makeDigiSimLinks_
private

Definition at line 299 of file SiPixelDigitizerAlgorithm.h.

Referenced by induce_signal(), and make_digis().

edm::ESHandle<SiPixelFedCablingMap> SiPixelDigitizerAlgorithm::map_
private

Definition at line 82 of file SiPixelDigitizerAlgorithm.h.

Referenced by module_killing_DB().

const int SiPixelDigitizerAlgorithm::NumberOfBarrelLayers
private
const int SiPixelDigitizerAlgorithm::NumberOfEndcapDisks
private
const PixelAging SiPixelDigitizerAlgorithm::pixelAging_
private

Definition at line 444 of file SiPixelDigitizerAlgorithm.h.

Referenced by drift().

PixelEfficiencies SiPixelDigitizerAlgorithm::pixelEfficiencies_
private

Definition at line 443 of file SiPixelDigitizerAlgorithm.h.

Referenced by calculateInstlumiFactor(), digitize(), and init_DynIneffDB().

const float SiPixelDigitizerAlgorithm::Sigma0
private

Definition at line 314 of file SiPixelDigitizerAlgorithm.h.

Referenced by drift().

edm::ESHandle<SiPixelQuality> SiPixelDigitizerAlgorithm::SiPixelBadModule_
private

Definition at line 79 of file SiPixelDigitizerAlgorithm.h.

Referenced by module_killing_DB().

edm::ESHandle<SiPixelDynamicInefficiency> SiPixelDigitizerAlgorithm::SiPixelDynamicInefficiency_
private

Definition at line 86 of file SiPixelDigitizerAlgorithm.h.

Referenced by init_DynIneffDB().

edm::ESHandle<SiPixelLorentzAngle> SiPixelDigitizerAlgorithm::SiPixelLorentzAngle_
private

Definition at line 76 of file SiPixelDigitizerAlgorithm.h.

Referenced by DriftDirection().

const float SiPixelDigitizerAlgorithm::tanLorentzAnglePerTesla_BPix
private

Definition at line 348 of file SiPixelDigitizerAlgorithm.h.

Referenced by DriftDirection().

const float SiPixelDigitizerAlgorithm::tanLorentzAnglePerTesla_FPix
private

Definition at line 347 of file SiPixelDigitizerAlgorithm.h.

Referenced by DriftDirection().

const int SiPixelDigitizerAlgorithm::theAdcFullScale
private

Definition at line 328 of file SiPixelDigitizerAlgorithm.h.

Referenced by make_digis(), and SiPixelDigitizerAlgorithm().

const int SiPixelDigitizerAlgorithm::theAdcFullScaleStack
private

Definition at line 329 of file SiPixelDigitizerAlgorithm.h.

Referenced by make_digis().

const float SiPixelDigitizerAlgorithm::theElectronPerADC
private

Definition at line 327 of file SiPixelDigitizerAlgorithm.h.

Referenced by make_digis(), and SiPixelDigitizerAlgorithm().

const float SiPixelDigitizerAlgorithm::theGainSmearing
private

Definition at line 372 of file SiPixelDigitizerAlgorithm.h.

const float SiPixelDigitizerAlgorithm::theNoiseInElectrons
private

Definition at line 330 of file SiPixelDigitizerAlgorithm.h.

Referenced by add_noise(), and digitize().

const std::unique_ptr<GaussianTailNoiseGenerator> SiPixelDigitizerAlgorithm::theNoiser
private

Definition at line 388 of file SiPixelDigitizerAlgorithm.h.

Referenced by add_noise().

const float SiPixelDigitizerAlgorithm::theOffsetSmearing
private

Definition at line 373 of file SiPixelDigitizerAlgorithm.h.

const float SiPixelDigitizerAlgorithm::theReadoutNoise
private

Definition at line 331 of file SiPixelDigitizerAlgorithm.h.

Referenced by add_noise().

const std::unique_ptr<SiPixelGainCalibrationOfflineSimService> SiPixelDigitizerAlgorithm::theSiPixelGainCalibrationService_
private

Definition at line 434 of file SiPixelDigitizerAlgorithm.h.

Referenced by pixel_inefficiency_db().

const float SiPixelDigitizerAlgorithm::theThresholdInE_BPix
private
const float SiPixelDigitizerAlgorithm::theThresholdInE_BPix_L1
private

Definition at line 336 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize(), make_digis(), and SiPixelDigitizerAlgorithm().

const float SiPixelDigitizerAlgorithm::theThresholdInE_FPix
private
const double SiPixelDigitizerAlgorithm::theThresholdSmearing_BPix
private

Definition at line 339 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const double SiPixelDigitizerAlgorithm::theThresholdSmearing_BPix_L1
private

Definition at line 340 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const double SiPixelDigitizerAlgorithm::theThresholdSmearing_FPix
private

Definition at line 338 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const float SiPixelDigitizerAlgorithm::theTofLowerCut
private

Definition at line 345 of file SiPixelDigitizerAlgorithm.h.

Referenced by accumulateSimHits().

const float SiPixelDigitizerAlgorithm::theTofUpperCut
private

Definition at line 346 of file SiPixelDigitizerAlgorithm.h.

Referenced by accumulateSimHits().

const double SiPixelDigitizerAlgorithm::tMax
private

Definition at line 383 of file SiPixelDigitizerAlgorithm.h.

Referenced by fluctuateEloss(), and SiPixelDigitizerAlgorithm().

const bool SiPixelDigitizerAlgorithm::use_deadmodule_DB_
private

Definition at line 303 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const bool SiPixelDigitizerAlgorithm::use_ineff_from_db_
private

Definition at line 301 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const bool SiPixelDigitizerAlgorithm::use_LorentzAngle_DB_
private

Definition at line 304 of file SiPixelDigitizerAlgorithm.h.

Referenced by DriftDirection().

const bool SiPixelDigitizerAlgorithm::use_module_killing_
private

Definition at line 302 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().