CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalNoiseRates Class Reference

#include <HcalNoiseRates.h>

Inheritance diagram for HcalNoiseRates:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 HcalNoiseRates (const edm::ParameterSet &)
 
 ~HcalNoiseRates ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 

Private Attributes

DQMStoredbe_
 
MonitorElementhLumiBlockCount_
 
MonitorElementhRBXEnergy_
 
MonitorElementhRBXEnergyType1_
 
MonitorElementhRBXEnergyType2_
 
MonitorElementhRBXEnergyType3_
 
MonitorElementhRBXNHits_
 
std::map< int, int > lumiCountMap_
 
double minHitEnergy_
 
double minRBXEnergy_
 
std::string outputFile_
 
edm::InputTag rbxCollName_
 
edm::EDGetTokenT
< reco::HcalNoiseRBXCollection
tok_rbx_
 
bool useAllHistos_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 40 of file HcalNoiseRates.h.

Constructor & Destructor Documentation

HcalNoiseRates::HcalNoiseRates ( const edm::ParameterSet iConfig)
explicit

Definition at line 17 of file HcalNoiseRates.cc.

References dbe_, edm::ParameterSet::getUntrackedParameter(), timingPdfMaker::histo, hLumiBlockCount_, hRBXEnergy_, hRBXEnergyType1_, hRBXEnergyType2_, hRBXEnergyType3_, hRBXNHits_, minHitEnergy_, minRBXEnergy_, cppFunctionSkipper::operator, outputFile_, rbxCollName_, AlCaHLTBitMon_QueryRunRegistry::string, tok_rbx_, and useAllHistos_.

18 {
19 
20  // DQM ROOT output
21  outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile","myfile.root");
22 
23  dbe_ = 0;
24  // get hold of back-end interface
25  dbe_ = edm::Service<DQMStore>().operator->();
26 
27  Char_t histo[100];
28 
29  if ( dbe_ ) {
30  dbe_->setCurrentFolder("HcalNoiseRatesD/HcalNoiseRatesTask");
31  }
32 
33  // set parameters
34  rbxCollName_ = iConfig.getUntrackedParameter<edm::InputTag>("rbxCollName");
35  tok_rbx_ = consumes<reco::HcalNoiseRBXCollection>(rbxCollName_);
36  minRBXEnergy_ = iConfig.getUntrackedParameter<double>("minRBXEnergy");
37  minHitEnergy_ = iConfig.getUntrackedParameter<double>("minHitEnergy");
38 
39  useAllHistos_ = iConfig.getUntrackedParameter<bool>("useAllHistos", false);
40 
41  // book histograms
42 
43  //Lumi block is not drawn; the rest are
44  if (useAllHistos_){
45  sprintf (histo, "hLumiBlockCount" );
46  hLumiBlockCount_ = dbe_->book1D(histo, histo, 1, -0.5, 0.5);
47  }
48 
49  sprintf (histo, "hRBXEnergy" );
50  hRBXEnergy_ = dbe_->book1D(histo, histo, 300, 0, 3000);
51 
52  sprintf (histo, "hRBXEnergyType1" );
53  hRBXEnergyType1_ = dbe_->book1D(histo, histo, 300, 0, 3000);
54 
55  sprintf (histo, "hRBXEnergyType2" );
56  hRBXEnergyType2_ = dbe_->book1D(histo, histo, 300, 0, 3000);
57 
58  sprintf (histo, "hRBXEnergyType3" );
59  hRBXEnergyType3_ = dbe_->book1D(histo, histo, 300, 0, 3000);
60 
61  sprintf (histo, "hRBXNHits" );
62  hRBXNHits_ = dbe_->book1D(histo, histo, 73,-0.5,72.5);
63 
64 }
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag rbxCollName_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
MonitorElement * hRBXEnergyType1_
MonitorElement * hRBXEnergy_
MonitorElement * hRBXEnergyType2_
edm::EDGetTokenT< reco::HcalNoiseRBXCollection > tok_rbx_
std::string outputFile_
MonitorElement * hRBXEnergyType3_
double minHitEnergy_
DQMStore * dbe_
MonitorElement * hLumiBlockCount_
double minRBXEnergy_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
MonitorElement * hRBXNHits_
HcalNoiseRates::~HcalNoiseRates ( )

Definition at line 67 of file HcalNoiseRates.cc.

68 {
69 }

Member Function Documentation

