Skip to content

Commit a2a0412

Browse files
noferinishahor02
authored andcommitted
fill calib infos during clusterization if requested
1 parent 68461c3 commit a2a0412

13 files changed

Lines changed: 250 additions & 7 deletions

File tree

DataFormats/Detectors/TOF/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ o2_add_library(DataFormatsTOF
1515
src/CalibLHCphaseTOF.cxx
1616
src/CalibTimeSlewingParamTOF.cxx
1717
src/CTF.cxx
18+
src/CalibInfoCluster.cxx
1819
PUBLIC_LINK_LIBRARIES O2::ReconstructionDataFormats
1920
Boost::serialization)
2021

@@ -27,4 +28,5 @@ o2_target_root_dictionary(DataFormatsTOF
2728
include/DataFormatsTOF/RawDataFormat.h
2829
include/DataFormatsTOF/CompressedDataFormat.h
2930
include/DataFormatsTOF/CTF.h
31+
include/DataFormatsTOF/CalibInfoCluster.h
3032
)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// \file Cluster.h
12+
/// \brief Definition of the TOF cluster
13+
14+
#ifndef ALICEO2_TOF_CLUSTERCALINFOCLASS_H
15+
#define ALICEO2_TOF_CLUSTERCALINFOCLASS_H
16+
17+
#include <vector>
18+
#include "Rtypes.h"
19+
20+
namespace o2
21+
{
22+
namespace tof
23+
{
24+
/// \class CalibInfoCluster
25+
/// \brief CalibInfoCluster for TOF
26+
///
27+
class CalibInfoCluster
28+
{
29+
int ch = 0;
30+
int8_t deltach = 0;
31+
float deltat = 0;
32+
short tot1 = 0;
33+
short tot2 = 0;
34+
35+
public:
36+
CalibInfoCluster() = default;
37+
CalibInfoCluster(int ich, int8_t ideltach, float dt, short t1, short t2) : ch(ich), deltach(ideltach), deltat(dt), tot1(t1), tot2(t2) {}
38+
ClassDefNV(CalibInfoCluster, 1);
39+
};
40+
} // namespace tof
41+
42+
} // namespace o2
43+
44+
#endif
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// \file CalibInfoCluster.cxx
12+
/// \brief Implementation of the TOF cluster calib info
13+
14+
#include "DataFormatsTOF/CalibInfoCluster.h"
15+
16+
ClassImp(o2::tof::CalibInfoCluster);

DataFormats/Detectors/TOF/src/DataFormatsTOFLinkDef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
#pragma link off all classes;
1515
#pragma link off all functions;
1616
#pragma link C++ class o2::tof::Cluster + ;
17+
#pragma link C++ class o2::tof::CalibInfoCluster + ;
1718
#pragma link C++ class std::vector < o2::tof::Cluster> + ;
19+
#pragma link C++ class std::vector < o2::tof::CalibInfoCluster> + ;
1820

1921
#pragma link C++ class o2::dataformats::CalibInfoTOFshort + ;
2022
#pragma link C++ class o2::dataformats::CalibInfoTOF + ;

Detectors/GlobalTrackingWorkflow/tofworkflow/src/tof-reco-workflow.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
5959
workflowOptions.push_back(ConfigParamSpec{"configKeyValues", o2::framework::VariantType::String, "", {"Semicolon separated key=value strings ..."}});
6060
workflowOptions.push_back(ConfigParamSpec{"disable-row-writing", o2::framework::VariantType::Bool, false, {"disable ROW in Digit writing"}});
6161
workflowOptions.push_back(ConfigParamSpec{"write-decoding-errors", o2::framework::VariantType::Bool, false, {"trace errors in digits output when decoding"}});
62+
workflowOptions.push_back(ConfigParamSpec{"calib-cluster", VariantType::Bool, false, {"to enable calib info production from clusters"}});
6263
}
6364

6465
#include "Framework/runDataProcessing.h" // the main driver
@@ -137,6 +138,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
137138
bool disableRootOutput = cfgc.options().get<bool>("disable-root-output");
138139
bool conetmode = cfgc.options().get<bool>("conet-mode");
139140
bool disableROWwriting = cfgc.options().get<bool>("disable-row-writing");
141+
auto isCalibFromCluster = cfgc.options().get<bool>("calib-cluster");
140142

