Belle II Software development
eclAutocovarianceCalibrationC1Collector.cc
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/* Own header. */
10#include <ecl/modules/eclAutocovarianceCalibrationC1Collector/eclAutocovarianceCalibrationC1Collector.h>
11
12/* ECL headers. */
13#include <ecl/dataobjects/ECLDsp.h>
14#include <ecl/dataobjects/ECLElementNumbers.h>
15
16/* Basf2 headers. */
17#include <framework/dataobjects/EventMetaData.h>
18
19using namespace std;
20using namespace Belle2;
21
22//-----------------------------------------------------------------
23// Register the Modules
24//-----------------------------------------------------------------
25REG_MODULE(eclAutocovarianceCalibrationC1Collector);
26//-----------------------------------------------------------------
27// Implementation
28//-----------------------------------------------------------------
29
30// constructor
32{
33 // Set module properties
34 setDescription("Module to export histogram of noise level of ECL waveforms in delayed Bhabha events");
36}
37
39{
40
43 PPVsCrysID = new TH2F("PPVsCrysID", "Peak to peak amplitude for each crystal;crystal ID;Peak to peak Amplitude (ADC)",
46 registerObject<TH2F>("PPVsCrysID", PPVsCrysID);
47 m_eclDsps.isRequired();
48}
49
51{
53 B2INFO("eclAutocovarianceCalibrationC1Collector: Experiment = " << m_evtMetaData->getExperiment() << " run = " <<
54 m_evtMetaData->getRun());
55}
56
58{
59
60 //Checking how many waveforms saved in event
61 const int NumDsp = m_eclDsps.getEntries();
62
63 //Random Trigger Events have waveform for each crystal
64 if (NumDsp == ECLElementNumbers::c_NCrystals) {
65
66 for (auto& aECLDsp : m_eclDsps) {
67
68 const int id = aECLDsp.getCellId() - 1;
69
70 //Peak to peak amplitude used to gauge noise level
71 float PeakToPeak = (float) aECLDsp.computePeaktoPeakAmp();
72
73 // I avoid using getObjectPtr<TH2>("PPVsCrysID")->Fill(id, PeakToPeak); to improve on run time as getObjectPtr is very slow
74 PPVsCrysID->Fill(id, PeakToPeak);
75
76 }
77 }
78}
79
81{
82 for (int i = 0; i < ECLElementNumbers::c_NCrystals; i++) {
83 for (int j = 0; j < MaxPeaktoPeakValue; j++) {
84 getObjectPtr<TH2>("PPVsCrysID")->SetBinContent(i + 1, j + 1, PPVsCrysID->GetBinContent(i + 1, j + 1));
85 }
86 }
87}
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
StoreArray< ECLDsp > m_eclDsps
Required input array of ECLDSPs.
void collect() override
Select events and crystals and accumulate histograms.
StoreObjPtr< EventMetaData > m_evtMetaData
dataStore EventMetaData
void prepare() override
Define histograms and read payloads from DB.
TH2F * PPVsCrysID
histogram of peak-to-peak amplitude vs crystalID (cellID-1)
const int MaxPeaktoPeakValue
histogram limit for peak-to-peak amplitude
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
const int c_NCrystals
Number of crystals.
Abstract base class for different kinds of events.
STL namespace.