|
| 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 | +/// \file trackPropagationTester.cxx |
| 13 | +/// \brief testing ground for track propagation |
| 14 | +/// \author ALICE |
| 15 | + |
| 16 | +//=============================================================== |
| 17 | +// |
| 18 | +// Modularized version of TPC PID task |
| 19 | +// |
| 20 | +//=============================================================== |
| 21 | + |
| 22 | +#include <map> |
| 23 | +#include <memory> |
| 24 | +#include <string> |
| 25 | +#include <utility> |
| 26 | +#include <vector> |
| 27 | +// ROOT includes |
| 28 | +#include "TFile.h" |
| 29 | +#include "TRandom.h" |
| 30 | +#include "TSystem.h" |
| 31 | + |
| 32 | +// O2 includes |
| 33 | +#include "MetadataHelper.h" |
| 34 | +#include "TableHelper.h" |
| 35 | +#include "pidTPCBase.h" |
| 36 | + |
| 37 | +#include "Common/Core/PID/TPCPIDResponse.h" |
| 38 | +#include "Common/DataModel/EventSelection.h" |
| 39 | +#include "Common/DataModel/Multiplicity.h" |
| 40 | +#include "Common/DataModel/PIDResponseTPC.h" |
| 41 | +#include "Common/Tools/PID/pidTPCModule.h" |
| 42 | +#include "Tools/ML/model.h" |
| 43 | + |
| 44 | +#include "CCDB/BasicCCDBManager.h" |
| 45 | +#include "CCDB/CcdbApi.h" |
| 46 | +#include "Framework/ASoAHelpers.h" |
| 47 | +#include "Framework/AnalysisDataModel.h" |
| 48 | +#include "Framework/AnalysisTask.h" |
| 49 | +#include "Framework/runDataProcessing.h" |
| 50 | +#include "ReconstructionDataFormats/Track.h" |
| 51 | + |
| 52 | +using namespace o2; |
| 53 | +using namespace o2::framework; |
| 54 | + |
| 55 | +o2::common::core::MetadataHelper metadataInfo; // Metadata helper |
| 56 | + |
| 57 | +struct pidTpcServiceRun2 { |
| 58 | + |
| 59 | + // CCDB boilerplate declarations |
| 60 | + o2::framework::Configurable<std::string> ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; |
| 61 | + Service<o2::ccdb::BasicCCDBManager> ccdb; |
| 62 | + o2::ccdb::CcdbApi ccdbApi; |
| 63 | + |
| 64 | + o2::aod::pid::pidTPCProducts products; |
| 65 | + o2::aod::pid::pidTPCConfigurables pidTPCopts; |
| 66 | + o2::aod::pid::pidTPCModule pidTPC; |
| 67 | + |
| 68 | + void init(o2::framework::InitContext& initContext) |
| 69 | + { |
| 70 | + // CCDB boilerplate init |
| 71 | + ccdb->setURL(ccdburl.value); |
| 72 | + ccdb->setFatalWhenNull(false); // manual fallback in case ccdb entry empty |
| 73 | + ccdb->setCaching(true); |
| 74 | + ccdb->setLocalObjectValidityChecking(); |
| 75 | + ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count()); |
| 76 | + ccdbApi.init(ccdburl.value); |
| 77 | + |
| 78 | + // task-specific |
| 79 | + pidTPC.init(ccdb, ccdbApi, initContext, pidTPCopts, metadataInfo); |
| 80 | + } |
| 81 | + |
| 82 | + void processTracks(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::Tracks, aod::TracksExtra> const& tracks, aod::BCsWithTimestamps const& bcs) |
| 83 | + { |
| 84 | + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast<TObject*>(nullptr), products); |
| 85 | + } |
| 86 | + void processTracksWithTracksQA(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::Tracks, aod::TracksExtra> const& tracks, aod::BCsWithTimestamps const& bcs, aod::TracksQA const& tracksQA) |
| 87 | + { |
| 88 | + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, tracksQA, products); |
| 89 | + } |
| 90 | + |
| 91 | + void processTracksMC(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::Tracks, aod::TracksExtra, aod::McTrackLabels> const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&) |
| 92 | + { |
| 93 | + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast<TObject*>(nullptr), products); |
| 94 | + } |
| 95 | + |
| 96 | + PROCESS_SWITCH(pidTpcServiceRun2, processTracks, "Process Tracks", true); |
| 97 | + PROCESS_SWITCH(pidTpcServiceRun2, processTracksMC, "Process Tracks in MC (enables tune-on-data)", false); |
| 98 | +}; |
| 99 | + |
| 100 | +//**************************************************************************************** |
| 101 | +/** |
| 102 | + * Workflow definition. |
| 103 | + */ |
| 104 | +//**************************************************************************************** |
| 105 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 106 | +{ |
| 107 | + // Parse the metadata for later too |
| 108 | + metadataInfo.initMetadata(cfgc); |
| 109 | + |
| 110 | + WorkflowSpec workflow{adaptAnalysisTask<pidTpcServiceRun2>(cfgc)}; |
| 111 | + return workflow; |
| 112 | +} |
0 commit comments