Belle II Software  release-08-01-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/database/DBObjPtr.h>
18 #include <framework/datastore/StoreArray.h>
19 #include <framework/dataobjects/EventMetaData.h>
20 #include <framework/dataobjects/EventT0.h>
21 #include <mdst/dataobjects/SoftwareTriggerResult.h>
22 
23 
24 class TTree;
25 
26 namespace Belle2 {
31  class ECLDigit;
32  class ECLCalDigit;
33  class Track;
34  class ECLCrystalCalib;
35  class ECLReferenceCrystalPerCrateCalib;
36  class ECLCluster;
37  class ECLChannelMapper;
38 
39  const static double realNaN = std::numeric_limits<double>::quiet_NaN();
40  const static int intNaN = std::numeric_limits<int>::quiet_NaN();
48 
49  public:
50 
53 
58 
60  void inDefineHisto() override;
61 
63  void prepare() override;
64 
66  void collect() override;
67 
68  private:
69 
71  bool m_saveTree;
72 
73 
80  std::unique_ptr< Belle2::ECL::ECLChannelMapper> m_crystalMapper =
81  std::make_unique<Belle2::ECL::ECLChannelMapper>();
82 
83 
91 
94 
98  std::vector<float> m_Electronics;
102  std::vector<float> m_ElectronicsTime;
106  std::vector<float> m_FlightTime;
110  std::vector<float> m_PreviousCrystalTime;
111  std::vector<float> m_PreviousCrystalTimeUnc;
115  std::vector<float> m_CrateTime;
116  std::vector<float> m_CrateTimeUnc;
120  std::vector<short> m_RefCrystalsCalib;
129  TTree* m_dbgTree_electrons = nullptr;
130  TTree* m_dbgTree_tracks = nullptr;
131  TTree* m_dbgTree_crystals = nullptr;
132  TTree* m_dbgTree_event = nullptr;
133  TTree* m_dbgTree_allCuts = nullptr;
134  TTree* m_dbgTree_evt_allCuts = nullptr;
135  TTree* m_dbgTree_crys_allCuts = nullptr;
137  /*** tree branches ***/
138  /*** See inDefineHisto method for branches description ***/
142  double m_tree_en = realNaN;
146  double m_tree_E1E2 = realNaN;
149  double m_tree_E1p = realNaN;
154  double m_tree_time = realNaN;
158  double m_tree_t0 = realNaN;
162  double m_tree_d0 = realNaN;
163  double m_tree_z0 = realNaN;
164  double m_tree_p = realNaN;
180 
194  int m_charge = intNaN;
195  double m_E_DIV_p = realNaN;
199  /*** tree branches END ***/
200 
201 
206  std::vector<float> m_EperCrys;
207  std::vector<int> m_eclCalDigitID;
208  std::vector<int> m_eclDigitID;
213  /****** Parameters for cuts ******/
214  short m_timeAbsMax;
219  /* d0 and z0 values of the loose and tight tracks*/
226  int m_runNum = intNaN;
228  bool m_storeCalib = true;
231  // For the energy dependence correction to the time
232  // t-t0 = p1 + pow( (p3/(amplitude+p2)), p4 ) + p5*exp(-amplitude/p6) ("Energy dependence equation")
233 
234  std::unique_ptr< Belle2::ECL::ECLTimingUtilities > m_ECLTimeUtil =
235  std::make_unique<Belle2::ECL::ECLTimingUtilities>();
240 
241  bool skipTrgSel;
244  };
246 }
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.