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

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 ()
 

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
CurrentProcessingContext const * currentContext () const
 

Private Attributes

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
 
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)
 

Detailed Description

Definition at line 41 of file HcalPedestalAnalyzer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 105 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, and HcalPedestalAnalysis::setup().

105  {
106 
108  m_pedAnal->setup(ps.getUntrackedParameter<std::string>("outputFileHist", "HcalPedestalAnalyzer.root"));
109 
110  m_startSample = ps.getUntrackedParameter<int>("firstSample", 0);
111  m_endSample = ps.getUntrackedParameter<int>("lastSample", 19);
112  m_inputPedestals_source = ps.getUntrackedParameter<std::string>("inputPedestalsSource", "");
113  m_inputPedestals_tag = ps.getUntrackedParameter<std::string>("inputPedestalsTag", "");
114  m_inputPedestals_run = ps.getUntrackedParameter<int>("inputPedestalsRun", 1);
115  m_inputPedestalWidths_source = ps.getUntrackedParameter<std::string>("inputPedestalWidthsSource", "");
116  m_inputPedestalWidths_tag = ps.getUntrackedParameter<std::string>("inputPedestalWidthsTag", "");
117  m_inputPedestalWidths_run = ps.getUntrackedParameter<int>("inputPedestalWidthsRun", 1);
118  m_outputPedestals_dest = ps.getUntrackedParameter<std::string>("outputPedestalsDest", "");
119  m_outputPedestals_tag = ps.getUntrackedParameter<std::string>("outputPedestalsTag", "");
120  m_outputPedestals_run = ps.getUntrackedParameter<int>("outputPedestalsRun", 99999);
121  m_outputPedestalWidths_dest = ps.getUntrackedParameter<std::string>("outputPedestalWidthsDest", "");
122  m_outputPedestalWidths_tag = ps.getUntrackedParameter<std::string>("outputPedestalWidthsTag", "");
123  m_outputPedestalWidths_run = ps.getUntrackedParameter<int>("outputPedestalWidthsRun", 99999);
124 
125  // CORAL required variables to be set, even if not needed
126  const char* foo1 = "CORAL_AUTH_USER=blaaah";
127  const char* foo2 = "CORAL_AUTH_PASSWORD=blaaah";
128  if (!::getenv("CORAL_AUTH_USER")) ::putenv(const_cast<char*>(foo1));
129  if (!::getenv("CORAL_AUTH_PASSWORD")) ::putenv(const_cast<char*>(foo2));
130 }
std::string m_outputPedestalWidths_tag
T getUntrackedParameter(std::string const &, T const &) const
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 132 of file HcalPedestalAnalyzer.cc.

132  {
133 // delete m_pedAnal;
134 }

Member Function Documentation

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

Analyze.

get digis

Implements edm::EDAnalyzer.

Definition at line 194 of file HcalPedestalAnalyzer.cc.

References gather_cfg::cout, edm::EventSetup::get(), edm::Event::getByType(), m_ievt, m_pedAnal, and HcalPedestalAnalysis::processEvent().

194  {
195 
196  m_ievt++;
197 
202 
203  // get conditions
204  edm::ESHandle<HcalDbService> conditions;
205  eventSetup.get<HcalDbRecord>().get(conditions);
206 
207  m_pedAnal->processEvent(*hbhe, *ho, *hf, *conditions);
208 
209  if(m_ievt%1000 == 0)
210  std::cout << "HcalPedestalAnalyzer: analyzed " << m_ievt << " events" << std::endl;
211 
212  return;
213 }
bool getByType(Handle< PROD > &result) const
Definition: Event.h:397
void processEvent(const HBHEDigiCollection &hbhe, const HODigiCollection &ho, const HFDigiCollection &hf, const HcalDbService &cond)
tuple cout
Definition: gather_cfg.py:41
HcalPedestalAnalysis * m_pedAnal
void HcalPedestalAnalyzer::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 136 of file HcalPedestalAnalyzer.cc.

References m_ievt, and ped_sample.

136  {
137  m_ievt = 0;
138  ped_sample = 1;
139 }
void HcalPedestalAnalyzer::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 141 of file HcalPedestalAnalyzer.cc.

References benchmark_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, and xmlFile().

