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
NoiseRates Class Reference

#include <NoiseRates.h>

Inheritance diagram for NoiseRates:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 NoiseRates (const edm::ParameterSet &)
 
 ~NoiseRates ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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 NoiseRates.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file NoiseRates.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("NoiseRatesV/NoiseRatesTask");
31  }
32 
33  // set parameters
34  rbxCollName_ = iConfig.getUntrackedParameter<edm::InputTag>("rbxCollName");
35  minRBXEnergy_ = iConfig.getUntrackedParameter<double>("minRBXEnergy");
36  minHitEnergy_ = iConfig.getUntrackedParameter<double>("minHitEnergy");
37 
38  tok_rbx_ = consumes<reco::HcalNoiseRBXCollection>(rbxCollName_);
39 
40  useAllHistos_ = iConfig.getUntrackedParameter<bool>("useAllHistos", false);
41 
42  // book histograms
43 
44  //Lumi block is not drawn; the rest are
45  if (useAllHistos_){
46  sprintf (histo, "hLumiBlockCount" );
47  hLumiBlockCount_ = dbe_->book1D(histo, histo, 1, -0.5, 0.5);
48  }
49 
50  sprintf (histo, "hRBXEnergy" );
51  hRBXEnergy_ = dbe_->book1D(histo, histo, 300, 0, 3000);
52 
53  sprintf (histo, "hRBXEnergyType1" );
54  hRBXEnergyType1_ = dbe_->book1D(histo, histo, 300, 0, 3000);
55 
56  sprintf (histo, "hRBXEnergyType2" );
57  hRBXEnergyType2_ = dbe_->book1D(histo, histo, 300, 0, 3000);
58 
59  sprintf (histo, "hRBXEnergyType3" );
60  hRBXEnergyType3_ = dbe_->book1D(histo, histo, 300, 0, 3000);
61 
62  sprintf (histo, "hRBXNHits" );
63  hRBXNHits_ = dbe_->book1D(histo, histo, 73,-0.5,72.5);
64 
65 }
MonitorElement * hRBXEnergy_
Definition: NoiseRates.h:62
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
std::string outputFile_
Definition: NoiseRates.h:52
bool useAllHistos_
Definition: NoiseRates.h:59
MonitorElement * hRBXEnergyType3_
Definition: NoiseRates.h:65
MonitorElement * hLumiBlockCount_
Definition: NoiseRates.h:61
MonitorElement * hRBXNHits_
Definition: NoiseRates.h:66
double minRBXEnergy_
Definition: NoiseRates.h:57
MonitorElement * hRBXEnergyType2_
Definition: NoiseRates.h:64
edm::InputTag rbxCollName_
Definition: NoiseRates.h:55
MonitorElement * hRBXEnergyType1_
Definition: NoiseRates.h:63
double minHitEnergy_
Definition: NoiseRates.h:58
DQMStore * dbe_
Definition: NoiseRates.h:51
edm::EDGetTokenT< reco::HcalNoiseRBXCollection > tok_rbx_
Definition: NoiseRates.h:56
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
NoiseRates::~NoiseRates ( )

Definition at line 68 of file NoiseRates.cc.

69 {
70 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 79 of file NoiseRates.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_.

80 {
81 
82  // get the lumi section
83  int lumiSection = iEvent.luminosityBlock();
84  lumiCountMap_[lumiSection]++;
85 
86  // get the RBX Noise collection
88  iEvent.getByToken(tok_rbx_,handle);
89  if(!handle.isValid()) {
91  << " could not find HcalNoiseRBXCollection named " << rbxCollName_ << ".\n";
92  return;
93  }
94 
95  // loop over the RBXs and fill the histograms
96  for(reco::HcalNoiseRBXCollection::const_iterator it=handle->begin(); it!=handle->end(); ++it) {
97  const reco::HcalNoiseRBX &rbx=(*it);
98 
99  double energy = rbx.recHitEnergy(minHitEnergy_);
100 
101  int nhits = rbx.numRecHits(minHitEnergy_);
102 
103  if(energy < minRBXEnergy_) continue;
104 
105  hRBXEnergy_->Fill(energy);
106 
107  if (nhits <= 9) hRBXEnergyType1_->Fill(energy);
108  else if (nhits <= 18) hRBXEnergyType2_->Fill(energy);
109  else hRBXEnergyType3_->Fill(energy);
110 
111  hRBXNHits_->Fill(nhits);
112 
113  } // done looping over RBXs
114 
115 }
MonitorElement * hRBXEnergy_
Definition: NoiseRates.h:62
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 * hRBXEnergyType3_
Definition: NoiseRates.h:65
MonitorElement * hRBXNHits_
Definition: NoiseRates.h:66
std::map< int, int > lumiCountMap_
Definition: NoiseRates.h:69
void Fill(long long x)
double minRBXEnergy_
Definition: NoiseRates.h:57
double recHitEnergy(double theshold=1.5) const
Definition: HcalNoiseRBX.cc:99
tuple handle
Definition: patZpeak.py:22
MonitorElement * hRBXEnergyType2_
Definition: NoiseRates.h:64
bool isValid() const
Definition: HandleBase.h:76
edm::InputTag rbxCollName_
Definition: NoiseRates.h:55
MonitorElement * hRBXEnergyType1_
Definition: NoiseRates.h:63
double minHitEnergy_
Definition: NoiseRates.h:58
edm::EDGetTokenT< reco::HcalNoiseRBXCollection > tok_rbx_
Definition: NoiseRates.h:56
void NoiseRates::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 120 of file NoiseRates.cc.

120 {}
void NoiseRates::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 124 of file NoiseRates.cc.

124  {
125 /*
126  if (useAllHistos_) hLumiBlockCount_->Fill(0.0, lumiCountMap_.size());
127 
128  if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
129 */
130 }

Member Data Documentation

DQMStore* NoiseRates::dbe_
private

Definition at line 51 of file NoiseRates.h.

Referenced by NoiseRates().

MonitorElement* NoiseRates::hLumiBlockCount_
private

Definition at line 61 of file NoiseRates.h.

Referenced by NoiseRates().

MonitorElement* NoiseRates::hRBXEnergy_
private

Definition at line 62 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

MonitorElement* NoiseRates::hRBXEnergyType1_
private

Definition at line 63 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

MonitorElement* NoiseRates::hRBXEnergyType2_
private

Definition at line 64 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

MonitorElement* NoiseRates::hRBXEnergyType3_
private

Definition at line 65 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

MonitorElement* NoiseRates::hRBXNHits_
private

Definition at line 66 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

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

Definition at line 69 of file NoiseRates.h.

Referenced by analyze().

double NoiseRates::minHitEnergy_
private

Definition at line 58 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

double NoiseRates::minRBXEnergy_
private

Definition at line 57 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

std::string NoiseRates::outputFile_
private

Definition at line 52 of file NoiseRates.h.

Referenced by NoiseRates().

edm::InputTag NoiseRates::rbxCollName_
private

Definition at line 55 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

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

Definition at line 56 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

bool NoiseRates::useAllHistos_
private

Definition at line 59 of file NoiseRates.h.

Referenced by NoiseRates().