CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
PixelDigi
OneDetectorMap
 
typedef std::map< uint32_t,
OneDetectorMap
SiGlobalIndex
 

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

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

Definition at line 67 of file DataMixingSiPixelWorker.h.

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

Definition at line 69 of file DataMixingSiPixelWorker.h.

Constructor & Destructor Documentation

DataMixingSiPixelWorker::DataMixingSiPixelWorker ( )

Definition at line 21 of file DataMixingSiPixelWorker.cc.

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

standard constructor

Definition at line 24 of file DataMixingSiPixelWorker.cc.

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

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  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiToken_
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiPToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DataMixingSiPixelWorker::~DataMixingSiPixelWorker ( )
virtual

Default destructor

Definition at line 46 of file DataMixingSiPixelWorker.cc.

46 {}

Member Function Documentation

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

Definition at line 79 of file DataMixingSiPixelWorker.cc.

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

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

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;
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  }
EventID const & id() const
static std::string const input
Definition: EdmProvDump.cc:47
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
std::multimap< int, PixelDigi > OneDetectorMap
string end
Definition: dataset.py:937
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
collection_type::const_iterator const_iterator
Definition: DetSet.h:31
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
#define LogDebug(id)
void DataMixingSiPixelWorker::addSiPixelSignals ( const edm::Event e)

Definition at line 48 of file DataMixingSiPixelWorker.cc.

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

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

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
57  edm::DetSetVector<PixelDigi>::const_iterator DSViter = input->begin();
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;
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiToken_
static std::string const input
Definition: EdmProvDump.cc:47
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
std::multimap< int, PixelDigi > OneDetectorMap
edm::EventID id() const
Definition: EventBase.h:59
string end
Definition: dataset.py:937
collection_type::const_iterator const_iterator
Definition: DetSet.h:31
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
#define LogDebug(id)
void DataMixingSiPixelWorker::putSiPixel ( edm::Event e)

Definition at line 143 of file DataMixingSiPixelWorker.cc.

References gpuClustering::adc, eostools::move(), PixelDigiCollectionDM_, edm::DetSet< T >::push_back(), edm::Event::put(), and SiHitStorage_.

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

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  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
def move
Definition: eostools.py:511
Log< level::Info, false > LogInfo
std::multimap< int, PixelDigi > OneDetectorMap
uint16_t *__restrict__ uint16_t const *__restrict__ adc

Member Data Documentation

std::string edm::DataMixingSiPixelWorker::label_
private
edm::InputTag edm::DataMixingSiPixelWorker::pixeldigi_collectionPile_
private

Definition at line 58 of file DataMixingSiPixelWorker.h.

Referenced by addSiPixelPileups(), and DataMixingSiPixelWorker().

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

Definition at line 56 of file DataMixingSiPixelWorker.h.

Referenced by DataMixingSiPixelWorker().

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

Definition at line 60 of file DataMixingSiPixelWorker.h.

Referenced by DataMixingSiPixelWorker(), and putSiPixel().

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

Definition at line 63 of file DataMixingSiPixelWorker.h.

Referenced by DataMixingSiPixelWorker().

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

Definition at line 62 of file DataMixingSiPixelWorker.h.

Referenced by addSiPixelSignals(), and DataMixingSiPixelWorker().

SiGlobalIndex edm::DataMixingSiPixelWorker::SiHitStorage_
private