141143
LOG(INFO) << "TOF RECO WORKFLOW configuration";
142144
LOG(INFO) << "TOF input = " << cfgc.options().get<std::string>("input-type");
@@ -180,7 +182,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
180182

181183
if (!clusterinput && writecluster) {
182184
LOG(INFO) << "Insert TOF Clusterizer";
183-
specs.emplace_back(o2::tof::getTOFClusterizerSpec(useMC, useCCDB));
185+
specs.emplace_back(o2::tof::getTOFClusterizerSpec(useMC, useCCDB, isCalibFromCluster));
184186
if (writecluster && !disableRootOutput) {
185187
LOG(INFO) << "Insert TOF Cluster Writer";
186188
specs.emplace_back(o2::tof::getTOFClusterWriterSpec(useMC));

Detectors/TOF/reconstruction/include/TOFReconstruction/Clusterer.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <utility>
1717
#include <vector>
1818
#include "DataFormatsTOF/Cluster.h"
19+
#include "DataFormatsTOF/CalibInfoCluster.h"
1920
#include "TOFBase/Geo.h"
2021
#include "TOFReconstruction/DataReader.h"
2122
#include "SimulationDataFormat/MCTruthContainer.h"
@@ -51,9 +52,18 @@ class Clusterer
5152
mCalibApi = calibApi;
5253
}
5354

55+
void addCalibFromCluster(int ch1, int8_t dch, float dtime, short tot1, short tot2);
56+
5457
void setFirstOrbit(uint64_t orb);
5558
uint64_t getFirstOrbit() const { return mFirstOrbit; }
5659

60+
void setCalibFromCluster(bool val = 1) { mCalibFromCluster = val; }
61+
bool isCalibFromCluster() const { return mCalibFromCluster; }
62+
63+
void setDeltaTforClustering(float val) { mDeltaTforClustering = val; }
64+
float getDeltaTforClustering() const { return mDeltaTforClustering; }
65+
std::vector<o2::tof::CalibInfoCluster>* getInfoFromCluster() { return &mCalibInfosFromCluster; }
66+
5767
private:
5868
void calibrateStrip();
5969
void processStrip(std::vector<Cluster>& clusters, MCLabelContainer const* digitMCTruth);
@@ -70,6 +80,11 @@ class Clusterer
7080
CalibApi* mCalibApi = nullptr; //! calib api to handle the TOF calibration
7181
uint64_t mFirstOrbit = 0; //! 1st orbit of the TF
7282
uint64_t mBCOffset = 0; //! 1st orbit of the TF converted to BCs
83+
84+
float mDeltaTforClustering = 5000; //! delta time (in ps) accepted for clustering
85+
bool mCalibFromCluster = false; //! if producing calib from clusters
86+
87+
std::vector<o2::tof::CalibInfoCluster> mCalibInfosFromCluster;
7388
};
7489

7590
} // namespace tof

