Skip to content

Commit fdfbc46

Browse files
committed
fix(Alpide): Minor change
fix(FOOT): clang format fix(Alpide): Fixing and histogram reseting style(Alpide): Changed limits of the histograms feat(FOOT): Setter for histogram limits
1 parent edcae2d commit fdfbc46

14 files changed

Lines changed: 794 additions & 74 deletions

alpide/online/R3BAlpideOnlineSpectra.cxx

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ InitStatus R3BAlpideOnlineSpectra::Init()
179179
}
180180
mainfol->Add(calfol);
181181

182-
fh1_Calmult_total = R3B::root_owned<TH1F>("fh1_mulcal_sensor_total", "Cal_mult for all sensors", 70, 0, 70);
182+
fh1_Calmult_total =
183+
R3B::root_owned<TH1F>("fh1_mulcal_sensor_total", "Cal_mult for all sensors", 70, -0.5, 69.5);
183184
fh1_Calmult_total->GetXaxis()->SetTitle("Pixel multiplicity");
184185
fh1_Calmult_total->GetYaxis()->SetTitle("Counts");
185186
fh1_Calmult_total->GetYaxis()->SetTitleOffset(1.1);
@@ -231,7 +232,7 @@ InitStatus R3BAlpideOnlineSpectra::Init()
231232
cHit->Divide(2, 1);
232233
sprintf(Name1, "fh2_pos_hit_sensor_%d", s + 1);
233234
sprintf(Name2, "Hit-position for sensor: %d", s + 1);
234-
fh2_PosHit[s] = R3B::root_owned<TH2F>(Name1, Name2, 200, -15.0, 15.0, 100, -7.5, 7.5);
235+
fh2_PosHit[s] = R3B::root_owned<TH2F>(Name1, Name2, 200, 0, 30., 100, 0, 15.);
235236
fh2_PosHit[s]->GetXaxis()->SetTitle("Posl [mm]");
236237
fh2_PosHit[s]->GetYaxis()->SetTitle("Post [mm]");
237238
fh2_PosHit[s]->GetYaxis()->SetTitleOffset(1.1);
@@ -270,6 +271,34 @@ InitStatus R3BAlpideOnlineSpectra::Init()
270271
fh1_Clustermult[s]->Draw();
271272
hitfol->Add(cHitm);
272273
}
274+
275+
auto cHitmTot = new TCanvas("Cluster_multiplicity_total", "mult hit info", 10, 10, 500, 500);
276+
fh1_Clustermult_total =
277+
R3B::root_owned<TH1F>("Cluster_multiplicity_total", "Total cluster multiplicity", 60, 0, 60);
278+
fh1_Clustermult_total->GetXaxis()->SetTitle("Cluster multiplicity");
279+
fh1_Clustermult_total->GetYaxis()->SetTitle("Counts");
280+
fh1_Clustermult_total->GetYaxis()->SetTitleOffset(1.1);
281+
fh1_Clustermult_total->GetXaxis()->CenterTitle(true);
282+
fh1_Clustermult_total->GetYaxis()->CenterTitle(true);
283+
fh1_Clustermult_total->SetLineColor(1);
284+
fh1_Clustermult_total->SetFillColor(31);
285+
cHitmTot->cd();
286+
fh1_Clustermult_total->Draw();
287+
hitfol->Add(cHitmTot);
288+
289+
auto cSizemTot = new TCanvas("Size_multiplicity_total", "size hit info", 10, 10, 500, 500);
290+
fh1_Clustersize_total = R3B::root_owned<TH1F>("Size_multiplicity_total", "Total size multiplicity", 60, 0, 60);
291+
fh1_Clustersize_total->GetXaxis()->SetTitle("Size multiplicity");
292+
fh1_Clustersize_total->GetYaxis()->SetTitle("Counts");
293+
fh1_Clustersize_total->GetYaxis()->SetTitleOffset(1.1);
294+
fh1_Clustersize_total->GetXaxis()->CenterTitle(true);
295+
fh1_Clustersize_total->GetYaxis()->CenterTitle(true);
296+
fh1_Clustersize_total->SetLineColor(1);
297+
fh1_Clustersize_total->SetFillColor(31);
298+
cSizemTot->cd();
299+
fh1_Clustersize_total->Draw();
300+
hitfol->Add(cSizemTot);
301+
273302
mainfol->Add(hitfol);
274303

