Skip to content

Commit afb7e90

Browse files
committed
Set up to compile with old O2
1 parent 40ac982 commit afb7e90

4 files changed

Lines changed: 163 additions & 2 deletions

File tree

Common/Tools/EventSelectionModule.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
#include <DataFormatsCTP/Configuration.h>
2828
#include <DataFormatsCTP/Scalers.h>
2929
#include <DataFormatsFT0/Digit.h>
30-
#include <DataFormatsITSMFT/DPLAlpideParam.h>
30+
// #include <DataFormatsITSMFT/DPLAlpideParam.h>
31+
#include <ITSMFTBase/DPLAlpideParam.h>
3132
#include <DataFormatsITSMFT/TimeDeadMap.h>
3233
#include <DataFormatsParameters/AggregatedRunInfo.h>
3334
#include <DataFormatsParameters/GRPLHCIFData.h>

PWGDQ/Tasks/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,8 @@ o2physics_add_dpl_workflow(muon-global-alignment
163163
SOURCES muonGlobalAlignment.cxx
164164
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore O2::MCHGeometryTransformer
165165
COMPONENT_NAME Analysis)
166+
167+
o2physics_add_dpl_workflow(jpsi-muon-correlations
168+
SOURCES taskJPsiMu.cxx
169+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore O2::MCHGeometryTransformer
170+
COMPONENT_NAME Analysis)

PWGDQ/Tasks/tableReader_withAssoc.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
#include <CCDB/BasicCCDBManager.h>
3131
#include <CCDB/CcdbApi.h>
3232
#include <CommonConstants/MathConstants.h>
33-
#include <DataFormatsITSMFT/DPLAlpideParam.h>
33+
// #include <DataFormatsITSMFT/DPLAlpideParam.h>
34+
#include <ITSMFTBase/DPLAlpideParam.h>
3435
#include <DataFormatsParameters/GRPLHCIFData.h>
3536
#include <DataFormatsParameters/GRPMagField.h>
3637
#include <DetectorsBase/GeometryManager.h>

