Project
Loading...
Searching...
No Matches
TracksToRecordsSpec.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
13
17#include "Framework/Logger.h"
19#include "Field/MagneticField.h"
20#include "TGeoGlobalMagField.h"
21#include "MFTBase/GeometryTGeo.h"
23
27
28using namespace o2::framework;
29
30namespace o2
31{
32namespace mft
33{
34
35//_____________________________________________________________
37{
39
40 auto& alignConfigParam = o2::mft::AlignConfig::Instance();
41 mAlignment = std::make_unique<o2::mft::TracksToRecords>();
42 mAlignment->setChi2CutNStdDev(alignConfigParam.chi2CutNStdDev);
43 mAlignment->setResidualCutInitial(alignConfigParam.residualCutInitial);
44 mAlignment->setResidualCut(alignConfigParam.residualCut);
45 mAlignment->setAllowedVariationDeltaX(alignConfigParam.allowedVarDeltaX);
46 mAlignment->setAllowedVariationDeltaY(alignConfigParam.allowedVarDeltaY);
47 mAlignment->setAllowedVariationDeltaZ(alignConfigParam.allowedVarDeltaZ);
48 mAlignment->setAllowedVariationDeltaRz(alignConfigParam.allowedVarDeltaRz);
49 mAlignment->setChi2CutFactor(alignConfigParam.chi2CutFactor);
50 for (int sw = 0; sw < NStopWatches; sw++) {
51 mTimer[sw].Stop();
52 mTimer[sw].Reset();
53 }
54 mTimer[SWTot].Start(false);
55}
56
57//_____________________________________________________________
59{
60 updateTimeDependentParams(pc);
61 mTimer[SWProcessTimeFrame].Start(false);
62 mAlignment->startRecordWriter();
63 mAlignment->processTimeFrame(pc);
64 mTimer[SWProcessTimeFrame].Stop();
65
66 mTimer[SWProcessRecoTracks].Start(false);
67 mAlignment->processRecoTracks();
68 mTimer[SWProcessRecoTracks].Stop();
69}
70
71//_____________________________________________________________
73{
74 mAlignment->printProcessTrackSummary();
75 mAlignment->endRecordWriter();
76
77 sendOutput(ec.outputs());
78 mTimer[SWTot].Stop();
79
80 for (int i = 0; i < NStopWatches; i++) {
81 LOGF(info, "Timing %18s: Cpu: %.3e s; Real: %.3e s in %d slots", TimerName[i], mTimer[i].CpuTime(), mTimer[i].RealTime(), mTimer[i].Counter() - 1);
82 }
83}
84
85//_____________________________________________________________
86void TracksToRecordsSpec::sendOutput(DataAllocator& output)
87{
88 // TODO: figure out how to have record tree output redirected here and saved
89}
90
92void TracksToRecordsSpec::updateTimeDependentParams(ProcessingContext& pc)
93{
95 static bool initOnceDone = false;
96 if (!initOnceDone) { // this params need to be queried only once
97 initOnceDone = true;
98 pc.inputs().get<o2::itsmft::TopologyDictionary*>("cldict"); // just to trigger the finaliseCCDB
99
101 geom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L,
104 auto& alignConfigParam = o2::mft::AlignConfig::Instance();
105 auto field = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
106 double centerMFT[3] = {0, 0, -61.4}; // Field at center of MFT
107 auto Bz = field->getBz(centerMFT);
108 LOG(info) << "Setting MFT TracksToRecords Bz = " << Bz;
109 mAlignment->setBz(Bz);
110 const auto& timingInfo = pc.services().get<o2::framework::TimingInfo>();
111 auto runNumber = timingInfo.runNumber;
112 mAlignment->setRunNumber(runNumber);
113 LOG(info) << "Setting MFT TracksToRecords run numner = " << runNumber;
114 mAlignment->setMinNumberClusterCut(alignConfigParam.minPoints);
115 mAlignment->init();
116 }
117}
118
121{
123 return;
124 }
125 if (matcher == ConcreteDataMatcher("MFT", "CLUSDICT", 0)) {
126 LOG(info) << "cluster dictionary updated";
127 mAlignment->setClusterDictionary((const o2::itsmft::TopologyDictionary*)obj);
128 }
129}
130
131//_____________________________________________________________
133{
134 std::vector<InputSpec> inputs;
135 std::vector<OutputSpec> outputs;
136
137 inputs.emplace_back("compClusters", "MFT", "COMPCLUSTERS", 0, Lifetime::Timeframe);
138 inputs.emplace_back("patterns", "MFT", "PATTERNS", 0, Lifetime::Timeframe);
139 inputs.emplace_back("clustersrofs", "MFT", "CLUSTERSROF", 0, Lifetime::Timeframe);
140 inputs.emplace_back("tracksrofs", "MFT", "MFTTrackROF", 0, Lifetime::Timeframe);
141 inputs.emplace_back("tracks", "MFT", "TRACKS", 0, Lifetime::Timeframe);
142 inputs.emplace_back("trackClIdx", "MFT", "TRACKCLSID", 0, Lifetime::Timeframe);
143 inputs.emplace_back("cldict", "MFT", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("MFT/Calib/ClusterDictionary"));
144 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
145 true, // GRPECS=true
146 false, // GRPLHCIF
147 true, // GRPMagField
148 false, // askMatLUT
150 inputs,
151 true);
152
153 outputs.emplace_back("MFT", "TRACKS2RECORDS", 0, Lifetime::Sporadic);
154
155 return DataProcessorSpec{
156 "mft-tracks2records",
157 inputs,
158 outputs,
159 AlgorithmSpec{adaptFromTask<o2::mft::TracksToRecordsSpec>(ggRequest)},
160 Options{{}}};
161}
162
163} // namespace mft
164} // namespace o2
Definition of the base alignment parameters class.
int32_t i
Configuration file for MFT standalone alignment.
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
Definition of the MagF class.
Definition of the Names Generator class.
Class to run tracks to records needed to feed standalone alignment for MFT.
void checkUpdates(o2::framework::ProcessingContext &pc)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
Double_t getBz(const Double_t *xyz) const
Method to calculate the field at point xyz.
decltype(auto) get(R binding, int part=0) const
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
static GeometryTGeo * Instance()
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void init(o2::framework::InitContext &ic) final
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj) final
void run(o2::framework::ProcessingContext &pc) final
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::vector< ConfigParamSpec > Options
DataProcessorSpec getTracksToRecordsSpec()
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static constexpr int T2L
Definition Cartesian.h:55
static constexpr int T2GRot
Definition Cartesian.h:57
static constexpr int T2G
Definition Cartesian.h:56
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
TStopwatch sw