Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions actaf/calibration/R3BActafCal2Hit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ void R3BActafCal2Hit::Exec(Option_t*)
auto ring = fActafGeo->GetRingId(pad);
auto zpos = calData->GetZpos();
auto energy = calData->GetEnergy();
auto maxAmpl = calData->GetEMaxAmpl();
TVector3 track = fActafGeo->GetPosition(pad);
AddHitData(pad, (pad < 65 ? 1 : 2), ring, track.X(), track.Y(), zpos, energy, track);
AddHitData(pad, (pad < 65 ? 1 : 2), ring, track.X(), track.Y(), zpos, energy, track, maxAmpl);
}
return;
}
Expand All @@ -134,12 +135,13 @@ R3BActafHitData* R3BActafCal2Hit::AddHitData(UInt_t padId,
double ypos,
double zpos,
double energy,
TVector3 track)
TVector3 track,
double maxAmpl)
{
// It fills the R3BActafCalData
TClonesArray& clref = *fActafHitData;
Int_t size = clref.GetEntriesFast();
return new (clref[size]) R3BActafHitData(padId, side, ring, xpos, ypos, zpos, energy, track);
return new (clref[size]) R3BActafHitData(padId, side, ring, xpos, ypos, zpos, energy, track, maxAmpl);
}

ClassImp(R3BActafCal2Hit)
3 changes: 2 additions & 1 deletion actaf/calibration/R3BActafCal2Hit.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ class R3BActafCal2Hit : public FairTask
double ypos,
double zpos,
double energy,
TVector3 track);
TVector3 track,
double maxAmpl);

public:
// Class definition
Expand Down
16 changes: 14 additions & 2 deletions actaf/calibration/R3BActafMapped2Cal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <TClonesArray.h>
#include <TMath.h>
#include <array>
#include <fstream>
#include <iostream>
#include <numeric>
#include <utility>
Expand Down Expand Up @@ -245,15 +246,26 @@ void R3BActafMapped2Cal::Exec(Option_t*)
continue;

std::array<double, ACTAF_BINS> waveform = mappedData->GetTrace();
int maxPos = FindMaxPosition(waveform);

// Calculate rms before filtering
int maxPos = FindMaxPosition(waveform);

double rmsRaw = ComputeBaselineMean(waveform, maxPos, 0);
double meanRaw = ComputeBaselineMean(waveform, maxPos, 1) + mappedData->GetBaseline();
// Apply the SG filter to the waveform

// create baseline-subtracted copy and write it to file (temporary tool)
std::array<double, ACTAF_BINS> waveform_bs = waveform;
double baseline = meanRaw;
for (auto& x : waveform_bs)
x -= baseline;

// Apply the SG filter to the waveform (on baseline-subtracted data)
if (fApplySGFilter)
ApplySGFilter(waveform, fSgCoeffs);

// Use baseline-subtracted waveform for further processing
// waveform = waveform_bs;

auto integral = IntegratePulse(waveform, mappedData->GetMaxpos());
auto energy = integral * fEGain[pad - 1];
auto energyMaxAmpl = mappedData->GetMaxampl() * fEGain[pad - 1];
Expand Down
Loading
Loading