Belle II Software  release-08-01-10
TOPBunchFinderModule.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 #include <framework/core/Module.h>
12 #include <map>
13 #include <framework/datastore/StoreArray.h>
14 #include <framework/datastore/StoreObjPtr.h>
15 #include <top/dataobjects/TOPDigit.h>
16 #include <top/dataobjects/TOPRawDigit.h>
17 #include <mdst/dataobjects/Track.h>
18 #include <top/dataobjects/TOPRecBunch.h>
19 #include <top/dataobjects/TOPTimeZero.h>
20 #include <framework/dataobjects/MCInitialParticles.h>
21 #include <framework/dataobjects/EventT0.h>
22 #include <framework/database/DBObjPtr.h>
23 #include <top/dbobjects/TOPCalCommonT0.h>
24 #include <top/dbobjects/TOPFrontEndSetting.h>
25 #include <top/dbobjects/TOPCalEventT0Offset.h>
26 #include <framework/dbobjects/BunchStructure.h>
27 #include <top/dbobjects/TOPCalFillPatternOffset.h>
28 
29 #include <top/reconstruction_cpp/PDFConstructor.h>
30 #include <top/utilities/Chi2MinimumFinder1D.h>
31 #include <framework/gearbox/Const.h>
32 
33 
34 namespace Belle2 {
44  class TOPBunchFinderModule : public Module {
45 
46  public:
47 
52 
57  virtual void initialize() override;
58 
62  virtual void beginRun() override;
63 
67  virtual void event() override;
68 
73  virtual void terminate() override;
74 
75  private:
76 
80  struct TimeSeed {
81  double t0 = 0;
82  double sigma = 0;
83  Const::EDetector detector = Const::TOP;
84  };
85 
91 
97  bool isBucketFilled(int bunchNo);
98 
106 
115  int setFinder(TOP::Chi2MinimumFinder1D& finder, const TOP::PDFConstructor& reco, double timeMin, double timeMax);
116 
117  // steering parameters
118  int m_numBins;
121  bool m_autoRange;
122  double m_sigmaSmear;
123  double m_minSignal;
124  double m_minSBRatio;
125  double m_minDERatio;
126  double m_maxDERatio;
127  double m_minPt;
128  double m_maxPt;
129  double m_maxD0;
130  double m_maxZ0;
134  double m_tau;
139  unsigned m_nTrackLimit;
143  // internal variables shared between events
144  double m_bunchTimeSep = 0;
145  std::map<int, double> m_priors;
146  double m_runningOffset = 0;
147  double m_runningError = 0;
148  bool m_HLTmode = false;
149  unsigned m_processed = 0;
150  unsigned m_success = 0;
151  int m_nodEdxCount = 0;
152  unsigned short m_revo9Counter = 0xFFFF;
153  bool m_isMC = false;
155  // collections
164  // database
171  };
172 
174 } // Belle2 namespace
175 
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:580
EDetector
Enum for identifying the detector components (detector and subdetector).
Definition: Const.h:42
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Base class for Modules.
Definition: Module.h:72
Optional DBObjPtr: This class behaves the same as the DBObjPtr except that it will not raise errors w...
Definition: DBObjPtr.h:48
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
Bunch finder: searches for the bunch crossing where the interaction happened using track-based TOP li...
double m_maxD0
maximal absolute value of helix perigee distance
unsigned m_nTrackLimit
maximum number of tracks (inclusive) to use three particle hypotheses in fine search
StoreObjPtr< TOPRecBunch > m_recBunch
reconstructed bunch
bool m_correctDigits
subtract bunch time in TOPDigits
DBObjPtr< TOPFrontEndSetting > m_feSetting
front-end settings
StoreObjPtr< EventT0 > m_eventT0
event T0
double m_minDERatio
minimal ratio of detected over expected photons
double m_sigmaSmear
additional smearing of PDF in [ns]
DBObjPtr< TOPCalCommonT0 > m_commonT0
common T0 calibration constants
bool m_HLTmode
use running average to correct digits
unsigned short m_revo9Counter
number of system clocks since last revo9 marker
int m_nodEdxCount
counter of tracks with no dEdx, reset at each event
double m_runningError
error on running average
int m_bunchesPerSSTclk
number of bunches per SST clock
bool m_useTimeSeed
use CDC or SVD event T0 as seed
bool m_saveHistograms
flag to save histograms
double m_minSignal
minimal number of signal photons
double m_maxZ0
maximal absolute value of helix perigee z coordnate
bool m_useFillPattern
use know fill pattern to enhance efficiency
int m_numBins
number of bins to which the fine search region is divided
bool m_subtractRunningOffset
subtract running offset when running in HLT mode
bool m_autoRange
determine coarse range automatically
double m_runningOffset
running average of bunch offset
int m_minNHitsCDC
minimal number of hits in CDC
unsigned m_success
events with reconstructed bunch
OptionalDBObjPtr< TOPCalFillPatternOffset > m_fillPatternOffset
fill pattern offset
double m_timeRangeFine
time range in which to do fine search [ns]
StoreArray< Track > m_tracks
collection of tracks
DBObjPtr< BunchStructure > m_bunchStructure
fill pattern
bool m_useMCTruth
use MC truth for mass instead of dEdx most probable
double m_minPt
minimal p_T of track
double m_tau
first order filter time constant [events]
OptionalDBObjPtr< TOPCalEventT0Offset > m_eventT0Offset
detector components offsets w.r.t TOP
double m_maxDERatio
maximal ratio of detected over expected photons
bool m_usePIDLikelihoods
if true, use PIDLikelihoods (only on cdst files)
double m_maxPt
maximal p_T of track
StoreArray< TOPRawDigit > m_topRawDigits
collection of TOP raw digits
unsigned m_processed
processed events
StoreArray< TOPTimeZero > m_timeZeros
collection of T0 of individual tracks
double m_bunchTimeSep
time between two bunches
double m_timeRangeCoarse
time range in which to do coarse search if autoRange turned off [ns]
std::map< int, double > m_priors
map of PDG codes to prior probabilities
StoreArray< TOPDigit > m_topDigits
collection of TOP digits
StoreObjPtr< MCInitialParticles > m_initialParticles
simulated beam particles
double m_minSBRatio
minimal signal-to-background ratio
Minimum finder using tabulated chi^2 values in one dimension.
PDF construction and log likelihood determination for a given track and particle hypothesis.
Class that bundles various TrackFitResults.
Definition: Track.h:25
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
Const::ChargedStable getMostProbable(const Track &track)
Returns most probable charged stable particle according to dEdx and predefined prior probabilities.
virtual void terminate() override
Termination action.
bool isBucketFilled(int bunchNo)
Does reconstructed bunch number correspond to filled bucket.
virtual void beginRun() override
Called when entering a new run.
int setFinder(TOP::Chi2MinimumFinder1D &finder, const TOP::PDFConstructor &reco, double timeMin, double timeMax)
Sets finder object with chi2 values.
TimeSeed getTimeSeed()
Returns a time seed.
Abstract base class for different kinds of events.
Structure to hold the time seed from a chosen detector component.
Const::EDetector detector
detector component