Skip to content

Commit 510ce43

Browse files
committed
feat(tcal):Add CI test for TCAL parameters and update containers
1 parent 9a520ec commit 510ce43

14 files changed

Lines changed: 189 additions & 150 deletions

actaf/pars/R3BActafContFact.cxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
#include "R3BLogger.h"
2525
#include "R3BTGeoPar.h"
2626

27-
#include <TClass.h>
28-
2927
static R3BActafContFact gR3BActafContFact;
3028

3129
R3BActafContFact::R3BActafContFact()

los/calib/R3BLosMapped2Cal.cxx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,32 +283,28 @@ void R3BLosMapped2Cal::Exec(Option_t*)
283283
{
284284
calItem->fTimeV_ns[iCha - 1] = times_ns;
285285
if (calItem->fTimeV_ns[iCha - 1] < 0. || IS_NAN(calItem->fTimeV_ns[iCha - 1]))
286-
LOG(info) << "Problem with fTimeV_ns: " << calItem->fTimeV_ns[iCha - 1] << " " << times_ns << " "
287-
<< endl;
286+
LOG(info) << "Problem with fTimeV_ns: " << calItem->fTimeV_ns[iCha - 1] << " " << times_ns;
288287
}
289288

290289
if (iType == 1)
291290
{
292291
calItem->fTimeL_ns[iCha - 1] = times_ns;
293292
if (calItem->fTimeL_ns[iCha - 1] < 0. || IS_NAN(calItem->fTimeL_ns[iCha - 1]))
294-
LOG(info) << "Problem with fTimeL_ns: " << calItem->fTimeL_ns[iCha - 1] << " " << times_ns << " "
295-
<< endl;
293+
LOG(info) << "Problem with fTimeL_ns: " << calItem->fTimeL_ns[iCha - 1] << " " << times_ns;
296294
}
297295

298296
if (iType == 2)
299297
{
300298
calItem->fTimeT_ns[iCha - 1] = times_ns;
301299
if (calItem->fTimeT_ns[iCha - 1] < 0. || IS_NAN(calItem->fTimeT_ns[iCha - 1]))
302-
LOG(info) << "Problem with fTimeT_ns: " << calItem->fTimeT_ns[iCha - 1] << " " << times_ns << " "
303-
<< endl;
300+
LOG(info) << "Problem with fTimeT_ns: " << calItem->fTimeT_ns[iCha - 1] << " " << times_ns;
304301
}
305302

306303
if (iType == 3)
307304
{
308305
calItem->fTimeM_ns[iCha - 1] = times_ns;
309306
if (calItem->fTimeM_ns[iCha - 1] < 0. || IS_NAN(calItem->fTimeM_ns[iCha - 1]))
310-
LOG(info) << "Problem with fTimeM_ns: " << calItem->fTimeM_ns[iCha - 1] << " " << times_ns << " "
311-
<< endl;
307+
LOG(info) << "Problem with fTimeM_ns: " << calItem->fTimeM_ns[iCha - 1] << " " << times_ns;
312308
}
313309
continue;
314310
}

sci8/R3BSci8Mapped2Cal.cxx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -289,24 +289,21 @@ void R3BSci8Mapped2Cal::Exec(Option_t* option)
289289
{
290290
calItem->fTimeV_r_ns = times_ns;
291291
if (calItem->fTimeV_r_ns < 0. || IS_NAN(calItem->fTimeV_r_ns))
292-
LOG(info) << "Problem with fTimeV_r_ns: " << calItem->fTimeV_r_ns << " " << times_ns << " "
293-
<< endl;
292+
LOG(info) << "Problem with fTimeV_r_ns: " << calItem->fTimeV_r_ns << " " << times_ns;
294293
}
295294

296295
if (iType == 1)
297296
{
298297
calItem->fTimeL_r_ns = times_ns;
299298
if (calItem->fTimeL_r_ns < 0. || IS_NAN(calItem->fTimeL_r_ns))
300-
LOG(info) << "Problem with fTimeL_r_ns: " << calItem->fTimeL_r_ns << " " << times_ns << " "
301-
<< endl;
299+
LOG(info) << "Problem with fTimeL_r_ns: " << calItem->fTimeL_r_ns << " " << times_ns;
302300
}
303301

