9#include <svd/modules/svdDQM/SVDDQMDoseModule.h>
11#include <rawdata/dataobjects/RawFTSW.h>
12#include <svd/dataobjects/SVDShaperDigit.h>
13#include <mdst/dataobjects/TRGSummary.h>
14#include <vxd/dataobjects/VxdID.h>
17#include <vxd/geometry/GeoCache.h>
18#include <svd/geometry/SensorInfo.h>
19#include <TDirectory.h>
32 setDescription(
"The SVD dose-monitoring DQM module. Fills histograms of the SVD's instantaneous occupancy and "
33 "of SVD occupancy vs time since last injection and time in beam revolution cycle.");
36 "Types of events to include in the plots (1 = less than noInjectionTimeout after HER injection, "
37 "2 = less than noInjectionTimeout after LER injection, 4 = more than noInjectionTimeout after any "
38 "injection; bitwise or combinations are possible; see SVDDQMDoseModule::EEventType).", 7U);
40 "Name of the directory where histograms will be placed in the ROOT file.",
41 std::string(
"SVDDose"));
43 "Name of the SVDShaperDigits to use for computing occupancy (default is SVDShaperDigitsZS5).",
44 std::string(
"SVDShaperDigitsZS5"));
46 "Time (microseconds) since last injection after which an event is considered \"No Injection\". "
47 "Also the limit for the x axis of the 2D histograms.",
51 "Trigger types for event selection. Empty to select everything. "
52 "Default is only Poisson w/o inj. veto.",
58 TDirectory* oldDir = gDirectory;
69 "SVD Events;Time since last injection [#mus];Time in beam cycle [#mus];Events / bin",
73 TString name =
"SVDInstOccu_";
74 TString title =
"SVD Instantaneous Occupancy ";
75 TString axisTitle =
";Occupancy [%];Count / bin";
78 new TH1F(name + group.nameSuffix +
"U",
79 title + group.titleSuffix +
" U-side" + axisTitle,
80 group.nBins, group.xMin, group.xMax));
84 name =
"SVDHitsVsTime_";
86 axisTitle =
";Time since last injection [#mus];Time in beam cycle[#mus];Hits / bin";
89 new TH2F(name + group.nameSuffix +
"U",
90 title + group.titleSuffix +
" U-side" + axisTitle,
97 "SVDEvtsVsTime1",
"SVD Events;Time since last injection [#mus];Events / bin",
101 name =
"SVDHitsVsTime1_";
103 axisTitle =
";Time since last injection [#mus];Hits / bin";
106 new TH1F(name + group.nameSuffix +
"U",
107 title + group.titleSuffix +
" U-side" + axisTitle,
113 title =
"SVDBunchNumVSNStrips - ";
115 title +=
";Bunch No.;Number of fired strips;Events / bin";
116 h_bunchNumVsNHits =
new TH2F(
"SVDBunchNumVSNStrips", title, 1280, 0, 1280, 10, 0, 10000);
131 static bool nStripsComputed =
false;
134 nStripsComputed =
true;
137 for (
const auto& ladder : geo.
getLadders(layer)) {
138 for (
const auto& sensor : geo.
getSensors(ladder)) {
141 if (group.contains(sensor)) {
143 group.nStripsU += sInfo.getUCells();
172 B2WARNING(
"Missing TRGSummary, SVDDQMDose is skipped.");
176 bool discardEvent =
true;
179 discardEvent =
false;
188 B2WARNING(
"Missing RawFTSW, SVDDQMDose is skipped.");
193 <<
", SVDDQMDose is skipped.");
201 const bool isHER = theTTD->
GetIsHER(0);
208 for (
int& count : groupHitsU) count = 0;
212 const VxdID& sensorID = hit.getSensorID();
213 if (hit.isUStrip()) {
237 {
"L3XX",
"L3", c_defaultNBins, c_defaultOccuMin, c_defaultOccuMax, [](
const VxdID & s) {
return s.getLayerNumber() == 3; }},
238 {
"L4XX",
"L4", c_defaultNBins, c_defaultOccuMin, c_defaultOccuMax, [](
const VxdID & s) {
return s.getLayerNumber() == 4; }},
239 {
"L5XX",
"L5", c_defaultNBins, c_defaultOccuMin, c_defaultOccuMax, [](
const VxdID & s) {
return s.getLayerNumber() == 5; }},
240 {
"L6XX",
"L6", c_defaultNBins, c_defaultOccuMin, c_defaultOccuMax, [](
const VxdID & s) {
return s.getLayerNumber() == 6; }},
241 {
"L31X",
"L3.1", c_defaultNBins, c_defaultOccuMin, c_defaultOccuMax, [](
const VxdID & s) {
return s.getLayerNumber() == 3 && s.getLadderNumber() == 1; }},
242 {
"L32X",
"L3.2", c_defaultNBins, c_defaultOccuMin, c_defaultOccuMax, [](
const VxdID & s) {
return s.getLayerNumber() == 3 && s.getLadderNumber() == 2; }}
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.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
int GetIsHER(int n)
HER injection = 1 or LER injection = 0.
unsigned int GetTimeSinceLastInjection(int n)
Get time since the last injection.
unsigned int GetBunchNumber(int n)
Get a bunch number.
The SVD ShaperDigit class.
TH1F * h_nEvtsVsTime1
Hist of the total evts in each time bin (1D, time since inj.
unsigned int m_eventFilter
Bitmask for event type selection, see EEventType .
void initialize() override final
Overrides HistoModule::initialize.
TH2F * h_bunchNumVsNHits
Hist of bunch number vs number of fired strips (copied from SVDDQMInjection).
static const std::vector< SensorGroup > c_sensorGroups
List of interesting groups of sensors to average over.
StoreArray< RawFTSW > m_rawTTD
Input: DAQ status.
std::vector< TH1F * > m_groupNHits1U
Hists of the number of hits in each time bin (1D) per sensor group, U-side.
void defineHisto() override final
Overrides HistoModule::defineHisto.
StoreObjPtr< TRGSummary > m_trgSummary
Input: trigger type.
SVDDQMDoseModule()
Default constructor, defines parameters.
static constexpr double c_revolutionTime
Beam revolution time in microseconds (approximated).
void event() override final
Overrides HistoModule::event.
static constexpr double c_globalClock
Approximated global clock frequency in MHz.
double m_noInjectionTime
After this time (in microseconds) from last injection the event falls in the "No Injection" category.
std::vector< int > m_trgTypes
Trigger types to accept (all if the vector is empty).
std::string m_histogramDirectoryName
Name of the histograms' directory in the ROOT file.
std::vector< TH2F * > m_groupNHitsU
Hists of the number of hits in each time bin per sensor group, U-side.
StoreArray< SVDShaperDigit > m_digits
Input: raw hits.
std::vector< TH1F * > m_groupOccupanciesU
Hists of the instantaneous occupancy per sensor group (see c_sensorGroups), U-side.
TH2F * h_nEvtsVsTime
Hist of the total evts in each time bin (time since inj.
EEventType
Bits definition for the bitmask that selects the events to put in the histograms.
void beginRun() override final
Overrides HistoModule::beginRun.
std::string m_SVDShaperDigitsName
Name of the StoreArray of SVDShaperDigit to use.
@ TTYP_POIS
poisson random trigger
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
const std::set< Belle2::VxdID > getLayers(SensorInfoBase::SensorType sensortype=SensorInfoBase::VXD)
Return a set of all known Layers.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
const std::set< Belle2::VxdID > & getSensors(Belle2::VxdID ladder) const
Return a set of all sensor IDs belonging to a given ladder.
static GeoCache & getInstance()
Return a reference to the singleton instance.
const std::set< Belle2::VxdID > & getLadders(Belle2::VxdID layer) const
Return a set of all ladder IDs belonging to a given layer.
Class to uniquely identify a any structure of the PXD and SVD.
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.
Namespace to encapsulate code needed for simulation and reconstrucion of the SVD.
Abstract base class for different kinds of events.
A struct to define non-trivial histograms in a human-readable way.