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;
207 unsigned int min_run = 0, max_since = 0;
209 min_run = max_since + 1;
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;
251 std::cout <<
"OMDS record for run " << irun <<
" is made of " << dataset_mon.size() << std::endl;
252 int nEB = 0, nEE = 0, nEBbad = 0, nEEbad = 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") {
294 if (nbad < (dataset_mon.size() * 0.05) &&
295 (nEB > 10200 || nEE > 2460)) {
298 for (CImon
p = dataset_mon.begin();
p != dataset_mon.end();
p++) {
301 int sm_num = ecid_xt.
getID1();
302 int xt_num = ecid_xt.
getID2();
303 int yt_num = ecid_xt.
getID3();
305 if (ecid_xt.
getName() ==
"EB_crystal_number") {
307 int iChannel = ebdetid.hashedIndex();
308 if (iChannel < 0 || iChannel > 61200)
309 cout <<
" SM " << sm_num <<
" Chan in SM " << xt_num <<
" IChannel " << iChannel << endl;
310 if (iChannel % 10000 == 1) {
317 if (iChannel % 10000 == 0)
318 cout <<
" channel " << iChannel <<
" mean " << PedVal.Mean[iChannel] <<
" RMS " << PedVal.RMS[iChannel]
322 EEDetId eedetid(xt_num, yt_num, sm_num);
323 int iChannel = eedetid.hashedIndex();
324 if (iChannel < 0 || iChannel > 14648)
325 cout <<
" x " << sm_num <<
" y " << xt_num <<
" z " << yt_num <<
" IChannel " << iChannel << endl;
326 if (iChannel % 2000 == 1) {
339 cout <<
" We got a good run " << irun << endl;
344 cout <<
"Exiting beginRun" << endl;
345 for (
int NbChan = 0; NbChan < 15; NbChan++) {
346 if (hMean[NbChan]->GetEntries() > 0.) {
347 hMean[NbChan]->Write();
348 hRMS[NbChan]->Write();
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::string getName() const
int iphi() const
get the crystal iphi
float getPedRMSG6() const
MonRunList fetchMonRunList(const RunTag &tag, const MonRunTag &monruntag) noexcept(false)
static EEDetId unhashIndex(int hi)
void setGeneralTag(std::string tag)
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
float getPedRMSG1() const
void setRunTag(const RunTag &tag)
int ieta() const
get the crystal ieta
float getPedMeanG1() const
float getPedMeanG6() const
void setMonVersionDef(const MonVersionDef &ver)
float getPedRMSG12() const
void setLocationDef(const LocationDef &locDef)
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
void setGeneralTag(std::string tag)
static const int SMCRYSTALMODE
EcalCondDBInterface * econn