Skip to content

Commit 245ad8d

Browse files
author
Maurice Coquet
committed
clang format
1 parent e54cf0d commit 245ad8d

File tree

2 files changed

+115
-116
lines changed

2 files changed

+115
-116
lines changed

PWGDQ/Core/MuonMatchingMlResponse.h

Lines changed: 71 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -24,69 +24,68 @@
2424
// Fill the map of available input features
2525
// the key is the feature's name (std::string)
2626
// the value is the corresponding value in EnumInputFeatures
27-
#define FILL_MAP_MFTMUON_MATCH(FEATURE) \
28-
{ \
29-
#FEATURE, static_cast<uint8_t>(InputFeaturesMFTMuonMatch::FEATURE) \
30-
}
27+
#define FILL_MAP_MFTMUON_MATCH(FEATURE) \
28+
{ \
29+
#FEATURE, static_cast<uint8_t>(InputFeaturesMFTMuonMatch::FEATURE)}
3130

3231
// Check if the index of mCachedIndices (index associated to a FEATURE)
3332
// matches the entry in EnumInputFeatures associated to this FEATURE
3433
// if so, the inputFeatures vector is filled with the FEATURE's value
3534
// by calling the corresponding GETTER=FEATURE from track
36-
#define CHECK_AND_FILL_MUON_TRACK(FEATURE, GETTER) \
35+
#define CHECK_AND_FILL_MUON_TRACK(FEATURE, GETTER) \
3736
case static_cast<uint8_t>(InputFeaturesMFTMuonMatch::FEATURE): { \
38-
inputFeature = muon.GETTER(); \
39-
break; \
37+
inputFeature = muon.GETTER(); \
38+
break; \
4039
}
4140

4241
// Check if the index of mCachedIndices (index associated to a FEATURE)
4342
// matches the entry in EnumInputFeatures associated to this FEATURE
4443
// if so, the inputFeatures vector is filled with the FEATURE's value
4544
// by calling the corresponding GETTER=FEATURE from track
46-
#define CHECK_AND_FILL_MFT_TRACK(FEATURE, GETTER) \
45+
#define CHECK_AND_FILL_MFT_TRACK(FEATURE, GETTER) \
4746
case static_cast<uint8_t>(InputFeaturesMFTMuonMatch::FEATURE): { \
48-
inputFeature = mft.GETTER(); \
49-
break; \
47+
inputFeature = mft.GETTER(); \
48+
break; \
5049
}
5150

5251
// Check if the index of mCachedIndices (index associated to a FEATURE)
5352
// matches the entry in EnumInputFeatures associated to this FEATURE
5453
// if so, the inputFeatures vector is filled with the FEATURE's value
5554
// by calling the corresponding GETTER=FEATURE from track
56-
#define CHECK_AND_FILL_MUON_COV(FEATURE, GETTER) \
55+
#define CHECK_AND_FILL_MUON_COV(FEATURE, GETTER) \
5756
case static_cast<uint8_t>(InputFeaturesMFTMuonMatch::FEATURE): { \
58-
inputFeature = muoncov.GETTER(); \
59-
break; \
57+
inputFeature = muoncov.GETTER(); \
58+
break; \
6059
}
6160

6261
// Check if the index of mCachedIndices (index associated to a FEATURE)
6362
// matches the entry in EnumInputFeatures associated to this FEATURE
6463
// if so, the inputFeatures vector is filled with the FEATURE's value
6564
// by calling the corresponding GETTER=FEATURE from track
66-
#define CHECK_AND_FILL_MFT_COV(FEATURE, GETTER) \
65+
#define CHECK_AND_FILL_MFT_COV(FEATURE, GETTER) \
6766
case static_cast<uint8_t>(InputFeaturesMFTMuonMatch::FEATURE): { \
68-
inputFeature = mftcov.GETTER(); \
69-
break; \
67+
inputFeature = mftcov.GETTER(); \
68+
break; \
7069
}
7170

7271
// Check if the index of mCachedIndices (index associated to a FEATURE)
7372
// matches the entry in EnumInputFeatures associated to this FEATURE
7473
// if so, the inputFeatures vector is filled with the FEATURE's value
7574
// by calling the corresponding GETTER1 and GETTER2 from track.
76-
#define CHECK_AND_FILL_MFTMUON_DIFF(FEATURE, GETTER1, GETTER2) \
77-
case static_cast<uint8_t>(InputFeaturesMFTMuonMatch::FEATURE): { \
78-
inputFeature = (mft.GETTER2() - muon.GETTER1()); \
79-
break; \
75+
#define CHECK_AND_FILL_MFTMUON_DIFF(FEATURE, GETTER1, GETTER2) \
76+
case static_cast<uint8_t>(InputFeaturesMFTMuonMatch::FEATURE): { \
77+
inputFeature = (mft.GETTER2() - muon.GETTER1()); \
78+
break; \
8079
}
8180

8281
// Check if the index of mCachedIndices (index associated to a FEATURE)
8382
// matches the entry in EnumInputFeatures associated to this FEATURE
8483
// if so, the inputFeatures vector is filled with the FEATURE's value
8584
// by calling the corresponding GETTER=FEATURE from collision
86-
#define CHECK_AND_FILL_MFTMUON_COLLISION(GETTER) \
85+
#define CHECK_AND_FILL_MFTMUON_COLLISION(GETTER) \
8786
case static_cast<uint8_t>(InputFeaturesMFTMuonMatch::GETTER): { \
88-
inputFeature = collision.GETTER(); \
89-
break; \
87+
inputFeature = collision.GETTER(); \
88+
break; \
9089
}
9190

9291
namespace o2::analysis
@@ -180,54 +179,54 @@ class MlResponseMFTMuonMatch : public MlResponse<TypeOutputScore>
180179
{
181180
float inputFeature = 0.;
182181
switch (idx) {
183-
CHECK_AND_FILL_MFT_TRACK(zMatching,z);
184-
CHECK_AND_FILL_MFT_TRACK(xMFT,x);
185-
CHECK_AND_FILL_MFT_TRACK(yMFT,y);
186-
CHECK_AND_FILL_MFT_TRACK(qOverptMFT,signed1Pt);
187-
CHECK_AND_FILL_MFT_TRACK(tglMFT,tgl);
188-
CHECK_AND_FILL_MFT_TRACK(phiMFT,phi);
189-
CHECK_AND_FILL_MFT_TRACK(chi2MFT,chi2);
190-
CHECK_AND_FILL_MFT_TRACK(nClustersMFT,nClusters);
182+
CHECK_AND_FILL_MFT_TRACK(zMatching, z);
183+
CHECK_AND_FILL_MFT_TRACK(xMFT, x);
184+
CHECK_AND_FILL_MFT_TRACK(yMFT, y);
185+
CHECK_AND_FILL_MFT_TRACK(qOverptMFT, signed1Pt);
186+
CHECK_AND_FILL_MFT_TRACK(tglMFT, tgl);
187+
CHECK_AND_FILL_MFT_TRACK(phiMFT, phi);
188+
CHECK_AND_FILL_MFT_TRACK(chi2MFT, chi2);
189+
CHECK_AND_FILL_MFT_TRACK(nClustersMFT, nClusters);
191190
CHECK_AND_FILL_MUON_TRACK(dcaXY, fwddcaXY);
192191
CHECK_AND_FILL_MUON_TRACK(dcaZ, fwddcaz);
193-
CHECK_AND_FILL_MUON_TRACK(xMCH,x);
194-
CHECK_AND_FILL_MUON_TRACK(yMCH,y);
195-
CHECK_AND_FILL_MUON_TRACK(qOverptMCH,signed1Pt);
196-
CHECK_AND_FILL_MUON_TRACK(tglMCH,tgl);
197-
CHECK_AND_FILL_MUON_TRACK(phiMCH,phi);
198-
CHECK_AND_FILL_MUON_TRACK(nClustersMCH,nClusters);
199-
CHECK_AND_FILL_MUON_TRACK(chi2MCH,chi2);
200-
CHECK_AND_FILL_MUON_TRACK(pdca,pDca);
201-
CHECK_AND_FILL_MFT_COV(cXXMFT,cXX);
202-
CHECK_AND_FILL_MFT_COV(cXYMFT,cXY);
203-
CHECK_AND_FILL_MFT_COV(cYYMFT,cYY);
204-
CHECK_AND_FILL_MFT_COV(cPhiYMFT,cPhiY);
205-
CHECK_AND_FILL_MFT_COV(cPhiXMFT,cPhiX);
206-
CHECK_AND_FILL_MFT_COV(cPhiPhiMFT,cPhiPhi);
207-
CHECK_AND_FILL_MFT_COV(cTglYMFT,cTglY);
208-
CHECK_AND_FILL_MFT_COV(cTglXMFT,cTglX);
209-
CHECK_AND_FILL_MFT_COV(cTglPhiMFT,cTglPhi);
210-
CHECK_AND_FILL_MFT_COV(cTglTglMFT,cTglTgl);
211-
CHECK_AND_FILL_MFT_COV(c1PtYMFT,c1PtY);
212-
CHECK_AND_FILL_MFT_COV(c1PtXMFT,c1PtX);
213-
CHECK_AND_FILL_MFT_COV(c1PtPhiMFT,c1PtPhi);
214-
CHECK_AND_FILL_MFT_COV(c1PtTglMFT,c1PtTgl);
215-
CHECK_AND_FILL_MFT_COV(c1Pt21Pt2MFT,c1Pt21Pt2);
216-
CHECK_AND_FILL_MUON_COV(cXXMCH,cXX);
217-
CHECK_AND_FILL_MUON_COV(cXYMCH,cXY);
218-
CHECK_AND_FILL_MUON_COV(cYYMCH,cYY);
219-
CHECK_AND_FILL_MUON_COV(cPhiYMCH,cPhiY);
220-
CHECK_AND_FILL_MUON_COV(cPhiXMCH,cPhiX);
221-
CHECK_AND_FILL_MUON_COV(cPhiPhiMCH,cPhiPhi);
222-
CHECK_AND_FILL_MUON_COV(cTglYMCH,cTglY);
223-
CHECK_AND_FILL_MUON_COV(cTglXMCH,cTglX);
224-
CHECK_AND_FILL_MUON_COV(cTglPhiMCH,cTglPhi);
225-
CHECK_AND_FILL_MUON_COV(cTglTglMCH,cTglTgl);
226-
CHECK_AND_FILL_MUON_COV(c1PtYMCH,c1PtY);
227-
CHECK_AND_FILL_MUON_COV(c1PtXMCH,c1PtX);
228-
CHECK_AND_FILL_MUON_COV(c1PtPhiMCH,c1PtPhi);
229-
CHECK_AND_FILL_MUON_COV(c1PtTglMCH,c1PtTgl);
230-
CHECK_AND_FILL_MUON_COV(c1Pt21Pt2MCH,c1Pt21Pt2);
192+
CHECK_AND_FILL_MUON_TRACK(xMCH, x);
193+
CHECK_AND_FILL_MUON_TRACK(yMCH, y);
194+
CHECK_AND_FILL_MUON_TRACK(qOverptMCH, signed1Pt);
195+
CHECK_AND_FILL_MUON_TRACK(tglMCH, tgl);
196+
CHECK_AND_FILL_MUON_TRACK(phiMCH, phi);
197+
CHECK_AND_FILL_MUON_TRACK(nClustersMCH, nClusters);
198+
CHECK_AND_FILL_MUON_TRACK(chi2MCH, chi2);
199+
CHECK_AND_FILL_MUON_TRACK(pdca, pDca);
200+
CHECK_AND_FILL_MFT_COV(cXXMFT, cXX);
201+
CHECK_AND_FILL_MFT_COV(cXYMFT, cXY);
202+
CHECK_AND_FILL_MFT_COV(cYYMFT, cYY);
203+
CHECK_AND_FILL_MFT_COV(cPhiYMFT, cPhiY);
204+
CHECK_AND_FILL_MFT_COV(cPhiXMFT, cPhiX);
205+
CHECK_AND_FILL_MFT_COV(cPhiPhiMFT, cPhiPhi);
206+
CHECK_AND_FILL_MFT_COV(cTglYMFT, cTglY);
207+
CHECK_AND_FILL_MFT_COV(cTglXMFT, cTglX);
208+
CHECK_AND_FILL_MFT_COV(cTglPhiMFT, cTglPhi);
209+
CHECK_AND_FILL_MFT_COV(cTglTglMFT, cTglTgl);
210+
CHECK_AND_FILL_MFT_COV(c1PtYMFT, c1PtY);
211+
CHECK_AND_FILL_MFT_COV(c1PtXMFT, c1PtX);
212+
CHECK_AND_FILL_MFT_COV(c1PtPhiMFT, c1PtPhi);
213+
CHECK_AND_FILL_MFT_COV(c1PtTglMFT, c1PtTgl);
214+
CHECK_AND_FILL_MFT_COV(c1Pt21Pt2MFT, c1Pt21Pt2);
215+
CHECK_AND_FILL_MUON_COV(cXXMCH, cXX);
216+
CHECK_AND_FILL_MUON_COV(cXYMCH, cXY);
217+
CHECK_AND_FILL_MUON_COV(cYYMCH, cYY);
218+
CHECK_AND_FILL_MUON_COV(cPhiYMCH, cPhiY);
219+
CHECK_AND_FILL_MUON_COV(cPhiXMCH, cPhiX);
220+
CHECK_AND_FILL_MUON_COV(cPhiPhiMCH, cPhiPhi);
221+
CHECK_AND_FILL_MUON_COV(cTglYMCH, cTglY);
222+
CHECK_AND_FILL_MUON_COV(cTglXMCH, cTglX);
223+
CHECK_AND_FILL_MUON_COV(cTglPhiMCH, cTglPhi);
224+
CHECK_AND_FILL_MUON_COV(cTglTglMCH, cTglTgl);
225+
CHECK_AND_FILL_MUON_COV(c1PtYMCH, c1PtY);
226+
CHECK_AND_FILL_MUON_COV(c1PtXMCH, c1PtX);
227+
CHECK_AND_FILL_MUON_COV(c1PtPhiMCH, c1PtPhi);
228+
CHECK_AND_FILL_MUON_COV(c1PtTglMCH, c1PtTgl);
229+
CHECK_AND_FILL_MUON_COV(c1Pt21Pt2MCH, c1Pt21Pt2);
231230
CHECK_AND_FILL_MFTMUON_COLLISION(posX);
232231
CHECK_AND_FILL_MFTMUON_COLLISION(posY);
233232
CHECK_AND_FILL_MFTMUON_COLLISION(posZ);
@@ -245,7 +244,7 @@ class MlResponseMFTMuonMatch : public MlResponse<TypeOutputScore>
245244
CHECK_AND_FILL_MFTMUON_COLLISION(centFT0M);
246245
CHECK_AND_FILL_MFTMUON_COLLISION(centFT0A);
247246
CHECK_AND_FILL_MFTMUON_COLLISION(centFT0C);
248-
CHECK_AND_FILL_MUON_TRACK(chi2MCHMFT,chi2MatchMCHMFT);
247+
CHECK_AND_FILL_MUON_TRACK(chi2MCHMFT, chi2MatchMCHMFT);
249248
}
250249
return inputFeature;
251250
}
@@ -255,12 +254,11 @@ class MlResponseMFTMuonMatch : public MlResponse<TypeOutputScore>
255254
{
256255
float inputFeature = 0.;
257256
switch (idx) {
258-
CHECK_AND_FILL_MUON_TRACK(chi2MCHMFT,chi2MatchMCHMFT);
257+
CHECK_AND_FILL_MUON_TRACK(chi2MCHMFT, chi2MatchMCHMFT);
259258
}
260259
return inputFeature;
261260
}
262261

263-
264262
/// Method to get the input features vector needed for ML inference
265263
/// \param track is the single track, \param collision is the collision
266264
/// \return inputFeatures vector
@@ -358,8 +356,7 @@ class MlResponseMFTMuonMatch : public MlResponse<TypeOutputScore>
358356
FILL_MAP_MFTMUON_MATCH(c1PtPhiMCH),
359357
FILL_MAP_MFTMUON_MATCH(c1PtTglMCH),
360358
FILL_MAP_MFTMUON_MATCH(c1Pt21Pt2MCH),
361-
FILL_MAP_MFTMUON_MATCH(chi2MCHMFT)
362-
};
359+
FILL_MAP_MFTMUON_MATCH(chi2MCHMFT)};
363360
}
364361

