60 std::cout <<
"EcalPedestals Source handler constructor\n" << std::endl;
69 std::cout << m_sid <<
"/" << m_user <<
"/" << m_pass <<
"/" << m_location <<
"/" << m_gentag << std::endl;
71 vector<int> listDefaults;
72 listDefaults.push_back(-1);
81 cout <<
"ANALYSIS FINISHED" << endl;
88 cout <<
"Entering beginRun" << endl;
115 TH1F** hMean =
new TH1F*[15];
116 TH1F** hRMS =
new TH1F*[15];
117 TFile
f(
"PedHist.root",
"RECREATE");
131 TTree* tPedChan =
new TTree(
"PedChan",
"Channels");
132 tPedChan->Branch(
"Channels", &Chan.iChannel,
"iChannel/I");
133 tPedChan->Branch(
"x", &Chan.ix,
"ix/I");
134 tPedChan->Branch(
"y", &Chan.iy,
"iy/I");
135 tPedChan->Branch(
"z", &Chan.iz,
"iz/I");
136 for (
int iChannel = 0; iChannel <
kEBChannels; iChannel++) {
137 Chan.iChannel = iChannel;
139 Chan.ix = myEBDetId.
ieta();
140 Chan.iy = myEBDetId.
iphi();
142 if (iChannel % 10000 == 0)
143 cout <<
" EB channel " << iChannel <<
" eta " << Chan.ix <<
" phi " << Chan.iy << endl;
146 for (
int iChannel = 0; iChannel <
kEEChannels; iChannel++) {
147 Chan.iChannel = iChannel;
149 Chan.ix = myEEDetId.
ix();
150 Chan.iy = myEEDetId.
iy();
151 Chan.iz = myEEDetId.
zside();
152 if (iChannel % 1000 == 0)
153 cout <<
" EE channel " << iChannel <<
" x " << Chan.ix <<
" y " << Chan.iy <<
" z " << Chan.iz << endl;
166 for (
int iChannel = 0; iChannel <
kChannels; iChannel++) {
167 PedVal.Mean[iChannel] = -1.;
168 PedVal.RMS[iChannel] = -1.;
170 TTree* tPedHist =
new TTree(
"PedHist",
"Pedestal History");
171 tPedHist->Branch(
"Pedestals", &PedVal.Run,
"Run/I");
172 tPedHist->Branch(
"Mean", PedVal.Mean,
"Mean[75848]/D");
173 tPedHist->Branch(
"RMS", PedVal.RMS,
"RMS[75848]/D");
176 std::cout <<
"Retrieving run list from ONLINE DB ... " << std::endl;
178 std::cout <<
"Connection done" << std::endl;
180 std::cout <<
" Problem with OMDS: connection parameters " << m_sid <<
"/" << m_user <<
"/" << m_pass << std::endl;
207 unsigned int min_run = 0, max_since = 0;
208 if (m_firstRun < max_since) {
209 min_run = max_since + 1;
211 min_run = m_firstRun;
214 unsigned int max_run = m_lastRun;
215 mon_list =
econn->fetchMonRunList(my_runtag, mon_tag, min_run, max_run);
217 std::vector<MonRunIOV> mon_run_vec = mon_list.
getRuns();
218 int mon_runs = mon_run_vec.size();
219 std::cout <<
"number of Mon runs is : " << mon_runs << std::endl;
223 for (
int iChannel = 0; iChannel <
kEBChannels; iChannel++) {
224 if (iChannel % 10000 == 1) {
225 hMean[NbChan] =
new TH1F(Form(
"Mean_%i", NbChan), Form(
"Mean EB %i", iChannel), mon_runs, 0., mon_runs);
226 hRMS[NbChan] =
new TH1F(Form(
"RMS_%i", NbChan), Form(
"RMS EB %i", iChannel), mon_runs, 0., mon_runs);
230 for (
int iChannel = 0; iChannel <
kEEChannels; iChannel++) {
231 if (iChannel % 2000 == 1) {
232 hMean[NbChan] =
new TH1F(Form(
"Mean_%i", NbChan), Form(
"Mean EE %i", iChannel), mon_runs, 0., mon_runs);
233 hRMS[NbChan] =
new TH1F(Form(
"RMS_%i", NbChan), Form(
"RMS EE %i", iChannel), mon_runs, 0., mon_runs);
239 int krmax = mon_runs;
240 for (
int kr = 0; kr < krmax; kr++) {
241 std::cout <<
"-kr------: " << kr << std::endl;
243 unsigned int irun =
static_cast<unsigned int>(mon_run_vec[kr].getRunIOV().getRunNumber());
244 std::cout <<
"retrieve the data for run number: " << irun << std::endl;
245 if (mon_run_vec[kr].getSubRunNumber() <= 1) {
247 RunIOV runiov_prime = mon_run_vec[kr].getRunIOV();
249 std::map<EcalLogicID, MonPedestalsDat> dataset_mon;
250 econn->fetchDataSet(&dataset_mon, &mon_run_vec[kr]);
251 std::cout <<
"OMDS record for run " << irun <<
" is made of " << dataset_mon.size() << std::endl;
252 int nEB = 0, nEE = 0;
253 typedef std::map<EcalLogicID, MonPedestalsDat>::const_iterator CImon;
259 for (CImon
p = dataset_mon.begin();
p != dataset_mon.end();
p++) {
262 int sm_num = ecid_xt.
getID1();
263 int xt_num = ecid_xt.
getID2();
264 int yt_num = ecid_xt.
getID3();
278 std::cout <<
"BAD LIST: channel " << sm_num <<
"/" << xt_num <<
"/" << yt_num <<
"ped/rms " 281 if (ecid_xt.
getName() ==
"EB_crystal_number") {
290 if (nbad < (dataset_mon.size() * 0.05) &&
291 (nEB > 10200 || nEE > 2460)) {
294 for (CImon
p = dataset_mon.begin();
p != dataset_mon.end();
p++) {
297 int sm_num = ecid_xt.
getID1();
298 int xt_num = ecid_xt.
getID2();
299 int yt_num = ecid_xt.
getID3();
301 if (ecid_xt.
getName() ==
"EB_crystal_number") {
304 if (iChannel < 0 || iChannel > 61200)
305 cout <<
" SM " << sm_num <<
" Chan in SM " << xt_num <<
" IChannel " << iChannel << endl;
306 if (iChannel % 10000 == 1) {
313 if (iChannel % 10000 == 0)
314 cout <<
" channel " << iChannel <<
" mean " << PedVal.Mean[iChannel] <<
" RMS " << PedVal.RMS[iChannel]
318 EEDetId eedetid(xt_num, yt_num, sm_num);
320 if (iChannel < 0 || iChannel > 14648)
321 cout <<
" x " << sm_num <<
" y " << xt_num <<
" z " << yt_num <<
" IChannel " << iChannel << endl;
322 if (iChannel % 2000 == 1) {
335 cout <<
" We got a good run " << irun << endl;
340 cout <<
"Exiting beginRun" << endl;
341 for (
int NbChan = 0; NbChan < 15; NbChan++) {
342 if (hMean[NbChan]->GetEntries() > 0.) {
343 hMean[NbChan]->Write();
344 hRMS[NbChan]->Write();
380 if (ECALType_ ==
"EB" || ECALType_ ==
"EA") {
382 }
else if (ECALType_ ==
"EE" || ECALType_ ==
"EA") {
385 cout <<
" strange ECALtype : " << ECALType_ <<
" abort " << endl;
void setRunTypeDef(const RunTypeDef &runTypeDef)
T getParameter(std::string const &) const
std::string getName() const
int iphi() const
get the crystal iphi
float getPedRMSG6() const
static EEDetId unhashIndex(int hi)
void setGeneralTag(std::string tag)
float getPedRMSG1() const
void setRunTag(const RunTag &tag)
int ieta() const
get the crystal ieta
T getUntrackedParameter(std::string const &, T const &) const
float getPedMeanG1() const
EcalPedestalHistory(const edm::ParameterSet &)
float getPedMeanG6() const
void endRun(edm::Run const &, edm::EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
void setMonVersionDef(const MonVersionDef &ver)
float getPedRMSG12() const
void setLocationDef(const LocationDef &locDef)
~EcalPedestalHistory() override
Namespace of DDCMS conversion namespace.
std::vector< MonRunIOV > getRuns()
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
void setMonRunTag(const MonRunTag &tag)
float getPedMeanG12() const
void setMonitoringVersion(std::string ver)
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
int hashedIndex() const
get a compact index for arrays
void analyze(const edm::Event &, const edm::EventSetup &) override
void setGeneralTag(std::string tag)
void beginRun(edm::Run const &, edm::EventSetup const &) override
static const int SMCRYSTALMODE