CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes
edm::DataMixingEMWorker Class Reference

#include <DataMixingEMWorker.h>

Public Member Functions

void addEMPileups (const int bcr, const edm::EventPrincipal *, unsigned int EventId, ModuleCallingContext const *)
 
void addEMSignals (const edm::Event &e)
 
 DataMixingEMWorker ()
 
 DataMixingEMWorker (const edm::ParameterSet &ps)
 
void putEM (edm::Event &e)
 
virtual ~DataMixingEMWorker ()
 

Private Types

typedef std::multimap< DetId,
EcalRecHit
EBRecHitMap
 
typedef std::multimap< DetId,
EcalRecHit
EERecHitMap
 
typedef std::multimap< DetId,
EcalRecHit
ESRecHitMap
 

Private Attributes

edm::InputTag EBPileRecHitInputTag_
 
edm::InputTag EBProducerSig_
 
std::string EBRecHitCollectionDM_
 
edm::InputTag EBrechitCollectionSig_
 
EBRecHitMap EBRecHitStorage_
 
edm::InputTag EEPileRecHitInputTag_
 
edm::InputTag EEProducerSig_
 
std::string EERecHitCollectionDM_
 
edm::InputTag EErechitCollectionSig_
 
EERecHitMap EERecHitStorage_
 
edm::InputTag ESPileRecHitInputTag_
 
edm::InputTag ESProducerSig_
 
std::string ESRecHitCollectionDM_
 
edm::InputTag ESrechitCollectionSig_
 
ESRecHitMap ESRecHitStorage_
 
std::string label_
 

Detailed Description

Definition at line 38 of file DataMixingEMWorker.h.

Member Typedef Documentation

typedef std::multimap<DetId, EcalRecHit> edm::DataMixingEMWorker::EBRecHitMap
private

Definition at line 78 of file DataMixingEMWorker.h.

typedef std::multimap<DetId, EcalRecHit> edm::DataMixingEMWorker::EERecHitMap
private

Definition at line 79 of file DataMixingEMWorker.h.

typedef std::multimap<DetId, EcalRecHit> edm::DataMixingEMWorker::ESRecHitMap
private

Definition at line 80 of file DataMixingEMWorker.h.

Constructor & Destructor Documentation

DataMixingEMWorker::DataMixingEMWorker ( )

Definition at line 27 of file DataMixingEMWorker.cc.

27 { }
DataMixingEMWorker::DataMixingEMWorker ( const edm::ParameterSet ps)
explicit

standard constructor

Definition at line 30 of file DataMixingEMWorker.cc.

References EBPileRecHitInputTag_, EBProducerSig_, EBRecHitCollectionDM_, EBrechitCollectionSig_, EEPileRecHitInputTag_, EEProducerSig_, EERecHitCollectionDM_, EErechitCollectionSig_, ESPileRecHitInputTag_, ESProducerSig_, ESRecHitCollectionDM_, ESrechitCollectionSig_, edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

30  :
31  label_(ps.getParameter<std::string>("Label"))
32 
33  {
34 
35  // get the subdetector names
36  // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do...
37 
38  // declare the products to produce, retrieve
39 
40  EBProducerSig_ = ps.getParameter<edm::InputTag>("EBProducerSig");
41  EEProducerSig_ = ps.getParameter<edm::InputTag>("EEProducerSig");
42  ESProducerSig_ = ps.getParameter<edm::InputTag>("ESProducerSig");
43 
44 
45  EBrechitCollectionSig_ = ps.getParameter<edm::InputTag>("EBrechitCollectionSig");
46  EErechitCollectionSig_ = ps.getParameter<edm::InputTag>("EErechitCollectionSig");
47  ESrechitCollectionSig_ = ps.getParameter<edm::InputTag>("ESrechitCollectionSig");
48 
49  EBPileRecHitInputTag_ = ps.getParameter<edm::InputTag>("EBPileRecHitInputTag");
50  EEPileRecHitInputTag_ = ps.getParameter<edm::InputTag>("EEPileRecHitInputTag");
51  ESPileRecHitInputTag_ = ps.getParameter<edm::InputTag>("ESPileRecHitInputTag");
52 
53 
54  EBRecHitCollectionDM_ = ps.getParameter<std::string>("EBRecHitCollectionDM");
55  EERecHitCollectionDM_ = ps.getParameter<std::string>("EERecHitCollectionDM");
56  ESRecHitCollectionDM_ = ps.getParameter<std::string>("ESRecHitCollectionDM");
57  // nMaxPrintout_ = ps.getUntrackedParameter<int>("nMaxPrintout",10);
58 
59  //EBalgo_ = new EcalRecHitSimpleAlgo();
60  //EEalgo_ = new EcalRecHitSimpleAlgo();
61 
62  // don't think I can "produce" in a sub-class...
63 
64  //produces< EBRecHitCollection >(EBRecHitCollectionDM_);
65  //produces< EERecHitCollection >(EERecHitCollectionDM_);
66 
67  }
T getParameter(std::string const &) const
edm::InputTag EBrechitCollectionSig_
edm::InputTag ESPileRecHitInputTag_
edm::InputTag EErechitCollectionSig_
edm::InputTag ESrechitCollectionSig_
edm::InputTag EBPileRecHitInputTag_
edm::InputTag EEPileRecHitInputTag_
DataMixingEMWorker::~DataMixingEMWorker ( )
virtual

