Project
Loading...
Searching...
No Matches
TRDPulseHeightSpec.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef O2_TRD_PULSEHEIGHTSPEC_H
13#define O2_TRD_PULSEHEIGHTSPEC_H
14
17
18#include "Framework/Task.h"
26#include <cstring>
27
28using namespace o2::framework;
30
31namespace o2
32{
33namespace trd
34{
35
37{
38 public:
39 PuseHeightDevice(std::shared_ptr<DataRequest> dr) : mDataRequest(dr) {}
41 {
42 mPulseHeight = std::make_unique<PulseHeight>();
43 if (ic.options().get<bool>("enable-root-output")) {
44 mPulseHeight->createOutputFile();
45 }
46 if (getenv("ALIEN_JDL_LPMPRODUCTIONTYPE") && std::strcmp(getenv("ALIEN_JDL_LPMPRODUCTIONTYPE"), "MC") == 0) {
47 // apply artificial pad shift in case non-ideal alignment is used to compensate for shift in current alignment from real data
48 mPulseHeight->setApplyShift(false);
49 }
50 }
51
53 {
54 const auto& tinfo = pc.services().get<o2::framework::TimingInfo>();
55 if (tinfo.globalRunNumberChanged) { // new run is starting
56 mRunStopRequested = false;
57 }
58 if (mRunStopRequested) {
59 std::vector<PHData> mPHValues{}; // the calibration expects data at every TF, so inject dummy
60 pc.outputs().snapshot(Output{"TRD", "PULSEHEIGHT", 0}, mPHValues);
61 std::vector<PHDataHD> mPHValuesHD{}; // the calibration expects data at every TF, so inject dummy
62 pc.outputs().snapshot(Output{"TRD", "PULSEHEIGHTHD", 0}, mPHValuesHD);
63 return;
64 }
65 RecoContainer recoData;
66 recoData.collectData(pc, *mDataRequest.get());
67 auto digits = pc.inputs().get<gsl::span<o2::trd::Digit>>("digits");
68 mPulseHeight->setInput(recoData, &digits);
69 mPulseHeight->reset();
70 mPulseHeight->process();
71 pc.outputs().snapshot(Output{"TRD", "PULSEHEIGHT", 0}, mPulseHeight->getPHData());
72 pc.outputs().snapshot(Output{"TRD", "PULSEHEIGHTHD", 0}, mPulseHeight->getPHDataHD());
73 if (pc.transitionState() == TransitionHandlingState::Requested) {
74 LOG(info) << "Run stop requested, finalizing";
75 mRunStopRequested = true;
76 }
77 }
78
80 {
81 mPulseHeight->closeOutputFile();
82 if (mRunStopRequested) {
83 return;
84 }
85 }
86
87 void stop() final
88 {
89 }
90
91 private:
92 std::shared_ptr<DataRequest> mDataRequest;
93 std::unique_ptr<o2::trd::PulseHeight> mPulseHeight;
94 bool mRunStopRequested = false; // flag that run was stopped (and the last output is sent)
95};
96
97} // namespace trd
98
99namespace framework
100{
101
102DataProcessorSpec getTRDPulseHeightSpec(GID::mask_t src, bool digitsFromReader)
103{
104
105 std::vector<OutputSpec> outputs;
106 outputs.emplace_back(o2::header::gDataOriginTRD, "PULSEHEIGHT", 0, Lifetime::Timeframe);
107 outputs.emplace_back(o2::header::gDataOriginTRD, "PULSEHEIGHTHD", 0, Lifetime::Timeframe);
108
109 bool isTPCavailable = false;
110 if (GID::includesSource(GID::Source::ITSTPC, src)) {
111 LOGF(debug, "Found ITS-TPC tracks as input, loading ITS-TPC-TRD");
112 src |= GID::getSourcesMask("ITS-TPC-TRD");
113 }
114 if (GID::includesSource(GID::Source::TPC, src)) {
115 LOGF(debug, "Found TPC tracks as input, loading TPC-TRD");
116 src |= GID::getSourcesMask("TPC-TRD");
117 isTPCavailable = true;
118 }
119 GID::mask_t srcClu = GID::getSourcesMask("TRD"); // we don't need all clusters, only TRD tracklets
120
121 auto dataRequest = std::make_shared<DataRequest>();
122 dataRequest->requestTracks(src, false);
123 dataRequest->requestClusters(srcClu, false);
124 dataRequest->inputs.emplace_back("digits", "TRD", "DIGITS", digitsFromReader ? 1 : 0);
125
126 return DataProcessorSpec{
127 "trd-pulseheight",
128 dataRequest->inputs,
129 outputs,
130 AlgorithmSpec{adaptFromTask<o2::trd::PuseHeightDevice>(dataRequest)},
131 Options{
132 {"enable-root-output", VariantType::Bool, false, {"output PH and debug data to root file"}}}};
133}
134} // namespace framework
135} // namespace o2
136
137#endif // O2_TRD_PULSEHEIGHTSPEC_H
std::ostringstream debug
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 trd
Helper for geometry and GRP related CCDB requests.
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Creates PH spectra from TRD digits found on tracks.
static mask_t getSourcesMask(const std::string_view srcList)
void stop() final
This is invoked on stop.
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void init(o2::framework::InitContext &ic) final
PuseHeightDevice(std::shared_ptr< DataRequest > dr)
void run(o2::framework::ProcessingContext &pc) final
constexpr o2::header::DataOrigin gDataOriginTRD
Definition DataHeader.h:580
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Digit > digits