275304
cHit_angcor = new TCanvas("Theta_vs_Phi", "Correlation theta vs phi", 10, 10, 500, 500);
@@ -458,8 +487,16 @@ void R3BAlpideOnlineSpectra::Reset_Histo()
458487
{
459488
hist->Reset();
460489
}
490+
461491
fh2_theta_phi->Reset();
462492
fh2_max_clusters->Reset();
493+
494+
for (auto& hist : fh2_y_x)
495+
{
496+
hist->Reset();
497+
}
498+
fh1_Clustermult_total->Reset();
499+
fh1_Clustersize_total->Reset();
463500
}
464501

465502
return;
@@ -539,6 +576,7 @@ void R3BAlpideOnlineSpectra::Exec(Option_t* /*option*/)
539576
std::vector<double> y_max(2, NAN);
540577
std::vector<int> cls_size(2, 0);
541578

579+
fh1_Clustermult_total->Fill(nHits);
542580
for (size_t ihit = 0; ihit < nHits; ihit++)
543581
{
544582
auto hit = dynamic_cast<R3BAlpideHitData*>(fHitItems->At(ihit));
@@ -547,6 +585,7 @@ void R3BAlpideOnlineSpectra::Exec(Option_t* /*option*/)
547585
auto senid = hit->GetSensorId() - 1;
548586
fh1_Clustersize[senid]->Fill(hit->GetClusterSize());
549587
fh2_PosHit[senid]->Fill(hit->GetPosl(), hit->GetPost());
588+
fh1_Clustersize_total->Fill(hit->GetClusterSize());
550589
if (fMap_Par->GetGeoVersion() == 202505)
551590
{
552591
fh2_theta_phi->Fill(hit->GetPhi() * TMath::RadToDeg(), hit->GetTheta() * TMath::RadToDeg());
@@ -575,6 +614,7 @@ void R3BAlpideOnlineSpectra::Exec(Option_t* /*option*/)
575614
}
576615
}
577616
}
617+
578618
mult[senid]++;
579619
}
580620
for (size_t s = 0; s < fNbSensors; s++)
@@ -585,12 +625,16 @@ void R3BAlpideOnlineSpectra::Exec(Option_t* /*option*/)
585625
{
586626
if (std::isfinite(x_max[0]) && std::isfinite(x_max[1]))
587627
fh2_y_x_cor_det[0]->Fill(x_max[0], x_max[1]);
628+
588629
if (std::isfinite(y_max[0]) && std::isfinite(y_max[1]))
589630
fh2_y_x_cor_det[1]->Fill(y_max[0], y_max[1]);
631+
590632
if (std::isfinite(x_max[0]) && std::isfinite(y_max[1]))
591633
fh2_y_x_cor_det[2]->Fill(x_max[0], y_max[1]);
592-
if (std::isfinite(x_max[2]) && std::isfinite(y_max[0]))
634+
635+
if (std::isfinite(x_max[1]) && std::isfinite(y_max[0]))
593636
fh2_y_x_cor_det[3]->Fill(x_max[1], y_max[0]);
637+
594638
if (cls_size[0] > 0 && cls_size[1] > 0)
595639
fh2_max_clusters->Fill(cls_size[0], cls_size[1]);
596640
}
@@ -639,6 +683,7 @@ void R3BAlpideOnlineSpectra::FinishTask()
639683
if (fHitItems)
640684
{
641685
fh2_theta_phi->Write();
686+
642687
fh2_max_clusters->Write();
643688
for (const auto& hist : fh2_y_x)
644689
{
@@ -648,6 +693,9 @@ void R3BAlpideOnlineSpectra::FinishTask()
648693
{
649694
hist->Write();
650695
}
696+
697+
fh1_Clustermult_total->Write();
698+
fh1_Clustersize_total->Write();
651699
}
652700
}
653701
ClassImp(R3BAlpideOnlineSpectra)