304302
if (iType == 2)
305303
{
306304
calItem->fTimeT_r_ns = times_ns;
307305
if (calItem->fTimeT_r_ns < 0. || IS_NAN(calItem->fTimeT_r_ns))
308-
LOG(info) << "Problem with fTimeT_r_ns: " << calItem->fTimeT_r_ns << " " << times_ns << " "
309-
<< endl;
306+
LOG(info) << "Problem with fTimeT_r_ns: " << calItem->fTimeT_r_ns << " " << times_ns;
310307
}
311308
}
312309

@@ -317,24 +314,21 @@ void R3BSci8Mapped2Cal::Exec(Option_t* option)
317314
{
318315
calItem->fTimeV_l_ns = times_ns;
319316
if (calItem->fTimeV_l_ns < 0. || IS_NAN(calItem->fTimeV_l_ns))
320-
LOG(info) << "Problem with fTimeV_l_ns: " << calItem->fTimeV_l_ns << " " << times_ns << " "
321-
<< endl;
317+
LOG(info) << "Problem with fTimeV_l_ns: " << calItem->fTimeV_l_ns << " " << times_ns;
322318
}
323319

324320
if (iType == 1)
325321
{
326322
calItem->fTimeL_l_ns = times_ns;
327323
if (calItem->fTimeL_l_ns < 0. || IS_NAN(calItem->fTimeL_l_ns))
328-
LOG(info) << "Problem with fTimeL_l_ns: " << calItem->fTimeL_l_ns << " " << times_ns << " "
329-
<< endl;
324+
LOG(info) << "Problem with fTimeL_l_ns: " << calItem->fTimeL_l_ns << " " << times_ns;
330325
}
331326

332327
if (iType == 2)
333328
{
334329
calItem->fTimeT_l_ns = times_ns;
335330
if (calItem->fTimeT_l_ns < 0. || IS_NAN(calItem->fTimeT_l_ns))
336-
LOG(info) << "Problem with fTimeT_l_ns: " << calItem->fTimeT_l_ns << " " << times_ns << " "
337-
<< endl;
331+
LOG(info) << "Problem with fTimeT_l_ns: " << calItem->fTimeT_l_ns << " " << times_ns;
338332
}
339333
}
340334

tcal/CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@
1111
# or submit itself to any jurisdiction. #
1212
##############################################################################
1313

14-
set(SRCS R3BTCalModulePar.cxx R3BTCalPar.cxx R3BTCalContFact.cxx R3BTCalEngine.cxx)
15-
set(HEADERS R3BTCalModulePar.h R3BTCalPar.h R3BTCalContFact.h R3BTCalEngine.h)
14+
set(SRCS
15+
R3BTCalModulePar.cxx
16+
R3BTCalPar.cxx
17+
R3BTCalContFact.cxx
18+
R3BTCalEngine.cxx)
19+
set(HEADERS
20+
R3BTCalModulePar.h
21+
R3BTCalPar.h
22+
R3BTCalContFact.h
23+
R3BTCalEngine.h)
1624

