CMS 3D CMS Logo

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

#include <DataMixingSiPixelWorker.h>

Public Member Functions

void addSiPixelPileups (const int bcr, const edm::EventPrincipal *, unsigned int EventId, ModuleCallingContext const *)
 
void addSiPixelSignals (const edm::Event &e)
 
 DataMixingSiPixelWorker ()
 
 DataMixingSiPixelWorker (const edm::ParameterSet &ps, edm::ConsumesCollector &&iC)
 
void putSiPixel (edm::Event &e)
 
virtual ~DataMixingSiPixelWorker ()
 

Private Types

typedef std::multimap< int, PixelDigiOneDetectorMap
 
typedef std::map< uint32_t, OneDetectorMapSiGlobalIndex
 

Private Attributes

std::string label_
 
edm::InputTag pixeldigi_collectionPile_
 
edm::InputTag pixeldigi_collectionSig_
 
std::string PixelDigiCollectionDM_
 
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiPToken_
 
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiToken_
 
SiGlobalIndex SiHitStorage_
 

Detailed Description

Definition at line 36 of file DataMixingSiPixelWorker.h.

Member Typedef Documentation

◆ OneDetectorMap

typedef std::multimap<int, PixelDigi> edm::DataMixingSiPixelWorker::OneDetectorMap
private

Definition at line 67 of file DataMixingSiPixelWorker.h.

◆ SiGlobalIndex

typedef std::map<uint32_t, OneDetectorMap> edm::DataMixingSiPixelWorker::SiGlobalIndex
private

Definition at line 69 of file DataMixingSiPixelWorker.h.

Constructor & Destructor Documentation

◆ DataMixingSiPixelWorker() [1/2]

DataMixingSiPixelWorker::DataMixingSiPixelWorker ( )

Definition at line 21 of file DataMixingSiPixelWorker.cc.

21 {}

◆ DataMixingSiPixelWorker() [2/2]

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

standard constructor

Definition at line 24 of file DataMixingSiPixelWorker.cc.

25  : label_(ps.getParameter<std::string>("Label"))
26 
27  {
28  // get the subdetector names
29  // this->getSubdetectorNames(); //something like this may be useful to
30  // check what we are supposed to do...
31 
32  // declare the products to produce
33 
34  pixeldigi_collectionSig_ = ps.getParameter<edm::InputTag>("pixeldigiCollectionSig");
35  pixeldigi_collectionPile_ = ps.getParameter<edm::InputTag>("pixeldigiCollectionPile");
36  PixelDigiCollectionDM_ = ps.getParameter<std::string>("PixelDigiCollectionDM");
37 
40 
41  // clear local storage for this event
42  SiHitStorage_.clear();
43  }

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

◆ ~DataMixingSiPixelWorker()

DataMixingSiPixelWorker::~DataMixingSiPixelWorker ( )
virtual

Default destructor

Definition at line 46 of file DataMixingSiPixelWorker.cc.

46 {}

Member Function Documentation

◆ addSiPixelPileups()

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

Definition at line 79 of file DataMixingSiPixelWorker.cc.

82  {
83  LogDebug("DataMixingSiPixelWorker") << "\n===============> adding pileups from event " << ep->id()
84  << " for bunchcrossing " << bcr;
85 
86  // fill in maps of hits; same code as addSignals, except now applied to the
87  // pileup events
88 
89  std::shared_ptr<Wrapper<edm::DetSetVector<PixelDigi>> const> inputPTR =
90  getProductByTag<edm::DetSetVector<PixelDigi>>(*ep, pixeldigi_collectionPile_, mcc);
91 
92  if (inputPTR) {
93  const edm::DetSetVector<PixelDigi> *input = const_cast<edm::DetSetVector<PixelDigi> *>(inputPTR->product());
94 
95  // Handle< edm::DetSetVector<PixelDigi> > input;
96 
97  // if( e->getByLabel(pixeldigi_collectionPile_,input) ) {
98 
99  // loop on all detsets (detectorIDs) inside the input collection
101  for (; DSViter != input->end(); DSViter++) {
102 #ifdef DEBUG
103  LogDebug("DataMixingSiPixelWorker") << "Pileups: Processing DetID " << DSViter->id;
104 #endif
105 
106  uint32_t detID = DSViter->id;
107  edm::DetSet<PixelDigi>::const_iterator begin = (DSViter->data).begin();
108  edm::DetSet<PixelDigi>::const_iterator end = (DSViter->data).end();
110 
111  // find correct local map (or new one) for this detector ID
112 
113  SiGlobalIndex::const_iterator itest;
114 
115  itest = SiHitStorage_.find(detID);
116 
117  if (itest != SiHitStorage_.end()) { // this detID already has hits, add to existing map
118 
119  OneDetectorMap LocalMap = itest->second;
120 
121  // fill in local map with extra channels
122  for (icopy = begin; icopy != end; icopy++) {
123  LocalMap.insert(OneDetectorMap::value_type((icopy->channel()), *icopy));
124  }
125 
126  SiHitStorage_[detID] = LocalMap;
127 
128  } else { // fill local storage with this information, put in global
129  // collection
130 
131  OneDetectorMap LocalMap;
132 
133  for (icopy = begin; icopy != end; icopy++) {
134  LocalMap.insert(OneDetectorMap::value_type((icopy->channel()), *icopy));
135  }
136 
137  SiHitStorage_.insert(SiGlobalIndex::value_type(detID, LocalMap));
138  }
139  }
140  }
141  }

