//
#include <TH3F.h>
+#include <TH1F.h>
#include <AliLog.h>
if (GetGeneratedHistogram() && GetMeasuredHistogram())
AliPWG0Helper::CreateDividedProjections(GetGeneratedHistogram(), GetMeasuredHistogram());
}
+
+//____________________________________________________________________
+Int_t AliCorrectionMatrix3D::CheckEmptyBins(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax, Bool_t quiet)
+{
+ //
+ // counts the number of empty Bins in a given region
+ //
+
+ TH3F* hist = GetGeneratedHistogram();
+ if (!hist)
+ return -1;
+
+ Int_t emptyBins = 0;
+ for (Int_t x=hist->GetXaxis()->FindBin(xmin); x<=hist->GetXaxis()->FindBin(xmax); ++x)
+ for (Int_t y=hist->GetYaxis()->FindBin(ymin); y<=hist->GetYaxis()->FindBin(ymax); ++y)
+ for (Int_t z=hist->GetZaxis()->FindBin(zmin); z<=hist->GetZaxis()->FindBin(zmax); ++z)
+ if (hist->GetBinContent(x, y, z) == 0)
+ {
+ if (!quiet)
+ printf("Empty bin in %s at vtx = %f, eta = %f, pt = %f\n", GetName(), hist->GetXaxis()->GetBinCenter(x), hist->GetYaxis()->GetBinCenter(y), hist->GetZaxis()->GetBinCenter(z));
+ ++emptyBins;
+ }
+
+ return emptyBins;
+}
+
+//____________________________________________________________________
+TH1F* AliCorrectionMatrix3D::PlotBinErrors(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax)
+{
+ //
+ // makes a 1d plots of the relative bin errors
+ //
+
+ TH3F* hist = GetCorrectionHistogram();
+ if (!hist)
+ return 0;
+
+ TH1F* target = new TH1F("relerrors", "relerrors", 100, 0, 10);
+
+ for (Int_t x=hist->GetXaxis()->FindBin(xmin); x<=hist->GetXaxis()->FindBin(xmax); ++x)
+ for (Int_t y=hist->GetYaxis()->FindBin(ymin); y<=hist->GetYaxis()->FindBin(ymax); ++y)
+ for (Int_t z=hist->GetZaxis()->FindBin(zmin); z<=hist->GetZaxis()->FindBin(zmax); ++z)
+ if (hist->GetBinContent(x, y, z) != 0)
+ target->Fill(100 * hist->GetBinError(x, y, z) / hist->GetBinContent(x, y, z));
+
+ return target;
+}
+
#include <AliCorrectionMatrix.h>
class TH3F;
+class TH1F;
class AliCorrectionMatrix3D : public AliCorrectionMatrix
{
virtual void SaveHistograms();
+ Int_t CheckEmptyBins(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax, Bool_t quiet = kFALSE);
+ TH1F* PlotBinErrors(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax);
+
+
protected:
ClassDef(AliCorrectionMatrix3D,1)
};
/* $Id$ */
-// Helper macros for creating chains
-
-TChain* CreateESDChain(const char* aDataDir = "ESDfiles.txt", Int_t aRuns = 20, Int_t offset = 0)
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+// This helper macros creates a chain of ESD files for you. Source can be either a text
+// file with the file paths or a directory. In the latter case all ESD files in all subdirectories
+// are considered.
+//
+// Author: Jan.Fiete.Grosse-Oetringhaus@cern.ch
+
+TChain* CreateESDChain(const char* aDataDir = "ESDfiles.txt", Int_t aRuns = 20, Int_t offset = 0, Bool_t addFileName = kFALSE, Bool_t addFriend = kFALSE, Bool_t check = kFALSE)
{
// creates chain of files in a given directory or file containing a list.
// In case of directory the structure is expected as:
// <aDataDir>/<dir0>/AliESDs.root
// <aDataDir>/<dir1>/AliESDs.root
// ...
+ //
+ // if addFileName is true the list only needs to contain the directories that contain the AliESDs.root files
+ // if addFriend is true a file AliESDfriends.root is expected in the same directory and added to the chain as friend
if (!aDataDir)
return 0;
}
TChain* chain = new TChain("esdTree");
- TChain* chaingAlice = 0;
+ TChain* chainFriend = 0;
+
+ if (addFriend)
+ chainFriend = new TChain("esdFriendTree");
if (flags & 2)
{
Int_t count = 0;
// Read the input list of files and add them to the chain
- TString esdfile;
- while(in.good()) {
- in >> esdfile;
- if (!esdfile.Contains("root")) continue; // protection
-
+ TString line;
+ while(in.good())
+ {
+ in >> line;
+
+ if (line.Length() == 0)
+ continue;
+
if (offset > 0)
{
--offset;
if (count++ == aRuns)
break;
+ TString esdFile(line);
+
+ if (addFileName)
+ esdFile += "/AliESDs.root";
+
+ TString esdFileFriend(esdFile);
+ esdFileFriend.ReplaceAll("AliESDs.root", "AliESDfriends.root");
+
+ if (check)
+ {
+ TFile* file = TFile::Open(esdFile);
+ if (!file)
+ continue;
+ file->Close();
+
+ if (chainFriend)
+ {
+ TFile* file = TFile::Open(esdFileFriend);
+ if (!file)
+ continue;
+ file->Close();
+ }
+
+ printf("%s\n", line.Data());
+ }
+
// add esd file
- chain->Add(esdfile);
+ chain->Add(esdFile);
+
+ // add file
+ if (chainFriend)
+ chainFriend->Add(esdFileFriend);
}
in.close();
}
+
+ if (chainFriend)
+ chain->AddFriend(chainFriend);
return chain;
}
outfile.open(target);
while ((obj = iter->Next()))
- outfile << obj->GetTitle() << "#AliESDs.root" << endl;
+ outfile << obj->GetTitle() << endl;
outfile.close();
return proof;
}
-Bool_t prepareQuery(TString libraries, TString packages, Bool_t useAliRoot)
+Bool_t prepareQuery(TString libraries, TString packages, Int_t useAliRoot)
{
// if not proof load libraries
if (!gProof)
}
else
{
- if (useAliRoot)
- ProofEnableAliRoot();
+ if (useAliRoot > 0)
+ ProofEnableAliRoot(useAliRoot);
TObjArray* packagesList = packages.Tokenize(";");
for (Int_t i=0; i<packagesList->GetEntries(); ++i)
return kFALSE;
}
+ if (gProof->UploadPackage(Form("%s.par", str->String().Data())))
+ {
+ printf("Uploading of package %s failed\n", str->String().Data());
+ return kFALSE;
+ }
+
if (gProof->EnablePackage(str->String()))
{
printf("Loading of package %s failed\n", str->String().Data());
return result;
}
-void ProofEnableAliRoot()
+void ProofEnableAliRoot(Int_t aliroot)
{
// enables a locally deployed AliRoot in a PROOF cluster
gROOT->Macro("$ALICE_ROOT/macros/loadlibs.C");
*/
- const char* location = "/home/alicecaf/ALICE/aliroot-head";
+ const char* location = 0;
+
+ switch (aliroot)
+ {
+ case 1: location = "/home/alicecaf/ALICE/aliroot-v4-04-Release"; break;
+ case 2: location = "/home/alicecaf/ALICE/aliroot-head"; break;
+ default: return;
+ }
gProof->Exec(Form("gSystem->Setenv(\"ALICE_ROOT\", \"%s\")", location), kTRUE);
gProof->AddIncludePath(Form("%s/include", location));