34 DataMixingHcalDigiWorker::DataMixingHcalDigiWorker() { }
38 label_(ps.getParameter<std::
string>(
"Label"))
60 if(ZDCPileInputTag_.
label() !=
"") DoZDC_ =
true;
85 LogInfo(
"DataMixingHcalDigiWorker")<<
"===============> adding MC signals for "<<e.
id();
94 HBHEDigis = pHBHEDigis.
product();
95 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HBHE digis: " << HBHEDigis->
size();
104 it != HBHEDigis->
end(); ++it) {
110 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
111 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
127 LogDebug(
"DataMixingHcalDigiWorker") <<
"processed HBHEDigi with rawId: "
129 <<
" digi energy: " << it->energy();
144 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HO digis: " << HODigis->
size();
153 it != HODigis->
end(); ++it) {
158 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
159 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
168 LogDebug(
"DataMixingHcalDigiWorker") <<
"processed HODigi with rawId: "
170 <<
" digi energy: " << it->energy();
185 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HF digis: " << HFDigis->
size();
194 it != HFDigis->
end(); ++it) {
199 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
200 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
209 LogDebug(
"DataMixingHcalDigiWorker") <<
"processed HFDigi with rawId: "
211 <<
" digi energy: " << it->energy();
226 ZDCDigis = pZDCDigis.
product();
228 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # ZDC digis: " << ZDCDigis->
size();
237 it != ZDCDigis->
end(); ++it) {
242 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
243 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
252 LogDebug(
"DataMixingHcalDigiWorker") <<
"processed ZDCDigi with rawId: "
254 <<
" digi energy: " << it->energy();
265 LogDebug(
"DataMixingHcalDigiWorker") <<
"\n===============> adding pileups from event "<<ep->
id()<<
" for bunchcrossing "<<bcr;
275 boost::shared_ptr<Wrapper<HBHEDigiCollection>
const> HBHEDigisPTR =
282 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HBHE digis: " << HBHEDigis->
size();
286 it != HBHEDigis->
end(); ++it) {
291 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
292 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
301 LogDebug(
"DataMixingHcalDigiWorker") <<
"processed HBHEDigi with rawId: "
303 <<
" digi energy: " << it->energy();
309 boost::shared_ptr<Wrapper<HODigiCollection>
const> HODigisPTR =
316 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HO digis: " << HODigis->
size();
320 it != HODigis->
end(); ++it) {
325 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
326 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
335 LogDebug(
"DataMixingHcalDigiWorker") <<
"processed HODigi with rawId: "
337 <<
" digi energy: " << it->energy();
345 boost::shared_ptr<Wrapper<HFDigiCollection>
const> HFDigisPTR =
352 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HF digis: " << HFDigis->
size();
356 it != HFDigis->
end(); ++it) {
361 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
362 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
371 LogDebug(
"DataMixingHcalDigiWorker") <<
"processed HFDigi with rawId: "
373 <<
" digi energy: " << it->energy();
384 boost::shared_ptr<Wrapper<ZDCDigiCollection>
const> ZDCDigisPTR =
391 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # ZDC digis: " << ZDCDigis->
size();
395 it != ZDCDigis->
end(); ++it) {
400 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
401 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
410 LogDebug(
"DataMixingHcalDigiWorker") <<
"processed ZDCDigi with rawId: "
412 <<
" digi energy: " << it->energy();
445 HBHEDigiMap::const_iterator iHBchk;
450 currentID = iHB->first;
452 if (currentID == formerID) {
456 unsigned int sizenew = (iHB->second).
size();
457 unsigned int sizeold = HB_old.
size();
461 if(sizenew > sizeold) usenew =
true;
463 unsigned int max_samp =
std::max(sizenew, sizeold);
472 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
473 if(isamp < sizenew) {
474 fC_new = (iHB->second)[isamp];
478 if(isamp < sizeold) {
479 fC_old = HB_old[isamp];
484 fC_sum = fC_new + fC_old;
490 if(usenew) {HB_bigger[isamp] = fC_sum; }
491 else { HB_old[isamp] = fC_sum; }
494 if(usenew) HB_old = HB_bigger;
505 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
506 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
509 unsigned int sizeold = HB_old.
size();
510 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
511 coder.
fC2adc(HB_old,(HBHEdigis->back()), 0 );
515 formerID = currentID;
516 HB_old = iHB->second;
529 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
530 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
533 unsigned int sizenew = (iHB->second).
size();
534 for(
unsigned int isamp = 0; isamp<sizenew; isamp++) {
535 coder.
fC2adc(HB_old,(HBHEdigis->back()), 0 );
547 HODigiMap::const_iterator iHOchk;
552 currentID = iHO->first;
554 if (currentID == formerID) {
557 unsigned int sizenew = (iHO->second).
size();
558 unsigned int sizeold = HO_old.
size();
560 unsigned int max_samp =
std::max(sizenew, sizeold);
566 if(sizenew > sizeold) usenew =
true;
571 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
572 if(isamp < sizenew) {
573 fC_new = (iHO->second)[isamp];
577 if(isamp < sizeold) {
578 fC_old = HO_old[isamp];
583 fC_sum = fC_new + fC_old;
585 if(usenew) {HO_bigger[isamp] = fC_sum; }
586 else { HO_old[isamp] = fC_sum; }
589 if(usenew) HO_old = HO_bigger;
600 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
601 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
604 unsigned int sizeold = HO_old.
size();
605 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
606 coder.
fC2adc(HO_old,(HOdigis->back()), 0 );
610 formerID = currentID;
611 HO_old = iHO->second;
622 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
623 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
626 unsigned int sizeold = (iHO->second).
size();
627 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
628 coder.
fC2adc(HO_old,(HOdigis->back()), 0 );
640 HFDigiMap::const_iterator iHFchk;
645 currentID = iHF->first;
647 if (currentID == formerID) {
650 unsigned int sizenew = (iHF->second).
size();
651 unsigned int sizeold = HF_old.
size();
653 unsigned int max_samp =
std::max(sizenew, sizeold);
659 if(sizenew > sizeold) usenew =
true;
664 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
665 if(isamp < sizenew) {
666 fC_new = (iHF->second)[isamp];
670 if(isamp < sizeold) {
671 fC_old = HF_old[isamp];
676 fC_sum = fC_new + fC_old;
678 if(usenew) {HF_bigger[isamp] = fC_sum; }
679 else { HF_old[isamp] = fC_sum; }
682 if(usenew) HF_old = HF_bigger;
693 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
694 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
697 unsigned int sizeold = HF_old.
size();
698 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
699 coder.
fC2adc(HF_old,(HFdigis->back()), 0 );
703 formerID = currentID;
704 HF_old = iHF->second;
715 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
716 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
719 unsigned int sizeold = (iHF->second).
size();
720 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
721 coder.
fC2adc(HF_old,(HFdigis->back()), 0 );
734 ZDCDigiMap::const_iterator iZDCchk;
739 currentID = iZDC->first;
741 if (currentID == formerID) {
744 unsigned int sizenew = (iZDC->second).
size();
745 unsigned int sizeold = ZDC_old.
size();
747 unsigned int max_samp =
std::max(sizenew, sizeold);
753 if(sizenew > sizeold) usenew =
true;
758 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
759 if(isamp < sizenew) {
760 fC_new = (iZDC->second)[isamp];
764 if(isamp < sizeold) {
765 fC_old = ZDC_old[isamp];
770 fC_sum = fC_new + fC_old;
772 if(usenew) {ZDC_bigger[isamp] = fC_sum; }
773 else { ZDC_old[isamp] = fC_sum; }
776 if(usenew) ZDC_old = ZDC_bigger;
787 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
788 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
791 unsigned int sizeold = ZDC_old.
size();
792 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
793 coder.
fC2adc(ZDC_old,(ZDCdigis->back()), 0 );
797 formerID = currentID;
798 ZDC_old = iZDC->second;
809 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
810 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
813 unsigned int sizeold = (iZDC->second).
size();
814 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
815 coder.
fC2adc(ZDC_old,(ZDCdigis->back()), 0 );
826 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HBHE Merged digis: " << HBHEdigis->size() ;
827 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HO Merged digis: " << HOdigis->size() ;
828 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HF Merged digis: " << HFdigis->size() ;
829 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # ZDC Merged digis: " << ZDCdigis->size() ;
T getParameter(std::string const &) const
std::string HBHEDigiCollectionDM_
edm::InputTag HBHEPileInputTag_
std::string ZDCDigiCollectionDM_
EventID const & id() const
edm::InputTag HBHEdigiCollectionSig_
std::string HODigiCollectionDM_
std::vector< T >::const_iterator const_iterator
HBHEDigiMap HBHEDigiStorage_
ZDCDigiMap ZDCDigiStorage_
virtual void fC2adc(const CaloSamples &clf, HBHEDataFrame &df, int fCapIdOffset) const
const T & max(const T &a, const T &b)
void putHcal(edm::Event &e, const edm::EventSetup &ES)
edm::InputTag HFPileInputTag_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const
void addHcalPileups(const int bcr, const edm::EventPrincipal *, unsigned int EventId, const edm::EventSetup &ES)
edm::InputTag HOPileInputTag_
edm::InputTag ZDCPileInputTag_
Container::value_type value_type
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
edm::InputTag ZDCdigiCollectionSig_
const_iterator end() const
int size() const
get the size
edm::InputTag HFdigiCollectionSig_
virtual ~DataMixingHcalDigiWorker()
T const * product() const
std::string HFDigiCollectionDM_
DetId id() const
get the (generic) id
void addHcalSignals(const edm::Event &e, const edm::EventSetup &ES)
tuple size
Write out results.
const_iterator begin() const
edm::InputTag HOdigiCollectionSig_