Belle II Software  release-05-02-19
SVDCoGTimeEstimatorModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Michael De Nuccio, Giulia Casarosa *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 
12 #pragma once
13 
14 #include <framework/core/Module.h>
15 #include <framework/datastore/RelationArray.h>
16 #include <framework/datastore/StoreArray.h>
17 #include <svd/dataobjects/SVDEventInfo.h>
18 #include <svd/dataobjects/SVDShaperDigit.h>
19 #include <svd/dataobjects/SVDRecoDigit.h>
20 #include <svd/calibration/SVDPulseShapeCalibrations.h>
21 #include <svd/calibration/SVDNoiseCalibrations.h>
22 #include <svd/calibration/SVDCoGTimeCalibrations.h>
23 
24 #include <mdst/dataobjects/MCParticle.h>
25 #include <svd/dataobjects/SVDTrueHit.h>
26 
27 #include <string>
28 
29 namespace Belle2 {
46  class SVDCoGTimeEstimatorModule : public Module {
47  public:
48 
50  typedef std::vector<const RelationElement*> RelationLookup;
51 
54 
57 
59  virtual void initialize() override;
60 
62  virtual void beginRun() override;
63 
65  virtual void event() override;
66 
68  virtual void endRun() override;
69 
71  virtual void terminate() override;
72 
73 
74  private:
75 
86  float m_weightedMeanTime = 0;
89 
91  float m_amplitude = 0;
93  float m_amplitudeError = 0;
94 
96  float m_chi2 = 0;
97 
99  float m_DeltaT = 31.44; //ns
100 
102  bool m_StopCreationReco = false;
103 
104  protected:
105 
120  void createRelationLookup(const RelationArray& relation, RelationLookup& lookup,
121  size_t digits);
122 
128  void fillRelationMap(const RelationLookup& lookup, std::map<unsigned int, float>&
129  relation, unsigned int index);
130 
131  // Relation lookups
136 
138  std::string m_svdEventInfoName = "SVDEventInfo";
140  std::string m_storeMCParticlesName = "MCParticles";
142  std::string m_storeTrueHitsName = "SVDTrueHits";
144  std::string m_storeShaperDigitsName = "SVDShaperDigits";
146  std::string m_storeRecoDigitsName = "SVDRecoDigits";
149 
151  bool m_calEventT0 = true;
152  bool m_corrPeakTime = true;
155  std::string m_relShaperDigitMCParticleName = "";
157  std::string m_relShaperDigitTrueHitName = "";
161  std::string m_relRecoDigitTrueHitName = "";
162 
164  float m_AmplitudeArbitraryError = 10;
165 
173  float CalculateAmplitudeError(VxdID ThisSensorID, bool ThisSide, int ThisCellID);
175  float CalculateChi2();
176 
177  //calibration objects
183  int m_NumberOfAPVSamples = 6;
184 
185  };
187 }
188 
189 
190 
191 
192 
193 
194 
195 
196 
197 
198 
199 
200 
201 
202 
203 
204 
205 
206 
207 
208 
209 
210 
211 
212 
213 
214 
Belle2::SVDCoGTimeEstimatorModule::~SVDCoGTimeEstimatorModule
virtual ~SVDCoGTimeEstimatorModule()
default destructor
Definition: SVDCoGTimeEstimatorModule.cc:45
Belle2::SVDCoGTimeEstimatorModule::endRun
virtual void endRun() override
This method is called if the current run ends.
Definition: SVDCoGTimeEstimatorModule.cc:233
Belle2::SVDCoGTimeEstimatorModule::m_corrPeakTime
bool m_corrPeakTime
correction of peakTime per strip from local calibrations
Definition: SVDCoGTimeEstimatorModule.h:160
Belle2::SVDCoGTimeEstimatorModule::m_StopCreationReco
bool m_StopCreationReco
To stop creation of the SVDShaperDigit if something is wrong.
Definition: SVDCoGTimeEstimatorModule.h:110
Belle2::RelationArray
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:72
Belle2::SVDCoGTimeEstimatorModule::CalculateAmplitudeError
float CalculateAmplitudeError(VxdID ThisSensorID, bool ThisSide, int ThisCellID)
Function to calculate the amplitude error as the noise of the strip.
Definition: SVDCoGTimeEstimatorModule.cc:296
Belle2::SVDCoGTimeCalibrations
This class defines the dbobject and the methods to access the SVD calibrations from the local runs pr...
Definition: SVDCoGTimeCalibrations.h:40
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::SVDCoGTimeEstimatorModule::m_weightedMeanTimeError
float m_weightedMeanTimeError
The peak time estimation error.
Definition: SVDCoGTimeEstimatorModule.h:96
Belle2::SVDCoGTimeEstimatorModule::RelationLookup
std::vector< const RelationElement * > RelationLookup
Container for a RelationArray Lookup table.
Definition: SVDCoGTimeEstimatorModule.h:58
Belle2::SVDCoGTimeEstimatorModule::m_amplitudeError
float m_amplitudeError
The shaper amplitude estimation error.
Definition: SVDCoGTimeEstimatorModule.h:101
Belle2::SVDCoGTimeEstimatorModule::m_mcRelation
RelationLookup m_mcRelation
Lookup table for SVDShaperDigit->MCParticle relation.
Definition: SVDCoGTimeEstimatorModule.h:141
Belle2::SVDCoGTimeEstimatorModule::initialize
virtual void initialize() override
Initialize the SVDCoGTimeEstimator.
Definition: SVDCoGTimeEstimatorModule.cc:50
Belle2::SVDCoGTimeEstimatorModule::m_storeReco
StoreArray< SVDRecoDigit > m_storeReco
SVDRecoDigits store array.
Definition: SVDCoGTimeEstimatorModule.h:86
Belle2::SVDCoGTimeEstimatorModule::m_relRecoDigitTrueHitName
std::string m_relRecoDigitTrueHitName
Name of the relation between SVDRecoDigits and SVDTrueHits.
Definition: SVDCoGTimeEstimatorModule.h:169
Belle2::SVDCoGTimeEstimatorModule::m_PulseShapeCal
SVDPulseShapeCalibrations m_PulseShapeCal
SVDPulseShaper calibrations db object.
Definition: SVDCoGTimeEstimatorModule.h:186
Belle2::SVDCoGTimeEstimatorModule::m_weightedMeanTime
float m_weightedMeanTime
The peak time estimation.
Definition: SVDCoGTimeEstimatorModule.h:94
Belle2::SVDCoGTimeEstimatorModule::m_relShaperDigitMCParticleName
std::string m_relShaperDigitMCParticleName
Name of the relation between SVDShaperDigits and MCParticles.
Definition: SVDCoGTimeEstimatorModule.h:163
Belle2::SVDCoGTimeEstimatorModule::m_DeltaT
float m_DeltaT
Time width of a sampling.
Definition: SVDCoGTimeEstimatorModule.h:107
Belle2::SVDCoGTimeEstimatorModule::m_NumberOfAPVSamples
int m_NumberOfAPVSamples
number of samples
Definition: SVDCoGTimeEstimatorModule.h:191
Belle2::SVDCoGTimeEstimatorModule::terminate
virtual void terminate() override
This method is called at the end of the event processing.
Definition: SVDCoGTimeEstimatorModule.cc:238
Belle2::SVDCoGTimeEstimatorModule::event
virtual void event() override
This method is the core of the SVDCoGTimeEstimator.
Definition: SVDCoGTimeEstimatorModule.cc:104
Belle2::SVDCoGTimeEstimatorModule::m_storeTrueHitsName
std::string m_storeTrueHitsName
Name of the collection to use for the SVDTrueHits.
Definition: SVDCoGTimeEstimatorModule.h:150
Belle2::SVDCoGTimeEstimatorModule::CalculateWeightedMeanPeakTimeError
float CalculateWeightedMeanPeakTimeError(Belle2::SVDShaperDigit::APVFloatSamples samples)
Function to calculate the peak time error.
Definition: SVDCoGTimeEstimatorModule.cc:276
Belle2::SVDCoGTimeEstimatorModule::m_storeMCParticles
StoreArray< MCParticle > m_storeMCParticles
MCParticles Store array.
Definition: SVDCoGTimeEstimatorModule.h:89
Belle2::SVDShaperDigit::APVFloatSamples
std::array< APVFloatSampleType, c_nAPVSamples > APVFloatSamples
array of APVFloatSampleType objects
Definition: SVDShaperDigit.h:63
Belle2::SVDCoGTimeEstimatorModule::m_NoiseCal
SVDNoiseCalibrations m_NoiseCal
SVDNoise calibrations db object.
Definition: SVDCoGTimeEstimatorModule.h:187
Belle2::SVDCoGTimeEstimatorModule::m_amplitude
float m_amplitude
The shaper amplitude estimation.
Definition: SVDCoGTimeEstimatorModule.h:99
Belle2::SVDCoGTimeEstimatorModule::m_relRecoDigitShaperDigitName
std::string m_relRecoDigitShaperDigitName
Name of the relation between SVDRecoDigits and SVDShaperDigits.
Definition: SVDCoGTimeEstimatorModule.h:156
Belle2::SVDCoGTimeEstimatorModule::fillRelationMap
void fillRelationMap(const RelationLookup &lookup, std::map< unsigned int, float > &relation, unsigned int index)
Add the relation from a given SVDShaperDigit index to a map.
Definition: SVDCoGTimeEstimatorModule.cc:324
Belle2::SVDCoGTimeEstimatorModule::m_relRecoDigitMCParticleName
std::string m_relRecoDigitMCParticleName
Name of the relation between SVDRecoDigits and MCParticles.
Definition: SVDCoGTimeEstimatorModule.h:167
Belle2::SVDCoGTimeEstimatorModule::m_calEventT0
bool m_calEventT0
Parameters for the corrections.
Definition: SVDCoGTimeEstimatorModule.h:159
Belle2::SVDCoGTimeEstimatorModule::m_storeShaperDigitsName
std::string m_storeShaperDigitsName
Name of the collection to use for the SVDShaperDigits.
Definition: SVDCoGTimeEstimatorModule.h:152
Belle2::SVDNoiseCalibrations
This class defines the dbobject and the method to access SVD calibrations from the noise local runs.
Definition: SVDNoiseCalibrations.h:46
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::SVDCoGTimeEstimatorModule::m_trueRelation
RelationLookup m_trueRelation
Lookup table for SVDShaperDigit->SVDTrueHit relation.
Definition: SVDCoGTimeEstimatorModule.h:143
Belle2::SVDCoGTimeEstimatorModule::CalculateChi2
float CalculateChi2()
Function to calculate chi2, that is not used here, so just set at 0.01.
Definition: SVDCoGTimeEstimatorModule.cc:304
Belle2::SVDCoGTimeEstimatorModule::m_svdEventInfoName
std::string m_svdEventInfoName
Name of the SVDEventInfo object.
Definition: SVDCoGTimeEstimatorModule.h:146
Belle2::SVDCoGTimeEstimatorModule::beginRun
virtual void beginRun() override
Called when entering a new run.
Definition: SVDCoGTimeEstimatorModule.cc:99
Belle2::SVDCoGTimeEstimatorModule::SVDCoGTimeEstimatorModule
SVDCoGTimeEstimatorModule()
Constructor defining the parameters.
Definition: SVDCoGTimeEstimatorModule.cc:25
Belle2::SVDCoGTimeEstimatorModule::CalculateAmplitude
float CalculateAmplitude(Belle2::SVDShaperDigit::APVFloatSamples samples)
Function to calculate the amplitude of the shaper, obtained as the largest of the 6 samples.
Definition: SVDCoGTimeEstimatorModule.cc:264
Belle2::SVDCoGTimeEstimatorModule::m_storeTrueHits
StoreArray< SVDTrueHit > m_storeTrueHits
SVDTrueHits store array.
Definition: SVDCoGTimeEstimatorModule.h:88
Belle2::SVDCoGTimeEstimatorModule::m_relShaperDigitTrueHitName
std::string m_relShaperDigitTrueHitName
Name of the relation between SVDShaperDigits and SVDTrueHits.
Definition: SVDCoGTimeEstimatorModule.h:165
Belle2::SVDCoGTimeEstimatorModule::m_chi2
float m_chi2
Chi2, to be defined here.
Definition: SVDCoGTimeEstimatorModule.h:104
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::SVDCoGTimeEstimatorModule::m_AmplitudeArbitraryError
float m_AmplitudeArbitraryError
Approximate ADC error on each sample.
Definition: SVDCoGTimeEstimatorModule.h:172
Belle2::SVDCoGTimeEstimatorModule::CalculateWeightedMeanPeakTime
float CalculateWeightedMeanPeakTime(Belle2::SVDShaperDigit::APVFloatSamples samples)
Function to calculate the peak time, obtained as the weighted mean of the time of the samples,...
Definition: SVDCoGTimeEstimatorModule.cc:243
Belle2::SVDCoGTimeEstimatorModule::m_storeRecoDigitsName
std::string m_storeRecoDigitsName
Name of the collection to use for the SVDRecoDigits.
Definition: SVDCoGTimeEstimatorModule.h:154
Belle2::SVDCoGTimeEstimatorModule::m_TimeCal
SVDCoGTimeCalibrations m_TimeCal
SVD CoG Time calibrations db object.
Definition: SVDCoGTimeEstimatorModule.h:188
Belle2::SVDCoGTimeEstimatorModule::createRelationLookup
void createRelationLookup(const RelationArray &relation, RelationLookup &lookup, size_t digits)
Create lookup maps for relations FIXME: This has to be significantly simplified here,...
Definition: SVDCoGTimeEstimatorModule.cc:311
Belle2::SVDCoGTimeEstimatorModule::m_storeMCParticlesName
std::string m_storeMCParticlesName
Name of the collection to use for the MCParticles.
Definition: SVDCoGTimeEstimatorModule.h:148
Belle2::SVDCoGTimeEstimatorModule::m_storeShaper
StoreArray< SVDShaperDigit > m_storeShaper
store arrays
Definition: SVDCoGTimeEstimatorModule.h:85
Belle2::SVDCoGTimeEstimatorModule::m_storeSVDEvtInfo
StoreObjPtr< SVDEventInfo > m_storeSVDEvtInfo
storage for SVDEventInfo object
Definition: SVDCoGTimeEstimatorModule.h:91
Belle2::SVDPulseShapeCalibrations
This class defines the dbobject and the methods to access the SVD calibrations from the local runs pr...
Definition: SVDPulseShapeCalibrations.h:46