35 DataMixingHcalDigiWorker::DataMixingHcalDigiWorker() { }
39 label_(ps.getParameter<std::
string>(
"Label"))
69 if(ZDCPileInputTag_.
label() !=
"") DoZDC_ =
true;
99 LogInfo(
"DataMixingHcalDigiWorker")<<
"===============> adding MC signals for "<<e.
id();
108 HBHEDigis = pHBHEDigis.
product();
109 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HBHE digis: " << HBHEDigis->
size();
118 it != HBHEDigis->
end(); ++it) {
124 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
125 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
159 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HO digis: " << HODigis->
size();
168 it != HODigis->
end(); ++it) {
173 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
174 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
201 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HF digis: " << HFDigis->
size();
210 it != HFDigis->
end(); ++it) {
215 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
216 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
243 ZDCDigis = pZDCDigis.
product();
245 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # ZDC digis: " << ZDCDigis->
size();
254 it != ZDCDigis->
end(); ++it) {
259 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
260 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
284 LogDebug(
"DataMixingHcalDigiWorker") <<
"\n===============> adding pileups from event "<<ep->
id()<<
" for bunchcrossing "<<bcr;
295 std::shared_ptr<Wrapper<HBHEDigiCollection>
const> HBHEDigisPTR =
302 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HBHE digis: " << HBHEDigis->
size();
306 it != HBHEDigis->
end(); ++it) {
311 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
312 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
332 std::shared_ptr<Wrapper<HODigiCollection>
const> HODigisPTR =
339 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HO digis: " << HODigis->
size();
343 it != HODigis->
end(); ++it) {
348 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
349 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
369 std::shared_ptr<Wrapper<HFDigiCollection>
const> HFDigisPTR =
376 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HF digis: " << HFDigis->
size();
380 it != HFDigis->
end(); ++it) {
385 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
386 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
409 std::shared_ptr<Wrapper<ZDCDigiCollection>
const> ZDCDigisPTR =
416 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # ZDC digis: " << ZDCDigis->
size();
420 it != ZDCDigis->
end(); ++it) {
425 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
426 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
471 HBHEDigiMap::const_iterator iHBchk;
476 currentID = iHB->first;
478 if (currentID == formerID) {
482 unsigned int sizenew = (iHB->second).
size();
483 unsigned int sizeold = HB_old.
size();
487 if(sizenew > sizeold) usenew =
true;
489 unsigned int max_samp =
std::max(sizenew, sizeold);
498 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
499 if(isamp < sizenew) {
500 fC_new = (iHB->second)[isamp];
504 if(isamp < sizeold) {
505 fC_old = HB_old[isamp];
510 fC_sum = fC_new + fC_old;
516 if(usenew) {HB_bigger[isamp] = fC_sum; }
517 else { HB_old[isamp] = fC_sum; }
520 if(usenew) HB_old = HB_bigger;
531 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
532 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
535 unsigned int sizeold = HB_old.
size();
536 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
537 coder.
fC2adc(HB_old,(HBHEdigis->back()), 1 );
541 formerID = currentID;
542 HB_old = iHB->second;
555 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
556 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
559 unsigned int sizenew = (iHB->second).
size();
560 for(
unsigned int isamp = 0; isamp<sizenew; isamp++) {
561 coder.
fC2adc(HB_old,(HBHEdigis->back()), 1 );
573 HODigiMap::const_iterator iHOchk;
578 currentID = iHO->first;
580 if (currentID == formerID) {
583 unsigned int sizenew = (iHO->second).
size();
584 unsigned int sizeold = HO_old.
size();
586 unsigned int max_samp =
std::max(sizenew, sizeold);
592 if(sizenew > sizeold) usenew =
true;
597 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
598 if(isamp < sizenew) {
599 fC_new = (iHO->second)[isamp];
603 if(isamp < sizeold) {
604 fC_old = HO_old[isamp];
609 fC_sum = fC_new + fC_old;
611 if(usenew) {HO_bigger[isamp] = fC_sum; }
612 else { HO_old[isamp] = fC_sum; }
615 if(usenew) HO_old = HO_bigger;
626 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
627 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
630 unsigned int sizeold = HO_old.
size();
631 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
632 coder.
fC2adc(HO_old,(HOdigis->back()), 1 );
636 formerID = currentID;
637 HO_old = iHO->second;
648 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
649 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
652 unsigned int sizeold = (iHO->second).
size();
653 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
654 coder.
fC2adc(HO_old,(HOdigis->back()), 1 );
666 HFDigiMap::const_iterator iHFchk;
671 currentID = iHF->first;
673 if (currentID == formerID) {
676 unsigned int sizenew = (iHF->second).
size();
677 unsigned int sizeold = HF_old.
size();
679 unsigned int max_samp =
std::max(sizenew, sizeold);
685 if(sizenew > sizeold) usenew =
true;
690 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
691 if(isamp < sizenew) {
692 fC_new = (iHF->second)[isamp];
696 if(isamp < sizeold) {
697 fC_old = HF_old[isamp];
702 fC_sum = fC_new + fC_old;
704 if(usenew) {HF_bigger[isamp] = fC_sum; }
705 else { HF_old[isamp] = fC_sum; }
708 if(usenew) HF_old = HF_bigger;
719 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
720 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
723 unsigned int sizeold = HF_old.
size();
724 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
725 coder.
fC2adc(HF_old,(HFdigis->back()), 1 );
729 formerID = currentID;
730 HF_old = iHF->second;
741 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
742 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
745 unsigned int sizeold = (iHF->second).
size();
746 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
747 coder.
fC2adc(HF_old,(HFdigis->back()), 1 );
760 ZDCDigiMap::const_iterator iZDCchk;
765 currentID = iZDC->first;
767 if (currentID == formerID) {
770 unsigned int sizenew = (iZDC->second).
size();
771 unsigned int sizeold = ZDC_old.
size();
773 unsigned int max_samp =
std::max(sizenew, sizeold);
779 if(sizenew > sizeold) usenew =
true;
784 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
785 if(isamp < sizenew) {
786 fC_new = (iZDC->second)[isamp];
790 if(isamp < sizeold) {
791 fC_old = ZDC_old[isamp];
796 fC_sum = fC_new + fC_old;
798 if(usenew) {ZDC_bigger[isamp] = fC_sum; }
799 else { ZDC_old[isamp] = fC_sum; }
802 if(usenew) ZDC_old = ZDC_bigger;
813 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
814 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
817 unsigned int sizeold = ZDC_old.
size();
818 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
819 coder.
fC2adc(ZDC_old,(ZDCdigis->back()), 1 );
823 formerID = currentID;
824 ZDC_old = iZDC->second;
835 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
836 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
839 unsigned int sizeold = (iZDC->second).
size();
840 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
841 coder.
fC2adc(ZDC_old,(ZDCdigis->back()), 1 );
852 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HBHE Merged digis: " << HBHEdigis->size() ;
853 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HO Merged digis: " << HOdigis->size() ;
854 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HF Merged digis: " << HFdigis->size() ;
855 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # ZDC Merged digis: " << ZDCdigis->size() ;
867 e.
put( hbheupgradeResult,
"HBHEUpgradeDigiCollection" );
868 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_
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
T const * product() const
int size() const
get the size
edm::InputTag HFdigiCollectionSig_
virtual ~DataMixingHcalDigiWorker()
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_