CMS 3D CMS Logo

ESPedestalTask.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <fstream>
3 #include <iostream>
4 
7 
11 
16 
18 
20 
21 using namespace cms;
22 using namespace edm;
23 using namespace std;
24 
26  digitoken_ = consumes<ESDigiCollection>(ps.getParameter<InputTag>("DigiLabel"));
27  lookup_ = ps.getUntrackedParameter<FileInPath>("LookupTable");
28  outputFile_ = ps.getUntrackedParameter<string>("OutputFile", "");
29  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower");
30 
31  for (int i = 0; i < 2; ++i)
32  for (int j = 0; j < 2; ++j)
33  for (int k = 0; k < 40; ++k)
34  for (int l = 0; l < 40; ++l)
35  senCount_[i][j][k][l] = -1;
36 
37  ievt_ = 0;
38 }
39 
41  int iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
42  int senZ_[4288], senP_[4288], senX_[4288], senY_[4288];
43 
44  // read in look-up table
45  ifstream file(lookup_.fullPath().c_str());
46  if (!file.is_open())
47  throw cms::Exception("FileNotFound") << lookup_.fullPath();
48 
49  file >> nLines_;
50 
51  for (int i = 0; i < nLines_; ++i) {
52  file >> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
53 
54  senZ_[i] = iz;
55  senP_[i] = ip;
56  senX_[i] = ix;
57  senY_[i] = iy;
58 
59  iz = (senZ_[i] == 1) ? 0 : 1;
60  senCount_[iz][senP_[i] - 1][senX_[i] - 1][senY_[i] - 1] = i;
61  }
62 
63  char hname[300];
64 
65  iBooker.setCurrentFolder(prefixME_ + "/ESPedestalTask");
66 
67  for (int i = 0; i < nLines_; ++i) {
68  for (int is = 0; is < 32; ++is) {
69  sprintf(hname, "ADC Z %d P %d X %d Y %d Str %d", senZ_[i], senP_[i], senX_[i], senY_[i], is + 1);
70  meADC_[i][is] = iBooker.book1D(hname, hname, 1000, 899.5, 1899.5);
71  }
72  }
73 }
74 
75 void ESPedestalTask::analyze(const edm::Event& e, const edm::EventSetup& iSetup) {
76  ievt_++;
77  runNum_ = e.id().run();
78 
80  e.getByToken(digitoken_, digis);
81 
82  runtype_ = 1; // Let runtype_ = 1
83 
84  // Digis
85  int zside, plane, ix, iy, strip, iz;
86  if (digis.isValid()) {
87  for (ESDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr) {
88  ESDataFrame dataframe = (*digiItr);
89  ESDetId id = dataframe.id();
90 
91  zside = id.zside();
92  plane = id.plane();
93  ix = id.six();
94  iy = id.siy();
95  strip = id.strip();
96  iz = (zside == 1) ? 0 : 1;
97 
98  if (meADC_[senCount_[iz][plane - 1][ix - 1][iy - 1]][strip - 1]) {
99  if (runtype_ == 1) {
100  meADC_[senCount_[iz][plane - 1][ix - 1][iy - 1]][strip - 1]->Fill(dataframe.sample(0).adc());
101  meADC_[senCount_[iz][plane - 1][ix - 1][iy - 1]][strip - 1]->Fill(dataframe.sample(1).adc());
102  meADC_[senCount_[iz][plane - 1][ix - 1][iy - 1]][strip - 1]->Fill(dataframe.sample(2).adc());
103  } else if (runtype_ == 3) {
104  meADC_[senCount_[iz][plane - 1][ix - 1][iy - 1]][strip - 1]->Fill(dataframe.sample(1).adc());
105  }
106  }
107  }
108  }
109 }
110 
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
ESPedestalTask::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: ESPedestalTask.cc:40
edm::DataFrameContainer::const_iterator
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
Definition: DataFrameContainer.h:61
ESSample::adc
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:16
ESPedestalTask.h
edm::Run
Definition: Run.h:45
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
edm
HLT enums.
Definition: AlignableModifier.h:19
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
ESPedestalTask
Definition: ESPedestalTask.h:13
DQMStore.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ESDetId
Definition: ESDetId.h:15
ESDetId.h
edm::Handle
Definition: AssociativeIterator.h:50
ESDataFrame
Definition: ESDataFrame.h:10
FileInPath.h
ESDataFrame.h
ESDataFrame::sample
const ESSample & sample(int i) const
Definition: ESDataFrame.h:24
EcalRawDataCollections.h
edm::FileInPath
Definition: FileInPath.h:64
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
ESPedestalTask::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: ESPedestalTask.cc:75
dqmdumpme.k
k
Definition: dqmdumpme.py:60
edm::ParameterSet
Definition: ParameterSet.h:36
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
edm::DataFrameContainer::begin
const_iterator begin() const
The iterator returned can not safely be used across threads.
Definition: DataFrameContainer.h:149
edm::EventSetup
Definition: EventSetup.h:57
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
std
Definition: JetResolutionObject.h:76
DetId.h
Frameworkfwd.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
cms::Exception
Definition: Exception.h:70
ESPedestalTask::ESPedestalTask
ESPedestalTask(const edm::ParameterSet &ps)
Definition: ESPedestalTask.cc:25
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
edm::DataFrameContainer::end
const_iterator end() const
Definition: DataFrameContainer.h:152
edm::InputTag
Definition: InputTag.h:15
ESDataFrame::id
const ESDetId & id() const
Definition: ESDataFrame.h:19
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37