CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Attributes
edm::DataMixingSiPixelMCDigiWorker Class Reference

#include <DataMixingSiPixelMCDigiWorker.h>

Classes

struct  PixelEfficiencies
 

Public Member Functions

void addSiPixelPileups (const int bcr, const edm::EventPrincipal *, unsigned int EventId, ModuleCallingContext const *)
 
void addSiPixelSignals (const edm::Event &e)
 
 DataMixingSiPixelMCDigiWorker ()
 
 DataMixingSiPixelMCDigiWorker (const edm::ParameterSet &ps, edm::ConsumesCollector &&iC)
 
void init_DynIneffDB (const edm::EventSetup &, const unsigned int &)
 
virtual void initializeEvent (edm::Event const &e, edm::EventSetup const &c)
 
void putSiPixel (edm::Event &e, edm::EventSetup const &iSetup, std::vector< PileupSummaryInfo > &ps, int &bs)
 
void setPileupInfo (const std::vector< PileupSummaryInfo > &ps, const int &bs)
 
virtual ~DataMixingSiPixelMCDigiWorker ()
 

Private Types

typedef int Amplitude
 
typedef std::multimap< int, PixelDigiOneDetectorMap
 
typedef std::map< uint32_t, OneDetectorMapSiGlobalIndex
 
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_typesignalMaps
 

Private Attributes

signalMaps _signal
 
const bool AddPixelInefficiency
 
bool FirstCall_
 
const std::string geometryType_
 
std::string label_
 
const int NumberOfBarrelLayers
 
const int NumberOfEndcapDisks
 
edm::ESHandle< TrackerGeometrypDD
 
edm::InputTag pixeldigi_collectionPile_
 
edm::InputTag pixeldigi_collectionSig_
 
std::string PixelDigiCollectionDM_
 
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiPToken_
 
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiToken_
 
PixelEfficiencies pixelEff_
 
SiGlobalIndex SiHitStorage_
 
edm::ESHandle< SiPixelDynamicInefficiencySiPixelDynamicInefficiency_
 

Detailed Description

Definition at line 53 of file DataMixingSiPixelMCDigiWorker.h.

Member Typedef Documentation

Definition at line 132 of file DataMixingSiPixelMCDigiWorker.h.

Definition at line 141 of file DataMixingSiPixelMCDigiWorker.h.

Definition at line 142 of file DataMixingSiPixelMCDigiWorker.h.

typedef signal_map_type::const_iterator edm::DataMixingSiPixelMCDigiWorker::signal_map_const_iterator
private

Definition at line 135 of file DataMixingSiPixelMCDigiWorker.h.

typedef signal_map_type::iterator edm::DataMixingSiPixelMCDigiWorker::signal_map_iterator
private

Definition at line 134 of file DataMixingSiPixelMCDigiWorker.h.

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

Definition at line 133 of file DataMixingSiPixelMCDigiWorker.h.

Definition at line 136 of file DataMixingSiPixelMCDigiWorker.h.

Constructor & Destructor Documentation

edm::DataMixingSiPixelMCDigiWorker::DataMixingSiPixelMCDigiWorker ( )
DataMixingSiPixelMCDigiWorker::DataMixingSiPixelMCDigiWorker ( const edm::ParameterSet ps,
edm::ConsumesCollector &&  iC 
)
explicit

standard constructor

Definition at line 42 of file DataMixingSiPixelMCDigiWorker.cc.

References FirstCall_, edm::ParameterSet::getParameter(), pixeldigi_collectionPile_, pixeldigi_collectionSig_, PixelDigiCollectionDM_, PixelDigiPToken_, PixelDigiToken_, SiHitStorage_, and AlCaHLTBitMon_QueryRunRegistry::string.

