Adding abstract class for comparison components
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Apr 2008 17:15:03 +0000 (17:15 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Apr 2008 17:15:03 +0000 (17:15 +0000)
14 files changed:
PWG1/AliComparisonDCA.cxx
PWG1/AliComparisonDCA.h
PWG1/AliComparisonDEdx.cxx
PWG1/AliComparisonDEdx.h
PWG1/AliComparisonEff.cxx
PWG1/AliComparisonEff.h
PWG1/AliComparisonObject.cxx [new file with mode: 0644]
PWG1/AliComparisonObject.h [new file with mode: 0644]
PWG1/AliComparisonRes.cxx
PWG1/AliComparisonRes.h
PWG1/AliComparisonTask.cxx
PWG1/AliComparisonTask.h
PWG1/PWG1LinkDef.h
PWG1/libPWG1.pkg

index fe5cec0..92c5cb7 100644 (file)
-//------------------------------------------------------------------------------\r
-// Implementation of AliComparisonDCA class. It keeps information from \r
-// comparison of reconstructed and MC particle tracks. In addtion, \r
-// it keeps selection cuts used during comparison. The comparison \r
-// information is stored in the ROOT histograms. Analysis of these \r
-// histograms can be done by using Analyse() class function. The result of \r
-// the analysis (histograms) are stored in the output picture_dca.root file.\r
-//  \r
-// Author: J.Otwinowski 04/02/2008 \r
-//------------------------------------------------------------------------------\r
-\r
-/*\r
-  // after running analysis, read the file, and get component\r
-  gSystem->Load("libPWG1.so");\r
-  TFile f("Output.root");\r
-  AliComparisonDCA * comp = (AliComparisonDCA*)f.Get("AliComparisonDCA");\r
-\r
-  // analyse comparison data (output stored in pictures_dca.root)\r
-  comp->Analyse();\r
-\r
-  // TPC track length parameterisation\r
-  TF1 fl("fl","((min(250./(abs(x+0.000001)),250)-90))",0,2);  // length function\r
-  TF1 fl2("fl2","[0]/((min(250./(abs(x+0.000001)),250)-90))^[1]",0,2);\r
-  fl2.SetParameter(1,1);\r
-  fl2.SetParameter(0,1);\r
-*/\r
-\r
-#include <iostream>\r
-\r
-#include "TFile.h"\r
-#include "TCint.h"\r
-#include "TH3F.h"\r
-#include "TH2F.h"\r
-#include "TF1.h"\r
-#include "TProfile.h"\r
-#include "TProfile2D.h"\r
-#include "TGraph2D.h"\r
-#include "TCanvas.h"\r
-#include "TGraph.h"\r
-// \r
-#include "AliTracker.h"   \r
-#include "AliESDEvent.h"   \r
-#include "AliESD.h"\r
-#include "AliESDfriend.h"\r
-#include "AliESDfriendTrack.h"\r
-#include "AliRecInfoCuts.h" \r
-#include "AliMCInfoCuts.h" \r
-#include "AliLog.h" \r
-#include "AliESDVertex.h" \r
-//\r
-#include "AliMathBase.h"\r
-#include "AliTreeDraw.h" \r
-\r
-#include "AliMCInfo.h" \r
-#include "AliESDRecInfo.h" \r
-#include "AliComparisonDCA.h" \r
-\r
-using namespace std;\r
-\r
-ClassImp(AliComparisonDCA)\r
-\r
-//_____________________________________________________________________________\r
-AliComparisonDCA::AliComparisonDCA():\r
-  TNamed("AliComparisonDCA","AliComparisonDCA"),\r
-\r
-  // DCA histograms\r
-  fD0TanSPtB1(0),\r
-  fD1TanSPtB1(0),\r
-  fD0TanSPtL1(0),\r
-  fD1TanSPtL1(0),\r
-  fD0TanSPtInTPC(0),\r
-  fD1TanSPtInTPC(0),\r
-  fVertex(0),\r
-\r
-  // Cuts \r
-  fCutsRC(0), \r
-  fCutsMC(0)  \r
-{\r
-  InitHisto();\r
-  InitCuts();\r
-\r
-  // vertex (0,0,0)\r
-  fVertex = new AliESDVertex();\r
-  fVertex->SetXv(0.0);\r
-  fVertex->SetYv(0.0);\r
-  fVertex->SetZv(0.0);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-AliComparisonDCA::~AliComparisonDCA()\r
-{\r
-  //\r
-  if(fD0TanSPtB1) delete fD0TanSPtB1; fD0TanSPtB1=0;\r
-  if(fD1TanSPtB1) delete fD1TanSPtB1; fD1TanSPtB1=0;\r
-  if(fD0TanSPtL1) delete fD0TanSPtL1; fD0TanSPtL1=0;\r
-  if(fD1TanSPtL1) delete fD1TanSPtL1; fD1TanSPtL1=0;\r
-  if(fD0TanSPtInTPC) delete fD0TanSPtInTPC; fD0TanSPtInTPC=0;\r
-  if(fD1TanSPtInTPC) delete fD1TanSPtInTPC; fD1TanSPtInTPC=0;\r
-  if(fVertex) delete fVertex; fVertex=0;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliComparisonDCA::InitHisto()\r
-{\r
-  // DCA histograms\r
-  fD0TanSPtB1 = new TH3F("DCAyTanSPtB1","DCAyTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);\r
-  fD0TanSPtB1->SetXTitle("tan(#theta)");\r
-  fD0TanSPtB1->SetYTitle("#sqrt{p_{t}(GeV/c)}");\r
-  fD0TanSPtB1->SetZTitle("DCA_{xy}");\r
-\r
-  fD1TanSPtB1 = new TH3F("DCAzTanSPtB1","DCAzTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);\r
-  fD1TanSPtB1->SetXTitle("tan(#theta)");\r
-  fD1TanSPtB1->SetYTitle("#sqrt(p_{t}(GeV/c))");\r
-  fD1TanSPtB1->SetZTitle("DCA_{z}");\r
-\r
-  fD0TanSPtL1 = new TH3F("DCAyTanSPtL1","DCAyTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);\r
-  fD0TanSPtL1->SetXTitle("tan(#theta)");\r
-  fD0TanSPtL1->SetYTitle("#sqrt{p_{t}(GeV/c)}");\r
-  fD0TanSPtL1->SetZTitle("DCA_{xy}");\r
-\r
-  fD1TanSPtL1 = new TH3F("DCAzTanSPtL1","DCAzTanSPt",40,-2,2, 10,0.3,3, 100, -1,1);\r
-  fD1TanSPtL1->SetXTitle("tan(#theta)");\r
-  fD1TanSPtL1->SetYTitle("#sqrt{p_{t}(GeV/c)}");\r
-  fD1TanSPtL1->SetZTitle("DCA_{z}");\r
-\r
-  fD0TanSPtInTPC = new TH3F("DCAyTanSPtInTPC","DCAyTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);\r
-  fD0TanSPtInTPC->SetXTitle("tan(#theta)");\r
-  fD0TanSPtInTPC->SetYTitle("#sqrt{p_{t}(GeV/c)}");\r
-  fD0TanSPtInTPC->SetZTitle("DCA_{xy}");\r
-\r
-  fD1TanSPtInTPC = new TH3F("DCAzTanSPtInTPC","DCAzTanSPt",40,-2,2, 10,0.3,3, 100, -1,1);\r
-  fD1TanSPtInTPC->SetXTitle("tan(#theta)");\r
-  fD1TanSPtInTPC->SetYTitle("#sqrt{p_{t}(GeV/c)}");\r
-  fD1TanSPtInTPC->SetZTitle("DCA_{z}");\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliComparisonDCA::InitCuts()\r
-{\r
-  if(!fCutsMC) \r
-    AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");\r
-  if(!fCutsRC) \r
-    AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliComparisonDCA::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)\r
-{\r
-  // Fill DCA comparison information\r
-  AliExternalTrackParam *track = 0;\r
-  Double_t kRadius    = 3.0;      // beam pipe radius\r
-  Double_t kMaxStep   = 5.0;      // max step\r
-  Double_t field      = AliTracker::GetBz(); // nominal Bz field [kG]\r
-  Double_t kMaxD      = 123456.0; // max distance\r
-\r
-  Int_t clusterITS[200];\r
-  Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z\r
-\r
-  Float_t mcpt = infoMC->GetParticle().Pt();\r
-  Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);\r
-  Float_t spt = TMath::Sqrt(mcpt);\r
-\r
-  // distance to Prim. vertex \r
-  const Double_t* dv = infoMC->GetVDist(); \r
-\r
-  Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();\r
-\r
-  // Check selection cuts\r
-  if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; \r
-  if (!isPrim) return;\r
-  if (infoRC->GetStatus(1)!=3) return;\r
-  if (!infoRC->GetESDtrack()) return;  \r
-  if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;\r
-  if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;\r
-\r
-  // calculate and set prim. vertex\r
-  fVertex->SetXv( infoMC->GetParticle().Vx() - dv[0] );\r
-  fVertex->SetYv( infoMC->GetParticle().Vy() - dv[1] );\r
-  fVertex->SetZv( infoMC->GetParticle().Vz() - dv[2] );\r
-\r
-  // calculate track parameters at vertex\r
-  if (infoRC->GetESDtrack()->GetTPCInnerParam())\r
-  {\r
-    if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )\r
-    {\r
-      Bool_t bStatus = AliTracker::PropagateTrackTo(track,kRadius,infoMC->GetMass(),kMaxStep,kTRUE);\r
-      Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);\r
-\r
-      if(bStatus && bDCAStatus) {\r
-        fD0TanSPtInTPC->Fill(tantheta,spt,dca[0]);\r
-        fD1TanSPtInTPC->Fill(tantheta,spt,dca[1]);\r
-         }\r
-\r
-         delete track;\r
-    }\r
-  }\r
-\r
- if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)==0){\r
-    fD0TanSPtB1->Fill(tantheta,spt,dca[0]);\r
-    fD1TanSPtB1->Fill(tantheta,spt,dca[1]);\r
-  }\r
-    fD0TanSPtL1->Fill(tantheta,spt,dca[0]);\r
-    fD1TanSPtL1->Fill(tantheta,spt,dca[1]);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Long64_t AliComparisonDCA::Merge(TCollection* list) \r
-{\r
-  // Merge list of objects (needed by PROOF)\r
-\r
-  if (!list)\r
-  return 0;\r
-\r
-  if (list->IsEmpty())\r
-  return 1;\r
-\r
-  TIterator* iter = list->MakeIterator();\r
-  TObject* obj = 0;\r
-\r
-  // collection of generated histograms\r
-  Int_t count=0;\r
-  while((obj = iter->Next()) != 0) \r
-  {\r
-    AliComparisonDCA* entry = dynamic_cast<AliComparisonDCA*>(obj);\r
-    if (entry == 0) { \r
-      Error("Add","Attempt to add object of class: %s to a %s",\r
-         obj->ClassName(),this->ClassName());\r
-      return -1;\r
-    }\r
-\r
-    fD0TanSPtB1->Add(entry->fD0TanSPtB1);\r
-    fD1TanSPtB1->Add(entry->fD1TanSPtB1);\r
-    fD0TanSPtL1->Add(entry->fD0TanSPtL1);\r
-    fD1TanSPtL1->Add(entry->fD1TanSPtL1);\r
-    fD0TanSPtInTPC->Add(entry->fD0TanSPtInTPC);\r
-    fD1TanSPtInTPC->Add(entry->fD1TanSPtInTPC);\r
-\r
-    count++;\r
-  }\r
-\r
-return count;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliComparisonDCA::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC){\r
-  // Process comparison information\r
-  Process(infoMC,infoRC);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliComparisonDCA::Analyse()\r
-{\r
-  // Analyse output histograms\r
-  \r
-  AliComparisonDCA * comp=this;\r
-  TGraph2D * gr=0;\r
-  TGraph * gr0=0;\r
-\r
-  TFile *fp = new TFile("pictures_dca.root","recreate");\r
-  fp->cd();\r
-\r
-  TCanvas * c = new TCanvas("DCA","DCA resloution");\r
-  c->cd();\r
-\r
-  // DCA resolution\r
-  gr0 = AliMathBase::MakeStat1D(comp->fD0TanSPtB1,2,5);\r
-  gr0->GetXaxis()->SetTitle("Tan(#theta)");\r
-  gr0->GetYaxis()->SetTitle("#sigmaDCA (cm)");\r
-  gr0->Write("DCAResolTan");\r
-  //\r
-  gr = AliMathBase::MakeStat2D(comp->fD0TanSPtB1,4,2,5); \r
-  gr->GetXaxis()->SetTitle("Tan(#theta)");\r
-  gr->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV/c)}");\r
-  gr->GetYaxis()->SetTitle("#sigmaDCA (cm)");\r
-  gr->GetHistogram()->Write("DCAResolSPTTan");\r
-\r
-  gPad->Clear();\r
-  gr0->Draw("al*");\r
-\r
-  fp->Close();\r
-}\r
+//------------------------------------------------------------------------------
+// Implementation of AliComparisonDCA class. It keeps information from 
+// comparison of reconstructed and MC particle tracks. In addtion, 
+// it keeps selection cuts used during comparison. The comparison 
+// information is stored in the ROOT histograms. Analysis of these 
+// histograms can be done by using Analyse() class function. The result of 
+// the analysis (histograms/graphs) are stored in the folder
+// which is a data member of AliComparisonDCA.
+//  
+// Author: J.Otwinowski 04/02/2008 
+//------------------------------------------------------------------------------
+
+/*
+  // after running comparison task, read the file, and get component
+  gSystem->Load("libPWG1.so");
+  TFile f("Output.root");
+  AliComparisonDCA * compObj = (AliComparisonDCA*)f.Get("AliComparisonDCA");
+
+  // analyse comparison data
+  compObj->Analyse();
+
+  // the output histograms/graphs will be stored in the folder "folderDCA" 
+  compObj->GetAnalysisFolder()->ls("*");
+  // user can save whole comparison object (or only folder with anlysed histograms) 
+  // in the seperate output file (e.g.)
+  TFile fout("Analysed_DCA.root","recreate");
+  compObj->Write(); // compObj->GetAnalysisFolder()->Write();
+  fout.Close();
+
+*/
+
+#include <iostream>
+
+#include "TFile.h"
+#include "TCint.h"
+#include "TH3F.h"
+#include "TH2F.h"
+#include "TF1.h"
+#include "TProfile.h"
+#include "TProfile2D.h"
+#include "TGraph2D.h"
+#include "TCanvas.h"
+#include "TGraph.h"
+// 
+#include "AliTracker.h"   
+#include "AliESDEvent.h"   
+#include "AliESD.h"
+#include "AliESDfriend.h"
+#include "AliESDfriendTrack.h"
+#include "AliRecInfoCuts.h" 
+#include "AliMCInfoCuts.h" 
+#include "AliLog.h" 
+#include "AliESDVertex.h" 
+//
+#include "AliMathBase.h"
+#include "AliTreeDraw.h" 
+
+#include "AliMCInfo.h" 
+#include "AliESDRecInfo.h" 
+#include "AliComparisonDCA.h" 
+
+using namespace std;
+
+ClassImp(AliComparisonDCA)
+
+//_____________________________________________________________________________
+AliComparisonDCA::AliComparisonDCA():
+//  TNamed("AliComparisonDCA","AliComparisonDCA"),
+  AliComparisonObject("AliComparisonDCA"),
+
+  // DCA histograms
+  fD0TanSPtB1(0),
+  fD1TanSPtB1(0),
+  fD0TanSPtL1(0),
+  fD1TanSPtL1(0),
+  fD0TanSPtInTPC(0),
+  fD1TanSPtInTPC(0),
+  fVertex(0),
+
+  // Cuts 
+  fCutsRC(0), 
+  fCutsMC(0),  
+
+  // histogram folder 
+  fAnalysisFolder(0)
+{
+  Init();
+
+  // vertex (0,0,0)
+  fVertex = new AliESDVertex();
+  fVertex->SetXv(0.0);
+  fVertex->SetYv(0.0);
+  fVertex->SetZv(0.0);
+}
+
+//_____________________________________________________________________________
+AliComparisonDCA::~AliComparisonDCA()
+{
+  //
+  if(fD0TanSPtB1) delete fD0TanSPtB1; fD0TanSPtB1=0;
+  if(fD1TanSPtB1) delete fD1TanSPtB1; fD1TanSPtB1=0;
+  if(fD0TanSPtL1) delete fD0TanSPtL1; fD0TanSPtL1=0;
+  if(fD1TanSPtL1) delete fD1TanSPtL1; fD1TanSPtL1=0;
+  if(fD0TanSPtInTPC) delete fD0TanSPtInTPC; fD0TanSPtInTPC=0;
+  if(fD1TanSPtInTPC) delete fD1TanSPtInTPC; fD1TanSPtInTPC=0;
+  if(fVertex) delete fVertex; fVertex=0;
+  if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
+
+}
+
+//_____________________________________________________________________________
+void AliComparisonDCA::Init()
+{
+  // DCA histograms
+  fD0TanSPtB1 = new TH3F("DCAyTanSPtB1","DCAyTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);
+  fD0TanSPtB1->SetXTitle("tan(#theta)");
+  fD0TanSPtB1->SetYTitle("#sqrt{p_{t}(GeV/c)}");
+  fD0TanSPtB1->SetZTitle("DCA_{xy}");
+
+  fD1TanSPtB1 = new TH3F("DCAzTanSPtB1","DCAzTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);
+  fD1TanSPtB1->SetXTitle("tan(#theta)");
+  fD1TanSPtB1->SetYTitle("#sqrt(p_{t}(GeV/c))");
+  fD1TanSPtB1->SetZTitle("DCA_{z}");
+
+  fD0TanSPtL1 = new TH3F("DCAyTanSPtL1","DCAyTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);
+  fD0TanSPtL1->SetXTitle("tan(#theta)");
+  fD0TanSPtL1->SetYTitle("#sqrt{p_{t}(GeV/c)}");
+  fD0TanSPtL1->SetZTitle("DCA_{xy}");
+
+  fD1TanSPtL1 = new TH3F("DCAzTanSPtL1","DCAzTanSPt",40,-2,2, 10,0.3,3, 100, -1,1);
+  fD1TanSPtL1->SetXTitle("tan(#theta)");
+  fD1TanSPtL1->SetYTitle("#sqrt{p_{t}(GeV/c)}");
+  fD1TanSPtL1->SetZTitle("DCA_{z}");
+
+  fD0TanSPtInTPC = new TH3F("DCAyTanSPtInTPC","DCAyTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);
+  fD0TanSPtInTPC->SetXTitle("tan(#theta)");
+  fD0TanSPtInTPC->SetYTitle("#sqrt{p_{t}(GeV/c)}");
+  fD0TanSPtInTPC->SetZTitle("DCA_{xy}");
+
+  fD1TanSPtInTPC = new TH3F("DCAzTanSPtInTPC","DCAzTanSPt",40,-2,2, 10,0.3,3, 100, -1,1);
+  fD1TanSPtInTPC->SetXTitle("tan(#theta)");
+  fD1TanSPtInTPC->SetYTitle("#sqrt{p_{t}(GeV/c)}");
+  fD1TanSPtInTPC->SetZTitle("DCA_{z}");
+
+  // init cuts
+  if(!fCutsMC) 
+    AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
+  if(!fCutsRC) 
+    AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
+  // init folder
+  fAnalysisFolder = CreateFolder("folderDCA","Analysis DCA Folder");
+}
+
+//_____________________________________________________________________________
+void AliComparisonDCA::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
+{
+  // Fill DCA comparison information
+  AliExternalTrackParam *track = 0;
+  Double_t field      = AliTracker::GetBz(); // nominal Bz field [kG]
+  Double_t kMaxD      = 123456.0; // max distance
+
+  Int_t clusterITS[200];
+  Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
+
+  Float_t mcpt = infoMC->GetParticle().Pt();
+  Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
+  Float_t spt = TMath::Sqrt(mcpt);
+
+  // distance to Prim. vertex 
+  const Double_t* dv = infoMC->GetVDist(); 
+
+  Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
+
+  // Check selection cuts
+  if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; 
+  if (!isPrim) return;
+  if (infoRC->GetStatus(1)!=3) return;
+  if (!infoRC->GetESDtrack()) return;  
+  if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
+  if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
+
+  // calculate and set prim. vertex
+  fVertex->SetXv( infoMC->GetParticle().Vx() - dv[0] );
+  fVertex->SetYv( infoMC->GetParticle().Vy() - dv[1] );
+  fVertex->SetZv( infoMC->GetParticle().Vz() - dv[2] );
+
+  // calculate track parameters at vertex
+  if (infoRC->GetESDtrack()->GetTPCInnerParam())
+  {
+    if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
+    {
+      Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);
+
+      if(bDCAStatus) {
+        fD0TanSPtInTPC->Fill(tantheta,spt,dca[0]);
+        fD1TanSPtInTPC->Fill(tantheta,spt,dca[1]);
+         }
+
+         delete track;
+    }
+  }
+
+ if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)==0){
+    fD0TanSPtB1->Fill(tantheta,spt,dca[0]);
+    fD1TanSPtB1->Fill(tantheta,spt,dca[1]);
+  }
+    fD0TanSPtL1->Fill(tantheta,spt,dca[0]);
+    fD1TanSPtL1->Fill(tantheta,spt,dca[1]);
+}
+
+//_____________________________________________________________________________
+Long64_t AliComparisonDCA::Merge(TCollection* list) 
+{
+  // Merge list of objects (needed by PROOF)
+
+  if (!list)
+  return 0;
+
+  if (list->IsEmpty())
+  return 1;
+
+  TIterator* iter = list->MakeIterator();
+  TObject* obj = 0;
+
+  // collection of generated histograms
+  Int_t count=0;
+  while((obj = iter->Next()) != 0) 
+  {
+    AliComparisonDCA* entry = dynamic_cast<AliComparisonDCA*>(obj);
+    if (entry == 0) continue; 
+    
+
+    fD0TanSPtB1->Add(entry->fD0TanSPtB1);
+    fD1TanSPtB1->Add(entry->fD1TanSPtB1);
+    fD0TanSPtL1->Add(entry->fD0TanSPtL1);
+    fD1TanSPtL1->Add(entry->fD1TanSPtL1);
+    fD0TanSPtInTPC->Add(entry->fD0TanSPtInTPC);
+    fD1TanSPtInTPC->Add(entry->fD1TanSPtInTPC);
+
+    count++;
+  }
+
+return count;
+}
+
+//_____________________________________________________________________________
+void AliComparisonDCA::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
+  // Process comparison information
+  Process(infoMC,infoRC);
+}
+
+//_____________________________________________________________________________
+void AliComparisonDCA::Analyse()
+{
+  //
+  // Analyse comparison information and store output histograms
+  // in the analysis folder "folderDCA" 
+  //
+  
+  TH1::AddDirectory(kFALSE);
+
+  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();
+
+  // write results in the folder 
+  // Canvas to draw analysed histograms
+  TCanvas * c = new TCanvas("canDCA","DCA resolution");
+  c->Divide(1,2);
+  c->cd(1);
+  //
+  // DCA resolution
+  //
+  gr0 = AliMathBase::MakeStat1D(comp->fD0TanSPtB1,2,5);
+  gr0->GetXaxis()->SetTitle("Tan(#theta)");
+  gr0->GetYaxis()->SetTitle("#sigmaDCA (cm)");
+  gr0->SetName("DCAResolTan");
+  gr0->Draw("Al*");
+
+  //if(folder) folder->Add(gr0->GetHistogram());
+  if(folder) folder->Add(gr0);
+  //
+  c->cd(2);
+  gr = AliMathBase::MakeStat2D(comp->fD0TanSPtB1,4,2,5); 
+  gr->GetXaxis()->SetTitle("Tan(#theta)");
+  gr->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV/c)}");
+  gr->GetYaxis()->SetTitle("#sigmaDCA (cm)");
+  gr->SetName("DCAResolSPTTan");
+  gr->GetHistogram()->Draw("colz");
+
+  if(folder) folder->Add(gr->GetHistogram());
+
+  // set pointer to fAnalysisFolder
+  fAnalysisFolder = folder;
+}
+
+//_____________________________________________________________________________
+TFolder* AliComparisonDCA::CreateFolder(TString name,TString title) { 
+// create folder for analysed histograms
+TFolder *folder = 0;
+  folder = new TFolder(name.Data(),title.Data());
+
+  return folder;
+}
index eaf8d9b..3ef9dd8 100644 (file)
@@ -22,31 +22,45 @@ class TH3F;
 class TH3;
 class TProfile;
 class TProfile2D;
+class TString;
 class AliESDVertex;
 
 #include "TNamed.h"
+#include "AliComparisonObject.h"
 
-class AliComparisonDCA : public TNamed {
+//class AliComparisonDCA : public TNamed {
+class AliComparisonDCA : public AliComparisonObject {
 public :
   AliComparisonDCA(); 
   ~AliComparisonDCA();
-  void      InitHisto();
-  void      InitCuts();
-  void      Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
-  void      Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
-  
-  // Selection cuts
-  void SetAliRecInfoCuts(AliRecInfoCuts* cuts=0) {fCutsRC = cuts;}
-  void SetAliMCInfoCuts(AliMCInfoCuts* cuts=0) {fCutsMC = cuts;}  
 
-  AliRecInfoCuts*  GetAliRecInfoCuts() const {return fCutsRC;}
-  AliMCInfoCuts*   GetAliMCInfoCuts()  const {return fCutsMC;}
+  // Init data members
+  virtual void Init();
+
+  // Execute analysis
+  virtual void Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
 
   // Merge output objects (needed by PROOF) 
   virtual Long64_t Merge(TCollection* list);
 
   // Analyse output histograms
-  void Analyse();
+  virtual void Analyse();
+
+  // Get analysis folder
+  virtual TFolder* GetAnalysisFolder() {return fAnalysisFolder;}
+
+  // Create folder for analysed histograms
+  TFolder *CreateFolder(TString folder = "folderDCA",TString title = "Analysed DCA histograms");
+
+  // Process events
+  void  Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+
+  // Selection cuts
+  void SetAliRecInfoCuts(AliRecInfoCuts* cuts=0) {fCutsRC = cuts;}
+  void SetAliMCInfoCuts(AliMCInfoCuts* cuts=0) {fCutsMC = cuts;}  
+
+  AliRecInfoCuts*  GetAliRecInfoCuts() const {return fCutsRC;}
+  AliMCInfoCuts*   GetAliMCInfoCuts()  const {return fCutsMC;}
 
 private:
   // DCA resolution
@@ -63,6 +77,9 @@ private:
   AliRecInfoCuts*  fCutsRC; // selection cuts for reconstructed tracks
   AliMCInfoCuts*  fCutsMC;  // selection cuts for MC tracks
 
+  // analysis folder 
+  TFolder *fAnalysisFolder; // folder for analysed histograms
+
   AliComparisonDCA(const AliComparisonDCA&); // not implemented
   AliComparisonDCA& operator=(const AliComparisonDCA&); // not implemented
 
index a60aae7..fe55d35 100644 (file)
-//------------------------------------------------------------------------------\r
-// Implementation of AliComparisonDEdx class. It keeps information from \r
-// comparison of reconstructed and MC particle tracks. In addtion, \r
-// it keeps selection cuts used during comparison. The comparison \r
-// information is stored in the ROOT histograms. Analysis of these \r
-// histograms can be done by using Analyse() class function. The result of \r
-// the analysis (histograms) are stored in the output picture_dedx.root file.\r
-//  \r
-// Author: J.Otwinowski 04/02/2008 \r
-//------------------------------------------------------------------------------\r
-\r
-\r
-/*\r
-  //after running analysis, read the file, and get component\r
-  gSystem->Load("libPWG1.so");\r
-  TFile f("Output.root");\r
-  AliComparisonDEdx * comp = (AliComparisonDEdx*)f.Get("AliComparisonDEdx");\r
-\r
-  // analyse comparison data (output stored in pictures_dedx.root)\r
-  comp->Analyse();\r
-\r
-  // TPC track length parameterisation\r
-  TF1 fl("fl","((min(250./(abs(x+0.000001)),250)-90))",0,2);  // length function\r
-  TF1 fl2("fl2","[0]/((min(250./(abs(x+0.000001)),250)-90))^[1]",0,2);\r
-  fl2.SetParameter(1,1);\r
-  fl2.SetParameter(0,1);\r
-*/\r
-\r
-#include <iostream>\r
-\r
-#include "TFile.h"\r
-#include "TCint.h"\r
-#include "TH3F.h"\r
-#include "TH2F.h"\r
-#include "TF1.h"\r
-#include "TProfile.h"\r
-#include "TProfile2D.h"\r
-#include "TGraph2D.h"\r
-#include "TCanvas.h"\r
-#include "TGraph.h"\r
-//\r
-#include "AliESDEvent.h"\r
-#include "AliESD.h"\r
-#include "AliESDfriend.h"\r
-#include "AliESDfriendTrack.h"\r
-#include "AliRecInfoCuts.h" \r
-#include "AliMCInfoCuts.h" \r
-#include "AliLog.h" \r
-//\r
-#include "AliMathBase.h"\r
-#include "AliTreeDraw.h"\r
-//#include "TStatToolkit.h"\r
-\r
-#include "AliMCInfo.h" \r
-#include "AliESDRecInfo.h" \r
-#include "AliComparisonDEdx.h" \r
-\r
-using namespace std;\r
-\r
-ClassImp(AliComparisonDEdx)\r
-\r
-//_____________________________________________________________________________\r
-AliComparisonDEdx::AliComparisonDEdx():\r
-  TNamed("AliComparisonDEdx","AliComparisonDEdx"),\r
-\r
-  // dEdx \r
-  fTPCSignalNormTan(0), \r
-  fTPCSignalNormSPhi(0),\r
-  fTPCSignalNormTPhi(0), \r
-  //\r
-  fTPCSignalNormTanSPhi(0),\r
-  fTPCSignalNormTanTPhi(0),\r
-  fTPCSignalNormTanSPt(0), \r
-  \r
-  // Cuts \r
-  fCutsRC(0), \r
-  fCutsMC(0),\r
-  fMCPtMin(0),\r
-  fMCAbsTanThetaMax(0),\r
-  fMCPdgCode(0)\r
-{\r
-  InitHisto();\r
-  InitCuts();\r
-}\r
-\r
-//_____________________________________________________________________________\r
-AliComparisonDEdx::~AliComparisonDEdx(){\r
-   \r
-  if(fTPCSignalNormTan)  delete fTPCSignalNormTan; fTPCSignalNormTan=0; \r
-  if(fTPCSignalNormSPhi) delete fTPCSignalNormSPhi; fTPCSignalNormSPhi=0;\r
-  if(fTPCSignalNormTPhi) delete fTPCSignalNormTPhi; fTPCSignalNormTPhi=0;\r
-  //\r
-  if(fTPCSignalNormTanSPhi) delete fTPCSignalNormTanSPhi; fTPCSignalNormTanSPhi=0;\r
-  if(fTPCSignalNormTanTPhi) delete fTPCSignalNormTanTPhi; fTPCSignalNormTanTPhi=0;\r
-  if(fTPCSignalNormTanSPt)  delete fTPCSignalNormTanSPt; fTPCSignalNormTanSPt=0;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliComparisonDEdx::InitHisto()\r
-{\r
-  // Init histograms\r
-  \r
-  // TPC dEdx\r
-  fTPCSignalNormTan = new TH2F("CdEdxTan","CdEdxTan",50, -2,2,  40,30,70); \r
-  fTPCSignalNormTan->SetXTitle("tan(#theta)");\r
-  fTPCSignalNormTan->SetYTitle("rec. dE/dx / calc. dE/dx");\r
-\r
-  fTPCSignalNormSPhi   = new TH2F("CdEdxSPhi","CdEdxSPhi",10,0.0,1,40,30,70);\r
-  fTPCSignalNormSPhi->SetXTitle("sin(#phi)");\r
-  fTPCSignalNormSPhi->SetYTitle("rec. dE/dx / calc. dE/dx");\r
-\r
-  fTPCSignalNormTPhi   = new TH2F("CdEdxTPhi","CdEdxTPhi",10,0.0,2,40,30,70); \r
-  fTPCSignalNormTPhi->SetXTitle("tan(#phi)");\r
-  fTPCSignalNormTPhi->SetYTitle("rec. dE/dx / calc. dE/dx");\r
-\r
-  fTPCSignalNormTanSPhi= new TH3F("CdEdxTanSPhi","CdEdxTanSPhi",20, -2,2, 10,0.0 ,1,  40,30,70);\r
-  fTPCSignalNormTanSPhi->SetXTitle("tan(#theta)");\r
-  fTPCSignalNormTanSPhi->SetYTitle("sin(#phi)");\r
-  fTPCSignalNormTanSPhi->SetZTitle("rec. dE/dx / calc. dE/dx");\r
-\r
-  fTPCSignalNormTanTPhi= new TH3F("CdEdxTanTPhi","CdEdxTanTPhi",20, -2,2, 10,0.0 ,1,  40,30,70);\r
-  fTPCSignalNormTanTPhi->SetXTitle("tan(#theta)");\r
-  fTPCSignalNormTanTPhi->SetYTitle("tan(#phi)");\r
-  fTPCSignalNormTanTPhi->SetZTitle("rec. dE/dx / calc. dE/dx");\r
-\r
-  fTPCSignalNormTanSPt= new TH3F("CdEdxTanSPt","CdEdxTanSPt",20, -2,2, 10,0.3 ,3, 40,30,70); \r
-  fTPCSignalNormTanSPt->SetXTitle("tan(#theta)");\r
-  fTPCSignalNormTanSPt->SetYTitle("#sqrt{p_{t}}");\r
-  fTPCSignalNormTanSPt->SetZTitle("rec. dE/dx / calc. dE/dx");\r
-}\r
-\r
-void AliComparisonDEdx::InitCuts()\r
-{\r
-  // Init cuts\r
-  if(!fCutsMC) \r
-    AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");\r
-  if(!fCutsRC) \r
-    AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliComparisonDEdx::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC){\r
-\r
-  // Fill dE/dx  comparison information\r
-  \r
-  Float_t mcpt = infoMC->GetParticle().Pt();\r
-  Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);\r
-  Float_t mprim = infoMC->GetPrim();\r
-\r
-  // distance to Prim. vertex \r
-  const Double_t* dv = infoMC->GetVDist(); \r
-\r
-  Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();\r
-  \r
-  // Check selection cuts \r
-  if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; \r
-  if (!isPrim) return;\r
-  if (infoRC->GetStatus(1)!=3) return;\r
-  if (!infoRC->GetESDtrack()) return;  \r
-  if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;\r
-  if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;\r
-  //if (mprim>1.4) return;\r
-  //if (mprim<0.5) return;\r
-  if (mprim > fCutsMC->GetMaxTPCSignal()) return;\r
-  if (mprim < fCutsMC->GetMinTPCSignal()) return;\r
-  if (infoRC->GetESDtrack()->GetTPCsignalN()<fCutsRC->GetMinTPCsignalN()) return;\r
-  //\r
-  Float_t ratio = infoRC->GetESDtrack()->GetTPCsignal()/infoMC->GetPrim();\r
-  Float_t sphi =  infoRC->GetESDtrack()->GetInnerParam()->GetSnp();\r
-  Float_t tphi =  sphi/TMath::Sqrt(1-sphi*sphi);\r
-\r
-  if (TMath::Abs(infoMC->GetParticle().GetPdgCode()) != GetMCPdgCode()) return;\r
-  //if (mcpt>0.5) {\r
-  if (mcpt > GetMCPtMin()) {\r
-    fTPCSignalNormTan->Fill(tantheta,ratio);    // only subset\r
-  }\r
-\r
-  //if (TMath::Abs(tantheta)<0.5){\r
-  if (TMath::Abs(tantheta) < GetMCAbsTanThetaMax()){\r
-    fTPCSignalNormSPhi->Fill(sphi,ratio);       // only subset\r
-    fTPCSignalNormTPhi->Fill(tphi,ratio);       // only subset\r
-  }\r
-  fTPCSignalNormTanSPhi->Fill(tantheta,sphi,ratio);    \r
-  fTPCSignalNormTanTPhi->Fill(tantheta,tphi,ratio);    \r
-  fTPCSignalNormTanSPt->Fill(tantheta,TMath::Sqrt(mcpt),ratio);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Long64_t AliComparisonDEdx::Merge(TCollection* list) \r
-{\r
-  // Merge list of objects (needed by PROOF)\r
-\r
-  if (!list)\r
-  return 0;\r
-\r
-  if (list->IsEmpty())\r
-  return 1;\r
-\r
-  TIterator* iter = list->MakeIterator();\r
-  TObject* obj = 0;\r
-\r
-  // collection of generated histograms\r
-  Int_t count=0;\r
-  while((obj = iter->Next()) != 0) \r
-  {\r
-    AliComparisonDEdx* entry = dynamic_cast<AliComparisonDEdx*>(obj);\r
-    if (entry == 0) { \r
-      Error("Add","Attempt to add object of class: %s to a %s",\r
-         obj->ClassName(),this->ClassName());\r
-      return -1;\r
-  }\r
-\r
-  fTPCSignalNormTan->Add(entry->fTPCSignalNormTan);\r
-  fTPCSignalNormSPhi->Add(entry->fTPCSignalNormSPhi);\r
-  fTPCSignalNormTPhi->Add(entry->fTPCSignalNormTPhi);\r
-  //\r
-  fTPCSignalNormTanSPhi->Add(entry->fTPCSignalNormTanSPhi);\r
-  fTPCSignalNormTanTPhi->Add(entry->fTPCSignalNormTanTPhi);\r
-  fTPCSignalNormTanSPt->Add(entry->fTPCSignalNormTanSPt);\r
-\r
-  count++;\r
-  }\r
-\r
-return count;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliComparisonDEdx::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC)\r
-{\r
-  // Process comparison information\r
-  Process(infoMC,infoRC);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-TH1F* AliComparisonDEdx::MakeResol(TH2F * his, Int_t integ, Bool_t type)\r
-{\r
-  // Make resolution histograms\r
-  TH1F *hisr, *hism;\r
-  if (!gPad) new TCanvas;\r
-  hisr = AliTreeDraw::CreateResHistoI(his,&hism,integ);\r
-  if (type) return hism;\r
-  else \r
-    return hisr;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliComparisonDEdx::Analyse()\r
-{\r
-  // Analyse output histograms\r
-  \r
-  AliComparisonDEdx * comp=this;\r
-  TH1F *hiss=0;\r
-  TGraph2D * gr=0;\r
-\r
-  TFile *fp = new TFile("pictures_dedx.root","recreate");\r
-  fp->cd();\r
-\r
-  TCanvas * c = new TCanvas("TPCdedx","TPC dedx");\r
-  c->cd();\r
-\r
-  hiss = comp->MakeResol(comp->fTPCSignalNormTan,4,0);\r
-  hiss->SetXTitle("Tan(#theta)");\r
-  hiss->SetYTitle("#sigma_{dEdx}");\r
-  hiss->Draw();\r
-  hiss->Write("TPCdEdxResolTan");\r
-  //\r
-  hiss = comp->MakeResol(comp->fTPCSignalNormTan,4,1); \r
-  hiss->SetXTitle("Tan(#theta)");\r
-  hiss->SetYTitle("<dEdx>");\r
-  hiss->Draw(); \r
-  hiss->Write("TPCdEdxMeanTan");\r
-  //\r
-  gr = AliMathBase::MakeStat2D(comp->fTPCSignalNormTanSPt,3,1,4);\r
-  gr->GetXaxis()->SetTitle("Tan(#theta)");\r
-  gr->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");\r
-  gr->GetZaxis()->SetTitle("<dEdx>");\r
-  gr->Draw("colz"); \r
-  gr->GetHistogram()->Write("TPCdEdxMeanTanPt_1");\r
-  //\r
-  gr = AliMathBase::MakeStat2D(comp->fTPCSignalNormTanSPt,3,1,5);\r
-  gr->GetXaxis()->SetTitle("Tan(#theta)");\r
-  gr->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");\r
-  gr->GetZaxis()->SetTitle("#sigma_{dEdx}");\r
-  gr->Draw("colz"); \r
-  gr->GetHistogram()->Write("TPCdEdxMeanTanPt_2");\r
-\r
-  fp->Close();\r
-}\r
+//------------------------------------------------------------------------------
+// Implementation of AliComparisonDEdx class. It keeps information from 
+// comparison of reconstructed and MC particle tracks. In addtion, 
+// it keeps selection cuts used during comparison. The comparison 
+// information is stored in the ROOT histograms. Analysis of these 
+// histograms can be done by using Analyse() class function. The result of 
+// the analysis (histograms/graphs) are stored in the folder which is 
+// a data of AliComparisonDEdx.
+//  
+// Author: J.Otwinowski 04/02/2008 
+//------------------------------------------------------------------------------
+
+/*
+  // after running comparison task, read the file, and get component
+  gSystem->Load("libPWG1.so");
+  TFile f("Output.root");
+  AliComparisonDEdx * compObj = (AliComparisonDEdx*)f.Get("AliComparisonDEdx");
+
+  // analyse comparison data
+  compObj->Analyse();
+
+  // the output histograms/graphs will be stored in the folder "folderDEdx" 
+  compObj->GetAnalysisFolder()->ls("*");
+
+  // user can save whole comparison object (or only folder with anlysed histograms) 
+  // in the seperate output file (e.g.)
+  TFile fout("Analysed_DEdx.root"."recreate");
+  compObj->Write(); // compObj->GetAnalysisFolder()->Write();
+  fout.Close();
+
+*/
+
+#include <iostream>
+
+#include "TFile.h"
+#include "TCint.h"
+#include "TH3F.h"
+#include "TH2F.h"
+#include "TF1.h"
+#include "TProfile.h"
+#include "TProfile2D.h"
+#include "TGraph2D.h"
+#include "TCanvas.h"
+#include "TGraph.h"
+//
+#include "AliESDEvent.h"
+#include "AliESD.h"
+#include "AliESDfriend.h"
+#include "AliESDfriendTrack.h"
+#include "AliRecInfoCuts.h" 
+#include "AliMCInfoCuts.h" 
+#include "AliLog.h" 
+//
+#include "AliMathBase.h"
+#include "AliTreeDraw.h"
+//#include "TStatToolkit.h"
+
+#include "AliMCInfo.h" 
+#include "AliESDRecInfo.h" 
+#include "AliComparisonDEdx.h" 
+
+using namespace std;
+
+ClassImp(AliComparisonDEdx)
+
+//_____________________________________________________________________________
+AliComparisonDEdx::AliComparisonDEdx():
+//  TNamed("AliComparisonDEdx","AliComparisonDEdx"),
+  AliComparisonObject("AliComparisonDEdx"),
+
+  // dEdx 
+  fTPCSignalNormTan(0), 
+  fTPCSignalNormSPhi(0),
+  fTPCSignalNormTPhi(0), 
+  //
+  fTPCSignalNormTanSPhi(0),
+  fTPCSignalNormTanTPhi(0),
+  fTPCSignalNormTanSPt(0), 
+  
+  // Cuts 
+  fCutsRC(0), 
+  fCutsMC(0),
+  fMCPtMin(0),
+  fMCAbsTanThetaMax(0),
+  fMCPdgCode(0),
+
+  // histogram folder 
+  fAnalysisFolder(0)
+{
+  Init();
+}
+
+//_____________________________________________________________________________
+AliComparisonDEdx::~AliComparisonDEdx(){
+   
+  if(fTPCSignalNormTan)  delete fTPCSignalNormTan; fTPCSignalNormTan=0; 
+  if(fTPCSignalNormSPhi) delete fTPCSignalNormSPhi; fTPCSignalNormSPhi=0;
+  if(fTPCSignalNormTPhi) delete fTPCSignalNormTPhi; fTPCSignalNormTPhi=0;
+  //
+  if(fTPCSignalNormTanSPhi) delete fTPCSignalNormTanSPhi; fTPCSignalNormTanSPhi=0;
+  if(fTPCSignalNormTanTPhi) delete fTPCSignalNormTanTPhi; fTPCSignalNormTanTPhi=0;
+  if(fTPCSignalNormTanSPt)  delete fTPCSignalNormTanSPt; fTPCSignalNormTanSPt=0;
+
+  if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
+}
+
+//_____________________________________________________________________________
+void AliComparisonDEdx::Init()
+{
+  // Init histograms
+  
+  // TPC dEdx
+  fTPCSignalNormTan = new TH2F("CdEdxTan","CdEdxTan",50, -2,2,  40,30,70); 
+  fTPCSignalNormTan->SetXTitle("tan(#theta)");
+  fTPCSignalNormTan->SetYTitle("rec. dE/dx / calc. dE/dx");
+
+  fTPCSignalNormSPhi   = new TH2F("CdEdxSPhi","CdEdxSPhi",10,0.0,1,40,30,70);
+  fTPCSignalNormSPhi->SetXTitle("sin(#phi)");
+  fTPCSignalNormSPhi->SetYTitle("rec. dE/dx / calc. dE/dx");
+
+  fTPCSignalNormTPhi   = new TH2F("CdEdxTPhi","CdEdxTPhi",10,0.0,2,40,30,70); 
+  fTPCSignalNormTPhi->SetXTitle("tan(#phi)");
+  fTPCSignalNormTPhi->SetYTitle("rec. dE/dx / calc. dE/dx");
+
+  fTPCSignalNormTanSPhi= new TH3F("CdEdxTanSPhi","CdEdxTanSPhi",20, -2,2, 10,0.0 ,1,  40,30,70);
+  fTPCSignalNormTanSPhi->SetXTitle("tan(#theta)");
+  fTPCSignalNormTanSPhi->SetYTitle("sin(#phi)");
+  fTPCSignalNormTanSPhi->SetZTitle("rec. dE/dx / calc. dE/dx");
+
+  fTPCSignalNormTanTPhi= new TH3F("CdEdxTanTPhi","CdEdxTanTPhi",20, -2,2, 10,0.0 ,1,  40,30,70);
+  fTPCSignalNormTanTPhi->SetXTitle("tan(#theta)");
+  fTPCSignalNormTanTPhi->SetYTitle("tan(#phi)");
+  fTPCSignalNormTanTPhi->SetZTitle("rec. dE/dx / calc. dE/dx");
+
+  fTPCSignalNormTanSPt= new TH3F("CdEdxTanSPt","CdEdxTanSPt",20, -2,2, 10,0.3 ,3, 40,30,70); 
+  fTPCSignalNormTanSPt->SetXTitle("tan(#theta)");
+  fTPCSignalNormTanSPt->SetYTitle("#sqrt{p_{t}}");
+  fTPCSignalNormTanSPt->SetZTitle("rec. dE/dx / calc. dE/dx");
+
+  // Init cuts
+  if(!fCutsMC) 
+    AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
+  if(!fCutsRC) 
+    AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
+
+    // init folder
+    fAnalysisFolder = CreateFolder("folderDEdx","Analysis de/dx Folder");
+}
+
+//_____________________________________________________________________________
+void AliComparisonDEdx::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
+
+  // Fill dE/dx  comparison information
+  
+  Float_t mcpt = infoMC->GetParticle().Pt();
+  Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
+  Float_t mprim = infoMC->GetPrim();
+
+  // distance to Prim. vertex 
+  const Double_t* dv = infoMC->GetVDist(); 
+
+  Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
+  
+  // Check selection cuts 
+  if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; 
+  if (!isPrim) return;
+  if (infoRC->GetStatus(1)!=3) return;
+  if (!infoRC->GetESDtrack()) return;  
+  if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
+  if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
+  //if (mprim>1.4) return;
+  //if (mprim<0.5) return;
+  if (mprim > fCutsMC->GetMaxTPCSignal()) return;
+  if (mprim < fCutsMC->GetMinTPCSignal()) return;
+  if (infoRC->GetESDtrack()->GetTPCsignalN()<fCutsRC->GetMinTPCsignalN()) return;
+  //
+  Float_t ratio = infoRC->GetESDtrack()->GetTPCsignal()/infoMC->GetPrim();
+  Float_t sphi =  infoRC->GetESDtrack()->GetInnerParam()->GetSnp();
+  Float_t tphi =  sphi/TMath::Sqrt(1-sphi*sphi);
+
+  if (TMath::Abs(infoMC->GetParticle().GetPdgCode()) != GetMCPdgCode()) return;
+  //if (mcpt>0.5) {
+  if (mcpt > GetMCPtMin()) {
+    fTPCSignalNormTan->Fill(tantheta,ratio);    // only subset
+  }
+
+  //if (TMath::Abs(tantheta)<0.5){
+  if (TMath::Abs(tantheta) < GetMCAbsTanThetaMax()){
+    fTPCSignalNormSPhi->Fill(sphi,ratio);       // only subset
+    fTPCSignalNormTPhi->Fill(tphi,ratio);       // only subset
+  }
+  fTPCSignalNormTanSPhi->Fill(tantheta,sphi,ratio);    
+  fTPCSignalNormTanTPhi->Fill(tantheta,tphi,ratio);    
+  fTPCSignalNormTanSPt->Fill(tantheta,TMath::Sqrt(mcpt),ratio);
+}
+
+//_____________________________________________________________________________
+Long64_t AliComparisonDEdx::Merge(TCollection* list) 
+{
+  // Merge list of objects (needed by PROOF)
+
+  if (!list)
+  return 0;
+
+  if (list->IsEmpty())
+  return 1;
+
+  TIterator* iter = list->MakeIterator();
+  TObject* obj = 0;
+
+  // collection of generated histograms
+  Int_t count=0;
+  while((obj = iter->Next()) != 0) 
+  {
+    AliComparisonDEdx* entry = dynamic_cast<AliComparisonDEdx*>(obj);
+    if (entry == 0) continue;
+
+    fTPCSignalNormTan->Add(entry->fTPCSignalNormTan);
+    fTPCSignalNormSPhi->Add(entry->fTPCSignalNormSPhi);
+    fTPCSignalNormTPhi->Add(entry->fTPCSignalNormTPhi);
+    //
+    fTPCSignalNormTanSPhi->Add(entry->fTPCSignalNormTanSPhi);
+    fTPCSignalNormTanTPhi->Add(entry->fTPCSignalNormTanTPhi);
+    fTPCSignalNormTanSPt->Add(entry->fTPCSignalNormTanSPt);
+
+    count++;
+  }
+
+return count;
+}
+
+//_____________________________________________________________________________
+void AliComparisonDEdx::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
+{
+  // Process comparison information
+  Process(infoMC,infoRC);
+}
+
+//_____________________________________________________________________________
+TH1F* AliComparisonDEdx::MakeResol(TH2F * his, Int_t integ, Bool_t type)
+{
+  // Make resolution histograms
+  TH1F *hisr, *hism;
+  if (!gPad) new TCanvas;
+  hisr = AliTreeDraw::CreateResHistoI(his,&hism,integ);
+  if (type) return hism;
+  else 
+    return hisr;
+}
+
+//_____________________________________________________________________________
+void AliComparisonDEdx::Analyse()
+{
+  // Analyse comparison information and store output histograms
+  // in the folder "folderDEdx"
+  //
+
+  TH1::AddDirectory(kFALSE);
+  
+  AliComparisonDEdx * comp=this;
+  TFolder *folder = comp->GetAnalysisFolder();
+
+  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();
+
+  hiss = comp->MakeResol(comp->fTPCSignalNormTan,4,0);
+  hiss->SetXTitle("Tan(#theta)");
+  hiss->SetYTitle("#sigma_{dEdx}");
+  hiss->Draw();
+  hiss->SetName("TPCdEdxResolTan");
+
+  if(folder) folder->Add(hiss);
+  //
+  hiss = comp->MakeResol(comp->fTPCSignalNormTan,4,1); 
+  hiss->SetXTitle("Tan(#theta)");
+  hiss->SetYTitle("<dEdx>");
+  hiss->Draw(); 
+  hiss->SetName("TPCdEdxMeanTan");
+
+  if(folder) folder->Add(hiss);
+  //
+  gr = AliMathBase::MakeStat2D(comp->fTPCSignalNormTanSPt,3,1,4);
+  gr->GetXaxis()->SetTitle("Tan(#theta)");
+  gr->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
+  gr->GetZaxis()->SetTitle("<dEdx>");
+  gr->SetName("TPCdEdxMeanTanPt_1");
+  gr->GetHistogram()->Draw("colz"); 
+
+  if(folder) folder->Add(gr->GetHistogram());
+  //
+  gr = AliMathBase::MakeStat2D(comp->fTPCSignalNormTanSPt,3,1,5);
+  gr->GetXaxis()->SetTitle("Tan(#theta)");
+  gr->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
+  gr->GetZaxis()->SetTitle("#sigma_{dEdx}");
+  gr->SetName("TPCdEdxMeanTanPt_2");
+  gr->GetHistogram()->Draw("colz"); 
+
+  if(folder) folder->Add(gr->GetHistogram());
+
+  // set pointer to fAnalysisFolder
+  fAnalysisFolder = folder;
+}
+
+//_____________________________________________________________________________
+TFolder* AliComparisonDEdx::CreateFolder(TString name,TString title) { 
+// create folder for analysed histograms
+TFolder *folder = 0;
+  folder = new TFolder(name.Data(),title.Data());
+
+  return folder;
+}
+
index 6b6a345..a0311f7 100644 (file)
@@ -23,16 +23,36 @@ class TProfile;
 class TProfile2D;
 class TGraph2D;
 class TGraph; 
+class TString;
 
 #include "TNamed.h"
+#include "AliComparisonObject.h"
 
-class AliComparisonDEdx : public TNamed {
+//class AliComparisonDEdx : public TNamed {
+class AliComparisonDEdx : public AliComparisonObject {
 public :
   AliComparisonDEdx(); 
   ~AliComparisonDEdx();
-  void      InitHisto();
-  void      InitCuts();
-  void      Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+
+  // Init data members
+  virtual void Init();
+
+  // Execute analysis
+  virtual void Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+
+  // Merge output objects (needed by PROOF) 
+  virtual Long64_t Merge(TCollection* list);
+
+  // Analyse output histograms
+  virtual void Analyse();
+
+  // Get analysis folder
+  virtual TFolder* GetAnalysisFolder() {return fAnalysisFolder;}
+
+  // Create folder for analysed histograms
+  TFolder *CreateFolder(TString folder = "folderDEdx",TString title = "Analysed DEdx histograms");
+
+  // Process events
   void      Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
 
   // Selection cuts
@@ -51,12 +71,6 @@ public :
 
   static TH1F*     MakeResol(TH2F * his, Int_t integ, Bool_t type); 
 
-  // Merge output objects (needed by PROOF) 
-  virtual Long64_t Merge(TCollection* list);
-
-  // Analyse output histograms
-  void Analyse();
-
 private:
 
   // TPC dE/dx 
@@ -76,6 +90,9 @@ private:
   Float_t fMCAbsTanThetaMax;      // max. MC abs[tan(theta)] cut
   Int_t fMCPdgCode;               // selected particle with Pdg code
 
+  // analysis folder 
+  TFolder *fAnalysisFolder; // folder for analysed histograms
+
   AliComparisonDEdx(const AliComparisonDEdx&); // not implemented
   AliComparisonDEdx& operator=(const AliComparisonDEdx&); // not implemented
 
index 46278ff..747b260 100644 (file)
@@ -4,26 +4,31 @@
 // it keeps selection cuts used during comparison. The comparison \r
 // information is stored in the ROOT histograms. Analysis of these \r
 // histograms can be done by using Analyse() class function. The result of \r
-// the analysis (histograms) are stored in the output picture_eff.root file.\r
-//  \r
+// the analysis (histograms/graphs) are stored in the folder which is \r
+// a data member of AliComparisonEff.\r
+// \r
 // Author: J.Otwinowski 04/02/2008 \r
 //------------------------------------------------------------------------------\r
 \r
 /*\r
-  // after running analysis, read the file, and get component\r
\r
+  // after running comparison task, read the file, and get component\r
   gSystem->Load("libPWG1.so");\r
   TFile f("Output.root");\r
-  AliComparisonEff * comp = (AliComparisonEff*)f.Get("AliComparisonEff");\r
+  AliComparisonEff * compObj = (AliComparisonEff*)f.Get("AliComparisonEff");\r
 \r
+  // analyse comparison data\r
+  compObj->Analyse();\r
+\r
+  // the output histograms/graphs will be stored in the folder "folderEff" \r
+  compObj->GetAnalysisFolder()->ls("*");\r
+\r
+  // user can save whole comparison object (or only folder with anlysed histograms) \r
+  // in the seperate output file (e.g.)\r
+  TFile fout("Analysed_Eff.root","recreate");\r
+  compObj->Write(); // compObj->GetAnalysisFolder()->Write();\r
+  fout.Close();\r
 \r
-  // analyse comparison data (output stored in pictures_eff.root)\r
-  comp->Analyse();\r
\r
-  // paramtetrisation of the TPC track length (for information only)\r
-  TF1 fl("fl","((min(250./(abs(x+0.000001)),250)-90))",0,2);  // length function\r
-  TF1 fl2("fl2","[0]/((min(250./(abs(x+0.000001)),250)-90))^[1]",0,2);\r
-  fl2.SetParameter(1,1);\r
-  fl2.SetParameter(0,1);\r
 */\r
 \r
 \r
@@ -66,7 +71,7 @@ ClassImp(AliComparisonEff)
 \r
 //_____________________________________________________________________________\r
 AliComparisonEff::AliComparisonEff():\r
-  TNamed("AliComparisonEff","AliComparisonEff"),\r
+  AliComparisonObject("AliComparisonEff"),\r
 \r
   // histograms\r
  \r
@@ -103,7 +108,10 @@ AliComparisonEff::AliComparisonEff():
   fCutsRC(0), \r
   fCutsMC(0),\r
 \r
-  fVertex(0)\r
+  fVertex(0),\r
+\r
+  // histogram folder \r
+  fAnalysisFolder(0)\r
 {\r
   // init vertex\r
   fVertex = new AliESDVertex();\r
@@ -125,15 +133,14 @@ AliComparisonEff::AliComparisonEff():
        fTPCPtDCAXYPid[i]=0;   \r
        fTPCPtDCAZPid[i]=0; \r
   }\r
-  InitHisto();\r
-  InitCuts();\r
+  Init();\r
 }\r
 \r
 //_____________________________________________________________________________\r
 AliComparisonEff::~AliComparisonEff(){\r
 \r
   // \r
-  if(fMCPt)  delete  fEffTPCPt; fEffTPCPt=0;\r
+  if(fMCPt)  delete  fMCPt; fMCPt=0;\r
   if(fMCRecPt)  delete  fMCRecPt; fMCRecPt=0;\r
   if(fMCRecPrimPt)  delete  fMCRecPrimPt; fMCRecPrimPt=0;\r
   if(fMCRecSecPt)  delete  fMCRecSecPt; fMCRecSecPt=0;\r
@@ -184,10 +191,12 @@ AliComparisonEff::~AliComparisonEff(){
        if(fTPCPtDCAXYPid[i]) delete  fTPCPtDCAXYPid[i]; fTPCPtDCAXYPid[i]=0;\r
        if(fTPCPtDCAZPid[i]) delete   fTPCPtDCAZPid[i];  fTPCPtDCAZPid[i]=0;\r
   }\r
+\r
+  if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;\r
 }\r
 \r
 //_____________________________________________________________________________\r
-void AliComparisonEff::InitHisto(){\r
+void AliComparisonEff::Init(){\r
 \r
   // Init histograms\r
   //\r
@@ -317,16 +326,15 @@ void AliComparisonEff::InitHisto(){
     sprintf(name, "fTPCPtDCAZPid_%d",i);\r
        fTPCPtDCAZPid[i]= new TH3F(name,name,50,0.1,3,100,0,100,5,0,5);\r
   }\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliComparisonEff::InitCuts()\r
-{\r
 \r
+  // init cuts\r
   if(!fCutsMC) \r
     AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");\r
   if(!fCutsRC) \r
     AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");\r
+\r
+  // init folder\r
+  fAnalysisFolder = CreateFolder("folderEff","Analysis Efficiency Folder");\r
 }\r
 \r
 //_____________________________________________________________________________\r
@@ -335,8 +343,6 @@ void AliComparisonEff::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
   // Fill efficiency comparison information\r
   \r
   AliExternalTrackParam *track = 0;\r
-  Double_t kRadius    = 3.0;      // beam pipe radius\r
-  Double_t kMaxStep   = 5.0;      // max step\r
   Double_t field      = AliTracker::GetBz(); // nominal Bz field [kG]\r
   Double_t kMaxD      = 123456.0; // max distance\r
 \r
@@ -387,11 +393,8 @@ void AliComparisonEff::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
     {\r
       if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )\r
       {\r
-\r
-        Bool_t bStatus = AliTracker::PropagateTrackTo(track,kRadius,infoMC->GetMass(),kMaxStep,kTRUE);\r
         Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);\r
-\r
-               if(bStatus && bDCAStatus) {\r
+               if(bDCAStatus) {\r
                //\r
                cov[2] = track->GetCovariance()[2];\r
 \r
@@ -607,8 +610,7 @@ Long64_t AliComparisonEff::Merge(TCollection* list)
   while((obj = iter->Next()) != 0) \r
   {\r
     AliComparisonEff* entry = dynamic_cast<AliComparisonEff*>(obj);\r
-    if (entry == 0) \r
-      continue; \r
+    if (entry == 0) continue; \r
   \r
     fMCPt->Add(entry->fMCPt);\r
     fMCRecPt->Add(entry->fMCRecPt);\r
@@ -665,24 +667,29 @@ return count;
 //_____________________________________________________________________________\r
 void AliComparisonEff::Analyse() \r
 {\r
-  // Analyse output histograms\r
+  // Analyse comparison information and store output histograms\r
+  // in the folder "folderEff" \r
+  //\r
   \r
+  TH1::AddDirectory(kFALSE);\r
+\r
   AliComparisonEff * comp=this;\r
+  TFolder *folder = comp->GetAnalysisFolder();\r
 \r
-  // calculate efficiency and contamination (4 sigma) \r
+  // recreate folder every time\r
+  if(folder) delete folder;\r
+  folder = CreateFolder("folderEff","Analysis Eff Folder");\r
+  folder->SetOwner();\r
 \r
+  // calculate efficiency and contamination (4 sigma) \r
   TH1 *h_sigmaidealpid[20];\r
   TH1 *h_sigmafullpid[20];\r
   TH1 *h_sigmaday0pid[20];\r
 \r
-  //TH1 *h_sigmaday0pidclone[20];\r
-\r
   TH1 *h_sigmaidealpidtot[4];\r
   TH1 *h_sigmafullpidtot[4];\r
   TH1 *h_sigmaday0pidtot[4];\r
 \r
-  //TH1 *h_sigmaday0pidtotclone[4];\r
-\r
   char name[256];\r
   char name1[256];\r
   Int_t idx;\r
@@ -731,7 +738,6 @@ void AliComparisonEff::Analyse()
        sprintf(name,"h_sigmaday0pid_%d",idx);\r
        h_sigmaday0pid[idx] = comp->fTPCPtDCASigmaDay0Pid[i]->Project3D();\r
        h_sigmaday0pid[idx]->SetName(name);\r
-\r
        } \r
   }\r
 \r
@@ -772,70 +778,80 @@ void AliComparisonEff::Analyse()
     h_sigmaday0pid[idx+15]->Divide(h_sigmaday0pidtot[2]);\r
   }\r
 \r
-  // write results\r
-  TFile *fp = new TFile("pictures_eff.root","recreate");\r
-  fp->cd();\r
-\r
   TCanvas * c = new TCanvas("Efficiency","Track efficiency");\r
   c->cd();\r
 \r
-  fMCPt->Write();\r
-  fMCRecPt->Write();\r
-  fMCRecPrimPt->Write();\r
-  fMCRecSecPt->Write();\r
-\r
-  for(int i = 0; i<4;i++)  \r
-  {\r
-   comp->fTPCPtDCASigmaIdealPid[i]->GetYaxis()->SetRange();\r
-   comp->fTPCPtDCASigmaIdealPid[i]->GetZaxis()->SetRange();\r
-   comp->fTPCPtDCASigmaFullPid[i]->GetYaxis()->SetRange();\r
-   comp->fTPCPtDCASigmaFullPid[i]->GetZaxis()->SetRange();\r
-   comp->fTPCPtDCASigmaDay0Pid[i]->GetYaxis()->SetRange();\r
-   comp->fTPCPtDCASigmaDay0Pid[i]->GetZaxis()->SetRange();\r
-\r
-    comp->fTPCPtDCASigmaIdealPid[i]->Write();\r
-    comp->fTPCPtDCASigmaFullPid[i]->Write();\r
-    comp->fTPCPtDCASigmaDay0Pid[i]->Write();\r
-  }\r
   //\r
   comp->fEffTPCTanF->SetXTitle("Tan(#theta)");\r
   comp->fEffTPCTanF->SetYTitle("eff_{findable}");\r
-  comp->fEffTPCTanF->Write("EffTanFindable");\r
+  comp->fEffTPCTanF->SetName("EffTanFindable");\r
   //\r
   comp->fEffTPCTan->SetXTitle("Tan(#theta)");\r
   comp->fEffTPCTan->SetYTitle("eff_{all}");\r
-  comp->fEffTPCTan->Write("EffTanAll");\r
+  comp->fEffTPCTan->SetName("EffTanAll");\r
 \r
-  h_sigmaidealpidtot[1]->Write("Eff_SigmaIdeal");\r
-  h_sigmaidealpidtot[3]->Write("Cont_SigmaIdeal");\r
+  if(folder) folder->Add(comp->fEffTPCTanF);\r
+  if(folder) folder->Add(comp->fEffTPCTan);\r
 \r
-  h_sigmafullpidtot[1]->Write("Eff_SigmaFull");\r
-  h_sigmafullpidtot[3]->Write("Cont_SigmaFull");\r
+  h_sigmaidealpidtot[1]->SetName("Eff_SigmaIdeal");\r
+  h_sigmaidealpidtot[3]->SetName("Cont_SigmaIdeal");\r
 \r
-  h_sigmaday0pidtot[1]->Write("Eff_SigmaDay0");\r
-  h_sigmaday0pidtot[3]->Write("Cont_SigmaDay0");\r
+  if(folder) folder->Add(h_sigmaidealpidtot[1]);\r
+  if(folder) folder->Add(h_sigmaidealpidtot[3]);\r
+\r
+  h_sigmafullpidtot[1]->SetName("Eff_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
+\r
+  h_sigmaday0pidtot[1]->SetName("Eff_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
 \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
-    h_sigmaidealpid[idx+5]->Write(name);\r
-    h_sigmaidealpid[idx+15]->Write(name1);\r
+    h_sigmaidealpid[idx+5]->SetName(name);\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
 \r
     sprintf(name,"Eff_SigmaFull_%d",idx);\r
     sprintf(name1,"Cont_SigmaFull_%d",idx);\r
 \r
-    h_sigmafullpid[idx+5]->Write(name);\r
-    h_sigmafullpid[idx+15]->Write(name1);\r
+    h_sigmafullpid[idx+5]->SetName(name);\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
 \r
     sprintf(name,"Eff_SigmaDay0_%d",idx);\r
     sprintf(name1,"Cont_SigmaDay0_%d",idx);\r
 \r
-    h_sigmaday0pid[idx+5]->Write(name);\r
-    h_sigmaday0pid[idx+15]->Write(name1);\r
+    h_sigmaday0pid[idx+5]->SetName(name);\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
   }\r
 \r
-  //\r
-  fp->Close();\r
+  // set pointer to fAnalysisFolder\r
+  fAnalysisFolder = folder;\r
+\r
+}\r
+\r
+//_____________________________________________________________________________\r
+TFolder* AliComparisonEff::CreateFolder(TString name,TString title) { \r
+// create folder for analysed histograms\r
+//\r
+TFolder *folder = 0;\r
+  folder = new TFolder(name.Data(),title.Data());\r
+\r
+  return folder;\r
 }\r
index 6f7ccbb..74e3e90 100644 (file)
@@ -24,33 +24,49 @@ class TProfile2D;
 class TGraph2D;
 class TGraph; 
 class TGeoManager; 
+class TString;
 class TStatToolkit; 
 class AliMagFMaps;
 class AliESDVertex;
 
 #include "TNamed.h"
+#include "AliComparisonObject.h"
 
-class AliComparisonEff : public TNamed {
+class AliComparisonEff : public AliComparisonObject {
 public :
   AliComparisonEff(); 
   ~AliComparisonEff();
-  void InitHisto();
-  void InitCuts();
-  void Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+
+  // Init data members
+  virtual void Init();
+
+  // Execute analysis 
+  virtual void Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+
+  // Merge output objects (needed by PROOF) 
+  virtual Long64_t Merge(TCollection* list);
+
+  // Analyse output histograms 
+  virtual void Analyse();
+
+  // Get analysis folder
+  virtual TFolder* GetAnalysisFolder() {return fAnalysisFolder;}
+
+  // Create folder for analysed histograms
+  TFolder *CreateFolder(TString folder = "folderEff",TString title = "Analysed Efficiency histograms");
+
+  // Process events
   void Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
-  
+
   // Selection cuts
   void SetAliRecInfoCuts(AliRecInfoCuts* cuts=0) {fCutsRC = cuts;}
   void SetAliMCInfoCuts(AliMCInfoCuts* cuts=0) {fCutsMC = cuts;} 
   
+  // Getters
   AliRecInfoCuts*  GetAliRecInfoCuts() const {return fCutsRC;} 
   AliMCInfoCuts*   GetAliMCInfoCuts()  const {return fCutsMC;}
 
-  // Merge output objects (needed by PROOF) 
-  virtual Long64_t Merge(TCollection* list);
-
-  // Analyse output histograms 
-  void Analyse();
+   
 
 private:
 
@@ -100,9 +116,8 @@ private:
   TH3F* fTPCPtDCASigmaIdealPid[4]; //->TPC efficiency vs Pt vs DCA/Sigma (tan+-1)
   TH3F* fTPCPtDCASigmaFullPid[4];  //->TPC efficiency vs Pt vs DCA/Sigma (tan+-1, full systematics)
   TH3F* fTPCPtDCASigmaDay0Pid[4];  //->TPC efficiency vs Pt vs DCA/Sigma (tan+-1, goofie systematics)
-
-  TH3F* fTPCPtDCAXYPid[4];     //->TPC efficiency as Pt vs DCA_XY (tan+-1)
-  TH3F* fTPCPtDCAZPid[4];      //->TPC efficiency as Pt vs DCA_Z (tan+-1)
+  TH3F* fTPCPtDCAXYPid[4];     //->TPC efficiency vs Pt vs DCA_XY (tan+-1)
+  TH3F* fTPCPtDCAZPid[4];      //->TPC efficiency vs Pt vs DCA_Z (tan+-1)
 
   // Global cuts objects
   AliRecInfoCuts* fCutsRC;     // selection cuts for reconstructed tracks
@@ -111,6 +126,9 @@ private:
   // Magnet (needed for DCA calculations) 
   AliESDVertex* fVertex;  //! 
   
+  // analysis folder 
+  TFolder *fAnalysisFolder; // folder for analysed histograms
+
   AliComparisonEff(const AliComparisonEff&); // not implemented
   AliComparisonEff& operator=(const AliComparisonEff&); // not implemented
 
diff --git a/PWG1/AliComparisonObject.cxx b/PWG1/AliComparisonObject.cxx
new file mode 100644 (file)
index 0000000..41311c2
--- /dev/null
@@ -0,0 +1,35 @@
+//------------------------------------------------------------------------------
+// Implementation of abstract AliComparisonObject class. It keeps information from 
+// comparison of reconstructed and MC particle tracks. All comparison objects should 
+// derive from this class.
+//
+// Author: J.Otwinowski 14/04/2008 
+//------------------------------------------------------------------------------
+
+#include <iostream>
+
+#include "AliMCInfo.h" 
+#include "AliESDRecInfo.h" 
+#include "AliComparisonObject.h" 
+
+using namespace std;
+
+ClassImp(AliComparisonObject)
+
+//_____________________________________________________________________________
+AliComparisonObject::AliComparisonObject():
+  TNamed("AliComparisonObject","AliComparisonObject") {
+  // constructor
+}
+
+//_____________________________________________________________________________
+AliComparisonObject::AliComparisonObject(const char* name):
+  TNamed(name,name) {
+  // constructor
+}
+
+//_____________________________________________________________________________
+AliComparisonObject::~AliComparisonObject(){
+  // destructor 
+}
+
diff --git a/PWG1/AliComparisonObject.h b/PWG1/AliComparisonObject.h
new file mode 100644 (file)
index 0000000..fe8ed9c
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef ALICOMPARISONOBJECT_H\r
+#define ALICOMPARISONOBJECT_H\r
+\r
+//------------------------------------------------------------------------------\r
+// Abstract class to keep information from comparison of \r
+// reconstructed and MC particle tracks.   \r
+// \r
+// Author: J.Otwinowski 04/14/2008 \r
+//------------------------------------------------------------------------------\r
+\r
+#include "TNamed.h"\r
+#include "TFolder.h"\r
+\r
+class AliMCInfo;\r
+class AliESDRecInfo;\r
+\r
+class AliComparisonObject : public TNamed {\r
+public :\r
+  AliComparisonObject(); \r
+  AliComparisonObject(const char* name="AliComparisonObject"); \r
+  virtual ~AliComparisonObject();\r
+\r
+  // Init data members\r
+  // call once before event loop\r
+  virtual void Init() = 0;\r
+\r
+  // Execute analysis\r
+  // call in the event loop \r
+  virtual void Exec(AliMCInfo* infoMC=0, AliESDRecInfo *infoRC=0) = 0;\r
+\r
+  // Merge output objects (needed by PROOF) \r
+  virtual Long64_t Merge(TCollection* list=0) = 0;\r
+\r
+  // Analyse output histograms\r
+  virtual void Analyse() = 0;\r
+\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
+\r
+#endif\r
index 4606cdf..f23a7f6 100644 (file)
@@ -4,25 +4,31 @@
 // it keeps selection cuts used during comparison. The comparison 
 // information is stored in the ROOT histograms. Analysis of these 
 // histograms can be done by using Analyse() class function. The result of 
-// the analysis (histograms) are stored in the output picture_res.root file.
-//  
+// the analysis (histograms/graphs) are stored in the folder which is
+// a data member of AliComparisonRes.
+//
 // Author: J.Otwinowski 04/02/2008 
 //------------------------------------------------------------------------------
 
 /*
-  //after running analysis, read the file, and get component
+  // after running comparison task, read the file, and get component
   gSystem->Load("libPWG1.so");
   TFile f("Output.root");
-  AliComparisonRes * comp = (AliComparisonRes*)f.Get("AliComparisonRes");
+  AliComparisonRes * compObj = (AliComparisonRes*)f.Get("AliComparisonRes");
+
+  // analyse comparison data
+  compObj->Analyse();
+
+  // the output histograms/graphs will be stored in the folder "folderRes" 
+  compObj->GetAnalysisFolder()->ls("*");
+
+  // user can save whole comparison object (or only folder with anlysed histograms) 
+  // in the seperate output file (e.g.)
+  TFile fout("Analysed_Res.root","recreate");
+  compObj->Write(); // compObj->GetAnalysisFolder()->Write();
+  fout.Close();
 
-  // analyse comparison data (output stored in pictures_res.root)
-  comp->Analyse();
-  
-  // paramtetrisation of the TPC track length (for information only) 
-  TF1 fl("fl","((min(250./(abs(x+0.000001)),250)-90))",0,2);  // TPC track length function
-  TF1 fl2("fl2","[0]/((min(250./(abs(x+0.000001)),250)-90))^[1]",0,2);
-  fl2.SetParameter(1,1);
-  fl2.SetParameter(0,1);
 */
 
 #include <iostream>
@@ -61,7 +67,7 @@ ClassImp(AliComparisonRes)
 
 //_____________________________________________________________________________
 AliComparisonRes::AliComparisonRes():
-  TNamed("AliComparisonRes","AliComparisonRes"),
+  AliComparisonObject("AliComparisonRes"),
 
   // Resolution 
   fPtResolLPT(0),        // pt resolution - low pt
@@ -82,38 +88,40 @@ AliComparisonRes::AliComparisonRes():
   // Parametrisation histograms
   //
 
-  f1Pt2Resol1PtTPC(0),
-  f1Pt2Resol1PtTPCITS(0),
-  fYResol1PtTPC(0),
-  fYResol1PtTPCITS(0),
-  fZResol1PtTPC(0),
-  fZResol1PtTPCITS(0),
-  fPhiResol1PtTPC(0),
-  fPhiResol1PtTPCITS(0),
-  fThetaResol1PtTPC(0),
-  fThetaResol1PtTPCITS(0),
+  f1Pt2ResolS1PtTPC(0),
+  f1Pt2ResolS1PtTPCITS(0),
+  fYResolS1PtTPC(0),
+  fYResolS1PtTPCITS(0),
+  fZResolS1PtTPC(0),
+  fZResolS1PtTPCITS(0),
+  fPhiResolS1PtTPC(0),
+  fPhiResolS1PtTPCITS(0),
+  fThetaResolS1PtTPC(0),
+  fThetaResolS1PtTPCITS(0),
 
   // constrained
-  fC1Pt2Resol1PtTPC(0),
-  fC1Pt2Resol1PtTPCITS(0),
-  fCYResol1PtTPC(0),
-  fCYResol1PtTPCITS(0),
-  fCZResol1PtTPC(0),
-  fCZResol1PtTPCITS(0),
-  fCPhiResol1PtTPC(0),
-  fCPhiResol1PtTPCITS(0),
-  fCThetaResol1PtTPC(0),
-  fCThetaResol1PtTPCITS(0),
+  fC1Pt2ResolS1PtTPC(0),
+  fC1Pt2ResolS1PtTPCITS(0),
+  fCYResolS1PtTPC(0),
+  fCYResolS1PtTPCITS(0),
+  fCZResolS1PtTPC(0),
+  fCZResolS1PtTPCITS(0),
+  fCPhiResolS1PtTPC(0),
+  fCPhiResolS1PtTPCITS(0),
+  fCThetaResolS1PtTPC(0),
+  fCThetaResolS1PtTPCITS(0),
 
   // vertex
   fVertex(0),
  
   // Cuts 
   fCutsRC(0),  
-  fCutsMC(0)  
+  fCutsMC(0),  
+
+  // histogram folder 
+  fAnalysisFolder(0)
 {
-  InitHisto();
-  InitCuts();
+  Init();
   
   // vertex (0,0,0)
   fVertex = new AliESDVertex();
@@ -141,35 +149,36 @@ AliComparisonRes::~AliComparisonRes(){
 
   // Parametrisation histograms
   // 
-  if(f1Pt2Resol1PtTPC) delete f1Pt2Resol1PtTPC; f1Pt2Resol1PtTPC=0;
-  if(f1Pt2Resol1PtTPCITS) delete f1Pt2Resol1PtTPCITS; f1Pt2Resol1PtTPCITS=0;
-  if(fYResol1PtTPC) delete fYResol1PtTPC; fYResol1PtTPC=0;
-  if(fYResol1PtTPCITS) delete fYResol1PtTPCITS; fYResol1PtTPCITS=0;
-  if(fZResol1PtTPC) delete fZResol1PtTPC; fZResol1PtTPC=0;
-  if(fZResol1PtTPCITS) delete fZResol1PtTPCITS; fZResol1PtTPCITS=0;
-  if(fPhiResol1PtTPC) delete fPhiResol1PtTPC; fPhiResol1PtTPC=0;
-  if(fPhiResol1PtTPCITS) delete fPhiResol1PtTPCITS; fPhiResol1PtTPCITS=0;
-  if(fThetaResol1PtTPC) delete fThetaResol1PtTPC; fThetaResol1PtTPC=0;
-  if(fThetaResol1PtTPCITS) delete fThetaResol1PtTPCITS; fThetaResol1PtTPCITS=0;
+  if(f1Pt2ResolS1PtTPC) delete f1Pt2ResolS1PtTPC; f1Pt2ResolS1PtTPC=0;
+  if(f1Pt2ResolS1PtTPCITS) delete f1Pt2ResolS1PtTPCITS; f1Pt2ResolS1PtTPCITS=0;
+  if(fYResolS1PtTPC) delete fYResolS1PtTPC; fYResolS1PtTPC=0;
+  if(fYResolS1PtTPCITS) delete fYResolS1PtTPCITS; fYResolS1PtTPCITS=0;
+  if(fZResolS1PtTPC) delete fZResolS1PtTPC; fZResolS1PtTPC=0;
+  if(fZResolS1PtTPCITS) delete fZResolS1PtTPCITS; fZResolS1PtTPCITS=0;
+  if(fPhiResolS1PtTPC) delete fPhiResolS1PtTPC; fPhiResolS1PtTPC=0;
+  if(fPhiResolS1PtTPCITS) delete fPhiResolS1PtTPCITS; fPhiResolS1PtTPCITS=0;
+  if(fThetaResolS1PtTPC) delete fThetaResolS1PtTPC; fThetaResolS1PtTPC=0;
+  if(fThetaResolS1PtTPCITS) delete fThetaResolS1PtTPCITS; fThetaResolS1PtTPCITS=0;
 
   // constrained
-  if(fC1Pt2Resol1PtTPC) delete fC1Pt2Resol1PtTPC; fC1Pt2Resol1PtTPC=0;
-  if(fC1Pt2Resol1PtTPCITS) delete fC1Pt2Resol1PtTPCITS; fC1Pt2Resol1PtTPCITS=0;
-  if(fCYResol1PtTPC) delete fCYResol1PtTPC; fCYResol1PtTPC=0;
-  if(fCYResol1PtTPCITS) delete fCYResol1PtTPCITS; fCYResol1PtTPCITS=0;
-  if(fCZResol1PtTPC) delete fCZResol1PtTPC; fCZResol1PtTPC=0;
-  if(fCZResol1PtTPCITS) delete fCZResol1PtTPCITS; fCZResol1PtTPCITS=0;
-  if(fCPhiResol1PtTPC) delete fCPhiResol1PtTPC; fCPhiResol1PtTPC=0;
-  if(fCPhiResol1PtTPCITS) delete fCPhiResol1PtTPCITS; fCPhiResol1PtTPCITS=0;
-  if(fCThetaResol1PtTPC) delete fCThetaResol1PtTPC; fCThetaResol1PtTPC=0;
-  if(fCThetaResol1PtTPCITS) delete fCThetaResol1PtTPCITS; fCThetaResol1PtTPCITS=0;
+  if(fC1Pt2ResolS1PtTPC) delete fC1Pt2ResolS1PtTPC; fC1Pt2ResolS1PtTPC=0;
+  if(fC1Pt2ResolS1PtTPCITS) delete fC1Pt2ResolS1PtTPCITS; fC1Pt2ResolS1PtTPCITS=0;
+  if(fCYResolS1PtTPC) delete fCYResolS1PtTPC; fCYResolS1PtTPC=0;
+  if(fCYResolS1PtTPCITS) delete fCYResolS1PtTPCITS; fCYResolS1PtTPCITS=0;
+  if(fCZResolS1PtTPC) delete fCZResolS1PtTPC; fCZResolS1PtTPC=0;
+  if(fCZResolS1PtTPCITS) delete fCZResolS1PtTPCITS; fCZResolS1PtTPCITS=0;
+  if(fCPhiResolS1PtTPC) delete fCPhiResolS1PtTPC; fCPhiResolS1PtTPC=0;
+  if(fCPhiResolS1PtTPCITS) delete fCPhiResolS1PtTPCITS; fCPhiResolS1PtTPCITS=0;
+  if(fCThetaResolS1PtTPC) delete fCThetaResolS1PtTPC; fCThetaResolS1PtTPC=0;
+  if(fCThetaResolS1PtTPCITS) delete fCThetaResolS1PtTPCITS; fCThetaResolS1PtTPCITS=0;
 
   if(fVertex) delete fVertex; fVertex=0;
 
+  if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
 }
 
 //_____________________________________________________________________________
-void AliComparisonRes::InitHisto(){
+void AliComparisonRes::Init(){
 
   // Init histograms
   fCPhiResolTan = new TH2F("CPhiResolTan","CPhiResolTan",50, -2,2,200,-0.025,0.025);   
@@ -216,96 +225,95 @@ void AliComparisonRes::InitHisto(){
   // Parametrisation histograms
   // 
 
-  f1Pt2Resol1PtTPC = new TH2F("f1Pt2Resol1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,10,200,-0.010,0.010);  
-  f1Pt2Resol1PtTPC->SetXTitle("1/mcp_{t}");
-  f1Pt2Resol1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
+  f1Pt2ResolS1PtTPC = new TH2F("f1Pt2ResolS1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs sqrt(1/pt))",100,0,3,200,-0.010,0.010);  
+  f1Pt2ResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
+  f1Pt2ResolS1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
 
-  f1Pt2Resol1PtTPCITS = new TH2F("f1Pt2Resol1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,10,200,-0.010,0.010);  
-  f1Pt2Resol1PtTPCITS->SetXTitle("1/mcp_{t}");
-  f1Pt2Resol1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
+  f1Pt2ResolS1PtTPCITS = new TH2F("f1Pt2ResolS1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs sqrt(1/pt))",100,0,3,200,-0.010,0.010);  
+  f1Pt2ResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
+  f1Pt2ResolS1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
 
-  fYResol1PtTPC = new TH2F("fYResol1PtTPC","fYResol1PtTPC",100, 0,10,200,-1.0,1.0);   
-  fYResol1PtTPC->SetXTitle("1/mcpt");
-  fYResol1PtTPC->SetYTitle("#DeltaY");
+  fYResolS1PtTPC = new TH2F("fYResolS1PtTPC","fYResolS1PtTPC",100, 0,3,200,-1.0,1.0);   
+  fYResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
+  fYResolS1PtTPC->SetYTitle("#DeltaY");
 
-  fYResol1PtTPCITS = new TH2F("fYResol1PtTPCITS","fYResol1PtTPCITS",100, 0,10,200,-0.05,0.05);   
-  fYResol1PtTPCITS->SetXTitle("1/mcpt");
-  fYResol1PtTPCITS->SetYTitle("#DeltaY");
+  fYResolS1PtTPCITS = new TH2F("fYResolS1PtTPCITS","fYResolS1PtTPCITS",100, 0,3,200,-0.05,0.05);   
+  fYResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
+  fYResolS1PtTPCITS->SetYTitle("#DeltaY");
 
-  fZResol1PtTPC = new TH2F("fZResol1PtTPC","fZResol1PtTPC",100, 0,10,200,-1.0,1.0);   
-  fZResol1PtTPC->SetXTitle("1/mcpt");
-  fZResol1PtTPC->SetYTitle("#DeltaZ");
+  fZResolS1PtTPC = new TH2F("fZResolS1PtTPC","fZResolS1PtTPC",100, 0,3,200,-1.0,1.0);   
+  fZResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
+  fZResolS1PtTPC->SetYTitle("#DeltaZ");
 
-  fZResol1PtTPCITS = new TH2F("fZResol1PtTPCITS","fZResol1PtTPCITS",100, 0,10,200,-0.05,0.05);   
-  fZResol1PtTPCITS->SetXTitle("1/mcpt");
-  fZResol1PtTPCITS->SetYTitle("#DeltaZ");
+  fZResolS1PtTPCITS = new TH2F("fZResolS1PtTPCITS","fZResolS1PtTPCITS",100, 0,3,200,-0.05,0.05);   
+  fZResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
+  fZResolS1PtTPCITS->SetYTitle("#DeltaZ");
 
-  fPhiResol1PtTPC = new TH2F("fPhiResol1PtTPC","fPhiResol1PtTPC",100, 0,10,200,-0.025,0.025);   
-  fPhiResol1PtTPC->SetXTitle("1/mcpt");
-  fPhiResol1PtTPC->SetYTitle("#Delta#phi");
+  fPhiResolS1PtTPC = new TH2F("fPhiResolS1PtTPC","fPhiResolS1PtTPC",100, 0,3,200,-0.025,0.025);   
+  fPhiResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
+  fPhiResolS1PtTPC->SetYTitle("#Delta#phi");
 
-  fPhiResol1PtTPCITS = new TH2F("fPhiResol1PtTPCITS","fPhiResol1PtTPCITS",100, 0,10,200,-0.01,0.01);   
-  fPhiResol1PtTPCITS->SetXTitle("1/mcpt");
-  fPhiResol1PtTPCITS->SetYTitle("#Delta#phi");
+  fPhiResolS1PtTPCITS = new TH2F("fPhiResolS1PtTPCITS","fPhiResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);   
+  fPhiResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
+  fPhiResolS1PtTPCITS->SetYTitle("#Delta#phi");
 
-  fThetaResol1PtTPC = new TH2F("fThetaResol1PtTPC","fThetaResol1PtTPC",100, 0,10,200,-0.025,0.025);   
-  fThetaResol1PtTPC->SetXTitle("1/mcpt");
-  fThetaResol1PtTPC->SetYTitle("#Delta#theta");
+  fThetaResolS1PtTPC = new TH2F("fThetaResolS1PtTPC","fThetaResolS1PtTPC",100, 0,3,200,-0.025,0.025);   
+  fThetaResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
+  fThetaResolS1PtTPC->SetYTitle("#Delta#theta");
 
-  fThetaResol1PtTPCITS = new TH2F("fThetaResol1PtTPCITS","fThetaResol1PtTPCITS",100, 0,10,200,-0.01,0.01);   
-  fThetaResol1PtTPCITS->SetXTitle("1/mcpt");
-  fThetaResol1PtTPCITS->SetYTitle("#Delta#theta");
+  fThetaResolS1PtTPCITS = new TH2F("fThetaResolS1PtTPCITS","fThetaResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);   
+  fThetaResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
+  fThetaResolS1PtTPCITS->SetYTitle("#Delta#theta");
   
   // constrained
-  fC1Pt2Resol1PtTPC = new TH2F("fC1Pt2Resol1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,10,200,-0.010,0.010);  
-  fC1Pt2Resol1PtTPC->SetXTitle("1/mcp_{t}");
-  fC1Pt2Resol1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
+  fC1Pt2ResolS1PtTPC = new TH2F("fC1Pt2ResolS1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,3,200,-0.010,0.010);  
+  fC1Pt2ResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
+  fC1Pt2ResolS1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
 
-  fC1Pt2Resol1PtTPCITS = new TH2F("fC1Pt2Resol1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,10,200,-0.010,0.010);  
-  fC1Pt2Resol1PtTPCITS->SetXTitle("1/mcp_{t}");
-  fC1Pt2Resol1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
+  fC1Pt2ResolS1PtTPCITS = new TH2F("fC1Pt2ResolS1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,3,200,-0.010,0.010);  
+  fC1Pt2ResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
+  fC1Pt2ResolS1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
 
-  fCYResol1PtTPC = new TH2F("fCYResol1PtTPC","fCYResol1PtTPC",100, 0,10,200,-1.0,1.0);   
-  fCYResol1PtTPC->SetXTitle("1/mcpt");
-  fCYResol1PtTPC->SetYTitle("#DeltaY");
+  fCYResolS1PtTPC = new TH2F("fCYResolS1PtTPC","fCYResolS1PtTPC",100, 0,3,200,-1.0,1.0);   
+  fCYResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
+  fCYResolS1PtTPC->SetYTitle("#DeltaY");
 
-  fCYResol1PtTPCITS = new TH2F("fCYResol1PtTPCITS","fCYResol1PtTPCITS",100, 0,10,200,-0.05,0.05);   
-  fCYResol1PtTPCITS->SetXTitle("1/mcpt");
-  fCYResol1PtTPCITS->SetYTitle("#DeltaY");
+  fCYResolS1PtTPCITS = new TH2F("fCYResolS1PtTPCITS","fCYResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);   
+  fCYResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
+  fCYResolS1PtTPCITS->SetYTitle("#DeltaY");
 
-  fCZResol1PtTPC = new TH2F("fCZResol1PtTPC","fCZResol1PtTPC",100, 0,10,200,-1.0,1.0);   
-  fCZResol1PtTPC->SetXTitle("1/mcpt");
-  fCZResol1PtTPC->SetYTitle("#DeltaZ");
+  fCZResolS1PtTPC = new TH2F("fCZResolS1PtTPC","fCZResolS1PtTPC",100, 0,3,200,-1.0,1.0);   
+  fCZResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
+  fCZResolS1PtTPC->SetYTitle("#DeltaZ");
 
-  fCZResol1PtTPCITS = new TH2F("fCZResol1PtTPCITS","fCZResol1PtTPCITS",100, 0,10,200,-0.05,0.05);   
-  fCZResol1PtTPCITS->SetXTitle("1/mcpt");
-  fCZResol1PtTPCITS->SetYTitle("#DeltaZ");
+  fCZResolS1PtTPCITS = new TH2F("fCZResolS1PtTPCITS","fCZResolS1PtTPCITS",100, 0,3,200,-0.025,0.025);   
+  fCZResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
+  fCZResolS1PtTPCITS->SetYTitle("#DeltaZ");
 
-  fCPhiResol1PtTPC = new TH2F("fCPhiResol1PtTPC","fCPhiResol1PtTPC",100, 0,10,200,-0.025,0.025);   
-  fCPhiResol1PtTPC->SetXTitle("1/mcpt");
-  fCPhiResol1PtTPC->SetYTitle("#Delta#phi");
+  fCPhiResolS1PtTPC = new TH2F("fCPhiResolS1PtTPC","fCPhiResolS1PtTPC",100, 0,3,200,-0.025,0.025);   
+  fCPhiResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
+  fCPhiResolS1PtTPC->SetYTitle("#Delta#phi");
 
-  fCPhiResol1PtTPCITS = new TH2F("fCPhiResol1PtTPCITS","fCPhiResol1PtTPCITS",100, 0,10,200,-0.01,0.01);   
-  fCPhiResol1PtTPCITS->SetXTitle("1/mcpt");
-  fCPhiResol1PtTPCITS->SetYTitle("#Delta#phi");
+  fCPhiResolS1PtTPCITS = new TH2F("fCPhiResolS1PtTPCITS","fCPhiResolS1PtTPCITS",100, 0,3,200,-0.003,0.003);   
+  fCPhiResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
+  fCPhiResolS1PtTPCITS->SetYTitle("#Delta#phi");
 
-  fCThetaResol1PtTPC = new TH2F("fCThetaResol1PtTPC","fCThetaResol1PtTPC",100, 0,10,200,-0.025,0.025);   
-  fCThetaResol1PtTPC->SetXTitle("1/mcpt");
-  fCThetaResol1PtTPC->SetYTitle("#Delta#theta");
+  fCThetaResolS1PtTPC = new TH2F("fCThetaResolS1PtTPC","fCThetaResolS1PtTPC",100, 0,3,200,-0.025,0.025);   
+  fCThetaResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
+  fCThetaResolS1PtTPC->SetYTitle("#Delta#theta");
 
-  fCThetaResol1PtTPCITS = new TH2F("fCThetaResol1PtTPCITS","fCThetaResol1PtTPCITS",100, 0,10,200,-0.01,0.01);   
-  fCThetaResol1PtTPCITS->SetXTitle("1/mcpt");
-  fCThetaResol1PtTPCITS->SetYTitle("#Delta#theta");
-}
+  fCThetaResolS1PtTPCITS = new TH2F("fCThetaResolS1PtTPCITS","fCThetaResolS1PtTPCITS",100, 0,3,200,-0.005,0.005);   
+  fCThetaResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
+  fCThetaResolS1PtTPCITS->SetYTitle("#Delta#theta");
 
-//_____________________________________________________________________________
-void AliComparisonRes::InitCuts()
-{
   // Init cuts 
   if(!fCutsMC) 
     AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
   if(!fCutsRC) 
     AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
+
+  // init folder
+  fAnalysisFolder = CreateFolder("folderRes","Analysis Resolution Folder");
 }
 
 //_____________________________________________________________________________
@@ -313,8 +321,6 @@ void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
 {
   // Fill resolution comparison information 
   AliExternalTrackParam *track = 0;
-  Double_t kRadius    = 3.0;      // beam pipe radius
-  Double_t kMaxStep   = 5.0;      // max step
   Double_t field      = AliTracker::GetBz(); // nominal Bz field [kG]
   Double_t kMaxD      = 123456.0; // max distance
 
@@ -325,6 +331,7 @@ void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
   Float_t deltaPtTPC, pullPtTPC, deltaPhiTPC, deltaTanTPC, delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC; 
 
   Float_t mcpt = infoMC->GetParticle().Pt();
+  Float_t s1mcpt = TMath::Sqrt(1./infoMC->GetParticle().Pt());
 
   // distance to Prim. vertex 
   const Double_t* dv = infoMC->GetVDist(); 
@@ -333,7 +340,6 @@ void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
   // Check selection cuts
   if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; 
   if (!isPrim) return;
-  //if (infoRC->GetStatus(1)==0) return;
   if (infoRC->GetStatus(1)!=3) return; // TPC refit
   if (!infoRC->GetESDtrack()) return;  
   if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
@@ -357,24 +363,16 @@ void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
   deltaPhi1Pt = deltaPhi   / (0.1+1/mcpt);
   deltaTheta1Pt = deltaTan / (0.1+1/mcpt);
 
-  //track parameters at the first measured point (TPC) 
-  //Double_t param[5],x,alpha; // [0]-Y [cm],[1]-Z [cm],[2]-sin(phi),[3]-tan(theta),[4]-1/pt [1/GeV]   
-  //infoRC->GetESDtrack()->GetInnerExternalParameters(alpha,x,param);
-  //const AliExternalTrackParam *innerTPC =  infoRC->GetESDtrack()->GetInnerParam(); 
-  //const AliExternalTrackParam *innerTPC =  infoRC->GetESDtrack()->GetTPCInnerParam(); 
-
-
   // calculate track parameters at vertex
   const AliExternalTrackParam *innerTPC =  0;
   if ((innerTPC = infoRC->GetESDtrack()->GetTPCInnerParam()) != 0)
   {
     if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
     {
-      Bool_t bStatus = AliTracker::PropagateTrackTo(track,kRadius,infoMC->GetMass(),kMaxStep,kTRUE);
       Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);
 
       // Fill parametrisation histograms (only TPC track)
-      if(bStatus && bDCAStatus) 
+      if(bDCAStatus) 
          {
                        deltaPtTPC= (mcpt-innerTPC->Pt())/mcpt;  
                        pullPtTPC= (1/mcpt-innerTPC->OneOverPt())/TMath::Sqrt(innerTPC->GetSigma1Pt2());  
@@ -390,11 +388,11 @@ void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
                        deltaPhi1PtTPC = deltaPhiTPC   / (0.1+1/mcpt);
                        deltaTheta1PtTPC = deltaTanTPC / (0.1+1/mcpt);
 
-                       f1Pt2Resol1PtTPC->Fill(1/mcpt,delta1Pt2TPC);
-                       fYResol1PtTPC->Fill(1/mcpt,deltaY1PtTPC);
-                       fZResol1PtTPC->Fill(1/mcpt,deltaZ1PtTPC);
-                       fPhiResol1PtTPC->Fill(1/mcpt,deltaPhi1PtTPC);
-                       fThetaResol1PtTPC->Fill(1/mcpt,deltaTheta1PtTPC);
+                       f1Pt2ResolS1PtTPC->Fill(s1mcpt,delta1Pt2TPC);
+                       fYResolS1PtTPC->Fill(s1mcpt,deltaY1PtTPC);
+                       fZResolS1PtTPC->Fill(s1mcpt,deltaZ1PtTPC);
+                       fPhiResolS1PtTPC->Fill(s1mcpt,deltaPhi1PtTPC);
+                       fThetaResolS1PtTPC->Fill(s1mcpt,deltaTheta1PtTPC);
          }
          delete track;
     }
@@ -403,11 +401,11 @@ void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
   // TPC and ITS (nb. of clusters >2) in the system
   if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>2) 
   {
-      f1Pt2Resol1PtTPCITS->Fill(1/mcpt,delta1Pt2);
-      fYResol1PtTPCITS->Fill(1/mcpt,deltaY1Pt);
-      fZResol1PtTPCITS->Fill(1/mcpt,deltaZ1Pt);
-      fPhiResol1PtTPCITS->Fill(1/mcpt,deltaPhi1Pt);
-      fThetaResol1PtTPCITS->Fill(1/mcpt,deltaTheta1Pt);
+      f1Pt2ResolS1PtTPCITS->Fill(s1mcpt,delta1Pt2);
+      fYResolS1PtTPCITS->Fill(s1mcpt,deltaY1Pt);
+      fZResolS1PtTPCITS->Fill(s1mcpt,deltaZ1Pt);
+      fPhiResolS1PtTPCITS->Fill(s1mcpt,deltaPhi1Pt);
+      fThetaResolS1PtTPCITS->Fill(s1mcpt,deltaTheta1Pt);
   }
 
   // Fill histograms
@@ -423,8 +421,6 @@ void AliComparisonRes::ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *info
   // Fill resolution comparison information (constarained parameters) 
   //
   AliExternalTrackParam *track = 0;
-  Double_t kRadius    = 3.0;      // beam pipe radius
-  Double_t kMaxStep   = 5.0;      // max step
   Double_t field      = AliTracker::GetBz(); // nominal Bz field [kG]
   Double_t kMaxD      = 123456.0; // max distance
 
@@ -435,6 +431,7 @@ void AliComparisonRes::ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *info
   Float_t deltaPtTPC, pullPtTPC, deltaPhiTPC, deltaTanTPC, delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC; 
 
   Float_t mcpt = infoMC->GetParticle().Pt();
+  Float_t s1mcpt = TMath::Sqrt(1./infoMC->GetParticle().Pt());
   Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
 
   // distance to Prim. vertex 
@@ -478,11 +475,10 @@ void AliComparisonRes::ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *info
   {
     if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
     {
-      Bool_t bStatus = AliTracker::PropagateTrackTo(track,kRadius,infoMC->GetMass(),kMaxStep,kTRUE);
       Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);
 
       // Fill parametrisation histograms (only TPC track)
-      if(bStatus && bDCAStatus) 
+      if(bDCAStatus) 
          {
                  deltaPtTPC= (mcpt-innerTPC->Pt())/mcpt;  
                  pullPtTPC= (1/mcpt-innerTPC->OneOverPt())/TMath::Sqrt(innerTPC->GetSigma1Pt2());  
@@ -498,11 +494,11 @@ void AliComparisonRes::ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *info
                  deltaPhi1PtTPC = deltaPhiTPC   / (0.1+1/mcpt);
                  deltaTheta1PtTPC = deltaTanTPC / (0.1+1/mcpt);
 
-          fC1Pt2Resol1PtTPC->Fill(1/mcpt,delta1Pt2TPC);
-          fCYResol1PtTPC->Fill(1/mcpt,deltaY1PtTPC);
-          fCZResol1PtTPC->Fill(1/mcpt,deltaZ1PtTPC);
-          fCPhiResol1PtTPC->Fill(1/mcpt,deltaPhi1PtTPC);
-          fCThetaResol1PtTPC->Fill(1/mcpt,deltaTheta1PtTPC);
+          fC1Pt2ResolS1PtTPC->Fill(s1mcpt,delta1Pt2TPC);
+          fCYResolS1PtTPC->Fill(s1mcpt,deltaY1PtTPC);
+          fCZResolS1PtTPC->Fill(s1mcpt,deltaZ1PtTPC);
+          fCPhiResolS1PtTPC->Fill(s1mcpt,deltaPhi1PtTPC);
+          fCThetaResolS1PtTPC->Fill(s1mcpt,deltaTheta1PtTPC);
          }
          delete track;
     }
@@ -511,11 +507,11 @@ void AliComparisonRes::ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *info
  // TPC and ITS (nb. of clusters >2) in the system
   if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>2) 
   {
-      fC1Pt2Resol1PtTPCITS->Fill(1/mcpt,delta1Pt2);
-      fCYResol1PtTPCITS->Fill(1/mcpt,deltaY1Pt);
-      fCZResol1PtTPCITS->Fill(1/mcpt,deltaZ1Pt);
-      fCPhiResol1PtTPCITS->Fill(1/mcpt,deltaPhi1Pt);
-      fCThetaResol1PtTPCITS->Fill(1/mcpt,deltaTheta1Pt);
+      fC1Pt2ResolS1PtTPCITS->Fill(s1mcpt,delta1Pt2);
+      fCYResolS1PtTPCITS->Fill(s1mcpt,deltaY1Pt);
+      fCZResolS1PtTPCITS->Fill(s1mcpt,deltaZ1Pt);
+      fCPhiResolS1PtTPCITS->Fill(s1mcpt,deltaPhi1Pt);
+      fCThetaResolS1PtTPCITS->Fill(s1mcpt,deltaTheta1Pt);
   }
 
   // Fill histograms
@@ -549,14 +545,22 @@ TH1F* AliComparisonRes::MakeResol(TH2F * his, Int_t integ, Bool_t type){
 
 //_____________________________________________________________________________
 void AliComparisonRes::Analyse(){
-  // Analyse comparison information and store output histograms 
-  // in the "pictures_res.root" file 
-  
+  // Analyse comparison information and store output histograms
+  // in the folder "folderRes"
+  //
+  TH1::AddDirectory(kFALSE);
+
   AliComparisonRes * comp=this;
+  TFolder *folder = comp->GetAnalysisFolder();
   TH1F *hiss=0;
 
-  TFile *fp = new TFile("pictures_res.root","recreate");
-  fp->cd();
+  // recreate folder every time
+  if(folder) delete folder;
+  folder = CreateFolder("folderRes","Analysis Res Folder");
+  folder->SetOwner();
+
+  // write results in the folder 
 
   TCanvas * c = new TCanvas("Phi resol Tan","Phi resol Tan");
   c->cd();
@@ -565,168 +569,198 @@ void AliComparisonRes::Analyse(){
   hiss->SetXTitle("Tan(#theta)");
   hiss->SetYTitle("#sigmap_{t}/p_{t}");
   hiss->Draw(); 
-  hiss->Write("CptResolTan");
+  hiss->SetName("CptResolTan");
+  
+  if(folder) folder->Add(hiss);
+
   //
   hiss = comp->MakeResol(comp->fCPhiResolTan,1,0);
   hiss->SetXTitle("Tan(#theta)");
   hiss->SetYTitle("#sigma#phi (rad)");
   hiss->Draw();
-  hiss->Write("PhiResolTan");
+  hiss->SetName("PhiResolTan");
+  
+  if(folder) folder->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fCTanResolTan,1,0);
   hiss->SetXTitle("Tan(#theta)");
   hiss->SetYTitle("#sigma#theta (rad)");
   hiss->Draw();
-  hiss->Write("ThetaResolTan");
+  hiss->SetName("ThetaResolTan");
+  
+  if(folder) folder->Add(hiss);
   //
   hiss = comp->MakeResol(comp->fCPtPullTan,1,0);
   hiss->SetXTitle("Tan(#theta)");
   hiss->SetYTitle("1/mcp_{t}-1/p_{t}/#Sigma(1/p_{t})");
   hiss->Draw();
-  hiss->Write("CptPullTan");
+  hiss->SetName("CptPullTan");
+  
+  if(folder) folder->Add(hiss);
   //
-  hiss = comp->MakeResol(comp->fC1Pt2Resol1PtTPC,1,0);
+  hiss = comp->MakeResol(comp->fC1Pt2ResolS1PtTPC,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
   hiss->Draw();
-  hiss->Write("C1Pt2Resol1PtTPC");
-  fC1Pt2Resol1PtTPC->Write();
+  hiss->SetName("C1Pt2ResolS1PtTPC");
+  
+  if(folder) folder->Add(hiss);
 
-  hiss = comp->MakeResol(comp->fC1Pt2Resol1PtTPCITS,1,0);
+  hiss = comp->MakeResol(comp->fC1Pt2ResolS1PtTPCITS,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
   hiss->Draw();
-  hiss->Write("C1Pt2Resol1PtTPCITS");
-  fC1Pt2Resol1PtTPCITS->Write();
+  hiss->SetName("C1Pt2ResolS1PtTPCITS");
+  
+  if(folder) folder->Add(hiss);
   //
-  hiss = comp->MakeResol(comp->fCYResol1PtTPC,1,0);
+  hiss = comp->MakeResol(comp->fCYResolS1PtTPC,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("CYResol1PtTPC");
-  fCYResol1PtTPC->Write();
+  hiss->SetName("CYResolS1PtTPC");
+  
+  if(folder) folder->Add(hiss);
 
-  hiss = comp->MakeResol(comp->fCYResol1PtTPCITS,1,0);
+  hiss = comp->MakeResol(comp->fCYResolS1PtTPCITS,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("CYResol1PtTPCITS");
-  fCYResol1PtTPCITS->Write();
+  hiss->SetName("CYResolS1PtTPCITS");
+  
+  if(folder) folder->Add(hiss);
   //
-  hiss = comp->MakeResol(comp->fCZResol1PtTPC,1,0);
+  hiss = comp->MakeResol(comp->fCZResolS1PtTPC,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("CZResol1PtTPC");
-  fCZResol1PtTPC->Write();
+  hiss->SetName("CZResolS1PtTPC");
+  
+  if(folder) folder->Add(hiss);
 
-  hiss = comp->MakeResol(comp->fCZResol1PtTPCITS,1,0);
+  hiss = comp->MakeResol(comp->fCZResolS1PtTPCITS,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("CZResol1PtTPCITS");
-  fCZResol1PtTPCITS->Write();
+  hiss->SetName("CZResolS1PtTPCITS");
+  
+  if(folder) folder->Add(hiss);
   //
-  hiss = comp->MakeResol(comp->fCPhiResol1PtTPC,1,0);
+  hiss = comp->MakeResol(comp->fCPhiResolS1PtTPC,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("CPhiResol1PtTPC");
-  fCPhiResol1PtTPC->Write();
+  hiss->SetName("CPhiResolS1PtTPC");
+  
+  if(folder) folder->Add(hiss);
 
-  hiss = comp->MakeResol(comp->fCPhiResol1PtTPCITS,1,0);
+  hiss = comp->MakeResol(comp->fCPhiResolS1PtTPCITS,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("CPhiResol1PtTPCITS");
-  fCPhiResol1PtTPCITS->Write();
+  hiss->SetName("CPhiResolS1PtTPCITS");
+  
+  if(folder) folder->Add(hiss);
   //
-  hiss = comp->MakeResol(comp->fCThetaResol1PtTPC,1,0);
+  hiss = comp->MakeResol(comp->fCThetaResolS1PtTPC,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("CThetaResol1PtTPC");
-  fCThetaResol1PtTPC->Write();
+  hiss->SetName("CThetaResolS1PtTPC");
+  
+  if(folder) folder->Add(hiss);
 
-  hiss = comp->MakeResol(comp->fCThetaResol1PtTPCITS,1,0);
+  hiss = comp->MakeResol(comp->fCThetaResolS1PtTPCITS,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("CThetaResol1PtTPCITS");
-  fCThetaResol1PtTPCITS->Write();
+  hiss->SetName("CThetaResolS1PtTPCITS");
+  
+  if(folder) folder->Add(hiss);
 
   //
-  hiss = comp->MakeResol(comp->f1Pt2Resol1PtTPC,1,0);
+  hiss = comp->MakeResol(comp->f1Pt2ResolS1PtTPC,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
   hiss->Draw();
-  hiss->Write("OnePt2Resol1PtTPC");
-  f1Pt2Resol1PtTPC->Write();
+  hiss->SetName("OnePt2ResolS1PtTPC");
+  
+  if(folder) folder->Add(hiss);
 
-  hiss = comp->MakeResol(comp->f1Pt2Resol1PtTPCITS,1,0);
+  hiss = comp->MakeResol(comp->f1Pt2ResolS1PtTPCITS,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
   hiss->Draw();
-  hiss->Write("OnePt2Resol1PtTPCITS");
-  f1Pt2Resol1PtTPCITS->Write();
+  hiss->SetName("OnePt2ResolS1PtTPCITS");
+  
+  if(folder) folder->Add(hiss);
   //
-  hiss = comp->MakeResol(comp->fYResol1PtTPC,1,0);
+  hiss = comp->MakeResol(comp->fYResolS1PtTPC,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("YResol1PtTPC");
-  fYResol1PtTPC->Write();
+  hiss->SetName("YResolS1PtTPC");
+  
+  if(folder) folder->Add(hiss);
 
-  hiss = comp->MakeResol(comp->fYResol1PtTPCITS,1,0);
+  hiss = comp->MakeResol(comp->fYResolS1PtTPCITS,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("YResol1PtTPCITS");
-  fYResol1PtTPCITS->Write();
+  hiss->SetName("YResolS1PtTPCITS");
+  
+  if(folder) folder->Add(hiss);
   //
-  hiss = comp->MakeResol(comp->fZResol1PtTPC,1,0);
+  hiss = comp->MakeResol(comp->fZResolS1PtTPC,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("ZResol1PtTPC");
-  fZResol1PtTPC->Write();
+  hiss->SetName("ZResolS1PtTPC");
+  
+  if(folder) folder->Add(hiss);
 
-  hiss = comp->MakeResol(comp->fZResol1PtTPCITS,1,0);
+  hiss = comp->MakeResol(comp->fZResolS1PtTPCITS,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("ZResol1PtTPCITS");
-  fZResol1PtTPCITS->Write();
+  hiss->SetName("ZResolS1PtTPCITS");
+  
+  if(folder) folder->Add(hiss);
   //
-  hiss = comp->MakeResol(comp->fPhiResol1PtTPC,1,0);
+  hiss = comp->MakeResol(comp->fPhiResolS1PtTPC,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("PhiResol1PtTPC");
-  fPhiResol1PtTPC->Write();
+  hiss->SetName("PhiResolS1PtTPC");
+  
+  if(folder) folder->Add(hiss);
 
-  hiss = comp->MakeResol(comp->fPhiResol1PtTPCITS,1,0);
+  hiss = comp->MakeResol(comp->fPhiResolS1PtTPCITS,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("PhiResol1PtTPCITS");
-  fPhiResol1PtTPCITS->Write();
+  hiss->SetName("PhiResolS1PtTPCITS");
+  
+  if(folder) folder->Add(hiss);
   //
-  hiss = comp->MakeResol(comp->fThetaResol1PtTPC,1,0);
+  hiss = comp->MakeResol(comp->fThetaResolS1PtTPC,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("ThetaResol1PtTPC");
-  fThetaResol1PtTPC->Write();
+  hiss->SetName("ThetaResolS1PtTPC");
+  
+  if(folder) folder->Add(hiss);
 
-  hiss = comp->MakeResol(comp->fThetaResol1PtTPCITS,1,0);
+  hiss = comp->MakeResol(comp->fThetaResolS1PtTPCITS,1,0);
   hiss->SetXTitle("1/mcp_{t}");
   hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
   hiss->Draw();
-  hiss->Write("ThetaResol1PtTPCITS");
-  fThetaResol1PtTPCITS->Write();
+  hiss->SetName("ThetaResolS1PtTPCITS");
+  
+  if(folder) folder->Add(hiss);
 
-  fp->Close();
+  // set pointer to fAnalysisFolder
+  fAnalysisFolder = folder;
 }
 
 //_____________________________________________________________________________
@@ -756,17 +790,17 @@ Long64_t AliComparisonRes::Merge(TCollection* list)
   fPtPullHPT->Add(entry->fPtPullHPT);
 
   // Histograms for 1/pt parameterisation
-  f1Pt2Resol1PtTPC->Add(entry->f1Pt2Resol1PtTPC);
-  fYResol1PtTPC->Add(entry->fYResol1PtTPC);
-  fZResol1PtTPC->Add(entry->fZResol1PtTPC);
-  fPhiResol1PtTPC->Add(entry->fPhiResol1PtTPC);
-  fThetaResol1PtTPC->Add(entry->fThetaResol1PtTPC);
-
-  f1Pt2Resol1PtTPCITS->Add(entry->f1Pt2Resol1PtTPCITS);
-  fYResol1PtTPCITS->Add(entry->fYResol1PtTPCITS);
-  fZResol1PtTPCITS->Add(entry->fZResol1PtTPCITS);
-  fPhiResol1PtTPCITS->Add(entry->fPhiResol1PtTPCITS);
-  fThetaResol1PtTPCITS->Add(entry->fThetaResol1PtTPCITS);
+  f1Pt2ResolS1PtTPC->Add(entry->f1Pt2ResolS1PtTPC);
+  fYResolS1PtTPC->Add(entry->fYResolS1PtTPC);
+  fZResolS1PtTPC->Add(entry->fZResolS1PtTPC);
+  fPhiResolS1PtTPC->Add(entry->fPhiResolS1PtTPC);
+  fThetaResolS1PtTPC->Add(entry->fThetaResolS1PtTPC);
+
+  f1Pt2ResolS1PtTPCITS->Add(entry->f1Pt2ResolS1PtTPCITS);
+  fYResolS1PtTPCITS->Add(entry->fYResolS1PtTPCITS);
+  fZResolS1PtTPCITS->Add(entry->fZResolS1PtTPCITS);
+  fPhiResolS1PtTPCITS->Add(entry->fPhiResolS1PtTPCITS);
+  fThetaResolS1PtTPCITS->Add(entry->fThetaResolS1PtTPCITS);
 
   // Resolution histograms (constrained param)
   fCPhiResolTan->Add(entry->fCPhiResolTan);
@@ -777,20 +811,30 @@ Long64_t AliComparisonRes::Merge(TCollection* list)
   fCPtPullTan->Add(entry->fCPtPullTan);
 
   //  Histograms for 1/pt parameterisation (constrained)
-  fC1Pt2Resol1PtTPC->Add(entry->fC1Pt2Resol1PtTPC);
-  fCYResol1PtTPC->Add(entry->fCYResol1PtTPC);
-  fCZResol1PtTPC->Add(entry->fCZResol1PtTPC);
-  fCPhiResol1PtTPC->Add(entry->fCPhiResol1PtTPC);
-  fCThetaResol1PtTPC->Add(entry->fCThetaResol1PtTPC);
-
-  fC1Pt2Resol1PtTPCITS->Add(entry->fC1Pt2Resol1PtTPCITS);
-  fCYResol1PtTPCITS->Add(entry->fCYResol1PtTPCITS);
-  fCZResol1PtTPCITS->Add(entry->fCZResol1PtTPCITS);
-  fCPhiResol1PtTPCITS->Add(entry->fCPhiResol1PtTPCITS);
-  fCThetaResol1PtTPCITS->Add(entry->fCThetaResol1PtTPCITS);
+  fC1Pt2ResolS1PtTPC->Add(entry->fC1Pt2ResolS1PtTPC);
+  fCYResolS1PtTPC->Add(entry->fCYResolS1PtTPC);
+  fCZResolS1PtTPC->Add(entry->fCZResolS1PtTPC);
+  fCPhiResolS1PtTPC->Add(entry->fCPhiResolS1PtTPC);
+  fCThetaResolS1PtTPC->Add(entry->fCThetaResolS1PtTPC);
+
+  fC1Pt2ResolS1PtTPCITS->Add(entry->fC1Pt2ResolS1PtTPCITS);
+  fCYResolS1PtTPCITS->Add(entry->fCYResolS1PtTPCITS);
+  fCZResolS1PtTPCITS->Add(entry->fCZResolS1PtTPCITS);
+  fCPhiResolS1PtTPCITS->Add(entry->fCPhiResolS1PtTPCITS);
+  fCThetaResolS1PtTPCITS->Add(entry->fCThetaResolS1PtTPCITS);
 
   count++;
   }
 
 return count;
 }
+
+//_____________________________________________________________________________
+TFolder* AliComparisonRes::CreateFolder(TString name,TString title) { 
+// create folder for analysed histograms
+//
+TFolder *folder = 0;
+  folder = new TFolder(name.Data(),title.Data());
+
+  return folder;
+}
index 386128a..89f40d7 100644 (file)
-#ifndef ALICOMPARISONRES_H\r
-#define ALICOMPARISONRES_H\r
-\r
-//------------------------------------------------------------------------------\r
-// Class to keep information from comparison of \r
-// reconstructed and MC particle tracks (TPC resolution).   \r
-// \r
-// Author: J.Otwinowski 04/02/2008 \r
-//------------------------------------------------------------------------------\r
-\r
-class TFile;\r
-class AliMCInfo;\r
-class AliESDRecInfo;\r
-class AliESDEvent; \r
-class AliESD;\r
-class AliESDfriend;\r
-class AliMCInfoCuts;\r
-class AliRecInfoCuts;\r
-class TH1I;\r
-class TH3F;\r
-class TH3;\r
-class TProfile;\r
-class TProfile2D;\r
-class AliESDVertex;\r
-\r
-#include "TNamed.h"\r
-\r
-class AliComparisonRes : public TNamed {\r
-public :\r
-  AliComparisonRes(); \r
-  virtual ~AliComparisonRes();\r
-  void      InitHisto();\r
-  void      InitCuts();\r
-  void      Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC);\r
-  void      ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *infoRC);\r
-  void      Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);\r
-\r
-  // Selection cuts\r
-  void SetAliRecInfoCuts(AliRecInfoCuts* cuts=0) {fCutsRC = cuts;}   \r
-  void SetAliMCInfoCuts(AliMCInfoCuts* cuts=0) {fCutsMC = cuts;}  \r
-   \r
-  AliRecInfoCuts*  GetAliRecInfoCuts() const {return fCutsRC;}  \r
-  AliMCInfoCuts*   GetAliMCInfoCuts()  const {return fCutsMC;}  \r
-\r
-  // Merge output objects (needed by PROOF) \r
-  virtual Long64_t Merge(TCollection* list);\r
-\r
-  // Analyse output histograms\r
-  void Analyse();\r
-  static TH1F*       MakeResol(TH2F * his, Int_t integ, Bool_t type); \r
-\r
-\r
-private:\r
-  //\r
-  // Control histograms\r
-  //\r
-  TH2F* fPtResolLPT;        //-> pt resolution - low pt\r
-  TH2F* fPtResolHPT;        //-> pt resolution - high pt \r
-  TH2F* fPtPullLPT;         //-> pt resolution - low pt\r
-  TH2F* fPtPullHPT;         //-> pt resolution - high pt \r
-\r
-  //\r
-  // Resolution constrained param\r
-  //\r
-  TH2F   *fCPhiResolTan;   //-> angular resolution -  constrained\r
-  TH2F   *fCTanResolTan;   //-> angular resolution -  constrained\r
-  TH2F   *fCPtResolTan;    //-> pt resolution      -  constrained\r
-  TH2F   *fCPhiPullTan;    //-> angular resolution -  constrained\r
-  TH2F   *fCTanPullTan;    //-> angular resolution -  constrained\r
-  TH2F   *fCPtPullTan;     //-> pt resolution      -  constrained\r
-\r
-  //\r
-  // Histograms for track resolution parameterisation\r
-  //\r
-\r
-  TH2F* f1Pt2Resol1PtTPC;      //-> (1/mcpt-1/pt)/(1+1/pt)^2 vs 1/pt (TPC)\r
-  TH2F* f1Pt2Resol1PtTPCITS;   //-> (1/mcpt-1/pt)/(1+1/pt)^2 vs 1/pt (TPC+ITS)\r
-  TH2F* fYResol1PtTPC;         //-> (mcy-y)/(0.2+1/pt) vs 1/pt (TPC) \r
-  TH2F* fYResol1PtTPCITS;      //-> (mcy-y)/(0.2+1/pt) vs 1/pt (TPC + ITS) \r
-  TH2F* fZResol1PtTPC;         //-> (mcz-z)/(0.2+1/pt) vs 1/pt (TPC)\r
-  TH2F* fZResol1PtTPCITS;      //-> (mcz-z)/(0.2+1/pt) vs 1/pt (TPC+ITS)\r
-  TH2F* fPhiResol1PtTPC;       //-> (mcphi-phi)/(0.1+1/pt) vs 1/pt (TPC)\r
-  TH2F* fPhiResol1PtTPCITS;    //-> (mcphi-phi)/(0.1+1/pt) vs 1/pt (TPC+ITS)\r
-  TH2F* fThetaResol1PtTPC;     //-> (mctheta-theta)/(0.1+1/pt) vs 1/pt (TPC)\r
-  TH2F* fThetaResol1PtTPCITS;  //-> (mctheta-theta)/(0.1+1/pt) vs 1/pt (TPC+ITS)\r
-  \r
-  // constrained\r
-  TH2F* fC1Pt2Resol1PtTPC;      //-> (1/mcpt-1/pt)/(1+1/pt)^2 vs 1/pt (TPC)\r
-  TH2F* fC1Pt2Resol1PtTPCITS;   //-> (1/mcpt-1/pt)/(1+1/pt)^2 vs 1/pt (TPC+ITS)\r
-  TH2F* fCYResol1PtTPC;         //-> (mcy-y)/(0.2+1/pt) vs 1/pt (TPC) \r
-  TH2F* fCYResol1PtTPCITS;      //-> (mcy-y)/(0.2+1/pt) vs 1/pt (TPC + ITS) \r
-  TH2F* fCZResol1PtTPC;         //-> (mcz-z)/(0.2+1/pt) vs 1/pt (TPC)\r
-  TH2F* fCZResol1PtTPCITS;      //-> (mcz-z)/(0.2+1/pt) vs 1/pt (TPC+ITS)\r
-  TH2F* fCPhiResol1PtTPC;       //-> (mcphi-phi)/(0.1+1/pt) vs 1/pt (TPC)\r
-  TH2F* fCPhiResol1PtTPCITS;    //-> (mcphi-phi)/(0.1+1/pt) vs 1/pt (TPC+ITS)\r
-  TH2F* fCThetaResol1PtTPC;     //-> (mctheta-theta)/(0.1+1/pt) vs 1/pt (TPC)\r
-  TH2F* fCThetaResol1PtTPCITS;  //-> (mctheta-theta)/(0.1+1/pt) vs 1/pt (TPC+ITS)\r
-\r
-  AliESDVertex *fVertex;  //! \r
-\r
-  // Global cuts objects\r
-  AliRecInfoCuts*  fCutsRC;      // selection cuts for reconstructed tracks\r
-  AliMCInfoCuts*  fCutsMC;       // selection cuts for MC tracks\r
-\r
-  AliComparisonRes(const AliComparisonRes&); // not implemented\r
-  AliComparisonRes& operator=(const AliComparisonRes&); // not implemented\r
-\r
-  ClassDef(AliComparisonRes,1);\r
-};\r
-\r
-#endif\r
+#ifndef ALICOMPARISONRES_H
+#define ALICOMPARISONRES_H
+
+//------------------------------------------------------------------------------
+// Class to keep information from comparison of 
+// reconstructed and MC particle tracks (TPC resolution).   
+// 
+// Author: J.Otwinowski 04/02/2008 
+//------------------------------------------------------------------------------
+
+class TFile;
+class AliMCInfo;
+class AliESDRecInfo;
+class AliESDEvent; 
+class AliESD;
+class AliESDfriend;
+class AliMCInfoCuts;
+class AliRecInfoCuts;
+class TH1I;
+class TH3F;
+class TH3;
+class TProfile;
+class TProfile2D;
+class TString;
+class AliESDVertex;
+
+#include "TNamed.h"
+#include "AliComparisonObject.h"
+
+class AliComparisonRes : public AliComparisonObject {
+public :
+  AliComparisonRes(); 
+  virtual ~AliComparisonRes();
+
+  // Init data members
+  virtual void     Init();
+
+  // Execute analysis
+  virtual void      Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+
+  // Merge output objects (needed by PROOF) 
+  virtual Long64_t Merge(TCollection* list);
+
+  // Analyse output histograms
+  virtual void Analyse();
+
+  // Get analysis folder
+  virtual TFolder* GetAnalysisFolder() {return fAnalysisFolder;}
+
+  // Process events
+  void      ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+  void      Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+
+  // Create folder for analysed histograms
+  TFolder *CreateFolder(TString folder = "folderRes",TString title = "Analysed Resolution histograms");
+
+  // Selection cuts
+  void SetAliRecInfoCuts(AliRecInfoCuts* cuts=0) {fCutsRC = cuts;}   
+  void SetAliMCInfoCuts(AliMCInfoCuts* cuts=0) {fCutsMC = cuts;}  
+   
+  AliRecInfoCuts*  GetAliRecInfoCuts() const {return fCutsRC;}  
+  AliMCInfoCuts*   GetAliMCInfoCuts()  const {return fCutsMC;}  
+
+  static TH1F*       MakeResol(TH2F * his, Int_t integ, Bool_t type); 
+
+
+private:
+  //
+  // Control histograms
+  //
+  TH2F* fPtResolLPT;        //-> pt resolution - low pt
+  TH2F* fPtResolHPT;        //-> pt resolution - high pt 
+  TH2F* fPtPullLPT;         //-> pt resolution - low pt
+  TH2F* fPtPullHPT;         //-> pt resolution - high pt 
+
+  //
+  // Resolution constrained param
+  //
+  TH2F   *fCPhiResolTan;   //-> angular resolution -  constrained
+  TH2F   *fCTanResolTan;   //-> angular resolution -  constrained
+  TH2F   *fCPtResolTan;    //-> pt resolution      -  constrained
+  TH2F   *fCPhiPullTan;    //-> angular resolution -  constrained
+  TH2F   *fCTanPullTan;    //-> angular resolution -  constrained
+  TH2F   *fCPtPullTan;     //-> pt resolution      -  constrained
+
+  //
+  // Histograms for track resolution parameterisation
+  //
+
+  TH2F* f1Pt2ResolS1PtTPC;      //-> (1/mcpt-1/pt)/(1+1/pt)^2 vs sqrt(1/pt) (TPC)
+  TH2F* f1Pt2ResolS1PtTPCITS;   //-> (1/mcpt-1/pt)/(1+1/pt)^2 vs sqrt(1/pt) (TPC+ITS)
+  TH2F* fYResolS1PtTPC;         //-> (mcy-y)/(0.2+1/pt) vs sqrt(1/pt) (TPC) 
+  TH2F* fYResolS1PtTPCITS;      //-> (mcy-y)/(0.2+1/pt) vs sqrt(1/pt) (TPC + ITS) 
+  TH2F* fZResolS1PtTPC;         //-> (mcz-z)/(0.2+1/pt) vs sqrt(1/pt) (TPC)
+  TH2F* fZResolS1PtTPCITS;      //-> (mcz-z)/(0.2+1/pt) vs sqrt(1/pt) (TPC+ITS)
+  TH2F* fPhiResolS1PtTPC;       //-> (mcphi-phi)/(0.1+1/pt) vs sqrt(1/pt) (TPC)
+  TH2F* fPhiResolS1PtTPCITS;    //-> (mcphi-phi)/(0.1+1/pt) vs sqrt(1/pt) (TPC+ITS)
+  TH2F* fThetaResolS1PtTPC;     //-> (mctheta-theta)/(0.1+1/pt) vs sqrt(1/pt) (TPC)
+  TH2F* fThetaResolS1PtTPCITS;  //-> (mctheta-theta)/(0.1+1/pt) vs sqrt(1/pt) (TPC+ITS)
+  
+  // constrained
+  TH2F* fC1Pt2ResolS1PtTPC;      //-> (1/mcpt-1/pt)/(1+1/pt)^2 vs sqrt(1/pt) (TPC)
+  TH2F* fC1Pt2ResolS1PtTPCITS;   //-> (1/mcpt-1/pt)/(1+1/pt)^2 vs sqrt(1/pt) (TPC+ITS)
+  TH2F* fCYResolS1PtTPC;         //-> (mcy-y)/(0.2+1/pt) vs sqrt(1/pt) (TPC) 
+  TH2F* fCYResolS1PtTPCITS;      //-> (mcy-y)/(0.2+1/pt) vs sqrt(1/pt) (TPC + ITS) 
+  TH2F* fCZResolS1PtTPC;         //-> (mcz-z)/(0.2+1/pt) vs sqrt(1/pt) (TPC)
+  TH2F* fCZResolS1PtTPCITS;      //-> (mcz-z)/(0.2+1/pt) vs sqrt(1/pt) (TPC+ITS)
+  TH2F* fCPhiResolS1PtTPC;       //-> (mcphi-phi)/(0.1+1/pt) vs sqrt(1/pt) (TPC)
+  TH2F* fCPhiResolS1PtTPCITS;    //-> (mcphi-phi)/(0.1+1/pt) vs sqrt(1/pt) (TPC+ITS)
+  TH2F* fCThetaResolS1PtTPC;     //-> (mctheta-theta)/(0.1+1/pt) vs sqrt(1/pt) (TPC)
+  TH2F* fCThetaResolS1PtTPCITS;  //-> (mctheta-theta)/(0.1+1/pt) vs sqrt(1/pt) (TPC+ITS)
+
+  AliESDVertex *fVertex;  //! 
+
+  // Global cuts objects
+  AliRecInfoCuts*  fCutsRC;      // selection cuts for reconstructed tracks
+  AliMCInfoCuts*  fCutsMC;       // selection cuts for MC tracks
+
+  // analysis folder 
+  TFolder *fAnalysisFolder; // folder for analysed histograms
+
+  AliComparisonRes(const AliComparisonRes&); // not implemented
+  AliComparisonRes& operator=(const AliComparisonRes&); // not implemented
+
+  ClassDef(AliComparisonRes,1);
+};
+
+#endif
index 1d329f3..4f06836 100644 (file)
@@ -2,10 +2,10 @@
 // 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
-// The comparison output histograms are stored \r
-// in the comparison objects: AliComparisonRes, AliComparisonEff, \r
-// AliComparisonDEdx and AliComparisonDCA. Each of these objects also contains \r
-// selection cuts which were used during filling the histograms.\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
 // \r
 // Author: J.Otwinowski 04/02/2008 \r
 //------------------------------------------------------------------------------\r
@@ -36,6 +36,7 @@
 #include "AliComparisonEff.h"\r
 #include "AliComparisonDEdx.h"\r
 #include "AliComparisonDCA.h"\r
+#include "AliComparisonObject.h"\r
 #include "AliComparisonTask.h"\r
 \r
 using namespace std;\r
@@ -50,14 +51,11 @@ AliComparisonTask::AliComparisonTask(const char *name)
   , fTree(0)\r
   , fInfoMC(0)\r
   , fInfoRC(0)\r
-  , fCompRes(0)\r
-  , fCompEff(0)\r
-  , fCompDEdx(0)\r
-  , fCompDCA(0)\r
   , fOutput(0)\r
   , fMagField(0)\r
   , fMagFMap(0)\r
-  , fGeom(0)\r
+  , pitList(0)\r
+  , fCompList(0)\r
 {\r
   // Constructor\r
 \r
@@ -68,8 +66,8 @@ AliComparisonTask::AliComparisonTask(const char *name)
   // set default mag. field\r
   SetMagField();\r
   \r
-  // set default geometry\r
-  SetGeometry();\r
+  // create the list for comparison objects\r
+  fCompList = new TList;\r
 }\r
 \r
 //_____________________________________________________________________________\r
@@ -77,6 +75,7 @@ AliComparisonTask::~AliComparisonTask()
 {\r
   if(fOutput)   delete fOutput;  fOutput =0; \r
   if(fMagFMap)  delete fMagFMap;  fMagFMap =0; \r
+  if(fCompList)   delete fCompList;  fCompList =0; \r
 }\r
 \r
 //_____________________________________________________________________________\r
@@ -102,9 +101,21 @@ void AliComparisonTask::ConnectInputData(Option_t *)
   // set mag. field map \r
   fMagFMap = new AliMagFMaps("Maps","Maps", 2, 1., 10., fMagField);\r
   AliTracker::SetFieldMap(fMagFMap,kFALSE);\r
+}\r
+\r
+//_____________________________________________________________________________\r
+Bool_t AliComparisonTask::AddComparisonObject(AliComparisonObject *pObj) \r
+{\r
+  // add comparison object to the list\r
+  if(pObj == 0) {\r
+      Printf("ERROR: Could not add comparison object");\r
+         return kFALSE;\r
+  }\r
 \r
-  // set geommetry\r
-  AliGeomManager::LoadGeometry(fGeom);\r
+  // add object to the list\r
+  fCompList->AddLast(pObj);\r
+       \r
+return kTRUE;\r
 }\r
 \r
 //_____________________________________________________________________________\r
@@ -113,29 +124,28 @@ void AliComparisonTask::CreateOutputObjects()
   // Create histograms\r
   // Called once\r
 \r
+  // create output list\r
   fOutput = new TList;\r
   fOutput->SetOwner();\r
+  pitList = fOutput->MakeIterator();\r
 \r
-  if(fCompRes) fOutput->Add(fCompRes);\r
-  else \r
-     Printf("WARNING: AliComparisonRes is not added to the output");\r
-\r
-  if(fCompEff) fOutput->Add(fCompEff);\r
-  else \r
-    Printf("WARNING: AliComparisonEff is not added to the output");\r
+  AliComparisonObject *pObj=0;\r
+  Int_t count=0;\r
 \r
-  if(fCompDEdx) fOutput->Add(fCompDEdx);\r
-  else \r
-    Printf("WARNING: AliComparisonDEdx is not added to the output");\r
-\r
-  if(fCompDCA) fOutput->Add(fCompDCA);\r
-  else \r
-     Printf("WARNING: AliComparisonDCA is not added to the output");\r
+  // add comparison objects to the output\r
+  TIterator *pitCompList = fCompList->MakeIterator();\r
+  pitCompList->Reset();\r
+  while(( pObj = (AliComparisonObject *)pitCompList->Next()) != NULL) {\r
+    fOutput->Add(pObj);\r
+       count++;\r
+  }\r
+  Printf("CreateOutputObjects(): Number of output comparison objects: %d \n", count);\r
 }\r
 \r
 //_____________________________________________________________________________\r
 Bool_t AliComparisonTask::ReadEntry(Int_t evt) \r
 {\r
+// Read entry from the tree\r
   Long64_t centry = fTree->LoadTree(evt);\r
   if(centry < 0) return kFALSE;\r
 \r
@@ -156,6 +166,8 @@ void AliComparisonTask::Exec(Option_t *)
   // Main loop\r
   // Called for each event\r
 \r
+  AliComparisonObject *pObj=0;\r
+\r
   if (!fInfoMC && !fInfoRC) {\r
     Printf("ERROR: fInfoMC && fInfoRC not available");\r
     return;\r
@@ -165,10 +177,10 @@ void AliComparisonTask::Exec(Option_t *)
   Bool_t status = ReadEntry(evtNumber);\r
   if(status == kTRUE) \r
   {\r
-     if(fCompRes)  fCompRes->Exec(fInfoMC,fInfoRC);\r
-     if(fCompEff)  fCompEff->Exec(fInfoMC,fInfoRC);\r
-     if(fCompDEdx) fCompDEdx->Exec(fInfoMC,fInfoRC);\r
-     if(fCompDCA)  fCompDCA->Exec(fInfoMC,fInfoRC);\r
+    pitList->Reset();\r
+    while(( pObj = (AliComparisonObject *)pitList->Next()) != NULL) {\r
+       pObj->Exec(fInfoMC,fInfoRC);\r
+    }\r
   }\r
 \r
   if( !( evtNumber % 10000) ) { \r
@@ -184,8 +196,6 @@ void AliComparisonTask::Exec(Option_t *)
 void AliComparisonTask::Terminate(Option_t *) \r
 {\r
   // Called once at the end of the event loop\r
-  cout << "Terminate " << endl;\r
-\r
   TFile *out = new TFile("Output.root","RECREATE");\r
   out->cd();\r
 \r
@@ -195,30 +205,6 @@ void AliComparisonTask::Terminate(Option_t *)
     return;\r
   }\r
 \r
-  fCompRes = dynamic_cast<AliComparisonRes*> (fOutput->FindObject("AliComparisonRes"));\r
-  if (!fCompRes) {\r
-    Printf("WARNING: AliComparisonRes not available");\r
-    return;\r
-  }\r
-\r
-  fCompEff = dynamic_cast<AliComparisonEff*> (fOutput->FindObject("AliComparisonEff"));\r
-  if (!fCompEff) {\r
-    Printf("WARNING: AliComparisonEff not available");\r
-    return;\r
-  }\r
-   \r
-  fCompDEdx = dynamic_cast<AliComparisonDEdx*> (fOutput->FindObject("AliComparisonDEdx"));\r
-  if (!fCompDEdx) {\r
-    Printf("WARNING: AliComparisonDEdx not available");\r
-    return;\r
-  }\r
-\r
-  fCompDCA = dynamic_cast<AliComparisonDCA*> (fOutput->FindObject("AliComparisonDCA"));\r
-  if (!fCompDCA) {\r
-    Printf("WARNING: AliComparisonDCA not available");\r
-    return;\r
-  }\r
-\r
   fOutput->Write();\r
   out->Close();\r
 }\r
index bf5537a..f9006ea 100644 (file)
@@ -7,10 +7,7 @@
 // Author: J.Otwinowski 04/02/2008 
 //------------------------------------------------------------------------------
 
-class AliComparisonRes;
-class AliComparisonEff;
-class AliComparisonDEdx;
-class AliComparisonDCA;
+class AliComparisonObject;
 class AliMagFMaps;
 class TList;
 
@@ -30,28 +27,20 @@ class AliComparisonTask : public AliAnalysisTask {
   Bool_t  ReadEntry(Int_t evt);
 
   // Set comparison objects
-  void SetAliComparisonRes(AliComparisonRes* comp) {fCompRes = comp;}
-  void SetAliComparisonEff(AliComparisonEff* comp) {fCompEff = comp;}
-  void SetAliComparisonDEdx(AliComparisonDEdx* comp) {fCompDEdx = comp;}
-  void SetAliComparisonDCA(AliComparisonDCA* comp) {fCompDCA = comp;}
-
+  Bool_t AddComparisonObject(AliComparisonObject* comp);
   void SetMagField(Int_t mag = 2) {fMagField = mag;}
-  void SetGeometry(char* geom = "/d/alice12/jacek/sim/v4-10-Release/pp/0/geometry.root")  {fGeom = geom;}
 
  private:
   TTree* fTree;                   //! input tree
   AliMCInfo *fInfoMC;             //! AliMCInfo object
   AliESDRecInfo *fInfoRC;         //! AliESDRecInfo object
-  AliComparisonRes* fCompRes;     // TPC resolution comparison object
-  AliComparisonEff* fCompEff;     // TPC efficiency comparison object
-  AliComparisonDEdx* fCompDEdx;   // TPC DEdx comparison object
-  AliComparisonDCA* fCompDCA;     // TPC DCA comparison object
 
   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 
-  const char *fGeom;              //! ROOT file with detector geometry
+  TIterator *pitList;             //! iterator over the output objetcs  
+  TList *fCompList;               // list of comparison objects
 
   AliComparisonTask(const AliComparisonTask&); // not implemented
   AliComparisonTask& operator=(const AliComparisonTask&); // not implemented
index 49ab539..4af39d6 100644 (file)
@@ -26,6 +26,7 @@
 #pragma link C++ class AliComparisonEff+;
 #pragma link C++ class AliComparisonDEdx+;
 #pragma link C++ class AliComparisonDCA+;
+#pragma link C++ class AliComparisonObject+;
 
 
 #endif
index 9ece35b..8ffbd06 100644 (file)
@@ -15,7 +15,8 @@ SRCS:=        AliTreeDraw.cxx \
        AliComparisonRes.cxx \
        AliComparisonEff.cxx \
        AliComparisonDEdx.cxx \
-       AliComparisonDCA.cxx
+       AliComparisonDCA.cxx \
+       AliComparisonObject.cxx
 
  
 HDRS:= $(SRCS:.cxx=.h)