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

double _pu_scale [20]
 
signalMaps _signal
 
const bool AddPixelInefficiency
 
const double bunchScaleAt25
 
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_
 
const PixelEfficiencies pixelEff_
 
SiGlobalIndex SiHitStorage_
 
const double theInstLumiScaleFactor
 

Detailed Description

Definition at line 51 of file DataMixingSiPixelMCDigiWorker.h.

Member Typedef Documentation

Definition at line 111 of file DataMixingSiPixelMCDigiWorker.h.

Definition at line 120 of file DataMixingSiPixelMCDigiWorker.h.

Definition at line 121 of file DataMixingSiPixelMCDigiWorker.h.

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

Definition at line 114 of file DataMixingSiPixelMCDigiWorker.h.

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

Definition at line 113 of file DataMixingSiPixelMCDigiWorker.h.

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

Definition at line 112 of file DataMixingSiPixelMCDigiWorker.h.

Definition at line 115 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 41 of file DataMixingSiPixelMCDigiWorker.cc.

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

41  :
42  label_(ps.getParameter<std::string>("Label")),
43  geometryType_(ps.getParameter<std::string>("GeometryType")),
44  // get external parameters:
45  // To account for upgrade geometries do not assume the number
46  // of layers or disks.
47  NumberOfBarrelLayers(ps.exists("NumPixelBarrel")?ps.getParameter<int>("NumPixelBarrel"):3),
48  NumberOfEndcapDisks(ps.exists("NumPixelEndcap")?ps.getParameter<int>("NumPixelEndcap"):2),
49  theInstLumiScaleFactor(ps.getParameter<double>("theInstLumiScaleFactor")), //For dynamic inefficiency PU scaling
50  bunchScaleAt25(ps.getParameter<double>("bunchScaleAt25")), //For dynamic inefficiency bunchspace scaling
51  // Control the pixel inefficiency
52  AddPixelInefficiency(ps.getParameter<bool>("AddPixelInefficiencyFromPython")),
54  {
55 
56  // get the subdetector names
57  // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do...
58 
59  // declare the products to produce
60 
61  pixeldigi_collectionSig_ = ps.getParameter<edm::InputTag>("pixeldigiCollectionSig");
62  pixeldigi_collectionPile_ = ps.getParameter<edm::InputTag>("pixeldigiCollectionPile");
63  PixelDigiCollectionDM_ = ps.getParameter<std::string>("PixelDigiCollectionDM");
64 
67 
68  // clear local storage for this event
69  SiHitStorage_.clear();
70 
71  }
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 75 of file DataMixingSiPixelMCDigiWorker.cc.

75  {
76  }

Member Function Documentation

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

Definition at line 225 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().

226  {
227 
228  LogDebug("DataMixingSiPixelMCDigiWorker") <<"\n===============> adding pileups from event "<<ep->id()<<" for bunchcrossing "<<bcr;
229 
230  // fill in maps of hits; same code as addSignals, except now applied to the pileup events
231 
232  std::shared_ptr<Wrapper<edm::DetSetVector<PixelDigi> > const> inputPTR =
233  getProductByTag<edm::DetSetVector<PixelDigi> >(*ep, pixeldigi_collectionPile_, mcc);
234 
235  if(inputPTR ) {
236 
237  const edm::DetSetVector<PixelDigi> *input = const_cast< edm::DetSetVector<PixelDigi> * >(inputPTR->product());
238 
239 
240 
241  // Handle< edm::DetSetVector<PixelDigi> > input;
242 
243  // if( e->getByLabel(pixeldigi_collectionPile_,input) ) {
244 
245  //loop on all detsets (detectorIDs) inside the input collection
247  for (; DSViter!=input->end();DSViter++){
248 
249 #ifdef DEBUG
250  LogDebug("DataMixingSiPixelMCDigiWorker") << "Pileups: Processing DetID " << DSViter->id;
251 #endif
252 
253  uint32_t detID = DSViter->id;
257 
258  // find correct local map (or new one) for this detector ID
259 
260  SiGlobalIndex::const_iterator itest;
261 
262  itest = SiHitStorage_.find(detID);
263 
264  if(itest!=SiHitStorage_.end()) { // this detID already has hits, add to existing map
265 
266  OneDetectorMap LocalMap = itest->second;
267 
268  // fill in local map with extra channels
269  for (icopy=begin; icopy!=end; icopy++) {
270  LocalMap.insert(OneDetectorMap::value_type( (icopy->channel()), *icopy ));
271  }
272 
273  SiHitStorage_[detID]=LocalMap;
274 
275  }
276  else{ // fill local storage with this information, put in global collection
277 
278  OneDetectorMap LocalMap;
279 
280  for (icopy=begin; icopy!=end; icopy++) {
281  LocalMap.insert(OneDetectorMap::value_type( (icopy->channel()), *icopy ));
282  }
283 
284  SiHitStorage_.insert( SiGlobalIndex::value_type( detID, LocalMap ) );
285  }
286 
287  }
288  }
289  }
#define LogDebug(id)
std::multimap< int, PixelDigi > OneDetectorMap
EventID const & id() const
static std::string const input
Definition: EdmProvDump.cc:43
#define end
Definition: vmac.h:37
Container::value_type value_type
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:365
#define begin
Definition: vmac.h:30
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:350
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:108
void DataMixingSiPixelMCDigiWorker::addSiPixelSignals ( const edm::Event e)