References mps_fire::end, SiStripBadComponentsDQMServiceTemplate_cfg::ep, input, LogDebug, pixeldigi_collectionPile_, and SiHitStorage_.

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

◆ addSiPixelSignals()

void DataMixingSiPixelWorker::addSiPixelSignals ( const edm::Event e)

Definition at line 48 of file DataMixingSiPixelWorker.cc.

48  {
49  // fill in maps of hits
50 
51  LogDebug("DataMixingSiPixelWorker") << "===============> adding MC signals for " << e.id();
52 
53  Handle<edm::DetSetVector<PixelDigi>> input;
54 
55  if (e.getByToken(PixelDigiToken_, input)) {
56  // loop on all detsets (detectorIDs) inside the input collection
58  for (; DSViter != input->end(); DSViter++) {
59 #ifdef DEBUG
60  LogDebug("DataMixingSiPixelWorker") << "Processing DetID " << DSViter->id;
61 #endif
62 
63  uint32_t detID = DSViter->id;
64  edm::DetSet<PixelDigi>::const_iterator begin = (DSViter->data).begin();
67 
68  OneDetectorMap LocalMap;
69 
70  for (icopy = begin; icopy != end; icopy++) {
71  LocalMap.insert(OneDetectorMap::value_type((icopy->channel()), *icopy));
72  }
73 
74  SiHitStorage_.insert(SiGlobalIndex::value_type(detID, LocalMap));
75  }
76  }
77  } // end of addSiPixelSignals

References MillePedeFileConverter_cfg::e, mps_fire::end, input, LogDebug, PixelDigiToken_, and SiHitStorage_.

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

◆ putSiPixel()

void DataMixingSiPixelWorker::putSiPixel ( edm::Event e)

Definition at line 143 of file DataMixingSiPixelWorker.cc.

143  {
144  // collection of Digis to put in the event
145 
146  std::vector<edm::DetSet<PixelDigi>> vPixelDigi;
147 
148  // loop through our collection of detectors, merging hits and putting new ones
149  // in the output
150 
151  // big loop over Detector IDs:
152 
153  for (SiGlobalIndex::const_iterator IDet = SiHitStorage_.begin(); IDet != SiHitStorage_.end(); IDet++) {
154  edm::DetSet<PixelDigi> SPD(IDet->first); // Make empty collection with this detector ID
155 
156  OneDetectorMap LocalMap = IDet->second;
157 
158  // counter variables
159  int formerPixel = -1;
160  int currentPixel;
161  int ADCSum = 0;
162 
163  OneDetectorMap::const_iterator iLocalchk;
164 
165  for (OneDetectorMap::const_iterator iLocal = LocalMap.begin(); iLocal != LocalMap.end(); ++iLocal) {
166  currentPixel = iLocal->first;
167 
168  if (currentPixel == formerPixel) { // we have to add these digis together
169  ADCSum += (iLocal->second).adc();
170  } else {
171  if (formerPixel != -1) { // ADC info stolen from SiStrips...
172  if (ADCSum > 511)
173  ADCSum = 255;
174  else if (ADCSum > 253 && ADCSum < 512)
175  ADCSum = 254;
176  PixelDigi aHit(formerPixel, ADCSum);
177  SPD.push_back(aHit);
178  }
179  // save pointers for next iteration
180  formerPixel = currentPixel;
181  ADCSum = (iLocal->second).adc();
182  }
183 
184  iLocalchk = iLocal;
185  if ((++iLocalchk) == LocalMap.end()) { // make sure not to lose the last one
186  if (ADCSum > 511)
187  ADCSum = 255;
188  else if (ADCSum > 253 && ADCSum < 512)
189  ADCSum = 254;
190  SPD.push_back(PixelDigi(formerPixel, ADCSum));
191  }
192 
193  } // end of loop over one detector
194 
195  // stick this into the global vector of detector info
196  vPixelDigi.push_back(SPD);
197 
198  } // end of big loop over all detector IDs
199 
200  // put the collection of digis in the event
201  LogInfo("DataMixingSiPixelWorker") << "total # Merged Pixels: " << vPixelDigi.size();
202 
203  // make new digi collection
204 
205  std::unique_ptr<edm::DetSetVector<PixelDigi>> MyPixelDigis(new edm::DetSetVector<PixelDigi>(vPixelDigi));
206 
207  // put collection
208 
209  e.put(std::move(MyPixelDigis), PixelDigiCollectionDM_);
210 
211  // clear local storage for this event
212  SiHitStorage_.clear();
213  }

