//
#include "AliSelector.h"
+
#include <TStyle.h>
#include <TSystem.h>
#include <TCanvas.h>
#include <TRegexp.h>
+#include <TTime.h>
-#include <TFriendElement.h>
-
-#include <iostream>
-using namespace std;
+#include <AliLog.h>
ClassImp(AliSelector)
Init(tree);
- printf("=======SLAVEBEGIN========\n");
- gSystem->Exec("hostname");
- gSystem->Exec("date");
+ AliDebug(AliLog::kDebug, "=======SLAVEBEGIN========");
+ AliDebug(AliLog::kDebug, Form("Hostname: %s", gSystem->HostName()));
+ AliDebug(AliLog::kDebug, Form("Time: %s", gSystem->Now().AsString()));
TFile *f = fChain->GetCurrentFile();
- printf("%s\n",f->GetName());
+ AliDebug(AliLog::kDebug, f->GetName());
TString option = GetOption();
}
// generated code, but the routine can be extended by the user if needed.
// Init() will be called many times when running with PROOF.
- printf("=========Init==========\n");
+ AliDebug(AliLog::kDebug, "=========Init==========");
// Set branch addresses
if (tree == 0)
{
- printf("ERROR: tree argument is 0.\n");
+ AliDebug(AliLog::kError, "ERROR: tree argument is 0.");
return;
}
fChain = dynamic_cast<TChain*> (tree);
if (fChain == 0)
{
- printf("ERROR: tree argument could not be casted to TChain.\n");
+ AliDebug(AliLog::kDebug, "ERROR: tree argument could not be casted to TChain.");
return;
}
fChain->SetBranchAddress("ESD", &fESD);
if (fESD != 0)
- printf("INFO: Found ESD branch in chain.\n");
+ AliDebug(AliLog::kInfo, "INFO: Found ESD branch in chain.");
fChain->SetBranchAddress("Header", &fHeader);
if (fHeader != 0)
- printf("INFO: Found event header branch in chain.\n");
-
+ AliDebug(AliLog::kInfo, "INFO: Found event header branch in chain.");
}
Bool_t AliSelector::Notify()
// to the generated code, but the routine can be extended by the
// user if needed.
- printf("=========NOTIFY==========\n");
- gSystem->Exec("hostname");
- gSystem->Exec("date");
+ AliDebug(AliLog::kDebug, "=========NOTIFY==========");
+ AliDebug(AliLog::kDebug, Form("Hostname: %s", gSystem->HostName()));
+ AliDebug(AliLog::kDebug, Form("Time: %s", gSystem->Now().AsString()));
+
TFile *f = fChain->GetCurrentFile();
- TString fileName(f->GetName());
- printf("%s\n",fileName.Data());
+ AliDebug(AliLog::kDebug, f->GetName());
DeleteKinematicsFile();
DeleteRunLoader();
// Assuming that fChain is the pointer to the TChain being processed,
// use fChain->GetTree()->GetEntry(entry).
- printf("=========PROCESS========== Entry %lld\n", entry);
+ AliDebug(AliLog::kDebug, Form("=========PROCESS========== Entry %lld", entry));
if (!fChain)
{
- printf("ERROR: fChain is 0.\n");
+ AliDebug(AliLog::kError, "ERROR: fChain is 0.");
return kFALSE;
}
fChain->GetTree()->GetEntry(entry);
if (fESD)
- printf("ESD: We have %d tracks.\n", fESD->GetNumberOfTracks());
+ AliDebug(AliLog::kDebug, Form("ESD: We have %d tracks.", fESD->GetNumberOfTracks()));
if (fHeader)
- printf("Header: We have %d primaries.\n", fHeader->GetNprimary());
+ AliDebug(AliLog::kDebug, Form("Header: We have %d primaries.", fHeader->GetNprimary()));
TTree* kinematics = GetKinematics();
if (kinematics)
- printf("Kinematics from folder: We have %lld particles.\n", kinematics->GetEntries());
-
- printf("\n");
+ AliDebug(AliLog::kDebug, Form("Kinematics: We have %lld particles.", kinematics->GetEntries()));
return kTRUE;
}
// a query. It always runs on the client, it can be used to present
// the results graphically or save the results to file.
- printf("=========TERMINATE==========\n");
+ AliDebug(AliLog::kDebug, "=========TERMINATE==========");
}
TTree* AliSelector::GetKinematics()
//
// deletes the runloader
//
-
+
if (fRunLoader)
{
fRunLoader->Delete();
fRunLoader = 0;
}
}
+
}
if (!fEsdTrackCuts)
- printf("ERROR: Could not read EsdTrackCuts from user info\n");
+ AliDebug(AliLog::kError, "ERROR: Could not read EsdTrackCuts from user info.");
if (!fEsdTrackCuts)
- printf("ERROR: Could not read dNdEtaCorrection from user info\n");
+ AliDebug(AliLog::kError, "ERROR: Could not read dNdEtaCorrection from user info.");
AliLog::SetClassDebugLevel("AliESDtrackCuts", 1);
}
AliESDtrack* esdTrack = fESD->GetTrack(t);
if (!esdTrack)
{
- printf("ERROR: Could not retrieve track %d.\n", t);
+ AliDebug(AliLog::kError, Form("ERROR: Could not retrieve track %d.", t));
continue;
}
// Add the histograms to the output on each slave server
if (!fOutput)
{
- printf("ERROR: Output list not initialized\n");
+ AliDebug(AliLog::kError, Form("ERROR: Output list not initialized."));
return;
}
if (!etaVsVtxHistogram || !vtxHistogram || !etaVsVtxUncorrectedHistogram)
{
- printf("ERROR: Histograms not available %p %p %p\n", (void*) etaVsVtxHistogram, (void*) etaVsVtxUncorrectedHistogram, (void*) vtxHistogram);
+ AliDebug(AliLog::kError, Form("ERROR: Histograms not available %p %p %p", (void*) etaVsVtxHistogram, (void*) etaVsVtxUncorrectedHistogram, (void*) vtxHistogram));
return;
}
fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fChain->GetUserInfo()->FindObject("AliESDtrackCuts"));
if (!fEsdTrackCuts)
- printf("ERROR: Could not read EsdTrackCuts from user info\n");
-
- AliLog::SetClassDebugLevel("ESDtrackQualityCuts",1);
+ AliDebug(AliLog::kError, "ERROR: Could not read EsdTrackCuts from user info");
}
Bool_t AlidNdEtaCorrectionSelector::Notify()
if (AliSelector::Process(entry) == kFALSE)
return kFALSE;
- if (!fESD || !fHeader)
+ // check prerequesites
+ if (!fESD)
+ {
+ AliDebug(AliLog::kError, "ESD branch not available");
+ return kFALSE;
+ }
+
+ if (!fHeader)
+ {
+ AliDebug(AliLog::kError, "Header branch not available");
+ return kFALSE;
+ }
+
+ if (!fEsdTrackCuts)
+ {
+ AliDebug(AliLog::kError, "fESDTrackCuts not available");
return kFALSE;
+ }
// ########################################################
// get the EDS vertex
if (strcmp(particle->GetName(),"XXX") == 0)
{
- printf("WARNING: There is a particle named XXX (%d).\n", i_mc);
+ AliDebug(AliLog::kWarning, Form("WARNING: There is a particle named XXX (%d).", i_mc));
continue;
}
if (strcmp(pdgPart->ParticleClass(),"Unknown") == 0)
{
- printf("WARNING: There is a particle with an unknown particle class (%d pdg code %d).\n", i_mc, particle->GetPdgCode());
+ AliDebug(AliLog::kError, Form("WARNING: There is a particle with an unknown particle class (%d pdg code %d).", i_mc, particle->GetPdgCode()));
continue;
}
Int_t label = TMath::Abs(esdTrack->GetLabel());
if (label == 0)
{
- printf("WARNING: cannot find corresponding mc part for track %d.", t);
+ AliDebug(AliLog::kWarning, Form("WARNING: cannot find corresponding mc part for track %d.", t));
continue;
}
particleTree->GetEntry(nTotal - nPrim + label);
// Add the histograms to the output on each slave server
if (!fOutput)
{
- printf("ERROR: Output list not initialized\n");
+ AliDebug(AliLog::kError, "ERROR: Output list not initialized");
return;
}
TH2F* generatedHistogram = dynamic_cast<TH2F*> (fOutput->FindObject("etaVsVtx_gene"));
if (!measuredHistogram || !generatedHistogram)
{
- printf("ERROR: Histograms not available %p %p\n", (void*) generatedHistogram, (void*) measuredHistogram);
+ AliDebug(AliLog::kError, Form("ERROR: Histograms not available %p %p", (void*) generatedHistogram, (void*) measuredHistogram));
return;
}
fdNdEtaCorrectionFinal->SetGeneratedHistogram(generatedHistogram);