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;
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") {
303 int iChannel = ebdetid.hashedIndex();
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);
319 int iChannel = eedetid.hashedIndex();
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();
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)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
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
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
void setGeneralTag(std::string tag)
static const int SMCRYSTALMODE
EcalCondDBInterface * econn