Default destructor

Definition at line 71 of file DataMixingEMWorker.cc.

71  {
72  }

Member Function Documentation

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

Definition at line 168 of file DataMixingEMWorker.cc.

References edm::SortedCollection< T, SORT >::begin(), EBPileRecHitInputTag_, egHLT::errCodes::EBRecHits, EBRecHitStorage_, EEPileRecHitInputTag_, egHLT::errCodes::EERecHits, EERecHitStorage_, edm::SortedCollection< T, SORT >::end(), ESPileRecHitInputTag_, ESRecHitStorage_, edm::EventPrincipal::id(), LogDebug, and edm::SortedCollection< T, SORT >::size().

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

169  {
170 
171  LogInfo("DataMixingEMWorker") <<"\n===============> adding pileups from event "<<ep->id()<<" for bunchcrossing "<<bcr;
172 
173  // fill in maps of hits; same code as addSignals, except now applied to the pileup events
174 
175  // EB first
176 
177  boost::shared_ptr<Wrapper<EBRecHitCollection> const> EBRecHitsPTR =
178  getProductByTag<EBRecHitCollection>(*ep, EBPileRecHitInputTag_, mcc);
179 
180  if(EBRecHitsPTR ) {
181 
182  const EBRecHitCollection* EBRecHits = const_cast< EBRecHitCollection * >(EBRecHitsPTR->product());
183 
184  LogDebug("DataMixingEMWorker") << "total # EB rechits: " << EBRecHits->size();
185 
186  // loop over digis, adding these to the existing maps
187  for(EBRecHitCollection::const_iterator it = EBRecHits->begin();
188  it != EBRecHits->end(); ++it) {
189 
190  EBRecHitStorage_.insert(EBRecHitMap::value_type( (it->id()), *it ));
191 
192 #ifdef DEBUG
193  LogDebug("DataMixingEMWorker") << "processed EBRecHit with rawId: "
194  << it->id().rawId() << "\n"
195  << " rechit energy: " << it->energy();
196 #endif
197  }
198  }
199 
200  // EE Next
201 
202  boost::shared_ptr<Wrapper<EERecHitCollection> const> EERecHitsPTR =
203  getProductByTag<EERecHitCollection>(*ep, EEPileRecHitInputTag_, mcc);
204 
205  if(EERecHitsPTR ) {
206 
207  const EERecHitCollection* EERecHits = const_cast< EERecHitCollection * >(EERecHitsPTR->product());
208 
209  LogDebug("DataMixingEMWorker") << "total # EE rechits: " << EERecHits->size();
210 
211  // loop over digis, adding these to the existing maps
212  for(EERecHitCollection::const_iterator it = EERecHits->begin();
213  it != EERecHits->end(); ++it) {
214 
215  EERecHitStorage_.insert(EERecHitMap::value_type( (it->id()), *it ));
216 
217 #ifdef DEBUG
218  LogDebug("DataMixingEMWorker") << "processed EERecHit with rawId: "
219  << it->id().rawId() << "\n"
220  << " rechit energy: " << it->energy();
221 #endif
222  }
223  }
224 
225  // ES Next
226 
227  boost::shared_ptr<Wrapper<ESRecHitCollection> const> ESRecHitsPTR =
228  getProductByTag<ESRecHitCollection>(*ep, ESPileRecHitInputTag_, mcc);
229 
230  if(ESRecHitsPTR ) {
231 
232  const ESRecHitCollection* ESRecHits = const_cast< ESRecHitCollection * >(ESRecHitsPTR->product());
233 
234  LogDebug("DataMixingEMWorker") << "total # ES rechits: " << ESRecHits->size();
235 
236  // loop over digis, adding these to the existing maps
237  for(ESRecHitCollection::const_iterator it = ESRecHits->begin();
238  it != ESRecHits->end(); ++it) {
239 
240  ESRecHitStorage_.insert(ESRecHitMap::value_type( (it->id()), *it ));
241 
242 #ifdef DEBUG
243  LogDebug("DataMixingEMWorker") << "processed ESRecHit with rawId: "
244  << it->id().rawId() << "\n"
245  << " rechit energy: " << it->energy();
246 #endif
247  }
248  }
249 
250 
251  }
#define LogDebug(id)
EventID const & id() const
std::vector< EcalRecHit >::const_iterator const_iterator
edm::InputTag ESPileRecHitInputTag_
Container::value_type value_type
const_iterator end() const
edm::InputTag EBPileRecHitInputTag_
edm::InputTag EEPileRecHitInputTag_
size_type size() const
const_iterator begin() const
void DataMixingEMWorker::addEMSignals ( const edm::Event e)