void HcalNoiseRates::analyze ( const edm::Event iEvent,
const edm::EventSetup evSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 78 of file HcalNoiseRates.cc.

References relval_parameters_module::energy, edm::hlt::Exception, MonitorElement::Fill(), edm::Event::getByToken(), patZpeak::handle, hRBXEnergy_, hRBXEnergyType1_, hRBXEnergyType2_, hRBXEnergyType3_, hRBXNHits_, edm::HandleBase::isValid(), lumiCountMap_, edm::EventBase::luminosityBlock(), minHitEnergy_, minRBXEnergy_, reco::HcalNoiseRBX::numRecHits(), edm::errors::ProductNotFound, rbxCollName_, reco::HcalNoiseRBX::recHitEnergy(), and tok_rbx_.

79 {
80 
81  // get the lumi section
82  int lumiSection = iEvent.luminosityBlock();
83  lumiCountMap_[lumiSection]++;
84 
85  // get the RBX Noise collection
87  iEvent.getByToken(tok_rbx_,handle);
88  if(!handle.isValid()) {
90  << " could not find HcalNoiseRBXCollection named " << rbxCollName_ << ".\n";
91  return;
92  }
93 
94  // loop over the RBXs and fill the histograms
95  for(reco::HcalNoiseRBXCollection::const_iterator it=handle->begin(); it!=handle->end(); ++it) {
96  const reco::HcalNoiseRBX &rbx=(*it);
97 
98  double energy = rbx.recHitEnergy(minHitEnergy_);
99 
100  int nhits = rbx.numRecHits(minHitEnergy_);
101 
102  if(energy < minRBXEnergy_) continue;
103 
104  hRBXEnergy_->Fill(energy);
105 
106  if (nhits <= 9) hRBXEnergyType1_->Fill(energy);
107  else if (nhits <= 18) hRBXEnergyType2_->Fill(energy);
108  else hRBXEnergyType3_->Fill(energy);
109 
110  hRBXNHits_->Fill(nhits);
111 
112  } // done looping over RBXs
113 
114 }
edm::InputTag rbxCollName_
MonitorElement * hRBXEnergyType1_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
int numRecHits(double threshold=1.5) const
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
MonitorElement * hRBXEnergy_
MonitorElement * hRBXEnergyType2_
void Fill(long long x)
double recHitEnergy(double theshold=1.5) const
Definition: HcalNoiseRBX.cc:99
tuple handle
Definition: patZpeak.py:22
bool isValid() const
Definition: HandleBase.h:76
edm::EDGetTokenT< reco::HcalNoiseRBXCollection > tok_rbx_
MonitorElement * hRBXEnergyType3_
double minHitEnergy_
std::map< int, int > lumiCountMap_
double minRBXEnergy_
MonitorElement * hRBXNHits_
void HcalNoiseRates::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 119 of file HcalNoiseRates.cc.

119 {}
void HcalNoiseRates::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 123 of file HcalNoiseRates.cc.

References dbe_, MonitorElement::Fill(), hLumiBlockCount_, lumiCountMap_, outputFile_, DQMStore::save(), and useAllHistos_.

123  {
124 
125  if (useAllHistos_) hLumiBlockCount_->Fill(0.0, lumiCountMap_.size());
126 
127  if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
128 
129 }
void Fill(long long x)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296
std::string outputFile_
DQMStore * dbe_
MonitorElement * hLumiBlockCount_
std::map< int, int > lumiCountMap_

Member Data Documentation

DQMStore* HcalNoiseRates::dbe_
private

Definition at line 51 of file HcalNoiseRates.h.

Referenced by endJob(), and HcalNoiseRates().

MonitorElement* HcalNoiseRates::hLumiBlockCount_
private

Definition at line 61 of file HcalNoiseRates.h.

Referenced by endJob(), and HcalNoiseRates().

MonitorElement* HcalNoiseRates::hRBXEnergy_
private

Definition at line 62 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

MonitorElement* HcalNoiseRates::hRBXEnergyType1_
private

Definition at line 63 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

MonitorElement* HcalNoiseRates::hRBXEnergyType2_
private

Definition at line 64 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

MonitorElement* HcalNoiseRates::hRBXEnergyType3_
private

Definition at line 65 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

MonitorElement* HcalNoiseRates::hRBXNHits_
private

Definition at line 66 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

std::map<int, int> HcalNoiseRates::lumiCountMap_
private

Definition at line 69 of file HcalNoiseRates.h.

Referenced by analyze(), and endJob().

double HcalNoiseRates::minHitEnergy_
private

Definition at line 58 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

double HcalNoiseRates::minRBXEnergy_
private

Definition at line 57 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

std::string HcalNoiseRates::outputFile_
private

Definition at line 52 of file HcalNoiseRates.h.

Referenced by endJob(), and HcalNoiseRates().

edm::InputTag HcalNoiseRates::rbxCollName_
private

Definition at line 55 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

edm::EDGetTokenT<reco::HcalNoiseRBXCollection> HcalNoiseRates::tok_rbx_
private

Definition at line 56 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

bool HcalNoiseRates::useAllHistos_
private

Definition at line 59 of file HcalNoiseRates.h.

Referenced by endJob(), and HcalNoiseRates().