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 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

double _pu_scale [20]
 
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 double bunchScaleAt25
 
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_
 
const PixelEfficiencies pixelEfficiencies_
 
const float Sigma0
 
edm::ESHandle< SiPixelQualitySiPixelBadModule_
 
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 double theInstLumiScaleFactor
 
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 43 of file SiPixelDigitizerAlgorithm.h.

Member Typedef Documentation

Definition at line 277 of file SiPixelDigitizerAlgorithm.h.

Definition at line 278 of file SiPixelDigitizerAlgorithm.h.

typedef signal_map_type::const_iterator SiPixelDigitizerAlgorithm::signal_map_const_iterator
private

Definition at line 274 of file SiPixelDigitizerAlgorithm.h.

typedef signal_map_type::iterator SiPixelDigitizerAlgorithm::signal_map_iterator
private

Definition at line 273 of file SiPixelDigitizerAlgorithm.h.

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

Definition at line 272 of file SiPixelDigitizerAlgorithm.h.

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

Definition at line 276 of file SiPixelDigitizerAlgorithm.h.

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

Definition at line 275 of file SiPixelDigitizerAlgorithm.h.

Constructor & Destructor Documentation

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

Definition at line 124 of file SiPixelDigitizerAlgorithm.cc.

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

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

Definition at line 355 of file SiPixelDigitizerAlgorithm.cc.

References LogDebug.

355  {
356  LogDebug ("PixelDigitizer")<<"SiPixelDigitizerAlgorithm deleted";
357 }
#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 497 of file SiPixelDigitizerAlgorithm.cc.

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

504  {
505  // produce SignalPoint's for all SimHit's in detector
506  // Loop over hits
507 
508  uint32_t detId = pixdet->geographicalId().rawId();
509  size_t simHitGlobalIndex=inputBeginGlobalIndex; // This needs to stored to create the digi-sim link later
510  for (std::vector<PSimHit>::const_iterator ssbegin = inputBegin; ssbegin != inputEnd; ++ssbegin, ++simHitGlobalIndex) {
511  // skip hits not in this detector.
512  if((*ssbegin).detUnitId() != detId) {
513  continue;
514  }
515 
516 #ifdef TP_DEBUG
517  LogDebug ("Pixel Digitizer")
518  << (*ssbegin).particleType() << " " << (*ssbegin).pabs() << " "
519  << (*ssbegin).energyLoss() << " " << (*ssbegin).tof() << " "
520  << (*ssbegin).trackId() << " " << (*ssbegin).processType() << " "
521  << (*ssbegin).detUnitId()
522  << (*ssbegin).entryPoint() << " " << (*ssbegin).exitPoint() ;
523 #endif
524 
525 
526  std::vector<EnergyDepositUnit> ionization_points;
527  std::vector<SignalPoint> collection_points;
528 
529  // fill collection_points for this SimHit, indpendent of topology
530  // Check the TOF cut
531  if ( ((*ssbegin).tof() - pixdet->surface().toGlobal((*ssbegin).localPosition()).mag()/30.)>= theTofLowerCut &&
532  ((*ssbegin).tof()- pixdet->surface().toGlobal((*ssbegin).localPosition()).mag()/30.) <= theTofUpperCut ) {
533  primary_ionization(*ssbegin, ionization_points, engine); // fills _ionization_points
534  drift(*ssbegin, pixdet, bfield, tTopo, ionization_points, collection_points); // transforms _ionization_points to collection_points
535  // compute induced signal on readout elements and add to _signal
536  induce_signal(*ssbegin, simHitGlobalIndex, tofBin, pixdet, collection_points); // 1st 3 args needed only for SimHit<-->Digi link
537  } // end if
538  } // end for
539 
540 }
#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 1256 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().

1258  {
1259 
1260 #ifdef TP_DEBUG
1261  LogDebug ("Pixel Digitizer") << " enter add_noise " << theNoiseInElectrons;
1262 #endif
1263 
1264  uint32_t detID= pixdet->geographicalId().rawId();
1265  signal_map_type& theSignal = _signal[detID];
1266 
1267 
1268  // First add noise to hit pixels
1269  float theSmearedChargeRMS = 0.0;
1270 
1271  for ( signal_map_iterator i = theSignal.begin(); i != theSignal.end(); i++) {
1272 
1274  {
1275  if((*i).second < 3000)
1276  {
1277  theSmearedChargeRMS = 543.6 - (*i).second * 0.093;
1278  } else if((*i).second < 6000){
1279  theSmearedChargeRMS = 307.6 - (*i).second * 0.01;
1280  } else{
1281  theSmearedChargeRMS = -432.4 +(*i).second * 0.123;
1282  }
1283 
1284  // Noise from Vcal smearing:
1285  float noise_ChargeVCALSmearing = theSmearedChargeRMS * CLHEP::RandGaussQ::shoot(engine, 0., 1.);
1286  // Noise from full readout:
1287  float noise = CLHEP::RandGaussQ::shoot(engine, 0., theReadoutNoise);
1288 
1289  if(((*i).second + Amplitude(noise+noise_ChargeVCALSmearing, -1.)) < 0. ) {
1290  (*i).second.set(0);}
1291  else{
1292  (*i).second +=Amplitude(noise+noise_ChargeVCALSmearing, -1.);
1293  }
1294 
1295  } // End if addChargeVCalSmearing
1296  else
1297  {
1298  // Noise: ONLY full READOUT Noise.
1299  // Use here the FULL readout noise, including TBM,ALT,AOH,OPT-REC.
1300  float noise = CLHEP::RandGaussQ::shoot(engine, 0., theReadoutNoise);
1301 
1302  if(((*i).second + Amplitude(noise, -1.)) < 0. ) {
1303  (*i).second.set(0);}
1304  else{
1305  (*i).second +=Amplitude(noise, -1.);
1306  }
1307  } // end if only Noise from full readout
1308 
1309  }
1310 
1311  if(!addNoisyPixels) // Option to skip noise in non-hit pixels
1312  return;
1313 
1314  const PixelTopology* topol=&pixdet->specificTopology();
1315  int numColumns = topol->ncolumns(); // det module number of cols&rows
1316  int numRows = topol->nrows();
1317 
1318  // Add noise on non-hit pixels
1319  // Use here the pixel noise
1320  int numberOfPixels = (numRows * numColumns);
1321  std::map<int,float, std::less<int> > otherPixels;
1322  std::map<int,float, std::less<int> >::iterator mapI;
1323 
1324  theNoiser->generate(numberOfPixels,
1325  thePixelThreshold, //thr. in un. of nois
1326  theNoiseInElectrons, // noise in elec.
1327  otherPixels,
1328  engine );
1329 
1330 #ifdef TP_DEBUG
1331  LogDebug ("Pixel Digitizer")
1332  << " Add noisy pixels " << numRows << " "
1333  << numColumns << " " << theNoiseInElectrons << " "
1334  << theThresholdInE_FPix << theThresholdInE_BPix <<" "<< numberOfPixels<<" "
1335  << otherPixels.size() ;
1336 #endif
1337 
1338  // Add noisy pixels
1339  for (mapI = otherPixels.begin(); mapI!= otherPixels.end(); mapI++) {
1340  int iy = ((*mapI).first) / numRows;
1341  int ix = ((*mapI).first) - (iy*numRows);
1342 
1343  // Keep for a while for testing.
1344  if( iy < 0 || iy > (numColumns-1) )
1345  LogWarning ("Pixel Geometry") << " error in iy " << iy ;
1346  if( ix < 0 || ix > (numRows-1) )
1347  LogWarning ("Pixel Geometry") << " error in ix " << ix ;
1348 
1349  int chan = PixelDigi::pixelToChannel(ix, iy);
1350 
1351 #ifdef TP_DEBUG
1352  LogDebug ("Pixel Digitizer")
1353  <<" Storing noise = " << (*mapI).first << " " << (*mapI).second
1354  << " " << ix << " " << iy << " " << chan ;
1355 #endif
1356 
1357  if(theSignal[chan] == 0){
1358  // float noise = float( (*mapI).second );
1359  int noise=int( (*mapI).second );
1360  theSignal[chan] = Amplitude (noise, -1.);
1361  }
1362  }
1363 }
#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 433 of file SiPixelDigitizerAlgorithm.h.

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

Referenced by induce_signal().

433  {
434  // need erf(x/sqrt2)
435  //float x2=0.5*x*x;
436  //float a=0.147;
437  //double erf=sqrt(1.0f-exp( -1.0f*x2*( (4/M_PI)+a*x2)/(1.0+a*x2)));
438  //if (x<0.) erf*=-1.0;
439  //return 0.5*(1.0-erf);
440 
441  auto xx=std::min(0.5f*x*x,12.5f);
442  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));
443  }
T sqrt(T t)
Definition: SSEVec.h:48
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
Definition: DDAxes.h:10
void SiPixelDigitizerAlgorithm::calculateInstlumiFactor ( PileupMixingContent puInfo)

Definition at line 543 of file SiPixelDigitizerAlgorithm.cc.

