|
| 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 "CommonConstants/LHCConstants.h" |
| 27 | +#include "CommonConstants/PhysicsConstants.h" |
| 28 | +#include "Common/DataModel/T0infoTable.h" |
| 29 | +#include <string> |
| 30 | + |
| 31 | +using namespace o2::aod; |
| 32 | +struct FT0Table { |
| 33 | + Produces<o2::aod::T0info> table; |
| 34 | + using BCsWithMatchings = soa::Join<aod::BCs, aod::Run3MatchedToBCSparse>; |
| 35 | + using CollisionEvSel = soa::Join<aod::Collisions, aod::EvSels>::iterator; |
| 36 | + |
| 37 | + void process(BCsWithMatchings const& bcs, soa::Join<aod::Collisions, aod::EvSels> const& collisions, aod::FT0s const& ft0s) |
| 38 | + { |
| 39 | + for (auto& collision : collisions) { |
| 40 | + int64_t foundFT0 = collision.foundFT0(); |
| 41 | + float vertexPV = collision.posZ(); |
| 42 | + float vertex_corr = vertexPV / o2::constants::physics::LightSpeedCm2NS; |
| 43 | + float t0A, t0C, t0AC, vertexT0; |
| 44 | + t0A = t0C = t0AC = vertexT0 = 32000; |
| 45 | + if (foundFT0 != -1) { |
| 46 | + auto ft0 = ft0s.iteratorAt(foundFT0); |
| 47 | + t0A = ft0.timeA(); |
| 48 | + t0C = ft0.timeC(); |
| 49 | + int triggersignals = ft0.triggerMask(); |
| 50 | + bool ora = (triggersignals & (1 << 0)) != 0; |
| 51 | + bool orc = (triggersignals & (1 << 1)) != 0; |
| 52 | + bool vertexTrigger = (triggersignals & (1 << 2)) != 0; |
| 53 | + LOGF(debug, "triggers OrA %i OrC %i vertexTrigger %i", ora, orc, vertexTrigger); |
| 54 | + LOGF(debug, " T0A = %f, T0C %f, vertex_corr %f, triggersignals %i", t0A, t0C, vertex_corr, triggersignals); |
| 55 | + if (vertexTrigger) { |
| 56 | + vertexT0 = o2::constants::physics::LightSpeedCm2NS * (t0C - t0A) / 2; |
| 57 | + t0AC = (t0A + t0C) / 2; |
| 58 | + } |
| 59 | + if (ora) { |
| 60 | + t0A += vertex_corr; |
| 61 | + } |
| 62 | + if (orc) { |
| 63 | + t0C -= vertex_corr; |
| 64 | + } |
| 65 | + } |
| 66 | + LOGF(debug, " T0 collision time = %f, T0A = %f, T0C = %f, T0 vertex = %f PV = %f", t0A, t0C, t0AC, vertexT0, vertexPV); |
| 67 | + table(t0A, t0C, t0AC, vertexT0); |
| 68 | + } |
| 69 | + } |
| 70 | +}; |
| 71 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 72 | +{ |
| 73 | + return WorkflowSpec{adaptAnalysisTask<FT0Table>(cfgc, TaskName{"ft0-table"})}; |
| 74 | +} |
0 commit comments