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
37 for (int ich = 0; ich < nch; ich++) {
38 if (mDeadChannelMap && !mDeadChannelMap->isChannelAlive(inChData[ich].mPMNumber)) {
39 LOG(debug) << "Channel " << ich << " is dead - discarding data";
40 continue;
41 }
42 bool inTime = inChData[ich].getFlag(ChannelData::EEventDataBit::kIsEventInTVDC);
43 bool inAdcGate = inChData[ich].getFlag(ChannelData::EEventDataBit::kIsCFDinADCgate);
44 if (inAdcGate) {
45 outChData.emplace_back((int)inChData[ich].mPMNumber, (inChData[ich].mTime) * timePerTDC,
46 (double)inChData[ich].mChargeADC, inChData[ich].mFEEBits);
47 nStored++;
48 }
49
50 Float_t adc = inChData[ich].mChargeADC;
51 Float_t time = (inChData[ich].mTime) * timePerTDC;
53 continue;
54 }
55 Float_t timeErr = 1;
56 if (adc > 3) {
57 timeErr = 1. / adc;
58 }
59 if ((int)inChData[ich].mPMNumber < 8) {
60 nInTimeC += inTime;
61 timeFDC += time / (timeErr * timeErr);
62 weightFDC += 1. / (timeErr * timeErr);
63 } else {
64 nInTimeA += inTime;
65 timeFDA += time / (timeErr * timeErr);
66 weightFDA += 1. / (timeErr * timeErr);
67 }
68 }
69 const int nsToPs = 1e3;
72 if (nInTimeA > 0) {
73 mCollisionTime[o2::fdd::RecPoint::TimeA] = (weightFDA > 1) ? round(timeFDA / weightFDA * nsToPs)
75 } else {
76 if (weightFDA > 0) {
77 mCollisionTime[o2::fdd::RecPoint::TimeA] = round(timeFDA / weightFDA * nsToPs);
78 }
79 }
80 if (nInTimeC > 0) {
81 mCollisionTime[o2::fdd::RecPoint::TimeC] = (weightFDC > 1) ? round(timeFDC / weightFDC * nsToPs)
83 } else {
84 if (weightFDC > 0) {
85 mCollisionTime[o2::fdd::RecPoint::TimeC] = round(timeFDC / weightFDC * nsToPs);
86 }
87 }
88 RecPoints.emplace_back(mCollisionTime, firstEntry, nStored, digitBC.getIntRecord(), digitBC.mTriggers);
89}
90//________________________________________________________
92{
93 // finalize reconstruction, if needed, flash remaining recpoints
94 // if (!mContinuous) return;
95}
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
const bool isChannelAlive(const uint8_t &chId) const
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
ArrayADC adc