19 #include "GaudiKernel/MsgStream.h"
29 static constexpr
int maxPRD = 50000;
32 static constexpr
int maxPrd = 50000;
33 static constexpr
int ncutadc = 50;
35 static constexpr
int TDCminrange = 0;
36 static constexpr
int TDCmaxrange = 2000;
37 static constexpr
int TDCNbin = 200;
46 const std::string&
name,
80 m_BISid = mdtIdHelper.stationNameIndex(
"BIS");
81 m_BMLid = mdtIdHelper.stationNameIndex(
"BML");
82 m_BOLid = mdtIdHelper.stationNameIndex(
"BOL");
83 m_BMFid = mdtIdHelper.stationNameIndex(
"BMF");
85 return StatusCode::SUCCESS;
92 "MdtVsRpcRawDataValAlg::MDT-RPC correlation RawData Monitoring "
93 "Histograms being filled");
96 return StatusCode::SUCCESS;
100 return StatusCode::SUCCESS;
102 std::string layer_name{}, sector_name{}, layerSector_name{};
105 std::string generic_path_mdtvsrpcmonitoring =
106 "Muon/MuonRawDataMonitoring/MDTvsRPC";
107 MonGroup mdtrpc_shift_dqmf(
this, generic_path_mdtvsrpcmonitoring +
"/Dqmf",
112 ATH_MSG_WARNING(
"couldn't register MdtRpcZdifference hist to MonGroup");
117 "couldn't register MdtNHitsvsRpcNHits hist to MonGroup");
134 if (!MuonDetMgr.isValid()) {
136 "Null pointer to the read MuonDetectorManager conditions object");
137 return StatusCode::FAILURE;
143 std::string
type =
"RPC";
145 float Nhitsrpc{0.f}, Nhitsmdt{0.f};
147 Nhitsrpc += rpc_coll->size();
151 mdt_coll->size() * !
m_idHelperSvc->isEndcap(mdt_coll->identify());
154 Nhitsrpc = Nhitsrpc > 0 ? std::log10(Nhitsrpc) : -0.5;
155 Nhitsmdt = Nhitsmdt > 0 ? std::log10(Nhitsmdt) : -0.5;
159 int N_RpcHitdblPhi1{0}, N_RpcHitdblPhi2{0};
172 int irpcstationPhi = rpcIdHelper.stationPhi(prd_id);
173 int irpcstationName = rpcIdHelper.stationName(prd_id);
174 int irpcstationEta = rpcIdHelper.stationEta(prd_id);
175 int irpcdoubletR = rpcIdHelper.doubletR(prd_id);
176 int irpcmeasuresPhi = rpcIdHelper.measuresPhi(prd_id);
178 if (irpcmeasuresPhi != 0)
180 int irpcdoubletPhi = rpcIdHelper.doubletPhi(prd_id);
181 int irpcdoubletZ = rpcIdHelper.doubletZ(prd_id);
182 int irpcstrip = rpcIdHelper.strip(prd_id);
185 irpcstationName, irpcstationEta, irpcstationPhi,
type);
193 int imdt_multi_near = 0;
194 if ((irpcstationName >
m_BISid) &&
196 if (irpcdoubletR == 1) {
197 layer_name =
"LowPt";
200 layer_name =
"Pivot";
204 layer_name =
"HighPt";
206 if (irpcstationName != 4)
212 if (irpcstationEta < 0) {
215 int sector = 2 * irpcstationPhi;
218 char sector_char[1000];
219 sprintf(sector_char,
"Sector%.2d", sector);
220 sector_name = sector_char;
222 layerSector_name = sector_name + layer_name;
225 std::array<int, 4> ShiftEtaStripsDoubletZ{};
226 for (
int idbz = 0; idbz != 3; idbz++) {
227 ShiftEtaStripsDoubletZ[idbz] = NetaStrips;
229 irpcstationName, irpcstationEta, irpcstationPhi,
230 irpcdoubletR, idbz + 1, 1, 1, 1,
235 MuonDetMgr->getRpcReadoutElement(
id);
241 bool histo_flag =
true;
243 if ((sector_name + layerSector_name) == iter) {
254 float stripzmin{0}, stripzmax{-10000};
256 for (
int ieta = rpcIdHelper.stationEtaMin();
257 ieta < rpcIdHelper.stationEtaMax(); ieta++) {
258 for (
int idbz = 0; idbz != 3; idbz++) {
260 irpcstationName, ieta, irpcstationPhi, irpcdoubletR,
266 MuonDetMgr->getRpcReadoutElement(
id);
271 float z1 = r1.z() - (rpc->
NetaStrips()) * pitch / 2;
272 if (z1 < stripzmin) {
275 float z2 = r1.z() + (rpc->
NetaStrips()) * pitch / 2;
276 if (z2 > stripzmax) {
286 float wirezmax{-10000.}, wirezmin{+10000.}, foundmin{0};
288 const int mdtStatName = irpcstationName;
290 for (
int stEta = mdtIdHelper.stationEtaMin(
true);
291 stEta <= mdtIdHelper.stationEtaMax(
true); ++stEta) {
292 const Identifier mdt_id = mdtIdHelper.channelID(
293 mdtStatName, stEta, irpcstationPhi, imdt_multi_near, 1,
296 MuonDetMgr->getMdtReadoutElement(mdt_id);
302 constexpr
float conv_fac = 0.5 / 29.9;
303 float z = lastelc.z() + NtubesPerLayerlast * conv_fac;
321 stripzmin, stripzmax, wirezmin,
328 TH2* mdttubevsrpcetastripsector;
333 MuonDetMgr->getRpcReadoutElement(prd_id);
335 ATH_MSG_DEBUG(
"rpc coord" << stripPos.z() << stripPos.perp());
336 float irpcstripz =
float(stripPos.z());
339 descriptor->
NphiStrips() * (irpcdoubletPhi - 1);
341 int ShiftEtaStrips = ShiftEtaStripsDoubletZ[irpcdoubletZ - 1];
343 int ShiftStrips = ShiftEtaStrips;
346 if (irpcmeasuresPhi == 1) {
347 ShiftStrips = ShiftPhiStrips;
351 int sectorlogic = (sector - 1) * 2;
352 if (irpcdoubletPhi == 1)
370 dig_idmdt = mdt_coll->identify();
371 int imdt_station = mdtIdHelper.stationName(dig_idmdt);
372 if (imdt_station != irpcstationName)
374 int imdt_eta = mdtIdHelper.stationEta(dig_idmdt);
375 if (imdt_eta != irpcstationEta)
377 int imdt_phi = mdtIdHelper.stationPhi(dig_idmdt);
378 if (imdt_phi != irpcstationPhi)
383 dig_idmdt = mdtPrd->identify();
384 int imdt_multi = mdtIdHelper.multilayer(dig_idmdt);
386 if (imdt_multi != imdt_multi_near)
388 int imdt_adc = mdtPrd->adc();
390 if (imdt_adc < ncutadc)
392 int imdt_tdc = mdtPrd->tdc();
393 int imdt_wire = mdtIdHelper.tube(dig_idmdt);
398 mdtPrd->detectorElement();
401 float imdt_wirez = elc.z();
403 if (imdt_wirez >= 0) {
405 (
float(imdt_wire) - 0.5 -
float(NetaTubes) / 2) *
408 imdt_wirez = imdt_wirez - (
float(imdt_wire) - 0.5 -
409 float(NetaTubes) / 2) *
415 bool histo_flag =
true;
417 if ((hardware_name + layer_name) == iter) {
422 bool is_valid{
false};
423 const Identifier mdt_id = mdtIdHelper.channelID(
424 irpcstationName, irpcstationEta, irpcstationPhi,
425 imdt_multi_near, 1, 1, is_valid);
426 if (!is_valid)
continue;
427 imdt_eta = irpcstationEta;
428 imdt_phi = irpcstationPhi;
431 MuonDetMgr->getMdtReadoutElement(mdt_id);
439 hardware_name, layer_name, NetaStrips, 0,
440 NetaStrips, NetaTubes, 0, NetaTubes);
446 TH2* mdttubevsrpcetastrip_doublphi1 =
447 hists.getH2(hardware_name +
"_" + layer_name +
448 "_MDTtube_vs_RPCstrip_doublPhi1");
449 TH2* mdttubevsrpcetastrip_doublphi2 =
450 hists.getH2(hardware_name +
"_" + layer_name +
451 "_MDTtube_vs_RPCstrip_doublPhi2");
453 TH1* mdttdcdoublphi1 =
454 hists.getH1(hardware_name +
"_" + layer_name +
455 "_MDTtdc_doublPhi1");
456 TH1* mdttdcdoublphi2 =
457 hists.getH1(hardware_name +
"_" + layer_name +
458 "_MDTtdc_doublPhi2");
462 constexpr
float tdc_adc_conv = 25.0 / 32.0;
463 if (irpcdoubletPhi == 1) {
464 if (N_RpcHitdblPhi1 == 0) {
465 if (mdttdcdoublphi1) {
466 mdttdcdoublphi1->Fill(
float(imdt_tdc) *
470 if (mdttubevsrpcetastrip_doublphi1) {
471 mdttubevsrpcetastrip_doublphi1->Fill(
472 (irpcstrip + ShiftStrips), imdt_wire);
475 if (N_RpcHitdblPhi2 == 0) {
476 if (mdttdcdoublphi2) {
477 mdttdcdoublphi2->Fill(
float(imdt_tdc) *
481 if (mdttubevsrpcetastrip_doublphi2) {
482 mdttubevsrpcetastrip_doublphi2->Fill(
483 (irpcstrip + ShiftStrips), imdt_wire);
489 mdttubevsrpcetastripsector =
490 hists1.
getH2(sector_name +
"_" + layer_name +
491 "_MDTtube_vs_RPCstrip");
492 if (mdttubevsrpcetastripsector) {
493 mdttubevsrpcetastripsector->Fill((
float)irpcstripz,
497 "mdttubevsrpcetastripsector not in hist list!");
501 double mdt_rpc_dz = imdt_wirez - irpcstripz;
507 if (nPrdmdt > maxPrd - 1) {
509 "Maximum number of MdtPrepData in the ntuple "
512 return StatusCode::SUCCESS;
519 if (irpcdoubletPhi == 1) {
530 return StatusCode::SUCCESS;
537 ATH_MSG_DEBUG(
"MdtVsRpcRawDataValAlg Monitoring Histograms being booked");
540 return StatusCode::SUCCESS;
544 return StatusCode::SUCCESS;
547 return StatusCode::SUCCESS;
549 std::string generic_path_mdtvsrpcmonitoring =
550 "Muon/MuonRawDataMonitoring/MDTvsRPC";
551 MonGroup mdtrpc_shift_dqmf(
this, generic_path_mdtvsrpcmonitoring +
"/Dqmf",
560 std::string MdtRpcZdiff_title =
"MdtRpcZdifference";
561 const char* MdtRpcZdiff_title_char = MdtRpcZdiff_title.c_str();
563 TH1* MdtRpcZdiff =
new TH1I(MdtRpcZdiff_title_char, MdtRpcZdiff_title_char,
566 MdtRpcZdiff->GetXaxis()->SetTitle(
"Z mdt tube - Z rpc strip [mm]");
567 MdtRpcZdiff->GetYaxis()->SetTitle(
"Counts");
568 MdtRpcZdiff->SetFillColor(42);
571 << MdtRpcZdiff_title.c_str());
576 std::string MdtNHitsvsRpcNHits_title =
"MdtNHitsvsRpcNHits";
577 const char* MdtNHitsvsRpcNHits_title_char =
578 MdtNHitsvsRpcNHits_title.c_str();
580 TH2* MdtNHitsvsRpcNHits =
581 new TH2I(MdtNHitsvsRpcNHits_title_char, MdtNHitsvsRpcNHits_title_char,
582 11, -1, 10, 11, -1, 10);
585 MdtNHitsvsRpcNHits->GetYaxis()->SetTitle(
"Number of MDT hits (10dB)");
586 MdtNHitsvsRpcNHits->GetXaxis()->SetTitle(
"Number of RPC hits (10dB)");
587 MdtNHitsvsRpcNHits->SetFillColor(42);
588 MdtNHitsvsRpcNHits->SetOption(
"COLZ");
589 MdtNHitsvsRpcNHits->SetMarkerColor(1);
590 MdtNHitsvsRpcNHits->SetMarkerStyle(21);
591 MdtNHitsvsRpcNHits->SetMarkerSize(0.2);
594 << MdtNHitsvsRpcNHits << MdtNHitsvsRpcNHits_title.c_str());
598 return StatusCode::SUCCESS;
603 const std::string& hardware_name,
const std::string& layer_name,
int binz,
604 int binminz,
int binmaxz,
int binx,
int binminx,
int binmaxx) {
617 std::string generic_path_mdtvsrpcmonitoring =
618 "Muon/MuonRawDataMonitoring/MDTvsRPC";
620 this, generic_path_mdtvsrpcmonitoring +
"/Chambers/" + hardware_name,
628 std::string mdtvsrpc_dphi1_title =
629 hardware_name +
"_" + layer_name +
"_MDTtube_vs_RPCstrip_doublPhi1";
630 std::string mdtvsrpc_dphi2_title =
631 hardware_name +
"_" + layer_name +
"_MDTtube_vs_RPCstrip_doublPhi2";
632 const char* mdtvsrpc_dphi1_title_char = mdtvsrpc_dphi1_title.c_str();
633 const char* mdtvsrpc_dphi2_title_char = mdtvsrpc_dphi2_title.c_str();
635 TH2* mdttubevsrpcetastrip_doublphi1 =
636 new TH2I(mdtvsrpc_dphi1_title_char, mdtvsrpc_dphi1_title_char, binz,
637 binminz, binmaxz, binx, binminx, binmaxx);
638 lst.
addHist(mdttubevsrpcetastrip_doublphi1);
640 mdttubevsrpcetastrip_doublphi1->SetOption(
"COLZ");
641 mdttubevsrpcetastrip_doublphi1->SetFillColor(42);
642 mdttubevsrpcetastrip_doublphi1->SetMarkerColor(1);
643 mdttubevsrpcetastrip_doublphi1->SetMarkerStyle(21);
644 mdttubevsrpcetastrip_doublphi1->SetMarkerSize(0.2);
645 mdttubevsrpcetastrip_doublphi1->GetXaxis()->SetTitle(
646 "<--- IP Rpc Eta strip EC --->");
647 mdttubevsrpcetastrip_doublphi1->GetYaxis()->SetTitle(
648 "<--- IP Mdt wire number ADC Cut ON EC --->");
650 if (mdtvsrpc_prd_expert.
regHist(mdttubevsrpcetastrip_doublphi1)
653 "couldn't register mdttubevsrpcetastrip_doublphi1 hist to "
656 TH2* mdttubevsrpcetastrip_doublphi2 =
657 new TH2I(mdtvsrpc_dphi2_title_char, mdtvsrpc_dphi2_title_char, binz,
658 binminz, binmaxz, binx, binminx, binmaxx);
659 lst.
addHist(mdttubevsrpcetastrip_doublphi2);
661 mdttubevsrpcetastrip_doublphi2->SetOption(
"COLZ");
662 mdttubevsrpcetastrip_doublphi2->SetFillColor(42);
663 mdttubevsrpcetastrip_doublphi2->SetMarkerColor(1);
664 mdttubevsrpcetastrip_doublphi2->SetMarkerStyle(21);
665 mdttubevsrpcetastrip_doublphi2->SetMarkerSize(0.2);
666 mdttubevsrpcetastrip_doublphi2->GetXaxis()->SetTitle(
667 "<--- IP Rpc Eta strip EC --->");
668 mdttubevsrpcetastrip_doublphi2->GetYaxis()->SetTitle(
669 "<--- IP Mdt wire number ADC Cut ON EC --->");
671 if (mdtvsrpc_prd_expert.
regHist(mdttubevsrpcetastrip_doublphi2)
674 "couldn't register mdttubevsrpcetastrip_doublphi2 hist to "
678 << mdttubevsrpcetastrip_doublphi1);
680 << mdttubevsrpcetastrip_doublphi1);
687 std::string generic_path_mdttdcdoublphi1 =
688 "/muoncosmics/MDTvsRPC/Chambers/" + hardware_name +
"/" + layer_name;
689 std::string mdttdcdoublphi1_title =
690 hardware_name +
"_" + layer_name +
"_MDTtdc_doublPhi1";
691 const char* mdttdcdoublphi1_title_char = mdttdcdoublphi1_title.c_str();
693 TH1* mdttdcdoublphi1 =
new TH1I(
694 mdttdcdoublphi1_title_char, mdttdcdoublphi1_title_char,
698 mdttdcdoublphi1->SetFillColor(42);
699 mdttdcdoublphi1->SetMarkerColor(1);
700 mdttdcdoublphi1->SetMarkerStyle(21);
701 mdttdcdoublphi1->SetMarkerSize(0.2);
702 mdttdcdoublphi1->GetXaxis()->SetTitle(
"Time Spectrum [ns]");
703 mdttdcdoublphi1->GetYaxis()->SetTitle(
"Counts");
705 if (mdtvsrpc_prd_expert.
regHist(mdttdcdoublphi1).isFailure()) {
709 << mdttdcdoublphi1 << generic_path_mdttdcdoublphi1);
714 std::string generic_path_mdttdcdoublphi2 =
715 "/muoncosmics/MDTvsRPC/Chambers/" + hardware_name +
"/" + layer_name;
716 std::string mdttdcdoublphi2_title =
717 hardware_name +
"_" + layer_name +
"_MDTtdc_doublPhi2";
718 const char* mdttdcdoublphi2_title_char = mdttdcdoublphi2_title.c_str();
720 TH1* mdttdcdoublphi2 =
new TH1I(
721 mdttdcdoublphi2_title_char, mdttdcdoublphi2_title_char,
725 mdttdcdoublphi2->SetFillColor(42);
726 mdttdcdoublphi2->SetMarkerColor(1);
727 mdttdcdoublphi2->SetMarkerStyle(21);
728 mdttdcdoublphi2->SetMarkerSize(0.2);
729 mdttdcdoublphi2->GetXaxis()->SetTitle(
"Time Spectrum [ns]");
730 mdttdcdoublphi2->GetYaxis()->SetTitle(
"Counts");
732 if (mdtvsrpc_prd_expert.
regHist(mdttdcdoublphi2).isFailure()) {
737 << mdttdcdoublphi2 << generic_path_mdttdcdoublphi2.c_str());
742 const std::string& sector_name,
const std::string& layer_name,
743 float stripzmin,
float stripzmax,
float wirezmin,
float wirezmax) {
752 std::string generic_path_mdtvsrpcmonitoring =
753 "Muon/MuonRawDataMonitoring/MDTvsRPC";
755 this, generic_path_mdtvsrpcmonitoring +
"/Sectors/" + sector_name,
run,
761 std::string generic_path_mdtvsrpcsector = generic_path_mdtvsrpcmonitoring +
762 "/Sectors/" + sector_name +
764 std::string mdtvsrpcsector_title =
765 sector_name +
"_" + layer_name +
"_MDTtube_vs_RPCstrip";
766 const char* mdtvsrpcsector_title_char = mdtvsrpcsector_title.c_str();
773 TH2* mdtvsrpcsector =
new TH2I(
774 mdtvsrpcsector_title_char, mdtvsrpcsector_title_char, MDTvsRPCNbinz,
775 stripzmin, stripzmax, MDTvsRPCNbinx, wirezmin, wirezmax);
778 mdtvsrpcsector->SetOption(
"COLZ");
779 mdtvsrpcsector->SetFillColor(42);
780 mdtvsrpcsector->SetMarkerColor(1);
781 mdtvsrpcsector->SetMarkerStyle(21);
782 mdtvsrpcsector->GetXaxis()->SetTitle(
783 "<--- Side C Rpc Eta strip z [mm] Side A "
785 mdtvsrpcsector->GetYaxis()->SetTitle(
786 "<--- Side C Mdt wire z [mm] Side A "
790 << mdtvsrpcsector << generic_path_mdtvsrpcsector.c_str());
793 if (mdtvsrpc_prd_shift.
regHist(mdtvsrpcsector).isFailure()) {