Skip to content

Commit ed07815

Browse files
andreasmolandershahor02
authored andcommitted
FIT: add RecPoint reader and writer workflows for FV0 and FDD
The main purpose of the commit: - Adding workflows for reading RecPoints for FV0 and FDD, these are needed for MC aQC Secondary purposes that arose during development: - ROOT macro for comparing two RecPoint files - Workflows for writing RecPoints added for FT0, FV0 and FDD (i.e. simply standalone RecPoint writers, not related to reconstrucion) - The two items above were needed to verify the new RecPoint reader workflows, namely by: reconstructing CTFs -> writing RecPoints to file -> Reading RecPoints from file -> Writing RecPoints to new file -> Comparing the two files - Minor cosmetics (e.g. reordering of includes) and utility functions (print and == operator functions)
1 parent 4336159 commit ed07815

File tree

20 files changed

+493
-36
lines changed

20 files changed

+493
-36
lines changed

DataFormats/Detectors/FIT/FDD/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
o2_add_library(DataFormatsFDD
1313
SOURCES src/RawEventData.cxx
14+
src/RecPoint.cxx
1415
src/CTF.cxx
1516
src/LookUpTable.cxx
1617
PUBLIC_LINK_LIBRARIES O2::FDDBase

DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/RecPoint.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
/// \file RecPoint.h
12+
/// \file RecPoint.h
1313
/// \brief Definition of the FDD RecPoint class
14+
1415
#ifndef ALICEO2_FDD_RECPOINT_H
1516
#define ALICEO2_FDD_RECPOINT_H
1617

@@ -42,6 +43,7 @@ struct ChannelDataFloat {
4243
}
4344

4445
void print() const;
46+
bool operator==(const ChannelDataFloat&) const = default;
4547

4648
ClassDefNV(ChannelDataFloat, 1);
4749
};
@@ -80,6 +82,9 @@ class RecPoint
8082
int getFirstEntry() const { return mRef.getFirstEntry(); }
8183
int getEntriesInCurrentBC() const { return mRef.getEntries(); }
8284

85+
void print() const;
86+
bool operator==(const RecPoint&) const = default;
87+
8388
private:
8489
o2::dataformats::RangeReference<int, int> mRef;
8590
o2::InteractionRecord mIntRecord;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2019-2024 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+
12+
/// \file RecPoint.cxx
13+
/// \brief Implementation of the FDD RecPoint class
14+
/// \author Andreas Molander andreas.molander@cern.ch
15+
16+
#include "DataFormatsFDD/RecPoint.h"
17+
#include "Framework/Logger.h"
18+
19+
using namespace o2::fdd;
20+
21+
void ChannelDataFloat::print() const
22+
{
23+
LOG(info) << "ChannelDataFloat data:";
24+
LOG(info) << "Channel ID: " << mPMNumber << ", Time (ps): " << mTime << ", Charge (ADC): " << mChargeADC << ", QTC chain: " << adcId;
25+
}
26+
27+
void RecPoint::print() const
28+
{
29+
LOG(info) << "RecPoint data:";
30+
LOG(info) << "Collision times: A: " << getCollisionTimeA() << ", C: " << getCollisionTimeC();
31+
LOG(info) << "Ref first: " << mRef.getFirstEntry() << ", Ref entries: " << mRef.getEntries();
32+
LOG(info) << "Triggers: " << mTriggers.print();
33+
}

DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/RecPoints.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct ChannelDataFloat {
4747
}
4848

4949
void print() const;
50+
bool operator==(const ChannelDataFloat&) const = default;
5051

5152
ClassDefNV(ChannelDataFloat, 1);
5253
};
@@ -74,8 +75,6 @@ class RecPoints
7475
}
7576
~RecPoints() = default;
7677

77-
void print() const;
78-
7978
short getCollisionTime(int side) const { return mCollisionTime[side]; }
8079
short getCollisionTimeMean() const { return getCollisionTime(TimeMean); }
8180
short getCollisionTimeA() const { return getCollisionTime(TimeA); }
@@ -96,6 +95,9 @@ class RecPoints
9695
gsl::span<const ChannelDataFloat> getBunchChannelData(const gsl::span<const ChannelDataFloat> tfdata) const;
9796
short static constexpr sDummyCollissionTime = 32767;
9897

98+
void print() const;
99+
bool operator==(const RecPoints&) const = default;
100+
99101
private:
100102
std::array<short, 4> mCollisionTime = {sDummyCollissionTime,
101103
sDummyCollissionTime,

DataFormats/Detectors/FIT/FT0/src/RecPoints.cxx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,22 @@
2121

2222
using namespace o2::ft0;
2323

24+
void ChannelDataFloat::print() const
25+
{
26+
printf(" ChID% d | CFDtime=%f | QTCampl=%f QTC chain %d\n", ChId, CFDTime, QTCAmpl, ChainQTC);
27+
}
28+
2429
gsl::span<const ChannelDataFloat> RecPoints::getBunchChannelData(const gsl::span<const ChannelDataFloat> tfdata) const
2530
{
2631
// extract the span of channel data for this bunch from the whole TF data
2732
return ref.getEntries() ? gsl::span<const ChannelDataFloat>(tfdata).subspan(ref.getFirstEntry(), ref.getEntries()) : gsl::span<const ChannelDataFloat>();
2833
}
2934

30-
void ChannelDataFloat::print() const
35+
void RecPoints::print() const
3136
{
32-
33-
printf(" ChID% d | CFDtime=%f | QTCampl=%f QTC chain %d\n", ChId, CFDTime, QTCAmpl, ChainQTC);
37+
LOG(info) << "RecPoint data:";
38+
LOG(info) << "Collision times: mean: " << getCollisionTimeMean() << ", A: " << getCollisionTimeA() << ", C: " << getCollisionTimeC();
39+
LOG(info) << "Vertex: " << getVertex();
40+
LOG(info) << "Ref first: " << ref.getFirstEntry() << ", Ref entries: " << ref.getEntries();
41+
LOG(info) << "Triggers: " << mTriggers.print();
3442
}

DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/RecPoints.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ struct ChannelDataFloat {
4242
}
4343

4444
void print() const;
45+
bool operator==(const ChannelDataFloat&) const = default;
4546

4647
ClassDefNV(ChannelDataFloat, 1);
4748
};
@@ -77,6 +78,9 @@ class RecPoints
7778
gsl::span<const ChannelDataFloat> getBunchChannelData(const gsl::span<const ChannelDataFloat> tfdata) const;
7879
short static constexpr sDummyCollissionTime = 32767;
7980

