Skip to content

Commit 81a4ac6

Browse files
committed
Please consider the following formatting changes
1 parent c489072 commit 81a4ac6

1 file changed

Lines changed: 83 additions & 83 deletions

File tree

PWGCF/MultiparticleCorrelations/Tasks/multiharmonic-correlations.cxx

Lines changed: 83 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@ using TrackSim = aod::McParticles::iterator;
4343
// ...
4444

4545
// *) ROOT and C++ include's:
46-
#include <iostream>
47-
#include <cstring>
48-
#include <TH1D.h>
4946
#include <TGrid.h>
47+
#include <TH1D.h>
5048
#include <TSystem.h>
49+
50+
#include <cstring>
51+
#include <iostream>
5152
// ...
5253

5354
using namespace std;
@@ -65,7 +66,6 @@ enum eProcess {
6566
eProcess_N
6667
};
6768

68-
6969
enum eEventHistograms {
7070
eVertexZ = 0,
7171
ePt,
@@ -106,14 +106,14 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
106106
struct TaskConfiguration {
107107
bool fProcess[eProcess_N] = {false}; // Set what to process. See enum eProcess for full description. Set via implicit variables within a PROCESS_SWITCH clause.
108108
bool fDryRun = false; // book all histos and run without filling and calculating anything
109-
} tc; // you have to prepend "tc." for all objects name in this group later in the code
109+
} tc; // you have to prepend "tc." for all objects name in this group later in the code
110110

111111
// **) Particle histograms:
112112
struct ParticleHistograms {
113113
TList* fParticleHistogramsList = NULL; //!<! list to hold all control particle histograms
114114
TH1F* fHistPt[2] = {NULL}; // pt distribution of a particle [ 0 = rec, 1 = sim ]
115115
TH1F* fHistPhi[2] = {NULL};
116-
TH1F* histWeights=NULL;
116+
TH1F* histWeights = NULL;
117117
} pc; // you have to prepend "pc." for all objects name in this group later in the code
118118

119119
struct EventHistograms {
@@ -129,46 +129,47 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
129129

130130
TObject* GetObjectFromList(TList* list, const char* objectName)
131131
{
132-
// Get TObject pointer from TList, even if it's in some nested TList. Foreseen
133-
// to be used to fetch histograms or profiles from files directly.
134-
// Some ideas taken from TCollection::ls()
135-
// If you have added histograms directly to files (without TList's), then you can fetch them directly with
136-
// file->Get("hist-name").
137-
138-
// Usage: TH1D *hist = (TH1D*) GetObjectFromList("some-valid-TList-pointer","some-object-name");
132+
// Get TObject pointer from TList, even if it's in some nested TList. Foreseen
133+
// to be used to fetch histograms or profiles from files directly.
134+
// Some ideas taken from TCollection::ls()
135+
// If you have added histograms directly to files (without TList's), then you can fetch them directly with
136+
// file->Get("hist-name").
139137

140-
// Insanity checks:
141-
if (!list) {
142-
LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__);
143-
}
144-
if (!objectName) {
145-
LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__);
146-
}
147-
if (0 == list->GetEntries()) {
148-
return NULL;
149-
}
138+
// Usage: TH1D *hist = (TH1D*) GetObjectFromList("some-valid-TList-pointer","some-object-name");
150139

151-
// The object is in the current base list:
152-
TObject* objectFinal = list->FindObject(objectName); // the final object I am after
153-
if (objectFinal ) { return objectFinal; }
140+
// Insanity checks:
141+
if (!list) {
142+
LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__);
143+
}
144+
if (!objectName) {
145+
LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__);
146+
}
147+
if (0 == list->GetEntries()) {
148+
return NULL;
149+
}
154150

