Skip to content

Commit

Permalink
Merge pull request cms-sw#3654 from mdhildreth/More_SIM_Consumes_migr…
Browse files Browse the repository at this point in the history
…ation

Consumes -- Some Ecal consumes migration
  • Loading branch information
ktf committed May 3, 2014

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 4dd08c9 + e96759a commit b4f7099
Showing 6 changed files with 33 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef ECALZEROSUPPRESSIONPRODUCER_H
#define ECALZEROSUPPRESSIONPRODUCER_H

#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/Framework/interface/EDProducer.h"
//#include "FWCore/Framework/interface/Event.h"
//#include "DataFormats/Common/interface/Handle.h"
@@ -154,6 +155,13 @@ class EcalSelectiveReadoutProducer : public edm::EDProducer
* for memory management. Used settings_ to access to the object
*/
std::auto_ptr<EcalSRSettings> settingsFromFile_;

// Tokens for consumes collection:

edm::EDGetTokenT<EBDigiCollection> EB_token;
edm::EDGetTokenT<EEDigiCollection> EE_token;
edm::EDGetTokenT<EcalTrigPrimDigiCollection> EcTP_token;

};

#endif
Original file line number Diff line number Diff line change
@@ -71,6 +71,11 @@ EcalSelectiveReadoutProducer::EcalSelectiveReadoutProducer(const edm::ParameterS
theGeometry = 0;
theTriggerTowerMap = 0;
theElecMap = 0;

EB_token = consumes<EBDigiCollection>(edm::InputTag(digiProducer_, ebdigiCollection_));
EE_token = consumes<EEDigiCollection>(edm::InputTag(digiProducer_, eedigiCollection_));;
EcTP_token = consumes<EcalTrigPrimDigiCollection>(edm::InputTag(trigPrimProducer_, trigPrimCollection_));;

}


@@ -181,7 +186,7 @@ const EBDigiCollection*
EcalSelectiveReadoutProducer::getEBDigis(edm::Event& event) const
{
edm::Handle<EBDigiCollection> hEBDigis;
event.getByLabel(digiProducer_, ebdigiCollection_, hEBDigis);
event.getByToken(EB_token, hEBDigis);
//product() method is called before id() in order to get an exception
//if the handle is not available (check not done by id() method).
const EBDigiCollection* result = hEBDigis.product();
@@ -197,7 +202,7 @@ const EEDigiCollection*
EcalSelectiveReadoutProducer::getEEDigis(edm::Event& event) const
{
edm::Handle<EEDigiCollection> hEEDigis;
event.getByLabel(digiProducer_, eedigiCollection_, hEEDigis);
event.getByToken(EE_token, hEEDigis);
//product() method is called before id() in order to get an exception
//if the handle is not available (check not done by id() method).
const EEDigiCollection* result = hEEDigis.product();
@@ -213,7 +218,7 @@ const EcalTrigPrimDigiCollection*
EcalSelectiveReadoutProducer::getTrigPrims(edm::Event& event) const
{
edm::Handle<EcalTrigPrimDigiCollection> hTPDigis;
event.getByLabel(trigPrimProducer_, trigPrimCollection_, hTPDigis);
event.getByToken(EcTP_token, hTPDigis);
return hTPDigis.product();
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef ESZEROSUPPRESSIONPRODUCER_H
#define ESZEROSUPPRESSIONPRODUCER_H

#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "DataFormats/Common/interface/Handle.h"
@@ -35,6 +36,9 @@ class ESZeroSuppressionProducer : public edm::EDProducer

edm::ESHandle<ESThresholds> esthresholds_;
edm::ESHandle<ESPedestals> espeds_;

edm::EDGetTokenT<ESDigiCollection> ES_token;

};

#endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef ECALZEROSUPPRESSIONPRODUCER_H
#define ECALZEROSUPPRESSIONPRODUCER_H

#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "DataFormats/Common/interface/Handle.h"
@@ -48,6 +49,9 @@ class EcalZeroSuppressionProducer : public edm::EDProducer

EcalZeroSuppressor<EBDataFrame> theBarrelZeroSuppressor_;
EcalZeroSuppressor<EEDataFrame> theEndcapZeroSuppressor_;

edm::EDGetTokenT<EBDigiCollection> EB_token;
edm::EDGetTokenT<EEDigiCollection> EE_token;

};

Original file line number Diff line number Diff line change
@@ -9,6 +9,9 @@ ESZeroSuppressionProducer::ESZeroSuppressionProducer(const edm::ParameterSet& ps
ESZSdigiCollection_ = ps.getParameter<std::string>("ESZSdigiCollection");

produces<ESDigiCollection>(ESZSdigiCollection_);

ES_token = consumes<ESDigiCollection>(edm::InputTag(digiProducer_));;

}

ESZeroSuppressionProducer::~ESZeroSuppressionProducer() {
@@ -28,7 +31,7 @@ void ESZeroSuppressionProducer::produce(edm::Event& event, const edm::EventSetup
edm::Handle<ESDigiCollection> ESDigis;

bool fullESDigis = true;
event.getByLabel(digiProducer_, ESDigis);
event.getByToken(ES_token, ESDigis);
if (!ESDigis.isValid()) {
edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << ESdigiCollection_.c_str() ;
fullESDigis = false;
Original file line number Diff line number Diff line change
@@ -17,6 +17,9 @@ EcalZeroSuppressionProducer::EcalZeroSuppressionProducer(const edm::ParameterSet
produces<EBDigiCollection>(EBZSdigiCollection_);
produces<EEDigiCollection>(EEZSdigiCollection_);

EB_token = consumes<EBDigiCollection>(edm::InputTag(digiProducer_));
EE_token = consumes<EEDigiCollection>(edm::InputTag(digiProducer_));;

}


@@ -37,15 +40,15 @@ void EcalZeroSuppressionProducer::produce(edm::Event& event, const edm::EventSet
const EBDigiCollection* fullBarrelDigis =0;
const EEDigiCollection* fullEndcapDigis =0;

event.getByLabel( digiProducer_, pEBDigis);
event.getByToken( EB_token, pEBDigis);
if (pEBDigis.isValid()){
fullBarrelDigis = pEBDigis.product(); // get a ptr to the produc
edm::LogInfo("ZeroSuppressionInfo") << "total # fullBarrelDigis: " << fullBarrelDigis->size() ;
} else {
edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EBdigiCollection_.c_str() ;
}

event.getByLabel( digiProducer_, pEEDigis);
event.getByToken( EE_token, pEEDigis);
if (pEEDigis.isValid()){
fullEndcapDigis = pEEDigis.product(); // get a ptr to the product
edm::LogInfo("ZeroSuppressionInfo") << "total # fullEndcapDigis: " << fullEndcapDigis->size() ;

0 comments on commit b4f7099

Please sign in to comment.