10 #include <arich/modules/arichDQM/ARICHDQMModule.h>
13 #include <arich/dbobjects/ARICHGeometryConfig.h>
14 #include <arich/dbobjects/ARICHChannelMapping.h>
15 #include <arich/dbobjects/ARICHMergerMapping.h>
16 #include <arich/dbobjects/ARICHGeoDetectorPlane.h>
17 #include <arich/dbobjects/ARICHGeoAerogelPlane.h>
18 #include <arich/dataobjects/ARICHHit.h>
19 #include <arich/dataobjects/ARICHDigit.h>
20 #include <arich/dataobjects/ARICHAeroHit.h>
21 #include <arich/dataobjects/ARICHTrack.h>
22 #include <arich/dataobjects/ARICHLikelihood.h>
23 #include <arich/dataobjects/ARICHPhoton.h>
25 #include <mdst/dataobjects/Track.h>
26 #include <mdst/dataobjects/MCParticle.h>
29 #include <framework/datastore/StoreArray.h>
32 #include <framework/database/DBObjPtr.h>
36 #include <TDirectory.h>
61 addParam(
"UpperMomentumLimit",
m_momUpLim,
"Upper momentum limit of tracks included in monitoring", 10.0);
62 addParam(
"LowerMomentumLimit",
m_momDnLim,
"Lower momentum limit of tracks included in monitoring", 2.5);
63 addParam(
"ArichEvents",
m_arichEvents,
"Include only hits from events where an extrapolated track to arich exists",
false);
64 addParam(
"MaxHits",
m_maxHits,
"Include only events with less than MaxHits hits in ARICH (remove loud events)", 70000);
65 addParam(
"MinHits",
m_minHits,
"Include only events with more than MinHits hits in ARICH", 0);
75 TDirectory* oldDir = gDirectory;
76 TDirectory* dirARICHDQM = oldDir->mkdir(
"ARICH");
81 h_chStat =
new TH1D(
"chStat",
"Status of channels;Channel serial;Status", 420 * 144, -0.5, 420 * 144 - 0.5);
82 h_aeroStat =
new TH1D(
"aeroStat",
"Status of aerogels;Aerogel tile serial;Status", 160, -0.5, 160 - 0.5);
83 h_chHit =
new TH1D(
"chHit",
"Number of hits in each channel;Channel serial;Hits", 420 * 144, -0.5, 420 * 144 - 0.5);
84 h_chipHit =
new TH1D(
"chipHit",
"Number of hits in each chip;Chip serial;Hits", 420 * 4, -0.5, 420 * 4 - 0.5);
85 h_hapdHit =
new TH1D(
"hapdHit",
"Number of hits in each HAPD;HAPD serial;Hits", 420, 0.5, 421 - 0.5);
86 h_hapdHitPerEvent =
new TH2D(
"hapdHitPerEvent",
"Number of hits in each HAPD per Event;HAPD serial;Hits/event", 420, 0.5, 420 + 0.5,
88 h_trackPerEvent =
new TH1D(
"trackPerEvent",
"Number of tracks in ARICH per event; # of tracks;Events", 6, -0.5, 5.5);
90 h_mergerHit =
new TH1D(
"mergerHit",
"Number of hits in each merger board;MB ID;Hits", 72, 0.5, 72 + 0.5);
91 h_bitsPerMergerNorm =
new TH2D(
"bitsPerMergerNorm",
"Normalised number of hits in each bit in each Merger;Bit;MB ID;Hits", 5,
93 4 - 0.5, 72, 0.5, 72 + 0.5);
94 h_bitsPerHapdMerger =
new TH2D(
"bitsPerHapdMerger",
95 "Number of hits in each bit in each Hapd sorted by mergers;Bit;HAPD unsorted;Hits", 5, -1 - 0.5,
96 4 - 0.5, 432, 1, 432);
98 h_aerogelHit =
new TH1D(
"aerogelHit",
"Number track associated hits in each aerogel tile;Aerogel slot ID;Hits", 125, -0.5,
100 h_bits =
new TH1D(
"bits",
"Number of hits in each bit;Bit;Hits", 5, -1 - 0.5,
102 h_bitsPerChannel =
new TH2D(
"bitsPerChannel",
"Number of hits in each bit in each chanenel;Bit;channel #;Hits", 4, - 0.5,
103 4 - 0.5, 420 * 144, -0.5, 420 * 144 - 0.5);
104 h_hitsPerTrack2D =
new TH2D(
"hitsPerTrack2D",
"2D distribution of track associated hits;X[cm];Y[cm];Hits", 230, -115, 115, 230,
106 h_tracks2D =
new TH2D(
"tracks2D",
"Distribution track positions;X[cm];Y[cm];Tracks", 230, -115, 115, 230, -115, 115);
108 h_hitsPerEvent =
new TH1D(
"hitsPerEvent",
"Number of hit per event;Number of hits;Events", 150, -0.5, 150 - 0.5);
109 h_theta =
new TH1D(
"theta",
"Cherenkov angle distribution;Angle [rad];Events", 60, 0, M_PI / 6);
110 h_hitsPerTrack =
new TH1D(
"hitsPerTrack",
"Number of hit per track;Number of hits;Tracks", 150, -0.5, 150 - 0.5);
112 for (
int i = 0; i < 6; i++) {
113 h_secTheta[i] =
new TH1D(Form(
"thetaSec%d", i + 1), Form(
"Cherenkov angle distribution in sector %d;Angle [rad];Events", i + 1),
116 Form(
"Number of hit per track in sector %d;Number of hits;Tracks", i + 1), 150, -0.5, 150 - 0.5);
117 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,
121 h_chDigit =
new TH1D(
"chDigit",
"Number of raw digits in each channel;Channel serial;Hits", 420 * 144, -0.5, 420 * 144 - 0.5);
122 h_chipDigit =
new TH1D(
"chipDigit",
"Number of raw digits in each chip;Chip serial;Hits", 420 * 4, -0.5, 420 * 4 - 0.5);
123 h_hapdDigit =
new TH1D(
"hapdDigit",
"Number of raw digits in each HAPD;HAPD serial;Hits", 420, 0.5, 421 - 0.5);
125 h_aerogelHits3D =
new TH3D(
"aerogelHits3D",
"Number of track associated hits for each aerogel tile; #phi section; r section", 125,
126 -0.5, 124.5, 20, 0, 20, 20, 0, 20);
128 "Cherenkov theta vs Cherenkov phi for mirror reflected photons; mirroID; #phi_{c} [rad]; #theta_{c} [rad]", 18, 0.5, 18.5, 100,
129 -M_PI, M_PI, 100, 0, 0.5);
130 h_thetaPhi =
new TH2D(
"thetaPhi",
"Cherenkov theta vs phi;#phi [rad];#theta_{c} [rad]", 100, -M_PI, M_PI, 100, 0., 0.5);
132 h_flashPerAPD =
new TH1D(
"flashPerAPD",
"Number of flashes per APD; APD serial; number of flash", 420 * 4, -0.5, 420 * 4 - 0.5);
134 h_ARICHOccAfterInjLer =
new TH1F(
"ARICHOccInjLER",
" ARICHOccInjLER /Time;Time in #mus;Nhits/Time (#mus bins)", 4000, 0, 20000);
135 h_ARICHOccAfterInjHer =
new TH1F(
"ARICHOccInjHER",
" ARICHOccInjHER /Time;Time in #mus;Nhits/Time (#mus bins)", 4000, 0, 20000);
136 h_ARICHEOccAfterInjLer =
new TH1F(
"ARICHEOccInjLER",
"ARICHEOccInjLER/Time;Time in #mus;Triggers/Time (#mus bins)", 4000, 0, 20000);
137 h_ARICHEOccAfterInjHer =
new TH1F(
"ARICHEOccInjHER",
"ARICHEOccInjHER/Time;Time in #mus;Triggers/Time (#mus bins)", 4000, 0, 20000);
151 h_bitsPerMergerNorm->SetOption(
"LIVE");
152 h_bitsPerHapdMerger->SetOption(
"LIVE");
155 h_bits->SetOption(
"LIVE");
165 for (
int i = 0; i < 6; i++) {
182 h_bitsPerMergerNorm->SetMinimum(0);
183 h_bitsPerHapdMerger->SetMinimum(0);
186 h_bitsPerChannel->SetMinimum(0);
198 for (
int i = 0; i < 6; i++) {
214 arichHits.isOptional();
239 h_bitsPerMergerNorm->Reset();
240 h_bitsPerHapdMerger->Reset();
244 h_bitsPerChannel->Reset();
257 for (
int i = 0; i < 6; i++) {
289 std::vector<int> apds(420 * 4, 0);
290 for (
const auto& digit : arichDigits) {
291 uint8_t bits = digit.getBitmap();
292 int moduleID = digit.getModuleID();
293 int channelID = digit.getChannelID();
294 int mergerID = arichMergerMap->getMergerID(moduleID);
295 int febSlot = arichMergerMap->getFEBSlot(moduleID);
296 unsigned binID = (mergerID - 1) * N_FEB2MERGER + (febSlot);
298 for (
int i = 0; i < 8; i++) {
299 if ((bits & (1 << i)) && !(bits & ~(1 << i))) {
301 h_bitsPerChannel->Fill(i, (moduleID - 1) * 144 + channelID);
302 h_bitsPerMergerNorm->Fill(i, mergerID);
303 h_bitsPerHapdMerger->Fill(i, binID);
306 h_bitsPerChannel->Fill(8, (moduleID - 1) * 144 + channelID);
307 h_bitsPerMergerNorm->Fill(8, mergerID);
308 h_bitsPerHapdMerger->Fill(8, binID);
313 h_chDigit ->Fill((moduleID - 1) * 144 + channelID);
314 int chip = (moduleID - 1) * 4 + channelID / 36;
321 for (
auto apd : apds) {
if (apd > 20)
h_flashPerAPD->Fill(iapd); iapd++;}
323 std::vector<int> hpd(420, 0);
326 for (
int i = 0; i < arichHits.getEntries(); i++) {
328 int moduleID = arichHits[i]->getModule();
329 int channelID = arichHits[i]->getChannel();
330 h_chHit->Fill((moduleID - 1) * 144 + channelID);
332 h_chipHit->Fill((moduleID - 1) * 4 + channelID / 36);
334 if (moduleID > 420) B2INFO(
"Invalid hapd number " <<
LogVar(
"hapd ID", moduleID));
336 for (
int j = 1; j <= 7; j++) {
337 int ringStart = (j - 1) * (84 + (j - 2) * 6) / 2 + 1;
338 int ringEnd = j * (84 + (j - 1) * 6) / 2;
339 if (ringStart <= moduleID && moduleID <= ringEnd) {
340 h_secHapdHit[(moduleID - ringStart) / (6 + j)]->Fill((moduleID - ringStart) % (6 + j) + 1 + (ringStart - 1) / 6);
344 int mergerID = arichMergerMap->getMergerID(moduleID);
354 for (
const auto& arichTrack : arichTracks) {
359 if (arichTrack.getMomentum() > 0.5) ntrk++;
362 TVector3 recPos = arichTrack.getPosition();
365 if (recPos.Phi() >= 0) {
368 dPhi = 2 * M_PI + recPos.Phi();
370 while (dPhi > M_PI / 3 && trSector < 5) {
374 double trR = recPos.XYvector().Mod();
376 if (recPos.Phi() >= 0) {
377 trPhi = recPos.Phi();
379 trPhi = 2 * M_PI + recPos.Phi();
384 while (arichGeoAero.
getRingRadius(iRing + 1) < trR && iRing < 4) {
387 if (iRing == 0)
continue;
388 while (arichGeoAero.
getRingDPhi(iRing) * (iAzimuth + 1) < trPhi) {
394 std::vector<ARICHPhoton> photons = arichTrack.getPhotons();
395 for (
auto& photon : photons) {
396 if (photon.getMirror() == 0) {
398 h_thetaPhi->Fill(photon.getPhiCer(), photon.getThetaCer());
399 h_theta->Fill(photon.getThetaCer());
402 double hitPhi = arichGeoDec.
getSlotPhi(arichHits[photon.getHitID()]->getModule());
403 if (hitPhi < 0) hitPhi += 2 * M_PI;
404 while (hitPhi > M_PI / 3 && hitSector < 5) {
408 h_secTheta[hitSector]->Fill(photon.getThetaCer());
410 if (trR > 95.)
h_mirrorThetaPhi->Fill(photon.getMirror(), photon.getPhiCer(), photon.getThetaCer());
416 const Track* mdstTrack = NULL;
423 if (!lkh->getFlag())
continue;
439 B2DEBUG(29,
"TTD FTSW : " << hex << it.GetTTUtime(0) <<
" " << it.GetTTCtime(0) <<
" EvtNr " << it.GetEveNo(0) <<
" Type " <<
440 (it.GetTTCtimeTRGType(0) & 0xF) <<
" TimeSincePrev " << it.GetTimeSincePrevTrigger(0) <<
" TimeSinceInj " <<
441 it.GetTimeSinceLastInjection(0) <<
" IsHER " << it.GetIsHER(0) <<
" Bunch " << it.GetBunchNumber(0));
442 auto difference = it.GetTimeSinceLastInjection(0);
443 if (difference != 0x7FFFFFFF) {
444 unsigned int nentries = arichDigits.
getEntries();
445 float diff2 = difference / 127.;
446 if (it.GetIsHER(0)) {
462 if (
h_theta->GetEntries() < 200)
return;
463 TF1* f1 =
new TF1(
"arichFitFunc",
"gaus(0)+pol1(3)", 0.25, 0.4);
464 f1->SetParameters(0.8 *
h_theta->GetMaximum(), 0.323, 0.016, 0, 0);
465 f1->SetParName(0,
"C");
466 f1->SetParName(1,
"mean");
467 f1->SetParName(2,
"sigma");
468 f1->SetParName(3,
"p0");
469 f1->SetParName(4,
"p1");
473 for (
int mergerID = 1; mergerID < 73; ++mergerID) {
475 for (
int febSlot = 1; febSlot < 7; ++febSlot) {
476 if (arichMergerMap->getModuleID(mergerID, febSlot) > 0) NHapd++;
480 for (
int i = 1; i <= 5; ++i) {
482 bin_value[i - 1] = h_bitsPerMergerNorm->GetBinContent(i, mergerID);
485 for (
int i = 1; i <= 5; ++i) {
487 h_bitsPerMergerNorm->SetBinContent(i, mergerID,
488 bin_value[i - 1] / (bin_value[3] + bin_value[2]) / NHapd);
TH1 * h_chipDigit
The number of raw digits in each ASIC chip.
TH2 * h_hitsPerTrack2D
Sum of 2D hit/track map on each position of track.
TH1 * h_chipHit
The number of hits in each ASIC chip.
int m_maxHits
exclude events with very large number of hits in arich
TH1 * h_ARICHEOccAfterInjHer
Histogram for Nr Entries (=Triggrs) for normalization after HER injection.
TH3 * h_aerogelHits3D
3D histogram of
int m_minHits
exclude events with number of hits lower than this
TH1 * h_flashPerAPD
Number of flashes in each APD.
TH1 * h_hitsPerTrack
Average hits/track calculated from h_hits2D and h_track2D.
TH1 * h_trackPerEvent
Number of tracks in ARICH per event (with p>0.5 GeV)
TH1 * h_ARICHOccAfterInjLer
Histogram Ndigits after LER injection.
StoreArray< RawFTSW > m_rawFTSW
Input array for DAQ Status.
TH1 * h_chDigit
The number of raw digits in each channel.
TH1 * h_aerogelHit
The number of reconstructed photons in each aerogel tiles.
TH1 * h_mergerHit
The number of hits in each Merger Boards.
double m_momDnLim
Lower momentum limit of tracks used in GeV (if set 0, no limit is applied)
double m_momUpLim
Upper momentum limit of tracks used in GeV (if set 0, no limit is applied)
TH1 * h_theta
Reconstructed Cherenkov angles.
TH2 * h_thetaPhi
cherenkov theta vs phi for non-mirror-reflected photons
TH1 * h_aeroStat
Status of each aerogel tiles.
TH1 * h_ARICHOccAfterInjHer
Histogram Ndigits after HER injection.
TH3 * h_mirrorThetaPhi
cherenkov theta vs phi for mirror reflected photons (for each mirror plate)
TH2 * h_hapdHitPerEvent
number of hits in each HAPD per event
TH1 * h_hapdDigit
The number of raw digits in each HAPD.
TH1 * h_chHit
The number of hits in each channel.
bool m_arichEvents
process only events that have extrapolated hit in arich
TH1 * h_chStat
Status of each channels.
TH1 * h_secHitsPerTrack[6]
Detailed average hits/track for each sector.
TH1 * h_hapdHit
The number of hits in each HAPD.
TH1 * h_ARICHEOccAfterInjLer
Histogram for Nr Entries (=Triggrs) for normalization after LER injection.
TH1 * h_secTheta[6]
Detailed view of Cherenkov angle for each sector.
TH1 * h_hitsPerEvent
Ihe number of all hits in each event.
TH2 * h_tracks2D
2D track distribution of whole ARICH
TH1 * h_secHapdHit[6]
The number of hits in each HAPDs of each sector.
Geometry parameters of HAPD.
double getRingDPhi(unsigned iRing) const
Get phi (angle) distance between "phi" aluminum wall between aerogel tiles in i-th tile ring.
double getRingRadius(unsigned iRing) const
Get radius of i-th aluminum ring between aerogel tiles (inner radius of ring)
unsigned getAerogelTileID(double x, double y) const
Get ID of aerogel tile containing point (x,y) (actually this is tile slot ID, as it is the same for a...
Geometry parameters of ARICH photon detector plane.
double getSlotPhi(unsigned modID) const
Get phi (angle) position of module with given module ID number.
This is a class to store ARICH likelihoods in the datastore.
float getDetPhot() const
Return number of detected photons for a given particle.
Class for accessing objects in the database.
Store one Ext hit as a ROOT object.
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
void setReturnValue(int value)
Sets the return value for this module as integer.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
int getEntries() const
Get the number of objects in the array.
Class that bundles various TrackFitResults.
Class to store variables with their name which were sent to the logging service.
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
virtual void endRun() override
End-of-run action.
virtual void terminate() override
Termination action.
virtual void beginRun() override
Called when entering a new run.
virtual ~ARICHDQMModule()
Destructor.
virtual void defineHisto() override
Function to define histograms.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.