Belle II Software  release-08-01-10
ECLExpertModule.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 <framework/datastore/StoreArray.h>
13 #include <framework/database/DBObjPtr.h>
14 
15 #include <mdst/dataobjects/ECLCluster.h>
16 #include <mdst/dataobjects/KlId.h>
17 
18 #include <mva/dataobjects/DatabaseRepresentationOfWeightfile.h>
19 #include <mva/interface/Weightfile.h>
20 #include <mva/interface/Expert.h>
21 
22 #include <string>
23 
24 
25 namespace Belle2 {
38  class ECLExpertModule : public Module {
39 
40  public:
41 
44 
46  virtual ~ECLExpertModule();
47 
49  virtual void initialize() override;
50 
52  virtual void beginRun() override;
53 
55  virtual void event() override;
56 
58  virtual void terminate() override
59  {
60  m_expert.reset();
61  m_dataset.reset();
62  }
63 
64  private:
65 
70  void init_mva(MVA::Weightfile& weightfile);
71 
72 
74  Double32_t m_ECLminTrkDistance; //[0.0, 250., 10]
75 
77  Double32_t m_ECLZ40; //[0.0, 1.7, 10]
78 
80  Double32_t m_ECLZ51; //[0.0, 1.2, 10]
81 
83  Double32_t m_ECLE1oE9; //[0.0, 1., 10]
84 
86  Double32_t m_ECLE9oE21; //[0.0, 1., 10]
87 
89  Double32_t m_ECLsecondMoment; //[0.0, 40.0, 10]
90 
92  Double32_t m_ECLLAT; //[0.0, 1., 10]
93 
95  Double32_t m_ECLnumberOfCrystals; //[0.0, 200.0, 10]
96 
98  Double32_t m_ECLtime; //[-1000.0, 1000.0, 12]
99 
101  Double32_t m_ECLdeltaTime99; //[0.0, 1000.0, 12]
102 
104  Double32_t m_ECLtheta; //[0.0, pi, 16]
105 
107  Double32_t m_ECLphi; //[-pi, pi, 16]
108 
110  Double32_t m_ECLr; //[75.0, 300.0, 16]
111 
113  Double32_t m_ECLDeltaL; //[75.0, 300.0, 16]
114 
116  Double32_t m_ECLPulseShapeDiscriminationMVA; //[0.0, 1.0, 18]
117 
119  Double32_t m_ECLNumberOfHadronDigits; //[0, 255, 18]
120 
122  Double32_t m_ECLZMVA;
123 
125  Double32_t m_ECLEnergy; //[-5, 3., 18]
126 
128  Double32_t m_ECLlogEnergy; //[-5, 3., 18]
129 
131  Double32_t m_ECLlogEnergyHighestCrystal; //[-5, 3., 18]
132 
137 
139  std::vector<float> m_feature_variables;
140 
142  std::string m_identifier =
143  "ECL_fBDT_1xBkgPhiGamma.xml";
144  // "ECL_fBDT_1xBkgpGunMulti.xml";
145  // "ECL_fBDT_test_mixedBkg50kv1.xml";
146  // "ECL_fBDT_mixedBkg10k"; // assuming 1 times beambkg and generic BBbar events
147 
149  std::unique_ptr<DBObjPtr<DatabaseRepresentationOfWeightfile>>
152  std::unique_ptr<MVA::Expert> m_expert;
154  std::unique_ptr<MVA::SingleDataset> m_dataset;
155 
156 
157  }; // end class
159 } // end namespace Belle2
Module to perform the ECL Klong ID classification.
Double32_t m_ECLtheta
Theta [rad].
StoreArray< KlId > m_klids
storearray
Double32_t m_ECLtime
Time.
Double32_t m_ECLphi
Phi [rad].
virtual void terminate() override
terminate and free
std::unique_ptr< MVA::SingleDataset > m_dataset
Pointer to the current dataset.
ECLExpertModule()
Constructor.
virtual void initialize() override
init
Double32_t m_ECLE1oE9
E1oE9.
Double32_t m_ECLminTrkDistance
Distance between cluster center and track extrapolation to ECL.
virtual void event() override
process event
Double32_t m_ECLEnergy
Energy [GeV].
Double32_t m_ECLlogEnergyHighestCrystal
Log.
std::unique_ptr< MVA::Expert > m_expert
Pointer to the current MVA Expert.
Double32_t m_ECLE9oE21
E9oE21.
virtual ~ECLExpertModule()
Destructor.
std::unique_ptr< DBObjPtr< DatabaseRepresentationOfWeightfile > > m_weightfile_representation
Database pointer to the Database representation of the weightfile.
Double32_t m_ECLdeltaTime99
Delta Time 99.
std::vector< float > m_feature_variables
vars to be classified
virtual void beginRun() override
begin run
Double32_t m_ECLZMVA
output of a BDT fitted on various Z-moments for the closest ECL cluster
Double32_t m_ECLnumberOfCrystals
Number of Crystals in a shower (sum of weights).
Double32_t m_ECLZ40
Zernike 40.
StoreArray< ECLCluster > m_eclClusters
storearray
Double32_t m_ECLr
Radius [cm].
Double32_t m_ECLPulseShapeDiscriminationMVA
MVA classifier that uses pulse shape discrimination to identify electromagnetic vs hadronic showers.
Double32_t m_ECLNumberOfHadronDigits
Number of hadron digits in cluster (pulse shape discrimination variable).
Double32_t m_ECLlogEnergy
Log.
Double32_t m_ECLsecondMoment
Second Moment.
Double32_t m_ECLDeltaL
DeltaL
void init_mva(MVA::Weightfile &weightfile)
Initialize mva expert, dataset and features Called every time the weightfile in the database changes ...
Double32_t m_ECLZ51
Zernike 51.
std::string m_identifier
mva identifier.
The Weightfile class serializes all information about a training into an xml tree.
Definition: Weightfile.h:38
Base class for Modules.
Definition: Module.h:72
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Abstract base class for different kinds of events.