42  :
43  label_(ps.getParameter<std::string>("Label")),
44  geometryType_(ps.getParameter<std::string>("GeometryType")),
45  // get external parameters:
46  // To account for upgrade geometries do not assume the number
47  // of layers or disks.
48  NumberOfBarrelLayers(ps.exists("NumPixelBarrel")?ps.getParameter<int>("NumPixelBarrel"):3),
49  NumberOfEndcapDisks(ps.exists("NumPixelEndcap")?ps.getParameter<int>("NumPixelEndcap"):2),
50  //theInstLumiScaleFactor(ps.getParameter<double>("theInstLumiScaleFactor")), //For dynamic inefficiency PU scaling
51  //bunchScaleAt25(ps.getParameter<double>("bunchScaleAt25")), //For dynamic inefficiency bunchspace scaling
52  // Control the pixel inefficiency
53  AddPixelInefficiency(ps.getParameter<bool>("AddPixelInefficiency")),
55  {
56 
57  // get the subdetector names
58  // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do...
59 
60  // declare the products to produce
61 
62  pixeldigi_collectionSig_ = ps.getParameter<edm::InputTag>("pixeldigiCollectionSig");
63  pixeldigi_collectionPile_ = ps.getParameter<edm::InputTag>("pixeldigiCollectionPile");
64  PixelDigiCollectionDM_ = ps.getParameter<std::string>("PixelDigiCollectionDM");
65 
68 
69  // clear local storage for this event
70  SiHitStorage_.clear();
71 
72  FirstCall_ = true;
73 
74  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiToken_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiPToken_
DataMixingSiPixelMCDigiWorker::~DataMixingSiPixelMCDigiWorker ( )
virtual

Default destructor

Definition at line 78 of file DataMixingSiPixelMCDigiWorker.cc.

78  {
79  }

Member Function Documentation

void DataMixingSiPixelMCDigiWorker::addSiPixelPileups ( const int  bcr,
const edm::EventPrincipal ep,
unsigned int  EventId,
ModuleCallingContext const *  mcc 
)

Definition at line 318 of file DataMixingSiPixelMCDigiWorker.cc.

References begin, edm::DetSetVector< T >::begin(), end, edm::DetSetVector< T >::end(), edm::EventPrincipal::id(), input, LogDebug, pixeldigi_collectionPile_, and SiHitStorage_.

Referenced by edm::DataMixingModule::pileWorker().

319  {
320 
321  LogDebug("DataMixingSiPixelMCDigiWorker") <<"\n===============> adding pileups from event "<<ep->id()<<" for bunchcrossing "<<bcr;
322 
323  // fill in maps of hits; same code as addSignals, except now applied to the pileup events
324 
325  std::shared_ptr<Wrapper<edm::DetSetVector<PixelDigi> > const> inputPTR =
326  getProductByTag<edm::DetSetVector<PixelDigi> >(*ep, pixeldigi_collectionPile_, mcc);
327 
328  if(inputPTR ) {
329 
330  const edm::DetSetVector<PixelDigi> *input = const_cast< edm::DetSetVector<PixelDigi> * >(inputPTR->product());
331 
332 
333 
334  // Handle< edm::DetSetVector<PixelDigi> > input;
335 
336  // if( e->getByLabel(pixeldigi_collectionPile_,input) ) {
337 
338  //loop on all detsets (detectorIDs) inside the input collection
340  for (; DSViter!=input->end();DSViter++){
341 
342 #ifdef DEBUG
343  LogDebug("DataMixingSiPixelMCDigiWorker") << "Pileups: Processing DetID " << DSViter->id;
344 #endif
345 
346  uint32_t detID = DSViter->id;
350 
351  // find correct local map (or new one) for this detector ID
352 
353  SiGlobalIndex::const_iterator itest;
354 
355  itest = SiHitStorage_.find(detID);
356 
357  if(itest!=SiHitStorage_.end()) { // this detID already has hits, add to existing map
358 
359  OneDetectorMap LocalMap = itest->second;
360 
361  // fill in local map with extra channels
362  for (icopy=begin; icopy!=end; icopy++) {
363  LocalMap.insert(OneDetectorMap::value_type( (icopy->channel()), *icopy ));
364  }
365 
366  SiHitStorage_[detID]=LocalMap;
367 
368  }
369  else{ // fill local storage with this information, put in global collection
370 
371  OneDetectorMap LocalMap;
372 
373  for (icopy=begin; icopy!=end; icopy++) {
374  LocalMap.insert(OneDetectorMap::value_type( (icopy->channel()), *icopy ));
375  }
376 
377  SiHitStorage_.insert( SiGlobalIndex::value_type( detID, LocalMap ) );
378  }
379 
380  }
381  }
382  }
#define LogDebug(id)
std::multimap< int, PixelDigi > OneDetectorMap
EventID const & id() const
static std::string const input
Definition: EdmProvDump.cc:44
#define end
Definition: vmac.h:37
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:361
#define begin
Definition: vmac.h:30
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:346
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
void DataMixingSiPixelMCDigiWorker::addSiPixelSignals ( const edm::Event e)

Definition at line 282 of file DataMixingSiPixelMCDigiWorker.cc.

References begin, end, edm::Event::getByToken(), edm::EventBase::id(), input, LogDebug, PixelDigiToken_, and SiHitStorage_.

Referenced by edm::DataMixingModule::addSignals().

282  {
283  // fill in maps of hits
284 
285  LogDebug("DataMixingSiPixelMCDigiWorker")<<"===============> adding MC signals for "<<e.id();
286 
287  Handle< edm::DetSetVector<PixelDigi> > input;
288 
289  if( e.getByToken(PixelDigiToken_,input) ) {
290 
291  //loop on all detsets (detectorIDs) inside the input collection
292  edm::DetSetVector<PixelDigi>::const_iterator DSViter=input->begin();
293  for (; DSViter!=input->end();DSViter++){
294 
295 #ifdef DEBUG
296  LogDebug("DataMixingSiPixelMCDigiWorker") << "Processing DetID " << DSViter->id;
297 #endif
298 
299  uint32_t detID = DSViter->id;
303 
304  OneDetectorMap LocalMap;
305 
306  for (icopy=begin; icopy!=end; icopy++) {
307  LocalMap.insert(OneDetectorMap::value_type( (icopy->channel()), *icopy ));
308  }
309 
310  SiHitStorage_.insert( SiGlobalIndex::value_type( detID, LocalMap ) );
311  }
312 
313  }
314  } // end of addSiPixelSignals
#define LogDebug(id)
std::multimap< int, PixelDigi > OneDetectorMap
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiToken_
static std::string const input
Definition: EdmProvDump.cc:44
#define end
Definition: vmac.h:37
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:361
edm::EventID id() const
Definition: EventBase.h:60
#define begin
Definition: vmac.h:30
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
void DataMixingSiPixelMCDigiWorker::init_DynIneffDB ( const edm::EventSetup es,
const unsigned int &  bunchspace 
)

Definition at line 217 of file DataMixingSiPixelMCDigiWorker.cc.

References AddPixelInefficiency, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::FromConfig, edm::EventSetup::get(), edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::init_from_db(), pDD, pixelEff_, and SiPixelDynamicInefficiency_.

Referenced by putSiPixel().

void DataMixingSiPixelMCDigiWorker::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
virtual

Definition at line 83 of file DataMixingSiPixelMCDigiWorker.cc.

References geometryType_, edm::EventSetup::get(), and pDD.

Referenced by edm::DataMixingModule::initializeEvent().

83  {
84 
85  iSetup.get<TrackerDigiGeometryRecord>().get(geometryType_, pDD);
86  //edm::ESHandle<TrackerTopology> tTopoHand;
87  //iSetup.get<IdealGeometryRecord>().get(tTopoHand);
88  //const TrackerTopology *tTopo=tTopoHand.product();
89  }
void DataMixingSiPixelMCDigiWorker::putSiPixel ( edm::Event e,
edm::EventSetup const &  iSetup,
std::vector< PileupSummaryInfo > &  ps,
int &  bs 
)

Definition at line 386 of file DataMixingSiPixelMCDigiWorker.cc.

References _signal, ecalMGPA::adc(), officialStyle::chan, PixelDigi::channelToPixel(), edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::ChipGeomFactors, cuy::col, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::ColGeomFactors, mps_check::columns, TrackerGeometry::detUnits(), FirstCall_, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::FPixIndex, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::FromConfig, GeomDet::geographicalId(), edm::EventSetup::get(), edm::RandomNumberGenerator::getEngine(), mps_fire::i, init_DynIneffDB(), edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::iPU, PVValHelper::ladder, TrackerTopology::layer(), LogDebug, python.rootplot.argparse::module, eostools::move(), PixelTopology::ncolumns(), PixelTopology::nrows(), NumberOfBarrelLayers, GeomDetEnumerators::P1PXB, GeomDetEnumerators::P1PXEC, GeomDetEnumerators::P2OTB, GeomDetEnumerators::P2OTEC, GeomDetEnumerators::P2PXB, GeomDetEnumerators::P2PXEC, pDD, GeomDetEnumerators::PixelBarrel, PixelDigiCollectionDM_, pixelEff_, GeomDetEnumerators::PixelEndcap, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::PixelGeomFactors, edm::ESHandle< T >::product(), edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::pu_scale, edm::DetSet< T >::push_back(), edm::Event::put(), TrackerTopology::pxbLadder(), TrackerTopology::pxbModule(), TrackerTopology::pxfModule(), TrackerTopology::pxfPanel(), rand(), DetId::rawId(), setPileupInfo(), SiHitStorage_, PixelGeomDetUnit::specificTopology(), edm::Event::streamID(), GeomDet::subDetector(), edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::theInnerEfficiency_FPix, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::theLadderEfficiency_BPix, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::theModuleEfficiency_BPix, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::theOuterEfficiency_FPix, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::thePixelChipEfficiency, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::thePixelColEfficiency, and edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::thePixelEfficiency.

Referenced by edm::DataMixingModule::put().

386  {
387 
388  // collection of Digis to put in the event
389 
390  std::vector< edm::DetSet<PixelDigi> > vPixelDigi;
391 
392  // loop through our collection of detectors, merging hits and putting new ones in the output
393 
394  _signal.clear();
395 
396  // big loop over Detector IDs:
397 
398  for(SiGlobalIndex::const_iterator IDet = SiHitStorage_.begin();
399  IDet != SiHitStorage_.end(); IDet++) {
400 
401  uint32_t detID = IDet->first;
402 
403  OneDetectorMap LocalMap = IDet->second;
404 
405  signal_map_type Signals;
406  Signals.clear();
407 
408  //counter variables
409  int formerPixel = -1;
410  int currentPixel;
411  int ADCSum = 0;
412 
413 
414  OneDetectorMap::const_iterator iLocalchk;
415 
416  for(OneDetectorMap::const_iterator iLocal = LocalMap.begin();
417  iLocal != LocalMap.end(); ++iLocal) {
418 
419  currentPixel = iLocal->first;
420 
421  if (currentPixel == formerPixel) { // we have to add these digis together
422  ADCSum+=(iLocal->second).adc();
423  }
424  else{
425  if(formerPixel!=-1){ // ADC info stolen from SiStrips...
426  if (ADCSum > 511) ADCSum = 255;
427  else if (ADCSum > 253 && ADCSum < 512) ADCSum = 254;
428 
429  Signals.insert( std::make_pair(formerPixel, ADCSum));
430  //PixelDigi aHit(formerPixel, ADCSum);
431  //SPD.push_back( aHit );
432  }
433  // save pointers for next iteration
434  formerPixel = currentPixel;
435  ADCSum = (iLocal->second).adc();
436  }
437 
438  iLocalchk = iLocal;
439  if((++iLocalchk) == LocalMap.end()) { //make sure not to lose the last one
440  if (ADCSum > 511) ADCSum = 255;
441  else if (ADCSum > 253 && ADCSum < 512) ADCSum = 254;
442  Signals.insert( std::make_pair(formerPixel, ADCSum));
443  //SPD.push_back( PixelDigi(formerPixel, ADCSum) );
444  }
445 
446  }// end of loop over one detector
447 
448  // stick this into the global vector of detector info
449  _signal.insert( std::make_pair( detID, Signals));
450 
451  } // end of big loop over all detector IDs
452 
453  // put the collection of digis in the event
454  LogInfo("DataMixingSiPixelMCDigiWorker") << "total # Merged Pixels: " << _signal.size() ;
455 
456  // Now, we have to run Lumi-Dependent efficiency calculation on the merged pixels.
457  // This is the only place where we have the PreMixed pileup information so that we can calculate
458  // the instantaneous luminosity and do the dynamic inefficiency.
459 
461  CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID());
462 
464  iSetup.get<TrackerTopologyRcd>().get(tTopoHand);
465  const TrackerTopology *tTopo=tTopoHand.product();
466 
467  // Load inefficiency constants (1st pass), set pileup information.
468 
469  if(FirstCall_) {
470  init_DynIneffDB(iSetup, bs);
471  FirstCall_ = false;
472  }
473 
474  setPileupInfo(ps, bs);
475 
476  for( const auto& iu : pDD->detUnits()) {
477 
478  if(iu->type().isTrackerPixel()) {
479 
480  //
481  const PixelGeomDetUnit* pixdet = dynamic_cast<const PixelGeomDetUnit*>(iu);
482  uint32_t detID = pixdet->geographicalId().rawId();
483 
484  // fetch merged hits for this detID
485 
486  signal_map_type& theSignal = _signal[detID];
487 
488  // if we have some hits...
489  if(!theSignal.empty()) {
490 
491  edm::DetSet<PixelDigi> SPD(detID); // make empty vector with this detID so we can push back digis at the end
492 
493  const PixelTopology* topol=&pixdet->specificTopology();
494  int numColumns = topol->ncolumns(); // det module number of cols&rows
495  int numRows = topol->nrows();
496 
497  // do inefficiency calculation, drop some pixel hits
498 
499  // Predefined efficiencies
500  double pixelEfficiency = 1.0;
501  double columnEfficiency = 1.0;
502  double chipEfficiency = 1.0;
503 
504  if (pixelEff_.FromConfig) {
505  // setup the chip indices conversion
508  pixdet->subDetector()==GeomDetEnumerators::SubDetector::P2PXB){// barrel layers
509  int layerIndex=tTopo->layer(detID);
510  pixelEfficiency = pixelEff_.thePixelEfficiency[layerIndex-1];
511  columnEfficiency = pixelEff_.thePixelColEfficiency[layerIndex-1];
512  chipEfficiency = pixelEff_.thePixelChipEfficiency[layerIndex-1];
513  //std::cout <<"Using BPix columnEfficiency = "<<columnEfficiency<< " for layer = "<<layerIndex <<"\n";
514  // This should never happen, but only check if it is not an upgrade geometry
515  if (NumberOfBarrelLayers==3){
516  if(numColumns>416) LogWarning ("Pixel Geometry") <<" wrong columns in barrel "<<numColumns;
517  if(numRows>160) LogWarning ("Pixel Geometry") <<" wrong rows in barrel "<<numRows;
518 
519  int ladder=tTopo->pxbLadder(detID);
520  int module=tTopo->pxbModule(detID);
521  if (module<=4) module=5-module;
522  else module-=4;
523 
524  columnEfficiency *= pixelEff_.theLadderEfficiency_BPix[layerIndex-1][ladder-1]*pixelEff_.theModuleEfficiency_BPix[layerIndex-1][module-1]*pixelEff_.pu_scale[layerIndex-1];
525  }
528  pixdet->subDetector()==GeomDetEnumerators::SubDetector::P2PXEC){ // forward disks
529 
530  unsigned int diskIndex=tTopo->layer(detID)+pixelEff_.FPixIndex; // Use diskIndex-1 later to stay consistent with BPix
531  unsigned int panelIndex=tTopo->pxfPanel(detID);
532  unsigned int moduleIndex=tTopo->pxfModule(detID);
533  //if (pixelEff_.FPixIndex>diskIndex-1){throw cms::Exception("Configuration") <<"SiPixelDigitizer is using the wrong efficiency value. index = "
534  // <<diskIndex-1<<" , MinIndex = "<<pixelEff_.FPixIndex<<" ... "<<tTopo->pxfDisk(detID);}
535  pixelEfficiency = pixelEff_.thePixelEfficiency[diskIndex-1];
536  columnEfficiency = pixelEff_.thePixelColEfficiency[diskIndex-1];
537  chipEfficiency = pixelEff_.thePixelChipEfficiency[diskIndex-1];
538  //std::cout <<"Using FPix columnEfficiency = "<<columnEfficiency<<" for Disk = "<< tTopo->pxfDisk(detID)<<"\n";
539  // Sometimes the forward pixels have wrong size,
540  // this crashes the index conversion, so exit, but only check if it is not an upgrade geometry
541  if (NumberOfBarrelLayers==3){ // whether it is the present or the phase 1 detector can be checked using GeomDetEnumerators::SubDetector
542  if(numColumns>260 || numRows>160) {
543  if(numColumns>260) LogWarning ("Pixel Geometry") <<" wrong columns in endcaps "<<numColumns;
544  if(numRows>160) LogWarning ("Pixel Geometry") <<" wrong rows in endcaps "<<numRows;
545  return;
546  }
547  if ((panelIndex==1 && (moduleIndex==1 || moduleIndex==2)) || (panelIndex==2 && moduleIndex==1)) { //inner modules
548  columnEfficiency*=pixelEff_.theInnerEfficiency_FPix[diskIndex-1]*pixelEff_.pu_scale[3];
549  } else { //outer modules
550  columnEfficiency*=pixelEff_.theOuterEfficiency_FPix[diskIndex-1]*pixelEff_.pu_scale[4];
551  }
552  } // current detector, forward
554  // If phase 2 outer tracker, hardcoded values as they have been so far
555  pixelEfficiency = 0.999;
556  columnEfficiency = 0.999;
557  chipEfficiency = 0.999;
558  } // if barrel/forward
559  } else { // Load precomputed factors from Database
560  pixelEfficiency = pixelEff_.PixelGeomFactors.at(detID);
561  columnEfficiency = pixelEff_.ColGeomFactors.at(detID)*pixelEff_.pu_scale[pixelEff_.iPU.at(detID)];
562  chipEfficiency = pixelEff_.ChipGeomFactors.at(detID);
563  }
564 
565 #ifdef TP_DEBUG
566  LogDebug ("Pixel Digitizer") << " enter pixel_inefficiency " << pixelEfficiency << " "
567  << columnEfficiency << " " << chipEfficiency;
568 #endif
569 
570  // Initilize the index converter
571  //PixelIndices indexConverter(numColumns,numRows);
572  std::unique_ptr<PixelIndices> pIndexConverter(new PixelIndices(numColumns,numRows));
573 
574 
575  int chipIndex = 0;
576  int rowROC = 0;
577  int colROC = 0;
578  std::map<int, int, std::less<int> >chips, columns;
579  std::map<int, int, std::less<int> >::iterator iter;
580 
581  // Find out the number of columns and rocs hits
582  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
583  for (signal_map_const_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
584 
585  int chan = i->first;
586  std::pair<int,int> ip = PixelDigi::channelToPixel(chan);
587  int row = ip.first; // X in row
588  int col = ip.second; // Y is in col
589  //transform to ROC index coordinates
590  pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
591  int dColInChip = pIndexConverter->DColumn(colROC); // get ROC dcol from ROC col
592  //dcol in mod
593  int dColInDet = pIndexConverter->DColumnInModule(dColInChip,chipIndex);
594 
595  chips[chipIndex]++;
596  columns[dColInDet]++;
597  }
598 
599  // Delete some ROC hits.
600  for ( iter = chips.begin(); iter != chips.end() ; iter++ ) {
601  //float rand = RandFlat::shoot();
602  float rand = CLHEP::RandFlat::shoot(engine);
603  if( rand > chipEfficiency ) chips[iter->first]=0;
604  }
605 
606  // Delete some Dcol hits.
607  for ( iter = columns.begin(); iter != columns.end() ; iter++ ) {
608  //float rand = RandFlat::shoot();
609  float rand = CLHEP::RandFlat::shoot(engine);
610  if( rand > columnEfficiency ) columns[iter->first]=0;
611  }
612 
613  // Now loop again over pixels to kill some of them.
614  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
615  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
616 
617  // int chan = i->first;
618  std::pair<int,int> ip = PixelDigi::channelToPixel(i->first);//get pixel pos
619  int row = ip.first; // X in row
620  int col = ip.second; // Y is in col
621  //transform to ROC index coordinates
622  pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
623  int dColInChip = pIndexConverter->DColumn(colROC); //get ROC dcol from ROC col
624  //dcol in mod
625  int dColInDet = pIndexConverter->DColumnInModule(dColInChip,chipIndex);
626 
627  //float rand = RandFlat::shoot();
628  float rand = CLHEP::RandFlat::shoot(engine);
629  if( chips[chipIndex]==0 || columns[dColInDet]==0
630  || rand>pixelEfficiency ) {
631  // make pixel amplitude =0, pixel will be lost at clusterization
632  i->second=(0.); // reset amplitude
633  } // end if
634  //Make a new Digi:
635 
636  // Don't put in digis that have been killed:
637  if(i->second > 0.) {
638  SPD.push_back( PixelDigi(i->first, i->second) );
639  }
640  } // end pixel loop
641  // push back vector here of one detID
642 
643  vPixelDigi.push_back(SPD);
644  }
645  }
646  }// end of loop over detectors
647 
648  // make new digi collection
649 
650  std::unique_ptr< edm::DetSetVector<PixelDigi> > MyPixelDigis(new edm::DetSetVector<PixelDigi>(vPixelDigi) );
651 
652  // put collection
653 
654  e.put(std::move(MyPixelDigis), PixelDigiCollectionDM_ );
655 
656  // clear local storage for this event
657  SiHitStorage_.clear();
658  }
#define LogDebug(id)
int adc(sample_type sample)
get the ADC sample (12 bits)
virtual int nrows() const =0
void init_DynIneffDB(const edm::EventSetup &, const unsigned int &)
std::multimap< int, PixelDigi > OneDetectorMap
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
unsigned int pxbLadder(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
signal_map_type::const_iterator signal_map_const_iterator
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:79
std::map< int, Amplitude, std::less< int > > signal_map_type
unsigned int pxfModule(const DetId &id) const
void setPileupInfo(const std::vector< PileupSummaryInfo > &ps, const int &bs)
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.
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
unsigned int layer(const DetId &id) const
virtual int ncolumns() const =0
StreamID streamID() const
Definition: Event.h:86
col
Definition: cuy.py:1008
Signal rand(Signal arg)
Definition: vlib.cc:442
virtual SubDetector subDetector() const
Which subdetector.
Definition: GeomDet.cc:44
T const * product() const
Definition: ESHandle.h:86
Definition: vlib.h:208
unsigned int pxfPanel(const DetId &id) const
def move(src, dest)
Definition: eostools.py:510
void DataMixingSiPixelMCDigiWorker::setPileupInfo ( const std::vector< PileupSummaryInfo > &  ps,
const int &  bs 
)

Definition at line 660 of file DataMixingSiPixelMCDigiWorker.cc.

References mps_fire::i, gen::n, AlCaHLTBitMon_ParallelJobs::p, pixelEff_, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::pu_scale, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::theInstLumiScaleFactor, and edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::thePUEfficiency.

Referenced by putSiPixel().

660  {
661 
662  //double bunchScale=1.0;
663  //if (bunchSpacing==25) bunchScale=bunchScaleAt25;
664 
665  int p = -1;
666  for ( unsigned int i=0; i<ps.size(); i++)
667  if ( ps[i].getBunchCrossing() == 0 )
668  p=i;
669 
670  if ( p>=0 ) {
671  for (size_t i=0, n = pixelEff_.thePUEfficiency.size(); i<n; i++) {
672  double instlumi = ps[p].getTrueNumInteractions()*pixelEff_.theInstLumiScaleFactor;
673  double instlumi_pow=1.;
674  pixelEff_.pu_scale[i] = 0;
675  for (size_t j=0; j<pixelEff_.thePUEfficiency[i].size(); j++){
676  pixelEff_.pu_scale[i]+=instlumi_pow*pixelEff_.thePUEfficiency[i][j];
677  instlumi_pow*=instlumi;
678  }
679  }
680  }
681 
682 } //this sets pu_scale

Member Data Documentation

signalMaps edm::DataMixingSiPixelMCDigiWorker::_signal
private

Definition at line 139 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by putSiPixel().

const bool edm::DataMixingSiPixelMCDigiWorker::AddPixelInefficiency
private

Definition at line 159 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by init_DynIneffDB().

bool edm::DataMixingSiPixelMCDigiWorker::FirstCall_
private

Definition at line 163 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by DataMixingSiPixelMCDigiWorker(), and putSiPixel().

const std::string edm::DataMixingSiPixelMCDigiWorker::geometryType_
private

Definition at line 150 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by initializeEvent().

std::string edm::DataMixingSiPixelMCDigiWorker::label_
private
const int edm::DataMixingSiPixelMCDigiWorker::NumberOfBarrelLayers
private
const int edm::DataMixingSiPixelMCDigiWorker::NumberOfEndcapDisks
private
edm::ESHandle<TrackerGeometry> edm::DataMixingSiPixelMCDigiWorker::pDD
private

Definition at line 123 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by init_DynIneffDB(), initializeEvent(), and putSiPixel().

edm::InputTag edm::DataMixingSiPixelMCDigiWorker::pixeldigi_collectionPile_
private
edm::InputTag edm::DataMixingSiPixelMCDigiWorker::pixeldigi_collectionSig_
private

Definition at line 116 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by DataMixingSiPixelMCDigiWorker().

std::string edm::DataMixingSiPixelMCDigiWorker::PixelDigiCollectionDM_
private

Definition at line 118 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by DataMixingSiPixelMCDigiWorker(), and putSiPixel().

edm::EDGetTokenT<edm::DetSetVector<PixelDigi> > edm::DataMixingSiPixelMCDigiWorker::PixelDigiPToken_
private

Definition at line 121 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by DataMixingSiPixelMCDigiWorker().

edm::EDGetTokenT<edm::DetSetVector<PixelDigi> > edm::DataMixingSiPixelMCDigiWorker::PixelDigiToken_
private
PixelEfficiencies edm::DataMixingSiPixelMCDigiWorker::pixelEff_
private

Definition at line 161 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by init_DynIneffDB(), putSiPixel(), and setPileupInfo().

SiGlobalIndex edm::DataMixingSiPixelMCDigiWorker::SiHitStorage_
private
edm::ESHandle<SiPixelDynamicInefficiency> edm::DataMixingSiPixelMCDigiWorker::SiPixelDynamicInefficiency_
private

Definition at line 126 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by init_DynIneffDB().