References _pu_scale, bunchScaleAt25, PileupMixingContent::getMix_bunchCrossing(), PileupMixingContent::getMix_bunchSpacing(), PileupMixingContent::getMix_TrueInteractions(), i, j, AlCaHLTBitMon_ParallelJobs::p, pixelEfficiencies_, theInstLumiScaleFactor, and SiPixelDigitizerAlgorithm::PixelEfficiencies::thePUEfficiency.

543  {
544  //Instlumi scalefactor calculating for dynamic inefficiency
545 
546  if (puInfo) {
547  const std::vector<int> bunchCrossing = puInfo->getMix_bunchCrossing();
548  const std::vector<float> TrueInteractionList = puInfo->getMix_TrueInteractions();
549  const int bunchSpacing = puInfo->getMix_bunchSpacing();
550  double bunchScale=1.0;
551 
552  if (bunchSpacing==25) bunchScale=bunchScaleAt25;
553 
554  int pui = 0, p = 0;
555  std::vector<int>::const_iterator pu;
556  std::vector<int>::const_iterator pu0 = bunchCrossing.end();
557 
558  for (pu=bunchCrossing.begin(); pu!=bunchCrossing.end(); ++pu) {
559  if (*pu==0) {
560  pu0 = pu;
561  p = pui;
562  }
563  pui++;
564  }
565 
566  if (pu0!=bunchCrossing.end()) {
567  for (size_t i=0; i<5; i++) {
568  double instlumi = TrueInteractionList.at(p)*theInstLumiScaleFactor*bunchScale;
569  double instlumi_pow=1.;
570  _pu_scale[i] = 0;
571  for (size_t j=0; j<pixelEfficiencies_.thePUEfficiency[i].size(); j++){
572  _pu_scale[i]+=instlumi_pow*pixelEfficiencies_.thePUEfficiency[i][j];
573  instlumi_pow*=instlumi;
574  }
575  }
576  }
577  }
578  else {
579  for (int i=0; i<5;i++) {
580  _pu_scale[i] = 1.;
581  }
582  }
583 }
int i
Definition: DBlmapReader.cc:9
const std::vector< float > & getMix_TrueInteractions() const
const std::vector< int > & getMix_bunchCrossing() const
int j
Definition: DBlmapReader.cc:9
const PixelEfficiencies pixelEfficiencies_
const int & getMix_bunchSpacing() const
void SiPixelDigitizerAlgorithm::digitize ( const PixelGeomDetUnit pixdet,
std::vector< PixelDigi > &  digis,
std::vector< PixelDigiSimLink > &  simlinks,
const TrackerTopology tTopo,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 586 of file SiPixelDigitizerAlgorithm.cc.

References _signal, add_noise(), addNoise, AddPixelInefficiency, addThresholdSmearing, Surface::bounds(), edm::hlt::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_.

590  {
591 
592  // Pixel Efficiency moved from the constructor to this method because
593  // the information of the det are not available in the constructor
594  // Efficiency parameters. 0 - no inefficiency, 1-low lumi, 10-high lumi
595 
596  uint32_t detID = pixdet->geographicalId().rawId();
597  const signal_map_type& theSignal = _signal[detID];
598 
599  const PixelTopology* topol=&pixdet->specificTopology();
600  int numColumns = topol->ncolumns(); // det module number of cols&rows
601  int numRows = topol->nrows();
602 
603  // Noise already defined in electrons
604  // thePixelThresholdInE = thePixelThreshold * theNoiseInElectrons ;
605  // Find the threshold in noise units, needed for the noiser.
606 
607 
608  float thePixelThresholdInE = 0.;
609 
610  if(theNoiseInElectrons>0.){
611  if(pixdet->type().isTrackerPixel() && pixdet->type().isBarrel()){ // Barrel modules
612  int lay = tTopo->layer(detID);
615  thePixelThresholdInE = CLHEP::RandGaussQ::shoot(engine, theThresholdInE_BPix_L1, theThresholdSmearing_BPix_L1); // gaussian smearing
616  } else {
617  thePixelThresholdInE = CLHEP::RandGaussQ::shoot(engine, theThresholdInE_BPix , theThresholdSmearing_BPix); // gaussian smearing
618  }
619  } else {
621  thePixelThresholdInE = theThresholdInE_BPix_L1;
622  } else {
623  thePixelThresholdInE = theThresholdInE_BPix; // no smearing
624  }
625  }
626  } else if(pixdet->type().isTrackerPixel()) { // Forward disks modules
628  thePixelThresholdInE = CLHEP::RandGaussQ::shoot(engine, theThresholdInE_FPix, theThresholdSmearing_FPix); // gaussian smearing
629  } else {
630  thePixelThresholdInE = theThresholdInE_FPix; // no smearing
631  }
632  }
633  else {throw cms::Exception("NotAPixelGeomDetUnit") << "Not a pixel geomdet unit" << detID;}
634  }
635 
636 
637 #ifdef TP_DEBUG
638  // full detector thickness
639  float moduleThickness = pixdet->specificSurface().bounds().thickness();
640  LogDebug ("PixelDigitizer")
641  << " PixelDigitizer "
642  << numColumns << " " << numRows << " " << moduleThickness;
643 #endif
644 
645  if(addNoise) add_noise(pixdet, thePixelThresholdInE/theNoiseInElectrons, engine); // generate noise
646 
647  // Do only if needed
648 
649  if((AddPixelInefficiency) && (theSignal.size()>0))
650  pixel_inefficiency(pixelEfficiencies_, pixdet, tTopo, engine); // Kill some pixels
651 
652  if(use_ineff_from_db_ && (theSignal.size()>0))
653  pixel_inefficiency_db(detID);
654 
655  if(use_module_killing_) {
656  if (use_deadmodule_DB_) { // remove dead modules using DB
657  module_killing_DB(detID);
658  } else { // remove dead modules using the list in cfg file
659  module_killing_conf(detID);
660  }
661  }
662 
663  make_digis(thePixelThresholdInE, detID, pixdet, digis, simlinks, tTopo);
664 
665 #ifdef TP_DEBUG
666  LogDebug ("PixelDigitizer") << "[SiPixelDigitizerAlgorithm] converted " << digis.size() << " PixelDigis in DetUnit" << detID;
667 #endif
668 }
#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
const PixelEfficiencies pixelEfficiencies_
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 800 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().

