18 #include "ROOT/RVec.hxx"
50 return StatusCode::SUCCESS;
57 std::map<std::pair<int, int>,
int> noiseCutsMap;
58 bool useHardcodedCuts =
false;
62 useHardcodedCuts =
true;
65 if (noiseCuts.isValid()) {
71 if(noiseCuts->size()==0) {
72 ATH_MSG_ERROR(
"No noise cuts loaded from conditions db for event with timestamp" << ctx.eventID().time_stamp());
73 return StatusCode::FAILURE;
75 for (
auto itr = noiseCuts->begin(); itr != noiseCuts->end(); ++itr) {
76 if (itr->first >= 50)
continue;
77 noiseCutsMap[std::pair(itr->first, 0)] = itr->second[
"EmPS"].data<
int>();
78 noiseCutsMap[std::pair(itr->first, 1)] = itr->second[
"EmFR"].data<
int>();
79 noiseCutsMap[std::pair(itr->first, 2)] = itr->second[
"EmMD"].data<
int>();
80 noiseCutsMap[std::pair(itr->first, 3)] = itr->second[
"EmBK"].data<
int>();
81 noiseCutsMap[std::pair(itr->first, 4)] = (itr->first >= 10 && itr->first < 40)
82 ? itr->second[
"Tile"].data<
int>()
83 : itr->second[
"HEC"].data<
int>();
90 std::unique_ptr<eTowerContainer> local_eTowerContainerRaw = std::make_unique<eTowerContainer>();
94 local_eTowerContainerRaw->clearContainerMap();
95 local_eTowerContainerRaw->fillContainerMap();
113 for(
size_t i=0;
i<counts.size();
i++) {
114 if(i<10 && eFexTower->em_status())
continue;
117 if (counts.at(
i)==0 || (counts.at(
i)>1020 && counts.at(
i)!=1023))
continue;
130 if(!useHardcodedCuts && counts.at(
i) <= noiseCutsMap[std::pair(
int( (
eFexTower->
eta() + 2.525)/0.1 ),
layer)])
continue;
147 TFile *debugFile =
dynamic_cast<TFile *
>(gROOT->GetListOfFiles()->FindObject(
"debug_eFexTowerMakerFromEfexTowers.root"));
148 if (!debugFile) debugFile = TFile::Open(
"debug_eFexTowerMakerFromEfexTowers.root",
"RECREATE");
149 if (debugFile->GetListOfKeys()->GetEntries() < 20) {
152 TH2D ps(
"ps",
"ps [code];#eta;#phi", 50, -2.5, 2.5, 64, -
M_PI,
M_PI);
153 TH2D
l1(
"l1",
"l1 [code];#eta;#phi", 200, -2.5, 2.5, 64, -
M_PI,
M_PI);
154 TH2D
l2(
"l2",
"l2 [code];#eta;#phi", 200, -2.5, 2.5, 64, -
M_PI,
M_PI);
155 TH2D l3(
"l3",
"l3 [code];#eta;#phi", 50, -2.5, 2.5, 64, -
M_PI,
M_PI);
156 TH2D had(
"had",
"had [code~25MeV or 500MeV for tile];#eta;#phi", 50, -2.5, 2.5, 64, -
M_PI,
M_PI);
157 std::vector < TH1 * >
hists{&ps, &
l1, &
l2, &l3, &had};
160 if (counts.empty())
continue;
163 double tEta = ((etaIndex < 0 ? 0.5 : -0.5) + etaIndex - 0.5) * 0.1;
165 for(
size_t i=0;
i<counts.size();
i++) {
166 if(i<10 && eFexTower->em_status())
continue;
175 if(!useHardcodedCuts && counts.at(
i) <= noiseCutsMap[std::pair(
int( (
eFexTower->
eta() + 2.525)/0.1 ),
layer)])
continue;
183 c.SetTitle(
TString::Format(
"Run %u LB %u Event %lu", ctx.eventID().run_number(), ctx.eventID().lumi_block(),
184 ctx.eventID().event_number()));
186 TH2D tobs(
"tobs",
"Sum [MeV];#eta;#phi", 50, -2.5, 2.5, 64, -
M_PI,
M_PI);
187 for (
size_t i = 0;
i <
hists.size();
i++) {
188 c.GetPad(
i + 1)->cd();gPad->SetGrid(1,1);
189 hists[
i]->SetStats(
false);
190 hists[
i]->SetMarkerSize(2);
191 hists[
i]->GetXaxis()->SetRangeUser(-0.3, 0.3);
192 hists[
i]->GetYaxis()->SetRangeUser(-0.3, 0.3);
193 hists[
i]->Draw((
hists[
i]->GetNbinsX() > 50) ?
"coltext89" :
"coltext");
194 for (
int ii = 1; ii <=
hists[
i]->GetNbinsX(); ii++) {
195 bool isTile = (
i==4 && std::abs(
hists[
i]->GetXaxis()->GetBinCenter(ii))<1.5);
196 for (
int jj = 1; jj <=
hists[
i]->GetNbinsY(); jj++)
197 tobs.Fill(
hists[
i]->GetXaxis()->GetBinCenter(ii),
hists[
i]->GetYaxis()->GetBinCenter(jj),
202 tobs.SetStats(
false);
204 TBox
b(-0.3, -0.3, 0.3, 0.3);
205 b.SetLineColor(kRed);
208 b.SetBit(TBox::kCannotMove);
209 tobs.GetListOfFunctions()->Add(
b.Clone());
211 "{ auto pad = gPad->GetCanvas()->GetPad(%lu); if( pad->GetEvent()==kButton1Down ) { double x = pad->PadtoX(pad->AbsPixeltoX(pad->GetEventX())); double y = pad->PadtoY(pad->AbsPixeltoY(pad->GetEventY())); for(int i=1;i<%lu;i++) {auto h = dynamic_cast<TH1*>(gPad->GetCanvas()->GetPad(i)->GetListOfPrimitives()->At(1)); if(h) {h->GetXaxis()->SetRangeUser(x-0.3,x+0.3);h->GetYaxis()->SetRangeUser(y-0.3,y+0.3); } } if(auto b = dynamic_cast<TBox*>(pad->FindObject(\"tobs\")->FindObject(\"TBox\"))) {b->SetX1(x-0.3);b->SetX2(x+0.3);b->SetY1(y-0.3);b->SetY2(y+0.3);} gPad->GetCanvas()->Paint(); gPad->GetCanvas()->Update(); } }",
222 ATH_CHECK(eTowerContainerSG.
record(std::move(local_eTowerContainerRaw)));
227 return StatusCode::SUCCESS;