12 #include <arich/modules/arichDQM/ARICHDQMModule.h>
15 #include <arich/dbobjects/ARICHGeometryConfig.h>
16 #include <arich/dbobjects/ARICHChannelMapping.h>
17 #include <arich/dbobjects/ARICHMergerMapping.h>
18 #include <arich/dbobjects/ARICHGeoDetectorPlane.h>
19 #include <arich/dbobjects/ARICHGeoAerogelPlane.h>
20 #include <arich/dataobjects/ARICHHit.h>
21 #include <arich/dataobjects/ARICHDigit.h>
22 #include <arich/dataobjects/ARICHAeroHit.h>
23 #include <arich/dataobjects/ARICHTrack.h>
24 #include <arich/dataobjects/ARICHLikelihood.h>
25 #include <arich/dataobjects/ARICHPhoton.h>
27 #include <mdst/dataobjects/Track.h>
28 #include <mdst/dataobjects/MCParticle.h>
31 #include <framework/datastore/StoreArray.h>
34 #include <framework/database/DBObjPtr.h>
62 addParam(
"UpperMomentumLimit",
m_momUpLim,
"Upper momentum limit of tracks included in monitoring", 10.0);
63 addParam(
"LowerMomentumLimit",
m_momDnLim,
"Lower momentum limit of tracks included in monitoring", 2.5);
64 addParam(
"ArichEvents",
m_arichEvents,
"Include only hits from events where an extrapolated track to arich exists",
false);
65 addParam(
"MaxHits",
m_maxHits,
"Include only events with less than MaxHits hits in ARICH (remove loud events)", 70000);
66 addParam(
"MinHits",
m_minHits,
"Include only events with more than MinHits hits in ARICH", 0);
76 TDirectory* oldDir = gDirectory;
77 TDirectory* dirARICHDQM = oldDir->mkdir(
"ARICH");
82 h_chStat =
new TH1D(
"chStat",
"Status of channels;Channel serial;Status", 420 * 144, -0.5, 420 * 144 - 0.5);
83 h_aeroStat =
new TH1D(
"aeroStat",
"Status of aerogels;Aerogel tile serial;Status", 160, -0.5, 160 - 0.5);
84 h_chHit =
new TH1D(
"chHit",
"Number of hits in each channel;Channel serial;Hits", 420 * 144, -0.5, 420 * 144 - 0.5);
85 h_chipHit =
new TH1D(
"chipHit",
"Number of hits in each chip;Chip serial;Hits", 420 * 4, -0.5, 420 * 4 - 0.5);
86 h_hapdHit =
new TH1D(
"hapdHit",
"Number of hits in each HAPD;HAPD serial;Hits", 420, 0.5, 421 - 0.5);
87 h_hapdHitPerEvent =
new TH2D(
"hapdHitPerEvent",
"Number of hits in each HAPD per Event;HAPD serial;Hits/event", 420, 0.5, 420 + 0.5,
89 h_trackPerEvent =
new TH1D(
"trackPerEvent",
"Number of tracks in ARICH per event; # of tracks;Events", 6, -0.5, 5.5);
91 h_mergerHit =
new TH1D(
"mergerHit",
"Number of hits in each merger board;MB ID;Hits", 72, 0.5, 72 + 0.5);
92 h_bitsPerMergerNorm =
new TH2D(
"bitsPerMergerNorm",
"Normalised number of hits in each bit in each Merger;Bit;MB ID;Hits", 5,
94 4 - 0.5, 72, 0.5, 72 + 0.5);
95 h_bitsPerHapdMerger =
new TH2D(
"bitsPerHapdMerger",
96 "Number of hits in each bit in each Hapd sorted by mergers;Bit;HAPD unsorted;Hits", 5, -1 - 0.5,
97 4 - 0.5, 432, 1, 432);
99 h_aerogelHit =
new TH1D(
"aerogelHit",
"Number track associated hits in each aerogel tile;Aerogel slot ID;Hits", 125, -0.5,
101 h_bits =
new TH1D(
"bits",
"Number of hits in each bit;Bit;Hits", 5, -1 - 0.5,
103 h_bitsPerChannel =
new TH2D(
"bitsPerChannel",
"Number of hits in each bit in each chanenel;Bit;channel #;Hits", 4, - 0.5,
104 4 - 0.5, 420 * 144, -0.5, 420 * 144 - 0.5);
105 h_hitsPerTrack2D =
new TH2D(
"hitsPerTrack2D",
"2D distribution of track associated hits;X[cm];Y[cm];Hits", 230, -115, 115, 230,
107 h_tracks2D =
new TH2D(
"tracks2D",
"Distribution track positions;X[cm];Y[cm];Tracks", 230, -115, 115, 230, -115, 115);
109 h_hitsPerEvent =
new TH1D(
"hitsPerEvent",
"Number of hit per event;Number of hits;Events", 150, -0.5, 150 - 0.5);
110 h_theta =
new TH1D(
"theta",
"Cherenkov angle distribution;Angle [rad];Events", 60, 0, M_PI / 6);
111 h_hitsPerTrack =
new TH1D(
"hitsPerTrack",
"Number of hit per track;Number of hits;Tracks", 41, -0.5, 40.5);
113 for (
int i = 0; i < 6; i++) {
114 h_secTheta[i] =
new TH1D(Form(
"thetaSec%d", i + 1), Form(
"Cherenkov angle distribution in sector %d;Angle [rad];Events", i + 1),
117 Form(
"Number of hit per track in sector %d;Number of hits;Tracks", i + 1), 40, 0, 40);
118 h_secHapdHit[i] =
new TH1D(Form(
"hapdHit%d", i + 1), Form(
"Number of hits in each HAPD in sector %d;HAPD serial;Hits", i + 1), 70,
122 h_chDigit =
new TH1D(
"chDigit",
"Number of raw digits in each channel;Channel serial;Hits", 420 * 144, -0.5, 420 * 144 - 0.5);
123 h_chipDigit =
new TH1D(
"chipDigit",
"Number of raw digits in each chip;Chip serial;Hits", 420 * 4, -0.5, 420 * 4 - 0.5);
124 h_hapdDigit =
new TH1D(
"hapdDigit",
"Number of raw digits in each HAPD;HAPD serial;Hits", 420, 0.5, 421 - 0.5);
126 h_aerogelHits3D =
new TH3D(
"aerogelHits3D",
"Number of track associated hits for each aerogel tile; #phi section; r section", 125,
127 -0.5, 124.5, 20, 0, 20, 20, 0, 20);
129 "Cherenkov theta vs Cherenkov phi for mirror reflected photons; mirroID; #phi_{c} [rad]; #theta_{c} [rad]", 18, 0.5, 18.5, 100,
130 -M_PI, M_PI, 100, 0, 0.5);
131 h_thetaPhi =
new TH2D(
"thetaPhi",
"Cherenkov theta vs phi;#phi [rad];#theta_{c} [rad]", 100, -M_PI, M_PI, 100, 0., 0.5);
133 h_flashPerAPD =
new TH1D(
"flashPerAPD",
"Number of flashes per APD; APD serial; number of flash", 420 * 4, -0.5, 420 * 4 - 0.5);
135 h_ARICHOccAfterInjLer =
new TH1F(
"ARICHOccInjLER",
" ARICHOccInjLER /Time;Time in #mus;Nhits/Time (#mus bins)", 4000, 0, 20000);
136 h_ARICHOccAfterInjHer =
new TH1F(
"ARICHOccInjHER",
" ARICHOccInjHER /Time;Time in #mus;Nhits/Time (#mus bins)", 4000, 0, 20000);
137 h_ARICHEOccAfterInjLer =
new TH1F(
"ARICHEOccInjLER",
"ARICHEOccInjLER/Time;Time in #mus;Triggers/Time (#mus bins)", 4000, 0, 20000);
138 h_ARICHEOccAfterInjHer =
new TH1F(
"ARICHEOccInjHER",
"ARICHEOccInjHER/Time;Time in #mus;Triggers/Time (#mus bins)", 4000, 0, 20000);
152 h_bitsPerMergerNorm->SetOption(
"LIVE");
153 h_bitsPerHapdMerger->SetOption(
"LIVE");
156 h_bits->SetOption(
"LIVE");
166 for (
int i = 0; i < 6; i++) {
183 h_bitsPerMergerNorm->SetMinimum(0);
184 h_bitsPerHapdMerger->SetMinimum(0);
187 h_bitsPerChannel->SetMinimum(0);
199 for (
int i = 0; i < 6; i++) {
211 MCParticles.isOptional();
215 arichHits.isOptional();
217 arichDigits.isRequired();
219 arichTracks.isOptional();
221 arichAeroHits.isOptional();
223 likelihoods.isOptional();
240 h_bitsPerMergerNorm->Reset();
241 h_bitsPerHapdMerger->Reset();
245 h_bitsPerChannel->Reset();
258 for (
int i = 0; i < 6; i++) {
290 std::vector<int> apds(420 * 4, 0);
291 for (
const auto& digit : arichDigits) {
292 uint8_t bits = digit.getBitmap();
293 int moduleID = digit.getModuleID();
294 int channelID = digit.getChannelID();
295 int mergerID = arichMergerMap->getMergerID(moduleID);
296 int febSlot = arichMergerMap->getFEBSlot(moduleID);
297 unsigned binID = (mergerID - 1) * N_FEB2MERGER + (febSlot);
299 for (
int i = 0; i < 8; i++) {
300 if ((bits & (1 << i)) && !(bits & ~(1 << i))) {
302 h_bitsPerChannel->Fill(i, (moduleID - 1) * 144 + channelID);
303 h_bitsPerMergerNorm->Fill(i, mergerID);
304 h_bitsPerHapdMerger->Fill(i, binID);
307 h_bitsPerChannel->Fill(8, (moduleID - 1) * 144 + channelID);
308 h_bitsPerMergerNorm->Fill(8, mergerID);
309 h_bitsPerHapdMerger->Fill(8, binID);
314 h_chDigit ->Fill((moduleID - 1) * 144 + channelID);
315 int chip = (moduleID - 1) * 4 + channelID / 36;
322 for (
auto apd : apds) {
if (apd > 20)
h_flashPerAPD->Fill(iapd); iapd++;}
324 std::vector<int> hpd(420, 0);
327 for (
int i = 0; i < arichHits.getEntries(); i++) {
329 int moduleID = arichHits[i]->getModule();
330 int channelID = arichHits[i]->getChannel();
331 h_chHit->Fill((moduleID - 1) * 144 + channelID);
333 h_chipHit->Fill((moduleID - 1) * 4 + channelID / 36);
335 if (moduleID > 420) B2INFO(
"Invalid hapd number " <<
LogVar(
"hapd ID", moduleID));
337 for (
int j = 1; j <= 7; j++) {
338 int ringStart = (j - 1) * (84 + (j - 2) * 6) / 2 + 1;
339 int ringEnd = j * (84 + (j - 1) * 6) / 2;
340 if (ringStart <= moduleID && moduleID <= ringEnd) {
341 h_secHapdHit[(moduleID - ringStart) / (6 + j)]->Fill((moduleID - ringStart) % (6 + j) + 1 + (ringStart - 1) / 6);
345 int mergerID = arichMergerMap->getMergerID(moduleID);
355 for (
const auto& arichTrack : arichTracks) {
360 if (arichTrack.getMomentum() > 0.5) ntrk++;
363 TVector3 recPos = arichTrack.getPosition();
366 if (recPos.Phi() >= 0) {
369 dPhi = 2 * M_PI + recPos.Phi();
371 while (dPhi > M_PI / 3 && trSector < 5) {
375 double trR = recPos.XYvector().Mod();
377 if (recPos.Phi() >= 0) {
378 trPhi = recPos.Phi();
380 trPhi = 2 * M_PI + recPos.Phi();
385 while (arichGeoAero.
getRingRadius(iRing + 1) < trR && iRing < 4) {
388 if (iRing == 0)
continue;
389 while (arichGeoAero.
getRingDPhi(iRing) * (iAzimuth + 1) < trPhi) {
395 std::vector<ARICHPhoton> photons = arichTrack.getPhotons();
396 for (
auto& photon : photons) {
397 if (photon.getMirror() == 0) {
399 h_thetaPhi->Fill(photon.getPhiCer(), photon.getThetaCer());
400 h_theta->Fill(photon.getThetaCer());
403 double hitPhi = arichGeoDec.
getSlotPhi(arichHits[photon.getHitID()]->getModule());
404 if (hitPhi < 0) hitPhi += 2 * M_PI;
405 while (hitPhi > M_PI / 3 && hitSector < 5) {
409 h_secTheta[hitSector]->Fill(photon.getThetaCer());
411 if (trR > 95.)
h_mirrorThetaPhi->Fill(photon.getMirror(), photon.getPhiCer(), photon.getThetaCer());
417 const Track* mdstTrack = NULL;
440 B2DEBUG(29,
"TTD FTSW : " << hex << it.GetTTUtime(0) <<
" " << it.GetTTCtime(0) <<
" EvtNr " << it.GetEveNo(0) <<
" Type " <<
441 (it.GetTTCtimeTRGType(0) & 0xF) <<
" TimeSincePrev " << it.GetTimeSincePrevTrigger(0) <<
" TimeSinceInj " <<
442 it.GetTimeSinceLastInjection(0) <<
" IsHER " << it.GetIsHER(0) <<
" Bunch " << it.GetBunchNumber(0));
443 auto difference = it.GetTimeSinceLastInjection(0);
444 if (difference != 0x7FFFFFFF) {
445 unsigned int nentries = arichDigits.getEntries();
446 float diff2 = difference / 127.;
447 if (it.GetIsHER(0)) {
463 if (
h_theta->GetEntries() < 200)
return;
464 TF1* f1 =
new TF1(
"arichFitFunc",
"gaus(0)+pol1(3)", 0.25, 0.4);
465 f1->SetParameters(0.8 *
h_theta->GetMaximum(), 0.323, 0.016, 0, 0);
466 f1->SetParName(0,
"C");
467 f1->SetParName(1,
"mean");
468 f1->SetParName(2,
"sigma");
469 f1->SetParName(3,
"p0");
470 f1->SetParName(4,
"p1");
474 for (
int mergerID = 1; mergerID < 73; ++mergerID) {
476 for (
int febSlot = 1; febSlot < 7; ++febSlot) {
477 if (arichMergerMap->getModuleID(mergerID, febSlot) > 0) NHapd++;
481 for (
int i = 1; i <= 5; ++i) {
483 bin_value[i - 1] = h_bitsPerMergerNorm->GetBinContent(i, mergerID);
486 for (
int i = 1; i <= 5; ++i) {
488 h_bitsPerMergerNorm->SetBinContent(i, mergerID,
489 bin_value[i - 1] / (bin_value[3] + bin_value[2]) / NHapd);