805  {
806 
807 #ifdef TP_DEBUG
808  LogDebug ("Pixel Digitizer") << " enter drift " ;
809 #endif
810 
811  collection_points.resize(ionization_points.size()); // set size
812 
813  LocalVector driftDir=DriftDirection(pixdet, bfield, hit.detUnitId()); // get the charge drift direction
814  if(driftDir.z() ==0.) {
815  LogWarning("Magnetic field") << " pxlx: drift in z is zero ";
816  return;
817  }
818 
819  // tangent of Lorentz angle
820  //float TanLorenzAngleX = driftDir.x()/driftDir.z();
821  //float TanLorenzAngleY = 0.; // force to 0, driftDir.y()/driftDir.z();
822 
823  float TanLorenzAngleX, TanLorenzAngleY,dir_z, CosLorenzAngleX,
824  CosLorenzAngleY;
825  if( alpha2Order) {
826  TanLorenzAngleX = driftDir.x(); // tangen of Lorentz angle
827  TanLorenzAngleY = driftDir.y();
828  dir_z = driftDir.z(); // The z drift direction
829  CosLorenzAngleX = 1./sqrt(1.+TanLorenzAngleX*TanLorenzAngleX); //cosine
830  CosLorenzAngleY = 1./sqrt(1.+TanLorenzAngleY*TanLorenzAngleY); //cosine;
831 
832  } else{
833  TanLorenzAngleX = driftDir.x();
834  TanLorenzAngleY = 0.; // force to 0, driftDir.y()/driftDir.z();
835  dir_z = driftDir.z(); // The z drift direction
836  CosLorenzAngleX = 1./sqrt(1.+TanLorenzAngleX*TanLorenzAngleX); //cosine to estimate the path length
837  CosLorenzAngleY = 1.;
838  }
839 
840  float moduleThickness = pixdet->specificSurface().bounds().thickness();
841 #ifdef TP_DEBUG
842  LogDebug ("Pixel Digitizer")
843  << " Lorentz Tan " << TanLorenzAngleX << " " << TanLorenzAngleY <<" "
844  << CosLorenzAngleX << " " << CosLorenzAngleY << " "
845  << moduleThickness*TanLorenzAngleX << " " << driftDir;
846 #endif
847 
848  float Sigma_x = 1.; // Charge spread
849  float Sigma_y = 1.;
850  float DriftDistance; // Distance between charge generation and collection
851  float DriftLength; // Actual Drift Lentgh
852  float Sigma;
853 
854  for (unsigned int i = 0; i != ionization_points.size(); i++) {
855 
856  float SegX, SegY, SegZ; // position
857  SegX = ionization_points[i].x();
858  SegY = ionization_points[i].y();
859  SegZ = ionization_points[i].z();
860 
861  // Distance from the collection plane
862  //DriftDistance = (moduleThickness/2. + SegZ); // Drift to -z
863  // Include explixitely the E drift direction (for CMS dir_z=-1)
864  DriftDistance = moduleThickness/2. - (dir_z * SegZ); // Drift to -z
865 
866  //if( DriftDistance <= 0.)
867  //cout<<" <=0 "<<DriftDistance<<" "<<i<<" "<<SegZ<<" "<<dir_z<<" "
868  // <<SegX<<" "<<SegY<<" "<<(moduleThickness/2)<<" "
869  // <<ionization_points[i].energy()<<" "
870  // <<hit.particleType()<<" "<<hit.pabs()<<" "<<hit.energyLoss()<<" "
871  // <<hit.entryPoint()<<" "<<hit.exitPoint()
872  // <<std::endl;
873 
874  if( DriftDistance < 0.) {
875  DriftDistance = 0.;
876  } else if( DriftDistance > moduleThickness )
877  DriftDistance = moduleThickness;
878 
879  // Assume full depletion now, partial depletion will come later.
880  float XDriftDueToMagField = DriftDistance * TanLorenzAngleX;
881  float YDriftDueToMagField = DriftDistance * TanLorenzAngleY;
882 
883  // Shift cloud center
884  float CloudCenterX = SegX + XDriftDueToMagField;
885  float CloudCenterY = SegY + YDriftDueToMagField;
886 
887  // Calculate how long is the charge drift path
888  DriftLength = sqrt( DriftDistance*DriftDistance +
889  XDriftDueToMagField*XDriftDueToMagField +
890  YDriftDueToMagField*YDriftDueToMagField );
891 
892  // What is the charge diffusion after this path
893  Sigma = sqrt(DriftLength/Dist300) * Sigma0;
894 
895  // Project the diffusion sigma on the collection plane
896  Sigma_x = Sigma / CosLorenzAngleX ;
897  Sigma_y = Sigma / CosLorenzAngleY ;
898 
899  // Insert a charge loss due to Rad Damage here
900  float energyOnCollector = ionization_points[i].energy(); // The energy that reaches the collector
901 
902  // add pixel aging
903  if (AddPixelAging) {
904  float kValue = pixel_aging(pixelAging_,pixdet,tTopo);
905  energyOnCollector *= exp( -1*kValue*DriftDistance/moduleThickness );
906  }
907 
908 #ifdef TP_DEBUG
909  LogDebug ("Pixel Digitizer")
910  <<" Dift DistanceZ= "<<DriftDistance<<" module thickness= "<<moduleThickness
911  <<" Start Energy= "<<ionization_points[i].energy()<<" Energy after loss= "<<energyOnCollector;
912 #endif
913  SignalPoint sp( CloudCenterX, CloudCenterY,
914  Sigma_x, Sigma_y, hit.tof(), energyOnCollector );
915 
916  // Load the Charge distribution parameters
917  collection_points[i] = (sp);
918 
919  } // loop over ionization points, i.
920 
921 } // 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 1650 of file SiPixelDigitizerAlgorithm.cc.

References alpha2Order, edm::hlt::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().

1652  {
1653  Frame detFrame(pixdet->surface().position(),pixdet->surface().rotation());
1654  LocalVector Bfield=detFrame.toLocal(bfield);
1655 
1656  float alpha2_FPix;
1657  float alpha2_BPix;
1658  float alpha2;
1659 
1660  //float dir_x = -tanLorentzAnglePerTesla * Bfield.y();
1661  //float dir_y = +tanLorentzAnglePerTesla * Bfield.x();
1662  //float dir_z = -1.; // E field always in z direction, so electrons go to -z
1663  // The dir_z has to be +/- 1. !
1664  // LocalVector theDriftDirection = LocalVector(dir_x,dir_y,dir_z);
1665 
1666  float dir_x = 0.0;
1667  float dir_y = 0.0;
1668  float dir_z = 0.0;
1669  float scale = 0.0;
1670 
1671  uint32_t detID= pixdet->geographicalId().rawId();
1672 
1673 
1674  // Read Lorentz angle from cfg file:**************************************************************
1675 
1676  if(!use_LorentzAngle_DB_){
1677 
1678  if( alpha2Order) {
1681  }else {
1682  alpha2_FPix = 0.0;
1683  alpha2_BPix = 0.0;
1684  }
1685 
1686  if(pixdet->type().isTrackerPixel() && pixdet->type().isBarrel()){// barrel layers
1687  dir_x = -( tanLorentzAnglePerTesla_BPix * Bfield.y() + alpha2_BPix* Bfield.z()* Bfield.x() );
1688  dir_y = +( tanLorentzAnglePerTesla_BPix * Bfield.x() - alpha2_BPix* Bfield.z()* Bfield.y() );
1689  dir_z = -(1 + alpha2_BPix* Bfield.z()*Bfield.z() );
1690  scale = -dir_z;
1691  } else if (pixdet->type().isTrackerPixel()) {// forward disks
1692  dir_x = -( tanLorentzAnglePerTesla_FPix * Bfield.y() + alpha2_FPix* Bfield.z()* Bfield.x() );
1693  dir_y = +( tanLorentzAnglePerTesla_FPix * Bfield.x() - alpha2_FPix* Bfield.z()* Bfield.y() );
1694  dir_z = -(1 + alpha2_FPix* Bfield.z()*Bfield.z() );
1695  scale = -dir_z;
1696  } else {
1697  throw cms::Exception("NotAPixelGeomDetUnit") << "Not a pixel geomdet unit" << detID;
1698  }
1699  } // end: Read LA from cfg file.
1700 
1701  //Read Lorentz angle from DB:********************************************************************
1703  float lorentzAngle = SiPixelLorentzAngle_->getLorentzAngle(detId);
1704  alpha2 = lorentzAngle * lorentzAngle;
1705  //std::cout << "detID is: "<< it->first <<"The LA per tesla is: "<< it->second << std::std::endl;
1706  dir_x = -( lorentzAngle * Bfield.y() + alpha2 * Bfield.z()* Bfield.x() );
1707  dir_y = +( lorentzAngle * Bfield.x() - alpha2 * Bfield.z()* Bfield.y() );
1708  dir_z = -(1 + alpha2 * Bfield.z()*Bfield.z() );
1709  scale = -dir_z;
1710  }// end: Read LA from DataBase.
1711 
1712  LocalVector theDriftDirection = LocalVector(dir_x/scale, dir_y/scale, dir_z/scale );
1713 
1714 #ifdef TP_DEBUG
1715  LogDebug ("Pixel Digitizer") << " The drift direction in local coordinate is "
1716  << theDriftDirection ;
1717 #endif
1718 
1719  return theDriftDirection;
1720 }
#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 745 of file SiPixelDigitizerAlgorithm.cc.

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

Referenced by primary_ionization().

748  {
749 
750  // Get dedx for this track
751  //float dedx;
752  //if( length > 0.) dedx = eloss/length;
753  //else dedx = eloss;
754 
755  double particleMass = 139.6; // Mass in MeV, Assume pion
756  pid = std::abs(pid);
757  if(pid!=211) { // Mass in MeV
758  if(pid==11) particleMass = 0.511;
759  else if(pid==13) particleMass = 105.7;
760  else if(pid==321) particleMass = 493.7;
761  else if(pid==2212) particleMass = 938.3;
762  }
763  // What is the track segment length.
764  float segmentLength = length/NumberOfSegs;
765 
766  // Generate charge fluctuations.
767  float de=0.;
768  float sum=0.;
769  double segmentEloss = (1000.*eloss)/NumberOfSegs; //eloss in MeV
770  for (int i=0;i<NumberOfSegs;i++) {
771  // material,*, momentum,energy,*, *, mass
772  //myglandz_(14.,segmentLength,2.,2.,dedx,de,0.14);
773  // The G4 routine needs momentum in MeV, mass in Mev, delta-cut in MeV,
774  // track segment length in mm, segment eloss in MeV
775  // Returns fluctuated eloss in MeV
776  double deltaCutoff = tMax; // the cutoff is sometimes redefined inside, so fix it.
777  de = fluctuate->SampleFluctuations(double(particleMomentum*1000.),
778  particleMass, deltaCutoff,
779  double(segmentLength*10.),
780  segmentEloss, engine )/1000.; //convert to GeV
781  elossVector[i]=de;
782  sum +=de;
783  }
784 
785  if(sum>0.) { // If fluctuations give eloss>0.
786  // Rescale to the same total eloss
787  float ratio = eloss/sum;
788 
789  for (int ii=0;ii<NumberOfSegs;ii++) elossVector[ii]= ratio*elossVector[ii];
790  } else { // If fluctuations gives 0 eloss
791  float averageEloss = eloss/NumberOfSegs;
792  for (int ii=0;ii<NumberOfSegs;ii++) elossVector[ii]= averageEloss;
793  }
794  return;
795 }
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 925 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(), detailsBasic3DVector::y, PV2DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by accumulateSimHits().