141  {
142  // get input objects
143  HcalPedestals* inputPeds = 0;
144  if (!m_inputPedestals_source.empty ()) {
145  inputPeds = new HcalPedestals ();
147  std::cerr << "HcalPedestalAnalyzer-> Failed to get input Pedestals" << std::endl;
148  }
149  }
150  HcalPedestalWidths* inputPedWids = 0;
151  if (!m_inputPedestalWidths_source.empty ()) {
152  inputPedWids = new HcalPedestalWidths ();
154  std::cerr << "HcalPedestalAnalyzer-> Failed to get input PedestalWidths" << std::endl;
155  }
156  }
157 
158  // make output objects
159  HcalPedestals* outputPeds = (m_outputPedestals_dest.empty () && !xmlFile (m_outputPedestals_dest)) ? 0 : new HcalPedestals ();
161 
162  // run algorithm
163  int Flag=m_pedAnal->done(inputPeds, inputPedWids, outputPeds, outputPedWids);
164 
165  delete inputPeds;
166  delete inputPedWids;
167 
168 
169  // store new objects
170  // Flag=-2 indicates there were less than 100 events and output is meaningless
171  if (Flag>-2) {
172  if (xmlFile (m_outputPedestals_dest)) { // output pedestals and widths together
173  if (!dumpXmlPedestals (*outputPeds, *outputPedWids, m_outputPedestals_dest, m_outputPedestals_tag, m_outputPedestals_run)) {
174  std::cerr << "HcalPedestalAnalyzer-> Failed to put output Pedestals & Widths" << std::endl;
175  }
176  }
177  else {
178  if (outputPeds) {
179  if (!putObject (&outputPeds, m_outputPedestals_dest, m_outputPedestals_tag, m_outputPedestals_run)) {
180  std::cerr << "HcalPedestalAnalyzer-> Failed to put output Pedestals" << std::endl;
181  }
182  }
183  if (outputPedWids) {
185  std::cerr << "HcalPedestalAnalyzer-> Failed to put output PedestalWidths" << std::endl;
186  }
187  }
188  }
189  }
190  delete outputPeds;
191  delete outputPedWids;
192 }
std::string m_outputPedestalWidths_tag
TObject * getObject(TDirectory *fDir, const std::vector< std::string > &fObjectName)
Definition: compareHists.cc:44
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

int HcalPedestalAnalyzer::m_endSample
private

Definition at line 74 of file HcalPedestalAnalyzer.h.

Referenced by HcalPedestalAnalyzer().

int HcalPedestalAnalyzer::m_ievt
private

Definition at line 66 of file HcalPedestalAnalyzer.h.

Referenced by analyze(), and beginJob().

int HcalPedestalAnalyzer::m_inputPedestals_run
private

Definition at line 78 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_inputPedestals_source
private

Definition at line 76 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_inputPedestals_tag
private

Definition at line 77 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

int HcalPedestalAnalyzer::m_inputPedestalWidths_run
private

Definition at line 81 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_inputPedestalWidths_source
private

Definition at line 79 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_inputPedestalWidths_tag
private

Definition at line 80 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_outputPedestals_dest
private

Definition at line 82 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

int HcalPedestalAnalyzer::m_outputPedestals_run
private

Definition at line 84 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_outputPedestals_tag
private

Definition at line 83 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_outputPedestalWidths_dest
private

Definition at line 85 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

int HcalPedestalAnalyzer::m_outputPedestalWidths_run
private

Definition at line 87 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

std::string HcalPedestalAnalyzer::m_outputPedestalWidths_tag
private

Definition at line 86 of file HcalPedestalAnalyzer.h.

Referenced by endJob(), and HcalPedestalAnalyzer().

HcalPedestalAnalysis* HcalPedestalAnalyzer::m_pedAnal
private

Definition at line 71 of file HcalPedestalAnalyzer.h.

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

int HcalPedestalAnalyzer::m_startSample
private

Definition at line 73 of file HcalPedestalAnalyzer.h.

Referenced by HcalPedestalAnalyzer().

int HcalPedestalAnalyzer::ped_sample
private

Definition at line 67 of file HcalPedestalAnalyzer.h.

Referenced by beginJob().