47 EcalIntercalibConstantsMCEBMap()
57 Base::setSingleIov(
true);
61 bool fill()
override {
62 auto tag = PlotBase::getTag<0>();
63 for (
auto const& iov :
tag.iovs) {
67 if (
payload->barrelItems().empty())
79 if (value_ptr ==
payload->end())
104 int EEhistSplit = 20;
107 EcalIntercalibConstantsMCEEMap()
117 Base::setSingleIov(
true);
120 bool fill()
override {
121 auto tag = PlotBase::getTag<0>();
122 for (
auto const& iov :
tag.iovs) {
125 if (
payload->endcapItems().empty())
137 if (value_ptr ==
payload->end())
142 if (myEEId.zside() == -1)
160 EcalIntercalibConstantsMCPlot()
165 bool fill(
const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs)
override {
170 auto iov = iovs.front();
172 unsigned int run = std::get<0>(iov);
175 if (
payload->barrelItems().empty())
178 fillEBMap_SingleIOV<EcalIntercalibConstantsMC>(
payload,
barrel);
180 if (
payload->endcapItems().empty())
183 fillEEMap_SingleIOV<EcalIntercalibConstantsMC>(
payload, endc_m, endc_p);
187 gStyle->SetPalette(1);
188 gStyle->SetOptStat(0);
189 TCanvas
canvas(
"CC map",
"CC map", 1600, 450);
193 t1.SetTextSize(0.04);
194 t1.DrawLatex(0.5, 0.96, Form(
"Ecal IntercalibConstants MC, IOV %i",
run));
196 float xmi[3] = {0.0, 0.24, 0.76};
197 float xma[3] = {0.24, 0.76, 1.00};
198 std::array<std::unique_ptr<TPad>, 3> pad;
200 pad[
obj] = std::make_unique<TPad>(Form(
"p_%i",
obj), Form(
"p_%i",
obj), xmi[
obj], 0.0, xma[
obj], 0.94);
215 canvas.SaveAs(ImageName.c_str());
223 template <cond::payloadInspector::IOVMultiplicity nIOVs,
int ntags,
int method>
224 class EcalIntercalibConstantsMCBase
227 EcalIntercalibConstantsMCBase()
229 "ECAL Intercalib Constants MC comparison") {}
231 bool fill()
override {
235 float pEBmin, pEEmin, pEBmax, pEEmax;
244 auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs;
245 l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().
name;
246 auto firstiov = iovs.front();
247 run[0] = std::get<0>(firstiov);
248 std::tuple<cond::Time_t, cond::Hash> lastiov;
250 auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs;
251 l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().
name;
252 lastiov = tag2iovs.front();
254 lastiov = iovs.back();
255 l_tagname[1] = l_tagname[0];
257 run[1] = std::get<0>(lastiov);
258 for (
int irun = 0; irun < nIOVs; irun++) {
259 std::shared_ptr<EcalIntercalibConstantsMC>
payload;
266 if (
payload->barrelItems().empty())
269 fillEBMap_TwoIOVs<EcalIntercalibConstantsMC>(
payload,
barrel, irun, pEB, pEBmin, pEBmax,
method);
271 if (
payload->endcapItems().empty())
274 fillEEMap_TwoIOVs<EcalIntercalibConstantsMC>(
payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax,
method);
279 gStyle->SetPalette(1);
280 gStyle->SetOptStat(0);
281 TCanvas
canvas(
"CC map",
"CC map", 1600, 450);
285 int len = l_tagname[0].length() + l_tagname[1].length();
289 t1.SetTextSize(0.05);
292 Form(
"%s IOV %i %s %s IOV %i",
293 l_tagname[1].c_str(),
296 l_tagname[0].c_str(),
299 t1.SetTextSize(0.05);
300 t1.DrawLatex(0.5, 0.96, Form(
"Ecal IntercalibConstantsMC, IOV %i %s %i",
run[1],
dr[
method].c_str(),
run[0]));
303 t1.SetTextSize(0.05);
304 t1.DrawLatex(0.5, 0.96, Form(
"%s, IOV %i %s %i", l_tagname[0].c_str(),
run[1],
dr[
method].c_str(),
run[0]));
307 float xmi[3] = {0.0, 0.24, 0.76};
308 float xma[3] = {0.24, 0.76, 1.00};
309 std::array<std::unique_ptr<TPad>, 3> pad;
312 pad[
obj] = std::make_unique<TPad>(Form(
"p_%i",
obj), Form(
"p_%i",
obj), xmi[
obj], 0.0, xma[
obj], 0.94);
317 DrawEE(endc_m, pEEmin, pEEmax);
321 DrawEE(endc_p, pEEmin, pEEmax);
324 canvas.SaveAs(ImageName.c_str());
328 using EcalIntercalibConstantsMCDiffOneTag = EcalIntercalibConstantsMCBase<cond::payloadInspector::SINGLE_IOV, 1, 0>;
329 using EcalIntercalibConstantsMCDiffTwoTags = EcalIntercalibConstantsMCBase<cond::payloadInspector::SINGLE_IOV, 2, 0>;
330 using EcalIntercalibConstantsMCRatioOneTag = EcalIntercalibConstantsMCBase<cond::payloadInspector::SINGLE_IOV, 1, 1>;
331 using EcalIntercalibConstantsMCRatioTwoTags = EcalIntercalibConstantsMCBase<cond::payloadInspector::SINGLE_IOV, 2, 1>;
338 EcalIntercalibConstantsMCSummaryPlot()
343 bool fill(
const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs)
override {
344 auto iov = iovs.front();
346 unsigned int run = std::get<0>(iov);
352 align =
new TH2F(
"",
"", 0, 0, 0, 0, 0, 0);
354 float mean_x_EB = 0.0f;
355 float mean_x_EE = 0.0f;
363 payload->summary(mean_x_EB, rms_EB, num_x_EB, mean_x_EE, rms_EE, num_x_EE);
365 align,
"Ecal Intercalib Constants MC", mean_x_EB, rms_EB, num_x_EB, mean_x_EE, rms_EE, num_x_EE);
370 gStyle->SetPalette(1);
371 gStyle->SetOptStat(0);
372 TCanvas
canvas(
"CC map",
"CC map", 1000, 1000);
376 t1.SetTextSize(0.04);
378 t1.DrawLatex(0.5, 0.96, Form(
"Ecal Intercalib Constants MC Summary, IOV %i",
run));
380 TPad pad(
"pad",
"pad", 0.0, 0.0, 1.0, 0.94);
388 canvas.SaveAs(ImageName.c_str());
void fillTableWithSummary(TH2F *&align, std::string title, const float &mean_x_EB, const float &rms_EB, const int &num_x_EB, const float &mean_x_EE, const float &rms_EE, const int &num_x_EE)
void fillWithValue(float xvalue, float yvalue, float weight=1)
static EEDetId unhashIndex(int hi)
static bool validHashIndex(int i)
void DrawEE(TH2F *endc, float min, float max)
void DrawEB(TH2F *ebmap, float min, float max)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
static const int MIN_HASH
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
std::vector< Item >::const_iterator const_iterator
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
void drawTable(int nbRows, int nbColumns)
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)