81+
void print() const;
82+
bool operator==(const RecPoints&) const = default;
83+
8084
private:
8185
o2::dataformats::RangeReference<int, int> mRef;
8286
o2::InteractionRecord mIntRecord;

DataFormats/Detectors/FIT/FV0/src/RecPoints.cxx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@
1414

1515
using namespace o2::fv0;
1616

17-
gsl::span<const ChannelDataFloat> RecPoints::getBunchChannelData(const gsl::span<const ChannelDataFloat> tfdata) const
17+
void ChannelDataFloat::print() const
1818
{
19-
// extract the span of channel data for this bunch from the whole TF data
20-
return mRef.getEntries() ? gsl::span<const ChannelDataFloat>(tfdata).subspan(mRef.getFirstEntry(), mRef.getEntries()) : gsl::span<const ChannelDataFloat>();
19+
printf(" Channel=%d | time=%f | charge=%f | adcId=%d\n", channel, time, charge, adcId);
2120
}
2221

23-
void ChannelDataFloat::print() const
22+
void RecPoints::print() const
2423
{
25-
printf(" Channel=%d | time=%f | charge=%f | adcId=%d\n", channel, time, charge, adcId);
24+
printf("RecPoint data:");
25+
printf("Collision times: first: %f, global mean: %f, selected mean: %f\n", getCollisionFirstTime(), getCollisionGlobalMeanTime(), getCollisionSelectedMeanTime());
26+
printf("Ref first: %d, Ref entries: %d\n", mRef.getFirstEntry(), mRef.getEntries());
27+
printf("Triggers: ");
28+
mTriggers.print();
29+
}
30+
31+
gsl::span<const ChannelDataFloat> RecPoints::getBunchChannelData(const gsl::span<const ChannelDataFloat> tfdata) const
32+
{
33+
// extract the span of channel data for this bunch from the whole TF data
34+
return mRef.getEntries() ? gsl::span<const ChannelDataFloat>(tfdata).subspan(mRef.getFirstEntry(), mRef.getEntries()) : gsl::span<const ChannelDataFloat>();
2635
}

Detectors/FIT/FDD/workflow/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ o2_add_executable(flp-dpl-workflow
5252
PUBLIC_LINK_LIBRARIES O2::FDDWorkflow O2::FDDRaw O2::FITWorkflow
5353
TARGETVARNAME fddflpexe)
5454

55+
o2_add_executable(recpoints-reader-workflow
56+
SOURCES src/recpoints-reader-workflow.cxx
57+
COMPONENT_NAME fdd
58+
PUBLIC_LINK_LIBRARIES O2::FDDWorkflow)
59+
60+
o2_add_executable(recpoints-writer-workflow
61+
SOURCES src/recpoints-writer-workflow.cxx
62+
COMPONENT_NAME fdd
63+
PUBLIC_LINK_LIBRARIES O2::FDDWorkflow)
64+
5565
o2_add_executable(integrate-cluster-workflow
5666
SOURCES src/cluster-integrator.cxx
5767
COMPONENT_NAME fdd

Detectors/FIT/FDD/workflow/include/FDDWorkflow/RecPointReaderSpec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace fdd
3131
class RecPointReader : public Task
3232
{
3333
public:
34-
RecPointReader(bool useMC = true);
34+
RecPointReader(bool useMC = false);
3535
~RecPointReader() override = default;
3636
void init(InitContext& ic) final;
3737
void run(ProcessingContext& pc) final;
@@ -42,7 +42,7 @@ class RecPointReader : public Task
4242
std::unique_ptr<TFile> mFile;
4343
std::unique_ptr<TTree> mTree;
4444

45-
bool mUseMC = true; // use MC truth
45+
bool mUseMC = false; // use MC truth
4646
o2::header::DataOrigin mOrigin = o2::header::gDataOriginFDD;
4747

4848
std::vector<o2::fdd::RecPoint>* mRecPoints = nullptr;

Detectors/FIT/FDD/workflow/src/RecPointReaderSpec.cxx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@
1111

1212
/// @file RecPointReaderSpec.cxx
1313

14-
#include <vector>
15-
16-
#include "TTree.h"
17-
18-
#include "Framework/ControlService.h"
1914
#include "Framework/ConfigParamRegistry.h"
15+
#include "Framework/ControlService.h"
2016
#include "Framework/Logger.h"
2117
#include "FDDWorkflow/RecPointReaderSpec.h"
2218
#include "CommonUtils/NameConf.h"
2319

20+
#include <vector>
21+
2422
using namespace o2::framework;
2523
using namespace o2::fdd;
2624

0 commit comments

Comments
 (0)