|
| 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 | +/// |
| 13 | +/// \file TrackClusters.cxx |
| 14 | +/// \author Laura Serksnyte |
| 15 | +/// |
| 16 | + |
| 17 | +// O2 includes |
| 18 | +#include "Framework/ProcessingContext.h" |
| 19 | +#include <Framework/InputRecord.h> |
| 20 | +#include "DataFormatsTPC/TrackTPC.h" |
| 21 | +#include "TPCQC/Helpers.h" |
| 22 | +#include "DataFormatsTPC/ClusterNative.h" |
| 23 | +#include "DataFormatsTPC/WorkflowHelper.h" |
| 24 | + |
| 25 | +// QC includes |
| 26 | +#include "QualityControl/QcInfoLogger.h" |
| 27 | +#include "TPC/TrackClusters.h" |
| 28 | +#include "Common/Utils.h" |
| 29 | + |
| 30 | +using namespace o2::framework; |
| 31 | +using namespace o2::tpc; |
| 32 | + |
| 33 | +namespace o2::quality_control_modules::tpc |
| 34 | +{ |
| 35 | + |
| 36 | +TrackClusters::TrackClusters() : TaskInterface() |
| 37 | +{ |
| 38 | +} |
| 39 | + |
| 40 | +void TrackClusters::initialize(InitContext& /*ctx*/) |
| 41 | +{ |
| 42 | + ILOG(Debug, Devel) << "initialize TPC TrackClusters QC task" << ENDM; |
| 43 | + |
| 44 | + // do random generator |
| 45 | + const int seed = o2::quality_control_modules::common::getFromConfig<int>(mCustomParameters, "seed"); |
| 46 | + mRandomGenerator = new TRandom3(seed); |
| 47 | + mSamplingFraction = o2::quality_control_modules::common::getFromConfig<float>(mCustomParameters, "samplingFraction"); |
| 48 | + |
| 49 | + const int cutMinNCluster = o2::quality_control_modules::common::getFromConfig<int>(mCustomParameters, "cutMinNCluster"); |
| 50 | + const float cutMindEdxTot = o2::quality_control_modules::common::getFromConfig<float>(mCustomParameters, "cutMindEdxTot"); |
| 51 | + const float cutAbsEta = o2::quality_control_modules::common::getFromConfig<float>(mCustomParameters, "cutAbsEta"); |
| 52 | + |
| 53 | + mQCTrackClusters.setTrackClustersCuts(cutMinNCluster, cutMindEdxTot, cutAbsEta); |
| 54 | + mQCTrackClusters.initializeHistograms(); |
| 55 | + |
| 56 | + o2::tpc::qc::helpers::setStyleHistogramsInMap(mQCTrackClusters.getMapOfHisto()); |
| 57 | + for (auto const& pair : mQCTrackClusters.getMapOfHisto()) { |
| 58 | + for (auto& hist : pair.second) { |
| 59 | + getObjectsManager()->startPublishing(hist.get()); |
| 60 | + } |
| 61 | + } |
| 62 | +} |
| 63 | + |
| 64 | +void TrackClusters::startOfActivity(const Activity& /*activity*/) |
| 65 | +{ |
| 66 | + ILOG(Debug, Devel) << "startOfActivity" << ENDM; |
| 67 | + // serksnyte: anything neeeded for start of activity (in track tasks there is a reset of histograms)? |
| 68 | +} |
| 69 | + |
| 70 | +void TrackClusters::startOfCycle() |
| 71 | +{ |
| 72 | + ILOG(Debug, Devel) << "startOfCycle" << ENDM; |
| 73 | +} |
| 74 | + |
| 75 | +void TrackClusters::monitorData(ProcessingContext& ctx) |
| 76 | +{ |
| 77 | + if (mRandomGenerator->Uniform(0., 1.) < mSamplingFraction) { |
| 78 | + |
| 79 | + using TrackType = std::vector<o2::tpc::TrackTPC>; |
| 80 | + using ClusterRefType = std::vector<o2::tpc::TPCClRefElem>; |
| 81 | + |
| 82 | + auto tracks = ctx.inputs().get<TrackType>("inputTracks"); |
| 83 | + const auto& inputsTPCclusters = o2::tpc::getWorkflowTPCInput(ctx, 0, false); |
| 84 | + auto clusRefs = ctx.inputs().get<ClusterRefType>("inputClusRefs"); |
| 85 | + |
| 86 | + mQCTrackClusters.processTrackAndClusters(&tracks, &inputsTPCclusters->clusterIndex, &clusRefs); |
| 87 | + } |
| 88 | +} |
| 89 | + |
| 90 | +void TrackClusters::endOfCycle() |
| 91 | +{ |
| 92 | + ILOG(Debug, Devel) << "endOfCycle" << ENDM; |
| 93 | +} |
| 94 | + |
| 95 | +void TrackClusters::endOfActivity(const Activity& /*activity*/) |
| 96 | +{ |
| 97 | + ILOG(Debug, Devel) << "endOfActivity" << ENDM; |
| 98 | +} |
| 99 | + |
| 100 | +void TrackClusters::reset() |
| 101 | +{ |
| 102 | + ILOG(Debug, Devel) << "Resetting the data" << ENDM; |
| 103 | + mQCTrackClusters.resetHistograms(); |
| 104 | +} |
| 105 | + |
| 106 | +} // namespace o2::quality_control_modules::tpc |
0 commit comments