929  {
930 
931  // X - Rows, Left-Right, 160, (1.6cm) for barrel
932  // Y - Columns, Down-Up, 416, (6.4cm)
933 
934  const PixelTopology* topol=&pixdet->specificTopology();
935  uint32_t detID= pixdet->geographicalId().rawId();
936  signal_map_type& theSignal = _signal[detID];
937 
938 #ifdef TP_DEBUG
939  LogDebug ("Pixel Digitizer")
940  << " enter induce_signal, "
941  << topol->pitch().first << " " << topol->pitch().second; //OK
942 #endif
943 
944  // local map to store pixels hit by 1 Hit.
945  typedef std::map< int, float, std::less<int> > hit_map_type;
946  hit_map_type hit_signal;
947 
948  // map to store pixel integrals in the x and in the y directions
949  std::map<int, float, std::less<int> > x,y;
950 
951  // Assign signals to readout channels and store sorted by channel number
952 
953  // Iterate over collection points on the collection plane
954  for ( std::vector<SignalPoint>::const_iterator i=collection_points.begin();
955  i != collection_points.end(); ++i) {
956 
957  float CloudCenterX = i->position().x(); // Charge position in x
958  float CloudCenterY = i->position().y(); // in y
959  float SigmaX = i->sigma_x(); // Charge spread in x
960  float SigmaY = i->sigma_y(); // in y
961  float Charge = i->amplitude(); // Charge amplitude
962 
963 
964  //if(SigmaX==0 || SigmaY==0) {
965  //cout<<SigmaX<<" "<<SigmaY
966  // << " cloud " << i->position().x() << " " << i->position().y() << " "
967  // << i->sigma_x() << " " << i->sigma_y() << " " << i->amplitude()<<std::endl;
968  //}
969 
970 #ifdef TP_DEBUG
971  LogDebug ("Pixel Digitizer")
972  << " cloud " << i->position().x() << " " << i->position().y() << " "
973  << i->sigma_x() << " " << i->sigma_y() << " " << i->amplitude();
974 #endif
975 
976  // Find the maximum cloud spread in 2D plane , assume 3*sigma
977  float CloudRight = CloudCenterX + ClusterWidth*SigmaX;
978  float CloudLeft = CloudCenterX - ClusterWidth*SigmaX;
979  float CloudUp = CloudCenterY + ClusterWidth*SigmaY;
980  float CloudDown = CloudCenterY - ClusterWidth*SigmaY;
981 
982  // Define 2D cloud limit points
983  LocalPoint PointRightUp = LocalPoint(CloudRight,CloudUp);
984  LocalPoint PointLeftDown = LocalPoint(CloudLeft,CloudDown);
985 
986  // This points can be located outside the sensor area.
987  // The conversion to measurement point does not check for that
988  // so the returned pixel index might be wrong (outside range).
989  // We rely on the limits check below to fix this.
990  // But remember whatever we do here THE CHARGE OUTSIDE THE ACTIVE
991  // PIXEL AREA IS LOST, it should not be collected.
992 
993  // Convert the 2D points to pixel indices
994  MeasurementPoint mp = topol->measurementPosition(PointRightUp ); //OK
995 
996  int IPixRightUpX = int( floor( mp.x()));
997  int IPixRightUpY = int( floor( mp.y()));
998 
999 #ifdef TP_DEBUG
1000  LogDebug ("Pixel Digitizer") << " right-up " << PointRightUp << " "
1001  << mp.x() << " " << mp.y() << " "
1002  << IPixRightUpX << " " << IPixRightUpY ;
1003 #endif
1004 
1005  mp = topol->measurementPosition(PointLeftDown ); //OK
1006 
1007  int IPixLeftDownX = int( floor( mp.x()));
1008  int IPixLeftDownY = int( floor( mp.y()));
1009 
1010 #ifdef TP_DEBUG
1011  LogDebug ("Pixel Digitizer") << " left-down " << PointLeftDown << " "
1012  << mp.x() << " " << mp.y() << " "
1013  << IPixLeftDownX << " " << IPixLeftDownY ;
1014 #endif
1015 
1016  // Check detector limits to correct for pixels outside range.
1017  int numColumns = topol->ncolumns(); // det module number of cols&rows
1018  int numRows = topol->nrows();
1019 
1020  IPixRightUpX = numRows>IPixRightUpX ? IPixRightUpX : numRows-1 ;
1021  IPixRightUpY = numColumns>IPixRightUpY ? IPixRightUpY : numColumns-1 ;
1022  IPixLeftDownX = 0<IPixLeftDownX ? IPixLeftDownX : 0 ;
1023  IPixLeftDownY = 0<IPixLeftDownY ? IPixLeftDownY : 0 ;
1024 
1025  x.clear(); // clear temporary integration array
1026  y.clear();
1027 
1028  // First integrate charge strips in x
1029  int ix; // TT for compatibility
1030  for (ix=IPixLeftDownX; ix<=IPixRightUpX; ix++) { // loop over x index
1031  float xUB, xLB, UpperBound, LowerBound;
1032 
1033  // Why is set to 0 if ix=0, does it meen that we accept charge
1034  // outside the sensor? CHeck How it was done in ORCA?
1035  //if(ix == 0) LowerBound = 0.;
1036  if(ix == 0 || SigmaX==0. ) // skip for surface segemnts
1037  LowerBound = 0.;
1038  else {
1039  mp = MeasurementPoint( float(ix), 0.0);
1040  xLB = topol->localPosition(mp).x();
1041  LowerBound = 1-calcQ((xLB-CloudCenterX)/SigmaX);
1042  }
1043 
1044  if(ix == numRows-1 || SigmaX==0. )
1045  UpperBound = 1.;
1046  else {
1047  mp = MeasurementPoint( float(ix+1), 0.0);
1048  xUB = topol->localPosition(mp).x();
1049  UpperBound = 1. - calcQ((xUB-CloudCenterX)/SigmaX);
1050  }
1051 
1052  float TotalIntegrationRange = UpperBound - LowerBound; // get strip
1053  x[ix] = TotalIntegrationRange; // save strip integral
1054  //if(SigmaX==0 || SigmaY==0)
1055  //cout<<TotalIntegrationRange<<" "<<ix<<std::endl;
1056 
1057  }
1058 
1059  // Now integrate strips in y
1060  int iy; // TT for compatibility
1061  for (iy=IPixLeftDownY; iy<=IPixRightUpY; iy++) { //loope over y ind
1062  float yUB, yLB, UpperBound, LowerBound;
1063 
1064  if(iy == 0 || SigmaY==0.)
1065  LowerBound = 0.;
1066  else {
1067  mp = MeasurementPoint( 0.0, float(iy) );
1068  yLB = topol->localPosition(mp).y();
1069  LowerBound = 1. - calcQ((yLB-CloudCenterY)/SigmaY);
1070  }
1071 
1072  if(iy == numColumns-1 || SigmaY==0. )
1073  UpperBound = 1.;
1074  else {
1075  mp = MeasurementPoint( 0.0, float(iy+1) );
1076  yUB = topol->localPosition(mp).y();
1077  UpperBound = 1. - calcQ((yUB-CloudCenterY)/SigmaY);
1078  }
1079 
1080  float TotalIntegrationRange = UpperBound - LowerBound;
1081  y[iy] = TotalIntegrationRange; // save strip integral
1082  //if(SigmaX==0 || SigmaY==0)
1083  //cout<<TotalIntegrationRange<<" "<<iy<<std::endl;
1084  }
1085 
1086  // Get the 2D charge integrals by folding x and y strips
1087  int chan;
1088  for (ix=IPixLeftDownX; ix<=IPixRightUpX; ix++) { // loop over x index
1089  for (iy=IPixLeftDownY; iy<=IPixRightUpY; iy++) { //loope over y ind
1090 
1091  float ChargeFraction = Charge*x[ix]*y[iy];
1092 
1093  if( ChargeFraction > 0. ) {
1094  chan = PixelDigi::pixelToChannel( ix, iy); // Get index
1095  // Load the amplitude
1096  hit_signal[chan] += ChargeFraction;
1097  } // endif
1098 
1099 
1100  mp = MeasurementPoint( float(ix), float(iy) );
1101  LocalPoint lp = topol->localPosition(mp);
1102  chan = topol->channel(lp);
1103 
1104 #ifdef TP_DEBUG
1105  LogDebug ("Pixel Digitizer")
1106  << " pixel " << ix << " " << iy << " - "<<" "
1107  << chan << " " << ChargeFraction<<" "
1108  << mp.x() << " " << mp.y() <<" "
1109  << lp.x() << " " << lp.y() << " " // givex edge position
1110  << chan; // edge belongs to previous ?
1111 #endif
1112 
1113  } // endfor iy
1114  } //endfor ix
1115 
1116 
1117  // Test conversions (THIS IS FOR TESTING ONLY) comment-out.
1118  // mp = topol->measurementPosition( i->position() ); //OK
1119  // LocalPoint lp = topol->localPosition(mp); //OK
1120  // std::pair<float,float> p = topol->pixel( i->position() ); //OK
1121  // chan = PixelDigi::pixelToChannel( int(p.first), int(p.second));
1122  // std::pair<int,int> ip = PixelDigi::channelToPixel(chan);
1123  // MeasurementPoint mp1 = MeasurementPoint( float(ip.first),
1124  // float(ip.second) );
1125  // LogDebug ("Pixel Digitizer") << " Test "<< mp.x() << " " << mp.y()
1126  // << " "<< lp.x() << " " << lp.y() << " "<<" "
1127  // <<p.first <<" "<<p.second<<" "<<chan<< " "
1128  // <<" " << ip.first << " " << ip.second << " "
1129  // << mp1.x() << " " << mp1.y() << " " //OK
1130  // << topol->localPosition(mp1).x() << " " //OK
1131  // << topol->localPosition(mp1).y() << " "
1132  // << topol->channel( i->position() ); //OK
1133 
1134 
1135  } // loop over charge distributions
1136 
1137  // Fill the global map with all hit pixels from this event
1138 
1139  for ( hit_map_type::const_iterator im = hit_signal.begin();
1140  im != hit_signal.end(); ++im) {
1141  int chan = (*im).first;
1142  theSignal[chan] += (makeDigiSimLinks_ ? Amplitude( (*im).second, &hit, hitIndex, tofBin, (*im).second) : Amplitude( (*im).second, (*im).second) ) ;
1143 
1144 #ifdef TP_DEBUG
1145  std::pair<int,int> ip = PixelDigi::channelToPixel(chan);
1146  LogDebug ("Pixel Digitizer")
1147  << " pixel " << ip.first << " " << ip.second << " "
1148  << theSignal[chan];
1149 #endif
1150  }
1151 
1152 } // 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
Definition: DDAxes.h:10
T x() const
Definition: PV2DBase.h:45
T x() const
Definition: PV3DBase.h:62
void SiPixelDigitizerAlgorithm::init ( const edm::EventSetup es)