1725
add_library_with_dictionary(
1826
LIBNAME
@@ -27,3 +35,5 @@ add_library_with_dictionary(
2735
${CMAKE_CURRENT_SOURCE_DIR}
2836
DEPENDENCIES
2937
R3BBase)
38+
39+
add_subdirectory(test)

tcal/R3BTCalContFact.cxx

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,35 @@
1111
* or submit itself to any jurisdiction. *
1212
******************************************************************************/
1313

14-
#include "FairParSet.h"
15-
#include "FairRuntimeDb.h"
14+
#include <FairParSet.h>
15+
#include <FairRuntimeDb.h>
1616

1717
#include "R3BLogger.h"
1818
#include "R3BTCalContFact.h"
1919
#include "R3BTCalPar.h"
2020

21-
#include "TList.h"
22-
#include <string.h>
23-
2421
static R3BTCalContFact gR3BTCalContFact;
2522

2623
R3BTCalContFact::R3BTCalContFact()
2724
{
2825
// Constructor (called when the library is loaded)
2926
fName = "R3BTCalContFact";
30-
fTitle = "Tutorial factory for parameter containers";
27+
fTitle = "Factory for TCal parameter containers";
3128
setAllContainers();
3229
FairRuntimeDb::instance()->addContFactory(this);
3330
}
3431

3532
void R3BTCalContFact::addContainer(TString name, TString description)
3633
{
37-
auto container = new FairContainer(name, description, "TestDefaultContext");
38-
container->addContext("TestNonDefaultContext");
39-
containers->Add(container);
34+
auto container = std::make_unique<FairContainer>(name.Data(), description.Data(), "DefaultContext");
35+
containers->Add(container.release());
4036
}
4137

4238
void R3BTCalContFact::setAllContainers()
43-
{
44-
/** Creates the Container objects with all accepted contexts and adds
45-
* them to the list of containers.*/
39+
{ /**
40+
** Creates the Container objects with all accepted contexts and adds
41+
** them to the list of containers.
42+
**/
4643
addContainer("LandTCalPar", "NeuLAND TCAL Calibration Parameters");
4744
addContainer("LosTCalPar", "LOS TCAL Calibration Parameters");
4845
addContainer("RoluTCalPar", "ROLU TCAL Calibration Parameters");
@@ -81,13 +78,13 @@ void R3BTCalContFact::setAllContainers()
8178
}
8279

8380
FairParSet* R3BTCalContFact::createContainer(FairContainer* c)
84-
{
85-
/** Calls the constructor of the corresponding parameter container.
86-
* For an actual context, which is not an empty string and not the default context
87-
* of this container, the name is concatinated with the context. */
88-
89-
const char* name = c->GetName();
90-
R3BLOG(info, name);
81+
{ /**
82+
** Calls the constructor of the corresponding parameter container. For an
83+
** actual context, which is not an empty string and not the default context
84+
** of this container, the name is concatinated with the context.
85+
**/
86+
const std::string name(c->GetName());
87+
R3BLOG(info, "Create container name: " << name.c_str());
9188

9289
containerNames.push_back("LandTCalPar");
9390
containerNames.push_back("LosTCalPar");
@@ -125,25 +122,14 @@ FairParSet* R3BTCalContFact::createContainer(FairContainer* c)
125122
PUSH_FIBER(Fi32);
126123
PUSH_FIBER(Fi33);
127124

128-
// bool found = false;
129125
for (auto containerName : containerNames)
130126
{
131-
if (strncmp(name, containerName, strlen(containerName)) == 0)
127+
if (name == containerName)
132128
{
133-
// found = true;
134-
// break;
135129
return new R3BTCalPar(c->getConcatName().Data(), c->GetTitle(), c->getContext());
136130
}
137131
}
138-
139-
/* if (found == true)
140-
{
141-
return new R3BTCalPar(c->getConcatName().Data(), c->GetTitle(), c->getContext());
142-
}
143-
else
144-
{*/
145132
return nullptr;
146-
// }
147133
}
148134

149-
ClassImp(R3BTCalContFact);
135+
ClassImp(R3BTCalContFact)

tcal/R3BTCalContFact.h

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,11 @@
1717

1818
#include <Rtypes.h>
1919
#include <TString.h>
20+
#include <string.h>
2021
#include <vector>
2122

2223
class FairParSet;
2324

24-
/**
25-
* Factory class for all TCAL parameter containers.
26-
* Currently supported:
27-
* NeuLAND - LandTCalPar
28-
* LOS - LosTCalPar
29-
* @author D. Kresan
30-
* @since September 3, 2015
31-
*/
3225
class R3BTCalContFact : public FairContFact
3326
{
3427
public:
@@ -40,18 +33,18 @@ class R3BTCalContFact : public FairContFact
4033
/**
4134
* Destructor.
4235
*/
43-
~R3BTCalContFact() {}
36+
virtual ~R3BTCalContFact() = default;
4437

4538
/**
4639
* Method to create a parameter container.
4740
* Called by FairRuntimeDB singleton class.
4841
* @param c a parameter container.
4942
* @return an instance of created parameter set.
5043
*/
51-
FairParSet* createContainer(FairContainer* c);
44+
FairParSet* createContainer(FairContainer* c) override;
5245

5346
private:
54-
std::vector<const char*> containerNames;
47+
std::vector<std::string> containerNames;
5548
/**
5649
* Method to add a standard container
5750
*/
@@ -86,5 +79,5 @@ class R3BTCalContFact : public FairContFact
8679
void setAllContainers();
8780

8881
public:
89-
ClassDef(R3BTCalContFact, 1);
82+
ClassDefOverride(R3BTCalContFact, 2);
9083
};

tcal/R3BTCalEngine.cxx

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ void R3BTCalEngine::Fill(Int_t plane, Int_t paddle, Int_t side, Int_t tdc)
4848
}
4949
if (NULL == fhData[plane - 1][paddle - 1][side - 1])
5050
{
51-
char strName[255];
52-
sprintf(strName, "%s_tcaldata_%d_%d_%d", fCal_Par->GetName(), plane, paddle, side);
53-
fhData[plane - 1][paddle - 1][side - 1] = new TH1F(strName, "", 4097, -0.5, 4096.5);
54-
sprintf(strName, "%s_time_%d_%d_%d", fCal_Par->GetName(), plane, paddle, side);
55-
fhTime[plane - 1][paddle - 1][side - 1] = new TH1F(strName, "", 4097, -0.5, 4096.5);
51+
TString strName;
52+
strName.Form("%s_tcaldata_%d_%d_%d", fCal_Par->GetName(), plane, paddle, side);
53+
fhData[plane - 1][paddle - 1][side - 1] = new TH1F(strName.Data(), "", 4097, -0.5, 4096.5);
54+
55+
strName.Form("%s_time_%d_%d_%d", fCal_Par->GetName(), plane, paddle, side);
56+
fhTime[plane - 1][paddle - 1][side - 1] = new TH1F(strName.Data(), "", 4097, -0.5, 4096.5);
5657
}
5758
fhData[plane - 1][paddle - 1][side - 1]->Fill(tdc);
5859

@@ -128,7 +129,6 @@ void R3BTCalEngine::CalculateParamClockTDC(enum CTDCVariant a_variant)
128129
}
129130
}
130131
}
131-
132132
fCal_Par->setChanged();
133133
}
134134

