Project
Loading...
Searching...
No Matches
GlobalFwdMatchingAssessmentSpec.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
16#include "Framework/Logger.h"
19#include "Field/MagneticField.h"
20#include "TGeoGlobalMagField.h"
22#include <TFile.h>
23
24using namespace o2::framework;
25
26namespace o2
27{
28namespace globaltracking
29{
30
31//_____________________________________________________________
33{
35 auto field = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
36 const double centerMFT[3] = {0, 0, -61.4}; // Field at center of MFT
37 auto Bz = field->getBz(centerMFT);
38 mGloFwdAssessment->setBz(Bz);
39 return;
40 }
41 return;
42}
43
44//_____________________________________________________________
46{
47 mGloFwdAssessment = std::make_unique<o2::globaltracking::GloFwdAssessment>(mUseMC);
49 if (mMIDFilterDisabled) {
50 mGloFwdAssessment->disableMIDFilter();
51 }
52
53 for (int sw = 0; sw < NStopWatches; sw++) {
54 mTimer[sw].Stop();
55 mTimer[sw].Reset();
56 }
57
58 mTimer[SWTot].Start(false);
59 mGloFwdAssessment->init(mFinalizeAnalysis);
60}
61
62//_____________________________________________________________
64{
66
67 mTimer[SWQCAsync].Start(false);
68 mGloFwdAssessment->runBasicQC(pc);
69 mTimer[SWQCAsync].Stop();
70
71 if (mUseMC) {
72
73 mTimer[SWTrackables].Start(false);
74 mGloFwdAssessment->processPairables();
75 mTimer[SWTrackables].Stop();
76
77 if (mProcessGen) {
78 mTimer[SWGenerated].Start(false);
79 mGloFwdAssessment->processGeneratedTracks();
80 mTimer[SWGenerated].Stop();
81 }
82 mTimer[SWRecoAndTrue].Start(false);
83 mGloFwdAssessment->processRecoTracks();
84 mGloFwdAssessment->processTrueTracks();
85 mTimer[SWRecoAndTrue].Stop();
86 }
87}
88
89//_____________________________________________________________
91{
92 if (mFinalizeAnalysis) {
93 mTimer[SWAnalysis].Start(false);
94 mGloFwdAssessment->finalizeAnalysis();
95 mTimer[SWAnalysis].Stop();
96 }
97
98 sendOutput(ec.outputs());
99 mTimer[SWTot].Stop();
100
101 for (int i = 0; i < NStopWatches; i++) {
102 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);
103 }
104}
105
106//_____________________________________________________________
107void GlobalFwdAssessmentSpec::sendOutput(DataAllocator& output)
108{
109 TObjArray objar;
110 mGloFwdAssessment->getHistos(objar);
111
112 output.snapshot(Output{"GLO", "FWDASSESSMENT", 0}, objar);
113
114 TFile* f = new TFile(Form("GlobalForwardAssessment.root"), "RECREATE");
115 objar.Write();
116 f->Close();
117}
118
119//_____________________________________________________________
120DataProcessorSpec getGlobaFwdAssessmentSpec(bool useMC, bool processGen, bool midFilterDisabled, bool finalizeAnalysis)
121{
122 std::vector<InputSpec> inputs;
123 std::vector<OutputSpec> outputs;
124
125 inputs.emplace_back("fwdtracks", "GLO", "GLFWD", 0, Lifetime::Timeframe);
126 inputs.emplace_back("mfttracks", "MFT", "TRACKS", 0, Lifetime::Timeframe);
127 inputs.emplace_back("mchtracks", "MCH", "TRACKS", 0, Lifetime::Timeframe);
128
129 if (useMC) {
130 inputs.emplace_back("mfttrklabels", "MFT", "TRACKSMCTR", 0, Lifetime::Timeframe);
131 inputs.emplace_back("mchtrklabels", "MCH", "TRACKLABELS", 0, Lifetime::Timeframe);
132 inputs.emplace_back("fwdtrklabels", "GLO", "GLFWD_MC", 0, Lifetime::Timeframe);
133 }
134
135 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
136 false, // GRPECS=true
137 false, // GRPLHCIF
138 true, // GRPMagField
139 false, // askMatLUT
141 inputs,
142 true); // query only once all objects except mag.field
143
144 outputs.emplace_back("GLO", "FWDASSESSMENT", 0, Lifetime::Sporadic);
145
146 return DataProcessorSpec{
147 "glofwd-assessment",
148 inputs,
149 outputs,
150 AlgorithmSpec{adaptFromTask<o2::globaltracking::GlobalFwdAssessmentSpec>(useMC, processGen, ggRequest, midFilterDisabled, finalizeAnalysis)},
151 Options{{}}};
152}
153
154} // namespace globaltracking
155} // namespace o2
int32_t i
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
Definition of the MagF class.
Definition of the Names Generator class.
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.
void init(o2::framework::InitContext &ic) final
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj)
void run(o2::framework::ProcessingContext &pc) final
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
GLdouble f
Definition glcorearb.h:310
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ConfigParamSpec > Options
DataProcessorSpec getGlobaFwdAssessmentSpec(bool useMC, bool processGen, bool midFilterDisabled, bool finalizeAnalysis=false)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
TStopwatch sw