PWGDQ/Tasks/taskJPsiMu.cxx

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
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+
/// @author Kaare Endrup Iversen
12+
// Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no
13+
//
14+
#include "PWGDQ/Core/AnalysisCompositeCut.h"
15+
#include "PWGDQ/Core/AnalysisCut.h"
16+
#include "PWGDQ/Core/VarManager.h"
17+
#include "PWGDQ/DataModel/ReducedInfoTables.h"
18+
19+
#include <CCDB/BasicCCDBManager.h>
20+
#include <CommonConstants/MathConstants.h>
21+
#include <Framework/AnalysisDataModel.h>
22+
#include <Framework/AnalysisHelpers.h>
23+
#include <Framework/AnalysisTask.h>
24+
#include <Framework/BinningPolicy.h>
25+
#include <Framework/Configurable.h>
26+
#include <Framework/HistogramRegistry.h>
27+
#include <Framework/HistogramSpec.h>
28+
#include <Framework/InitContext.h>
29+
#include <Framework/StringHelpers.h>
30+
#include <Framework/runDataProcessing.h>
31+
32+
#include <sys/types.h>
33+
34+
#include <RtypesCore.h>
35+
36+
#include <chrono>
37+
#include <cmath>
38+
#include <cstdint>
39+
#include <memory>
40+
#include <string>
41+
#include <vector>
42+
43+
using std::string;
44+
45+
using namespace o2;
46+
using namespace o2::framework;
47+
using namespace o2::framework::expressions;
48+
using namespace o2::aod;
49+
50+
// Some definitions
51+
namespace o2::aod
52+
{
53+
54+
namespace dqanalysisflags
55+
{
56+
// DECLARE_SOA_COLUMN(IsEventSelected, isEventSelected, int);
57+
DECLARE_SOA_BITMAP_COLUMN(IsEventSelected, isEventSelected, 8); //! Event decision
58+
// DECLARE_SOA_COLUMN(IsMuonSelected, isMuonSelected, int);
59+
DECLARE_SOA_BITMAP_COLUMN(IsMuonSelected, isMuonSelected, 32); //! Muon track decisions (joinable to ReducedMuonsAssoc)
60+
}
61+
62+
DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTSA", dqanalysisflags::IsEventSelected); //! joinable to ReducedEvents
63+
DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTSA", dqanalysisflags::IsMuonSelected); //! joinable to ReducedMuonsAssoc
64+
}
65+
66+
// Declarations of various short names
67+
using MyEvents = soa::Join<aod::ReducedEvents, aod::ReducedEventsExtended>;
68+
using MyEventsSelected = soa::Join<aod::ReducedEvents, aod::ReducedEventsExtended, aod::EventCuts>;
69+
using MyEventsVtxCov = soa::Join<aod::ReducedEvents, aod::ReducedEventsExtended, aod::ReducedEventsVtxCov>;
70+
using MyEventsVtxCovSelected = soa::Join<aod::ReducedEvents, aod::ReducedEventsExtended, aod::ReducedEventsVtxCov, aod::EventCuts>;
71+
72+
using MyPairCandidatesSelected = soa::Join<aod::Dimuons, aod::DimuonsExtra>;
73+
using MyMuonTracks = soa::Join<aod::ReducedMuons, aod::ReducedMuonsExtra>;
74+
using MyMuonTracksSelected = soa::Join<aod::ReducedMuons, aod::ReducedMuonsExtra, aod::MuonTrackCuts>;
75+
using MyMuonTracksWithCov = soa::Join<aod::ReducedMuons, aod::ReducedMuonsExtra, aod::ReducedMuonsCov>;
76+
using MyMuonTracksSelectedWithCov = soa::Join<aod::ReducedMuons, aod::ReducedMuonsExtra, aod::ReducedMuonsCov, aod::MuonTrackCuts>;
77+
78+
// bit maps used for the Fill functions of the VarManager
79+
constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended;
80+
constexpr static uint32_t gkMuonFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::ReducedMuonExtra;
81+
82+
struct DqJPsiMuonCorrelations {
83+
84+
// Configurables for the dilepton and dilepton cuts
85+
Configurable<float> fConfigDileptonLowMass{"cfgDileptonLowMass", 2., "Low mass cut for the dileptons used in analysis"};
86+
Configurable<float> fConfigDileptonHighMass{"cfgDileptonHighMass", 4., "High mass cut for the dileptons used in analysis"};
87+
88+
// Connect to ccdb
89+
Service<ccdb::BasicCCDBManager> ccdb;
90+
Configurable<int64_t> nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
91+
Configurable<std::string> url{"ccdb-url", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"};
92+
93+
// Define the filter for events
94+
Filter eventFilter = aod::dqanalysisflags::isEventSelected == 1;
95+
96+
// Define the filter for the dileptons
97+
Filter dileptonFilter = aod::reducedpair::sign == 0;
98+
99+
constexpr static uint32_t fgDimuonsFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::Pair; // fill map
100+
101+
// use two values array to avoid mixing up the quantities
102+
float* fValuesDilepton;
103+
float* fValuesMuon;
104+
105+
HistogramRegistry registry{"registry"};
106+
107+
void init(o2::framework::InitContext&)
108+
{
109+
ccdb->setURL(url.value);
110+
ccdb->setCaching(true);
111+
ccdb->setCreatedNotAfter(nolaterthan.value);
112+
113+
fValuesDilepton = new float[VarManager::kNVars];
114+
fValuesMuon = new float[VarManager::kNVars];
115+
VarManager::SetDefaultVarNames();
116+
117+
LOG(info) << "Initialized DqJPsiMuonCorrelations task" << std::endl;
118+
}
119+
120+
// Template function to run pair - muon combinations
121+
template <int TCandidateType, uint32_t TEventFillMap, uint32_t TMuonFillMap, typename TEvent, typename TMuons, typename TDileptons>
122+
void runDileptonMuon(TEvent const& event, TMuons const& muons, TDileptons const& dileptons)
123+
{
124+
// VarManager::ResetValues(0, VarManager::kNVars, fValuesHadron);
125+
VarManager::ResetValues(0, VarManager::kNVars, fValuesMuon);
126+
VarManager::ResetValues(0, VarManager::kNVars, fValuesDilepton);
127+
VarManager::FillEvent<TEventFillMap>(event, fValuesMuon);
128+
VarManager::FillEvent<TEventFillMap>(event, fValuesDilepton);
129+
130+
if (dileptons.size() > 0) {
131+
LOG(info) << "Dileptons in event: " << dileptons.size() << std::endl;
132+
} else {
133+
LOG(info) << "No dileptons in event" << std::endl;
134+
}
135+
}
136+
137+
void processSkimmedDimuon(MyEventsSelected::iterator const& event, MyMuonTracksSelected const& muons, soa::Filtered<MyPairCandidatesSelected> const& dileptons)
138+
{
139+
LOG(info) << "Processing event " << event.globalIndex() << " with " << muons.size() << " muons and " << dileptons.size() << " dileptons" << std::endl;
140+
runDileptonMuon<VarManager::kDecayToMuMu, gkEventFillMap, gkMuonFillMap>(event, muons, dileptons);
141+
}
142+
void processDummy(MyEvents&)
143+
{
144+
}
145+
146+
PROCESS_SWITCH(DqJPsiMuonCorrelations, processSkimmedDimuon, "Run dilepton-muon pairing, using skimmed data", false);
147+
PROCESS_SWITCH(DqJPsiMuonCorrelations, processDummy, "Dummy function", false);
148+
};
149+
150+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
151+
{
152+
return WorkflowSpec{
153+
adaptAnalysisTask<DqJPsiMuonCorrelations>(cfgc)};
154+
}

0 commit comments

Comments
 (0)