Definition at line 106 of file SiPixelDigitizerAlgorithm.cc.

References edm::EventSetup::get().

106  {
107  if(use_ineff_from_db_){// load gain calibration service fromdb...
108  theSiPixelGainCalibrationService_->setESObjects( es );
109  }
110  if(use_deadmodule_DB_) {
112  }
114  // Get Lorentz angle from DB record
116  }
117  //gets the map and geometry from the DB (to kill ROCs)
118  es.get<SiPixelFedCablingMapRcd>().get(map_);
120 }
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:55
std::map< int, SiPixelDigitizerAlgorithm::CalParameters, std::less< int > > SiPixelDigitizerAlgorithm::initCal ( ) const
private

Definition at line 263 of file SiPixelDigitizerAlgorithm.cc.

References calmap, dtNoiseDBValidation_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.

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

References _signal.

51  {
52  _signal.clear();
53  }
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 1157 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().

1162  {
1163 
1164 #ifdef TP_DEBUG
1165  LogDebug ("Pixel Digitizer") << " make digis "<<" "
1166  << " pixel threshold FPix" << theThresholdInE_FPix << " "
1167  << " pixel threshold BPix" << theThresholdInE_BPix << " "
1168  << " pixel threshold BPix Layer1" << theThresholdInE_BPix_L1 << " "
1169  << " List pixels passing threshold ";
1170 #endif
1171 
1172  // Loop over hit pixels
1173 
1174  signalMaps::const_iterator it = _signal.find(detID);
1175  if (it == _signal.end()) {
1176  return;
1177  }
1178 
1179  const signal_map_type& theSignal = (*it).second;
1180 
1181  for (signal_map_const_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
1182 
1183  float signalInElectrons = (*i).second ; // signal in electrons
1184 
1185  // Do the miss calibration for calibration studies only.
1186  //if(doMissCalibrate) signalInElectrons = missCalibrate(signalInElectrons)
1187 
1188  // Do only for pixels above threshold
1189 
1190  if( signalInElectrons >= thePixelThresholdInE) { // check threshold
1191 
1192  int chan = (*i).first; // channel number
1193  std::pair<int,int> ip = PixelDigi::channelToPixel(chan);
1194  int adc=0; // ADC count as integer
1195 
1196  // Do the miss calibration for calibration studies only.
1197  if(doMissCalibrate) {
1198  int row = ip.first; // X in row
1199  int col = ip.second; // Y is in col
1200  adc = int(missCalibrate(detID, pixdet, col, row, signalInElectrons)); //full misscalib.
1201  } else { // Just do a simple electron->adc conversion
1202  adc = int( signalInElectrons / theElectronPerADC ); // calibrate gain
1203  }
1204  adc = std::min(adc, theAdcFullScale); // Check maximum value
1205 // Calculate layerIndex
1207  if(pixdet->subDetector() == GeomDetEnumerators::SubDetector::P2OTB) { // Phase 2 OT Barrel only
1208  // Set to 1 if over the threshold
1209  if (theAdcFullScaleStack==1) {adc=1;}
1210  // Make it a linear fit to the full scale of the normal adc count. Start new adc from 1 not zero.
1212  }
1213  } // Only enter this if the Adc changes for the outer layers
1214 #ifdef TP_DEBUG
1215  LogDebug ("Pixel Digitizer")
1216  << (*i).first << " " << (*i).second << " " << signalInElectrons
1217  << " " << adc << ip.first << " " << ip.second ;
1218 #endif
1219 
1220  // Load digis
1221  digis.emplace_back(ip.first, ip.second, adc);
1222 
1223  if (makeDigiSimLinks_ && (*i).second.hitInfo()!=0) {
1224  //digilink
1225  if((*i).second.trackIds().size()>0){
1226  simlink_map simi;
1227  unsigned int il=0;
1228  for( std::vector<unsigned int>::const_iterator itid = (*i).second.trackIds().begin();
1229  itid != (*i).second.trackIds().end(); ++itid) {
1230  simi[*itid].push_back((*i).second.individualampl()[il]);
1231  il++;
1232  }
1233 
1234  //sum the contribution of the same trackid
1235  for( simlink_map::iterator simiiter=simi.begin();
1236  simiiter!=simi.end();
1237  simiiter++){
1238 
1239  float sum_samechannel=0;
1240  for (unsigned int iii=0;iii<(*simiiter).second.size();iii++){
1241  sum_samechannel+=(*simiiter).second[iii];
1242  }
1243  float fraction=sum_samechannel/(*i).second;
1244  if(fraction>1.) fraction=1.;
1245  simlinks.emplace_back((*i).first, (*simiiter).first, (*i).second.hitIndex(), (*i).second.tofBin(), (*i).second.eventId(), fraction);
1246  }
1247  }
1248  }
1249  }
1250  }
1251 }
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 1568 of file SiPixelDigitizerAlgorithm.cc.

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

Referenced by make_digis().

1569  {
1570  // Central values
1571  //const float p0=0.00352, p1=0.868, p2=112., p3=113.; // pix(0,0,0)
1572  // const float p0=0.00382, p1=0.886, p2=112.7, p3=113.0; // average roc=0
1573  //const float p0=0.00492, p1=1.998, p2=90.6, p3=134.1; // average roc=6
1574  // Smeared (rms)
1575  //const float s0=0.00020, s1=0.051, s2=5.4, s3=4.4; // average roc=0
1576  //const float s0=0.00015, s1=0.043, s2=3.2, s3=3.1; // col average roc=0
1577 
1578  // Make 2 sets of parameters for Fpix and BPIx:
1579 
1580  float p0=0.0;
1581  float p1=0.0;
1582  float p2=0.0;
1583  float p3=0.0;
1584 
1585  if(pixdet->type().isTrackerPixel() && pixdet->type().isBarrel()){// barrel layers
1586  p0 = BPix_p0;
1587  p1 = BPix_p1;
1588  p2 = BPix_p2;
1589  p3 = BPix_p3;
1590  } else if(pixdet->type().isTrackerPixel()) {// forward disks
1591  p0 = FPix_p0;
1592  p1 = FPix_p1;
1593  p2 = FPix_p2;
1594  p3 = FPix_p3;
1595  } else {
1596  throw cms::Exception("NotAPixelGeomDetUnit") << "Not a pixel geomdet unit" << detID;
1597  }
1598 
1599  // const float electronsPerVCAL = 65.5; // our present VCAL calibration (feb 2009)
1600  // const float electronsPerVCAL_Offset = -414.0; // our present VCAL calibration (feb 2009)
1601  float newAmp = 0.; //Modified signal
1602 
1603  // Convert electrons to VCAL units
1604  float signal = (signalInElectrons-electronsPerVCAL_Offset)/electronsPerVCAL;
1605 
1606  // Simulate the analog response with fixed parametrization
1607  newAmp = p3 + p2 * tanh(p0*signal - p1);
1608 
1609 
1610  // Use the pixel-by-pixel calibrations
1611  //transform to ROC index coordinates
1612  //int chipIndex=0, colROC=0, rowROC=0;
1613  //std::auto_ptr<PixelIndices> pIndexConverter(new PixelIndices(numColumns,numRows));
1614  //pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
1615 
1616  // Use calibration from a file
1617  //int chanROC = PixelIndices::pixelToChannelROC(rowROC,colROC); // use ROC coordinates
1618  //float pp0=0, pp1=0,pp2=0,pp3=0;
1619  //map<int,CalParameters,std::less<int> >::const_iterator it=calmap.find(chanROC);
1620  //CalParameters y = (*it).second;
1621  //pp0 = y.p0;
1622  //pp1 = y.p1;
1623  //pp2 = y.p2;
1624  //pp3 = y.p3;
1625 
1626  //
1627  // Use random smearing
1628  // Randomize the pixel response
1629  //float pp0 = RandGaussQ::shoot(p0,s0);
1630  //float pp1 = RandGaussQ::shoot(p1,s1);
1631  //float pp2 = RandGaussQ::shoot(p2,s2);
1632  //float pp3 = RandGaussQ::shoot(p3,s3);
1633 
1634  //newAmp = pp3 + pp2 * tanh(pp0*signal - pp1); // Final signal
1635 
1636  //cout<<" misscalibrate "<<col<<" "<<row<<" "<<chipIndex<<" "<<colROC<<" "
1637  // <<rowROC<<" "<<signalInElectrons<<" "<<signal<<" "<<newAmp<<" "
1638  // <<(signalInElectrons/theElectronPerADC)<<std::endl;
1639 
1640  return newAmp;
1641 }
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 1747 of file SiPixelDigitizerAlgorithm.cc.

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

