Project
Loading...
Searching...
No Matches
BaseRecoTask.cxx
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
14
17#include "FV0Base/Geometry.h"
23#include <Framework/Logger.h>
24
25using namespace o2::fv0;
27
29 gsl::span<const o2::fv0::ChannelData> inChData,
30 gsl::span<o2::fv0::ChannelDataFloat> outChData)
31{
32 LOG(debug) << "Running reconstruction on new event";
33
34 Int_t ndigitsA = 0;
35 Int_t ndigitsASelected = 0;
36 Float_t sideAtimeFirst = 1e10;
37 Float_t sideAtimeAvg = 0;
38 Float_t sideAtimeAvgSelected = 0;
39
40 auto timeStamp = o2::InteractionRecord::bc2ns(bcd.getIntRecord().bc, bcd.getIntRecord().orbit);
41
42 LOG(debug) << " event time " << timeStamp << " orbit " << bcd.getIntRecord().orbit << " bc " << bcd.getIntRecord().bc;
43
44 int nch = inChData.size();
45 for (int ich = 0; ich < nch; ich++) {
46 LOG(debug) << " channel " << ich << " / " << nch;
47 int offsetChannel = getOffset(int(inChData[ich].ChId));
48 outChData[ich] = o2::fv0::ChannelDataFloat{inChData[ich].ChId,
49 (inChData[ich].CFDTime - offsetChannel) * DigitizationConstant::TIME_PER_TDCCHANNEL,
50 (float)inChData[ich].QTCAmpl,
51 inChData[ich].ChainQTC};
52
53 // Conditions for reconstructing collision time (3 variants: first, average-relaxed and average-tight)
54 if (outChData[ich].charge > FV0DigParam::Instance().chargeThrForMeanTime) {
55 sideAtimeFirst = std::min(static_cast<Double_t>(sideAtimeFirst), outChData[ich].time);
56 if (inChData[ich].areAllFlagsGood()) {
57 if (std::abs(outChData[ich].time) < FV0DigParam::Instance().mTimeThresholdForReco) {
58 sideAtimeAvg += outChData[ich].time;
59 ndigitsA++;
60 }
61 if (outChData[ich].charge > FV0DigParam::Instance().mAmpThresholdForReco && std::abs(outChData[ich].time) < FV0DigParam::Instance().mTimeThresholdForReco) {
62 sideAtimeAvgSelected += outChData[ich].time;
63 ndigitsASelected++;
64 }
65 }
66 }
67 }
68 const int nsToPs = 1e3;
69 std::array<short, 3> mCollisionTime = {RP::sDummyCollissionTime, RP::sDummyCollissionTime, RP::sDummyCollissionTime};
70 mCollisionTime[RP::TimeFirst] = (ndigitsA > 0) ? round(sideAtimeFirst * nsToPs) : RP::sDummyCollissionTime;
71 mCollisionTime[RP::TimeGlobalMean] = (ndigitsA > 0) ? round(sideAtimeAvg * nsToPs / Float_t(ndigitsA)) : RP::sDummyCollissionTime;
72 mCollisionTime[RP::TimeSelectedMean] = (ndigitsASelected > 0) ? round(sideAtimeAvgSelected * nsToPs / Float_t(ndigitsASelected)) : RP::sDummyCollissionTime;
73
74 return RecPoints{mCollisionTime, bcd.ref.getFirstEntry(), bcd.ref.getEntries(), bcd.getIntRecord(), bcd.mTriggers};
75}
76//______________________________________________________
78{
79 // finalize digitization, if needed, flash remaining digits
80 // if (!mContinuous) return;
81}
82//______________________________________________________
84{
85 if (!mCalibOffset) {
86 return 0;
87 }
88 int offsetChannel = mCalibOffset->mTimeOffsets[channel];
89 return offsetChannel;
90}
Definition of the FV0 reconstruction task.
Class to describe fired triggered and/or stored channels for the BC and to refer to channel data.
Base definition of FV0 geometry.
Container class to store time and charge values of single FV0 channel.
int16_t charge
Definition RawEventData.h:5
int16_t time
Definition RawEventData.h:4
Configurable digitization parameters.
Definition of the FV0 RecPoints class.
std::ostringstream debug
static short constexpr sDummyCollissionTime
Definition RecPoints.h:97
o2::fv0::RecPoints process(o2::fv0::Digit const &bcd, gsl::span< const o2::fv0::ChannelData > inChData, gsl::span< o2::fv0::ChannelDataFloat > outChData)
int getOffset(int channel)
uint32_t orbit
LHC orbit.
uint16_t bc
bunch crossing ID of interaction
Triggers mTriggers
Definition Digit.h:61
const o2::InteractionRecord & getIntRecord() const
Definition Digit.h:78
o2::dataformats::RangeReference< int, int > ref
Definition Digit.h:60
static constexpr float TIME_PER_TDCCHANNEL
std::array< int16_t, Constants::nFv0Channels > mTimeOffsets
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"