Definition at line 74 of file DataMixingEMWorker.cc.

References edm::SortedCollection< T, SORT >::begin(), EBProducerSig_, egHLT::errCodes::EBRecHits, EBRecHitStorage_, EEProducerSig_, egHLT::errCodes::EERecHits, EERecHitStorage_, edm::SortedCollection< T, SORT >::end(), ESProducerSig_, ESRecHitStorage_, edm::Event::getByLabel(), edm::EventBase::id(), LogDebug, edm::Handle< T >::product(), and edm::SortedCollection< T, SORT >::size().

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

74  {
75  // fill in maps of hits
76 
77  LogInfo("DataMixingEMWorker")<<"===============> adding MC signals for "<<e.id();
78 
79  // EB first
80 
81  Handle< EBRecHitCollection > pEBRecHits;
82 
83  const EBRecHitCollection* EBRecHits = 0;
84 
85  if(e.getByLabel(EBProducerSig_, pEBRecHits) ){
86  EBRecHits = pEBRecHits.product(); // get a ptr to the product
87  LogDebug("DataMixingEMWorker") << "total # EB rechits: " << EBRecHits->size();
88  }
89 
90 
91  if (EBRecHits)
92  {
93  // loop over rechits, storing them in a map so we can add pileup later
94  for(EBRecHitCollection::const_iterator it = EBRecHits->begin();
95  it != EBRecHits->end(); ++it) {
96 
97  EBRecHitStorage_.insert(EBRecHitMap::value_type( ( it->id() ), *it ));
98 
99  LogDebug("DataMixingEMWorker") << "processed EBRecHit with rawId: "
100  << it->id().rawId() << "\n"
101  << " rechit energy: " << it->energy();
102 
103  }
104  }
105 
106  // EE next
107 
108  Handle< EERecHitCollection > pEERecHits;
109 
110  const EERecHitCollection* EERecHits = 0;
111 
112 
113  if(e.getByLabel(EEProducerSig_, pEERecHits) ){
114  EERecHits = pEERecHits.product(); // get a ptr to the product
115  LogDebug("DataMixingEMWorker") << "total # EE rechits: " << EERecHits->size();
116  }
117 
118 
119  if (EERecHits)
120  {
121  // loop over rechits, storing them in a map so we can add pileup later
122  for(EERecHitCollection::const_iterator it = EERecHits->begin();
123  it != EERecHits->end(); ++it) {
124 
125  EERecHitStorage_.insert(EERecHitMap::value_type( ( it->id() ), *it ));
126 #ifdef DEBUG
127  LogDebug("DataMixingEMWorker") << "processed EERecHit with rawId: "
128  << it->id().rawId() << "\n"
129  << " rechit energy: " << it->energy();
130 #endif
131 
132  }
133  }
134  // ES next
135 
136  Handle< ESRecHitCollection > pESRecHits;
137 
138  const ESRecHitCollection* ESRecHits = 0;
139 
140 
141  if(e.getByLabel( ESProducerSig_, pESRecHits) ){
142  ESRecHits = pESRecHits.product(); // get a ptr to the product
143 #ifdef DEBUG
144  LogDebug("DataMixingEMWorker") << "total # ES rechits: " << ESRecHits->size();
145 #endif
146  }
147 
148 
149  if (ESRecHits)
150  {
151  // loop over rechits, storing them in a map so we can add pileup later
152  for(ESRecHitCollection::const_iterator it = ESRecHits->begin();
153  it != ESRecHits->end(); ++it) {
154 
155  ESRecHitStorage_.insert(ESRecHitMap::value_type( ( it->id() ), *it ));
156 
157 #ifdef DEBUG
158  LogDebug("DataMixingEMWorker") << "processed ESRecHit with rawId: "
159  << it->id().rawId() << "\n"
160  << " rechit energy: " << it->energy();
161 #endif
162 
163  }
164  }
165 
166  } // end of addEMSignals
#define LogDebug(id)
std::vector< EcalRecHit >::const_iterator const_iterator
Container::value_type value_type
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
const_iterator end() const
edm::EventID id() const
Definition: EventBase.h:56
size_type size() const
const_iterator begin() const
void DataMixingEMWorker::putEM ( edm::Event e)

