8#include <svd/modules/svdTimeCalibrationCollector/SVDTimeCalibrationCollectorModule.h>
26 setDescription(
"Collector module used to create the histograms needed for the SVD 6-Sample CoG, 3-Sample CoG and 3-Sample ELS Time calibration");
34 "Minimum value of the raw time distribution used to determine whether change IoV or not",
m_minRawTimeForIoV);
36 "Maximum value of the raw time distribution used to determine whether change IoV or not",
m_maxRawTimeForIoV);
42 m_hEventT0FromCDC =
new TH1F(
"hEventT0FromCDC",
"EventT0FromCDC", 200, -100, 100);
46 m_hRawTimeL3V =
new TH1F(
"hRawTimeL3V",
"RawTimeL3V", 150, 0, 150);
56 std::vector<Belle2::VxdID> allSensors;
58 for (
auto ladder : geoCache.getLadders(layer))
60 allSensors.push_back(sensor);
62 int numberOfSensorBin = 2 * int(allSensors.size());
63 B2INFO(
"Number of SensorBin: " << numberOfSensorBin);
65 TH3F* __hEventT0vsCoG__ =
new TH3F(
"__hEventT0vsCoG__",
"EventT0Sync vs rawTime",
67 numberOfSensorBin, + 0.5, numberOfSensorBin + 0.5);
68 TH2F* __hEventT0__ =
new TH2F(
"__hEventT0__",
"EventT0Sync",
70 numberOfSensorBin, + 0.5, numberOfSensorBin + 0.5);
71 TH2F* __hEventT0NoSync__ =
new TH2F(
"__hEventT0NoSync__",
"EventT0NoSync",
73 numberOfSensorBin, + 0.5, numberOfSensorBin + 0.5);
74 TH1F* __hBinToSensorMap__ =
new TH1F(
"__hBinToSensorMap__",
"__BinToSensorMap__",
75 numberOfSensorBin, + 0.5, numberOfSensorBin + 0.5);
76 __hEventT0vsCoG__->GetZaxis()->SetTitle(
"Sensor");
77 __hEventT0vsCoG__->GetYaxis()->SetTitle(
"EventT0Sync (ns)");
78 __hEventT0vsCoG__->GetXaxis()->SetTitle(
"raw_time (ns)");
79 __hEventT0__->GetYaxis()->SetTitle(
"Sensor");
80 __hEventT0__->GetXaxis()->SetTitle(
"event_t0 (ns)");
81 __hEventT0NoSync__->GetYaxis()->SetTitle(
"sensor");
82 __hEventT0NoSync__->GetXaxis()->SetTitle(
"event_t0 (ns)");
85 for (
auto sensor : allSensors) {
86 for (
auto view : {
'U',
'V'}) {
88 TString binLabel = TString::Format(
"L%iL%iS%i%c",
89 sensor.getLayerNumber(),
90 sensor.getLadderNumber(),
91 sensor.getSensorNumber(),
93 __hBinToSensorMap__->GetXaxis()->SetBinLabel(tmpBinCnt, binLabel);
96 registerObject<TH3F>(__hEventT0vsCoG__->GetName(), __hEventT0vsCoG__);
97 registerObject<TH2F>(__hEventT0__->GetName(), __hEventT0__);
98 registerObject<TH2F>(__hEventT0NoSync__->GetName(), __hEventT0NoSync__);
99 registerObject<TH1F>(__hBinToSensorMap__->GetName(), __hBinToSensorMap__);
104 getObjectPtr<TH1F>(
"hEventT0FromCDC")->Reset();
105 getObjectPtr<TH1F>(
"hEventT0FromCDCSync")->Reset();
106 getObjectPtr<TH1F>(
"hRawTimeL3V")->Reset();
107 getObjectPtr<TH1F>(
"hRawTimeL3VFullRange")->Reset();
108 getObjectPtr<TH3F>(
"__hEventT0vsCoG__")->Reset();
109 getObjectPtr<TH2F>(
"__hEventT0__")->Reset();
110 getObjectPtr<TH2F>(
"__hEventT0NoSync__")->Reset();
111 getObjectPtr<TH1F>(
"__hBinToSensorMap__")->Reset();
118 if (
m_eventT0->hasTemporaryEventT0(Const::EDetector::CDC)) {
119 auto evtT0CDC =
m_eventT0->getBestCDCTemporaryEventT0();
122 eventT0 = evtT0CDC->eventT0;
123 getObjectPtr<TH1F>(
"hEventT0FromCDC")->Fill(eventT0);
133 std::string m_svdEventInfoName =
"SVDEventInfo";
134 if (!temp_eventinfo.
isOptional(
"SVDEventInfo"))
135 m_svdEventInfoName =
"SVDEventInfoSim";
137 if (!eventinfo) B2ERROR(
"No SVDEventInfo!");
142 float clTime_ftsw = svdCluster.getClsTime();
145 float clTime = eventinfo->getTimeInSVDReference(clTime_ftsw, svdCluster.getFirstFrame());
148 int side = svdCluster.isUCluster();
151 short unsigned int layer = svdCluster.getSensorID().getLayerNumber();
154 if (
m_eventT0->hasTemporaryEventT0(Const::EDetector::CDC)) {
156 float eventT0Sync = eventinfo->getTimeInSVDReference(eventT0, svdCluster.getFirstFrame());
158 TString binLabel = TString::Format(
"L%iL%iS%i%c",
159 svdCluster.getSensorID().getLayerNumber(),
160 svdCluster.getSensorID().getLadderNumber(),
161 svdCluster.getSensorID().getSensorNumber(),
163 int sensorBin = getObjectPtr<TH1F>(
"__hBinToSensorMap__")->GetXaxis()->FindBin(binLabel.Data());
164 double sensorBinCenter = getObjectPtr<TH1F>(
"__hBinToSensorMap__")->GetXaxis()->GetBinCenter(sensorBin);
165 getObjectPtr<TH3F>(
"__hEventT0vsCoG__")->Fill(clTime, eventT0Sync, sensorBinCenter);
166 getObjectPtr<TH2F>(
"__hEventT0__")->Fill(eventT0Sync, sensorBinCenter);
167 getObjectPtr<TH2F>(
"__hEventT0NoSync__")->Fill(eventT0, sensorBinCenter);
169 getObjectPtr<TH1F>(
"hEventT0FromCDCSync")->Fill(eventT0Sync);
170 if (layer == 3 && side == 0) {
172 getObjectPtr<TH1F>(
"hRawTimeL3V")->Fill(clTime_ftsw);
174 getObjectPtr<TH1F>(
"hRawTimeL3VFullRange")->Fill(clTime_ftsw);
Calibration collector module base class.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
StoreArray< SVDCluster > m_svdClsOnTrk
SVDClusters store array.
double m_rawCoGBinWidth
Raw_CoG Bin Width [ns] for 2D-histogram.
SVDTimeCalibrationCollectorModule()
Constructor.
void prepare() override final
Initialize the module.
StoreObjPtr< EventT0 > m_eventT0
EventT0 store object pointer.
TH1F * m_hEventT0FromCDC
Distribution of EventT0 reconstructed by the CDC for all sensos/side.
double m_maxRawTimeForIoV
Maxmum value of the raw time distribution used to determine whether change IoV or not.
double m_minRawTimeForIoV
Minimum value of the raw time distribution used to determine whether change IoV or not.
std::string m_eventTime
EventT0.
void collect() override final
Event processor.
TH1F * m_hEventT0FromCDCSync
Distribution of EventT0 reconstructed by the CDC and synchronized for all sensos/side.
TH1F * m_hRawTimeL3V
Raw time distribution of layer3 V-side for IoV determination.
std::string m_svdClustersOnTracks
SVDCluster.
DBObjPtr< HardwareClockSettings > m_hwClock
systems clock
TH1F * m_hRawTimeL3VFullRange
Raw time distribution of layer3 V-side.
std::string m_svdEventInfo
SVDEventInfo.
void startRun() override final
Called when entering a new run.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
bool isValid() const
Check wether the array was registered.
Type-safe access to single objects in the data store.
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
static GeoCache & getInstance()
Return a reference to the singleton instance.
Class to uniquely identify a any structure of the PXD and SVD.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.