alpide/online/R3BAlpideOnlineSpectra.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ class R3BAlpideOnlineSpectra : public FairTask
125125
std::vector<TH2F*> fh2_y_x_cor_det;
126126
TH2F* fh2_max_clusters;
127127

128+
TH1F* fh1_Clustermult_total;
129+
TH1F* fh1_Clustersize_total;
130+
128131
TCanvas* cCalPixelSize = nullptr;
129132
TCanvas* cHit_angcor = nullptr;
130133

ssd/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ set(SRCS
3535
calibration/R3BAmsStripCal2Hit.cxx
3636
online/R3BAmsOnlineSpectra.cxx
3737
online/R3BAmsCalifaCorrelatedOnlineSpectra.cxx
38+
online/R3BFootVsAlpideOnlineSpectra.cxx
3839
online/R3BFootOnlineSpectra.cxx
3940
pars/R3BFootMappingPar.cxx
4041
pars/R3BFootCalPar.cxx
41-
pars/R3BFootHitPar.cxx
42+
pars/R3BFootHitPar.cxx
4243
calibration/R3BFootMapped2StripCal.cxx
4344
calibration/R3BFootStripCal2Hit.cxx)
4445

@@ -66,10 +67,11 @@ set(HEADERS
6667
calibration/R3BAmsStripCal2Hit.h
6768
online/R3BAmsOnlineSpectra.h
6869
online/R3BAmsCalifaCorrelatedOnlineSpectra.h
70+
online/R3BFootVsAlpideOnlineSpectra.h
6971
online/R3BFootOnlineSpectra.h
7072
pars/R3BFootMappingPar.h
7173
pars/R3BFootCalPar.h
72-
pars/R3BFootHitPar.h
74+
pars/R3BFootHitPar.h
7375
calibration/R3BFootMapped2StripCal.h
7476
calibration/R3BFootStripCal2Hit.h)
7577

ssd/SsdLinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#pragma link C++ class R3BAmsStripCal2Hit+;
4444
#pragma link C++ class R3BAmsOnlineSpectra+;
4545
#pragma link C++ class R3BAmsCalifaCorrelatedOnlineSpectra+;
46+
#pragma link C++ class R3BFootVsAlpideOnlineSpectra;
4647
#pragma link C++ class vector<R3B::DetectorMappedData>+;
4748

4849
#pragma link C++ class R3BFootMappingPar+;

ssd/calibration/R3BFootMapped2StripCal.cxx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,13 @@ void R3BFootMapped2StripCal::SetPedestals(Int_t thr, TString conf)
294294
Float_t ped = h1_peds->GetBinContent(istrip + 1);
295295
Float_t sig = h1_sigma->GetBinContent(istrip + 1);
296296

297+
// Do not update dead strip
298+
if (sigmas[iDet][istrip] == -1)
299+
{
300+
sig = -1.;
301+
ped = -1.;
302+
}
303+
297304
sigmas[iDet][istrip] = sig;
298305
pedestals[iDet][istrip] = ped;
299306

@@ -312,7 +319,16 @@ void R3BFootMapped2StripCal::SetPedestals(Int_t thr, TString conf)
312319
fine_sigmas[iDet][istrip] = h1_sigma->GetBinContent(istrip + 1);
313320
fCal_Par->SetFineSigma(fine_sigmas[iDet][istrip], iDet * fNStrip + istrip);
314321
fCal_Par->setChanged(kTRUE);
315-
sigmas[iDet][istrip] = fine_sigmas[iDet][istrip];
322+
Float_t sig;
323+
if (sigmas[iDet][istrip] == -1)
324+
{
325+
sig = -1.;
326+
}
327+
else
328+
{
329+
sig = fine_sigmas[iDet][istrip];
330+
}
331+
sigmas[iDet][istrip] = sig;
316332
}
317333
}
318334

