Skip to content

Commit dbf6f79

Browse files
committed
FT0 info table and FT0 AOD QA
1 parent 5ce9831 commit dbf6f79

5 files changed

Lines changed: 194 additions & 0 deletions

File tree

Common/DataModel/T0infoTable.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
#ifndef O2_T0_INFO_TABLE_H_
12+
#define O2_T0_INFO_TABLE_H_
13+
14+
#include "Framework/AnalysisDataModel.h"
15+
16+
namespace o2::aod
17+
{
18+
namespace infoFT0
19+
{
20+
DECLARE_SOA_COLUMN(T0A, t0A, float);
21+
DECLARE_SOA_COLUMN(T0C, t0C, float);
22+
DECLARE_SOA_COLUMN(T0AC, t0AC, float);
23+
DECLARE_SOA_COLUMN(T0vertex, t0vertex, float);
24+
} // namespace infoFT0
25+
DECLARE_SOA_TABLE(T0info, "AOD", "T0info",
26+
infoFT0::T0A, infoFT0::T0C,
27+
infoFT0::T0AC, infoFT0::T0vertex);
28+
using infosFT0 = T0info::iterator;
29+
} // namespace o2::aod
30+
31+
#endif // O2_T0_INFO_TABLE_H_

Common/TableProducer/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ o2physics_add_dpl_workflow(weak-decay-indices
4545
SOURCES weakDecayIndices.cxx
4646
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore
4747
COMPONENT_NAME Analysis)
48+
o2physics_add_dpl_workflow(ft0-table
49+
SOURCES infoTableFT0producer.cxx
50+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase O2::CCDB O2::CommonConstants
51+
COMPONENT_NAME Analysis)
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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+
#include "Framework/ConfigParamSpec.h"
12+
13+
using namespace o2;
14+
using namespace o2::framework;
15+
16+
// custom configurable for switching between run2 and run3 selection types
17+
/*void customize(std::vector<ConfigParamSpec>& workflowOptions)
18+
{
19+
workflowOptions.push_back(ConfigParamSpec{"ccdb-path-ft0", o2::framework::VariantType::String, "http://o2-ccdb.internal/", {"URL of the CCDB database"}});
20+
}*/
21+
22+
#include "Framework/runDataProcessing.h"
23+
#include "Framework/AnalysisTask.h"
24+
#include "Common/DataModel/EventSelection.h"
25+
#include "Framework/AnalysisDataModel.h"
26+
#include "Common/CCDB/TriggerAliases.h"
27+
#include "CCDB/BasicCCDBManager.h"
28+
#include "CommonConstants/LHCConstants.h"
29+
#include "Common/DataModel/T0infoTable.h"
30+
#include "iostream"
31+
#include <string>
32+
33+
using namespace o2::aod;
34+
struct infoTableFT0producer {
35+
Produces<o2::aod::T0info> table;
36+
using BCsWithMatchings = soa::Join<aod::BCs, aod::Run3MatchedToBCSparse>;
37+
Service<o2::ccdb::BasicCCDBManager> ccdb; /// Object manager in CCDB
38+
o2::ccdb::CcdbApi ccdb_api; /// API to access CCDB
39+
Configurable<std::string> url{"ccdb-url", "http://alice-ccdb.cern.ch", "URL of the CCDB database"};
40+
using CollisionEvSel = soa::Join<aod::Collisions, aod::EvSels>::iterator;
41+
/* void init(o2::framework::InitContext&)
42+
{
43+
LOGF(info, "Initializing CCDB");
44+
// ccdb.setURL(url.value); // Setting URL of CCDB manager from configuration
45+
// ccdb_api.init(url.value);
46+
// if (!ccdb_api.isHostReachable()) {
47+
// LOGF(fatal, "CCDB host %s is n
48+
ot reacheable, cannot go forward", url.value.data());
49+
// }
50+
}
51+
*/
52+
void process(BCsWithMatchings const& bcs, soa::Join<aod::Collisions, aod::EvSels> const& collisions, aod::FT0s const& ft0s)
53+
{
54+
// auto caliboffsets = ccdb.get<o2::ft0::GlobalOffsetsCalibrationObject>("FT0/Calibration/GlobalOffsets");
55+
LOG(INFO) << "infoTableFT0producer";
56+
float c = 29.9792458; // cm/ns
57+
for (auto& collision : collisions) {
58+
int64_t foundFT0 = collision.foundFT0();
59+
float vertexPV = collision.posZ();
60+
float vertex_corr = vertexPV / c;
61+
float t0A, t0C, t0AC, vertexT0;
62+
t0A = t0C = t0AC = vertexT0 = 32000;
63+
if (foundFT0 != -1) {
64+
auto ft0 = ft0s.iteratorAt(foundFT0);
65+
t0A = ft0.timeA();
66+
t0C = ft0.timeC();
67+
int triggersignals = ft0.triggerMask();
68+
bool ora = (triggersignals & (1 << 0)) != 0;
69+
bool orc = (triggersignals & (1 << 1)) != 0;
70+
bool vertexTrigger = (triggersignals & (1 << 2)) != 0;
71+
LOGF(info, "triggers OrA %i OrC %i vertexTrigger %i", ora, orc, vertexTrigger);
72+
LOGF(info, " T0A = %f, T0C %f, vertex_corr %f, triggersignals %i", t0A, t0C, vertex_corr, triggersignals);
73+
if (vertexTrigger) {
74+
vertexT0 = c * (t0C - t0A) / 2;
75+
t0AC = (t0A + t0C) / 2;
76+
}
77+
if (ora) {
78+
t0A += vertex_corr;
79+
}
80+
if (orc) {
81+
t0C -= vertex_corr;
82+
}
83+
}
84+
LOGF(info, " T0 collision time = %f, T0A = %f, T0C = %f, T0 vertex = %f PV = %f", t0A, t0C, t0AC, vertexT0, vertexPV);
85+
table(t0A, t0C, t0AC, vertexT0);
86+
}
87+
}
88+
};
89+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
90+
{
91+
LOG(INFO) << "WorkflowSpec defineDataProcessin";
92+
return WorkflowSpec{adaptAnalysisTask<infoTableFT0producer>(cfgc, TaskName{"ft0-table"})};
93+
}

