Belle II Software  release-08-00-10
ECLBhabhaTCollectorModule.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 /* ECL headers. */
12 #include <ecl/mapper/ECLChannelMapper.h>
13 #include <ecl/utility/ECLTimingUtilities.h>
14 
15 /* Basf2 headers. */
16 #include <calibration/CalibrationCollectorModule.h>
17 #include <framework/core/Module.h>
18 #include <framework/database/DBObjPtr.h>
19 #include <framework/datastore/StoreArray.h>
20 #include <framework/dataobjects/EventMetaData.h>
21 #include <framework/dataobjects/EventT0.h>
22 #include <mdst/dataobjects/SoftwareTriggerResult.h>
23 
24 
25 class TTree;
26 
27 namespace Belle2 {
32  class ECLDigit;
33  class ECLCalDigit;
34  class Track;
35  class ECLCrystalCalib;
36  class ECLReferenceCrystalPerCrateCalib;
37  class ECLCluster;
38  class ECLChannelMapper;
39 
40  const static double realNaN = std::numeric_limits<double>::quiet_NaN();
41  const static int intNaN = std::numeric_limits<int>::quiet_NaN();
49 
50  public:
51 
54 
59 
61  void inDefineHisto() override;
62 
64  void prepare() override;
65 
67  void collect() override;
68 
69  private:
70 
72  bool m_saveTree;
73 
74 
81  std::unique_ptr< Belle2::ECL::ECLChannelMapper> m_crystalMapper =
82  std::make_unique<Belle2::ECL::ECLChannelMapper>();
83 
84 
92 
95 
99  std::vector<float> m_Electronics;
103  std::vector<float> m_ElectronicsTime;
107  std::vector<float> m_FlightTime;
111  std::vector<float> m_PreviousCrystalTime;
112  std::vector<float> m_PreviousCrystalTimeUnc;
116  std::vector<float> m_CrateTime;
117  std::vector<float> m_CrateTimeUnc;
121  std::vector<short> m_RefCrystalsCalib;
130  TTree* m_dbgTree_electrons = nullptr;
131  TTree* m_dbgTree_tracks = nullptr;
132  TTree* m_dbgTree_crystals = nullptr;
133  TTree* m_dbgTree_event = nullptr;
134  TTree* m_dbgTree_allCuts = nullptr;
135  TTree* m_dbgTree_evt_allCuts = nullptr;
136  TTree* m_dbgTree_crys_allCuts = nullptr;
138  /*** tree branches ***/
139  /*** See inDefineHisto method for branches description ***/
143  double m_tree_en = realNaN;
147  double m_tree_E1E2 = realNaN;
150  double m_tree_E1p = realNaN;
155  double m_tree_time = realNaN;
159  double m_tree_t0 = realNaN;
163  double m_tree_d0 = realNaN;
164  double m_tree_z0 = realNaN;
165  double m_tree_p = realNaN;
181 
195  int m_charge = intNaN;
196  double m_E_DIV_p = realNaN;
200  /*** tree branches END ***/
201 
202 
207  std::vector<float> m_EperCrys;
208  std::vector<int> m_eclCalDigitID;
209  std::vector<int> m_eclDigitID;
214  /****** Parameters for cuts ******/
215  short m_timeAbsMax;
220  /* d0 and z0 values of the loose and tight tracks*/
227  int m_runNum = intNaN;
229  bool m_storeCalib = true;
232  // For the energy dependence correction to the time
233  // t-t0 = p1 + pow( (p3/(amplitude+p2)), p4 ) + p5*exp(-amplitude/p6) ("Energy dependence equation")
234 
235  std::unique_ptr< Belle2::ECL::ECLTimingUtilities > m_ECLTimeUtil =
236  std::make_unique<Belle2::ECL::ECLTimingUtilities>();
241 
242  bool skipTrgSel;
245  };
247 }
Calibration collector module base class.
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
This module generates time vs crystal 2D histograms to later (in eclBhabhaTAlgorithm) find time cryst...
double m_tree_d0
Track d0 for debug TTree output.
double m_tree_maxEcrystNegClust
Time of the highest energy crystal in the cluster associated to negatively charged track,...
std::vector< float > m_CrateTime
vector obtained from DB object
std::vector< int > m_eclDigitID
ECL digit id sorter.
double m_tree_timeF
ECL fitting time for debug TTree output.
double m_tree_E1Etot
Energy of crystal with maximum energy within ECL cluster divided by total cluster energy,...
double m_tree_tClustNeg
Cluster time of cluster associated to negatively charged track, ns for debug TTree output.
DBObjPtr< ECLCrystalCalib > m_CrateTimeDB
Time offset from crate time calibration (also this calibration) from database.
TTree * m_dbgTree_crystals
Debug TTree output per crystal.
StoreObjPtr< EventT0 > m_eventT0
StoreObjPtr for T0.
StoreArray< ECLDigit > m_eclDigitArray
Required input array of ECLDigits.
double m_tree_clustCrysE
crystal energy, only for the crystals that meet all the selection criteria for debug TTree output
std::vector< float > m_FlightTime
vector obtained from DB object
double m_tree_timetsPreviousTimeCalibs
Time for Ts distribution after application of previous time calibrations for debug TTree output.
double m_looseTrkD0
Loose track d0 minimum cut.
double m_tree_E1E2
Energy of crystal with maximum energy within ECL cluster divided by second most energetic crystal in ...
double m_tree_ECLDigitAmplitude
Amplitude (used to calculate energy) of an ECLDigit within a cluster, for debug TTree output.
double m_tree_tClustPos
Cluster time of cluster associated to positively charged track, ns for debug TTree output.
int m_tree_quality
ECL fit quality for debug TTree output.
bool m_saveTree
If true, save TTree with more detailed event info.
double m_tree_enNeg
Energy of cluster associated to negatively charged track, GeV for debug TTree output.
DBObjPtr< ECLCrystalCalib > m_ElectronicsTimeDB
Time offset from electronics calibration from database.
double m_tree_tClust
Cluster time of a cluster, ns for debug TTree output.
double m_E_DIV_p
Energy divided by momentum, for debug TTree output.
double m_tree_en
Energy of crystal with maximum energy within ECL cluster, GeV for debug TTree output.
std::vector< int > m_eclCalDigitID
ECL cal digit id sorter.
bool m_storeCalib
Boolean for whether or not to store the previous calibration calibration constants.
StoreArray< ECLCluster > m_eclClusterArray
Required input array of ECLClusters.
short m_timeAbsMax
Events with abs(time) > m_timeAbsMax are excluded, mostly for histogram x-range purposes.
DBObjPtr< ECLReferenceCrystalPerCrateCalib > m_RefCrystalsCalibDB
Crystal IDs of the one reference crystal per crate from database.
int m_crystalCrate
Crate id for the crystal.
int m_tree_cid
ECL Cell ID (1..ECLElementNumbers::c_NCrystals) for debug TTree output.
double m_tree_time
Time for Ts distribution for debug TTree output.
double m_massInvTracks
invariant mass of the two tracks, for debug TTree output
double m_tree_nCDChits
Number of CDC hits along the track for debug TTree output.
double m_tree_enPlus
Energy of cluster associated to positively charged track, GeV for debug TTree output.
int m_tree_evtNum
Event number for debug TTree output.
double m_tightTrkZ0
Tight track z0 minimum cut.
DBObjPtr< Belle2::ECLChannelMap > m_channelMapDB
Mapper of ecl channels to various other objects, like crates.
std::vector< short > m_RefCrystalsCalib
vector obtained from DB object
double m_tree_t0_ECL_minChi2
EventT0 (from ECL) min chi2 for debug TTree output.
double m_tree_maxEcrystPosClust
Time of the highest energy crystal in the cluster associated to positively charged track,...
void collect() override
Select events and crystals and accumulate histograms.
std::vector< float > m_CrateTimeUnc
uncertainty vector obtained from DB object
TTree * m_dbgTree_allCuts
Debug TTree output after all cuts.
double m_tree_ECLCalDigitTime
Time of an ECLCalDigit within a cluster, ns for debug TTree output.
StoreArray< ECLCalDigit > m_eclCalDigitArray
Required input array of ECLCalDigits.
TTree * m_dbgTree_event
Debug TTree output per event.
double m_tree_z0
Track z0 for debug TTree output.
std::vector< float > m_EperCrys
ECL cal digit energy for each crystal.
bool skipTrgSel
flag to skip the trigger skim selection in the module
double m_tree_p
Track momentum for debug TTree output.
void prepare() override
Define histograms and read payloads from DB.
std::vector< float > m_PreviousCrystalTime
vector obtained from DB object
DBObjPtr< ECLCrystalCalib > m_PreviousCrystalTimeDB
Time offset from previous crystal time calibration (this calibration) from database.
double m_tightTrkD0
Tight track d0 minimum cut.
double m_tree_t0
EventT0 (not from ECL) for debug TTree output.
int m_tree_amp
Fitting amplitude from ECL for debug TTree output.
double m_tree_E1p
Energy of crystal with maximum energy within ECL cluster divided by total cluster energy divided by t...
TTree * m_dbgTree_evt_allCuts
Debug TTree output per event after all cuts.
std::vector< float > m_Electronics
vector obtained from DB object
void inDefineHisto() override
Replacement for defineHisto() in CalibrationCollector modules.
int m_charge
particle charge, for debug TTree output
TTree * m_dbgTree_electrons
Output tree with detailed event data.
std::vector< float > m_PreviousCrystalTimeUnc
vector obtained from DB object
std::unique_ptr< Belle2::ECL::ECLTimingUtilities > m_ECLTimeUtil
ECL timing tools.
StoreArray< Track > tracks
StoreArray for tracks.
double m_tree_t0_ECLclosestCDC
EventT0 (from ECL) closest to CDC for debug TTree output.
TTree * m_dbgTree_crys_allCuts
Debug TTree output per crystal after all cuts.
double m_tree_clustCrysE_DIV_maxEcrys
ratio of crystal energy to energy of the crystal that has the maximum energy, only for the crystals t...
DBObjPtr< ECLCrystalCalib > m_FlightTimeDB
Time offset from flight time b/w IP and crystal from database.
DBObjPtr< ECLCrystalCalib > m_ElectronicsDB
electronics amplitude calibration from database Scale amplitudefor each crystal and for dead pre-amps
double m_tree_ECLCalDigitE
Energy of an ECLCalDigit within a cluster, GeV for debug TTree output.
StoreObjPtr< EventMetaData > m_EventMetaData
Event metadata.
double m_tree_t0_unc
EventT0 uncertainty for debug TTree output.
std::unique_ptr< Belle2::ECL::ECLChannelMapper > m_crystalMapper
ECL object for keeping track of mapping between crystals and crates etc.
virtual ~ECLBhabhaTCollectorModule()
Module destructor.
double m_hadronEventT0_TO_bhabhaEventT0_correction
correction to apply to CDC event t0 values in bhabha events to correct for CDC event t0 bias compared...
std::vector< float > m_ElectronicsTime
vector obtained from DB object
StoreObjPtr< SoftwareTriggerResult > m_TrgResult
Store array for Trigger selection.
TTree * m_dbgTree_tracks
Debug TTree output per track.
double m_looseTrkZ0
Loose track z0 minimum cut.
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
static const double realNaN
constant for double NaN
static const int intNaN
constant for integer NaN
Abstract base class for different kinds of events.