17#include <TDirectory.h>
19#include <TPaveStats.h>
32 if (mInterCalibConfig ==
nullptr) {
33 LOG(fatal) <<
"o2::zdc::InterCalibEPN: missing configuration object";
40 if (opt.debugOutput ==
true) {
45 auto* cfg = mInterCalibConfig;
48 for(
int ih=0; ih<
NH; ih++){
65 const gsl::span<const o2::zdc::ZDCEnergy>& Energy,
66 const gsl::span<const o2::zdc::ZDCTDCData>& TDCData,
67 const gsl::span<const uint16_t>& Info)
76 ev.
init(RecBC, Energy, TDCData, Info);
81 uint8_t ch = (info >> 10) & 0x1f;
132 if (
x < -(mInterCalibConfig->
xcut_ZPA)) {
166 for (
int ih = 0; ih <
NH; ih++) {
170 if (mSaveDebugHistos) {
182 THnSparse* hs = (THnSparse*)gROOT->FindObject(hname);
184 LOGF(
error,
"Not found: %s\n", hname);
187 if (!hs->InheritsFrom(THnSparse::Class())) {
188 LOGF(
error,
"Not a THnSparse: %s\n", hname);
194 if (hn.EqualTo(
"hZNA")) {
196 }
else if (hn.EqualTo(
"hZPA")) {
198 }
else if (hn.EqualTo(
"hZNC")) {
200 }
else if (hn.EqualTo(
"hZPC")) {
202 }
else if (hn.EqualTo(
"hZEM")) {
204 }
else if (hn.EqualTo(
"hZNI")) {
206 }
else if (hn.EqualTo(
"hZPI")) {
208 }
else if (hn.EqualTo(
"hZPAX")) {
210 }
else if (hn.EqualTo(
"hZPCX")) {
213 LOGF(
error,
"Not recognized histogram name: %s\n", hname);
220 int64_t nb = hs->GetNbins();
222 LOGF(info,
"Histogram %s has %ld bins\n", hname, nb);
223 double cutl = mInterCalibConfig->
cutLow[ih];
224 double cuth = mInterCalibConfig->
cutHigh[ih];
226 for (int64_t
i = 0;
i < nb;
i++) {
227 double cont = hs->GetBinContent(
i,
bins);
232 x[
d] = hs->GetAxis(
d)->GetBinCenter(
bins[
d]);
234 if (TMath::Nint(
x[5] - ic) == 0 &&
x[0] > cutl &&
x[0] < cuth) {
240 LOGF(info,
"Trigger class selection %d and %d bins %g events and cuts (%g:%g): %ld", ic,
nn, contt, cutl, cuth);
248 if (ih >= 0 && ih <
NH) {
252 for (
int32_t ii = ihstart; ii < ihstop; ii++) {
269 constexpr double minfty = -std::numeric_limits<double>::infinity();
271 if (tc < mInterCalibConfig->cutLow[ih] || tc > mInterCalibConfig->
cutHigh[ih]) {
275 if (t1 < mInterCalibConfig->towerCutLow_ZPA[0] || t2 < mInterCalibConfig->towerCutLow_ZPA[1] || t3 < mInterCalibConfig->towerCutLow_ZPA[2] || t4 < mInterCalibConfig->towerCutLow_ZPA[3]) {
283 if (t1 < mInterCalibConfig->towerCutLow_ZPC[0] || t2 < mInterCalibConfig->towerCutLow_ZPC[1] || t3 < mInterCalibConfig->towerCutLow_ZPC[2] || t4 < mInterCalibConfig->towerCutLow_ZPC[3]) {
290 double val[
NPAR] = {tc,
t1, t2, t3, t4, 1};
291 if (tc > minfty &&
t1 > minfty && t2 > minfty && t3 > minfty && t4 > minfty) {
301 if (
mH[ih] !=
nullptr) {
302 mH[ih]->fill(sumquad,
w);
304 if (
mH[ih +
NH] !=
nullptr) {
307 mC[ih]->fill(
val[0], sumquad,
w);
313 TDirectory* cwd = gDirectory;
314 TFile*
f =
new TFile(fn.data(),
"recreate");
316 LOG(
error) <<
"Cannot create file: " << fn;
319 for (
int32_t ih = 0; ih < (2 *
NH); ih++) {
323 p->Write(
"", TObject::kOverwrite);
330 p->Write(
"", TObject::kOverwrite);
ZDC calibration common parameters.
unsigned short int uint16_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder Print launch bounds used for RTC code as debugging for exit after Allow RTC with slave GPUReconstruction instances with optConstexpr and optSpecialcode Maximum number of RTC cache files per backend in the cache the oldest are Prepend RTC compilation commands by this string Load a parameter object containing the launch bounds from a file h configStandalone Processing proc_param TPC Cluster Z Error Parameterization h nn
char error[CURL_ERROR_SIZE]
Intercalibration intermediate data.
bounded_vector< float > bins
static const CalibParamZDC & Instance()
static constexpr int HidZPC
static constexpr int HidZPI
static constexpr int HidZNA
std::array< o2::dataformats::FlatHisto2D< float > *, NH > mC
int saveDebugHistos(const std::string fn="ZDCInterCalibEPN.root")
static constexpr int HidZNI
static constexpr int HidZEM
int process(const gsl::span< const o2::zdc::BCRecData > &bcrec, const gsl::span< const o2::zdc::ZDCEnergy > &energy, const gsl::span< const o2::zdc::ZDCTDCData > &tdc, const gsl::span< const uint16_t > &info)
static constexpr int HidZPAX
void setSaveDebugHistos()
static constexpr int HidZPCX
static constexpr int NPAR
static constexpr int HidZPA
static constexpr int HidZNC
void cumulate(int ih, double tc, double t1, double t2, double t3, double t4, double w)
std::array< o2::dataformats::FlatHisto1D< float > *, 2 *NH > mH
static constexpr const char * mHUncT[2 *NH]
static constexpr const char * mHUncN[2 *NH]
static constexpr const char * mCUncT[NH]
static constexpr const char * mCUncN[NH]
GLubyte GLubyte GLubyte GLubyte w
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
constexpr uint32_t MaskZNA
constexpr uint32_t MaskAllZNA
constexpr uint32_t MaskZNC
constexpr uint32_t MaskAllZPA
constexpr uint32_t MaskZEM
constexpr uint32_t MaskZPA
constexpr uint32_t MaskAllZPC
constexpr uint32_t MaskAllZNC
constexpr uint32_t MaskZPC
uint16_t bc
bunch crossing ID of interaction
double towerCutHigh_ZPA[4]
double towerCutHigh_ZPC[4]
double mSum[NH][NPAR][NPAR]
ZNA, ZPA, ZNC, ZPC, ZEM, ZNI, ZPI, ZPAX, ZPCX.
uint64_t mCTimeEnd
Time of processed time frame.
static constexpr const char * DN[NH]
Time of processed time frame.
uint64_t mCTimeBeg
Cumulated sums.
void centroidZPA(float &x, float &rms)
std::vector< float > TDCVal[NTDCChannels]
signal in ZDCs
BCRecData mCurB
End of sequence.
float EZDC(uint8_t ich) const
uint32_t ezdcDecoded
pattern of channels acquired
void init(const std::vector< o2::zdc::BCRecData > *RecBC, const std::vector< o2::zdc::ZDCEnergy > *Energy, const std::vector< o2::zdc::ZDCTDCData > *TDCData, const std::vector< uint16_t > *Info)
Trigger mask for printout.
const std::vector< uint16_t > & getDecodedInfo()
void centroidZPC(float &x, float &rms)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"