Common/Tasks/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ o2physics_add_dpl_workflow(check-data-model
3838
SOURCES checkDataModel.cxx
3939
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
4040
COMPONENT_NAME AnalysisTutorial)
41+
o2physics_add_dpl_workflow(ft0-qa
42+
SOURCES ft0infoQaTask.cxx
43+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase
44+
COMPONENT_NAME Analysis)

Common/Tasks/ft0infoQaTask.cxx

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
//
12+
// This code calculates output histograms for centrality calibration
13+
// as well as vertex-Z dependencies of raw variables (either for calibration
14+
// of vtx-Z dependencies or for the calibration of those).
15+
//
16+
// This task is not strictly necessary in a typical analysis workflow,
17+
// except for centrality calibration! The necessary task is the multiplicity
18+
// tables.
19+
20+
#include "Framework/runDataProcessing.h"
21+
#include "Framework/AnalysisTask.h"
22+
#include "Framework/AnalysisDataModel.h"
23+
#include "Common/DataModel/T0infoTable.h"
24+
#include "Common/DataModel/EventSelection.h"
25+
#include "Common/DataModel/Multiplicity.h"
26+
#include "TH1F.h"
27+
#include "TH2F.h"
28+
using namespace o2;
29+
using namespace o2::framework;
30+
31+
struct FT0InfoQaTask {
32+
OutputObj<TH1F> hT0A{TH1F("hT0A", "T0A; ns", 200, -1, 1)};
33+
OutputObj<TH1F> hT0C{TH1F("hT0C", "T0C; ns", 200, -1, 1)};
34+
OutputObj<TH1F> hT0AC{TH1F("hT0AC", "(T0C+T0A)/2; ns", 200, -1, 1)};
35+
OutputObj<TH1F> hT0res{TH1F("hT0res", "T0 resolution; ns", 200, -0.5, 0.5)};
36+
OutputObj<TH1F> hT0Vertex{TH1F("hT0vertex", "T0 vertex; cm", 200, -30, 30.)};
37+
OutputObj<TH2F> hVertex_T0_PV{TH2F(" hVertex_T0_PV", "T0 vertex vs Primary Vertex; T0 vertex, cm; PV, cm", 200, -30, 30., 200, -30, 30.)};
38+
OutputObj<TH2F> hResMult{TH2F("hResMult", "T0 resolution vs event multiplicity", 600, 0., 2000, 100, -500, 500.)};
39+
OutputObj<TH2F> hT0V0mult{TH2F("hT0V0mult", "T0 vs V0 multiplicity ;V0Mult;T0Mmult", 200, 0., 50000., 200, 0., 20000.)};
40+
41+
Configurable<bool> isMC{"isMC", 0, "0 - data, 1 - MC"};
42+
43+
void process(soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::T0info>::iterator const& col /*, aod::T0info const &ft0s*/)
44+
{
45+
int64_t foundFT0 = col.foundFT0();
46+
if (foundFT0 != -1) {
47+
LOGF(info, "multV0A=%5.0f; multT0A=%5.0f; PV=%f; T0vertex=%f;T0A=%f; T0C=%f; T0AC=%f ", col.multV0A(), col.multT0A(), col.posZ(), col.t0A(), col.t0C(), col.t0AC(), col.t0vertex());
48+
/* hT0A->Fill(col.t0A());
49+
hT0C->Fill(col.t0C());
50+
hT0AC->Fill(col.t0AC());
51+
hT0Vertex->Fill(col.t0vertex());
52+
hVertex_T0_PV->Fill(col.t0vertex(), col.posZ());
53+
hT0res->Fill((col.t0A()-col.t0C())/2.);*/
54+
}
55+
}
56+
};
57+
58+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
59+
{
60+
return WorkflowSpec{
61+
adaptAnalysisTask<FT0InfoQaTask>(cfgc, TaskName{"ft0-qa"})};
62+
}

0 commit comments

Comments
 (0)