@@ -423,7 +439,7 @@ void R3BFootMapped2StripCal::Exec(Option_t* /*option*/)
423439
h2_fine[detId]->Fill(stripId + 1, energies[detId][stripId]);
424440
}
425441

426-
if (energies[detId][stripId] > 0. && pedestals[detId][stripId] != -1)
442+
if (energies[detId][stripId] > 0. && sigmas[detId][stripId] != -1)
427443
StripCounter[detId]++;
428444
}
429445

@@ -432,9 +448,11 @@ void R3BFootMapped2StripCal::Exec(Option_t* /*option*/)
432448
detId = data->GetDetId() - 1;
433449
stripId = data->GetStripId() - 1;
434450

435-
if (pedestals[detId][stripId] != -1 &&
451+
if (sigmas[detId][stripId] != -1 &&
436452
StripCounter[detId] < fNStrip) // allow also negative values for the energies
453+
{
437454
AddCalData(detId + 1, stripId + 1, energies[detId][stripId], fine_sigmas[detId][stripId]);
455+
}
438456
}
439457
}
440458

ssd/calibration/R3BFootStripCal2Hit.cxx

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
// FOOT headers
3636
#include "R3BFootCalData.h"
3737
#include "R3BFootHitData.h"
38+
#include "R3BFootHitPar.h"
3839
#include "R3BFootMappingPar.h"
3940
#include "R3BFootStripCal2Hit.h"
4041
#include "R3BLogger.h"
@@ -70,6 +71,17 @@ void R3BFootStripCal2Hit::SetParContainers()
7071
{
7172
R3BLOG(info, "footMappingPar found");
7273
}
74+
75+
R3BLOG(info, "Calling SetParContainers()");
76+
fHit_Par = dynamic_cast<R3BFootHitPar*>(rtdb->getContainer("footHitPar"));
77+
if (!fHit_Par)
78+
{
79+
R3BLOG(error, "SetParContainers(): footHitPar not found");
80+
}
81+
else
82+
{
83+
R3BLOG(info, "SetParContainers(): footHitPar loaded correctly");
84+
}
7385
}
7486

7587
void R3BFootStripCal2Hit::SetParameter()
@@ -92,6 +104,28 @@ void R3BFootStripCal2Hit::SetParameter()
92104
fOffsetY.push_back(fMap_Par->GetOffsetY(i + 1));
93105
}
94106
fMap_Par->printParams();
107+
108+
if (!fHit_Par)
109+
{
110+
R3BLOG(error, "SetParameter(): fHit_Par is NULL");
111+
}
112+
else
113+
{
114+
R3BLOG(info, TString::Format("SetParameter(): fHit_Par is VALID, NumParsFit = %d", fHit_Par->GetNumParsFit()));
115+
}
116+
117+
fNumParsFit = fHit_Par->GetNumParsFit();
118+
HitCalParams = fHit_Par->GetCharCalParams();
119+
Int_t array_size = fMaxNumDet * fNumParsFit;
120+
HitCalParams->Set(array_size);
121+
122+
for (int d = 0; d < fMaxNumDet; d++)
123+
{
124+
for (int j = 0; j < fNumParsFit; j++)
125+
{
126+
fCharCalPar.push_back(HitCalParams->GetAt(d * fNumParsFit + j));
127+
}
128+
}
95129
}
96130