Definition at line 253 of file DataMixingEMWorker.cc.

References EBRecHitCollectionDM_, EBRecHitStorage_, EERecHitCollectionDM_, EERecHitStorage_, relval_parameters_module::energy, ESRecHitCollectionDM_, ESRecHitStorage_, edm::Event::put(), and cond::rpcobgas::time.

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

253  {
254 
255  // collection of rechits to put in the event
256  std::auto_ptr< EBRecHitCollection > EBrechits( new EBRecHitCollection );
257  std::auto_ptr< EERecHitCollection > EErechits( new EERecHitCollection );
258  std::auto_ptr< ESRecHitCollection > ESrechits( new ESRecHitCollection );
259 
260  // loop over the maps we have, re-making individual hits or digis if necessary.
261  DetId formerID = 0;
262  DetId currentID;
263  float ESum = 0.;
264  float EBTime = 0.;
265 
266  // EB first...
267 
268  EBRecHitMap::const_iterator iEBchk;
269 
270  for(EBRecHitMap::const_iterator iEB = EBRecHitStorage_.begin();
271  iEB != EBRecHitStorage_.end(); ++iEB) {
272 
273  currentID = iEB->first;
274 
275  if (currentID == formerID) { // we have to add these rechits together
276 
277  ESum+=(iEB->second).energy();
278  }
279  else {
280  if(formerID>0) {
281  // cutoff for ESum?
282  EcalRecHit aHit(formerID, ESum, EBTime);
283  EBrechits->push_back( aHit );
284  }
285  //save pointers for next iteration
286  formerID = currentID;
287  ESum = (iEB->second).energy();
288  EBTime = (iEB->second).time(); // take time of first hit in sequence - is this ok?
289  }
290 
291  iEBchk = iEB;
292  if((++iEBchk) == EBRecHitStorage_.end()) { //make sure not to lose the last one
293  EcalRecHit aHit(formerID, ESum, EBTime);
294  EBrechits->push_back( aHit );
295  }
296  }
297 
298  // EE next...
299 
300  // loop over the maps we have, re-making individual hits or digis if necessary.
301  formerID = 0;
302  ESum = 0.;
303  float EETime = 0.;
304 
305  EERecHitMap::const_iterator iEEchk;
306 
307  for(EERecHitMap::const_iterator iEE = EERecHitStorage_.begin();
308  iEE != EERecHitStorage_.end(); ++iEE) {
309 
310  currentID = iEE->first;
311 
312  if (currentID == formerID) { // we have to add these rechits together
313 
314  ESum+=(iEE->second).energy();
315  }
316  else {
317  if(formerID>0) {
318  // cutoff for ESum?
319  EcalRecHit aHit(formerID, ESum, EETime);
320  EErechits->push_back( aHit );
321  }
322  //save pointers for next iteration
323  formerID = currentID;
324  ESum = (iEE->second).energy();
325  EETime = (iEE->second).time(); // take time of first hit in sequence - is this ok?
326  }
327 
328  iEEchk = iEE;
329  if((++iEEchk) == EERecHitStorage_.end()) { //make sure not to lose the last one
330  EcalRecHit aHit(formerID, ESum, EETime);
331  EErechits->push_back( aHit );
332  }
333  }
334 
335  // ES next...
336 
337  // loop over the maps we have, re-making individual hits or digis if necessary.
338  formerID = 0;
339  ESum = 0.;
340  float ESTime = 0.;
341 
342  ESRecHitMap::const_iterator iESchk;
343 
344  for(ESRecHitMap::const_iterator iES = ESRecHitStorage_.begin();
345  iES != ESRecHitStorage_.end(); ++iES) {
346 
347  currentID = iES->first;
348 
349  if (currentID == formerID) { // we have to add these rechits together
350 
351  ESum+=(iES->second).energy();
352  }
353  else {
354  if(formerID>0) {
355  // cutoff for ESum?
356  EcalRecHit aHit(formerID, ESum, ESTime);
357  ESrechits->push_back( aHit );
358  }
359  //save pointers for next iteration
360  formerID = currentID;
361  ESum = (iES->second).energy();
362  ESTime = (iES->second).time(); // take time of first hit in sequence - is this ok?
363  }
364 
365  iESchk = iES;
366  if((++iESchk) == ESRecHitStorage_.end()) { //make sure not to lose the last one
367  EcalRecHit aHit(formerID, ESum, ESTime);
368  ESrechits->push_back( aHit );
369  }
370  }
371 
372  // done merging
373 
374  // put the collection of reconstructed hits in the event
375  LogInfo("DataMixingEMWorker") << "total # EB Merged rechits: " << EBrechits->size() ;
376  LogInfo("DataMixingEMWorker") << "total # EE Merged rechits: " << EErechits->size() ;
377  LogInfo("DataMixingEMWorker") << "total # ES Merged rechits: " << ESrechits->size() ;
378 
379  e.put( EBrechits, EBRecHitCollectionDM_ );
380  e.put( EErechits, EERecHitCollectionDM_ );
381  e.put( ESrechits, ESRecHitCollectionDM_ );
382 
383  // clear local storage after this event
384 
385  EBRecHitStorage_.clear();
386  EERecHitStorage_.clear();
387  ESRecHitStorage_.clear();
388 
389  }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
Definition: DetId.h:18