Detectors/TOF/reconstruction/src/Clusterer.cxx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void Clusterer::processStrip(std::vector<Cluster>& clusters, MCLabelContainer co
100100
// check if the TOF time are close enough to be merged; if not, it means that nothing else will contribute to the cluster (since digits are ordered in time)
101101
double timeDigNext = digNext->getCalibratedTime(); // in ps
102102
LOG(DEBUG) << "Time difference = " << timeDigNext - timeDig;
103-
if (timeDigNext - timeDig > 5000 /*in ps*/) { // to be change to 500 ps
103+
if (timeDigNext - timeDig > mDeltaTforClustering /*in ps*/) { // to be change to 500 ps
104104
break;
105105
}
106106
digNext->getPhiAndEtaIndex(iphi2, ieta2);
@@ -181,6 +181,10 @@ void Clusterer::buildCluster(Cluster& c, MCLabelContainer const* digitMCTruth)
181181

182182
c.setDigitInfo(0, mContributingDigit[0]->getChannel(), mContributingDigit[0]->getCalibratedTime(), mContributingDigit[0]->getTOT() * Geo::TOTBIN_NS);
183183

184+
int ch1 = mContributingDigit[0]->getChannel();
185+
short tot1 = mContributingDigit[0]->getTOT();
186+
double dtime = c.getTimeRaw();
187+
184188
int chan1, chan2;
185189
int phi1, phi2;
186190
int eta1, eta2;
@@ -228,6 +232,13 @@ void Clusterer::buildCluster(Cluster& c, MCLabelContainer const* digitMCTruth)
228232
if (isOk) {
229233
c.setDigitInfo(c.getNumOfContributingChannels(), mContributingDigit[idig]->getChannel(), mContributingDigit[idig]->getCalibratedTime(), mContributingDigit[idig]->getTOT() * Geo::TOTBIN_NS);
230234
c.addBitInContributingChannels(mask);
235+
236+
if (mCalibFromCluster && c.getNumOfContributingChannels() == 2) { // fill info for calibration
237+
int8_t dch = int8_t(mContributingDigit[idig]->getChannel() - ch1);
238+
short tot2 = mContributingDigit[idig]->getTOT();
239+
dtime -= mContributingDigit[idig]->getTDC() * Geo::TDCBIN + mContributingDigit[idig]->getBC() * o2::constants::lhc::LHCBunchSpacingNS * 1E3;
240+
addCalibFromCluster(ch1, dch, float(dtime), tot1, tot2);
241+
}
231242
}
232243
}
233244

@@ -282,3 +293,8 @@ void Clusterer::setFirstOrbit(uint64_t orb)
282293
mFirstOrbit = orb;
283294
mBCOffset = orb * o2::constants::lhc::LHCMaxBunches;
284295
}
296+
//_____________________________________________________________________
297+
void Clusterer::addCalibFromCluster(int ch1, int8_t dch, float dtime, short tot1, short tot2)
298+
{
299+
mCalibInfosFromCluster.emplace_back(ch1, dch, dtime, tot1, tot2);
300+
}

Detectors/TOF/workflow/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ o2_add_library(TOFWorkflowUtils
2020
src/CompressedAnalysisTask.cxx
2121
src/EntropyEncoderSpec.cxx
2222
src/EntropyDecoderSpec.cxx
23+
src/TOFCalClusInfoWriterSpec.cxx
2324
PUBLIC_LINK_LIBRARIES O2::Framework O2::DPLUtils O2::TOFBase O2::DataFormatsTOF O2::TOFReconstruction)
2425

2526
o2_add_executable(entropy-encoder-workflow
@@ -36,3 +37,9 @@ o2_add_executable(cluster-writer-workflow
3637
SOURCES src/cluster-writer-commissioning.cxx
3738
COMPONENT_NAME tof
3839
PUBLIC_LINK_LIBRARIES O2::TOFWorkflowUtils)
40+
41+
o2_add_executable(cluster-calib
42+
SOURCES src/cluster-calib.cxx
43+
COMPONENT_NAME tof
44+
PUBLIC_LINK_LIBRARIES O2::TOFWorkflowUtils)
45+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// @file TOFCalClusInfoWriterSpec.h
12+
13+
#ifndef STEER_DIGITIZERWORKFLOW_TOFCALCLUSINFOWRITER_H_
14+
#define STEER_DIGITIZERWORKFLOW_TOFCALCLUSINFOWRITER_H_
15+
16+
#include "Framework/DataProcessorSpec.h"
17+
18+
using namespace o2::framework;
19+
20+
namespace o2
21+
{
22+
namespace tof
23+
{
24+
25+
/// create a processor spec
26+
/// write ITS tracks a root file
27+
o2::framework::DataProcessorSpec getTOFCalClusInfoWriterSpec();
28+
29+
} // namespace tof
30+
} // namespace o2
31+
32+
#endif /* STEER_DIGITIZERWORKFLOW_TOFCALCLUSINFOWRITER_H_ */

Detectors/TOF/workflow/include/TOFWorkflowUtils/TOFClusterizerSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace o2
1818
namespace tof
1919
{
2020

21-
o2::framework::DataProcessorSpec getTOFClusterizerSpec(bool useMC, bool useCCDB = 0);
21+
o2::framework::DataProcessorSpec getTOFClusterizerSpec(bool useMC, bool useCCDB = 0, bool doCalib = 0);
2222

2323
} // end namespace tof
2424
} // end namespace o2

0 commit comments

Comments
 (0)