Referenced by digitize().

1747  {
1748 
1749  bool isbad=false;
1750 
1751  Parameters::const_iterator itDeadModules=DeadModules.begin();
1752 
1753  int detid = detID;
1754  for(; itDeadModules != DeadModules.end(); ++itDeadModules){
1755  int Dead_detID = itDeadModules->getParameter<int>("Dead_detID");
1756  if(detid == Dead_detID){
1757  isbad=true;
1758  break;
1759  }
1760  }
1761 
1762  if(!isbad)
1763  return;
1764 
1765  signal_map_type& theSignal = _signal[detID];
1766 
1767  std::string Module = itDeadModules->getParameter<std::string>("Module");
1768 
1769  if(Module=="whole"){
1770  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
1771  i->second.set(0.); // reset amplitude
1772  }
1773  }
1774 
1775  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
1776  std::pair<int,int> ip = PixelDigi::channelToPixel(i->first);//get pixel pos
1777 
1778  if(Module=="tbmA" && ip.first>=80 && ip.first<=159){
1779  i->second.set(0.);
1780  }
1781 
1782  if( Module=="tbmB" && ip.first<=79){
1783  i->second.set(0.);
1784  }
1785  }
1786 }
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 1788 of file SiPixelDigitizerAlgorithm.cc.

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

Referenced by digitize().

1788  {
1789 // Not SLHC safe for now
1790 
1791  bool isbad=false;
1792 
1793  std::vector<SiPixelQuality::disabledModuleType>disabledModules = SiPixelBadModule_->getBadComponentList();
1794 
1796 
1797  for (size_t id=0;id<disabledModules.size();id++)
1798  {
1799  if(detID==disabledModules[id].DetID){
1800  isbad=true;
1801  badmodule = disabledModules[id];
1802  break;
1803  }
1804  }
1805 
1806  if(!isbad)
1807  return;
1808 
1809  signal_map_type& theSignal = _signal[detID];
1810 
1811  //std::cout<<"Hit in: "<< detID <<" errorType "<< badmodule.errorType<<" BadRocs="<<std::hex<<SiPixelBadModule_->getBadRocs(detID)<<dec<<" "<<std::endl;
1812  if(badmodule.errorType == 0){ // this is a whole dead module.
1813 
1814  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
1815  i->second.set(0.); // reset amplitude
1816  }
1817  }
1818  else { // all other module types: half-modules and single ROCs.
1819  // Get Bad ROC position:
1820  //follow the example of getBadRocPositions in CondFormats/SiPixelObjects/src/SiPixelQuality.cc
1821  std::vector<GlobalPixel> badrocpositions (0);
1822  for(unsigned int j = 0; j < 16; j++){
1823  if(SiPixelBadModule_->IsRocBad(detID, j) == true){
1824 
1825  std::vector<CablingPathToDetUnit> path = map_.product()->pathToDetUnit(detID);
1826  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
1827  for (IT it = path.begin(); it != path.end(); ++it) {
1828  const PixelROC* myroc = map_.product()->findItem(*it);
1829  if( myroc->idInDetUnit() == j) {
1830  LocalPixel::RocRowCol local = { 39, 25}; //corresponding to center of ROC row, col
1831  GlobalPixel global = myroc->toGlobal( LocalPixel(local) );
1832  badrocpositions.push_back(global);
1833  break;
1834  }
1835  }
1836  }
1837  }// end of getBadRocPositions
1838 
1839 
1840  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
1841  std::pair<int,int> ip = PixelDigi::channelToPixel(i->first);//get pixel pos
1842 
1843  for(std::vector<GlobalPixel>::const_iterator it = badrocpositions.begin(); it != badrocpositions.end(); ++it){
1844  if(it->row >= 80 && ip.first >= 80 ){
1845  if((fabs(ip.second - it->col) < 26) ) {i->second.set(0.);}
1846  else if(it->row==120 && ip.second-it->col==26){i->second.set(0.);}
1847  else if(it->row==119 && it->col-ip.second==26){i->second.set(0.);}
1848  }
1849  else if(it->row < 80 && ip.first < 80 ){
1850  if((fabs(ip.second - it->col) < 26) ){i->second.set(0.);}
1851  else if(it->row==40 && ip.second-it->col==26){i->second.set(0.);}
1852  else if(it->row==39 && it->col-ip.second==26){i->second.set(0.);}
1853  }
1854  }
1855  }
1856  }
1857 }
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
tuple path
else: Piece not in the list, fine.
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 1515 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().

1517  {
1518 
1519  uint32_t detID= pixdet->geographicalId().rawId();
1520 
1521 
1522  // Predefined damage parameter (no aging)
1523  float pseudoRadDamage = 0.0;
1524 
1525  // setup the chip indices conversion
1527  pixdet->subDetector() == GeomDetEnumerators::SubDetector::P1PXB){// barrel layers
1528  int layerIndex=tTopo->layer(detID);
1529 
1530  pseudoRadDamage = aging.thePixelPseudoRadDamage[layerIndex-1];
1531 
1532  // std::cout << "pixel_aging: " << std::endl;
1533  // std::cout << "Subid " << Subid << " layerIndex " << layerIndex << " ladder " << tTopo->pxbLadder(detID) << " module " << tTopo->pxbModule(detID) << std::endl;
1534 
1537  pixdet->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC) { // forward disks
1538  unsigned int diskIndex=tTopo->layer(detID)+aging.FPixIndex; // Use diskIndex-1 later to stay consistent with BPix
1539 
1540  pseudoRadDamage = aging.thePixelPseudoRadDamage[diskIndex-1];
1541 
1542  // std::cout << "pixel_aging: " << std::endl;
1543  // std::cout << "Subid " << Subid << " diskIndex " << diskIndex << std::endl;
1545  // if phase 2 OT hardcoded value as it has always been
1546  pseudoRadDamage = 0.;
1547  } // if barrel/forward
1548 
1549  // std::cout << " pseudoRadDamage " << pseudoRadDamage << std::endl;
1550  // std::cout << " end pixel_aging " << std::endl;
1551 
1552  return pseudoRadDamage;
1553 #ifdef TP_DEBUG
1554  LogDebug ("Pixel Digitizer") << " enter pixel_aging " << pseudoRadDamage;
1555 #endif
1556 
1557 }
#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 1369 of file SiPixelDigitizerAlgorithm.cc.

References _pu_scale, _signal, PixelDigi::channelToPixel(), cuy::col, SiPixelDigitizerAlgorithm::PixelEfficiencies::FPixIndex, GeomDet::geographicalId(), i, getDQMSummary::iter, 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, 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().