Member Data Documentation

edm::InputTag edm::DataMixingEMWorker::EBPileRecHitInputTag_
private

Definition at line 67 of file DataMixingEMWorker.h.

Referenced by addEMPileups(), and DataMixingEMWorker().

edm::InputTag edm::DataMixingEMWorker::EBProducerSig_
private

Definition at line 59 of file DataMixingEMWorker.h.

Referenced by addEMSignals(), and DataMixingEMWorker().

std::string edm::DataMixingEMWorker::EBRecHitCollectionDM_
private

Definition at line 74 of file DataMixingEMWorker.h.

Referenced by DataMixingEMWorker(), and putEM().

edm::InputTag edm::DataMixingEMWorker::EBrechitCollectionSig_
private

Definition at line 63 of file DataMixingEMWorker.h.

Referenced by DataMixingEMWorker().

EBRecHitMap edm::DataMixingEMWorker::EBRecHitStorage_
private

Definition at line 82 of file DataMixingEMWorker.h.

Referenced by addEMPileups(), addEMSignals(), and putEM().

edm::InputTag edm::DataMixingEMWorker::EEPileRecHitInputTag_
private

Definition at line 68 of file DataMixingEMWorker.h.

Referenced by addEMPileups(), and DataMixingEMWorker().

edm::InputTag edm::DataMixingEMWorker::EEProducerSig_
private

Definition at line 60 of file DataMixingEMWorker.h.

Referenced by addEMSignals(), and DataMixingEMWorker().

std::string edm::DataMixingEMWorker::EERecHitCollectionDM_
private

Definition at line 75 of file DataMixingEMWorker.h.

Referenced by DataMixingEMWorker(), and putEM().

edm::InputTag edm::DataMixingEMWorker::EErechitCollectionSig_
private

Definition at line 64 of file DataMixingEMWorker.h.

Referenced by DataMixingEMWorker().

EERecHitMap edm::DataMixingEMWorker::EERecHitStorage_
private

Definition at line 83 of file DataMixingEMWorker.h.

Referenced by addEMPileups(), addEMSignals(), and putEM().

edm::InputTag edm::DataMixingEMWorker::ESPileRecHitInputTag_
private

Definition at line 69 of file DataMixingEMWorker.h.

Referenced by addEMPileups(), and DataMixingEMWorker().

edm::InputTag edm::DataMixingEMWorker::ESProducerSig_
private

Definition at line 61 of file DataMixingEMWorker.h.

Referenced by addEMSignals(), and DataMixingEMWorker().

std::string edm::DataMixingEMWorker::ESRecHitCollectionDM_
private

Definition at line 76 of file DataMixingEMWorker.h.

Referenced by DataMixingEMWorker(), and putEM().

edm::InputTag edm::DataMixingEMWorker::ESrechitCollectionSig_
private

Definition at line 65 of file DataMixingEMWorker.h.

Referenced by DataMixingEMWorker().

ESRecHitMap edm::DataMixingEMWorker::ESRecHitStorage_
private

Definition at line 84 of file DataMixingEMWorker.h.

Referenced by addEMPileups(), addEMSignals(), and putEM().

std::string edm::DataMixingEMWorker::label_
private