References ecalLiteDTU::adc(), MillePedeFileConverter_cfg::e, eostools::move(), PixelDigiCollectionDM_, edm::DetSet< T >::push_back(), and SiHitStorage_.

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

Member Data Documentation

◆ label_

std::string edm::DataMixingSiPixelWorker::label_
private

◆ pixeldigi_collectionPile_

edm::InputTag edm::DataMixingSiPixelWorker::pixeldigi_collectionPile_
private

Definition at line 58 of file DataMixingSiPixelWorker.h.

Referenced by addSiPixelPileups(), and DataMixingSiPixelWorker().

◆ pixeldigi_collectionSig_

edm::InputTag edm::DataMixingSiPixelWorker::pixeldigi_collectionSig_
private

Definition at line 56 of file DataMixingSiPixelWorker.h.

Referenced by DataMixingSiPixelWorker().

◆ PixelDigiCollectionDM_

std::string edm::DataMixingSiPixelWorker::PixelDigiCollectionDM_
private

Definition at line 60 of file DataMixingSiPixelWorker.h.

Referenced by DataMixingSiPixelWorker(), and putSiPixel().

◆ PixelDigiPToken_

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

Definition at line 63 of file DataMixingSiPixelWorker.h.

Referenced by DataMixingSiPixelWorker().

◆ PixelDigiToken_

edm::EDGetTokenT<edm::DetSetVector<PixelDigi> > edm::DataMixingSiPixelWorker::PixelDigiToken_
private

Definition at line 62 of file DataMixingSiPixelWorker.h.

Referenced by addSiPixelSignals(), and DataMixingSiPixelWorker().

◆ SiHitStorage_

SiGlobalIndex edm::DataMixingSiPixelWorker::SiHitStorage_
private
edm::DetSetVector
Definition: DetSetVector.h:61
edm::DataMixingSiPixelWorker::OneDetectorMap
std::multimap< int, PixelDigi > OneDetectorMap
Definition: DataMixingSiPixelWorker.h:67
input
static const std::string input
Definition: EdmProvDump.cc:48
edm::DataMixingSiPixelWorker::SiHitStorage_
SiGlobalIndex SiHitStorage_
Definition: DataMixingSiPixelWorker.h:71
edm::DetSet
Definition: DetSet.h:23
edm::DataMixingSiPixelWorker::PixelDigiToken_
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiToken_
Definition: DataMixingSiPixelWorker.h:62
PixelDigi
Definition: PixelDigi.h:14
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
ecalLiteDTU::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalLiteDTUSample.h:12
mps_fire.end
end
Definition: mps_fire.py:242
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
edm::DataMixingSiPixelWorker::pixeldigi_collectionSig_
edm::InputTag pixeldigi_collectionSig_
Definition: DataMixingSiPixelWorker.h:56
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::DataMixingSiPixelWorker::PixelDigiPToken_
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiPToken_
Definition: DataMixingSiPixelWorker.h:63
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::DataMixingSiPixelWorker::pixeldigi_collectionPile_
edm::InputTag pixeldigi_collectionPile_
Definition: DataMixingSiPixelWorker.h:58
edm::DataMixingSiPixelWorker::label_
std::string label_
Definition: DataMixingSiPixelWorker.h:75
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::DataMixingSiPixelWorker::PixelDigiCollectionDM_
std::string PixelDigiCollectionDM_
Definition: DataMixingSiPixelWorker.h:60
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31