CMS 3D CMS Logo

EcalTBHodoscopeRawInfoDumper.cc
Go to the documentation of this file.
7 
8 #include <TFile.h>
11 
13  rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
14  rawInfoProducer_ = ps.getParameter<std::string>("rawInfoProducer");
15  rootfile_ = ps.getUntrackedParameter<std::string>("rootfile", "ecalHodoscopeRawInfoPlots.root");
16 }
17 
19 
20 //========================================================================
22  //========================================================================
23 
24  char histoName[100];
25  char histoTitle[100];
26 
27  for (int i = 0; i < 4; i++) {
28  sprintf(histoName, "h_numberOfFiredHits_%d", i);
29  sprintf(histoTitle, "NumberOfFiredHits Plane %d", i);
30  h_numberOfFiredHits_[i] = new TH1F(histoName, histoTitle, 10, 0., 10.);
31  }
32 
33  for (int i = 0; i < 4; i++) {
34  sprintf(histoName, "h_firedHits_%d", i);
35  sprintf(histoTitle, "firedHits Plane %d", i);
36  h_firedHits_[i] = new TH1F(histoName, histoTitle, 64, -0.5, 63.5);
37  }
38 }
39 
40 //========================================================================
42  //========================================================================
43 
44  TFile f(rootfile_.c_str(), "RECREATE");
45 
46  for (int i = 0; i < 4; i++)
47  h_numberOfFiredHits_[i]->Write();
48 
49  for (int i = 0; i < 4; i++)
50  h_firedHits_[i]->Write();
51 
52  f.Close();
53 }
54 
56  // Get input
57  edm::Handle<EcalTBHodoscopeRawInfo> ecalRawHodoscope;
58  const EcalTBHodoscopeRawInfo* hodoscopeRawInfo = nullptr;
59  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
60  e.getByLabel(rawInfoProducer_, ecalRawHodoscope);
61  if (!ecalRawHodoscope.isValid()) {
62  edm::LogError("EcalTBHodoscopeRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str();
63  } else {
64  hodoscopeRawInfo = ecalRawHodoscope.product();
65  }
66 
67  if (hodoscopeRawInfo)
68  for (int i = 0; i < 4; i++) {
69  std::ostringstream str;
70  str << " Hits ";
71  std::vector<int> firedHits;
72  h_numberOfFiredHits_[i]->Fill((*hodoscopeRawInfo)[i].numberOfFiredHits());
73  for (int j = 0; j < 64; j++)
74  if ((*hodoscopeRawInfo)[i][j]) {
75  h_firedHits_[i]->Fill(j);
76  firedHits.push_back(j);
77  str << j << " ";
78  }
79  LogDebug("EcalTBHodoscope") << "Looking plane " << i << " number of hits "
80  << (*hodoscopeRawInfo)[i].numberOfFiredHits() << str.str();
81  }
82  // Create empty output
83 }
EcalTBHodoscopeRawInfoDumper::h_numberOfFiredHits_
TH1F * h_numberOfFiredHits_[4]
Definition: EcalTBHodoscopeRawInfoDumper.h:29
Handle.h
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ESHandle.h
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
EcalTBHodoscopeRawInfo.h
EcalTBHodoscopeRawInfoDumper::rootfile_
std::string rootfile_
Definition: EcalTBHodoscopeRawInfoDumper.h:28
EcalTBHodoscopeRawInfoDumper::endJob
void endJob() override
Definition: EcalTBHodoscopeRawInfoDumper.cc:41
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
MakerMacros.h
EcalTBHodoscopeRawInfoDumper::~EcalTBHodoscopeRawInfoDumper
~EcalTBHodoscopeRawInfoDumper() override
Definition: EcalTBHodoscopeRawInfoDumper.cc:18
str
#define str(s)
Definition: TestProcessor.cc:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalTBHodoscopeRawInfoDumper::rawInfoProducer_
std::string rawInfoProducer_
Definition: EcalTBHodoscopeRawInfoDumper.h:26
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
EcalTBHodoscopeRawInfo
Definition: EcalTBHodoscopeRawInfo.h:13
EcalTBHodoscopeRawInfoDumper::beginJob
void beginJob() override
Definition: EcalTBHodoscopeRawInfoDumper.cc:21
edm::EventSetup
Definition: EventSetup.h:57
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
EcalTBHodoscopeRawInfoDumper::h_firedHits_
TH1F * h_firedHits_[4]
Definition: EcalTBHodoscopeRawInfoDumper.h:30
HltBtagPostValidation_cff.histoName
histoName
Definition: HltBtagPostValidation_cff.py:17
EventSetup.h
EcalTBHodoscopeRawInfoDumper::rawInfoCollection_
std::string rawInfoCollection_
Definition: EcalTBHodoscopeRawInfoDumper.h:27
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
EDCollection.h
EcalTBHodoscopeRawInfoDumper.h
EcalTBHodoscopeRawInfoDumper::EcalTBHodoscopeRawInfoDumper
EcalTBHodoscopeRawInfoDumper(const edm::ParameterSet &ps)
Definition: EcalTBHodoscopeRawInfoDumper.cc:12
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
EcalTBHodoscopeRawInfoDumper::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: EcalTBHodoscopeRawInfoDumper.cc:55