1372  {
1373 
1374  uint32_t detID= pixdet->geographicalId().rawId();
1375  signal_map_type& theSignal = _signal[detID];
1376  const PixelTopology* topol=&pixdet->specificTopology();
1377  int numColumns = topol->ncolumns(); // det module number of cols&rows
1378  int numRows = topol->nrows();
1379 
1380  // Predefined efficiencies
1381  double pixelEfficiency = 1.0;
1382  double columnEfficiency = 1.0;
1383  double chipEfficiency = 1.0;
1384 
1385  // setup the chip indices conversion
1387  pixdet->subDetector()==GeomDetEnumerators::SubDetector::P1PXB){// barrel layers
1388  int layerIndex=tTopo->layer(detID);
1389  pixelEfficiency = eff.thePixelEfficiency[layerIndex-1];
1390  columnEfficiency = eff.thePixelColEfficiency[layerIndex-1];
1391  chipEfficiency = eff.thePixelChipEfficiency[layerIndex-1];
1392  //std::cout <<"Using BPix columnEfficiency = "<<columnEfficiency<< " for layer = "<<layerIndex <<"\n";
1393  // This should never happen, but only check if it is not an upgrade geometry
1394  if (NumberOfBarrelLayers==3){
1395  if(numColumns>416) LogWarning ("Pixel Geometry") <<" wrong columns in barrel "<<numColumns;
1396  if(numRows>160) LogWarning ("Pixel Geometry") <<" wrong rows in barrel "<<numRows;
1397 
1398  int ladder=tTopo->pxbLadder(detID);
1399  int module=tTopo->pxbModule(detID);
1400  if (module<=4) module=5-module;
1401  else module-=4;
1402 
1403  columnEfficiency *= eff.theLadderEfficiency_BPix[layerIndex-1][ladder-1]*eff.theModuleEfficiency_BPix[layerIndex-1][module-1]*_pu_scale[layerIndex-1];
1404  }
1407  pixdet->subDetector()==GeomDetEnumerators::SubDetector::P2PXEC){ // forward disks
1408 
1409  unsigned int diskIndex=tTopo->layer(detID)+eff.FPixIndex; // Use diskIndex-1 later to stay consistent with BPix
1410  unsigned int panelIndex=tTopo->pxfPanel(detID);
1411  unsigned int moduleIndex=tTopo->pxfModule(detID);
1412  //if (eff.FPixIndex>diskIndex-1){throw cms::Exception("Configuration") <<"SiPixelDigitizer is using the wrong efficiency value. index = "
1413  // <<diskIndex-1<<" , MinIndex = "<<eff.FPixIndex<<" ... "<<tTopo->pxfDisk(detID);}
1414  pixelEfficiency = eff.thePixelEfficiency[diskIndex-1];
1415  columnEfficiency = eff.thePixelColEfficiency[diskIndex-1];
1416  chipEfficiency = eff.thePixelChipEfficiency[diskIndex-1];
1417  //std::cout <<"Using FPix columnEfficiency = "<<columnEfficiency<<" for Disk = "<< tTopo->pxfDisk(detID)<<"\n";
1418  // Sometimes the forward pixels have wrong size,
1419  // this crashes the index conversion, so exit, but only check if it is not an upgrade geometry
1420  if (NumberOfBarrelLayers==3){ // whether it is the present or the phase 1 detector can be checked using GeomDetEnumerators::SubDetector
1421  if(numColumns>260 || numRows>160) {
1422  if(numColumns>260) LogWarning ("Pixel Geometry") <<" wrong columns in endcaps "<<numColumns;
1423  if(numRows>160) LogWarning ("Pixel Geometry") <<" wrong rows in endcaps "<<numRows;
1424  return;
1425  }
1426  if ((panelIndex==1 && (moduleIndex==1 || moduleIndex==2)) || (panelIndex==2 && moduleIndex==1)) { //inner modules
1427  columnEfficiency*=eff.theInnerEfficiency_FPix[diskIndex-1]*_pu_scale[3];
1428  } else { //outer modules
1429  columnEfficiency*=eff.theOuterEfficiency_FPix[diskIndex-1]*_pu_scale[4];
1430  }
1431  } // current detector, forward
1433  // If phase 2 outer tracker, hardcoded values as they have been so far
1434  pixelEfficiency = 0.999;
1435  columnEfficiency = 0.999;
1436  chipEfficiency = 0.999;
1437  } // if barrel/forward
1438 
1439 #ifdef TP_DEBUG
1440  LogDebug ("Pixel Digitizer") << " enter pixel_inefficiency " << pixelEfficiency << " "
1441  << columnEfficiency << " " << chipEfficiency;
1442 #endif
1443 
1444  // Initilize the index converter
1445  //PixelIndices indexConverter(numColumns,numRows);
1446  std::auto_ptr<PixelIndices> pIndexConverter(new PixelIndices(numColumns,numRows));
1447 
1448  int chipIndex = 0;
1449  int rowROC = 0;
1450  int colROC = 0;
1451  std::map<int, int, std::less<int> >chips, columns;
1452  std::map<int, int, std::less<int> >::iterator iter;
1453 
1454  // Find out the number of columns and rocs hits
1455  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
1456  for (signal_map_const_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
1457 
1458  int chan = i->first;
1459  std::pair<int,int> ip = PixelDigi::channelToPixel(chan);
1460  int row = ip.first; // X in row
1461  int col = ip.second; // Y is in col
1462  //transform to ROC index coordinates
1463  pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
1464  int dColInChip = pIndexConverter->DColumn(colROC); // get ROC dcol from ROC col
1465  //dcol in mod
1466  int dColInDet = pIndexConverter->DColumnInModule(dColInChip,chipIndex);
1467 
1468  chips[chipIndex]++;
1469  columns[dColInDet]++;
1470  }
1471 
1472  // Delete some ROC hits.
1473  for ( iter = chips.begin(); iter != chips.end() ; iter++ ) {
1474  //float rand = RandFlat::shoot();
1475  float rand = CLHEP::RandFlat::shoot(engine);
1476  if( rand > chipEfficiency ) chips[iter->first]=0;
1477  }
1478 
1479  // Delete some Dcol hits.
1480  for ( iter = columns.begin(); iter != columns.end() ; iter++ ) {
1481  //float rand = RandFlat::shoot();
1482  float rand = CLHEP::RandFlat::shoot(engine);
1483  if( rand > columnEfficiency ) columns[iter->first]=0;
1484  }
1485 
1486  // Now loop again over pixels to kill some of them.
1487  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
1488  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
1489 
1490  // int chan = i->first;
1491  std::pair<int,int> ip = PixelDigi::channelToPixel(i->first);//get pixel pos
1492  int row = ip.first; // X in row
1493  int col = ip.second; // Y is in col
1494  //transform to ROC index coordinates
1495  pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
1496  int dColInChip = pIndexConverter->DColumn(colROC); //get ROC dcol from ROC col
1497  //dcol in mod
1498  int dColInDet = pIndexConverter->DColumnInModule(dColInChip,chipIndex);
1499 
1500  //float rand = RandFlat::shoot();
1501  float rand = CLHEP::RandFlat::shoot(engine);
1502  if( chips[chipIndex]==0 || columns[dColInDet]==0
1503  || rand>pixelEfficiency ) {
1504  // make pixel amplitude =0, pixel will be lost at clusterization
1505  i->second.set(0.); // reset amplitude,
1506  } // end if
1507 
1508  } // end pixel loop
1509 } // 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 1724 of file SiPixelDigitizerAlgorithm.cc.

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

Referenced by digitize().

1724  {
1725 
1726  signal_map_type& theSignal = _signal[detID];
1727 
1728  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
1729  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
1730 
1731  // int chan = i->first;
1732  std::pair<int,int> ip = PixelDigi::channelToPixel(i->first);//get pixel pos
1733  int row = ip.first; // X in row
1734  int col = ip.second; // Y is in col
1735  //transform to ROC index coordinates
1736  if(theSiPixelGainCalibrationService_->isDead(detID, col, row)){
1737  // std::cout << "now in isdead check, row " << detID << " " << col << "," << row << std::std::endl;
1738  // make pixel amplitude =0, pixel will be lost at clusterization
1739  i->second.set(0.); // reset amplitude,
1740  } // end if
1741  } // end pixel loop
1742 } // 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 673 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().

673  {
674 
675  // Straight line approximation for trajectory inside active media
676 
677  const float SegmentLength = 0.0010; //10microns in cm
678  float energy;
679 
680  // Get the 3D segment direction vector
681  LocalVector direction = hit.exitPoint() - hit.entryPoint();
682 
683  float eLoss = hit.energyLoss(); // Eloss in GeV
684  float length = direction.mag(); // Track length in Silicon
685 
686  int NumberOfSegments = int ( length / SegmentLength); // Number of segments
687  if(NumberOfSegments < 1) NumberOfSegments = 1;
688 
689 #ifdef TP_DEBUG
690  LogDebug ("Pixel Digitizer")
691  << " enter primary_ionzation " << NumberOfSegments
692  << " shift = "
693  << (hit.exitPoint().x()-hit.entryPoint().x()) << " "
694  << (hit.exitPoint().y()-hit.entryPoint().y()) << " "
695  << (hit.exitPoint().z()-hit.entryPoint().z()) << " "
696  << hit.particleType() <<" "<< hit.pabs() ;
697 #endif
698 
699  float* elossVector = new float[NumberOfSegments]; // Eloss vector
700 
701  if( fluctuateCharge ) {
702  //MP DA RIMUOVERE ASSOLUTAMENTE
703  int pid = hit.particleType();
704  //int pid=211; // assume it is a pion
705 
706  float momentum = hit.pabs();
707  // Generate fluctuated charge points
708  fluctuateEloss(pid, momentum, eLoss, length, NumberOfSegments,
709  elossVector, engine);
710  }
711 
712  ionization_points.resize( NumberOfSegments); // set size
713 
714  // loop over segments
715  for ( int i = 0; i != NumberOfSegments; i++) {
716  // Divide the segment into equal length subsegments
717  Local3DPoint point = hit.entryPoint() +
718  float((i+0.5)/NumberOfSegments) * direction;
719 
720  if( fluctuateCharge )
721  energy = elossVector[i]/GeVperElectron; // Convert charge to elec.
722  else
723  energy = hit.energyLoss()/GeVperElectron/float(NumberOfSegments);
724 
725  EnergyDepositUnit edu( energy, point); //define position,energy point
726  ionization_points[i] = edu; // save
727 
728 #ifdef TP_DEBUG
729  LogDebug ("Pixel Digitizer")
730  << i << " " << ionization_points[i].x() << " "
731  << ionization_points[i].y() << " "
732  << ionization_points[i].z() << " "
733  << ionization_points[i].energy();
734 #endif
735 
736  } // end for loop
737 
738  delete[] elossVector;
739 
740 }
#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

