|
| 1 | +// Copyright CERN and copyright holders of ALICE O2. This software is |
| 2 | +// distributed under the terms of the GNU General Public License v3 (GPL |
| 3 | +// Version 3), copied verbatim in the file "COPYING". |
| 4 | +// |
| 5 | +// See http://alice-o2.web.cern.ch/license for full licensing information. |
| 6 | +// |
| 7 | +// In applying this license CERN does not waive the privileges and immunities |
| 8 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 9 | +// or submit itself to any jurisdiction. |
| 10 | + |
| 11 | +#include "Framework/AnalysisDataModel.h" |
| 12 | +#include "Framework/AnalysisTask.h" |
| 13 | +#include "Framework/runDataProcessing.h" |
| 14 | +#include <TH1F.h> |
| 15 | + |
| 16 | +#include "AnalysisDataModel/EventSelection.h" |
| 17 | +#include "AnalysisDataModel/TrackSelectionTables.h" |
| 18 | + |
| 19 | +using namespace o2; |
| 20 | +using namespace o2::framework; |
| 21 | +using namespace o2::framework::expressions; |
| 22 | + |
| 23 | +// Example task generating a multiplicity distribution of |
| 24 | +// collision which pass the INT7 selection and |
| 25 | +// tracks which pass the "isGlobalTrack" selection |
| 26 | +// |
| 27 | +// Needs to run with event and track selection: |
| 28 | +// o2-analysis-timestamp | o2-analysis-event-selection | o2-analysis-trackextension | o2-analysis-trackselection | o2-analysistutorial-multiplicity-event-track-selection |
| 29 | + |
| 30 | +struct MultiplicityEventTrackSelection { |
| 31 | + |
| 32 | + OutputObj<TH1F> multiplicity{TH1F("multiplicity", "multiplicity", 5000, -0.5, 4999.5)}; |
| 33 | + |
| 34 | + Filter collisionZFilter = nabs(aod::collision::posZ) < 10.0f; |
| 35 | + Filter trackFilter = (nabs(aod::track::eta) < 0.8f) && (aod::track::pt > 0.15f) && (aod::track::isGlobalTrack == (uint8_t) true); |
| 36 | + |
| 37 | + void process(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels>>::iterator const& collision, |
| 38 | + soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection>> const& tracks) |
| 39 | + { |
| 40 | + if (!collision.alias()[kINT7]) { |
| 41 | + return; |
| 42 | + } |
| 43 | + if (!collision.sel7()) { |
| 44 | + return; |
| 45 | + } |
| 46 | + |
| 47 | + LOGP(INFO, "Collision with {} tracks", tracks.size()); |
| 48 | + multiplicity->Fill(tracks.size()); |
| 49 | + } |
| 50 | +}; |
| 51 | + |
| 52 | +// Workflow definition |
| 53 | +WorkflowSpec defineDataProcessing(ConfigContext const&) |
| 54 | +{ |
| 55 | + return WorkflowSpec{ |
| 56 | + adaptAnalysisTask<MultiplicityEventTrackSelection>("multiplicity-event-track-selection")}; |
| 57 | +} |
0 commit comments