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);
145 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HO digis: " << HODigis->
size();
154 it != HODigis->
end(); ++it) {
159 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
160 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
187 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HF digis: " << HFDigis->
size();
196 it != HFDigis->
end(); ++it) {
201 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
202 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
229 ZDCDigis = pZDCDigis.
product();
231 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # ZDC digis: " << ZDCDigis->
size();
240 it != ZDCDigis->
end(); ++it) {
245 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
246 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
270 LogDebug(
"DataMixingHcalDigiWorker") <<
"\n===============> adding pileups from event "<<ep->
id()<<
" for bunchcrossing "<<bcr;
281 boost::shared_ptr<Wrapper<HBHEDigiCollection>
const> HBHEDigisPTR =
288 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HBHE digis: " << HBHEDigis->
size();
292 it != HBHEDigis->
end(); ++it) {
297 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
298 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
316 boost::shared_ptr<Wrapper<HODigiCollection>
const> HODigisPTR =
323 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HO digis: " << HODigis->
size();
327 it != HODigis->
end(); ++it) {
332 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
333 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
353 boost::shared_ptr<Wrapper<HFDigiCollection>
const> HFDigisPTR =
360 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # HF digis: " << HFDigis->
size();
364 it != HFDigis->
end(); ++it) {
369 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
370 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
393 boost::shared_ptr<Wrapper<ZDCDigiCollection>
const> ZDCDigisPTR =
400 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # ZDC digis: " << ZDCDigis->
size();
404 it != ZDCDigis->
end(); ++it) {
409 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
410 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
455 HBHEDigiMap::const_iterator iHBchk;
460 currentID = iHB->first;
462 if (currentID == formerID) {
466 unsigned int sizenew = (iHB->second).
size();
467 unsigned int sizeold = HB_old.
size();
471 if(sizenew > sizeold) usenew =
true;
473 unsigned int max_samp =
std::max(sizenew, sizeold);
482 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
483 if(isamp < sizenew) {
484 fC_new = (iHB->second)[isamp];
488 if(isamp < sizeold) {
489 fC_old = HB_old[isamp];
494 fC_sum = fC_new + fC_old;
500 if(usenew) {HB_bigger[isamp] = fC_sum; }
501 else { HB_old[isamp] = fC_sum; }
504 if(usenew) HB_old = HB_bigger;
515 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
516 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
519 unsigned int sizeold = HB_old.
size();
520 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
521 coder.
fC2adc(HB_old,(HBHEdigis->back()), 1 );
525 formerID = currentID;
526 HB_old = iHB->second;
539 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
540 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
543 unsigned int sizenew = (iHB->second).
size();
544 for(
unsigned int isamp = 0; isamp<sizenew; isamp++) {
545 coder.
fC2adc(HB_old,(HBHEdigis->back()), 1 );
557 HODigiMap::const_iterator iHOchk;
562 currentID = iHO->first;
564 if (currentID == formerID) {
567 unsigned int sizenew = (iHO->second).
size();
568 unsigned int sizeold = HO_old.
size();
570 unsigned int max_samp =
std::max(sizenew, sizeold);
576 if(sizenew > sizeold) usenew =
true;
581 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
582 if(isamp < sizenew) {
583 fC_new = (iHO->second)[isamp];
587 if(isamp < sizeold) {
588 fC_old = HO_old[isamp];
593 fC_sum = fC_new + fC_old;
595 if(usenew) {HO_bigger[isamp] = fC_sum; }
596 else { HO_old[isamp] = fC_sum; }
599 if(usenew) HO_old = HO_bigger;
610 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
611 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
614 unsigned int sizeold = HO_old.
size();
615 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
616 coder.
fC2adc(HO_old,(HOdigis->back()), 1 );
620 formerID = currentID;
621 HO_old = iHO->second;
632 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
633 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
636 unsigned int sizeold = (iHO->second).
size();
637 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
638 coder.
fC2adc(HO_old,(HOdigis->back()), 1 );
650 HFDigiMap::const_iterator iHFchk;
655 currentID = iHF->first;
657 if (currentID == formerID) {
660 unsigned int sizenew = (iHF->second).
size();
661 unsigned int sizeold = HF_old.
size();
663 unsigned int max_samp =
std::max(sizenew, sizeold);
669 if(sizenew > sizeold) usenew =
true;
674 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
675 if(isamp < sizenew) {
676 fC_new = (iHF->second)[isamp];
680 if(isamp < sizeold) {
681 fC_old = HF_old[isamp];
686 fC_sum = fC_new + fC_old;
688 if(usenew) {HF_bigger[isamp] = fC_sum; }
689 else { HF_old[isamp] = fC_sum; }
692 if(usenew) HF_old = HF_bigger;
703 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
704 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
707 unsigned int sizeold = HF_old.
size();
708 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
709 coder.
fC2adc(HF_old,(HFdigis->back()), 1 );
713 formerID = currentID;
714 HF_old = iHF->second;
725 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
726 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
729 unsigned int sizeold = (iHF->second).
size();
730 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
731 coder.
fC2adc(HF_old,(HFdigis->back()), 1 );
744 ZDCDigiMap::const_iterator iZDCchk;
749 currentID = iZDC->first;
751 if (currentID == formerID) {
754 unsigned int sizenew = (iZDC->second).
size();
755 unsigned int sizeold = ZDC_old.
size();
757 unsigned int max_samp =
std::max(sizenew, sizeold);
763 if(sizenew > sizeold) usenew =
true;
768 for(
unsigned int isamp = 0; isamp<max_samp; isamp++) {
769 if(isamp < sizenew) {
770 fC_new = (iZDC->second)[isamp];
774 if(isamp < sizeold) {
775 fC_old = ZDC_old[isamp];
780 fC_sum = fC_new + fC_old;
782 if(usenew) {ZDC_bigger[isamp] = fC_sum; }
783 else { ZDC_old[isamp] = fC_sum; }
786 if(usenew) ZDC_old = ZDC_bigger;
797 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
798 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
801 unsigned int sizeold = ZDC_old.
size();
802 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
803 coder.
fC2adc(ZDC_old,(ZDCdigis->back()), 1 );
807 formerID = currentID;
808 ZDC_old = iZDC->second;
819 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
820 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
823 unsigned int sizeold = (iZDC->second).
size();
824 for(
unsigned int isamp = 0; isamp<sizeold; isamp++) {
825 coder.
fC2adc(ZDC_old,(ZDCdigis->back()), 1 );
836 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HBHE Merged digis: " << HBHEdigis->size() ;
837 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HO Merged digis: " << HOdigis->size() ;
838 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HF Merged digis: " << HFdigis->size() ;
839 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # ZDC Merged digis: " << ZDCdigis->size() ;
851 e.
put( hbheupgradeResult,
"HBHEUpgradeDigiCollection" );
852 e.
put( hfupgradeResult,
"HFUpgradeDigiCollection" );
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< 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
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
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_