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 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,
PixelDigi
OneDetectorMap
 
typedef std::map< uint32_t,
OneDetectorMap
SiGlobalIndex
 
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
 

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

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:462
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:59
#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(), PixelDigi::channelToPixel(), edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::ChipGeomFactors, cuy::col, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::ColGeomFactors, mps_check::columns, FirstCall_, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::FPixIndex, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::FromConfig, GeomDet::geographicalId(), edm::EventSetup::get(), edm::RandomNumberGenerator::getEngine(), i, init_DynIneffDB(), edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::iPU, TrackerTopology::layer(), LogDebug, python.rootplot.argparse::module, PixelTopology::ncolumns(), PixelTopology::nrows(), NumberOfBarrelLayers, GeomDetEnumerators::P1PXB, GeomDetEnumerators::P1PXEC, GeomDetEnumerators::P2OTB, GeomDetEnumerators::P2OTEC, GeomDetEnumerators::P2PXEC, pDD, GeomDetEnumerators::PixelBarrel, PixelDigiCollectionDM_, pixelEff_, GeomDetEnumerators::PixelEndcap, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::PixelGeomFactors, edm::ESHandle< class >::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(TrackingGeometry::DetUnitContainer::const_iterator iu = pDD->detUnits().begin(); iu != pDD->detUnits().end(); iu ++){
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.size()>0) {
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
507  pixdet->subDetector()==GeomDetEnumerators::SubDetector::P1PXB){// barrel layers
508  int layerIndex=tTopo->layer(detID);
509  pixelEfficiency = pixelEff_.thePixelEfficiency[layerIndex-1];
510  columnEfficiency = pixelEff_.thePixelColEfficiency[layerIndex-1];
511  chipEfficiency = pixelEff_.thePixelChipEfficiency[layerIndex-1];
512  //std::cout <<"Using BPix columnEfficiency = "<<columnEfficiency<< " for layer = "<<layerIndex <<"\n";
513  // This should never happen, but only check if it is not an upgrade geometry
514  if (NumberOfBarrelLayers==3){
515  if(numColumns>416) LogWarning ("Pixel Geometry") <<" wrong columns in barrel "<<numColumns;
516  if(numRows>160) LogWarning ("Pixel Geometry") <<" wrong rows in barrel "<<numRows;
517 
518  int ladder=tTopo->pxbLadder(detID);
519  int module=tTopo->pxbModule(detID);
520  if (module<=4) module=5-module;
521  else module-=4;
522 
523  columnEfficiency *= pixelEff_.theLadderEfficiency_BPix[layerIndex-1][ladder-1]*pixelEff_.theModuleEfficiency_BPix[layerIndex-1][module-1]*pixelEff_.pu_scale[layerIndex-1];
524  }
527  pixdet->subDetector()==GeomDetEnumerators::SubDetector::P2PXEC){ // forward disks
528 
529  unsigned int diskIndex=tTopo->layer(detID)+pixelEff_.FPixIndex; // Use diskIndex-1 later to stay consistent with BPix
530  unsigned int panelIndex=tTopo->pxfPanel(detID);
531  unsigned int moduleIndex=tTopo->pxfModule(detID);
532  //if (pixelEff_.FPixIndex>diskIndex-1){throw cms::Exception("Configuration") <<"SiPixelDigitizer is using the wrong efficiency value. index = "
533  // <<diskIndex-1<<" , MinIndex = "<<pixelEff_.FPixIndex<<" ... "<<tTopo->pxfDisk(detID);}
534  pixelEfficiency = pixelEff_.thePixelEfficiency[diskIndex-1];
535  columnEfficiency = pixelEff_.thePixelColEfficiency[diskIndex-1];
536  chipEfficiency = pixelEff_.thePixelChipEfficiency[diskIndex-1];
537  //std::cout <<"Using FPix columnEfficiency = "<<columnEfficiency<<" for Disk = "<< tTopo->pxfDisk(detID)<<"\n";
538  // Sometimes the forward pixels have wrong size,
539  // this crashes the index conversion, so exit, but only check if it is not an upgrade geometry
540  if (NumberOfBarrelLayers==3){ // whether it is the present or the phase 1 detector can be checked using GeomDetEnumerators::SubDetector
541  if(numColumns>260 || numRows>160) {
542  if(numColumns>260) LogWarning ("Pixel Geometry") <<" wrong columns in endcaps "<<numColumns;
543  if(numRows>160) LogWarning ("Pixel Geometry") <<" wrong rows in endcaps "<<numRows;
544  return;
545  }
546  if ((panelIndex==1 && (moduleIndex==1 || moduleIndex==2)) || (panelIndex==2 && moduleIndex==1)) { //inner modules
547  columnEfficiency*=pixelEff_.theInnerEfficiency_FPix[diskIndex-1]*pixelEff_.pu_scale[3];
548  } else { //outer modules
549  columnEfficiency*=pixelEff_.theOuterEfficiency_FPix[diskIndex-1]*pixelEff_.pu_scale[4];
550  }
551  } // current detector, forward
553  // If phase 2 outer tracker, hardcoded values as they have been so far
554  pixelEfficiency = 0.999;
555  columnEfficiency = 0.999;
556  chipEfficiency = 0.999;
557  } // if barrel/forward
558  } else { // Load precomputed factors from Database
559  pixelEfficiency = pixelEff_.PixelGeomFactors.at(detID);
560  columnEfficiency = pixelEff_.ColGeomFactors.at(detID)*pixelEff_.pu_scale[pixelEff_.iPU.at(detID)];
561  chipEfficiency = pixelEff_.ChipGeomFactors.at(detID);
562  }
563 
564 #ifdef TP_DEBUG
565  LogDebug ("Pixel Digitizer") << " enter pixel_inefficiency " << pixelEfficiency << " "
566  << columnEfficiency << " " << chipEfficiency;
567 #endif
568 
569  // Initilize the index converter
570  //PixelIndices indexConverter(numColumns,numRows);
571  std::auto_ptr<PixelIndices> pIndexConverter(new PixelIndices(numColumns,numRows));
572 
573 
574  int chipIndex = 0;
575  int rowROC = 0;
576  int colROC = 0;
577  std::map<int, int, std::less<int> >chips, columns;
578  std::map<int, int, std::less<int> >::iterator iter;
579 
580  // Find out the number of columns and rocs hits
581  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
582  for (signal_map_const_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
583 
584  int chan = i->first;
585  std::pair<int,int> ip = PixelDigi::channelToPixel(chan);
586  int row = ip.first; // X in row
587  int col = ip.second; // Y is in col
588  //transform to ROC index coordinates
589  pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
590  int dColInChip = pIndexConverter->DColumn(colROC); // get ROC dcol from ROC col
591  //dcol in mod
592  int dColInDet = pIndexConverter->DColumnInModule(dColInChip,chipIndex);
593 
594  chips[chipIndex]++;
595  columns[dColInDet]++;
596  }
597 
598  // Delete some ROC hits.
599  for ( iter = chips.begin(); iter != chips.end() ; iter++ ) {
600  //float rand = RandFlat::shoot();
601  float rand = CLHEP::RandFlat::shoot(engine);
602  if( rand > chipEfficiency ) chips[iter->first]=0;
603  }
604 
605  // Delete some Dcol hits.
606  for ( iter = columns.begin(); iter != columns.end() ; iter++ ) {
607  //float rand = RandFlat::shoot();
608  float rand = CLHEP::RandFlat::shoot(engine);
609  if( rand > columnEfficiency ) columns[iter->first]=0;
610  }
611 
612  // Now loop again over pixels to kill some of them.
613  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
614  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
615 
616  // int chan = i->first;
617  std::pair<int,int> ip = PixelDigi::channelToPixel(i->first);//get pixel pos
618  int row = ip.first; // X in row
619  int col = ip.second; // Y is in col
620  //transform to ROC index coordinates
621  pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
622  int dColInChip = pIndexConverter->DColumn(colROC); //get ROC dcol from ROC col
623  //dcol in mod
624  int dColInDet = pIndexConverter->DColumnInModule(dColInChip,chipIndex);
625 
626  //float rand = RandFlat::shoot();
627  float rand = CLHEP::RandFlat::shoot(engine);
628  if( chips[chipIndex]==0 || columns[dColInDet]==0
629  || rand>pixelEfficiency ) {
630  // make pixel amplitude =0, pixel will be lost at clusterization
631  i->second=(0.); // reset amplitude
632  } // end if
633  //Make a new Digi:
634 
635  SPD.push_back( PixelDigi(i->first, i->second) );
636 
637  } // end pixel loop
638  // push back vector here of one detID
639 
640  vPixelDigi.push_back(SPD);
641  }
642  }
643  }// end of loop over detectors
644 
645  // make new digi collection
646 
647  std::auto_ptr< edm::DetSetVector<PixelDigi> > MyPixelDigis(new edm::DetSetVector<PixelDigi>(vPixelDigi) );
648 
649  // put collection
650 
651  e.put( MyPixelDigis, PixelDigiCollectionDM_ );
652 
653  // clear local storage for this event
654  SiHitStorage_.clear();
655  }
#define LogDebug(id)
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
void init_DynIneffDB(const edm::EventSetup &, const unsigned int &)
std::multimap< int, PixelDigi > OneDetectorMap
virtual int ncolumns() const =0
unsigned int pxbLadder(const DetId &id) const
virtual int nrows() const =0
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
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
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.
T const * product() const
Definition: ESHandle.h:86
unsigned int layer(const DetId &id) const
tuple columns
Definition: mps_check.py:210
StreamID streamID() const
Definition: Event.h:80
Signal rand(Signal arg)
Definition: vlib.cc:442
int col
Definition: cuy.py:1008
virtual SubDetector subDetector() const
Which subdetector.
Definition: GeomDet.cc:44
Definition: vlib.h:208
unsigned int pxfPanel(const DetId &id) const
void DataMixingSiPixelMCDigiWorker::setPileupInfo ( const std::vector< PileupSummaryInfo > &  ps,
const int &  bs 
)

Definition at line 657 of file DataMixingSiPixelMCDigiWorker.cc.

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

Referenced by putSiPixel().

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

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().