155-
//Otherwise, search for the object recursively in the nested lists:
156-
TObject* objectIter; // iterator object in the loop below
157-
TIter next(list);
158-
while ((objectIter = next())) // double round braces are to silence the warnings
159-
{
160-
if (TString(objectIter->ClassName()).EqualTo("TList")) {
161-
objectFinal = GetObjectFromList(reinterpret_cast<TList*>(objectIter), objectName);
162-
if (objectFinal)
163-
return objectFinal;
151+
// The object is in the current base list:
152+
TObject* objectFinal = list->FindObject(objectName); // the final object I am after
153+
if (objectFinal) {
154+
return objectFinal;
164155
}
165-
} // while(objectIter = next())
166156

167-
return NULL;
157+
// Otherwise, search for the object recursively in the nested lists:
158+
TObject* objectIter; // iterator object in the loop below
159+
TIter next(list);
160+
while ((objectIter = next())) // double round braces are to silence the warnings
161+
{
162+
if (TString(objectIter->ClassName()).EqualTo("TList")) {
163+
objectFinal = GetObjectFromList(reinterpret_cast<TList*>(objectIter), objectName);
164+
if (objectFinal)
165+
return objectFinal;
166+
}
167+
} // while(objectIter = next())
168+
169+
return NULL;
168170

169171
} // TObject* GetObjectFromList(TList *list, char *objectName)
170172

171-
172173
TH1F* GetHistogramWithWeights(const char* filePath, const char* runNumber)
173174
{
174175
// *) Return value:
@@ -183,14 +184,13 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
183184
bool bFileIsInAliEn = false;
184185
bool bFileIsInCCDB = false;
185186

186-
string pathstr=filePath;
187-
const string pathalien="/alice/cern.ch/";
188-
const string pathccdb="/alice-ccdb.cern.ch/";
189-
if(pathstr.find(pathalien)==0){
190-
bFileIsInAliEn=true;
191-
}
192-
else if(pathstr.find(pathccdb)==0){
193-
bFileIsInCCDB=true;
187+
string pathstr = filePath;
188+
const string pathalien = "/alice/cern.ch/";
189+
const string pathccdb = "/alice-ccdb.cern.ch/";
190+
if (pathstr.find(pathalien) == 0) {
191+
bFileIsInAliEn = true;
192+
} else if (pathstr.find(pathccdb) == 0) {
193+
bFileIsInCCDB = true;
194194
}
195195

196196
if (bFileIsInAliEn) {
@@ -220,17 +220,17 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
220220
}
221221
}
222222

223-
} else if (bFileIsInCCDB) {
224-
// File you want to access is in your home dir in CCDB:
225-
// Remember that here I do not access the file; instead, I directly access the object in that file.
226-
ccdb->setURL("http://alice-ccdb.cern.ch"); // to be able to use "ccdb" this object in your analysis task, see 4b/ below
227-
baseList = reinterpret_cast<TList*>(ccdb->get<TList>(TString(filePath).ReplaceAll("/alice-ccdb.cern.ch/", "").Data()));
228-
if (!baseList) {
229-
LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__);
230-
}
231-
232-
listWithRuns = reinterpret_cast<TList*>(GetObjectFromList(baseList, runNumber));
233-
if (!listWithRuns) {
223+
} else if (bFileIsInCCDB) {
224+
// File you want to access is in your home dir in CCDB:
225+
// Remember that here I do not access the file; instead, I directly access the object in that file.
226+
ccdb->setURL("http://alice-ccdb.cern.ch"); // to be able to use "ccdb" this object in your analysis task, see 4b/ below
227+
baseList = reinterpret_cast<TList*>(ccdb->get<TList>(TString(filePath).ReplaceAll("/alice-ccdb.cern.ch/", "").Data()));
228+
if (!baseList) {
229+
LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__);
230+
}
231+
232+
listWithRuns = reinterpret_cast<TList*>(GetObjectFromList(baseList, runNumber));
233+
if (!listWithRuns) {
234234
TString runNumberWithLeadingZeroes = "000";
235235
runNumberWithLeadingZeroes += runNumber; // another try, with "000" prepended to run number
236236
listWithRuns = reinterpret_cast<TList*>(GetObjectFromList(baseList, runNumberWithLeadingZeroes.Data()));
@@ -241,25 +241,25 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
241241

242242
// OK, we got the desired TList with efficiency corrections, after that we can use the common code for all 3 cases (local, AliEn, CCDB, that common code is below)
243243

244-
} else{
245-
// this is the local case:
246-
// Check if the external ROOT file exists at the specified path:
247-
if (gSystem->AccessPathName(filePath, kFileExists)) {
248-
LOGF(info, "\033[1;33m if(gSystem->AccessPathName(filePath,kFileExists)), filePath = %s \033[0m", filePath);
249-
LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__);
250-
}
244+
} else {
245+
// this is the local case:
246+
// Check if the external ROOT file exists at the specified path:
247+
if (gSystem->AccessPathName(filePath, kFileExists)) {
248+
LOGF(info, "\033[1;33m if(gSystem->AccessPathName(filePath,kFileExists)), filePath = %s \033[0m", filePath);
249+
LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__);
250+
}
251251

