Adding new functionality to the ComaprisonComponent
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 Apr 2008 15:09:10 +0000 (15:09 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 Apr 2008 15:09:10 +0000 (15:09 +0000)
Export Folder with analysis results
(Jacek)

15 files changed:
PWG1/AliComparisonDCA.cxx
PWG1/AliComparisonDCA.h
PWG1/AliComparisonDEdx.cxx
PWG1/AliComparisonDEdx.h
PWG1/AliComparisonEff.cxx
PWG1/AliComparisonEff.h
PWG1/AliComparisonObject.cxx
PWG1/AliComparisonObject.h
PWG1/AliComparisonRes.cxx
PWG1/AliComparisonRes.h
PWG1/AliComparisonTask.cxx
PWG1/AliComparisonTask.h
PWG1/AliMCInfoCuts.cxx
PWG1/AliMCInfoCuts.h
PWG1/AliRecInfoCuts.cxx

index 92c5cb7..b84ab52 100644 (file)
 /*
  
   // after running comparison task, read the file, and get component
-  gSystem->Load("libPWG1.so");
+  gROOT->LoadMacro("$ALICE_ROOT/PWG1/Macros/LoadMyLibs.C");
+  LoadMyLibs();
   TFile f("Output.root");
   AliComparisonDCA * compObj = (AliComparisonDCA*)f.Get("AliComparisonDCA");
 
-  // analyse comparison data
+  // Analyse comparison data
   compObj->Analyse();
 
   // the output histograms/graphs will be stored in the folder "folderDCA" 
@@ -87,12 +88,6 @@ AliComparisonDCA::AliComparisonDCA():
   fAnalysisFolder(0)
 {
   Init();
-
-  // vertex (0,0,0)
-  fVertex = new AliESDVertex();
-  fVertex->SetXv(0.0);
-  fVertex->SetYv(0.0);
-  fVertex->SetZv(0.0);
 }
 
 //_____________________________________________________________________________
@@ -152,6 +147,12 @@ void AliComparisonDCA::Init()
  
   // init folder
   fAnalysisFolder = CreateFolder("folderDCA","Analysis DCA Folder");
+
+  // vertex (0,0,0)
+  fVertex = new AliESDVertex();
+  fVertex->SetXv(0.0);
+  fVertex->SetYv(0.0);
+  fVertex->SetZv(0.0);
 }
 
 //_____________________________________________________________________________
@@ -265,12 +266,7 @@ void AliComparisonDCA::Analyse()
   TGraph2D *gr=0;
   TGraph * gr0=0;
   AliComparisonDCA * comp=this;
-  TFolder *folder = comp->GetAnalysisFolder();
-
-  // recreate folder every time
-  if(folder) delete folder;
-  folder = CreateFolder("folderDCA","Analysis DCA Folder");
-  folder->SetOwner();
+  TObjArray *aFolderObj = new TObjArray;
 
   // write results in the folder 
   // Canvas to draw analysed histograms
@@ -287,7 +283,7 @@ void AliComparisonDCA::Analyse()
   gr0->Draw("Al*");
 
   //if(folder) folder->Add(gr0->GetHistogram());
-  if(folder) folder->Add(gr0);
+  aFolderObj->Add(gr0);
   //
   c->cd(2);
   gr = AliMathBase::MakeStat2D(comp->fD0TanSPtB1,4,2,5); 
@@ -297,13 +293,52 @@ void AliComparisonDCA::Analyse()
   gr->SetName("DCAResolSPTTan");
   gr->GetHistogram()->Draw("colz");
 
-  if(folder) folder->Add(gr->GetHistogram());
+  aFolderObj->Add(gr->GetHistogram());
+
+  // export objects to analysis folder
+  fAnalysisFolder = ExportToFolder(aFolderObj);
 
-  // set pointer to fAnalysisFolder
-  fAnalysisFolder = folder;
+  // delete only TObjArray
+  if(aFolderObj) delete aFolderObj;
 }
 
 //_____________________________________________________________________________
+TFolder* AliComparisonDCA::ExportToFolder(TObjArray * array) 
+{
+  // recreate folder avery time and export objects to new one
+  //
+  AliComparisonDCA * comp=this;
+  TFolder *folder = comp->GetAnalysisFolder();
+
+  TString name, title;
+  TFolder *newFolder = 0;
+  Int_t i = 0;
+  Int_t size = array->GetSize();
+
+  if(folder) { 
+     // get name and title from old folder
+     name = folder->GetName();  
+     title = folder->GetTitle();  
+
+        // delete old one
+     delete folder;
+
+        // create new one
+     newFolder = CreateFolder(name.Data(),title.Data());
+     newFolder->SetOwner();
+
+        // add objects to folder
+     while(i < size) {
+          newFolder->Add(array->At(i));
+          i++;
+        }
+  }
+
+return newFolder;
+}
+
+
+//_____________________________________________________________________________
 TFolder* AliComparisonDCA::CreateFolder(TString name,TString title) { 
 // create folder for analysed histograms
 TFolder *folder = 0;
index 3ef9dd8..95e9521 100644 (file)
@@ -52,6 +52,9 @@ public :
   // Create folder for analysed histograms
   TFolder *CreateFolder(TString folder = "folderDCA",TString title = "Analysed DCA histograms");
 
+  // Export objects to folder
+  TFolder *ExportToFolder(TObjArray * array=0);
+
   // Process events
   void  Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
 
index fe55d35..839bdd9 100644 (file)
 /*
  
   // after running comparison task, read the file, and get component
-  gSystem->Load("libPWG1.so");
+  gROOT->LoadMacro("$ALICE_ROOT/PWG1/Macros/LoadMyLibs.C");
+  LoadMyLibs();
   TFile f("Output.root");
   AliComparisonDEdx * compObj = (AliComparisonDEdx*)f.Get("AliComparisonDEdx");
 
-  // analyse comparison data
+  // Analyse comparison data
   compObj->Analyse();
 
   // the output histograms/graphs will be stored in the folder "folderDEdx" 
@@ -252,23 +253,18 @@ TH1F* AliComparisonDEdx::MakeResol(TH2F * his, Int_t integ, Bool_t type)
 //_____________________________________________________________________________
 void AliComparisonDEdx::Analyse()
 {
-  // Analyse comparison information and store output histograms
+  // Analyze comparison information and store output histograms
   // in the folder "folderDEdx"
   //
 
   TH1::AddDirectory(kFALSE);
   
   AliComparisonDEdx * comp=this;
-  TFolder *folder = comp->GetAnalysisFolder();
+  TObjArray *aFolderObj = new TObjArray;
 
   TH1F *hiss=0;
   TGraph2D * gr=0;
 
-  // recreate folder every time
-  if(folder) delete folder;
-  folder = CreateFolder("folderDEdx","Analysis DEdx Folder");
-  folder->SetOwner();
-
   // write results in the folder 
   TCanvas * c = new TCanvas("can","TPC dedx");
   c->cd();
@@ -279,7 +275,7 @@ void AliComparisonDEdx::Analyse()
   hiss->Draw();
   hiss->SetName("TPCdEdxResolTan");
 
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fTPCSignalNormTan,4,1); 
   hiss->SetXTitle("Tan(#theta)");
@@ -287,7 +283,7 @@ void AliComparisonDEdx::Analyse()
   hiss->Draw(); 
   hiss->SetName("TPCdEdxMeanTan");
 
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   gr = AliMathBase::MakeStat2D(comp->fTPCSignalNormTanSPt,3,1,4);
   gr->GetXaxis()->SetTitle("Tan(#theta)");
@@ -296,7 +292,7 @@ void AliComparisonDEdx::Analyse()
   gr->SetName("TPCdEdxMeanTanPt_1");
   gr->GetHistogram()->Draw("colz"); 
 
-  if(folder) folder->Add(gr->GetHistogram());
+  aFolderObj->Add(gr->GetHistogram());
   //
   gr = AliMathBase::MakeStat2D(comp->fTPCSignalNormTanSPt,3,1,5);
   gr->GetXaxis()->SetTitle("Tan(#theta)");
@@ -305,12 +301,51 @@ void AliComparisonDEdx::Analyse()
   gr->SetName("TPCdEdxMeanTanPt_2");
   gr->GetHistogram()->Draw("colz"); 
 
-  if(folder) folder->Add(gr->GetHistogram());
+  aFolderObj->Add(gr->GetHistogram());
+
+  // export objects to analysis folder
+  fAnalysisFolder = ExportToFolder(aFolderObj);
+
+  // delete only TObjrArray
+  if(aFolderObj) delete aFolderObj;
+}
+
+//_____________________________________________________________________________
+TFolder* AliComparisonDEdx::ExportToFolder(TObjArray * array) 
+{
+  // recreate folder avery time and export objects to new one
+  //
+  AliComparisonDEdx * comp=this;
+  TFolder *folder = comp->GetAnalysisFolder();
+
+  TString name, title;
+  TFolder *newFolder = 0;
+  Int_t i = 0;
+  Int_t size = array->GetSize();
+
+  if(folder) { 
+     // get name and title from old folder
+     name = folder->GetName();  
+     title = folder->GetTitle();  
+
+        // delete old one
+     delete folder;
 
-  // set pointer to fAnalysisFolder
-  fAnalysisFolder = folder;
+        // create new one
+     newFolder = CreateFolder(name.Data(),title.Data());
+     newFolder->SetOwner();
+
+        // add objects to folder
+     while(i < size) {
+          newFolder->Add(array->At(i));
+          i++;
+        }
+  }
+
+return newFolder;
 }
 
+
 //_____________________________________________________________________________
 TFolder* AliComparisonDEdx::CreateFolder(TString name,TString title) { 
 // create folder for analysed histograms
index a0311f7..5d5f8dd 100644 (file)
@@ -52,6 +52,9 @@ public :
   // Create folder for analysed histograms
   TFolder *CreateFolder(TString folder = "folderDEdx",TString title = "Analysed DEdx histograms");
 
+  // Export objects to folder
+  TFolder *ExportToFolder(TObjArray * array=0);
+
   // Process events
   void      Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
 
index 747b260..879299d 100644 (file)
 /*\r
  \r
   // after running comparison task, read the file, and get component\r
-  gSystem->Load("libPWG1.so");\r
+  gROOT->LoadMacro("$ALICE_ROOT/PWG1/Macros/LoadMyLibs.C");\r
+  LoadMyLibs();\r
   TFile f("Output.root");\r
   AliComparisonEff * compObj = (AliComparisonEff*)f.Get("AliComparisonEff");\r
 \r
-  // analyse comparison data\r
+  // Analyse comparison data\r
   compObj->Analyse();\r
 \r
   // the output histograms/graphs will be stored in the folder "folderEff" \r
@@ -133,6 +134,7 @@ AliComparisonEff::AliComparisonEff():
        fTPCPtDCAXYPid[i]=0;   \r
        fTPCPtDCAZPid[i]=0; \r
   }\r
+\r
   Init();\r
 }\r
 \r
@@ -348,10 +350,10 @@ void AliComparisonEff::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
 \r
   // systematics\r
   const Double_t kSigma2Full_xy  = 0.25; // ExB full systematics  [cm]\r
-  const Double_t kSigma2Full_z  =  5.0;  // [cm] \r
+  const Double_t kSigma2Full_z  =  5.0;  // drift velocity (goofie) [cm] \r
 \r
   const Double_t kSigma2Day0_xy  = 0.02; //  ExB  [cm]\r
-  const Double_t kSigma2Day0_z  =  0.1; //  [cm] goofie  \r
+  const Double_t kSigma2Day0_z  =  0.1;  //   drift velocity (goofie) [cm]  \r
 \r
   //  \r
   Double_t     DCASigmaIdeal=0;\r
@@ -674,12 +676,7 @@ void AliComparisonEff::Analyse()
   TH1::AddDirectory(kFALSE);\r
 \r
   AliComparisonEff * comp=this;\r
-  TFolder *folder = comp->GetAnalysisFolder();\r
-\r
-  // recreate folder every time\r
-  if(folder) delete folder;\r
-  folder = CreateFolder("folderEff","Analysis Eff Folder");\r
-  folder->SetOwner();\r
+  TObjArray *aFolderObj = new TObjArray;\r
 \r
   // calculate efficiency and contamination (4 sigma) \r
   TH1 *h_sigmaidealpid[20];\r
@@ -780,73 +777,159 @@ void AliComparisonEff::Analyse()
 \r
   TCanvas * c = new TCanvas("Efficiency","Track efficiency");\r
   c->cd();\r
+  c->Divide(1,2);\r
 \r
   //\r
+  c->cd(1);\r
   comp->fEffTPCTanF->SetXTitle("Tan(#theta)");\r
   comp->fEffTPCTanF->SetYTitle("eff_{findable}");\r
   comp->fEffTPCTanF->SetName("EffTanFindable");\r
+  comp->fEffTPCTanF->Draw();\r
   //\r
+  c->cd(2);\r
   comp->fEffTPCTan->SetXTitle("Tan(#theta)");\r
   comp->fEffTPCTan->SetYTitle("eff_{all}");\r
   comp->fEffTPCTan->SetName("EffTanAll");\r
+  comp->fEffTPCTan->Draw();\r
 \r
-  if(folder) folder->Add(comp->fEffTPCTanF);\r
-  if(folder) folder->Add(comp->fEffTPCTan);\r
+  aFolderObj->Add(comp->fEffTPCTanF);\r
+  aFolderObj->Add(comp->fEffTPCTan);\r
 \r
+  h_sigmaidealpidtot[1]->SetXTitle("p_{t}");\r
+  h_sigmaidealpidtot[1]->SetYTitle("efficiency");\r
+  h_sigmaidealpidtot[1]->SetTitle("Eff_SigmaIdeal");\r
   h_sigmaidealpidtot[1]->SetName("Eff_SigmaIdeal");\r
+\r
+  h_sigmaidealpidtot[3]->SetXTitle("p_{t}");\r
+  h_sigmaidealpidtot[3]->SetYTitle("contamination");\r
+  h_sigmaidealpidtot[3]->SetTitle("Cont_SigmaIdeal");\r
   h_sigmaidealpidtot[3]->SetName("Cont_SigmaIdeal");\r
 \r
-  if(folder) folder->Add(h_sigmaidealpidtot[1]);\r
-  if(folder) folder->Add(h_sigmaidealpidtot[3]);\r
+  aFolderObj->Add(h_sigmaidealpidtot[1]);\r
+  aFolderObj->Add(h_sigmaidealpidtot[3]);\r
 \r
+  h_sigmafullpidtot[1]->SetXTitle("p_{t}");\r
+  h_sigmafullpidtot[1]->SetYTitle("efficiency");\r
+  h_sigmafullpidtot[1]->SetTitle("Eff_SigmaFull");\r
   h_sigmafullpidtot[1]->SetName("Eff_SigmaFull");\r
+\r
+  h_sigmafullpidtot[3]->SetXTitle("p_{t}");\r
+  h_sigmafullpidtot[3]->SetYTitle("contamination");\r
+  h_sigmafullpidtot[3]->SetTitle("Cont_SigmaFull");\r
   h_sigmafullpidtot[3]->SetName("Cont_SigmaFull");\r
 \r
-  if(folder) folder->Add(h_sigmafullpidtot[1]);\r
-  if(folder) folder->Add(h_sigmafullpidtot[3]);\r
+  aFolderObj->Add(h_sigmafullpidtot[1]);\r
+  aFolderObj->Add(h_sigmafullpidtot[3]);\r
 \r
+  h_sigmaday0pidtot[1]->SetXTitle("p_{t}");\r
+  h_sigmaday0pidtot[1]->SetYTitle("efficiency");\r
+  h_sigmaday0pidtot[1]->SetTitle("Eff_SigmaDay0");\r
   h_sigmaday0pidtot[1]->SetName("Eff_SigmaDay0");\r
+\r
+  h_sigmaday0pidtot[3]->SetXTitle("p_{t}");\r
+  h_sigmaday0pidtot[3]->SetYTitle("contamination");\r
+  h_sigmaday0pidtot[3]->SetTitle("Cont_SigmaDay0");\r
   h_sigmaday0pidtot[3]->SetName("Cont_SigmaDay0");\r
 \r
-  if(folder) folder->Add(h_sigmaday0pidtot[1]);\r
-  if(folder) folder->Add(h_sigmaday0pidtot[3]);\r
+  aFolderObj->Add(h_sigmaday0pidtot[1]);\r
+  aFolderObj->Add(h_sigmaday0pidtot[3]);\r
 \r
   for(Int_t idx = 0; idx<5; idx++)\r
   {\r
     sprintf(name,"Eff_SigmaIdeal_%d",idx);\r
     sprintf(name1,"Cont_SigmaIdeal_%d",idx);\r
 \r
+\r
+    h_sigmaidealpid[idx+5]->SetXTitle("p_{t}");\r
+    h_sigmaidealpid[idx+5]->SetYTitle("efficiency");\r
+    h_sigmaidealpid[idx+5]->SetTitle(name);\r
     h_sigmaidealpid[idx+5]->SetName(name);\r
+\r
+    h_sigmaidealpid[idx+15]->SetXTitle("p_{t}");\r
+    h_sigmaidealpid[idx+15]->SetYTitle("contamination");\r
+    h_sigmaidealpid[idx+15]->SetTitle(name1);\r
     h_sigmaidealpid[idx+15]->SetName(name1);\r
 \r
-       if(folder) folder->Add(h_sigmaidealpid[idx+5]);\r
-       if(folder) folder->Add(h_sigmaidealpid[idx+15]);\r
+       aFolderObj->Add(h_sigmaidealpid[idx+5]);\r
+       aFolderObj->Add(h_sigmaidealpid[idx+15]);\r
 \r
     sprintf(name,"Eff_SigmaFull_%d",idx);\r
     sprintf(name1,"Cont_SigmaFull_%d",idx);\r
 \r
+    h_sigmafullpid[idx+5]->SetXTitle("p_{t}");\r
+    h_sigmafullpid[idx+5]->SetYTitle("efficiency");\r
+    h_sigmafullpid[idx+5]->SetTitle(name);\r
     h_sigmafullpid[idx+5]->SetName(name);\r
+\r
+    h_sigmafullpid[idx+15]->SetXTitle("p_{t}");\r
+    h_sigmafullpid[idx+15]->SetYTitle("contamination");\r
+    h_sigmafullpid[idx+15]->SetTitle(name1);\r
     h_sigmafullpid[idx+15]->SetName(name1);\r
 \r
-       if(folder) folder->Add(h_sigmafullpid[idx+5]);\r
-       if(folder) folder->Add(h_sigmafullpid[idx+15]);\r
+       aFolderObj->Add(h_sigmafullpid[idx+5]);\r
+       aFolderObj->Add(h_sigmafullpid[idx+15]);\r
 \r
     sprintf(name,"Eff_SigmaDay0_%d",idx);\r
     sprintf(name1,"Cont_SigmaDay0_%d",idx);\r
 \r
+    h_sigmaday0pid[idx+5]->SetXTitle("p_{t}");\r
+    h_sigmaday0pid[idx+5]->SetYTitle("efficiency");\r
+    h_sigmaday0pid[idx+5]->SetTitle(name);\r
     h_sigmaday0pid[idx+5]->SetName(name);\r
+\r
+    h_sigmaday0pid[idx+15]->SetXTitle("p_{t}");\r
+    h_sigmaday0pid[idx+15]->SetYTitle("contamination");\r
+    h_sigmaday0pid[idx+15]->SetTitle(name1);\r
     h_sigmaday0pid[idx+15]->SetName(name1);\r
 \r
-       if(folder) folder->Add(h_sigmaday0pid[idx+5]);\r
-       if(folder) folder->Add(h_sigmaday0pid[idx+15]);\r
+       aFolderObj->Add(h_sigmaday0pid[idx+5]);\r
+       aFolderObj->Add(h_sigmaday0pid[idx+15]);\r
   }\r
 \r
-  // set pointer to fAnalysisFolder\r
-  fAnalysisFolder = folder;\r
+  // export objects to analysis folder\r
+  fAnalysisFolder = ExportToFolder(aFolderObj);\r
 \r
+  // delete only TObjArray\r
+  if(aFolderObj) delete aFolderObj;\r
 }\r
 \r
 //_____________________________________________________________________________\r
+TFolder* AliComparisonEff::ExportToFolder(TObjArray * array) \r
+{\r
+  // recreate folder avery time and export objects to new one\r
+  //\r
+  AliComparisonEff * comp=this;\r
+  TFolder *folder = comp->GetAnalysisFolder();\r
+\r
+  TString name, title;\r
+  TFolder *newFolder = 0;\r
+  Int_t i = 0;\r
+  Int_t size = array->GetSize();\r
+\r
+  if(folder) { \r
+     // get name and title from old folder\r
+     name = folder->GetName();  \r
+     title = folder->GetTitle();  \r
+\r
+        // delete old one\r
+     delete folder;\r
+\r
+        // create new one\r
+     newFolder = CreateFolder(name.Data(),title.Data());\r
+     newFolder->SetOwner();\r
+\r
+        // add objects to folder\r
+     while(i < size) {\r
+          newFolder->Add(array->At(i));\r
+          i++;\r
+        }\r
+  }\r
+\r
+return newFolder;\r
+}\r
+\r
+\r
+//_____________________________________________________________________________\r
 TFolder* AliComparisonEff::CreateFolder(TString name,TString title) { \r
 // create folder for analysed histograms\r
 //\r
index 74e3e90..2c2da9f 100644 (file)
@@ -55,6 +55,9 @@ public :
   // Create folder for analysed histograms
   TFolder *CreateFolder(TString folder = "folderEff",TString title = "Analysed Efficiency histograms");
 
+  // Export objects to folder
+  TFolder *ExportToFolder(TObjArray * array=0);
+
   // Process events
   void Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
 
index 41311c2..40b9ea0 100644 (file)
@@ -1,7 +1,21 @@
+/**************************************************************************
+* 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.                  *
+**************************************************************************/
+
 //------------------------------------------------------------------------------
 // Implementation of abstract AliComparisonObject class. It keeps information from 
-// comparison of reconstructed and MC particle tracks. All comparison objects should 
-// derive from this class.
+// comparison of reconstructed and MC particle tracks. 
 //
 // Author: J.Otwinowski 14/04/2008 
 //------------------------------------------------------------------------------
index fe8ed9c..040c7a9 100644 (file)
@@ -36,7 +36,6 @@ public :
 \r
   // Get output folder for analysed histograms\r
   virtual TFolder* GetAnalysisFolder() = 0;\r
-  //virtual TFolder* CreateFolder(TString name="",TString title="") = 0;\r
 \r
   ClassDef(AliComparisonObject,1);\r
 };\r
