Belle II Software  release-08-01-10
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/KLMElementNumbers.h>
17 #include <klm/dataobjects/KLMPlaneArrayIndex.h>
18 #include <klm/dbobjects/KLMChannelStatus.h>
19 
20 /* Basf2 headers. */
21 #include <analysis/dataobjects/ParticleList.h>
22 #include <framework/core/HistoModule.h>
23 #include <framework/database/DBObjPtr.h>
24 #include <framework/datastore/StoreArray.h>
25 #include <framework/datastore/StoreObjPtr.h>
26 #include <mdst/dataobjects/SoftwareTriggerResult.h>
27 #include <tracking/dataobjects/ExtHit.h>
28 
29 /* ROOT headers. */
30 #include <TH1F.h>
31 
32 /* C++ headers. */
33 #include <map>
34 #include <string>
35 
36 
37 namespace Belle2 {
50  class KLMDQM2Module : public HistoModule {
51 
52  public:
53 
55  struct HitData {
56 
59 
61  int section;
62 
64  int layer;
65 
67  int sector;
68 
70  int plane;
71 
73  int strip;
74 
76  double localPosition;
77 
79  const ExtHit* hit;
80 
82  const KLMDigit* digit;
83 
84  };
85 
89  KLMDQM2Module();
90 
95 
101  void defineHisto() override;
102 
104  virtual void initialize() override;
105 
107  virtual void beginRun() override;
108 
110  virtual void event() override;
111 
113  virtual void endRun() override;
114 
116  virtual void terminate() override;
117 
118 
119 
120  private:
121 
122  /*******************************************/
123  /*******************************************/
124  //PRE-DEFINED FUNCTIONS
125  /*******************************************/
126  /*******************************************/
127 
128 
133  void findMatchingDigit(struct HitData* hitData);
134 
148  bool collectDataTrack(const Particle* muon, TH1F* matchedHitsBKLM,
149  TH1F* allExtHitsBKLM, TH1F* matchedHitsEKLM,
150  TH1F* allExtHitsEKLM, TH1F* matchedHitsBKLMSec,
151  TH1F* allExtHitsBKLMSec, TH1F* matchedHitsEKLMSec,
152  TH1F* allExtHitsEKLMSec);
153 
160  void addHit(std::map<KLMPlaneNumber, struct HitData>& hitMap,
161  KLMPlaneNumber planeGlobal, struct HitData* hitData);
162 
168  bool triggerFlag();
169 
170  /*******************************************/
171  /*******************************************/
172  //INPUT RELATED
173  /*******************************************/
174  /*******************************************/
175 
178 
181 
184 
187 
190 
193 
196 
199 
202 
203  /*******************************************/
204  /*******************************************/
205  //MODULE PARAMETERS
206  /*******************************************/
207  /*******************************************/
208 
210  std::string m_MuonListName;
211 
215 
218 
221 
224 
227 
230 
233 
236 
237  /*******************************************/
238  /*******************************************/
239  //OUTPUT RELATED
240  /*******************************************/
241  /*******************************************/
242 
245 
248 
251 
254 
257 
260 
263 
266 
267 
268  /*******************************************/
269  /*******************************************/
270  //OTHER USEFUL VARIABLES
271  /*******************************************/
272  /*******************************************/
273 
275  const int m_PlaneNumBKLM = BKLMElementNumbers::getMaximalLayerGlobalNumber(); // 15 layers per octant, forward and backward
276 
278  const int m_PlaneNumEKLM = EKLMElementNumbers::getMaximalPlaneGlobalNumber(); // 12 or 14 layers per quadrant, forward and backward
279 
280  };
282 }
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:32
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:50
TH1F * m_MatchedHitsBKLMSector
Matched hits in sector for BKLM.
TH1F * m_MatchedHitsEKLM
Matched hits in plane for EKLM.
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.
TH1F * m_AllExtHitsBKLMSector
Extrapolated hits in sector for BKLM.
virtual void initialize() override
Register input and output data.
double m_MinimalMomentumNoOuterLayers
Minimal momentum in case there are no hits in outer layers.
bool m_RemoveUnusedMuons
Whether to remove unused muons.
virtual void event() override
Selection for mumu_tight_skim, then DQM plot filling
const KLMElementNumbers * m_ElementNumbers
KLM element numbers.
const KLMPlaneArrayIndex * m_PlaneArrayIndex
Plane array index.
virtual void endRun() override
Called if the current run ends.
const EKLMElementNumbers * m_eklmElementNumbers
EKLM element numbers.
virtual void terminate() override
Called at the end of the event processing.
void findMatchingDigit(struct HitData *hitData)
Find matching digit.
std::string m_SoftwareTriggerName
Software Trigger Name.
TH1F * m_AllExtHitsEKLMSector
Extrapolated hits in sector for EKLM.
TH1F * m_MatchedHitsBKLM
Matched hits in plane for BKLM.
StoreObjPtr< ParticleList > m_MuonList
Muons.
virtual void beginRun() override
Called when entering a new run.
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.
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:29
KLM element numbers.
KLM plane array index.
Class to store reconstructed particles.
Definition: Particle.h:75
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:96
Provides BKLM geometry parameters for simulation, reconstruction etc (from Gearbox or DataBase)
Definition: GeometryPar.h:37
uint16_t KLMPlaneNumber
Plane number.
Abstract base class for different kinds of events.
double localPosition
Local coordinate.
Definition: KLMDQM2Module.h:76
const KLMDigit * digit
Digit.
Definition: KLMDQM2Module.h:82
const ExtHit * hit
Extrapolation hit.
Definition: KLMDQM2Module.h:79