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 std::vector<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 if (mDeadChannelMap && !mDeadChannelMap->isChannelAlive(inChData[ich].ChId)) {
48 LOG(debug) << "Channel " << ich << " is dead - discarding data";
49 continue;
50 }
51 int offsetChannel = getOffset(int(inChData[ich].ChId));
52 outChData.emplace_back(o2::fv0::ChannelDataFloat{inChData[ich].ChId,
53 (inChData[ich].CFDTime - offsetChannel) * DigitizationConstant::TIME_PER_TDCCHANNEL,
54 (float)inChData[ich].QTCAmpl,
55 inChData[ich].ChainQTC});
56 const auto& currentOutCh = outChData.back();
57
58 // Conditions for reconstructing collision time (3 variants: first, average-relaxed and average-tight)
59 if (currentOutCh.charge > FV0DigParam::Instance().chargeThrForMeanTime) {
60 sideAtimeFirst = std::min(static_cast<Double_t>(sideAtimeFirst), currentOutCh.time);
61 if (inChData[ich].areAllFlagsGood()) {
62 if (std::abs(currentOutCh.time) < FV0DigParam::Instance().mTimeThresholdForReco) {
63 sideAtimeAvg += currentOutCh.time;
64 ndigitsA++;
65 }
66 if (currentOutCh.charge > FV0DigParam::Instance().mAmpThresholdForReco && std::abs(currentOutCh.time) < FV0DigParam::Instance().mTimeThresholdForReco) {
67 sideAtimeAvgSelected += currentOutCh.time;
68 ndigitsASelected++;
69 }
70 }
71 }
72 }
73 const int nsToPs = 1e3;
74 std::array<short, 3> mCollisionTime = {RP::sDummyCollissionTime, RP::sDummyCollissionTime, RP::sDummyCollissionTime};
75 mCollisionTime[RP::TimeFirst] = (ndigitsA > 0) ? round(sideAtimeFirst * nsToPs) : RP::sDummyCollissionTime;
76 mCollisionTime[RP::TimeGlobalMean] = (ndigitsA > 0) ? round(sideAtimeAvg * nsToPs / Float_t(ndigitsA)) : RP::sDummyCollissionTime;
77 mCollisionTime[RP::TimeSelectedMean] = (ndigitsASelected > 0) ? round(sideAtimeAvgSelected * nsToPs / Float_t(ndigitsASelected)) : RP::sDummyCollissionTime;
78
79 return RecPoints{mCollisionTime, bcd.ref.getFirstEntry(), bcd.ref.getEntries(), bcd.getIntRecord(), bcd.mTriggers};
80}
81//______________________________________________________
83{
84 // finalize digitization, if needed, flash remaining digits
85 // if (!mContinuous) return;
86}
87//______________________________________________________
89{
90 if (!mCalibOffset) {
91 return 0;
92 }
93 int offsetChannel = mCalibOffset->mTimeOffsets[channel];
94 return offsetChannel;
95}
Definition of the FV0 reconstruction task.
Class to describe fired triggered and/or stored channels for the BC and to refer to channel data.
std::ostringstream debug
Base definition of FV0 geometry.
Container class to store time and charge values of single FV0 channel.
Configurable digitization parameters.
Definition of the FV0 RecPoints class.
static short constexpr sDummyCollissionTime
Definition RecPoints.h:143
o2::fv0::RecPoints process(o2::fv0::Digit const &bcd, gsl::span< const o2::fv0::ChannelData > inChData, std::vector< o2::fv0::ChannelDataFloat > &outChData)
int getOffset(int channel)
uint32_t orbit
LHC orbit.
uint16_t bc
bunch crossing ID of interaction
const bool isChannelAlive(const uint8_t &chId) const
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"