17 #include <ecl/modules/eclDataAnalysis/EclCovMatrixNtupleModule.h>
24 #include <ecl/dataobjects/ECLDigit.h>
25 #include <ecl/dataobjects/ECLDsp.h>
26 #include <ecl/dataobjects/ECLTrig.h>
27 #include <ecl/geometry/ECLGeometryPar.h>
45 setDescription(
"EclCovMatrixNtuple: write ECL waveform and fitted time and amplitude in a root file");
46 setPropertyFlags(c_ParallelProcessingCertified);
48 addParam(
"outputFileName", m_dataOutFileName,
49 "Output root file name of this module",
string(
"EclCovMatrixNtuple"));
50 addParam(
"dspArrayName", m_dspArrayName,
"name of input ECLDsp Array",
string(
"ECLDsps"));
51 addParam(
"digiArrayName", m_digiArrayName,
"name of input ECLDigit Array",
string(
"ECLDigits"));
54 void EclCovMatrixNtupleModule::initialize()
56 m_eclDspArray.registerInDataStore(m_dspArrayName);
57 m_eclDigiArray.registerInDataStore(m_digiArrayName);
58 B2INFO(
"[EclCovMatrixNtuple Module]: Starting initialization of EclCovMatrixNtuple Module.");
61 string dataFileName = m_dataOutFileName +
".root";
63 m_rootFile =
new TFile(dataFileName.c_str(),
"RECREATE");
64 m_tree =
new TTree(
"m_tree",
"EclCovMatrixNtuple tree");
66 m_tree->Branch(
"energy", &m_energy,
"energy/D");
67 m_tree->Branch(
"nhits", &m_nhits,
"nhits/I");
68 m_tree->Branch(
"cellID", m_cellID,
"cellID[nhits]/I");
69 m_tree->Branch(
"theta", m_theta,
"theta[nhits]/I");
70 m_tree->Branch(
"phi", m_phi,
"phi[nhits]/I");
71 m_tree->Branch(
"hitA", m_DspHit,
"hitA[nhits][31]/I");
72 m_tree->Branch(
"hitT", m_hitTime,
"hitT[nhits]/D");
73 m_tree->Branch(
"deltaT", m_DeltaT,
"deltaT[nhits]/D");
75 m_tree->Branch(
"digiE", m_hitE,
"hitE[nhits]/D");
76 m_tree->Branch(
"digiT", m_DigiTime,
"digiT[nhits]/I");
79 B2INFO(
"[EclCovMatrixNtuple Module]: Finished initialising the Time Information Study in Gamma Reconstruction Module.");
82 void EclCovMatrixNtupleModule::terminate()
89 void EclCovMatrixNtupleModule::event()
100 for (
int i = 0; i < 8736; i++) {
109 for (
int j = 0; j < 31; j++) {
115 m_nhits = m_eclDigiArray.getEntries();
118 assert(m_eclTrigArray.getEntries() == 1);
120 for (
const auto& adigit : m_eclDigiArray) {
121 size_t cellIndex =
static_cast<size_t>(adigit.getCellId() - 1);
124 m_phi[cellIndex] = eclgeo->
GetPhiID();
131 m_cellID[cellIndex] = cellIndex;
132 m_hitE[cellIndex] = adigit.getAmp();
133 m_DigiTime[cellIndex] = adigit.getTimeFit();
135 double deltaT = m_eclTrigArray[0]->getTimeTrig() * 508.0 / 12.0;
136 m_DeltaT[cellIndex] = deltaT;
137 m_hitTime[cellIndex] = 1520 - adigit.getTimeFit() - 64 * deltaT * 12.0 * 24.0 / 508.0 / 1536.0;
144 assert(m_eclDspArray.getEntries() == m_eclDigiArray.getEntries());
145 for (
const auto& eclDsp : m_eclDspArray) {
146 size_t cellIndex =
static_cast<size_t>(eclDsp.getCellId() - 1);
147 eclDsp.getDspA(m_DspHit[cellIndex]);
The Class for ECL Geometry Parameters.
int GetPhiID()
Get Phi Id.
void Mapping(int cid)
Mapping theta, phi Id.
int GetThetaID()
Get Theta Id.
a module to write ECL waveform and fitted time and amplitude information in a root ntuple
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.