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"
21#include <fairlogger/Logger.h>
22
23using namespace o2::fdd;
24
25//_____________________________________________________________________
26void Reconstructor::process(o2::fdd::Digit const& digitBC, gsl::span<const o2::fdd::ChannelData> inChData,
27 std::vector<o2::fdd::RecPoint>& RecPoints, std::vector<o2::fdd::ChannelDataFloat>& outChData)
28// gsl::span<o2::fdd::ChannelDataFloat> outChData)
29{
30 // Compute charge weighted average time
31 Double_t timeFDA = 0, timeFDC = 0;
32 Double_t weightFDA = 0.0, weightFDC = 0.0;
33 Int_t nInTimeA = 0, nInTimeC = 0;
34 int firstEntry = outChData.size();
35 int nStored = 0;
36 int nch = inChData.size();
37
38 for (int ich = 0; ich < nch; ich++) {
39 if (mDeadChannelMap && !mDeadChannelMap->isChannelAlive(inChData[ich].mPMNumber)) {
40 LOG(debug) << "Channel " << ich << " is dead - discarding data";
41 continue;
42 }
43 bool inTime = inChData[ich].getFlag(ChannelData::EEventDataBit::kIsEventInTVDC);
44 bool inAdcGate = inChData[ich].getFlag(ChannelData::EEventDataBit::kIsCFDinADCgate);
45 if (inAdcGate) {
46 outChData.emplace_back((int)inChData[ich].mPMNumber, (inChData[ich].mTime) * timePerTDC,
47 (double)inChData[ich].mChargeADC, inChData[ich].mFEEBits);
48 nStored++;
49 }
50
51 Float_t adc = inChData[ich].mChargeADC;
52 Float_t time = (inChData[ich].mTime) * timePerTDC;
54 continue;
55 }
56 Float_t timeErr = 1;
58 timeErr = 1. / adc;
59 }
60 if ((int)inChData[ich].mPMNumber < 8) {
61 nInTimeC += inTime;
62 timeFDC += time / (timeErr * timeErr);
63 weightFDC += 1. / (timeErr * timeErr);
64 } else {
65 nInTimeA += inTime;
66 timeFDA += time / (timeErr * timeErr);
67 weightFDA += 1. / (timeErr * timeErr);
68 }
69 }
70 const int nsToPs = 1e3;
73 if (nInTimeA > 0) {
74 mCollisionTime[o2::fdd::RecPoint::TimeA] = (weightFDA > 1) ? round(timeFDA / weightFDA * nsToPs)
76 } else {
77 if (weightFDA > 0) {
78 mCollisionTime[o2::fdd::RecPoint::TimeA] = round(timeFDA / weightFDA * nsToPs);
79 }
80 }
81 if (nInTimeC > 0) {
82 mCollisionTime[o2::fdd::RecPoint::TimeC] = (weightFDC > 1) ? round(timeFDC / weightFDC * nsToPs)
84 } else {
85 if (weightFDC > 0) {
86 mCollisionTime[o2::fdd::RecPoint::TimeC] = round(timeFDC / weightFDC * nsToPs);
87 }
88 }
89 RecPoints.emplace_back(mCollisionTime, firstEntry, nStored, digitBC.getIntRecord(), digitBC.mTriggers);
90}
91//________________________________________________________
93{
94 // finalize reconstruction, if needed, flash remaining recpoints
95 // if (!mContinuous) return;
96}
std::ostringstream debug
Container class to store values of single FDD channel.
int16_t time
Definition RawEventData.h:4
static short constexpr sDummyCollissionTime
Definition RecPoint.h:81
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
float AmplitudeCutOnCollisionTimeWeights
const bool isChannelAlive(const uint8_t &chId) const
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
ArrayADC adc