365362
uint8_t mCachedIndexBinning; // index correspondance between configurable and available input features

PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,46 +16,50 @@
1616
// The skimmed MC stack includes the MC truth particles corresponding to the list of user specified MC signals (see MCsignal.h)
1717
// and the MC truth particles corresponding to the reconstructed tracks selected by the specified track cuts on reconstructed data.
1818

19-
#include <cstdint>
20-
#include <iostream>
21-
#include <map>
22-
#include <string>
23-
#include <memory>
24-
#include <vector>
25-
#include <utility>
26-
#include <unordered_map>
27-
#include "TList.h"
28-
#include "Framework/AnalysisTask.h"
29-
#include "Framework/AnalysisDataModel.h"
30-
#include "Framework/ASoAHelpers.h"
31-
#include "Framework/ASoA.h"
32-
#include "Framework/DataTypes.h"
33-
#include "Framework/runDataProcessing.h"
34-
#include "Common/DataModel/Multiplicity.h"
35-
#include "Common/DataModel/EventSelection.h"
36-
#include "Common/DataModel/Centrality.h"
37-
#include "Common/CCDB/TriggerAliases.h"
38-
#include "PWGDQ/DataModel/ReducedInfoTables.h"
39-
#include "PWGDQ/Core/VarManager.h"
40-
#include "PWGDQ/Core/HistogramManager.h"
41-
#include "PWGDQ/Core/AnalysisCut.h"
4219
#include "PWGDQ/Core/AnalysisCompositeCut.h"
43-
#include "PWGDQ/Core/HistogramsLibrary.h"
20+
#include "PWGDQ/Core/AnalysisCut.h"
4421
#include "PWGDQ/Core/CutsLibrary.h"
22+
#include "PWGDQ/Core/HistogramManager.h"
23+
#include "PWGDQ/Core/HistogramsLibrary.h"
4524
#include "PWGDQ/Core/MCSignal.h"
4625
#include "PWGDQ/Core/MCSignalLibrary.h"
4726
#include "PWGDQ/Core/MuonMatchingMlResponse.h"
27+
#include "PWGDQ/Core/VarManager.h"
28+
#include "PWGDQ/DataModel/ReducedInfoTables.h"
29+
30+
#include "Common/CCDB/TriggerAliases.h"
31+
#include "Common/DataModel/Centrality.h"
32+
#include "Common/DataModel/CollisionAssociationTables.h"
33+
#include "Common/DataModel/EventSelection.h"
34+
#include "Common/DataModel/FwdTrackReAlignTables.h"
35+
#include "Common/DataModel/Multiplicity.h"
4836
#include "Common/DataModel/PIDResponse.h"
4937
#include "Common/DataModel/TrackSelectionTables.h"
50-
#include "Common/DataModel/FwdTrackReAlignTables.h"
51-
#include "Common/DataModel/CollisionAssociationTables.h"
38+
39+
#include "CCDB/BasicCCDBManager.h"
5240
#include "DataFormatsParameters/GRPMagField.h"
5341
#include "DataFormatsParameters/GRPObject.h"
42+
#include "DetectorsBase/GeometryManager.h"
43+
#include "DetectorsBase/Propagator.h"
5444
#include "Field/MagneticField.h"
45+
#include "Framework/ASoA.h"
46+
#include "Framework/ASoAHelpers.h"
47+
#include "Framework/AnalysisDataModel.h"
48+
#include "Framework/AnalysisTask.h"
49+
#include "Framework/DataTypes.h"
50+
#include "Framework/runDataProcessing.h"
51+
5552
#include "TGeoGlobalMagField.h"
56-
#include "DetectorsBase/Propagator.h"
57-
#include "DetectorsBase/GeometryManager.h"
58-
#include "CCDB/BasicCCDBManager.h"
53+
#include "TList.h"
54+
55+
#include <cstdint>
56+
#include <iostream>
57+
#include <map>
58+
#include <memory>
59+
#include <string>
60+
#include <unordered_map>
61+
#include <utility>
62+
#include <vector>
5963