double SiPixelDigitizerAlgorithm::_pu_scale[20]
private

Definition at line 269 of file SiPixelDigitizerAlgorithm.h.

Referenced by calculateInstlumiFactor(), and pixel_inefficiency().

signalMaps SiPixelDigitizerAlgorithm::_signal
private
const bool SiPixelDigitizerAlgorithm::addChargeVCALSmearing
private

Definition at line 349 of file SiPixelDigitizerAlgorithm.h.

Referenced by add_noise().

const bool SiPixelDigitizerAlgorithm::addNoise
private

Definition at line 348 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const bool SiPixelDigitizerAlgorithm::addNoisyPixels
private

Definition at line 350 of file SiPixelDigitizerAlgorithm.h.

Referenced by add_noise().

const bool SiPixelDigitizerAlgorithm::AddPixelAging
private

Definition at line 363 of file SiPixelDigitizerAlgorithm.h.

Referenced by drift().

const bool SiPixelDigitizerAlgorithm::AddPixelInefficiency
private

Definition at line 353 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize(), and SiPixelDigitizerAlgorithm().

const bool SiPixelDigitizerAlgorithm::addThresholdSmearing
private

Definition at line 355 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const bool SiPixelDigitizerAlgorithm::alpha2Order
private

Definition at line 300 of file SiPixelDigitizerAlgorithm.h.

Referenced by drift(), and DriftDirection().

const float SiPixelDigitizerAlgorithm::BPix_p0
private

Definition at line 341 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const float SiPixelDigitizerAlgorithm::BPix_p1
private

Definition at line 342 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const float SiPixelDigitizerAlgorithm::BPix_p2
private

Definition at line 343 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const float SiPixelDigitizerAlgorithm::BPix_p3
private

Definition at line 344 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const double SiPixelDigitizerAlgorithm::bunchScaleAt25
private

Definition at line 311 of file SiPixelDigitizerAlgorithm.h.

Referenced by calculateInstlumiFactor().

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

Definition at line 378 of file SiPixelDigitizerAlgorithm.h.

Referenced by initCal().

const float SiPixelDigitizerAlgorithm::ClusterWidth
private

Definition at line 305 of file SiPixelDigitizerAlgorithm.h.

Referenced by induce_signal().

const Parameters SiPixelDigitizerAlgorithm::DeadModules
private

Definition at line 290 of file SiPixelDigitizerAlgorithm.h.

Referenced by module_killing_conf().

const float SiPixelDigitizerAlgorithm::Dist300
private

Definition at line 299 of file SiPixelDigitizerAlgorithm.h.

Referenced by drift().

const bool SiPixelDigitizerAlgorithm::doMissCalibrate
private

Definition at line 358 of file SiPixelDigitizerAlgorithm.h.

Referenced by make_digis().

const double SiPixelDigitizerAlgorithm::electronsPerVCAL
private

Definition at line 329 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const double SiPixelDigitizerAlgorithm::electronsPerVCAL_Offset
private

Definition at line 330 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

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

Definition at line 374 of file SiPixelDigitizerAlgorithm.h.

Referenced by fluctuateEloss().

const bool SiPixelDigitizerAlgorithm::fluctuateCharge
private

Definition at line 351 of file SiPixelDigitizerAlgorithm.h.

Referenced by primary_ionization().

const float SiPixelDigitizerAlgorithm::FPix_p0
private

Definition at line 337 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const float SiPixelDigitizerAlgorithm::FPix_p1
private

Definition at line 338 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const float SiPixelDigitizerAlgorithm::FPix_p2
private

Definition at line 339 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

const float SiPixelDigitizerAlgorithm::FPix_p3
private

Definition at line 340 of file SiPixelDigitizerAlgorithm.h.

Referenced by missCalibrate().

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

Definition at line 81 of file SiPixelDigitizerAlgorithm.h.

const float SiPixelDigitizerAlgorithm::GeVperElectron
private

Definition at line 295 of file SiPixelDigitizerAlgorithm.h.

Referenced by primary_ionization().

const bool SiPixelDigitizerAlgorithm::makeDigiSimLinks_
private

Definition at line 283 of file SiPixelDigitizerAlgorithm.h.

Referenced by induce_signal(), and make_digis().

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

Definition at line 80 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 431 of file SiPixelDigitizerAlgorithm.h.

Referenced by drift().

const PixelEfficiencies SiPixelDigitizerAlgorithm::pixelEfficiencies_
private

Definition at line 430 of file SiPixelDigitizerAlgorithm.h.

Referenced by calculateInstlumiFactor(), and digitize().

const float SiPixelDigitizerAlgorithm::Sigma0
private

Definition at line 298 of file SiPixelDigitizerAlgorithm.h.

Referenced by drift().

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

Definition at line 77 of file SiPixelDigitizerAlgorithm.h.

Referenced by module_killing_DB().

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

Definition at line 74 of file SiPixelDigitizerAlgorithm.h.

Referenced by DriftDirection().

const float SiPixelDigitizerAlgorithm::tanLorentzAnglePerTesla_BPix
private

Definition at line 335 of file SiPixelDigitizerAlgorithm.h.

Referenced by DriftDirection().

const float SiPixelDigitizerAlgorithm::tanLorentzAnglePerTesla_FPix
private

Definition at line 334 of file SiPixelDigitizerAlgorithm.h.

Referenced by DriftDirection().

const int SiPixelDigitizerAlgorithm::theAdcFullScale
private

Definition at line 315 of file SiPixelDigitizerAlgorithm.h.

Referenced by make_digis(), and SiPixelDigitizerAlgorithm().

const int SiPixelDigitizerAlgorithm::theAdcFullScaleStack
private

Definition at line 316 of file SiPixelDigitizerAlgorithm.h.

Referenced by make_digis().

const float SiPixelDigitizerAlgorithm::theElectronPerADC
private

Definition at line 314 of file SiPixelDigitizerAlgorithm.h.

Referenced by make_digis(), and SiPixelDigitizerAlgorithm().

const float SiPixelDigitizerAlgorithm::theGainSmearing
private

Definition at line 359 of file SiPixelDigitizerAlgorithm.h.

const double SiPixelDigitizerAlgorithm::theInstLumiScaleFactor
private

Definition at line 310 of file SiPixelDigitizerAlgorithm.h.

Referenced by calculateInstlumiFactor().

const float SiPixelDigitizerAlgorithm::theNoiseInElectrons
private

Definition at line 317 of file SiPixelDigitizerAlgorithm.h.

Referenced by add_noise(), and digitize().

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

Definition at line 375 of file SiPixelDigitizerAlgorithm.h.

Referenced by add_noise().

const float SiPixelDigitizerAlgorithm::theOffsetSmearing
private

Definition at line 360 of file SiPixelDigitizerAlgorithm.h.

const float SiPixelDigitizerAlgorithm::theReadoutNoise
private

Definition at line 318 of file SiPixelDigitizerAlgorithm.h.

Referenced by add_noise().

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

Definition at line 421 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 323 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 326 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const double SiPixelDigitizerAlgorithm::theThresholdSmearing_BPix_L1
private

Definition at line 327 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const double SiPixelDigitizerAlgorithm::theThresholdSmearing_FPix
private

Definition at line 325 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const float SiPixelDigitizerAlgorithm::theTofLowerCut
private

Definition at line 332 of file SiPixelDigitizerAlgorithm.h.

Referenced by accumulateSimHits().

const float SiPixelDigitizerAlgorithm::theTofUpperCut
private

Definition at line 333 of file SiPixelDigitizerAlgorithm.h.

Referenced by accumulateSimHits().

const double SiPixelDigitizerAlgorithm::tMax
private

Definition at line 370 of file SiPixelDigitizerAlgorithm.h.

Referenced by fluctuateEloss(), and SiPixelDigitizerAlgorithm().

const bool SiPixelDigitizerAlgorithm::use_deadmodule_DB_
private

Definition at line 287 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const bool SiPixelDigitizerAlgorithm::use_ineff_from_db_
private

Definition at line 285 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().

const bool SiPixelDigitizerAlgorithm::use_LorentzAngle_DB_
private

Definition at line 288 of file SiPixelDigitizerAlgorithm.h.

Referenced by DriftDirection().

const bool SiPixelDigitizerAlgorithm::use_module_killing_
private

Definition at line 286 of file SiPixelDigitizerAlgorithm.h.

Referenced by digitize().