Skip to content

Commit

Permalink
Change getByType calls to getByLabel calls in 22 places in 8 modules.…
Browse files Browse the repository at this point in the history
… In all cases add a required configurable InputTag. There are no python configuration files that reference these modules in the CMSSW release. Private configurations outside the release will fail with an exception if run without adding the InputTag parameters so any problems should be obvious.
  • Loading branch information
W.David Dagenhart committed Oct 9, 2012
1 parent 86b7932 commit 54ef9ca
Show file tree
Hide file tree
Showing 17 changed files with 149 additions and 112 deletions.
5 changes: 1 addition & 4 deletions CalibCalorimetry/HcalStandardModules/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<flags EDM_PLUGIN="1"/>
<use name="boost"/>
<use name="rootgpad"/>
<use name="CommonTools/Statistics"/>
<use name="root"/>
<use name="FWCore/Framework"/>
<use name="FWCore/Utilities"/>
<use name="FWCore/PluginManager"/>
<use name="FWCore/ParameterSet"/>
<use name="DataFormats/HcalDetId"/>
<use name="CondFormats/HcalObjects"/>
<use name="DataFormats/HcalDigi"/>
Expand Down
3 changes: 3 additions & 0 deletions CalibCalorimetry/HcalStandardModules/interface/HFLightCal.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Utilities/interface/InputTag.h"

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

edm::InputTag hfDigiCollectionTag_;
edm::InputTag hcalCalibDigiCollectionTag_;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Utilities/interface/InputTag.h"

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

edm::InputTag hfDigiCollectionTag_;
edm::InputTag hcalCalibDigiCollectionTag_;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Utilities/interface/InputTag.h"

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

edm::InputTag hfDigiCollectionTag_;
edm::InputTag hcalCalibDigiCollectionTag_;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h"
#include "CalibCalorimetry/HcalAlgos/interface/HcalLedAnalysis.h"
Expand Down Expand Up @@ -53,6 +54,11 @@ void endJob(void);
std::string m_inputPedestals_source;
std::string m_inputPedestals_tag;
int m_inputPedestals_run;

edm::InputTag hbheDigiCollectionTag_;
edm::InputTag hoDigiCollectionTag_;
edm::InputTag hfDigiCollectionTag_;
edm::InputTag hcalCalibDigiCollectionTag_;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
/*
* \file HcalPedestalAnalyzer.h
*
* $Date: 2006/03/24 01:00:15 $
* $Revision: 1.2 $
* $Date: 2009/12/17 21:09:32 $
* $Revision: 1.3 $
* \author S. Stoynev / W. Fisher
*
*/
Expand All @@ -17,6 +17,7 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h"
#include "CalibCalorimetry/HcalAlgos/interface/HcalPedestalAnalysis.h"
Expand Down Expand Up @@ -85,6 +86,10 @@ void endJob(void);
std::string m_outputPedestalWidths_dest;
std::string m_outputPedestalWidths_tag;
int m_outputPedestalWidths_run;

edm::InputTag hbheDigiCollectionTag_;
edm::InputTag hoDigiCollectionTag_;
edm::InputTag hfDigiCollectionTag_;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
Expand Down Expand Up @@ -92,6 +93,10 @@ class HcalPedestalMCWidths : public edm::EDAnalyzer
TFile *theFile;
bool firsttime;
bool histflag;

edm::InputTag hbheDigiCollectionTag_;
edm::InputTag hoDigiCollectionTag_;
edm::InputTag hfDigiCollectionTag_;
};
#endif

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
Expand Down Expand Up @@ -105,6 +106,10 @@ class HcalPedestalWidthsValidation : public edm::EDAnalyzer
HcalPedestalWidths* rawWidthsItem;
HcalPedestals* rawPedsItemfc;
HcalPedestalWidths* rawWidthsItemfc;

edm::InputTag hbheDigiCollectionTag_;
edm::InputTag hoDigiCollectionTag_;
edm::InputTag hfDigiCollectionTag_;
};
#endif

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// $Id: HcalPedestalsAnalysis.h,v 1.11 2009/11/24 15:54:38 devildog Exp $

#ifndef HcalPedestalsAnalysis_H
#define HcalPedestalsAnalysis_H

Expand All @@ -11,6 +9,7 @@
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
Expand Down Expand Up @@ -76,7 +75,6 @@ class HcalPedestalsAnalysis : public edm::EDAnalyzer
virtual ~HcalPedestalsAnalysis();
//Analysis
void analyze(const edm::Event & event, const edm::EventSetup& eventSetup);
virtual void endJob();