index f23a7f6..e0293d3 100644 (file)
@@ -552,13 +552,9 @@ void AliComparisonRes::Analyse(){
   TH1::AddDirectory(kFALSE);
 
   AliComparisonRes * comp=this;
-  TFolder *folder = comp->GetAnalysisFolder();
+  //TFolder *folder = comp->GetAnalysisFolder();
   TH1F *hiss=0;
-
-  // recreate folder every time
-  if(folder) delete folder;
-  folder = CreateFolder("folderRes","Analysis Res Folder");
-  folder->SetOwner();
+  TObjArray *aFolderObj = new TObjArray;
 
   // write results in the folder 
 
@@ -571,7 +567,7 @@ void AliComparisonRes::Analyse(){
   hiss->Draw(); 
   hiss->SetName("CptResolTan");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
 
   //
   hiss = comp->MakeResol(comp->fCPhiResolTan,1,0);
@@ -580,7 +576,7 @@ void AliComparisonRes::Analyse(){
   hiss->Draw();
   hiss->SetName("PhiResolTan");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fCTanResolTan,1,0);
   hiss->SetXTitle("Tan(#theta)");
@@ -588,7 +584,7 @@ void AliComparisonRes::Analyse(){
   hiss->Draw();
   hiss->SetName("ThetaResolTan");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fCPtPullTan,1,0);
   hiss->SetXTitle("Tan(#theta)");
@@ -596,171 +592,209 @@ void AliComparisonRes::Analyse(){
   hiss->Draw();
   hiss->SetName("CptPullTan");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fC1Pt2ResolS1PtTPC,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
   hiss->Draw();
   hiss->SetName("C1Pt2ResolS1PtTPC");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
 
   hiss = comp->MakeResol(comp->fC1Pt2ResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
   hiss->Draw();
   hiss->SetName("C1Pt2ResolS1PtTPCITS");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fCYResolS1PtTPC,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("CYResolS1PtTPC");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
 
   hiss = comp->MakeResol(comp->fCYResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("CYResolS1PtTPCITS");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fCZResolS1PtTPC,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("CZResolS1PtTPC");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
 
   hiss = comp->MakeResol(comp->fCZResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("CZResolS1PtTPCITS");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fCPhiResolS1PtTPC,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("CPhiResolS1PtTPC");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
 
   hiss = comp->MakeResol(comp->fCPhiResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("CPhiResolS1PtTPCITS");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fCThetaResolS1PtTPC,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("CThetaResolS1PtTPC");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
 
   hiss = comp->MakeResol(comp->fCThetaResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("CThetaResolS1PtTPCITS");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
 
   //
   hiss = comp->MakeResol(comp->f1Pt2ResolS1PtTPC,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
   hiss->Draw();
   hiss->SetName("OnePt2ResolS1PtTPC");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
 
   hiss = comp->MakeResol(comp->f1Pt2ResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
   hiss->Draw();
   hiss->SetName("OnePt2ResolS1PtTPCITS");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fYResolS1PtTPC,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("YResolS1PtTPC");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
 
   hiss = comp->MakeResol(comp->fYResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("YResolS1PtTPCITS");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fZResolS1PtTPC,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("ZResolS1PtTPC");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
 
   hiss = comp->MakeResol(comp->fZResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("ZResolS1PtTPCITS");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fPhiResolS1PtTPC,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("PhiResolS1PtTPC");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
 
   hiss = comp->MakeResol(comp->fPhiResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("PhiResolS1PtTPCITS");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fThetaResolS1PtTPC,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("ThetaResolS1PtTPC");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
 
   hiss = comp->MakeResol(comp->fThetaResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("1/mcp_{t}");
+  hiss->SetXTitle("#sqrt(1/mcp_{t})");
   hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
   hiss->Draw();
   hiss->SetName("ThetaResolS1PtTPCITS");
   
-  if(folder) folder->Add(hiss);
+  aFolderObj->Add(hiss);
+
+  // export objects to analysis folder
+  fAnalysisFolder = ExportToFolder(aFolderObj);
+
+  // delete only TObjArray
+  if(aFolderObj) delete aFolderObj;
+}
+
+//_____________________________________________________________________________
+TFolder* AliComparisonRes::ExportToFolder(TObjArray * array) 
+{
+  // recreate folder avery time and export objects to new one
+  //
+  AliComparisonRes * comp=this;
+  TFolder *folder = comp->GetAnalysisFolder();
+
+  TString name, title;
+  TFolder *newFolder = 0;
+  Int_t i = 0;
+  Int_t size = array->GetSize();
+
+  if(folder) { 
+     // get name and title from old folder
+     name = folder->GetName();  
+     title = folder->GetTitle();  
+
+        // delete old one
+     delete folder;
+
+        // create new one
+     newFolder = CreateFolder(name.Data(),title.Data());
+     newFolder->SetOwner();
+
+        // add objects to folder
+     while(i < size) {
+          newFolder->Add(array->At(i));
+          i++;
+        }
+  }
 
-  // set pointer to fAnalysisFolder
-  fAnalysisFolder = folder;
+return newFolder;
 }
 
 //_____________________________________________________________________________
index 89f40d7..bd46c2d 100644 (file)
@@ -54,6 +54,9 @@ public :
   // Create folder for analysed histograms
   TFolder *CreateFolder(TString folder = "folderRes",TString title = "Analysed Resolution histograms");
 
+  // Export objects to folder
+  TFolder *ExportToFolder(TObjArray * array=0);
+
   // Selection cuts
   void SetAliRecInfoCuts(AliRecInfoCuts* cuts=0) {fCutsRC = cuts;}   
   void SetAliMCInfoCuts(AliMCInfoCuts* cuts=0) {fCutsMC = cuts;}  
index 4f06836..9b68ba3 100644 (file)
@@ -1,11 +1,28 @@
+/**************************************************************************\r
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
+*                                                                        *\r
+* Author: The ALICE Off-line Project.                                    *\r
+* Contributors are mentioned in the code where appropriate.              *\r
+*                                                                        *\r
+* Permission to use, copy, modify and distribute this software and its   *\r
+* documentation strictly for non-commercial purposes is hereby granted   *\r
+* without fee, provided that the above copyright notice appears in all   *\r
+* copies and that both the copyright notice and this permission notice   *\r
+* appear in the supporting documentation. The authors make no claims     *\r
+* about the suitability of this software for any purpose. It is          *\r
+* provided "as is" without express or implied warranty.                  *\r
+**************************************************************************/\r
+\r
 //------------------------------------------------------------------------------\r
 // Implementation of the AliComparisonTask class. It compares properties of the \r
 // reconstructed and MC particle tracks under several conditions. \r
-// As the input it requires the TTree with AliRecInfo and AliMCInfo branches. \r
-// \r
+// As the input it requires the tree with AliRecInfo and AliMCInfo branches. Such\r
+// tree can be prepared in advance by runing AliGenInfoMaker and then AliRecInfoMaker\r
+// (details in description of these classes).\r
+//\r
 // The comparison output objects deriving from AliComparisonObject \r
 // (e.g. AliComparisonRes, AliComparisonEff, AliComparisonDEdxA, AliComparisonDCA ...) \r
-// are stored in the Output.root file.\r
+// are stored in the output file (details in description of these classes).\r
 // \r
 // Author: J.Otwinowski 04/02/2008 \r
 //------------------------------------------------------------------------------\r
@@ -52,8 +69,6 @@ AliComparisonTask::AliComparisonTask(const char *name)
   , fInfoMC(0)\r
   , fInfoRC(0)\r
   , fOutput(0)\r
-  , fMagField(0)\r
-  , fMagFMap(0)\r
   , pitList(0)\r
   , fCompList(0)\r
 {\r
@@ -63,9 +78,6 @@ AliComparisonTask::AliComparisonTask(const char *name)
   DefineInput(0, TChain::Class());\r
   DefineOutput(0, TList::Class());\r
 \r
-  // set default mag. field\r
-  SetMagField();\r
-  \r
   // create the list for comparison objects\r
   fCompList = new TList;\r
 }\r
@@ -74,7 +86,6 @@ AliComparisonTask::AliComparisonTask(const char *name)
 AliComparisonTask::~AliComparisonTask()\r
 {\r
   if(fOutput)   delete fOutput;  fOutput =0; \r
-  if(fMagFMap)  delete fMagFMap;  fMagFMap =0; \r
   if(fCompList)   delete fCompList;  fCompList =0; \r
 }\r
 \r
@@ -97,10 +108,6 @@ void AliComparisonTask::ConnectInputData(Option_t *)
   } else {\r
       Printf("ERROR: Could not get MC and RC branches");\r
   }\r
-  \r
-  // set mag. field map \r
-  fMagFMap = new AliMagFMaps("Maps","Maps", 2, 1., 10., fMagField);\r
-  AliTracker::SetFieldMap(fMagFMap,kFALSE);\r
 }\r
 \r
 //_____________________________________________________________________________\r
@@ -195,16 +202,12 @@ void AliComparisonTask::Exec(Option_t *)
 //_____________________________________________________________________________\r
 void AliComparisonTask::Terminate(Option_t *) \r
 {\r
-  // Called once at the end of the event loop\r
-  TFile *out = new TFile("Output.root","RECREATE");\r
-  out->cd();\r
-\r
+  // Called one at the end \r
+  \r
+  // check output data\r
   fOutput = dynamic_cast<TList*> (GetOutputData(0));\r
   if (!fOutput) {\r
-    Printf("ERROR: fOutput not available");\r
+    Printf("ERROR: AliComparisonTask::Terminate(): Output data not avaiable GetOutputData(0)==0x0 ..." );\r
     return;\r
   }\r
-\r
-  fOutput->Write();\r
-  out->Close();\r
 }\r
index f9006ea..79a6b99 100644 (file)
@@ -28,7 +28,6 @@ class AliComparisonTask : public AliAnalysisTask {
 
   // Set comparison objects
   Bool_t AddComparisonObject(AliComparisonObject* comp);
-  void SetMagField(Int_t mag = 2) {fMagField = mag;}
 
  private:
   TTree* fTree;                   //! input tree
@@ -37,8 +36,6 @@ class AliComparisonTask : public AliAnalysisTask {
 
   TList* fOutput;                 //! list send on output slot 0
   static Int_t evtNumber;         //! event number
-  Int_t  fMagField;               //! mag. field (0 - 0.2 T, 1 - 0.4 T, 2 - 0.5 T) 
-  AliMagFMaps *fMagFMap;          //! mag. field map 
   TIterator *pitList;             //! iterator over the output objetcs  
   TList *fCompList;               // list of comparison objects
 
index 84cdb83..6f2f473 100644 (file)
@@ -1,3 +1,18 @@
+/**************************************************************************
+* 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.                  *
+**************************************************************************/
+
 //------------------------------------------------------------------------------
 // Impementation of AliMCInfoCuts class. It keeps selection cuts for MC tracks. 
 // 
@@ -98,6 +113,27 @@ Bool_t AliMCInfoCuts::IsPdgParticle(Int_t pdgcode) const
 }
 
 //_____________________________________________________________________________
+Bool_t AliMCInfoCuts::IsPosPdgParticle(Int_t pdgcode) const
+{
+  // check PDG particle (only positive charged) 
+  if(aTrackParticles == 0) { 
+    AliDebug(AliLog::kError, "ERROR: Cannot get particle array");
+    return kFALSE;
+  }
+
+  Int_t size = aTrackParticles->GetSize();
+  for(int i=0; i<size; ++i) {
+    // leptons have oposite pdg convension from hadrons (e+/e- = -11/11)
+    if(pdgcode > 0 && (pdgcode == 11 || pdgcode == 13)) return kFALSE; 
+    if(pdgcode < 0 && (pdgcode != -11 || pdgcode != -13) ) return kFALSE; 
+       // 
+    if(pdgcode == aTrackParticles->At(i)) return kTRUE;
+  }
+  return kFALSE;
+}
+
+
+//_____________________________________________________________________________
 Long64_t AliMCInfoCuts::Merge(TCollection* list) 
 {
   // Merge list of objects (needed by PROOF)
index 4806166..72adbae 100644 (file)
@@ -53,6 +53,9 @@ public:
   // check particle in array \r
   Bool_t IsPdgParticle(Int_t pdgcode=0) const;\r
 \r
+  // check particle in array \r
+  Bool_t IsPosPdgParticle(Int_t pdgcode=0) const;\r
+\r
   // Merge output objects (needed by PROOF) \r
   virtual Long64_t Merge(TCollection* list);\r
 \r
index adee27e..519a701 100644 (file)
@@ -1,3 +1,18 @@
+/**************************************************************************
+* 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.                  *
+**************************************************************************/
+
 //------------------------------------------------------------------------------
 // Implementation of the AliRecInfoCuts class. It keeps selection cuts for 
 // reconstructed tracks.