Project
Loading...
Searching...
No Matches
Reconstructor.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 "FDDBase/Constants.h"
20#include <fairlogger/Logger.h>
21
22using namespace o2::fdd;
23
24//_____________________________________________________________________
25void Reconstructor::process(o2::fdd::Digit const& digitBC, gsl::span<const o2::fdd::ChannelData> inChData,
26 std::vector<o2::fdd::RecPoint>& RecPoints, std::vector<o2::fdd::ChannelDataFloat>& outChData)
27// gsl::span<o2::fdd::ChannelDataFloat> outChData)
28{
29 // Compute charge weighted average time
30 Double_t timeFDA = 0, timeFDC = 0;
31 Double_t weightFDA = 0.0, weightFDC = 0.0;
32 Int_t nInTimeA = 0, nInTimeC = 0;
33 int firstEntry = outChData.size();
34 int nStored = 0;
35 int nch = inChData.size();
36 for (int ich = 0; ich < nch; ich++) {
37 bool inTime = inChData[ich].getFlag(ChannelData::EEventDataBit::kIsEventInTVDC);
38 bool inAdcGate = inChData[ich].getFlag(ChannelData::EEventDataBit::kIsCFDinADCgate);
39 if (inAdcGate) {
40 outChData.emplace_back((int)inChData[ich].mPMNumber, (inChData[ich].mTime) * timePerTDC,
41 (double)inChData[ich].mChargeADC, inChData[ich].mFEEBits);
42 nStored++;
43 }
44
45 Float_t adc = inChData[ich].mChargeADC;
46 Float_t time = (inChData[ich].mTime) * timePerTDC;
48 continue;
49 }
50 Float_t timeErr = 1;
51 if (adc > 3) {
52 timeErr = 1. / adc;
53 }
54 if ((int)inChData[ich].mPMNumber < 8) {
55 nInTimeC += inTime;
56 timeFDC += time / (timeErr * timeErr);
57 weightFDC += 1. / (timeErr * timeErr);
58 } else {
59 nInTimeA += inTime;
60 timeFDA += time / (timeErr * timeErr);
61 weightFDA += 1. / (timeErr * timeErr);
62 }
63 }
64 const int nsToPs = 1e3;
67 if (nInTimeA > 0) {
68 mCollisionTime[o2::fdd::RecPoint::TimeA] = (weightFDA > 1) ? round(timeFDA / weightFDA * nsToPs)
70 } else {
71 if (weightFDA > 0) {
72 mCollisionTime[o2::fdd::RecPoint::TimeA] = round(timeFDA / weightFDA * nsToPs);
73 }
74 }
75 if (nInTimeC > 0) {
76 mCollisionTime[o2::fdd::RecPoint::TimeC] = (weightFDC > 1) ? round(timeFDC / weightFDC * nsToPs)
78 } else {
79 if (weightFDC > 0) {
80 mCollisionTime[o2::fdd::RecPoint::TimeC] = round(timeFDC / weightFDC * nsToPs);
81 }
82 }
83 RecPoints.emplace_back(mCollisionTime, firstEntry, nStored, digitBC.getIntRecord(), digitBC.mTriggers);
84}
85//________________________________________________________
87{
88 // finalize reconstruction, if needed, flash remaining recpoints
89 // if (!mContinuous) return;
90}
Container class to store values of single FDD channel.
int16_t time
Definition RawEventData.h:4
static short constexpr sDummyCollissionTime
Definition RecPoint.h:79
void process(o2::fdd::Digit const &digitBC, gsl::span< const o2::fdd::ChannelData > inChData, std::vector< o2::fdd::RecPoint > &RecPoints, std::vector< o2::fdd::ChannelDataFloat > &outChData)
constexpr float timePerTDC
Definition Constants.h:33
static constexpr double DummyTime
o2::InteractionRecord getIntRecord() const
Definition Digit.h:64
Triggers mTriggers
Definition Digit.h:57
ArrayADC adc