CMS 3D CMS Logo

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

#include <HcalPedestalAnalyzer.h>

Inheritance diagram for HcalPedestalAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 HcalPedestalAnalyzer (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~HcalPedestalAnalyzer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob ()
 
void endJob (void)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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)
 

Private Attributes

edm::InputTag hbheDigiCollectionTag_
 
edm::InputTag hfDigiCollectionTag_
 
edm::InputTag hoDigiCollectionTag_
 
int m_endSample
 
int m_ievt
 
int m_inputPedestals_run
 
std::string m_inputPedestals_source
 
std::string m_inputPedestals_tag
 
int m_inputPedestalWidths_run
 
std::string m_inputPedestalWidths_source
 
std::string m_inputPedestalWidths_tag
 
std::string m_outputPedestals_dest
 
int m_outputPedestals_run
 
std::string m_outputPedestals_tag
 
std::string m_outputPedestalWidths_dest
 
int m_outputPedestalWidths_run
 
std::string m_outputPedestalWidths_tag
 
HcalPedestalAnalysism_pedAnal
 
int m_startSample
 
const HcalTopologym_topo
 
int ped_sample
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 42 of file HcalPedestalAnalyzer.h.

Constructor & Destructor Documentation

HcalPedestalAnalyzer::HcalPedestalAnalyzer ( const edm::ParameterSet ps)

Constructor.

Definition at line 112 of file HcalPedestalAnalyzer.cc.

References edm::ParameterSet::getUntrackedParameter(), m_endSample, m_inputPedestals_run, m_inputPedestals_source, m_inputPedestals_tag, m_inputPedestalWidths_run, m_inputPedestalWidths_source, m_inputPedestalWidths_tag, m_outputPedestals_dest, m_outputPedestals_run, m_outputPedestals_tag, m_outputPedestalWidths_dest, m_outputPedestalWidths_run, m_outputPedestalWidths_tag, m_pedAnal, m_startSample, HcalPedestalAnalysis::setup(), and AlCaHLTBitMon_QueryRunRegistry::string.

112  :
113  hbheDigiCollectionTag_(ps.getParameter<edm::InputTag>("hbheDigiCollectionTag")),
114  hoDigiCollectionTag_(ps.getParameter<edm::InputTag>("hoDigiCollectionTag")),
115  hfDigiCollectionTag_(ps.getParameter<edm::InputTag>("hfDigiCollectionTag")) {
116 
118  m_pedAnal->setup(ps.getUntrackedParameter<std::string>("outputFileHist", "HcalPedestalAnalyzer.root"));
119 
120  m_startSample = ps.getUntrackedParameter<int>("firstSample", 0);
121  m_endSample = ps.getUntrackedParameter<int>("lastSample", 19);
122  m_inputPedestals_source = ps.getUntrackedParameter<std::string>("inputPedestalsSource", "");
123  m_inputPedestals_tag = ps.getUntrackedParameter<std::string>("inputPedestalsTag", "");
124  m_inputPedestals_run = ps.getUntrackedParameter<int>("inputPedestalsRun", 1);
125  m_inputPedestalWidths_source = ps.getUntrackedParameter<std::string>("inputPedestalWidthsSource", "");
126  m_inputPedestalWidths_tag = ps.getUntrackedParameter<std::string>("inputPedestalWidthsTag", "");
127  m_inputPedestalWidths_run = ps.getUntrackedParameter<int>("inputPedestalWidthsRun", 1);
128  m_outputPedestals_dest = ps.getUntrackedParameter<std::string>("outputPedestalsDest", "");
129  m_outputPedestals_tag = ps.getUntrackedParameter<std::string>("outputPedestalsTag", "");
130  m_outputPedestals_run = ps.getUntrackedParameter<int>("outputPedestalsRun", 99999);
131  m_outputPedestalWidths_dest = ps.getUntrackedParameter<std::string>("outputPedestalWidthsDest", "");
132  m_outputPedestalWidths_tag = ps.getUntrackedParameter<std::string>("outputPedestalWidthsTag", "");
133  m_outputPedestalWidths_run = ps.getUntrackedParameter<int>("outputPedestalWidthsRun", 99999);
134 
135  // CORAL required variables to be set, even if not needed
136  const char* foo1 = "CORAL_AUTH_USER=blaaah";
137  const char* foo2 = "CORAL_AUTH_PASSWORD=blaaah";
138  if (!::getenv("CORAL_AUTH_USER")) ::putenv(const_cast<char*>(foo1));
139  if (!::getenv("CORAL_AUTH_PASSWORD")) ::putenv(const_cast<char*>(foo2));
140 }
T getParameter(std::string const &) const
std::string m_outputPedestalWidths_tag
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag hbheDigiCollectionTag_
edm::InputTag hfDigiCollectionTag_
edm::InputTag hoDigiCollectionTag_
std::string m_outputPedestalWidths_dest
void setup(const std::string &m_outputFileROOT)
std::string m_inputPedestalWidths_source
std::string m_outputPedestals_dest
std::string m_inputPedestalWidths_tag
std::string m_inputPedestals_source
HcalPedestalAnalysis * m_pedAnal
HcalPedestalAnalyzer::~HcalPedestalAnalyzer ( )