Definition at line 189 of file DataMixingSiPixelMCDigiWorker.cc.

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

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

189  {
190  // fill in maps of hits
191 
192  LogDebug("DataMixingSiPixelMCDigiWorker")<<"===============> adding MC signals for "<<e.id();
193 
194  Handle< edm::DetSetVector<PixelDigi> > input;
195 
196  if( e.getByToken(PixelDigiToken_,input) ) {
197 
198  //loop on all detsets (detectorIDs) inside the input collection
199  edm::DetSetVector<PixelDigi>::const_iterator DSViter=input->begin();
200  for (; DSViter!=input->end();DSViter++){
201 
202 #ifdef DEBUG
203  LogDebug("DataMixingSiPixelMCDigiWorker") << "Processing DetID " << DSViter->id;
204 #endif
205 
206  uint32_t detID = DSViter->id;
210 
211  OneDetectorMap LocalMap;
212 
213  for (icopy=begin; icopy!=end; icopy++) {
214  LocalMap.insert(OneDetectorMap::value_type( (icopy->channel()), *icopy ));
215  }
216 
217  SiHitStorage_.insert( SiGlobalIndex::value_type( detID, LocalMap ) );
218  }
219 
220  }
221  } // end of addSiPixelSignals
#define LogDebug(id)
std::multimap< int, PixelDigi > OneDetectorMap
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiToken_
static std::string const input
Definition: EdmProvDump.cc:43
#define end
Definition: vmac.h:37
Container::value_type value_type
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:365
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:108
void DataMixingSiPixelMCDigiWorker::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
virtual

Definition at line 80 of file DataMixingSiPixelMCDigiWorker.cc.

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

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

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

Definition at line 293 of file DataMixingSiPixelMCDigiWorker.cc.

References _pu_scale, _signal, ecalMGPA::adc(), PixelDigi::channelToPixel(), cuy::col, edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::FPixIndex, GeomDet::geographicalId(), edm::EventSetup::get(), edm::RandomNumberGenerator::getEngine(), i, getDQMSummary::iter, TrackerTopology::layer(), 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::ESHandle< class >::product(), 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().

