9 #include <svd/modules/svdDQM/SVDDQMInjectionModule.h>
10 #include "TDirectory.h"
29 setDescription(
"Monitor SVD Occupancy after Injection.");
30 setPropertyFlags(c_ParallelProcessingCertified);
31 addParam(
"histogramDirectoryName", m_histogramDirectoryName,
"Name of the directory where histograms will be placed.",
32 std::string(
"SVDInjection"));
33 addParam(
"ShaperDigits", m_SVDShaperDigitsName,
"Name of SVD ShaperDigits to count occupancy - usually ZS5 strips.",
37 void SVDDQMInjectionModule::defineHisto()
39 TDirectory* oldDir = gDirectory;
40 if (m_histogramDirectoryName !=
"") {
41 oldDir->mkdir(m_histogramDirectoryName.c_str());
42 oldDir->cd(m_histogramDirectoryName.c_str());
45 m_hOccAfterInjLER =
new TH1F(
"SVDOccInjLER",
"SVDOccInjLER/Time;Time in #mus;Count/Time (5 #mus bins)", 4000, 0, 20000);
46 m_hOccAfterInjHER =
new TH1F(
"SVDOccInjHER",
"SVDOccInjHER/Time;Time in #mus;Count/Time (5 #mus bins)", 4000, 0, 20000);
47 m_hTrgOccAfterInjLER =
new TH1F(
"SVDTrgOccInjLER",
"SVDTrgOccInjLER/Time;Time in #mus;Triggers/Time (5 #mus bins)", 4000, 0,
49 m_hTrgOccAfterInjHER =
new TH1F(
"SVDTrgOccInjHER",
"SVDTrgOccInjHER/Time;Time in #mus;Triggers/Time (5 #mus bins)", 4000, 0,
51 m_hMaxOccAfterInjLER =
new TH1F(
"SVDMaxOccInjLER",
"SVDMaxOccInjLER/Time;Time in #mus;Triggers/Time (5 #mus bins)", 4000, 0,
53 m_hMaxOccAfterInjHER =
new TH1F(
"SVDMaxOccInjHER",
"SVDMaxOccInjHER/Time;Time in #mus;Triggers/Time (5 #mus bins)", 4000, 0,
55 m_hBunchNumVSNStrips =
new TH2F(
"SVDBunchNumVSNStrips",
"SVDBunchNumVSNStrips;Bunch No.;Number of fired strips", 1280, 0, 1280, 10,
64 void SVDDQMInjectionModule::initialize()
68 m_rawTTD.isOptional();
69 m_digits.isOptional(m_SVDShaperDigitsName);
72 void SVDDQMInjectionModule::beginRun()
75 m_hOccAfterInjLER->Reset();
76 m_hOccAfterInjHER->Reset();
77 m_hTrgOccAfterInjLER->Reset();
78 m_hTrgOccAfterInjHER->Reset();
79 m_hMaxOccAfterInjLER->Reset();
80 m_hMaxOccAfterInjHER->Reset();
81 m_hBunchNumVSNStrips->Reset();
84 void SVDDQMInjectionModule::event()
87 if (!m_rawTTD.isValid()) {
88 B2WARNING(
"Missing RawFTSW, SVDDQMInjection is skipped.");
92 if (!m_digits.isValid()) {
93 B2WARNING(
"Missing " << m_SVDShaperDigitsName <<
", SVDDQMInjection is skipped.");
98 for (
auto& it : m_rawTTD) {
99 B2DEBUG(29,
"TTD FTSW : " << hex << it.GetTTUtime(0) <<
" " << it.GetTTCtime(0) <<
" EvtNr " << it.GetEveNo(0) <<
" Type " <<
100 (it.GetTTCtimeTRGType(0) & 0xF) <<
" TimeSincePrev " << it.GetTimeSincePrevTrigger(0) <<
" TimeSinceInj " <<
101 it.GetTimeSinceLastInjection(0) <<
" IsHER " << it.GetIsHER(0) <<
" Bunch " << it.GetBunchNumber(0));
104 auto difference = it.GetTimeSinceLastInjection(0);
106 if (difference != 0x7FFFFFFF) {
107 unsigned int allV = 0;
108 unsigned int allU = 0;
109 unsigned int nHitsL3v = 0;
110 unsigned int nHitsL3u = 0;
111 for (
auto& p : m_digits) {
112 if (p.isUStrip()) allU++;
115 if (p.getSensorID().getLayerNumber() != 3)
continue;
121 B2DEBUG(29,
"L3 V = " << nHitsL3v <<
", L3 U = " << nHitsL3u <<
", all V = " << allV <<
", all U = " << allU);
124 unsigned int counter = nHitsL3u;
126 float diff2 = difference / 127.;
127 if (it.GetIsHER(0)) {
128 m_hOccAfterInjHER->Fill(diff2, counter);
129 m_hTrgOccAfterInjHER->Fill(diff2);
130 auto bin = m_hMaxOccAfterInjHER->FindBin(diff2);
131 auto value = m_hMaxOccAfterInjHER->GetBinContent(bin);
132 if (counter > value) m_hMaxOccAfterInjHER->SetBinContent(bin, counter);
134 m_hOccAfterInjLER->Fill(diff2, counter);
135 m_hTrgOccAfterInjLER->Fill(diff2);
136 auto bin = m_hMaxOccAfterInjLER->FindBin(diff2);
137 auto value = m_hMaxOccAfterInjLER->GetBinContent(bin);
138 if (counter > value) m_hMaxOccAfterInjLER->SetBinContent(bin, counter);
141 m_hBunchNumVSNStrips->Fill(it.GetBunchNumber(0), allU + allV);
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
The SVD Occupancy after Injection DQM module.
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Namespace to encapsulate code needed for simulation and reconstrucion of the SVD.
Namespace to provide code needed by both Vertex Detectors, PXD and SVD, and also testbeam telescopes.
Abstract base class for different kinds of events.