Skip to content

Commit

Permalink
Merge pull request #39186 from bsunanda/Run3-gex138A
Browse files Browse the repository at this point in the history
Run3-gex138A Replace access by label with access using token in CalibCalorimetry/EcalPedestalOffsets
  • Loading branch information
cmsbuild committed Aug 26, 2022
2 parents 540bea4 + 6ce6e2d commit 2521bbe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
17 changes: 8 additions & 9 deletions CalibCalorimetry/EcalPedestalOffsets/interface/testChannel.h
Expand Up @@ -58,18 +58,17 @@ class testChannel : public edm::one::EDAnalyzer<> {
private:
int getHeaderSMId(const int headerId);

std::string m_digiCollection; //! secondary name given to collection of digis
std::string m_digiProducer; //! name of module/plugin/producer making digis
std::string m_headerProducer; //! name of module/plugin/producer making headers
const edm::EDGetTokenT<EBDigiCollection> m_digiProducerToken; //! Token to access digis
const edm::EDGetTokenT<EcalRawDataCollection> m_headerProducerToken; //! Token to access headers

std::string m_xmlFile; //! name of the xml file to be saved
const std::string m_xmlFile; //! name of the xml file to be saved

int m_DACmin;
int m_DACmax;
double m_RMSmax;
int m_bestPed;
const int m_DACmin;
const int m_DACmax;
const double m_RMSmax;
const int m_bestPed;

int m_xtal;
const int m_xtal;

TH2F m_pedVSDAC;
TH2F m_singlePedVSDAC_1;
Expand Down
17 changes: 8 additions & 9 deletions CalibCalorimetry/EcalPedestalOffsets/src/testChannel.cc
Expand Up @@ -15,9 +15,10 @@

//! ctor
testChannel::testChannel(const edm::ParameterSet &paramSet)
: m_digiCollection(paramSet.getParameter<std::string>("digiCollection")),
m_digiProducer(paramSet.getParameter<std::string>("digiProducer")),
m_headerProducer(paramSet.getParameter<std::string>("headerProducer")),
: m_digiProducerToken(
consumes<EBDigiCollection>(edm::InputTag(paramSet.getParameter<std::string>("digiProducer")))),
m_headerProducerToken(
consumes<EcalRawDataCollection>(edm::InputTag(paramSet.getParameter<std::string>("headerProducer")))),
m_xmlFile(paramSet.getParameter<std::string>("xmlFile")),
m_DACmin(paramSet.getParameter<int>("DACmin")),
m_DACmax(paramSet.getParameter<int>("DACmax")),
Expand Down Expand Up @@ -66,10 +67,9 @@ void testChannel::analyze(edm::Event const &event, edm::EventSetup const &eventS

// get the headers
// (one header for each supermodule)
edm::Handle<EcalRawDataCollection> DCCHeaders;
event.getByLabel(m_headerProducer, DCCHeaders);
const edm::Handle<EcalRawDataCollection> &DCCHeaders = event.getHandle(m_headerProducerToken);
if (!DCCHeaders.isValid()) {
edm::LogError("testChannel") << "Error! can't get the product " << m_headerProducer.c_str();
edm::LogError("testChannel") << "Error! can't get the product for EcalRawDataCollection";
}

std::map<int, int> DACvalues;
Expand All @@ -85,10 +85,9 @@ void testChannel::analyze(edm::Event const &event, edm::EventSetup const &eventS

// get the digis
// (one digi for each crystal)
edm::Handle<EBDigiCollection> pDigis;
event.getByLabel(m_digiProducer, pDigis);
const edm::Handle<EBDigiCollection> &pDigis = event.getHandle(m_digiProducerToken);
if (!pDigis.isValid()) {
edm::LogError("testChannel") << "Error! can't get the product " << m_digiCollection.c_str();
edm::LogError("testChannel") << "Error! can't get the product for EBDigiCollection";
}

// loop over the digis
Expand Down

0 comments on commit 2521bbe

Please sign in to comment.