private:
//Container for data, 1 per channel
Expand All @@ -88,7 +86,6 @@ class HcalPedestalsAnalysis : public edm::EDAnalyzer
int runnum;
int firstTS;
int lastTS;
int ievt;
std::string ROOTfilename;
std::string pedsADCfilename;
std::string pedsfCfilename;
Expand All @@ -112,6 +109,10 @@ class HcalPedestalsAnalysis : public edm::EDAnalyzer
HcalPedestalWidths* rawWidthsItem;
HcalPedestals* rawPedsItemfc;
HcalPedestalWidths* rawWidthsItemfc;

edm::InputTag hbheDigiCollectionTag_;
edm::InputTag hoDigiCollectionTag_;
edm::InputTag hfDigiCollectionTag_;
};
#endif

9 changes: 6 additions & 3 deletions CalibCalorimetry/HcalStandardModules/src/HFLightCal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ namespace {
bool verbose = false;
}

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

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

// HF PIN-diodes
edm::Handle<HcalCalibDigiCollection> calib;
fEvent.getByType(calib);
fEvent.getByLabel(hcalCalibDigiCollectionTag_, 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 @@ -481,7 +484,7 @@ void HFLightCal::analyze(const edm::Event& fEvent, const edm::EventSetup& fSetup

// HF
edm::Handle<HFDigiCollection> hf_digi;
fEvent.getByType(hf_digi);
fEvent.getByLabel(hfDigiCollectionTag_, 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
9 changes: 6 additions & 3 deletions CalibCalorimetry/HcalStandardModules/src/HFLightCalRand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ namespace {
bool verbose = false;
}

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

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

// HF PIN-diodes
edm::Handle<HcalCalibDigiCollection> calib;
fEvent.getByType(calib);
fEvent.getByLabel(hcalCalibDigiCollectionTag_, 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 @@ -442,7 +445,7 @@ void HFLightCalRand::analyze(const edm::Event& fEvent, const edm::EventSetup& fS
*/
// HF
edm::Handle<HFDigiCollection> hf_digi;
fEvent.getByType(hf_digi);
fEvent.getByLabel(hfDigiCollectionTag_, 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
9 changes: 6 additions & 3 deletions CalibCalorimetry/HcalStandardModules/src/HFPreLightCal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ namespace {
bool verbose = false;
}

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

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

// HF PIN-diodes
edm::Handle<HcalCalibDigiCollection> calib;
fEvent.getByType(calib);
fEvent.getByLabel(hcalCalibDigiCollectionTag_, 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 @@ -162,7 +165,7 @@ void HFPreLightCal::analyze(const edm::Event& fEvent, const edm::EventSetup& fSe
*/
// HF
edm::Handle<HFDigiCollection> hf_digi;
fEvent.getByType(hf_digi);
fEvent.getByLabel(hfDigiCollectionTag_, 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
15 changes: 10 additions & 5 deletions CalibCalorimetry/HcalStandardModules/src/HcalLedAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ namespace {

}

HcalLedAnalyzer::HcalLedAnalyzer(const edm::ParameterSet& ps){
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")) {

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

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

// get calib digis
edm::Handle<HcalCalibDigiCollection> calib; e.getByType(calib);
edm::Handle<HcalCalibDigiCollection> calib; e.getByLabel(hcalCalibDigiCollectionTag_, 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: 9 additions & 6 deletions CalibCalorimetry/HcalStandardModules/src/HcalPedestalAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
/*
* \file HcalPedestalAnalyzer.cc
*
* $Date: 2009/12/17 21:09:32 $
* $Revision: 1.13 $
* $Date: 2010/02/25 00:28:13 $
* $Revision: 1.14 $
* \author S Stoynev / W Fisher
*
*/
Expand Down Expand Up @@ -102,7 +102,10 @@ namespace {
}
}

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

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

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

// get conditions
edm::ESHandle<HcalDbService> conditions;
Expand Down
13 changes: 8 additions & 5 deletions CalibCalorimetry/HcalStandardModules/src/HcalPedestalMCWidths.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
#include <memory>
#include "CalibCalorimetry/HcalStandardModules/interface/HcalPedestalMCWidths.h"

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

firsttime = true;
histflag = ps.getUntrackedParameter<bool>("saveHists",true);
}
Expand Down Expand Up @@ -102,9 +105,9 @@ HcalPedestalMCWidths::analyze(const edm::Event& e, const edm::EventSetup& iSetup
using namespace edm;
using namespace std;

edm::Handle<HBHEDigiCollection> hbhe; e.getByType(hbhe);
edm::Handle<HODigiCollection> ho; e.getByType(ho);
edm::Handle<HFDigiCollection> hf; e.getByType(hf);
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::ESHandle<HcalDbService> conditions;
iSetup.get<HcalDbRecord>().get(conditions);

Expand Down
Loading

0 comments on commit 54ef9ca

Please sign in to comment.