97131
// ----- Public method Init -------------------------------------------------
@@ -224,9 +258,6 @@ void R3BFootStripCal2Hit::Exec(Option_t* /*option*/)
224258
int k = j + 1;
225259
while (k < StripE[i].size())
226260
{
227-
if (StripI[i][k] - StripI[i][k - 1] != 1)
228-
break;
229-
230261
if (StripE[i][k] < fTimesSigmas * StripS[i][k])
231262
break;
232263

@@ -333,9 +364,25 @@ void R3BFootStripCal2Hit::Exec(Option_t* /*option*/)
333364
TVector3 master(x, y, z);
334365
// TODO: Eta correction not used at the moment
335366

367+
// Charge calibration (charge = m * energy + n)
368+
double m = 1;
369+
double n = 0;
370+
371+
if (fCharCalPar.size() > 0)
372+
{
373+
if (fCharCalPar[i * fNumParsFit] != 0)
374+
{
375+
m = fCharCalPar[i * fNumParsFit];
376+
n = fCharCalPar[i * fNumParsFit + 1];
377+
}
378+
}
379+
380+
double charge = m * ClusterESum[i][j] + n;
381+
336382
if (ClusterESum[i][j] > fThSum && j < fMaxNumClusters)
337383
{
338-
AddHitData(i + 1, ClusterNStrip[i][j], pos, master, ClusterESum[i][j], ClusterMult[i], Eta[i][j]);
384+
AddHitData(
385+
i + 1, ClusterNStrip[i][j], pos, master, ClusterESum[i][j], ClusterMult[i], Eta[i][j], charge);
339386
}
340387
else
341388
{
@@ -375,11 +422,12 @@ R3BFootHitData* R3BFootStripCal2Hit::AddHitData(uint8_t detid,
375422
TVector3 master,
376423
double energy_s,
377424
uint16_t mulS,
378-
double eta)
425+
double eta,
426+
double charge)
379427
{
380428
TClonesArray& clref = *fFootHitData;
381429
int size = clref.GetEntriesFast();
382-
return new (clref.ConstructedAt(size)) R3BFootHitData(detid, numhit, pos, master, energy_s, mulS, eta);
430+
return new (clref.ConstructedAt(size)) R3BFootHitData(detid, numhit, pos, master, energy_s, mulS, eta, charge);
383431
}
384432

385433
ClassImp(R3BFootStripCal2Hit)

ssd/calibration/R3BFootStripCal2Hit.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@
2323
#include <FairTask.h>
2424

2525
#include <Rtypes.h>
26+
#include <TArrayF.h>
2627
#include <TVector3.h>
2728
#include <vector>
2829

2930
class TClonesArray;
3031
class TH1F;
3132
class R3BFootMappingPar;
33+
class R3BFootHitPar;
3234

3335
class R3BFootStripCal2Hit : public FairTask
3436
{
@@ -80,12 +82,15 @@ class R3BFootStripCal2Hit : public FairTask
8082
double fTimesSigmas = 3.;
8183
int fMaxNumDet = 16;
8284
int fMaxNumClusters = 10;
85+
int fNumParsFit = 2;
8386
std::vector<double> fDistTarget;
8487
std::vector<double> fAngleTheta;
8588
std::vector<double> fAnglePhi;
8689
std::vector<double> fOffsetX;
8790
std::vector<double> fOffsetY;
91+
std::vector<double> fCharCalPar;
8892
std::vector<TH1F*> hssd;
93+
TArrayF* HitCalParams = nullptr;
8994

9095
std::vector<int> ClusterMult; // Cluster multiplicity
9196
std::vector<std::vector<double>> ClusterPos; // Position of Cluster from Weighted Average
@@ -97,8 +102,10 @@ class R3BFootStripCal2Hit : public FairTask
97102
std::vector<std::vector<std::vector<double>>> ClusterE; // Energy of Strip in Cluster
98103

99104
R3BFootMappingPar* fMap_Par = nullptr; // Parameter container with mapping
100-
TClonesArray* fFootCalData = nullptr; // Array with FOOT Cal-input data
101-
TClonesArray* fFootHitData = nullptr; // Array with FOOT Hit-output data
105+
R3BFootHitPar* fHit_Par = nullptr; // Parameter container with hit params
106+
107+
TClonesArray* fFootCalData = nullptr; // Array with FOOT Cal-input data
108+
TClonesArray* fFootHitData = nullptr; // Array with FOOT Hit-output data
102109

103110
bool fOnline = false; // Don't store data for online
104111
Double_t* fChannelPeaks;
@@ -110,7 +117,8 @@ class R3BFootStripCal2Hit : public FairTask
110117
TVector3 master,
111118
double energy_s,
112119
uint16_t mulS,
113-
double eta);
120+
double eta,
121+
double charge);
114122

115123
public:
116124
// Class definition

0 commit comments

Comments
 (0)