Belle II Software development
TOPRingPlotterModule.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#include <top/modules/TOPRingPlotter/TOPRingPlotterModule.h>
10
11#include <analysis/dataobjects/ParticleList.h>
12#include <analysis/dataobjects/Particle.h>
13
14#include <framework/datastore/StoreArray.h>
15#include <framework/datastore/StoreObjPtr.h>
16
17#include <framework/logging/Logger.h>
18#include <framework/utilities/MakeROOTCompatible.h>
19
20#include <iostream>
21#include <TRandom.h>
22#include <TDirectory.h>
23
24// framework - DataStore
25#include <framework/datastore/DataStore.h>
26#include <framework/datastore/StoreArray.h>
27#include <framework/datastore/StoreObjPtr.h>
28
29// framework aux
30#include <framework/gearbox/Unit.h>
31#include <framework/gearbox/Const.h>
32#include <framework/logging/Logger.h>
33
34// DataStore classes
35#include <mdst/dataobjects/Track.h>
36#include <mdst/dataobjects/MCParticle.h>
37#include <top/dataobjects/TOPLikelihoodScanResult.h>
38#include <top/dataobjects/TOPLikelihood.h>
39#include <top/dataobjects/TOPBarHit.h>
40#include <tracking/dataobjects/ExtHit.h>
41#include <top/dataobjects/TOPDigit.h>
42#include <mdst/dataobjects/ECLCluster.h>
43
44#include <top/geometry/TOPGeometryPar.h>
45#include <top/reconstruction_cpp/TOPTrack.h>
46#include <top/reconstruction_cpp/PDFConstructor.h>
47#include <top/reconstruction_cpp/TOPRecoManager.h>
48
49using namespace Belle2;
50using namespace TOP;
51using namespace Belle2::Variable;
52
53
54REG_MODULE(TOPRingPlotter);
55
57{
58 // Set module properties
60 R"DOC(A module to plot the x-t images from TOP, and in general study the distribution of the digits associated to the particles in a particleList)DOC");
61
62 // Parameter definitions
63 addParam("particleList", m_particleList, "List of particles to be used for plotting", std::string("pi+:all"));
64 addParam("variables", m_variables, "List of variables to be saved", {});
65 addParam("pdgHyp", m_pdgHyp, "List of pdg codes for which the PDF is sampled and saved. Valid values are 11, 13, 211, 321, 2212.",
66 m_pdgHyp);
67 addParam("outputName", m_outputName, "Name of the output file", std::string("TOPRings.root"));
68 addParam("nToys", m_toyNumber,
69 "Number of toys used to sample the PDFs. Set it to a large number for a precise sampling of the PDF in the histograms (suggested for small number of events) ",
70 1);
71 addParam("saveHistograms", m_saveHistograms,
72 "Set true to save the histograms of the maps in addition to the list of sampled pseudo-digits", false);
73 addParam("saveLLScan", m_saveLLScan,
74 "Set true to save the results of the LL scan. Requires to add TOPLLScannerModule to the path", false);
75 addParam("dumpOtherSlots", m_dumpOtherSlots,
76 "Instead of saving the TOP response for the single slot extrapolated from the given particle list, set true to save the response of all other slots. This excludes the one associated to the list. Good for studying background hits.",
77 false);
78}
79
80
82{
83 m_pdfSamplesP = 0;
84 m_pdfToysP = 0;
85 m_pdfSamplesK = 0;
86 m_pdfToysK = 0;
88 m_pdfToysPI = 0;
90 m_pdfToysMU = 0;
91 m_pdfSamplesE = 0;
92 m_pdfToysE = 0;
93 m_hitMapMCK->Reset();
94 m_hitMapMCPI->Reset();
95 m_hitMapMCP->Reset();
96 m_hitMapMCE->Reset();
97 m_hitMapMCMU->Reset();
98 m_nScanPoints = 0;
99
100 for (int i = 0; i < 10000; i++) {
101 m_scanMass[i] = 0;
102 m_scanLL[i] = 0;
103 }
104
105 for (int i = 0; i < m_MaxPDFPhotons; i++) {
106 m_pdfPixelE[i] = 0;
107 m_pdfTimeE[i] = 0;
108 m_pdfPixelMU[i] = 0;
109 m_pdfTimeMU[i] = 0;
110 m_pdfPixelPI[i] = 0;
111 m_pdfTimePI[i] = 0;
112 m_pdfPixelK[i] = 0;
113 m_pdfTimeK[i] = 0;
114 m_pdfPixelP[i] = 0;
115 m_pdfTimeP[i] = 0;
116 }
117
118
119 m_nDigits = 0;
120
121 for (int i = 0; i < m_MaxPhotons; i++) {
122 m_digitTime[i] = 0;
123 m_digitChannel[i] = 0;
124 m_digitPixel[i] = 0;
125 m_digitPixelCol[i] = 0;
126 m_digitPixelRow[i] = 0;
127 m_digitAmplitude[i] = 0;
128 m_digitWidth[i] = 0;
129 m_digitASICChannel[i] = 0;
130 m_digitPMTNumber[i] = 0;
131 m_digitSlot[i] = {0};
132 m_digitBoardstack[i] = {0};
133 m_digitCarrier[i] = {0};
134 m_digitAsic[i] = {0};
135 m_digitQuality[i] = {0};
136 }
137
138
139 return;
140}
141
142
143void TOPRingPlotterModule::fillPDF(Belle2::Const::ChargedStable ch, const Track* track, TH2F* histo, short* pixelArray,
144 float* timeArray, int& arrayGuard, int& toyCounter)
145{
146
147 if (not track) return;
148
149 TOPTrack trkPDF(*track);
150
151 if (!trkPDF.isValid())
152 return;
153
154 PDFConstructor pdfConstructor(trkPDF, ch, PDFConstructor::c_Fine);
155 if (not pdfConstructor.isValid()) return;
156
157 arrayGuard = 0; // this keeps track of the total number of PDF samples we have saved so far
158 m_pdfAsHisto->Reset(); // clan the histogram that will contain the PDf to be sampled
159
160 // loops of pixels and PDF peaks to make a full sampling of the PDF
161 for (int pixelID = 1; pixelID <= 512; pixelID++) {
162 for (int iBinY = 1; iBinY < 500 + 1; iBinY++) {
163 // MARKO'S Trick HERE
164 auto time = m_pdfAsHisto->GetYaxis()->GetBinCenter(iBinY);
165 auto pdfVal = pdfConstructor.getPDFValue(pixelID, time, 0.070); // average electronic time reso = 70 ps
166 m_pdfAsHisto->Fill(pixelID - 0.5, time, pdfVal * 0.2); // bins are 1 px X 0.2 ns wide
167 short pixelCol = (pixelID - 1) % 64 + 1;
168 histo->Fill(pixelCol, time, pdfVal * 1.6); // bins in the map are 8 px X 0.2 ns wide
169 }
170 }
171
172 auto nExpPhot = pdfConstructor.getExpectedPhotons();
173
174 m_pdfAsHisto->Scale(nExpPhot);
175 histo->Scale(nExpPhot);
176
177 // loop over the toys
178 for (int iSim = 0; iSim < m_toyNumber; iSim++) {
179 // tmp arrays. Before appending the PDF-based digits to the list, we want to be sure
180 // that their total number does not exceeds the size of pixelArray and timeArray.
181 // We run the full toy for an event storing the results here, and we copy them to timeArray and pixelArray only
182 // if there's enough room.
183 std::vector<float> tmpTime;
184 std::vector<short> tmpPixel;
185
186 short numPhot = gRandom->Poisson(nExpPhot);
187
188 for (short rn = 0; rn < numPhot; rn++) {
189 double time = 0;
190 double pxID = 0;
191 m_pdfAsHisto->GetRandom2(pxID, time);
192 tmpTime.push_back(time);
193 tmpPixel.push_back(short(pxID));
194 }
195
196 // before transferring the results of the PDF sampling into pixelArray and timeArray, check if there's
197 // enough room.
198 if (arrayGuard + tmpTime.size() < m_MaxPDFPhotons) {
199 for (unsigned int iPh = 0; iPh < tmpTime.size(); iPh++) {
200 pixelArray[arrayGuard] = tmpPixel[iPh];
201 timeArray[arrayGuard] = tmpTime[iPh];
202 arrayGuard++;
203 }
204 toyCounter++;
205 } else {
206 return; // we already reached the max size of the arrays for sampling, no point in keep doing this
207 }
208 }
209
210 return;
211}
212
213
215{
216
217 // Check the list of pdg hypotheses
218 for (auto pdg : m_pdgHyp) {
219 if ((pdg != Const::electron.getPDGCode()) and (pdg != Const::pion.getPDGCode()) and (pdg != Const::kaon.getPDGCode()) and
220 (pdg != Const::muon.getPDGCode()) and (pdg != Const::proton.getPDGCode()))
221 B2FATAL("Invalid PDG hypothesis for the PDF evaluation: " << pdg);
222 short duplicateCount = 0;
223 for (auto pdg2 : m_pdgHyp) {
224 if (pdg == pdg2)
225 duplicateCount++;
226 }
227 if (duplicateCount > 1)
228 B2FATAL("Duplicate PDG hypothesis found");
229 }
230
231 m_hitMapMCK = new TH2F("hitMapMCK", "x-t map of the kaon PDF", 64, 0, 64, 500, 0, 100);
232 m_hitMapMCPI = new TH2F("hitMapMCPI", "x-t map of the pion PDF", 64, 0, 64, 500, 0, 100);
233 m_hitMapMCP = new TH2F("hitMapMCP", "x-t map of the proton PDF", 64, 0, 64, 500, 0, 100);
234 m_hitMapMCE = new TH2F("hitMapMCE", "x-t map of the electron PDF", 64, 0, 64, 500, 0, 100);
235 m_hitMapMCMU = new TH2F("hitMapMCMU", "x-t map of the muon PDF", 64, 0, 64, 500, 0, 100);
236
237 m_pdfAsHisto = new TH2F("pdfAsHisto", "tms holder for the pdf to be sampled", 512, 0, 512, 500, 0, 100);
238
239 TDirectory::TContext context;
240 B2INFO("creating a tree for TOPRingPlotterModule");
241 m_outputFile = new TFile(m_outputName.c_str(), "recreate");
242 m_tree = new TTree("tree", "tree");
243
244 if (m_saveHistograms) {
245 for (auto pdg : m_pdgHyp) {
246 if (pdg == Const::electron.getPDGCode())
247 m_tree->Branch("hitMapMCE", "TH2F", &m_hitMapMCE, 32000, 0);
248 else if (pdg == Const::muon.getPDGCode())
249 m_tree->Branch("hitMapMCMU", "TH2F", &m_hitMapMCMU, 32000, 0);
250 else if (pdg == Const::pion.getPDGCode())
251 m_tree->Branch("hitMapMCPI", "TH2F", &m_hitMapMCPI, 32000, 0);
252 else if (pdg == Const::kaon.getPDGCode())
253 m_tree->Branch("hitMapMCK", "TH2F", &m_hitMapMCK, 32000, 0);
254 else if (pdg == Const::proton.getPDGCode())
255 m_tree->Branch("hitMapMCP", "TH2F", &m_hitMapMCP, 32000, 0);
256 }
257 }
258
259 m_tree->Branch("nDigits", &m_nDigits, "m_nDigits/S");
260 m_tree->Branch("digitTime", m_digitTime, "m_digitTime[m_nDigits]/F");
261 m_tree->Branch("digitAmplitude", m_digitAmplitude, "m_digitAmplitude[m_nDigits]/F");
262 m_tree->Branch("digitWidth", m_digitWidth, "m_digitWidth[m_nDigits]/F");
263 m_tree->Branch("digitChannel", m_digitChannel, "m_digitChannel[m_nDigits]/S");
264 m_tree->Branch("digitPixel", m_digitPixel, "m_digitPixel[m_nDigits]/S");
265 m_tree->Branch("digitPixelCol", m_digitPixelCol, "m_digitPixelCol[m_nDigits]/S");
266 m_tree->Branch("digitPixelRow", m_digitPixelRow, "m_digitPixelRow[m_nDigits]/S");
267 m_tree->Branch("digitASICChannel", m_digitASICChannel, "m_digitASICChannel[m_nDigits]/S");
268 m_tree->Branch("digitPMTNumber", m_digitPMTNumber, "m_digitPMTNumber[m_nDigits]/S");
269 m_tree->Branch("digitSlot", m_digitSlot, "m_digitSlot[m_nDigits]/S");
270 m_tree->Branch("digitBoardstack", m_digitBoardstack, "m_digitBoardstack[m_nDigits]/S");
271 m_tree->Branch("digitCarrier", m_digitCarrier, "m_digitCarrier[m_nDigits]/S");
272 m_tree->Branch("digitAsic", m_digitAsic, "m_digitAsic[m_nDigits]/S");
273 m_tree->Branch("digitQuality", m_digitQuality, "m_digitQuality[m_nDigits]/S");
274
275 m_tree->Branch("pdfSamplesP", &m_pdfSamplesP, "m_pdfSamplesP/I");
276 m_tree->Branch("pdfToysP", &m_pdfToysP, "m_pdfToysP/I");
277 m_tree->Branch("pdfPixelP", m_pdfPixelP, "m_pdfPixelP[m_pdfSamplesP]/S");
278 m_tree->Branch("pdfTimeP", m_pdfTimeP, "m_pdfTimeP[m_pdfSamplesP]/F");
279
280 m_tree->Branch("pdfSamplesK", &m_pdfSamplesK, "m_pdfSamplesK/I");
281 m_tree->Branch("pdfToysK", &m_pdfToysK, "m_pdfToysK/I");
282 m_tree->Branch("pdfPixelK", m_pdfPixelK, "m_pdfPixelK[m_pdfSamplesK]/S");
283 m_tree->Branch("pdfTimeK", m_pdfTimeK, "m_pdfTimeK[m_pdfSamplesK]/F");
284
285 m_tree->Branch("pdfSamplesPI", &m_pdfSamplesPI, "m_pdfSamplesPI/I");
286 m_tree->Branch("pdfToysPI", &m_pdfToysPI, "m_pdfToysPI/I");
287 m_tree->Branch("pdfPixelPI", m_pdfPixelPI, "m_pdfPixelPI[m_pdfSamplesPI]/S");
288 m_tree->Branch("pdfTimePI", m_pdfTimePI, "m_pdfTimePI[m_pdfSamplesPI]/F");
289
290 m_tree->Branch("pdfSamplesMU", &m_pdfSamplesMU, "m_pdfSamplesMU/I");
291 m_tree->Branch("pdfToysMU", &m_pdfToysMU, "m_pdfToysMU/I");
292 m_tree->Branch("pdfPixelMU", m_pdfPixelMU, "m_pdfPixelMU[m_pdfSamplesMU]/S");
293 m_tree->Branch("pdfTimeMU", m_pdfTimeMU, "m_pdfTimeMU[m_pdfSamplesMU]/F");
294
295 m_tree->Branch("pdfSamplesE", &m_pdfSamplesE, "m_pdfSamplesE/I");
296 m_tree->Branch("pdfToysE", &m_pdfToysE, "m_pdfToysE/I");
297 m_tree->Branch("pdfPixelE", m_pdfPixelE, "m_pdfPixelE[m_pdfSamplesE]/S");
298 m_tree->Branch("pdfTimeE", m_pdfTimeE, "m_pdfTimeE[m_pdfSamplesE]/F");
299
300 if (m_saveLLScan) {
301 m_tree->Branch("nScanPoints", &m_nScanPoints, "m_nScanPoints/I");
302 m_tree->Branch("scanMass", m_scanMass, "m_scanMass[m_nScanPoints]/F");
303 m_tree->Branch("scanLL", m_scanLL, "m_scanLL[m_nScanPoints]/F");
304 }
305
306 // This parts parses the list of variables and creates the branches in the output tree.
307 // This is copy-pasted from VariablesToNtupleModule
309 m_branchAddresses.resize(m_variables.size() + 1);
310 size_t enumerate = 0;
311 for (const std::string& varStr : m_variables) {
312 std::string branchName = MakeROOTCompatible::makeROOTCompatible(varStr);
313 m_tree->Branch(branchName.c_str(), &m_branchAddresses[enumerate], (branchName + "/D").c_str());
314
316 if (!var) {
317 B2ERROR("Variable '" << varStr << "' is not available in Variable::Manager!");
318 } else {
319 if (m_particleList.empty() && var->description.find("[Eventbased]") == std::string::npos) {
320 B2ERROR("Variable '" << varStr << "' is not an event-based variable, "
321 "but you are using VariablesToNtuple without a decay string, i.e. in the event-wise mode.\n"
322 "If you have created an event-based alias you can wrap your alias with `eventCached` to "
323 "declare it as event based, which avoids this error.\n\n"
324 "vm.addAlias('myAliasName', 'eventCached(myAlias)')");
325 continue;
326 }
327 m_functions.push_back(var->function);
328 }
329 enumerate++;
330 }
331
332 StoreArray<Track> tracks;
333 tracks.isRequired();
334 StoreArray<ExtHit> extHits;
335 extHits.isRequired();
336 StoreArray<TOPLikelihood> likelihoods;
337 likelihoods.isRequired();
339 digits.isRequired();
340 StoreArray<TOPBarHit> barHits;
341 barHits.isOptional();
343 likelihoodScans.isOptional();
344
345}
346
347
349{
351
354
355 // skip on invalid lists
356 if (! particles.isValid())
357 return;
358
359 // loops over all particles
360 int n_part = particles->getListSize();
361 for (int i = 0; i < n_part; i++) {
362
363 // Reset the tree variables to the default values
364 resetTree();
365
366 // Get the track associated to the particle
367 const Particle* particle = particles->getParticle(i);
368 const Track* track = particle->getTrack();
369
370 bool isFromTrack = true;
371 short moduleID = 0;
372 short deltaModule = 0;
373
374 // If there's no track, we will use the cluster position
375 // to pin-point the moduleID. This is meant to allow to use
376 // the module to study ECL backsplashes and conversions in the
377 // TOP volume
378 if (!track) {
379 const ECLCluster* clstr = particle->getECLCluster();
380 if (! clstr)
381 continue; // if there's not even a cluster, we can't do much
382 else {
383 if (clstr->getDetectorRegion() != 2)
384 continue; // the cluster is not in the barrel
385 isFromTrack = false;
386 // find the two slots closer to the cluster
387 auto phi = particle->getECLCluster()->getPhi();
388 if (phi < 0)
389 phi = 2 * M_PI - phi;
390 auto rawModuleID = phi / (M_PI / 8) + 1;
391 moduleID = int(rawModuleID);
392 if (rawModuleID - moduleID > 0.5) {
393 deltaModule = 1;
394 if (moduleID == 16)
395 deltaModule = -15; // ad-hoc treatment for the 16-1 boundary
396 } else {
397 deltaModule = -1;
398 if (moduleID == 1)
399 deltaModule = 15; // ad-hoc treatment for the 1-16 boundary
400 }
401 }
402 } else {
403 // Check if one can make a TOP track
404 TOPTrack trk(*track);
405 if (!trk.isValid())
406 continue;
407 moduleID = trk.getModuleID();
408 }
409
410 if (moduleID < 1)
411 continue;
412
413 // Save the digit info for all the topDigits in the module where the track was extrapolated
414 // If `dumpOtherSlots` is true, then instead save all other modules.
415 for (const auto& digi : digits) {
416 // if we have a cluster, save the digits from the two modules closer to the cluster
417 if (m_nDigits >= m_MaxPhotons) break;
418 if ((!m_dumpOtherSlots && digi.getModuleID() == moduleID) || (!m_dumpOtherSlots && !isFromTrack
419 && digi.getModuleID() == moduleID + deltaModule) || (m_dumpOtherSlots == true && digi.getModuleID() != moduleID)) {
420 m_digitTime[m_nDigits] = digi.getTime();
421 m_digitChannel[m_nDigits] = digi.getChannel();
422 m_digitPixel[m_nDigits] = digi.getPixelID();
423 m_digitPixelCol[m_nDigits] = digi.getPixelCol();
424 m_digitPixelRow[m_nDigits] = digi.getPixelRow();
425 m_digitAmplitude[m_nDigits] = digi.getPulseHeight();
426 m_digitWidth[m_nDigits] = digi.getPulseWidth();
427 m_digitASICChannel[m_nDigits] = digi.getASICChannel();
428 m_digitPMTNumber[m_nDigits] = digi.getPMTNumber();
429 m_digitSlot[m_nDigits] = digi.getModuleID();
430 m_digitBoardstack[m_nDigits] = digi.getBoardstackNumber();
431 m_digitCarrier[m_nDigits] = digi.getCarrierNumber();
432 m_digitAsic[m_nDigits] = digi.getASICNumber();
433 m_digitQuality[m_nDigits] = digi.getHitQuality();
434 m_nDigits++;
435 }
436 }
437
438 // Save the track variables from the VM
439 for (unsigned int iVar = 0; iVar < m_variables.size(); iVar++) {
440 if (std::holds_alternative<double>(m_functions[iVar](particle))) {
441 m_branchAddresses[iVar] = std::get<double>(m_functions[iVar](particle));
442 } else if (std::holds_alternative<int>(m_functions[iVar](particle))) {
443 m_branchAddresses[iVar] = (double)std::get<int>(m_functions[iVar](particle));
444 } else if (std::holds_alternative<bool>(m_functions[iVar](particle))) {
445 m_branchAddresses[iVar] = (double)std::get<bool>(m_functions[iVar](particle));
446 }
447 }
448
449
450 // Save the PDF samplings
451 if (isFromTrack) {
452
453 if (m_saveLLScan) {
454 auto llScan = track->getRelated<TOPLikelihoodScanResult>();
455 auto masses = llScan->getCoarseScanMassPoints();
456 auto lls = llScan->getCoarseScanLLValues();
457 m_nScanPoints = lls.size();
458 for (unsigned int j = 0; j < lls.size(); j++) {
459 m_scanMass[j] = masses[j];
460 m_scanLL[j] = lls[j];
461 }
462 }
463
464 for (auto pdg : m_pdgHyp) {
465 if (pdg == Const::electron.getPDGCode())
467 else if (pdg == Const::muon.getPDGCode())
469 else if (pdg == Const::pion.getPDGCode())
471 else if (pdg == Const::kaon.getPDGCode())
473 else if (pdg == Const::proton.getPDGCode())
475 }
476 }
477
478 m_tree->Fill();
479 }
480 return;
481}
482
483
485{
486 TDirectory::TContext context;
487 m_outputFile->cd();
488 m_tree->Write();
489 m_outputFile->Close();
490}
491
492
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:589
static const ChargedStable muon
muon particle
Definition: Const.h:660
static const ChargedStable pion
charged pion particle
Definition: Const.h:661
static const ChargedStable proton
proton particle
Definition: Const.h:663
static const ChargedStable kaon
charged kaon particle
Definition: Const.h:662
static const ChargedStable electron
electron particle
Definition: Const.h:659
ECL cluster data.
Definition: ECLCluster.h:27
int getDetectorRegion() const
Return detector region: 0: below acceptance, 1: FWD, 2: BRL, 3: BWD, 11: FWDGAP, 13: BWDGAP.
Definition: ECLCluster.cc:70
static std::string makeROOTCompatible(std::string str)
Remove special characters that ROOT dislikes in branch names, e.g.
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
Class to store reconstructed particles.
Definition: Particle.h:76
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.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:95
Class to store the result of the TOP LL scan (output of TOPLLScanner).
std::vector< float > getCoarseScanMassPoints() const
Return a std::vector containing the mass points used for the coarse LL scane.
short m_digitQuality[m_MaxPhotons]
Digit quality
float m_pdfTimePI[m_MaxPDFPhotons]
array with the times of the sampled pseudo-hits for the pion PDF
float m_pdfTimeE[m_MaxPDFPhotons]
array with the times of the sampled pseudo-hits for the electron PDF
short m_digitPixelCol[m_MaxPhotons]
Pixel column.
short m_pdfPixelK[m_MaxPDFPhotons]
array with the pixel location of the sampled pseudo-hits for the kaon PDF
TTree * m_tree
tree where data are saved.
std::vector< std::string > m_variables
List of variables to save.
short m_digitPixel[m_MaxPhotons]
Pixel number (1-512)
short m_digitSlot[m_MaxPhotons]
Slot number (1-16)
TH2F * m_hitMapMCPI
x-t plot of the pion PDF
short m_digitPixelRow[m_MaxPhotons]
Pixel row.
std::vector< short > m_pdgHyp
List of pdg codes for which the PDF is sampled and saved.
void initialize() override
Prepares the tree.
TOPRingPlotterModule()
Constructor: Sets the description, the properties and the parameters of the module.
bool m_dumpOtherSlots
Set to to save the results of the LL scan.
float m_pdfTimeP[m_MaxPDFPhotons]
array with the times of the sampled pseudo-hits for the proton PDF
void event() override
Fills the tree.
float m_scanLL[10000]
LL values of the scan.
void fillPDF(Belle2::Const::ChargedStable, const Track *, TH2F *, short *, float *, int &, int &)
Fills the pdf-related branches.
bool m_saveHistograms
Set true to save the histograms of the maps.
float m_digitAmplitude[m_MaxPhotons]
Digit amplitude [ADC].
int m_pdfSamplesPI
total number of samples drawn from the pion PDF
void terminate() override
Writes the tree.
TH2F * m_hitMapMCK
x-t plot of the kaon PDF
int m_pdfToysP
total number of toys from the proton PDF
TH2F * m_hitMapMCMU
x-t plot of the muon PDF
std::vector< double > m_branchAddresses
Variable branch addresses.
int m_pdfSamplesK
total number of samples drawn from the kaon PDF
bool m_saveLLScan
Set to true to save the results of the LL scan.
static const int m_MaxPhotons
maximum number of digits allowed per PDF
int m_pdfSamplesMU
total number of samples drawn from the muon PDF
int m_pdfToysMU
total number of toys from the muon PDF
std::string m_outputName
Name of the output file.
short m_digitBoardstack[m_MaxPhotons]
BoardStack number
int m_pdfToysPI
total number of toys from the pion PDF
static const int m_MaxPDFPhotons
maximum number of digits allowed per PDF
std::vector< Variable::Manager::FunctionPtr > m_functions
List of function pointers corresponding to given variables.
int m_pdfSamplesE
total number of samples drawn from the electron PDF
std::string m_particleList
List of particles to be used for plotting.
short m_digitCarrier[m_MaxPhotons]
Carrier number
float m_scanMass[10000]
masses used in the LL scan
short m_pdfPixelE[m_MaxPDFPhotons]
array with the pixel location of the sampled pseudo-hits for the electron PDF
short m_digitAsic[m_MaxPhotons]
Asic number
float m_pdfTimeMU[m_MaxPDFPhotons]
array with the times of the sampled pseudo-hits for the muon PDF
void resetTree()
reset the tree variables.
short m_digitASICChannel[m_MaxPhotons]
ASIC channel number.
TH2F * m_hitMapMCE
x-t plot of the electron PDF
int m_pdfToysK
total number of toys from the kaon PDF
TH2F * m_pdfAsHisto
histogram to hot the PDF that will be sampled
float m_digitTime[m_MaxPhotons]
Digit calibrated time [ns].
short m_digitChannel[m_MaxPhotons]
SW channel (0-511)
short m_pdfPixelPI[m_MaxPDFPhotons]
array with the pixel location of the sampled pseudo-hits for the pion PDF
short m_pdfPixelP[m_MaxPDFPhotons]
array with the pixel location of the sampled pseudo-hits for the proton PDF
float m_digitWidth[m_MaxPhotons]
Digit calibrated width [ns].
short m_digitPMTNumber[m_MaxPhotons]
Digit PMT number.
int m_nScanPoints
number of points used in the LL scan
short m_nDigits
Total number of digits in the slot where the track is extrapolated.
int m_toyNumber
Number of toys used to populate the arrays of expected hits.
TH2F * m_hitMapMCP
x-t plot of the proton PDF
short m_pdfPixelMU[m_MaxPDFPhotons]
array with the pixel location of the sampled pseudo-hits for the muon PDF
float m_pdfTimeK[m_MaxPDFPhotons]
array with the times of the sampled pseudo-hits for the kaon PDF
int m_pdfToysE
total number of toys from the electron PDF
int m_pdfSamplesP
total number of samples drawn from the proton PDF
PDF construction and log likelihood determination for a given track and particle hypothesis.
double getPDFValue(int pixelID, double time, double timeErr, double sigt=0) const
Returns PDF value.
bool isValid() const
Checks the object status.
double getExpectedPhotons() const
Returns the expected number of all photons within the default time window.
@ c_Fine
y dependent everywhere
static void setTimeWindow(double minTime, double maxTime)
Sets time window.
Reconstructed track at TOP.
Definition: TOPTrack.h:39
bool isValid() const
Checks if track is successfully constructed.
Definition: TOPTrack.h:137
int getModuleID() const
Returns slot ID.
Definition: TOPTrack.h:143
Class that bundles various TrackFitResults.
Definition: Track.h:25
std::vector< std::string > resolveCollections(const std::vector< std::string > &variables)
Resolve Collection Returns variable names corresponding to the given collection or if it is not a col...
Definition: Manager.cc:180
const Var * getVariable(std::string name)
Get the variable belonging to the given key.
Definition: Manager.cc:58
static Manager & Instance()
get singleton instance.
Definition: Manager.cc:26
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:649
TString rn()
Get random string.
Definition: tools.h:38
Abstract base class for different kinds of events.
A variable returning a floating-point value for a given Particle.
Definition: Manager.h:145