Destructor.

Definition at line 142 of file HcalPedestalAnalyzer.cc.

142  {
143 // delete m_pedAnal;
144 }

Member Function Documentation

void HcalPedestalAnalyzer::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

get digis

Implements edm::EDAnalyzer.

Definition at line 204 of file HcalPedestalAnalyzer.cc.

References gather_cfg::cout, edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), edm::Event::getByLabel(), hbheDigiCollectionTag_, hfDigiCollectionTag_, hoDigiCollectionTag_, m_ievt, m_pedAnal, m_topo, HcalPedestalAnalysis::processEvent(), and record.

204  {
205 
206  m_ievt++;
207 
212 
213  // get conditions
214  edm::ESHandle<HcalDbService> conditions;
215  eventSetup.get<HcalDbRecord>().get(conditions);
216 
217  if (m_topo==0) {
218  const IdealGeometryRecord& record = eventSetup.get<IdealGeometryRecord>();
220  record.get (topology);
221  m_topo=new HcalTopology(*topology);
222  }
223 
224 
225  m_pedAnal->processEvent(*hbhe, *ho, *hf, *conditions);
226 
227  if(m_ievt%1000 == 0)
228  std::cout << "HcalPedestalAnalyzer: analyzed " << m_ievt << " events" << std::endl;
229 
230  return;
231 }
edm::InputTag hbheDigiCollectionTag_
JetCorrectorParameters::Record record
Definition: classes.h:13
edm::InputTag hfDigiCollectionTag_
void processEvent(const HBHEDigiCollection &hbhe, const HODigiCollection &ho, const HFDigiCollection &hf, const HcalDbService &cond)
const HcalTopology * m_topo
edm::InputTag hoDigiCollectionTag_
void get(HolderT &iHolder) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
tuple cout
Definition: gather_cfg.py:121
HcalPedestalAnalysis * m_pedAnal
void HcalPedestalAnalyzer::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 146 of file HcalPedestalAnalyzer.cc.

References m_ievt, and ped_sample.

146  {
147  m_ievt = 0;
148  ped_sample = 1;
149 }
void HcalPedestalAnalyzer::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 151 of file HcalPedestalAnalyzer.cc.

References dtNoiseDBValidation_cfg::cerr, HcalPedestalAnalysis::done(), getObject(), m_inputPedestals_run, m_inputPedestals_source, m_inputPedestals_tag, m_inputPedestalWidths_run, m_inputPedestalWidths_source, m_inputPedestalWidths_tag, m_outputPedestals_dest, m_outputPedestals_run, m_outputPedestals_tag, m_outputPedestalWidths_dest, m_outputPedestalWidths_run, m_outputPedestalWidths_tag, m_pedAnal, m_topo, and xmlFile().

