R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandMappingPar.cxx
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2025 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13
14// -------------------------------------------------------------
15// ----- R3BTofDMappingPar source file -----
16// ----- Created 18/03/22 by J.L. Rodriguez-Sanchez -----
17// -------------------------------------------------------------
18
20
21#include "FairParamList.h"
22#include "R3BLogger.h"
23
24#include "TMath.h"
25#include "TString.h"
26
27// ---- Standard Constructor ---------------------------------------------------
28R3BNeulandMappingPar::R3BNeulandMappingPar(const TString& name, const TString& title, const TString& context)
29 : FairParGenericSet(name, title, context)
30 , fNumPlanes(60)
31 , fNumPaddles(50)
32 , fNumPmts(2)
33{
34 for (Int_t p = 0; p < fNumPmts; p++)
35 {
36 fTrigmap[p].resize(fNumPlanes);
37 }
38 for (Int_t plane = 0; plane < fNumPlanes; plane++)
39 for (Int_t p = 0; p < fNumPmts; p++)
40 {
41 fTrigmap[p][plane] = new TArrayI(fNumPaddles);
42 for (Int_t paddle = 0; paddle < fNumPaddles; paddle++)
43 fTrigmap[p][plane]->AddAt(0, paddle);
44 }
45}
46
47// ---- Destructor ------------------------------------------------------------
49{
50 clear();
51 for (Int_t plane = 0; plane < fNumPlanes; plane++)
52 for (Int_t p = 0; p < fNumPmts; p++)
53 {
54 if (fTrigmap[p][plane])
55 delete fTrigmap[p][plane];
56 }
57}
58
59// ---- Method clear ----------------------------------------------------------
61{
62 status = kFALSE;
63 resetInputVersions();
64}
65
66// ---- Method putParams ------------------------------------------------------
67void R3BNeulandMappingPar::putParams(FairParamList* list)
68{
69 R3BLOG(info, "called");
70 if (!list)
71 {
72 R3BLOG(fatal, "FairParamList not found");
73 return;
74 }
75 list->add("neulandPlanesPar", fNumPlanes);
76 list->add("neulandPaddlesPar", fNumPaddles);
77
78 R3BLOG(info, "Nb of planes: " << fNumPlanes);
79 R3BLOG(info, "Nb of paddles: " << fNumPaddles);
80
81 for (Int_t p = 0; p < fNumPmts; p++)
82 {
83 fTrigmap[p].resize(fNumPlanes);
84 }
85 char name[300];
86 for (Int_t plane = 0; plane < fNumPlanes; plane++)
87 for (Int_t p = 0; p < fNumPmts; p++)
88 {
89 fTrigmap[p][plane]->Set(fNumPaddles);
90 sprintf(name, "neulandplane%dPmt%dPar", plane + 1, p + 1);
91 list->add(name, *fTrigmap[p][plane]);
92 }
93}
94
95// ---- Method getParams ------------------------------------------------------
96Bool_t R3BNeulandMappingPar::getParams(FairParamList* list)
97{
98 R3BLOG(info, "called");
99 if (!list)
100 {
101 R3BLOG(fatal, "FairParamList not found");
102 return kFALSE;
103 }
104 if (!list->fill("neulandPlanesPar", &fNumPlanes))
105 {
106 R3BLOG(info, "Could not initialize neulandPlanesPar");
107 return kFALSE;
108 }
109 if (!list->fill("neulandPaddlesPar", &fNumPaddles))
110 {
111 R3BLOG(info, "Could not initialize neulandPaddlesPar");
112 return kFALSE;
113 }
114
115 for (Int_t p = 0; p < fNumPmts; p++)
116 {
117 fTrigmap[p].resize(fNumPlanes);
118 }
119 char name[300];
120 for (Int_t plane = 0; plane < fNumPlanes; plane++)
121 for (Int_t p = 0; p < fNumPmts; p++)
122 {
123 fTrigmap[p][plane]->Set(fNumPaddles);
124 sprintf(name, "neulandplane%dPmt%dPar", plane + 1, p + 1);
125
126 if (!(list->fill(name, fTrigmap[p][plane])))
127 {
128 R3BLOG(error, "Could not initialize " << name);
129 return kFALSE;
130 }
131 }
132
133 return kTRUE;
134}
135
136// ---- Method print ----------------------------------------------------------
138
139// ---- Method printParams ----------------------------------------------------
141{
142 R3BLOG(info, "Mapping params for Neuland: Num of planes: " << fNumPlanes << " and paddles: " << fNumPaddles);
143
144 for (Int_t plane = 0; plane < fNumPlanes; plane++)
145 for (Int_t p = 0; p < fNumPmts; p++)
146 for (Int_t paddle = 0; paddle < fNumPaddles; paddle++)
147 {
148 R3BLOG(info,
149 "Plane: " << plane + 1 << ", pmt: " << p + 1 << ", paddle: " << paddle + 1
150 << ", value: " << fTrigmap[p][plane]->GetAt(paddle));
151 }
152}
153
#define R3BLOG(severity, x)
Definition R3BLogger.h:35
ClassImp(R3BNeulandMappingPar)
virtual ~R3BNeulandMappingPar()
Destructor.
virtual void putParams(FairParamList *list)
Store all parameters using FairRuntimeDB.
Bool_t getParams(FairParamList *list)
Retrieve all parameters using FairRuntimeDB.
virtual void print()
Print values of parameters to the standard output.
virtual void clear()
Reset all parameters.
R3BNeulandMappingPar(const TString &name="neulandMappingPar", const TString &title="Neuland Mapping parameters", const TString &context="neulandMappingContext")
Standard constructor.