34 DataMixingHcalDigiWorker::DataMixingHcalDigiWorker() { }
38 label_(ps.getParameter<std::
string>(
"Label"))
68 if(ZDCPileInputTag_.
label() !=
"") DoZDC_ =
true;
98 LogInfo(
"DataMixingHcalDigiWorker")<<
"===============> adding MC signals for "<<e.
id();
107 HBHEDigis = pHBHEDigis.
product();
108 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HBHE digis: " << HBHEDigis->
size();
117 it != HBHEDigis->
end(); ++it) {
123 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
124 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
158 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HO digis: " << HODigis->
size();
167 it != HODigis->
end(); ++it) {
172 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
173 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
200 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HF digis: " << HFDigis->
size();
209 it != HFDigis->
end(); ++it) {
214 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
215 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
242 ZDCDigis = pZDCDigis.
product();
244 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # ZDC digis: " << ZDCDigis->
size();
253 it != ZDCDigis->
end(); ++it) {
258 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
259 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
283 LogDebug(
"DataMixingHcalDigiWorker") <<
"\n===============> adding pileups from event "<<ep->
id()<<
" for bunchcrossing "<<bcr;
294 boost::shared_ptr<Wrapper<HBHEDigiCollection>
const> HBHEDigisPTR =
301 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HBHE digis: " << HBHEDigis->
size();
305 it != HBHEDigis->
end(); ++it) {
310 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
311 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
330 boost::shared_ptr<Wrapper<HODigiCollection>
const> HODigisPTR =
337 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HO digis: " << HODigis->
size();
341 it != HODigis->
end(); ++it) {
346 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
347 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
367 boost::shared_ptr<Wrapper<HFDigiCollection>
const> HFDigisPTR =
374 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HF digis: " << HFDigis->
size();
378 it != HFDigis->
end(); ++it) {
383 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
384 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
407 boost::shared_ptr<Wrapper<ZDCDigiCollection>
const> ZDCDigisPTR =
414 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # ZDC digis: " << ZDCDigis->
size();
418 it != ZDCDigis->
end(); ++it) {
423 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
424 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
469 HBHEDigiMap::const_iterator iHBchk;
474 currentID = iHB->first;
476 if (currentID == formerID) {
480 unsigned int sizenew = (iHB->second).
size();
481 unsigned int sizeold = HB_old.
size();
485 if(sizenew > sizeold) usenew =
true;
487 unsigned int max_samp =
std::max(sizenew, sizeold);
496 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
497 if(isamp < sizenew) {
498 fC_new = (iHB->second)[isamp];
502 if(isamp < sizeold) {
503 fC_old = HB_old[isamp];
508 fC_sum = fC_new + fC_old;
514 if(usenew) {HB_bigger[isamp] = fC_sum; }
515 else { HB_old[isamp] = fC_sum; }
518 if(usenew) HB_old = HB_bigger;
529 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
530 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
533 unsigned int sizeold = HB_old.
size();
534 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
535 coder.
fC2adc(HB_old,(HBHEdigis->back()), 1 );
539 formerID = currentID;
540 HB_old = iHB->second;
553 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
554 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
557 unsigned int sizenew = (iHB->second).
size();
558 for(
unsigned int isamp = 0; isamp<sizenew; isamp++) {
559 coder.
fC2adc(HB_old,(HBHEdigis->back()), 1 );
571 HODigiMap::const_iterator iHOchk;
576 currentID = iHO->first;
578 if (currentID == formerID) {
581 unsigned int sizenew = (iHO->second).
size();
582 unsigned int sizeold = HO_old.
size();
584 unsigned int max_samp =
std::max(sizenew, sizeold);
590 if(sizenew > sizeold) usenew =
true;
595 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
596 if(isamp < sizenew) {
597 fC_new = (iHO->second)[isamp];
601 if(isamp < sizeold) {
602 fC_old = HO_old[isamp];
607 fC_sum = fC_new + fC_old;
609 if(usenew) {HO_bigger[isamp] = fC_sum; }
610 else { HO_old[isamp] = fC_sum; }
613 if(usenew) HO_old = HO_bigger;
624 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
625 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
628 unsigned int sizeold = HO_old.
size();
629 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
630 coder.
fC2adc(HO_old,(HOdigis->back()), 1 );
634 formerID = currentID;
635 HO_old = iHO->second;
646 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
647 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
650 unsigned int sizeold = (iHO->second).
size();
651 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
652 coder.
fC2adc(HO_old,(HOdigis->back()), 1 );
664 HFDigiMap::const_iterator iHFchk;
669 currentID = iHF->first;
671 if (currentID == formerID) {
674 unsigned int sizenew = (iHF->second).
size();
675 unsigned int sizeold = HF_old.
size();
677 unsigned int max_samp =
std::max(sizenew, sizeold);
683 if(sizenew > sizeold) usenew =
true;
688 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
689 if(isamp < sizenew) {
690 fC_new = (iHF->second)[isamp];
694 if(isamp < sizeold) {
695 fC_old = HF_old[isamp];
700 fC_sum = fC_new + fC_old;
702 if(usenew) {HF_bigger[isamp] = fC_sum; }
703 else { HF_old[isamp] = fC_sum; }
706 if(usenew) HF_old = HF_bigger;
717 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
718 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
721 unsigned int sizeold = HF_old.
size();
722 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
723 coder.
fC2adc(HF_old,(HFdigis->back()), 1 );
727 formerID = currentID;
728 HF_old = iHF->second;
739 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
740 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
743 unsigned int sizeold = (iHF->second).
size();
744 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
745 coder.
fC2adc(HF_old,(HFdigis->back()), 1 );
758 ZDCDigiMap::const_iterator iZDCchk;
763 currentID = iZDC->first;
765 if (currentID == formerID) {
768 unsigned int sizenew = (iZDC->second).
size();
769 unsigned int sizeold = ZDC_old.
size();
771 unsigned int max_samp =
std::max(sizenew, sizeold);
777 if(sizenew > sizeold) usenew =
true;
782 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
783 if(isamp < sizenew) {
784 fC_new = (iZDC->second)[isamp];
788 if(isamp < sizeold) {
789 fC_old = ZDC_old[isamp];
794 fC_sum = fC_new + fC_old;
796 if(usenew) {ZDC_bigger[isamp] = fC_sum; }
797 else { ZDC_old[isamp] = fC_sum; }
800 if(usenew) ZDC_old = ZDC_bigger;
811 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
812 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
815 unsigned int sizeold = ZDC_old.
size();
816 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
817 coder.
fC2adc(ZDC_old,(ZDCdigis->back()), 1 );
821 formerID = currentID;
822 ZDC_old = iZDC->second;
833 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
834 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
837 unsigned int sizeold = (iZDC->second).
size();
838 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
839 coder.
fC2adc(ZDC_old,(ZDCdigis->back()), 1 );
850 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HBHE Merged digis: " << HBHEdigis->size() ;
851 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HO Merged digis: " << HOdigis->size() ;
852 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HF Merged digis: " << HFdigis->size() ;
853 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # ZDC Merged digis: " << ZDCdigis->size() ;
865 e.
put( hbheupgradeResult,
"HBHEUpgradeDigiCollection" );
866 e.
put( hfupgradeResult,
"HFUpgradeDigiCollection" );
T getParameter(std::string const &) const
std::string HBHEDigiCollectionDM_
edm::InputTag HBHEPileInputTag_
edm::EDGetTokenT< HBHEDigiCollection > HBHEDigiPToken_
edm::EDGetTokenT< HODigiCollection > HODigiToken_
std::string ZDCDigiCollectionDM_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< ZDCDigiCollection > ZDCDigiToken_
edm::EDGetTokenT< HODigiCollection > HODigiPToken_
EventID const & id() const
edm::InputTag HBHEdigiCollectionSig_
std::string HODigiCollectionDM_
std::vector< HBHEDataFrame >::const_iterator const_iterator
HBHEDigiMap HBHEDigiStorage_
void addHcalPileups(const int bcr, const edm::EventPrincipal *, unsigned int EventId, const edm::EventSetup &ES, ModuleCallingContext const *)
ZDCDigiMap ZDCDigiStorage_
virtual void fC2adc(const CaloSamples &clf, HBHEDataFrame &df, int fCapIdOffset) const
edm::EDGetTokenT< ZDCDigiCollection > ZDCDigiPToken_
edm::EDGetTokenT< HFDigiCollection > HFDigiPToken_
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
edm::InputTag HOPileInputTag_
edm::SortedCollection< HcalUpgradeDataFrame > HFUpgradeDigiCollection
edm::InputTag ZDCPileInputTag_
Container::value_type value_type
edm::SortedCollection< HcalUpgradeDataFrame > HBHEUpgradeDigiCollection
edm::InputTag ZDCdigiCollectionSig_
const_iterator end() const
int size() const
get the size
edm::InputTag HFdigiCollectionSig_
virtual ~DataMixingHcalDigiWorker()
T const * product() const
edm::EDGetTokenT< HFDigiCollection > HFDigiToken_
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::EDGetTokenT< HBHEDigiCollection > HBHEDigiToken_
edm::InputTag HOdigiCollectionSig_