293  {
294 
295  // collection of Digis to put in the event
296 
297  std::vector< edm::DetSet<PixelDigi> > vPixelDigi;
298 
299  // loop through our collection of detectors, merging hits and putting new ones in the output
300 
301  _signal.clear();
302 
303  // big loop over Detector IDs:
304 
305  for(SiGlobalIndex::const_iterator IDet = SiHitStorage_.begin();
306  IDet != SiHitStorage_.end(); IDet++) {
307 
308  uint32_t detID = IDet->first;
309 
310  OneDetectorMap LocalMap = IDet->second;
311 
312  signal_map_type Signals;
313  Signals.clear();
314 
315  //counter variables
316  int formerPixel = -1;
317  int currentPixel;
318  int ADCSum = 0;
319 
320 
321  OneDetectorMap::const_iterator iLocalchk;
322 
323  for(OneDetectorMap::const_iterator iLocal = LocalMap.begin();
324  iLocal != LocalMap.end(); ++iLocal) {
325 
326  currentPixel = iLocal->first;
327 
328  if (currentPixel == formerPixel) { // we have to add these digis together
329  ADCSum+=(iLocal->second).adc();
330  }
331  else{
332  if(formerPixel!=-1){ // ADC info stolen from SiStrips...
333  if (ADCSum > 511) ADCSum = 255;
334  else if (ADCSum > 253 && ADCSum < 512) ADCSum = 254;
335 
336  Signals.insert( std::make_pair(formerPixel, ADCSum));
337  //PixelDigi aHit(formerPixel, ADCSum);
338  //SPD.push_back( aHit );
339  }
340  // save pointers for next iteration
341  formerPixel = currentPixel;
342  ADCSum = (iLocal->second).adc();
343  }
344 
345  iLocalchk = iLocal;
346  if((++iLocalchk) == LocalMap.end()) { //make sure not to lose the last one
347  if (ADCSum > 511) ADCSum = 255;
348  else if (ADCSum > 253 && ADCSum < 512) ADCSum = 254;
349  Signals.insert( std::make_pair(formerPixel, ADCSum));
350  //SPD.push_back( PixelDigi(formerPixel, ADCSum) );
351  }
352 
353  }// end of loop over one detector
354 
355  // stick this into the global vector of detector info
356  _signal.insert( std::make_pair( detID, Signals));
357 
358  } // end of big loop over all detector IDs
359 
360  // put the collection of digis in the event
361  LogInfo("DataMixingSiPixelMCDigiWorker") << "total # Merged Pixels: " << _signal.size() ;
362 
363  // Now, we have to run Lumi-Dependent efficiency calculation on the merged pixels.
364  // This is the only place where we have the PreMixed pileup information so that we can calculate
365  // the instantaneous luminosity and do the dynamic inefficiency.
366 
368  CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID());
369 
371  iSetup.get<IdealGeometryRecord>().get(tTopoHand);
372  const TrackerTopology *tTopo=tTopoHand.product();
373 
374  // set pileup information.
375 
376  setPileupInfo(ps, bs);
377 
378  for(TrackingGeometry::DetUnitContainer::const_iterator iu = pDD->detUnits().begin(); iu != pDD->detUnits().end(); iu ++){
379 
380  if((*iu)->type().isTrackerPixel()) {
381 
382  //
383  const PixelGeomDetUnit* pixdet = dynamic_cast<const PixelGeomDetUnit*>((*iu));
384  uint32_t detID = pixdet->geographicalId().rawId();
385 
386  // fetch merged hits for this detID
387 
388  signal_map_type& theSignal = _signal[detID];
389 
390  // if we have some hits...
391  if(theSignal.size()>0) {
392 
393  edm::DetSet<PixelDigi> SPD(detID); // make empty vector with this detID so we can push back digis at the end
394 
395  const PixelTopology* topol=&pixdet->specificTopology();
396  int numColumns = topol->ncolumns(); // det module number of cols&rows
397  int numRows = topol->nrows();
398 
399  // do inefficiency calculation, drop some pixel hits
400 
401  // Predefined efficiencies
402  double pixelEfficiency = 1.0;
403  double columnEfficiency = 1.0;
404  double chipEfficiency = 1.0;
405 
406  // setup the chip indices conversion
408  pixdet->subDetector()==GeomDetEnumerators::SubDetector::P1PXB){// barrel layers
409  int layerIndex=tTopo->layer(detID);
410  pixelEfficiency = pixelEff_.thePixelEfficiency[layerIndex-1];
411  columnEfficiency = pixelEff_.thePixelColEfficiency[layerIndex-1];
412  chipEfficiency = pixelEff_.thePixelChipEfficiency[layerIndex-1];
413  //std::cout <<"Using BPix columnEfficiency = "<<columnEfficiency<< " for layer = "<<layerIndex <<"\n";
414  // This should never happen, but only check if it is not an upgrade geometry
415  if (NumberOfBarrelLayers==3){
416  if(numColumns>416) LogWarning ("Pixel Geometry") <<" wrong columns in barrel "<<numColumns;
417  if(numRows>160) LogWarning ("Pixel Geometry") <<" wrong rows in barrel "<<numRows;
418 
419  int ladder=tTopo->pxbLadder(detID);
420  int module=tTopo->pxbModule(detID);
421  if (module<=4) module=5-module;
422  else module-=4;
423 
424  columnEfficiency *= pixelEff_.theLadderEfficiency_BPix[layerIndex-1][ladder-1]*pixelEff_.theModuleEfficiency_BPix[layerIndex-1][module-1]*_pu_scale[layerIndex-1];
425  }
428  pixdet->subDetector()==GeomDetEnumerators::SubDetector::P2PXEC){ // forward disks
429 
430  unsigned int diskIndex=tTopo->layer(detID)+pixelEff_.FPixIndex; // Use diskIndex-1 later to stay consistent with BPix
431  unsigned int panelIndex=tTopo->pxfPanel(detID);
432  unsigned int moduleIndex=tTopo->pxfModule(detID);
433  //if (pixelEff_.FPixIndex>diskIndex-1){throw cms::Exception("Configuration") <<"SiPixelDigitizer is using the wrong efficiency value. index = "
434  // <<diskIndex-1<<" , MinIndex = "<<pixelEff_.FPixIndex<<" ... "<<tTopo->pxfDisk(detID);}
435  pixelEfficiency = pixelEff_.thePixelEfficiency[diskIndex-1];
436  columnEfficiency = pixelEff_.thePixelColEfficiency[diskIndex-1];
437  chipEfficiency = pixelEff_.thePixelChipEfficiency[diskIndex-1];
438  //std::cout <<"Using FPix columnEfficiency = "<<columnEfficiency<<" for Disk = "<< tTopo->pxfDisk(detID)<<"\n";
439  // Sometimes the forward pixels have wrong size,
440  // this crashes the index conversion, so exit, but only check if it is not an upgrade geometry
441  if (NumberOfBarrelLayers==3){ // whether it is the present or the phase 1 detector can be checked using GeomDetEnumerators::SubDetector
442  if(numColumns>260 || numRows>160) {
443  if(numColumns>260) LogWarning ("Pixel Geometry") <<" wrong columns in endcaps "<<numColumns;
444  if(numRows>160) LogWarning ("Pixel Geometry") <<" wrong rows in endcaps "<<numRows;
445  return;
446  }
447  if ((panelIndex==1 && (moduleIndex==1 || moduleIndex==2)) || (panelIndex==2 && moduleIndex==1)) { //inner modules
448  columnEfficiency*=pixelEff_.theInnerEfficiency_FPix[diskIndex-1]*_pu_scale[3];
449  } else { //outer modules
450  columnEfficiency*=pixelEff_.theOuterEfficiency_FPix[diskIndex-1]*_pu_scale[4];
451  }
452  } // current detector, forward
454  // If phase 2 outer tracker, hardcoded values as they have been so far
455  pixelEfficiency = 0.999;
456  columnEfficiency = 0.999;
457  chipEfficiency = 0.999;
458  } // if barrel/forward
459 
460 
461  // Initilize the index converter
462  //PixelIndices indexConverter(numColumns,numRows);
463  std::auto_ptr<PixelIndices> pIndexConverter(new PixelIndices(numColumns,numRows));
464 
465  int chipIndex = 0;
466  int rowROC = 0;
467  int colROC = 0;
468  std::map<int, int, std::less<int> >chips, columns;
469  std::map<int, int, std::less<int> >::iterator iter;
470 
471  // Find out the number of columns and rocs hits
472  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
473  for (signal_map_const_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
474 
475  int chan = i->first;
476  std::pair<int,int> ip = PixelDigi::channelToPixel(chan);
477  int row = ip.first; // X in row
478  int col = ip.second; // Y is in col
479  //transform to ROC index coordinates
480  pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
481  int dColInChip = pIndexConverter->DColumn(colROC); // get ROC dcol from ROC col
482  //dcol in mod
483  int dColInDet = pIndexConverter->DColumnInModule(dColInChip,chipIndex);
484 
485  chips[chipIndex]++;
486  columns[dColInDet]++;
487  }
488 
489  // Delete some ROC hits.
490  for ( iter = chips.begin(); iter != chips.end() ; iter++ ) {
491  //float rand = RandFlat::shoot();
492  float rand = CLHEP::RandFlat::shoot(engine);
493  if( rand > chipEfficiency ) chips[iter->first]=0;
494  }
495 
496  // Delete some Dcol hits.
497  for ( iter = columns.begin(); iter != columns.end() ; iter++ ) {
498  //float rand = RandFlat::shoot();
499  float rand = CLHEP::RandFlat::shoot(engine);
500  if( rand > columnEfficiency ) columns[iter->first]=0;
501  }
502 
503  // Now loop again over pixels to kill some of them.
504  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
505  for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) {
506 
507  // int chan = i->first;
508  std::pair<int,int> ip = PixelDigi::channelToPixel(i->first);//get pixel pos
509  int row = ip.first; // X in row
510  int col = ip.second; // Y is in col
511  //transform to ROC index coordinates
512  pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
513  int dColInChip = pIndexConverter->DColumn(colROC); //get ROC dcol from ROC col
514  //dcol in mod
515  int dColInDet = pIndexConverter->DColumnInModule(dColInChip,chipIndex);
516 
517  //float rand = RandFlat::shoot();
518  float rand = CLHEP::RandFlat::shoot(engine);
519  if( chips[chipIndex]==0 || columns[dColInDet]==0
520  || rand>pixelEfficiency ) {
521  // make pixel amplitude =0, pixel will be lost at clusterization
522  i->second=(0.); // reset amplitude
523  } // end if
524  //Make a new Digi:
525 
526  SPD.push_back( PixelDigi(i->first, i->second) );
527 
528  } // end pixel loop
529  // push back vector here of one detID
530 
531  vPixelDigi.push_back(SPD);
532  }
533  }
534  }// end of loop over detectors
535 
536  // make new digi collection
537 
538  std::auto_ptr< edm::DetSetVector<PixelDigi> > MyPixelDigis(new edm::DetSetVector<PixelDigi>(vPixelDigi) );
539 
540  // put collection
541 
542  e.put( MyPixelDigis, PixelDigiCollectionDM_ );
543 
544  // clear local storage for this event
545  SiHitStorage_.clear();
546  }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
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
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:113
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
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
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
unsigned int layer(const DetId &id) const
StreamID streamID() const
Definition: Event.h:72
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 DataMixingSiPixelMCDigiWorker::setPileupInfo ( const std::vector< PileupSummaryInfo > &  ps,
const int &  bs 
)