151  {
152  // get input objects
153  HcalPedestals* inputPeds = 0;
154  if (!m_inputPedestals_source.empty ()) {
155  inputPeds = new HcalPedestals (m_topo);
157  std::cerr << "HcalPedestalAnalyzer-> Failed to get input Pedestals" << std::endl;
158  }
159  }
160  HcalPedestalWidths* inputPedWids = 0;
161  if (!m_inputPedestalWidths_source.empty ()) {
162  inputPedWids = new HcalPedestalWidths (m_topo);
164  std::cerr << "HcalPedestalAnalyzer-> Failed to get input PedestalWidths" << std::endl;
165  }
166  }
167 
168  // make output objects
169  HcalPedestals* outputPeds = (m_outputPedestals_dest.empty () && !xmlFile (m_outputPedestals_dest)) ? 0 : new HcalPedestals (m_topo);
171 
172  // run algorithm
173  int Flag=m_pedAnal->done(inputPeds, inputPedWids, outputPeds, outputPedWids);
174 
175  delete inputPeds;
176  delete inputPedWids;
177 
178 
179  // store new objects
180  // Flag=-2 indicates there were less than 100 events and output is meaningless
181  if (Flag>-2) {
182  if (xmlFile (m_outputPedestals_dest)) { // output pedestals and widths together
183  if (!dumpXmlPedestals (*outputPeds, *outputPedWids, m_outputPedestals_dest, m_outputPedestals_tag, m_outputPedestals_run)) {
184  std::cerr << "HcalPedestalAnalyzer-> Failed to put output Pedestals & Widths" << std::endl;
185  }
186  }
187  else {
188  if (outputPeds) {
189  if (!putObject (&outputPeds, m_outputPedestals_dest, m_outputPedestals_tag, m_outputPedestals_run)) {
190  std::cerr << "HcalPedestalAnalyzer-> Failed to put output Pedestals" << std::endl;
191  }
192  }
193  if (outputPedWids) {
195  std::cerr << "HcalPedestalAnalyzer-> Failed to put output PedestalWidths" << std::endl;
196  }
197  }
198  }
199  }
200  delete outputPeds;
201  delete outputPedWids;
202 }
std::string m_outputPedestalWidths_tag
TObject * getObject(TDirectory *fDir, const std::vector< std::string > &fObjectName)
Definition: compareHists.cc:44
const HcalTopology * m_topo
std::string m_outputPedestalWidths_dest
int done(const HcalPedestals *fInputPedestals, const HcalPedestalWidths *fInputWidths, HcalPedestals *fOutputPedestals, HcalPedestalWidths *fOutputWidths)
std::string m_inputPedestalWidths_source
std::string m_outputPedestals_dest
std::string m_inputPedestalWidths_tag
bool xmlFile(const std::string fParam)
std::string m_inputPedestals_source
HcalPedestalAnalysis * m_pedAnal

Member Data Documentation

edm::InputTag HcalPedestalAnalyzer::hbheDigiCollectionTag_
private

Definition at line 92 of file HcalPedestalAnalyzer.h.

Referenced by analyze().

edm::InputTag HcalPedestalAnalyzer::hfDigiCollectionTag_
private

Definition at line 94 of file HcalPedestalAnalyzer.h.

Referenced by analyze().

edm::InputTag HcalPedestalAnalyzer::hoDigiCollectionTag_
private

Definition at line 93 of file HcalPedestalAnalyzer.h.

Referenced by analyze().

int HcalPedestalAnalyzer::m_endSample
private

Definition at line 77 of file HcalPedestalAnalyzer.h.

Referenced by HcalPedestalAnalyzer().

int HcalPedestalAnalyzer::m_ievt
private

Definition at line 67 of file HcalPedestalAnalyzer.h.

Referenced by analyze(), and beginJob().

int HcalPedestalAnalyzer::m_inputPedestals_run
private

Definition at line 81 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_inputPedestals_source
private

Definition at line 79 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_inputPedestals_tag
private

Definition at line 80 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

int HcalPedestalAnalyzer::m_inputPedestalWidths_run
private

Definition at line 84 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_inputPedestalWidths_source
private

Definition at line 82 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_inputPedestalWidths_tag
private

Definition at line 83 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_outputPedestals_dest
private

Definition at line 85 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

int HcalPedestalAnalyzer::m_outputPedestals_run
private

Definition at line 87 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_outputPedestals_tag
private

Definition at line 86 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_outputPedestalWidths_dest
private

Definition at line 88 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

int HcalPedestalAnalyzer::m_outputPedestalWidths_run
private

Definition at line 90 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_outputPedestalWidths_tag
private

Definition at line 89 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

HcalPedestalAnalysis* HcalPedestalAnalyzer::m_pedAnal
private

Definition at line 72 of file HcalPedestalAnalyzer.h.

Referenced by analyze(), endJob(), and HcalPedestalAnalyzer().

int HcalPedestalAnalyzer::m_startSample
private

Definition at line 76 of file HcalPedestalAnalyzer.h.

Referenced by HcalPedestalAnalyzer().

const HcalTopology* HcalPedestalAnalyzer::m_topo
private

Definition at line 74 of file HcalPedestalAnalyzer.h.

Referenced by analyze(), and endJob().

int HcalPedestalAnalyzer::ped_sample
private

Definition at line 68 of file HcalPedestalAnalyzer.h.

Referenced by beginJob().