Skip to content

Commit

Permalink
updated data access method based on tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher committed Sep 23, 2013
1 parent 3721594 commit c8c0e79
Show file tree
Hide file tree
Showing 203 changed files with 1,796 additions and 991 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapHcal.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"

class HcalRecHitRecalib : public edm::EDProducer
{
Expand All @@ -43,9 +44,9 @@ class HcalRecHitRecalib : public edm::EDProducer
virtual void produce(edm::Event &, const edm::EventSetup&) override;

private:
edm::InputTag hbheLabel_;
edm::InputTag hoLabel_;
edm::InputTag hfLabel_;
edm::EDGetTokenT<HBHERecHitCollection> tok_hbhe_;
edm::EDGetTokenT<HORecHitCollection> tok_ho_;
edm::EDGetTokenT<HFRecHitCollection> tok_hf_;
std::string RecalibHBHEHits_;
std::string RecalibHFHits_;
std::string RecalibHOHits_;
Expand Down
13 changes: 6 additions & 7 deletions CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
#include "FWCore/ParameterSet/interface/FileInPath.h"
#include "FWCore/Framework/interface/ESHandle.h"

#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLHcal.h"

HcalRecHitRecalib::HcalRecHitRecalib(const edm::ParameterSet& iConfig)
{

hbheLabel_ = iConfig.getParameter<edm::InputTag>("hbheInput");
hoLabel_ = iConfig.getParameter<edm::InputTag>("hoInput");
hfLabel_ = iConfig.getParameter<edm::InputTag>("hfInput");
tok_hbhe_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInput"));
tok_ho_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInput"));
tok_hf_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInput"));

// HBHEHitsProducer_ = iConfig.getParameter< std::string > ("HBHERecHitsProducer");
// HOHitsProducer_ = iConfig.getParameter< std::string > ("HERecHitsProducer");
Expand Down Expand Up @@ -78,21 +77,21 @@ HcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
const HFRecHitCollection* HFRecHits = 0;
const HORecHitCollection* HORecHits = 0;

iEvent.getByLabel(hbheLabel_,HBHERecHitsHandle);
iEvent.getByToken(tok_hbhe_,HBHERecHitsHandle);
if (!HBHERecHitsHandle.isValid()) {
LogDebug("") << "HcalREcHitRecalib: Error! can't get product!" << std::endl;
} else {
HBHERecHits = HBHERecHitsHandle.product(); // get a ptr to the product
}

iEvent.getByLabel(hoLabel_,HORecHitsHandle);
iEvent.getByToken(tok_ho_,HORecHitsHandle);
if (!HORecHitsHandle.isValid()) {
LogDebug("") << "HcalREcHitRecalib: Error! can't get product!" << std::endl;
} else {
HORecHits = HORecHitsHandle.product(); // get a ptr to the product
}

iEvent.getByLabel(hfLabel_,HFRecHitsHandle);
iEvent.getByToken(tok_hf_,HFRecHitsHandle);
if (!HFRecHitsHandle.isValid()) {
LogDebug("") << "HcalREcHitRecalib: Error! can't get product!" << std::endl;
} else {
Expand Down
7 changes: 5 additions & 2 deletions CalibCalorimetry/HcalStandardModules/interface/HFLightCal.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"

class TFile;
class TH1F;
class TH2F;
Expand Down Expand Up @@ -43,8 +46,8 @@ class HFLightCal : public edm::EDAnalyzer {
TH1F* hpedpin[8][3];
TH1F* htsmpin[8][3];

edm::InputTag hfDigiCollectionTag_;
edm::InputTag hcalCalibDigiCollectionTag_;
edm::EDGetTokenT<HFDigiCollection> tok_hfDigiCollection_;
edm::EDGetTokenT<HcalCalibDigiCollection> tok_hcalCalibDigiCollection_;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"

class TFile;
class TH1F;
class TH2F;
Expand Down Expand Up @@ -43,8 +46,8 @@ class HFLightCalRand : public edm::EDAnalyzer {
TH1F* hpedpin[8][3];
TH1F* htsmpin[8][3];

edm::InputTag hfDigiCollectionTag_;
edm::InputTag hcalCalibDigiCollectionTag_;
edm::EDGetTokenT<HFDigiCollection> tok_hfDigiCollection_;
edm::EDGetTokenT<HcalCalibDigiCollection> tok_hcalCalibDigiCollection_;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"


class TFile;
class TH1F;
class TH2F;
Expand Down Expand Up @@ -32,8 +36,8 @@ class HFPreLightCal : public edm::EDAnalyzer {
TH1F *htsmax,*htspinmax;
TH1F* htspin[8][3];

edm::InputTag hfDigiCollectionTag_;
edm::InputTag hcalCalibDigiCollectionTag_;
edm::EDGetTokenT<HFDigiCollection> tok_hfDigiCollection_;
edm::EDGetTokenT<HcalCalibDigiCollection> tok_hcalCalibDigiCollection_;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ void endJob(void);
std::string m_inputPedestals_tag;
int m_inputPedestals_run;

edm::InputTag hbheDigiCollectionTag_;
edm::InputTag hoDigiCollectionTag_;
edm::InputTag hfDigiCollectionTag_;
edm::InputTag hcalCalibDigiCollectionTag_;
edm::EDGetTokenT<HBHEDigiCollection> tok_hbheDigiCollection_;
edm::EDGetTokenT<HODigiCollection> tok_hoDigiCollection_;
edm::EDGetTokenT<HFDigiCollection> tok_hfDigiCollection_;
edm::EDGetTokenT<HcalCalibDigiCollection> tok_hcalCalibDigiCollection_;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ void endJob(void);
std::string m_outputPedestalWidths_tag;
int m_outputPedestalWidths_run;

edm::InputTag hbheDigiCollectionTag_;
edm::InputTag hoDigiCollectionTag_;
edm::InputTag hfDigiCollectionTag_;
edm::EDGetTokenT<HBHEDigiCollection> tok_hbheDigiCollection_;
edm::EDGetTokenT<HODigiCollection> tok_hoDigiCollection_;
edm::EDGetTokenT<HFDigiCollection> tok_hfDigiCollection_;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ class HcalPedestalMCWidths : public edm::EDAnalyzer
bool firsttime;
bool histflag;

edm::InputTag hbheDigiCollectionTag_;
edm::InputTag hoDigiCollectionTag_;
edm::InputTag hfDigiCollectionTag_;
edm::EDGetTokenT<HBHEDigiCollection> tok_hbheDigiCollection_;
edm::EDGetTokenT<HODigiCollection> tok_hoDigiCollection_;
edm::EDGetTokenT<HFDigiCollection> tok_hfDigiCollection_;
};
#endif

Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ class HcalPedestalsAnalysis : public edm::EDAnalyzer
HcalPedestalWidths* rawWidthsItemfc;
HcalTopology *theTopology;

edm::InputTag hbheDigiCollectionTag_;
edm::InputTag hoDigiCollectionTag_;
edm::InputTag hfDigiCollectionTag_;
edm::EDGetTokenT<HBHEDigiCollection> tok_hbheDigiCollection_;
edm::EDGetTokenT<HODigiCollection> tok_hoDigiCollection_;
edm::EDGetTokenT<HFDigiCollection> tok_hfDigiCollection_;
};
#endif

14 changes: 7 additions & 7 deletions CalibCalorimetry/HcalStandardModules/src/HFLightCal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#include "CalibCalorimetry/HcalStandardModules/interface/HFLightCal.h"

#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"

#include "CalibFormats/HcalObjects/interface/HcalDbService.h"
#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
Expand All @@ -41,9 +39,11 @@ namespace {
bool verbose = false;
}

HFLightCal::HFLightCal (const edm::ParameterSet& fConfiguration) :
hfDigiCollectionTag_(fConfiguration.getParameter<edm::InputTag>("hfDigiCollectionTag")),
hcalCalibDigiCollectionTag_(fConfiguration.getParameter<edm::InputTag>("hcalCalibDigiCollectionTag")) {
HFLightCal::HFLightCal (const edm::ParameterSet& fConfiguration) {


tok_hfDigiCollection_ = consumes<HFDigiCollection>(fConfiguration.getParameter<edm::InputTag>("hfDigiCollectionTag"));
tok_hcalCalibDigiCollection_ = consumes<HcalCalibDigiCollection>(fConfiguration.getParameter<edm::InputTag>("hcalCalibDigiCollectionTag")) ;

//std::string histfile = fConfiguration.getUntrackedParameter<string>("rootFile");
histfile = fConfiguration.getUntrackedParameter<string>("rootFile");
Expand Down Expand Up @@ -428,7 +428,7 @@ void HFLightCal::analyze(const edm::Event& fEvent, const edm::EventSetup& fSetup

// HF PIN-diodes
edm::Handle<HcalCalibDigiCollection> calib;
fEvent.getByLabel(hcalCalibDigiCollectionTag_, calib);
fEvent.getByToken(tok_hcalCalibDigiCollection_, calib);
if (verbose) std::cout<<"Analysis-> total CAL digis= "<<calib->size()<<std::endl;

/* COMMENTED OUT by J. Mans (7-28-2008) as major changes needed with new Calib DetId
Expand Down Expand Up @@ -484,7 +484,7 @@ void HFLightCal::analyze(const edm::Event& fEvent, const edm::EventSetup& fSetup

// HF
edm::Handle<HFDigiCollection> hf_digi;
fEvent.getByLabel(hfDigiCollectionTag_, hf_digi);
fEvent.getByToken(tok_hfDigiCollection_, hf_digi);
if (verbose) std::cout<<"Analysis-> total HF digis= "<<hf_digi->size()<<std::endl;

for (unsigned ihit = 0; ihit < hf_digi->size (); ++ihit) {
Expand Down
13 changes: 6 additions & 7 deletions CalibCalorimetry/HcalStandardModules/src/HFLightCalRand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

#include "CalibCalorimetry/HcalStandardModules/interface/HFLightCalRand.h"

#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"

#include "CalibFormats/HcalObjects/interface/HcalDbService.h"
#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
Expand All @@ -40,9 +38,10 @@ namespace {
bool verbose = false;
}

HFLightCalRand::HFLightCalRand (const edm::ParameterSet& fConfiguration) :
hfDigiCollectionTag_(fConfiguration.getParameter<edm::InputTag>("hfDigiCollectionTag")),
hcalCalibDigiCollectionTag_(fConfiguration.getParameter<edm::InputTag>("hcalCalibDigiCollectionTag")) {
HFLightCalRand::HFLightCalRand (const edm::ParameterSet& fConfiguration) {

tok_hfDigiCollection_ = consumes<HFDigiCollection>(fConfiguration.getParameter<edm::InputTag>("hfDigiCollectionTag"));
tok_hcalCalibDigiCollection_ = consumes<HcalCalibDigiCollection>(fConfiguration.getParameter<edm::InputTag>("hcalCalibDigiCollectionTag"));

//std::string histfile = fConfiguration.getUntrackedParameter<string>("rootFile");
histfile = fConfiguration.getUntrackedParameter<string>("rootFile");
Expand Down Expand Up @@ -387,7 +386,7 @@ void HFLightCalRand::analyze(const edm::Event& fEvent, const edm::EventSetup& fS

// HF PIN-diodes
edm::Handle<HcalCalibDigiCollection> calib;
fEvent.getByLabel(hcalCalibDigiCollectionTag_, calib);
fEvent.getByToken(tok_hcalCalibDigiCollection_, calib);
if (verbose) std::cout<<"Analysis-> total CAL digis= "<<calib->size()<<std::endl;
/* COMMENTED OUT by J. Mans (7-28-2008) as major changes needed with new Calib DetId
re-commented out by R.Ofierzynski (11.Nov.2008) - to be able to provide a consistent code for CMSSW_3_0_0_pre3:
Expand Down Expand Up @@ -445,7 +444,7 @@ void HFLightCalRand::analyze(const edm::Event& fEvent, const edm::EventSetup& fS
*/
// HF
edm::Handle<HFDigiCollection> hf_digi;
fEvent.getByLabel(hfDigiCollectionTag_, hf_digi);
fEvent.getByToken(tok_hfDigiCollection_, hf_digi);
if (verbose) std::cout<<"Analysis-> total HF digis= "<<hf_digi->size()<<std::endl;

for (unsigned ihit = 0; ihit < hf_digi->size (); ++ihit) {
Expand Down
14 changes: 6 additions & 8 deletions CalibCalorimetry/HcalStandardModules/src/HFPreLightCal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

#include "CalibCalorimetry/HcalStandardModules/interface/HFPreLightCal.h"

#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"

#include "CalibFormats/HcalObjects/interface/HcalDbService.h"
#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
#include "CondFormats/HcalObjects/interface/HcalQIEShape.h"
Expand All @@ -35,9 +32,10 @@ namespace {
bool verbose = false;
}

HFPreLightCal::HFPreLightCal (const edm::ParameterSet& fConfiguration) :
hfDigiCollectionTag_(fConfiguration.getParameter<edm::InputTag>("hfDigiCollectionTag")),
hcalCalibDigiCollectionTag_(fConfiguration.getParameter<edm::InputTag>("hcalCalibDigiCollectionTag")) {
HFPreLightCal::HFPreLightCal (const edm::ParameterSet& fConfiguration) {

tok_hfDigiCollection_ = consumes<HFDigiCollection>(fConfiguration.getParameter<edm::InputTag>("hfDigiCollectionTag"));
tok_hcalCalibDigiCollection_ = consumes<HcalCalibDigiCollection>(fConfiguration.getParameter<edm::InputTag>("hcalCalibDigiCollectionTag"));

//std::string histfile = fConfiguration.getUntrackedParameter<string>("rootFile");
histfile = fConfiguration.getUntrackedParameter<string>("rootPreFile");
Expand Down Expand Up @@ -137,7 +135,7 @@ void HFPreLightCal::analyze(const edm::Event& fEvent, const edm::EventSetup& fSe

// HF PIN-diodes
edm::Handle<HcalCalibDigiCollection> calib;
fEvent.getByLabel(hcalCalibDigiCollectionTag_, calib);
fEvent.getByToken(tok_hcalCalibDigiCollection_, calib);
if (verbose) std::cout<<"Analysis-> total CAL digis= "<<calib->size()<<std::endl;
/* COMMENTED OUT by J. Mans (7-28-2008) as major changes needed with new Calib DetId
Expand Down Expand Up @@ -165,7 +163,7 @@ void HFPreLightCal::analyze(const edm::Event& fEvent, const edm::EventSetup& fSe
*/
// HF
edm::Handle<HFDigiCollection> hf_digi;
fEvent.getByLabel(hfDigiCollectionTag_, hf_digi);
fEvent.getByToken(tok_hfDigiCollection_, hf_digi);
if (verbose) std::cout<<"Analysis-> total HF digis= "<<hf_digi->size()<<std::endl;

for (unsigned ihit = 0; ihit < hf_digi->size (); ++ihit) {
Expand Down
19 changes: 10 additions & 9 deletions CalibCalorimetry/HcalStandardModules/src/HcalLedAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ namespace {

}

HcalLedAnalyzer::HcalLedAnalyzer(const edm::ParameterSet& ps) :
hbheDigiCollectionTag_(ps.getParameter<edm::InputTag>("hbheDigiCollectionTag")),
hoDigiCollectionTag_(ps.getParameter<edm::InputTag>("hoDigiCollectionTag")),
hfDigiCollectionTag_(ps.getParameter<edm::InputTag>("hfDigiCollectionTag")),
hcalCalibDigiCollectionTag_ (ps.getParameter<edm::InputTag>("hcalCalibDigiCollectionTag")) {
HcalLedAnalyzer::HcalLedAnalyzer(const edm::ParameterSet& ps) {

tok_hbheDigiCollection_ = consumes<HBHEDigiCollection>(ps.getParameter<edm::InputTag>("hbheDigiCollectionTag"));
tok_hoDigiCollection_ = consumes<HODigiCollection>(ps.getParameter<edm::InputTag>("hoDigiCollectionTag"));
tok_hfDigiCollection_ = consumes<HFDigiCollection>(ps.getParameter<edm::InputTag>("hfDigiCollectionTag"));
tok_hcalCalibDigiCollection_ = consumes<HcalCalibDigiCollection>(ps.getParameter<edm::InputTag>("hcalCalibDigiCollectionTag"));

m_ledAnal = new HcalLedAnalysis(ps);
m_ledAnal->LedSetup(ps.getUntrackedParameter<std::string>("outputFileHist", "HcalLedAnalyzer.root"));
Expand Down Expand Up @@ -89,12 +90,12 @@ void HcalLedAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& eventS
m_ievt++;

///get digis
edm::Handle<HBHEDigiCollection> hbhe; e.getByLabel(hbheDigiCollectionTag_, hbhe);
edm::Handle<HODigiCollection> ho; e.getByLabel(hoDigiCollectionTag_, ho);
edm::Handle<HFDigiCollection> hf; e.getByLabel(hfDigiCollectionTag_, hf);
edm::Handle<HBHEDigiCollection> hbhe; e.getByToken(tok_hbheDigiCollection_, hbhe);
edm::Handle<HODigiCollection> ho; e.getByToken(tok_hoDigiCollection_, ho);
edm::Handle<HFDigiCollection> hf; e.getByToken(tok_hfDigiCollection_, hf);

// get calib digis
edm::Handle<HcalCalibDigiCollection> calib; e.getByLabel(hcalCalibDigiCollectionTag_, calib);
edm::Handle<HcalCalibDigiCollection> calib; e.getByToken(tok_hcalCalibDigiCollection_, calib);

// get testbeam specific laser info from the TDC. This probably will not work
// outside of the testbeam, but it should be easy to modify the Handle/getByType
Expand Down
15 changes: 8 additions & 7 deletions CalibCalorimetry/HcalStandardModules/src/HcalPedestalAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ namespace {
}
}

HcalPedestalAnalyzer::HcalPedestalAnalyzer(const edm::ParameterSet& ps) :
hbheDigiCollectionTag_(ps.getParameter<edm::InputTag>("hbheDigiCollectionTag")),
hoDigiCollectionTag_(ps.getParameter<edm::InputTag>("hoDigiCollectionTag")),
hfDigiCollectionTag_(ps.getParameter<edm::InputTag>("hfDigiCollectionTag")) {
HcalPedestalAnalyzer::HcalPedestalAnalyzer(const edm::ParameterSet& ps) {

tok_hbheDigiCollection_ = consumes<HBHEDigiCollection>(ps.getParameter<edm::InputTag>("hbheDigiCollectionTag"));
tok_hoDigiCollection_ = consumes<HODigiCollection>(ps.getParameter<edm::InputTag>("hoDigiCollectionTag"));
tok_hfDigiCollection_ = consumes<HFDigiCollection>(ps.getParameter<edm::InputTag>("hfDigiCollectionTag"));

m_pedAnal = new HcalPedestalAnalysis(ps);
m_pedAnal->setup(ps.getUntrackedParameter<std::string>("outputFileHist", "HcalPedestalAnalyzer.root"));
Expand Down Expand Up @@ -204,9 +205,9 @@ void HcalPedestalAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& e
m_ievt++;

///get digis
edm::Handle<HBHEDigiCollection> hbhe; e.getByLabel(hbheDigiCollectionTag_, hbhe);
edm::Handle<HODigiCollection> ho; e.getByLabel(hoDigiCollectionTag_, ho);
edm::Handle<HFDigiCollection> hf; e.getByLabel(hfDigiCollectionTag_, hf);
edm::Handle<HBHEDigiCollection> hbhe; e.getByToken(tok_hbheDigiCollection_, hbhe);
edm::Handle<HODigiCollection> ho; e.getByToken(tok_hoDigiCollection_, ho);
edm::Handle<HFDigiCollection> hf; e.getByToken(tok_hfDigiCollection_, hf);

// get conditions
edm::ESHandle<HcalDbService> conditions;
Expand Down
Loading

0 comments on commit c8c0e79

Please sign in to comment.