Definition at line 548 of file DataMixingSiPixelMCDigiWorker.cc.

References _pu_scale, bunchScaleAt25, i, j, AlCaHLTBitMon_ParallelJobs::p, pixelEff_, theInstLumiScaleFactor, and edm::DataMixingSiPixelMCDigiWorker::PixelEfficiencies::thePUEfficiency.

Referenced by putSiPixel().

548  {
549 
550  double bunchScale=1.0;
551  if (bunchSpacing==25) bunchScale=bunchScaleAt25;
552 
553  int p = -1;
554  for ( unsigned int i=0; i<ps.size(); i++)
555  if ( ps[i].getBunchCrossing() == 0 )
556  p=i;
557 
558  if ( p>=0 ) {
559  for (size_t i=0; i<5; i++) {
560  double instlumi = ps[p].getTrueNumInteractions()*theInstLumiScaleFactor*bunchScale;
561  double instlumi_pow=1.;
562  _pu_scale[i] = 0;
563  for (size_t j=0; j<pixelEff_.thePUEfficiency[i].size(); j++){
564  _pu_scale[i]+=instlumi_pow*pixelEff_.thePUEfficiency[i][j];
565  instlumi_pow*=instlumi;
566  }
567  }
568  }
569 
570 
571 } //this sets pu_scale
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9

