Skip to content

Commit dc4c7d4

Browse files
committed
[PWGEM,PWGEM-36] skimmerGammaCalo: Add needEMCTrigger configurable
- Add `needEMCTrigger` configurable option. If one uses this one for the EM Event Selection, one also needs to enable this here to ensure the table sizes of `EMCEMEventId` and `SkimEMCClusters` have the same size. - Header cleanup with clang´-tidy
1 parent f3acbbf commit dc4c7d4

File tree

1 file changed

+34
-21
lines changed

1 file changed

+34
-21
lines changed

PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,44 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12+
/// \file skimmerGammaCalo.cxx
1213
/// \brief skim cluster information to write photon cluster table in AO2D.root
1314
/// dependencies: emcal-correction-task
1415
/// \author marvin.hemmer@cern.ch
1516

16-
#include <algorithm>
17-
#include <vector>
17+
#include "PWGEM/PhotonMeson/DataModel/gammaTables.h"
18+
#include "PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h"
19+
#include "PWGJE/DataModel/EMCALClusters.h"
1820

19-
#include "Framework/runDataProcessing.h"
20-
#include "Framework/AnalysisTask.h"
21-
#include "Framework/AnalysisDataModel.h"
21+
#include "Common/CCDB/TriggerAliases.h"
22+
#include "Common/DataModel/EventSelection.h"
2223

23-
#include "Common/Core/TableHelper.h"
24+
#include <Framework/AnalysisDataModel.h>
25+
#include <Framework/AnalysisHelpers.h>
26+
#include <Framework/AnalysisTask.h>
27+
#include <Framework/Configurable.h>
28+
#include <Framework/HistogramRegistry.h>
29+
#include <Framework/HistogramSpec.h>
30+
#include <Framework/InitContext.h>
31+
#include <Framework/OutputObjHeader.h>
32+
#include <Framework/runDataProcessing.h>
2433

25-
// includes for the R recalculation
26-
#include "DetectorsBase/GeometryManager.h"
27-
#include "DataFormatsParameters/GRPObject.h"
28-
#include "CCDB/BasicCCDBManager.h"
34+
#include <TH1.h>
2935

30-
#include "PWGEM/PhotonMeson/DataModel/gammaTables.h"
31-
#include "PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h"
36+
#include <algorithm>
37+
#include <cmath>
38+
#include <cstddef>
39+
#include <cstdint>
40+
#include <vector>
3241

3342
using namespace o2;
3443
using namespace o2::framework;
3544
using namespace o2::framework::expressions;
3645

37-
struct skimmerGammaCalo {
46+
struct SkimmerGammaCalo {
3847

39-
Preslice<o2::aod::EMCALClusterCells> CellperCluster = o2::aod::emcalclustercell::emcalclusterId;
40-
Preslice<o2::aod::EMCALMatchedTracks> MTperCluster = o2::aod::emcalclustercell::emcalclusterId;
48+
Preslice<o2::aod::EMCALClusterCells> psCellperCluster = o2::aod::emcalclustercell::emcalclusterId;
49+
Preslice<o2::aod::EMCALMatchedTracks> psMTperCluster = o2::aod::emcalclustercell::emcalclusterId;
4150

4251
Produces<aod::SkimEMCClusters> tableGammaEMCReco;
4352
Produces<aod::EMCClusterMCLabels> tableEMCClusterMCLabels;
@@ -53,6 +62,7 @@ struct skimmerGammaCalo {
5362
Configurable<std::vector<int>> clusterDefinitions{"clusterDefinitions", {0, 1, 2, 10, 11, 12, 13, 20, 21, 22, 30, 40, 41, 42, 43, 44, 45}, "Cluster definitions to be accepted (e.g. 13 for kV3MostSplitLowSeed)"};
5463
Configurable<float> maxdEta{"maxdEta", 0.1, "Set a maximum difference in eta for tracks and cluster to still count as matched"};
5564
Configurable<float> maxdPhi{"maxdPhi", 0.1, "Set a maximum difference in phi for tracks and cluster to still count as matched"};
65+
Configurable<bool> needEMCTrigger{"needEMCTrigger", false, "flag to only save events which have kTVXinEMC trigger bit. To reduce PbPb derived data size"};
5666

5767
HistogramRegistry historeg{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false};
5868

@@ -86,6 +96,9 @@ struct skimmerGammaCalo {
8696
if (!collision.isSelected()) {
8797
return;
8898
}
99+
if (needEMCTrigger.value && !collision.alias_bit(kTVXinEMC)) {
100+
return;
101+
}
89102

90103
for (const auto& emccluster : emcclusters) {
91104
historeg.fill(HIST("hCaloClusterFilter"), 0);
@@ -124,7 +137,7 @@ struct skimmerGammaCalo {
124137
historeg.fill(HIST("TimeOut"), emccluster.time());
125138

126139
// Skimmed cell table
127-
auto groupedCells = emcclustercells.sliceBy(CellperCluster, emccluster.globalIndex());
140+
auto groupedCells = emcclustercells.sliceBy(psCellperCluster, emccluster.globalIndex());
128141
for (const auto& emcclustercell : groupedCells) {
129142
tableCellEMCReco(emcclustercell.emcalclusterId(), emcclustercell.caloId());
130143
}
@@ -135,7 +148,7 @@ struct skimmerGammaCalo {
135148
std::vector<float> vPhi;
136149
std::vector<float> vP;
137150
std::vector<float> vPt;
138-
auto groupedMTs = emcmatchedtracks.sliceBy(MTperCluster, emccluster.globalIndex());
151+
auto groupedMTs = emcmatchedtracks.sliceBy(psMTperCluster, emccluster.globalIndex());
139152
vTrackIds.reserve(groupedMTs.size());
140153
vEta.reserve(groupedMTs.size());
141154
vPhi.reserve(groupedMTs.size());
@@ -195,18 +208,18 @@ struct skimmerGammaCalo {
195208
mcLabels.clear();
196209
}
197210
}
198-
PROCESS_SWITCH(skimmerGammaCalo, processRec, "process only reconstructed info", true);
199-
PROCESS_SWITCH(skimmerGammaCalo, processMC, "process MC info", false); // Run this in addition to processRec for MCs to copy the cluster mc labels from the EMCALMCClusters to the skimmed EMCClusterMCLabels table
211+
PROCESS_SWITCH(SkimmerGammaCalo, processRec, "process only reconstructed info", true);
212+
PROCESS_SWITCH(SkimmerGammaCalo, processMC, "process MC info", false); // Run this in addition to processRec for MCs to copy the cluster mc labels from the EMCALMCClusters to the skimmed EMCClusterMCLabels table
200213

201214
void processDummy(aod::Collision const&)
202215
{
203216
// do nothing
204217
}
205-
PROCESS_SWITCH(skimmerGammaCalo, processDummy, "Dummy function", false);
218+
PROCESS_SWITCH(SkimmerGammaCalo, processDummy, "Dummy function", false);
206219
};
207220

208221
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
209222
{
210-
WorkflowSpec workflow{adaptAnalysisTask<skimmerGammaCalo>(cfgc, TaskName{"skimmer-gamma-calo"})};
223+
WorkflowSpec workflow{adaptAnalysisTask<SkimmerGammaCalo>(cfgc)};
211224
return workflow;
212225
}

0 commit comments

Comments
 (0)