Belle II Software  release-06-02-00
KLMDQM2Module.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 /* KLM headers. */
12 #include <klm/bklm/geometry/GeometryPar.h>
13 #include <klm/dataobjects/bklm/BKLMElementNumbers.h>
14 #include <klm/dataobjects/eklm/EKLMElementNumbers.h>
15 #include <klm/dataobjects/KLMDigit.h>
16 #include <klm/dataobjects/KLMChannelArrayIndex.h>
17 #include <klm/dataobjects/KLMElementNumbers.h>
18 #include <klm/dataobjects/KLMPlaneArrayIndex.h>
19 #include <klm/dbobjects/KLMChannelStatus.h>
20 
21 /* Belle 2 headers. */
22 #include <analysis/dataobjects/ParticleList.h>
23 #include <framework/core/HistoModule.h>
24 #include <framework/database/DBObjPtr.h>
25 #include <framework/datastore/StoreArray.h>
26 #include <framework/datastore/StoreObjPtr.h>
27 #include <mdst/dataobjects/SoftwareTriggerResult.h>
28 #include <tracking/dataobjects/ExtHit.h>
29 
30 /* ROOT headers. */
31 #include <TH1F.h>
32 
33 /* C++ headers. */
34 #include <map>
35 #include <string>
36 
37 
38 namespace Belle2 {
51  class KLMDQM2Module : public HistoModule {
52 
53  public:
54 
56  struct HitData {
57 
60 
62  int section;
63 
65  int layer;
66 
68  int sector;
69 
71  int plane;
72 
74  int strip;
75 
77  double localPosition;
78 
80  const ExtHit* hit;
81 
83  const KLMDigit* digit;
84 
85  };
86 
90  KLMDQM2Module();
91 
96 
102  void defineHisto() override;
103 
105  virtual void initialize() override;
106 
108  virtual void beginRun() override;
109 
111  virtual void event() override;
112 
114  virtual void endRun() override;
115 
117  virtual void terminate() override;
118 
119 
120 
121  private:
122 
123  /*******************************************/
124  /*******************************************/
125  //PRE-DEFINED FUNCTIONS
126  /*******************************************/
127  /*******************************************/
128 
129 
134  void findMatchingDigit(struct HitData* hitData);
135 
149  bool collectDataTrack(const Particle* muon, TH1F* matchedHitsBKLM,
150  TH1F* allExtHitsBKLM, TH1F* matchedHitsEKLM,
151  TH1F* allExtHitsEKLM, TH1F* matchedHitsBKLMSec,
152  TH1F* allExtHitsBKLMSec, TH1F* matchedHitsEKLMSec,
153  TH1F* allExtHitsEKLMSec);
154 
161  void addHit(std::map<KLMPlaneNumber, struct HitData>& hitMap,
162  KLMPlaneNumber planeGlobal, struct HitData* hitData);
163 
169  bool triggerFlag();
170 
171  /*******************************************/
172  /*******************************************/
173  //INPUT RELATED
174  /*******************************************/
175  /*******************************************/
176 
179 
182 
185 
188 
191 
194 
197 
200 
203 
204  /*******************************************/
205  /*******************************************/
206  //MODULE PARAMETERS
207  /*******************************************/
208  /*******************************************/
209 
211  std::string m_MuonListName;
212 
216 
219 
222 
225 
228 
231 
234 
235  /*******************************************/
236  /*******************************************/
237  //OUTPUT RELATED
238  /*******************************************/
239  /*******************************************/
240 
243 
246 
249 
252 
255 
258 
261 
264 
265 
266  /*******************************************/
267  /*******************************************/
268  //OTHER USEFUL VARIABLES
269  /*******************************************/
270  /*******************************************/
271 
273  const int m_PlaneNumBKLM = BKLMElementNumbers::getMaximalLayerGlobalNumber(); //15 layers per octant, forward and backward
274 
276  const int m_PlaneNumEKLM = EKLMElementNumbers::getMaximalPlaneGlobalNumber(); //12 or 14 layers per quadrant, forward and backward
277 
278  };
280 }
static constexpr int getMaximalLayerGlobalNumber()
Get maximal layer global number.
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
EKLM element numbers.
static constexpr int getMaximalPlaneGlobalNumber()
Get maximal plane global number.
Store one Ext hit as a ROOT object.
Definition: ExtHit.h:30
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
Additional Module for KLMDQM plots after HLT filters.
Definition: KLMDQM2Module.h:51
TH1F * m_MatchedHitsBKLMSector
Matched hits in sector for BKLM.
TH1F * m_MatchedHitsEKLM
Matched hits in plane for EKLM.
virtual void endRun() override
Called if the current run ends.
const bklm::GeometryPar * m_GeometryBKLM
BKLM geometry.
void addHit(std::map< KLMPlaneNumber, struct HitData > &hitMap, KLMPlaneNumber planeGlobal, struct HitData *hitData)
Add hit to map.
StoreArray< KLMDigit > m_Digits
KLM digits.
DBObjPtr< KLMChannelStatus > m_ChannelStatus
Channel status.
virtual void terminate() override
Called at the end of the event processing.
TH1F * m_AllExtHitsBKLMSector
Extrapolated hits in sector for BKLM.
double m_MinimalMomentumNoOuterLayers
Minimal momentum in case there are no hits in outer layers.
bool m_RemoveUnusedMuons
Whether to remove unused muons.
const KLMElementNumbers * m_ElementNumbers
KLM element numbers.
const KLMPlaneArrayIndex * m_PlaneArrayIndex
Plane array index.
const EKLMElementNumbers * m_eklmElementNumbers
Element numbers.
void findMatchingDigit(struct HitData *hitData)
Find matching digit.
TH1F * m_AllExtHitsEKLMSector
Extrapolated hits in sector for EKLM.
TH1F * m_MatchedHitsBKLM
Matched hits in plane for BKLM.
virtual void event() override
Selection for mumu_tight_skim, then DQM plot filling
StoreObjPtr< ParticleList > m_MuonList
Muons.
virtual void initialize() override
Register input and output data.
bool m_IgnoreBackwardPropagation
Whether to ignore ExtHits with backward propagation.
double m_AllowedDistance1D
Maximal distance in the units of strip number from ExtHit to matching KLMDigit.
virtual void beginRun() override
Called when entering a new run.
KLMDQM2Module()
Constructor: Sets the description, the properties and the parameters of the module.
~KLMDQM2Module()
Destructor.
TH1F * m_AllExtHitsBKLM
Extrapolated hits in plane for BKLM.
TH1F * m_MatchedHitsEKLMSector
Matched hits in sector for EKLM.
StoreArray< ExtHit > m_extHits
ExtHits.
const int m_PlaneNumBKLM
Number of layers/planes for BKLM.
int m_MinimalMatchingDigitsOuterLayers
Minimal number of matching digits in outer layers.
std::string m_MuonListName
Muon list name.
int m_MinimalMatchingDigits
Minimal number of matching digits.
StoreObjPtr< SoftwareTriggerResult > m_softwareTriggerResult
Trigger Information.
const int m_PlaneNumEKLM
Number of layers/planes for EKLM.
TH1F * m_AllExtHitsEKLM
Extrapolated hits in plane for EKLM.
bool collectDataTrack(const Particle *muon, TH1F *matchedHitsBKLM, TH1F *allExtHitsBKLM, TH1F *matchedHitsEKLM, TH1F *allExtHitsEKLM, TH1F *matchedHitsBKLMSec, TH1F *allExtHitsBKLMSec, TH1F *matchedHitsEKLMSec, TH1F *allExtHitsEKLMSec)
Collect the data for one muon.
bool triggerFlag()
Uses TrigResult along with desired software cut to determine whether histograms are filled or not for...
std::string m_HistogramDirectoryName
Directory for KLM DQM histograms in ROOT file.
void defineHisto() override
Definition of the histograms.
KLM digit (class representing a digitized hit in RPCs or scintillators).
Definition: KLMDigit.h:30
KLM element numbers.
KLM plane array index.
Class to store reconstructed particles.
Definition: Particle.h:74
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:95
Provides BKLM geometry parameters for simulation, reconstruction etc (from Gearbox or DataBase)
Definition: GeometryPar.h:38
uint16_t KLMPlaneNumber
Plane number.
Abstract base class for different kinds of events.
double localPosition
Local coordinate.
Definition: KLMDQM2Module.h:77
const KLMDigit * digit
Digit.
Definition: KLMDQM2Module.h:83
const ExtHit * hit
Extrapolation hit.
Definition: KLMDQM2Module.h:80