6064
using std::cout;
6165
using std::endl;
@@ -248,10 +252,9 @@ struct TableMakerMC {
248252

249253
o2::analysis::MlResponseMFTMuonMatch<float> matchingMlResponse;
250254
std::vector<double> binsPtMl;
251-
std::array<double,1> cutValues;
255+
std::array<double, 1> cutValues;
252256
std::vector<int> cutDirMl;
253257

254-
255258
void init(o2::framework::InitContext& context)
256259
{
257260
// Check whether barrel or muon are enabled
@@ -377,18 +380,17 @@ struct TableMakerMC {
377380
}
378381
fCCDBApi.init(fConfigCCDB.fConfigCcdbUrl.value);
379382

380-
if (fConfigVariousOptions.fUseML.value){
381-
//TODO : for now we use hard coded values since the current models use 1 pT bin
382-
binsPtMl = {-1e-6,1000.0};
383+
if (fConfigVariousOptions.fUseML.value) {
384+
// TODO : for now we use hard coded values since the current models use 1 pT bin
385+
binsPtMl = {-1e-6, 1000.0};
383386
cutValues = {0.0};
384387
cutDirMl = {cuts_ml::CutNot};
385-
o2::framework::LabeledArray<double> mycutsMl(cutValues.data(),1,1,std::vector<std::string>{"pT bin 0"},std::vector<std::string>{"score"});
388+
o2::framework::LabeledArray<double> mycutsMl(cutValues.data(), 1, 1, std::vector<std::string>{"pT bin 0"}, std::vector<std::string>{"score"});
386389
matchingMlResponse.configure(binsPtMl, mycutsMl, cutDirMl, 1);
387390
matchingMlResponse.setModelPathsCCDB(fConfigVariousOptions.fModelNames.value, fCCDBApi, fConfigVariousOptions.fModelPathsCCDB.value, fConfigCCDB.timestamp.value);
388391
matchingMlResponse.cacheInputFeaturesIndices(fConfigVariousOptions.fInputFeatures.value);
389392
matchingMlResponse.init();
390393
}
391-
392394
}
393395

394396
void DefineCuts()
@@ -907,12 +909,12 @@ struct TableMakerMC {
907909
if (static_cast<int>(muon.trackType()) < 2) {
908910
auto muonID = muon.matchMCHTrackId();
909911
auto chi2 = muon.chi2MatchMCHMFT();
910-
if (fConfigVariousOptions.fUseML.value){
911-
std::vector<float> output;
912-
std::vector<float> inputML = matchingMlResponse.getInputFeaturesTest(muon);
913-
matchingMlResponse.isSelectedMl(inputML, 0, output);
914-
chi2 = output[0];
915-
}
912+
if (fConfigVariousOptions.fUseML.value) {
913+
std::vector<float> output;
914+
std::vector<float> inputML = matchingMlResponse.getInputFeaturesTest(muon);
915+
matchingMlResponse.isSelectedMl(inputML, 0, output);
916+
chi2 = output[0];
917+
}
916918
if (mCandidates.find(muonID) == mCandidates.end()) {
917919
mCandidates[muonID] = {chi2, muon.globalIndex()};
918920
} else {

0 commit comments

Comments
 (0)