Member Data Documentation

double edm::DataMixingSiPixelMCDigiWorker::_pu_scale[20]
private

Definition at line 95 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by putSiPixel(), and setPileupInfo().

signalMaps edm::DataMixingSiPixelMCDigiWorker::_signal
private

Definition at line 118 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by putSiPixel().

const bool edm::DataMixingSiPixelMCDigiWorker::AddPixelInefficiency
private

Definition at line 138 of file DataMixingSiPixelMCDigiWorker.h.

const double edm::DataMixingSiPixelMCDigiWorker::bunchScaleAt25
private

Definition at line 136 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by setPileupInfo().

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

Definition at line 129 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 106 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by initializeEvent(), and putSiPixel().

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

Definition at line 99 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by DataMixingSiPixelMCDigiWorker().

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

Definition at line 101 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by DataMixingSiPixelMCDigiWorker(), and putSiPixel().

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

Definition at line 104 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by DataMixingSiPixelMCDigiWorker().

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

Definition at line 140 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by putSiPixel(), and setPileupInfo().

SiGlobalIndex edm::DataMixingSiPixelMCDigiWorker::SiHitStorage_
private
const double edm::DataMixingSiPixelMCDigiWorker::theInstLumiScaleFactor
private

Definition at line 135 of file DataMixingSiPixelMCDigiWorker.h.

Referenced by setPileupInfo().