Skip to content

Commit 0207f12

Browse files
authored
Merge pull request #41 from alibuild/alibot-cleanup-13744
[PWGLF] Please consider the following formatting changes to #13744
2 parents 508938f + 16b3d76 commit 0207f12

File tree

5 files changed

+57
-65
lines changed

5 files changed

+57
-65
lines changed

PWGLF/Tasks/Resonances/phitutorial.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct phitutorial {
5757
histos.add("Nch_pT", "Nch_pT", kTH1F, {ptAxis});
5858
histos.add("Nch_USS_Minv", "Nch_USS_Minv", kTH1F, {MinvAxis});
5959
histos.add("Nch_LSS_Minv", "Nch_LSS_Minv", kTH1F, {MinvAxis});
60-
60+
6161
histos.add("Nch_ME_Minv", "Nch_ME_Minv", kTH1F, {MinvAxis});
6262

6363
}; // end of init

PWGLF/Tasks/Resonances/phitutorial_step0.cxx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,22 @@ struct phitutorial_step0 {
7171
template <typename EventType>
7272
bool eventSelection(const EventType event)
7373
{
74-
if (!event.sel8()) //This is required to extract good events
74+
if (!event.sel8()) // This is required to extract good events
7575
return false;
76-
76+
7777
return true;
7878
};
7979
//********************************************//
80-
//Space for more helper functions!
81-
80+
// Space for more helper functions!
8281

8382
//********************************************//
8483
// HELPER FCNS COMPLETE, NOW WE DO PROCESS FCNS
8584
//********************************************//
8685

8786
// SAME EVENT
8887
int nEvents = 0;
89-
void processDataSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks){
88+
void processDataSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks)
89+
{
9090
nEvents++;
9191
if ((nEvents + 1) % 10000 == 0) {
9292
std::cout << "Processed Data Events: " << nEvents << std::endl;
@@ -99,16 +99,16 @@ struct phitutorial_step0 {
9999
// Keep in mind that:
100100
// M_inv = sqrt( (E1+E2)^2 - |P1 + P2|^2 )
101101
// Where you use the energies and momenta of the individual Kaons.
102-
102+
103103
// You should fill: histos.fill(HIST("Minv"), M_inv), calculated as above.
104-
105-
//Usefull tips:
106-
// E = sqrt(p^2 + m^2). The Kaon mass is found above in the constant massKa
107-
// pz = pT*sinh(eta)
108-
// track.pt()
109-
// track.eta();
110-
// std::sinh(x)
111-
104+
105+
// Usefull tips:
106+
// E = sqrt(p^2 + m^2). The Kaon mass is found above in the constant massKa
107+
// pz = pT*sinh(eta)
108+
// track.pt()
109+
// track.eta();
110+
// std::sinh(x)
111+
112112
// For more concise techinques, check out:
113113
// ROOT::Math::PxPyPzMVector //Check google
114114
// combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy.... //check ALICE O2 documentation
@@ -120,14 +120,12 @@ struct phitutorial_step0 {
120120
//..
121121
}
122122

123-
124123
} // proccessSameEvent
125124
PROCESS_SWITCH(phitutorial_step0, processDataSameEvent, "process Data Same Event", false);
126125

127-
//***************************************//
128-
// TASK COMPLETE!
129-
//**************************************//
130-
126+
//***************************************//
127+
// TASK COMPLETE!
128+
//**************************************//
131129
};
132130
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
133131
{

PWGLF/Tasks/Resonances/phitutorial_step1.cxx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,13 @@ struct phitutorial_step1 {
7272
template <typename EventType>
7373
bool eventSelection(const EventType event)
7474
{
75-
if (!event.sel8()) //This is required to extract good events
75+
if (!event.sel8()) // This is required to extract good events
7676
return false;
77-
77+
7878
return true;
7979
};
8080
//********************************************//
81-
//Space for more helper functions!
82-
81+
// Space for more helper functions!
8382

8483
//********************************************//
8584
// HELPER FCNS COMPLETE, NOW WE DO PROCESS FCNS
@@ -102,14 +101,14 @@ struct phitutorial_step1 {
102101
// track.isGlobalTrack() <.... this menas that it is a good track
103102
// track.pt() >0.15 <.... we want to remove really low momentum tracks
104103
// -0.8<track.eta()<0.8 <.... the TPC efficiency drops really hard at the edges
105-
104+
106105
// We can either create a template function (see eventSelection above for reference) that accepts tracks instead of collisions.
107106
// We can also directly implement the track cuts on the track iterators (track, trk1, trk2) themselves.
108107
// We can also set a filter around the subscribed table. Then before the process function, you would have to modify:
109108
// Filter pT Filter = track::pt > 0.15f;
110109
// then you have to modify the subscription
111110
// soa::Filtered<TrackCandidates> const& tracks
112-
111+
113112
for (const auto& track : tracks) {
114113
histos.fill(HIST("Nch_pT"), track.pt());
115114
}
@@ -130,10 +129,9 @@ struct phitutorial_step1 {
130129
} // proccessSameEvent
131130
PROCESS_SWITCH(phitutorial_step1, processDataSameEvent, "process Data Same Event", false);
132131

133-
//***************************************//
134-
// TASK COMPLETE!
135-
//**************************************//
136-
132+
//***************************************//
133+
// TASK COMPLETE!
134+
//**************************************//
137135
};
138136
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
139137
{

PWGLF/Tasks/Resonances/phitutorial_step2.cxx

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ struct phitutorial_step2 {
7272
template <typename EventType>
7373
bool eventSelection(const EventType event)
7474
{
75-
if (!event.sel8()) //This is required to extract good events
75+
if (!event.sel8()) // This is required to extract good events
7676
return false;
77-
77+
7878
return true;
7979
};
8080
//********************************************//
@@ -89,9 +89,9 @@ struct phitutorial_step2 {
8989
return false;
9090

9191
return true;
92-
};
93-
//Space for more helper functions!
94-
//********************************************//
92+
};
93+
// Space for more helper functions!
94+
//********************************************//
9595

9696
//********************************************//
9797
// HELPER FCNS COMPLETE, NOW WE DO PROCESS FCNS
@@ -112,20 +112,19 @@ struct phitutorial_step2 {
112112
// Now, we want to add some PID to ensure that we are with a higher likelhood pairing Kaons.
113113
// Three ways to do this:
114114
// 1.) Directly cut on the tracks in the looping functions (not recommended)
115-
115+
116116
// 2.) Create a helper function above similar to trackSelection
117-
117+
118118
// 3.) Partition your tracks with a preselection by adding this outside of your process function:
119119
// Partition<TrackCandidates> kaon (nabs(aod::pidtpc::tpcNSigmaKa) <= X); // X is a cfg value or a hardcoded integer.
120120
// Then inside the function: auto tracks1 = kaon->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); Do the same for tracks2.
121121

122+
// Getters for PID:
123+
// tracks.tpcNSigmaKa()
124+
// tracks.tofNSigmaKa()
125+
// Good starting value for the selected nsigma value is "3".
126+
// You might not want to have a STRICT TOF cut, a lot of tracks with good TPC PID does not have TOF information. You can make a conditional cut on TOF by only implementing the TOF cut if track.hasTOF() returns TRUE.
122127

123-
//Getters for PID:
124-
// tracks.tpcNSigmaKa()
125-
// tracks.tofNSigmaKa()
126-
// Good starting value for the selected nsigma value is "3".
127-
// You might not want to have a STRICT TOF cut, a lot of tracks with good TPC PID does not have TOF information. You can make a conditional cut on TOF by only implementing the TOF cut if track.hasTOF() returns TRUE.
128-
129128
for (const auto& track : tracks) {
130129
if (!trackSelection(track)) {
131130
continue;
@@ -151,10 +150,9 @@ struct phitutorial_step2 {
151150
} // proccessSameEvent
152151
PROCESS_SWITCH(phitutorial_step2, processDataSameEvent, "process Data Same Event", false);
153152

154-
//***************************************//
155-
// TASK COMPLETE!
156-
//**************************************//
157-
153+
//***************************************//
154+
// TASK COMPLETE!
155+
//**************************************//
158156
};
159157
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
160158
{

PWGLF/Tasks/Resonances/phitutorial_step3.cxx

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ struct phitutorial_step3 {
5858
histos.add("Nch_USS_Minv", "Nch_USS_Minv", kTH1F, {MinvAxis});
5959

6060
histos.add("Nch_LSS_Minv", "Nch_LSS_Minv", kTH1F, {MinvAxis});
61-
62-
histos.add("Nch_ME_Minv", "Nch_ME_Minv", kTH1F, {MinvAxis});
6361

62+
histos.add("Nch_ME_Minv", "Nch_ME_Minv", kTH1F, {MinvAxis});
6463

6564
}; // end of init
6665

@@ -77,9 +76,9 @@ struct phitutorial_step3 {
7776
template <typename EventType>
7877
bool eventSelection(const EventType event)
7978
{
80-
if (!event.sel8()) //This is required to extract good events
79+
if (!event.sel8()) // This is required to extract good events
8180
return false;
82-
81+
8382
return true;
8483
};
8584
//********************************************//
@@ -96,7 +95,7 @@ struct phitutorial_step3 {
9695
return true;
9796
};
9897

99-
//********************************************//
98+
//********************************************//
10099

101100
template <typename TrackPID>
102101
bool trackPIDKaon(const TrackPID& candidate)
@@ -136,11 +135,11 @@ struct phitutorial_step3 {
136135
if (!eventSelection(collision))
137136
return;
138137

139-
//Last step, we want to remove the cominbatorial background to get a clean peak. We want to fill our new two booked historams, Nch_LSS_Minv and Nch_ME_Minv
138+
// Last step, we want to remove the cominbatorial background to get a clean peak. We want to fill our new two booked historams, Nch_LSS_Minv and Nch_ME_Minv
139+
140+
// LSS is easy, you simply need to fill the histogram if the conjugate argument below is NOT true.
141+
// For event mixing, we have to now copy our logic into a new process function below, and iterate over track pairs between different events!
140142

141-
//LSS is easy, you simply need to fill the histogram if the conjugate argument below is NOT true.
142-
// For event mixing, we have to now copy our logic into a new process function below, and iterate over track pairs between different events!
143-
144143
for (const auto& track : tracks) {
145144
if (!trackSelection(track)) {
146145
continue;
@@ -178,32 +177,31 @@ struct phitutorial_step3 {
178177
// DEFINITION OF SLICE CACHE, BINNING AND MIXING STRUCTURE
179178
//*********************************************************//
180179
Preslice<aod::Tracks> perCollision = aod::track::collisionId;
181-
//We ensure here that we mix events that have relatively similar characteristics.
180+
// We ensure here that we mix events that have relatively similar characteristics.
182181
std::vector<double> zBins{10, -10, 10};
183182
std::vector<double> multBins{VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1};
184183
using BinningType = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0M>;
185184
BinningType binning{{zBins, multBins}, true};
186185
SameKindPair<EventCandidates, TrackCandidates, BinningType> pair{binning, 5, -1, &cache};
187186

188-
void processDataMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks)//notice the collisions subscrition, it is not an iterator here!
187+
void processDataMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks) // notice the collisions subscrition, it is not an iterator here!
189188
{
190-
189+
191190
for (const auto& [c1, tracks1, c2, tracks2] : pair) {
192191

193192
if (!eventSelection(c1) || !eventSelection(c2))
194193
continue;
195-
//Fill your event mixing logic here.
194+
// Fill your event mixing logic here.
196195
//..
197196
//..
198197
//..
199-
} //pairs
198+
} // pairs
200199
} // processMixedEvent
201200
PROCESS_SWITCH(phitutorial_step3, processDataMixedEvent, "process Data Mixed Event", false);
202-
203-
//***************************************//
204-
// TASK COMPLETE!
205-
//**************************************//
206201

202+
//***************************************//
203+
// TASK COMPLETE!
204+
//**************************************//
207205
};
208206
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
209207
{

0 commit comments

Comments
 (0)