@@ -168,8 +168,7 @@ void R3BTCalEngine::CalculateParamTacquila()
168168

169169
Int_t nparam = 0;
170170

171-
R3BTCalModulePar* pTCal = NULL;
172-
pTCal = new R3BTCalModulePar();
171+
auto pTCal = new R3BTCalModulePar();
173172
pTCal->SetPlane(i + 1);
174173
pTCal->SetPaddle(j + 1);
175174
pTCal->SetSide(k + 1);
@@ -283,10 +282,6 @@ void R3BTCalEngine::CalculateParamVFTX()
283282

284283
for (Int_t k = 0; k < N_SIDE_MAX; k++)
285284
{
286-
287-
// if(i == 0) LOG(info) << "R3BTCalEngine::CalculateParamVFTX() : Detector: "<<i<<", Channel: "<<j<<",
288-
// Type: " << k;
289-
290285
if (NULL == fhData[i][j][k])
291286
{
292287
// LOG(info) << "R3BTCalEngine::CalculateParamVFTX() : NULL: " << fhData[i][j][k];
@@ -316,8 +311,7 @@ void R3BTCalEngine::CalculateParamVFTX()
316311

317312
Int_t nparam = 0;
318313

319-
R3BTCalModulePar* pTCal = NULL;
320-
pTCal = new R3BTCalModulePar();
314+
auto pTCal = new R3BTCalModulePar();
321315
pTCal->SetPlane(i + 1);
322316
pTCal->SetPaddle(j + 1);
323317
pTCal->SetSide(k + 1);

tcal/R3BTCalEngine.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class TH1F;
2929

3030
/**
3131
* Class with implementation of TCAL time calibration.
32-
* Currently supported electronics: Clock TDC, Tacquila, and VFTX.
32+
* Currently supported electronics: Clock TDC, Tamex3, TRB3, Tacquila, and VFTX.
3333
* Clock frequency is set as a constant in MHz and the
3434
* clock cycle in ns is calculated from it.
3535
* Recommended value of minimum statistics per module is
@@ -144,5 +144,5 @@ class R3BTCalEngine : public TObject
144144
Double_t fClockFreq; /**< A clock cycle in [ns]. */
145145

146146
public:
147-
ClassDef(R3BTCalEngine, 1)
147+
ClassDef(R3BTCalEngine, 1);
148148
};

0 commit comments

Comments
 (0)