252-
TFile* weightsFile = TFile::Open(filePath, "READ");
253-
if (!weightsFile) {
254-
LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__);
255-
}
252+
TFile* weightsFile = TFile::Open(filePath, "READ");
253+
if (!weightsFile) {
254+
LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__);
255+
}
256256

257-
weightsFile->GetObject("ccdb_object", baseList);
257+
weightsFile->GetObject("ccdb_object", baseList);
258258

259-
if (!baseList) {
259+
if (!baseList) {
260260
// weightsFile->ls();
261261
LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__);
262-
}
262+
}
263263

264264
listWithRuns = reinterpret_cast<TList*>(GetObjectFromList(baseList, runNumber));
265265
if (!listWithRuns) {
@@ -268,28 +268,28 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
268268
listWithRuns = reinterpret_cast<TList*>(GetObjectFromList(baseList, runNumberWithLeadingZeroes.Data()));
269269
if (!listWithRuns) {
270270
// baseList->ls();
271-
LOGF(fatal, "\033[1;31m%s at line %d : this crash can happen if in the output file there is no list with weights for the current run number = %s\033[0m", __FUNCTION__, __LINE__ /*, tc.fRunNumber.Data()*/ );
271+
LOGF(fatal, "\033[1;31m%s at line %d : this crash can happen if in the output file there is no list with weights for the current run number = %s\033[0m", __FUNCTION__, __LINE__ /*, tc.fRunNumber.Data()*/);
272272
}
273273
}
274274

275275
} // end of else
276276

277277
// Here comes the common code for all three cases, where from "listWithRuns" you fetch the desired histogram with efficiency corrections:
278-
listWithRuns->ls();
278+
listWithRuns->ls();
279279

280-
hist= (TH1F*) listWithRuns->FindObject("histWithEfficiencyCorrections");
281-
if(!hist){
280+
hist = (TH1F*)listWithRuns->FindObject("histWithEfficiencyCorrections");
281+
if (!hist) {
282282
LOGF(fatal, "no histweight");
283283
}
284284

285-
// Once you have a valid pointer to "hist", add these technical lines:
286-
hist->SetDirectory(0); // remove ownerhip from an external file
287-
TH1F* histClone = reinterpret_cast<TH1F*>(hist->Clone()); // yes, I have to clone here
288-
delete baseList; // release back the memory
285+
// Once you have a valid pointer to "hist", add these technical lines:
286+
hist->SetDirectory(0); // remove ownerhip from an external file
287+
TH1F* histClone = reinterpret_cast<TH1F*>(hist->Clone()); // yes, I have to clone here
288+
delete baseList; // release back the memory
289289

290-
return histClone;
290+
return histClone;
291291

292-
} // end of TH1F* GetHistogramWithWeights(const char* filePath, const char* runNumber) {
292+
} // end of TH1F* GetHistogramWithWeights(const char* filePath, const char* runNumber) {
293293

294294
// ...
295295

@@ -387,7 +387,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
387387

388388
// Print track azimuthal angle:
389389
// LOGF(info, "Track azimuthal angle: %f", track.phi());
390-
//pc.histWeights=GetHistogramWithWeights(cfFileWithWeights.value.c_str(), "000123456");
390+
// pc.histWeights=GetHistogramWithWeights(cfFileWithWeights.value.c_str(), "000123456");
391391

392392
// Fill reconstructed ...:
393393
float ptrec = 0., ptsim = 0.;
@@ -501,7 +501,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
501501
pc.fHistPhi[eSim]->GetXaxis()->SetTitle("phi");
502502
pc.fParticleHistogramsList->Add(pc.fHistPhi[eSim]);
503503

504-
pc.histWeights=GetHistogramWithWeights(cfFileWithWeights.value.c_str(), "000123456");
504+
pc.histWeights = GetHistogramWithWeights(cfFileWithWeights.value.c_str(), "000123456");
505505
pc.fParticleHistogramsList->Add(pc.histWeights);
506506

507507
event.fHistCentr[eRec] = new TH1F("fHistCentr[eRec]", "centrality distribution for reconstructed particles", nBinscentr, mincentr, maxcentr);

0 commit comments

Comments
 (0)