]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Hyperon reconstruction ported to newIO (Y. Belikov)
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Jul 2003 08:27:52 +0000 (08:27 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Jul 2003 08:27:52 +0000 (08:27 +0000)
ITS/AliCascadeComparison.C
ITS/AliCascadeFindVertices.C
ITS/AliCascadeVertexer.cxx
ITS/AliCascadeVertexer.h
ITS/AliITSLoader.cxx
ITS/AliITSLoader.h
ITS/AliV0Comparison.C
ITS/AliV0FindVertices.C
ITS/AliV0vertexer.cxx
ITS/AliV0vertexer.h

index 35d8db977786afd89ee4ccc4b4484090fbbc3a12..9d96d05f03574bdc065e76f51ab36fd7524da746 100644 (file)
@@ -7,10 +7,15 @@
  *  Origin: Christian Kuhn, IReS, Strasbourg, christian.kuhn@ires.in2p3.fr  *
  ****************************************************************************/
 
-#ifndef __CINT__
+#if !defined(__CINT__) || defined(__MAKECINT__)
   #include <Riostream.h>
   #include <fstream.h>
 
+  #include "AliRun.h"
+  #include "AliHeader.h"
+  #include "AliRunLoader.h"
+  #include "AliITSLoader.h"
+
   #include "TH1.h"
   #include "TFile.h"
   #include "TTree.h"
@@ -37,6 +42,8 @@ struct GoodCascade {
 };
 Int_t good_cascades(GoodCascade *gt, Int_t max);
 
+extern AliRun *gAlice;
+
 Int_t AliCascadeComparison(Int_t code=3312) {
   //code= 3312; //kXiMinus 
   //code=-3312; //kXiPlusBar
@@ -45,6 +52,8 @@ Int_t AliCascadeComparison(Int_t code=3312) {
 
    cerr<<"Doing comparison...\n";
 
+   TStopwatch timer;
+
    const Double_t cascadeWindow=0.05, cascadeWidth=0.015; 
    Double_t ptncut=0.12, ptpcut=0.33, kine0cut=0.003;
    Double_t ptbcut=0.11, kinecut=0.002;
@@ -69,23 +78,66 @@ Int_t AliCascadeComparison(Int_t code=3312) {
    default: cerr<<"Invalid PDG code !\n"; return 1;
    }
 
-   TStopwatch timer;
+   /*** create some histograms ***/
+   TH1F *hp=new TH1F("hp","Angular Resolution",30,-30.,30.); //phi resolution 
+   hp->SetXTitle("(mrad)"); hp->SetFillColor(2);
+   TH1F *hl=new TH1F("hl","Lambda Resolution",30,-30,30);
+   hl->SetXTitle("(mrad)"); hl->SetFillColor(1); hl->SetFillStyle(3013); 
+   TH1F *hpt=new TH1F("hpt","Relative Pt Resolution",30,-10.,10.); 
+   hpt->SetXTitle("(%)"); hpt->SetFillColor(2); 
+
+   TH1F *hx=new TH1F("hx","Position Resolution (X,Y)",30,-3.,3.); //x res. 
+   hx->SetXTitle("(mm)"); hx->SetFillColor(6);
+   TH1F *hy=new TH1F("hy","Position Resolution (Y)",30,-3.,3.);   //y res
+   hy->SetXTitle("(mm)"); hy->SetFillColor(1); hy->SetFillStyle(3013);
+   TH1F *hz=new TH1F("hz","Position Resolution (Z)",30,-3.,3.);   //z res. 
+   hz->SetXTitle("(mm)"); hz->SetFillColor(6);
+
+   Double_t pmin=0.2, pmax=4.2; Int_t nchan=20;
+   TH1F *hgood=new TH1F("hgood","Good Cascades",nchan,pmin,pmax);    
+   TH1F *hfound=new TH1F("hfound","Found Cascades",nchan,pmin,pmax);
+   TH1F *hfake=new TH1F("hfake","Fake Cascades",nchan,pmin,pmax);
+   TH1F *hg=new TH1F("hg","Efficiency for Good Cascades",nchan,pmin,pmax);
+   hg->SetLineColor(4); hg->SetLineWidth(2);
+   TH1F *hf=new TH1F("hf","Probability of Fake Cascades",nchan,pmin,pmax);
+   hf->SetFillColor(1); hf->SetFillStyle(3013); hf->SetLineWidth(2);
+
+   Double_t mmin=cascadeMass-cascadeWindow, mmax=cascadeMass+cascadeWindow;
+   TH1F *cs =new TH1F("cs","Cascade Effective Mass",40, mmin, mmax);
+   cs->SetXTitle("(GeV)");
+   cs->SetLineColor(4); cs->SetLineWidth(4);
+   TH1F *csf =new TH1F("csf","Fake Cascade Effective Mass",40, mmin, mmax);
+   csf->SetXTitle("(GeV)"); csf->SetFillColor(6);
+
+   if (gAlice) {
+      delete gAlice->GetRunLoader();
+      delete gAlice; 
+      gAlice=0;
+   }   
+   AliRunLoader *rl = AliRunLoader::Open("galice.root");
+   if (!rl) {
+       cerr<<"AliV0Comparison.C :Can't start sesion !\n";
+       return 1;
+   }
+   AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
+   if (itsl == 0x0) {
+       cerr<<"AliV0Comparison.C : Can not find the ITSLoader\n";
+       delete rl;
+       return 2;
+   }
 
    /*** Load reconstructed cascades ***/
-   TFile *cf=TFile::Open("AliCascadeVertices.root");
-   if (!cf->IsOpen()){cerr<<"Can't open AliCascadeVertices.root !\n";return 2;}
    TObjArray carray(1000);
-   TTree *cTree=(TTree*)cf->Get("TreeCasc");
-   TBranch *branch=cTree->GetBranch("cascades");
-   Int_t nentr=(Int_t)cTree->GetEntries();
+   itsl->LoadCascades();
+   TTree *xTree=itsl->TreeX();
+   TBranch *branch=xTree->GetBranch("cascades");
+   Int_t nentr=(Int_t)xTree->GetEntries();
    for (Int_t i=0; i<nentr; i++) {
        AliCascadeVertex *iovertex=new AliCascadeVertex; 
        branch->SetAddress(&iovertex);
-       cTree->GetEvent(i);
+       xTree->GetEvent(i);
        carray.AddLast(iovertex);
    }
-   delete cTree;
-   cf->Close();
 
    /*** Check if the file with the "good" cascades exists ***/
    GoodCascade gc[100];
@@ -120,37 +172,6 @@ Int_t AliCascadeComparison(Int_t code=3312) {
       out.close();
    }
 
-   /*** create some histograms ***/
-   TH1F *hp=new TH1F("hp","Angular Resolution",30,-30.,30.); //phi resolution 
-   hp->SetXTitle("(mrad)"); hp->SetFillColor(2);
-   TH1F *hl=new TH1F("hl","Lambda Resolution",30,-30,30);
-   hl->SetXTitle("(mrad)"); hl->SetFillColor(1); hl->SetFillStyle(3013); 
-   TH1F *hpt=new TH1F("hpt","Relative Pt Resolution",30,-10.,10.); 
-   hpt->SetXTitle("(%)"); hpt->SetFillColor(2); 
-
-   TH1F *hx=new TH1F("hx","Position Resolution (X,Y)",30,-3.,3.); //x res. 
-   hx->SetXTitle("(mm)"); hx->SetFillColor(6);
-   TH1F *hy=new TH1F("hy","Position Resolution (Y)",30,-3.,3.);   //y res
-   hy->SetXTitle("(mm)"); hy->SetFillColor(1); hy->SetFillStyle(3013);
-   TH1F *hz=new TH1F("hz","Position Resolution (Z)",30,-3.,3.);   //z res. 
-   hz->SetXTitle("(mm)"); hz->SetFillColor(6);
-
-   Double_t pmin=0.2, pmax=4.2; Int_t nchan=20;
-   TH1F *hgood=new TH1F("hgood","Good Cascades",nchan,pmin,pmax);    
-   TH1F *hfound=new TH1F("hfound","Found Cascades",nchan,pmin,pmax);
-   TH1F *hfake=new TH1F("hfake","Fake Cascades",nchan,pmin,pmax);
-   TH1F *hg=new TH1F("hg","Efficiency for Good Cascades",nchan,pmin,pmax);
-   hg->SetLineColor(4); hg->SetLineWidth(2);
-   TH1F *hf=new TH1F("hf","Probability of Fake Cascades",nchan,pmin,pmax);
-   hf->SetFillColor(1); hf->SetFillStyle(3013); hf->SetLineWidth(2);
-
-   Double_t mmin=cascadeMass-cascadeWindow, mmax=cascadeMass+cascadeWindow;
-   TH1F *cs =new TH1F("cs","Cascade Effective Mass",40, mmin, mmax);
-   cs->SetXTitle("(GeV)");
-   cs->SetLineColor(4); cs->SetLineWidth(4);
-   TH1F *csf =new TH1F("csf","Fake Cascade Effective Mass",40, mmin, mmax);
-   csf->SetXTitle("(GeV)"); csf->SetFillColor(6);
-
    Double_t pxg=0.,pyg=0.,ptg=0.;
    Int_t nlab=-1, plab=-1, blab=-1;
    Int_t i;
@@ -310,11 +331,12 @@ Int_t AliCascadeComparison(Int_t code=3312) {
 
    timer.Stop(); timer.Print();
 
+   delete rl;
+
    return 0;
 }
 
 
-
 Int_t good_cascades(GoodCascade *gc, Int_t max) {
    Int_t nc=0;
    /*** Get information about the cuts ***/
@@ -341,16 +363,23 @@ Int_t good_cascades(GoodCascade *gc, Int_t max) {
    }
 
    /*** Get an access to the kinematics ***/
-   if (gAlice) {delete gAlice; gAlice=0;}
+   AliRunLoader *rl =
+        AliRunLoader::GetRunLoader(AliConfig::fgkDefaultEventFolderName);
+   if (rl == 0x0) {
+  ::Fatal("AliCascadeComparison.C::good_cascades","Can not find Run Loader !");
+   }
 
-   TFile *file=TFile::Open("galice.root");
-   if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; exit(4);}
-   if (!(gAlice=(AliRun*)file->Get("gAlice"))) {
-     cerr<<"gAlice has not been found on galice.root !\n";
-     exit(5);
+   AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
+   if (itsl == 0x0) {
+       cerr<<"AliITSComparisonV2.C : Can not find TPCLoader\n";
+       delete rl;
+       return 1;
    }
+   rl->LoadgAlice();
+   rl->LoadHeader();
+   rl->LoadKinematics();
+   Int_t np = rl->GetHeader()->GetNtrack();
 
-   Int_t np=gAlice->GetEvent(0);
    while (np--) {
       cerr<<np<<'\r';
       TParticle *cp=gAlice->Particle(np);
@@ -412,6 +441,7 @@ Int_t good_cascades(GoodCascade *gc, Int_t max) {
 
    }
 
+   delete rl;
 
    return nc;
 }
index db433b1e37e11e8f5b007866d9e3f2fc15a411ab..1b8e88b914f34c3ed11e30888aee2167b2e76c29 100644 (file)
@@ -1,24 +1,36 @@
-#ifndef __CINT__
+#if !defined(__CINT__) || defined(__MAKECINT__)
   #include <Riostream.h>
   #include "AliCascadeVertexer.h"
   #include "TFile.h"
   #include "TStopwatch.h"
+
+  #include "AliRun.h"
+  #include "AliRunLoader.h"
+  #include "AliITSLoader.h"
 #endif
 
-Int_t AliCascadeFindVertices() {
+Int_t AliCascadeFindVertices(Int_t nev=5) {
    cerr<<"Looking for cascade vertices...\n";
 
-   TFile *out=TFile::Open("AliCascadeVertices.root","new");
-   if (!out->IsOpen()) {
-      cerr<<"Delete old AliCascadeVertices.root !\n"; return 1;
+   if (gAlice) {
+      delete gAlice->GetRunLoader();
+      delete gAlice;
+      gAlice=0;
    }
-   TFile *in=TFile::Open("AliITStracksV2.root");
-   if (!in->IsOpen()) {cerr<<"Can't open AliITStracksV2.root !\n"; return 2;}
-
-   TFile *file=TFile::Open("AliV0vertices.root");
-   if (!file->IsOpen()) {
-      cerr<<"Can't open AliV0vertices.root !\n";return 3;
+   AliRunLoader* rl = AliRunLoader::Open("galice.root");
+   if (rl == 0x0) {
+      cerr<<"AliCascadeFindVertices.C : Can not open session RL=NULL"<< endl;
+      return 1;
    }
+   AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
+   if (itsl == 0x0) {
+      cerr<<"AliCascadeFindVertices.C : Can not get ITS loader"<<endl;
+      return 2;
+   }
+   itsl->LoadTracks("read");
+   itsl->LoadV0s("read");
+   itsl->LoadCascades("recreate");
+
    Double_t cuts[]={33.,    // max. allowed chi2
                     0.05,   // min. allowed V0 impact parameter 
                     0.008,  // window around the Lambda mass 
@@ -30,13 +42,35 @@ Int_t AliCascadeFindVertices() {
                    };
    TStopwatch timer;
    AliCascadeVertexer *vertexer=new AliCascadeVertexer(cuts);
-   Int_t rc=vertexer->V0sTracks2CascadeVertices(in,out);
+   Int_t rc=0;
+   if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
+   for (Int_t i=0; i<nev; i++) {
+     rl->GetEvent(i);
+
+     TTree *tTree=itsl->TreeT();
+     if (!tTree) {
+       cerr<<"AliCascadeFindVertices.C : Can't get the ITS track tree !"<<endl;
+       return 3;
+     }
+     TTree *vTree=itsl->TreeV0();
+     if (!vTree) {
+       cerr<<"AliCascadeFindVertices.C : Can't get the V0 tree !"<<endl;
+       return 4;
+     }
+     TTree *xTree=itsl->TreeX();
+     if (!xTree) {
+        itsl->MakeTree("X");
+        xTree=itsl->TreeX();
+     }
+
+     rc=vertexer->V0sTracks2CascadeVertices(vTree,tTree,xTree);
+
+     itsl->WriteCascades("OVERWRITE");
+   }
    delete vertexer;
    timer.Stop(); timer.Print();
     
-   file->Close();
-   in->Close();
-   out->Close();
+   delete rl;
 
    return rc;
 }
index ac76ea36fa8e391e6314ae1e848cb23faf4937fc..11591933fad3401dffec6497f0b5e04ea2e98f9a 100644 (file)
@@ -19,7 +19,6 @@
 //    Origin: Christian Kuhn, IReS, Strasbourg, christian.kuhn@ires.in2p3.fr
 //-------------------------------------------------------------------------
 #include <Riostream.h>
-#include <TFile.h>
 #include <TObjArray.h>
 #include <TPDGCode.h>
 #include <TTree.h>
 
 ClassImp(AliCascadeVertexer)
 
-Int_t 
-AliCascadeVertexer::V0sTracks2CascadeVertices(const TFile *inp, TFile *out) {
-
+Int_t AliCascadeVertexer::
+V0sTracks2CascadeVertices(TTree *vTree,TTree *tTree, TTree *xTree) {
   //--------------------------------------------------------------------
-  //This function reconstructs cascade vertices
+  // This function reconstructs cascade vertices
   //--------------------------------------------------------------------
-  TFile *in=(TFile*)inp;
-  TDirectory *savedir=gDirectory;
-
-   // Tree for vertices(V0's)
-
-   TTree *vtxTree=(TTree*)gDirectory->Get("TreeV0");
-   TBranch *branch=vtxTree->GetBranch("vertices");
-   Int_t nentrV0=(Int_t)vtxTree->GetEntries();
+   TBranch *branch=vTree->GetBranch("vertices");
+   if (!branch) {
+      Error("V0sTracks2CascadeVertices","Can't get the V0 branch !");
+      return 1;
+   }   
+   Int_t nentrV0=(Int_t)vTree->GetEntries();
    
    TObjArray vtxV0(nentrV0);
 
@@ -55,20 +51,18 @@ AliCascadeVertexer::V0sTracks2CascadeVertices(const TFile *inp, TFile *out) {
 
        AliV0vertex *ioVertex=new AliV0vertex;
        branch->SetAddress(&ioVertex);
-       vtxTree->GetEvent(i);
+       vTree->GetEvent(i);
        nV0++; 
        vtxV0.AddLast(ioVertex);
        
    }
 
-
-   in->cd();
-
-  // Tree for tracks
-
-   TTree *trkTree=(TTree*)in->Get("TreeT_ITS_0");
-   branch=trkTree->GetBranch("tracks");
-   Int_t nentr=(Int_t)trkTree->GetEntries();
+   branch=tTree->GetBranch("tracks");
+   if (!branch) {
+      Error("V0sTracks2CascadeVertices","Can't get the track branch !");
+      return 2;
+   }
+   Int_t nentr=(Int_t)tTree->GetEntries();
 
    TObjArray trks(nentr);
 
@@ -80,7 +74,7 @@ AliCascadeVertexer::V0sTracks2CascadeVertices(const TFile *inp, TFile *out) {
 
        AliITStrackV2 *iotrack=new AliITStrackV2;
        branch->SetAddress(&iotrack);
-       trkTree->GetEvent(i);
+       tTree->GetEvent(i);
 
        iotrack->PropagateTo(3.,0.0023,65.19); iotrack->PropagateTo(2.5,0.,0.);
 
@@ -88,13 +82,10 @@ AliCascadeVertexer::V0sTracks2CascadeVertices(const TFile *inp, TFile *out) {
        
    }   
 
-   // create Tree for cascades 
-
-   out->cd();
-
-   TTree cascTree("TreeCasc","Tree with cascades");
-   AliCascadeVertex *ioCascade=0;
-   cascTree.Branch("cascades","AliCascadeVertex",&ioCascade,32000,0);
+  AliCascadeVertex *ioCascade=0;
+  branch=xTree->GetBranch("cascades");
+  if (!branch) xTree->Branch("cascades","AliCascadeVertex",&ioCascade,32000,3);
+  else branch->SetAddress(&ioCascade); 
 
    // loop on all vertices
 
@@ -162,7 +153,7 @@ AliCascadeVertexer::V0sTracks2CascadeVertices(const TFile *inp, TFile *out) {
          //cascade.ChangeMassHypothesis(); //default is Xi
 
 
-         ioCascade=&cascade; cascTree.Fill();
+         ioCascade=&cascade; xTree->Fill();
 
          ncasc++;
 
@@ -171,13 +162,9 @@ AliCascadeVertexer::V0sTracks2CascadeVertices(const TFile *inp, TFile *out) {
 
    cerr<<"Number of reconstructed cascades: "<<ncasc<<endl;
 
-   cascTree.Write();
-
    trks.Delete();
    vtxV0.Delete();
 
-   savedir->cd();
-
    return 0;
 }
 
index 3dae6f3f88425fd55d80f875c3207d489a2fdd93..3ce87ffa7e7840a6df75fe665b6361c30304a92b 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "TObject.h"
 
-class TFile;
+class TTree;
 class AliITStrackV2;
 class AliV0vertex;
 
@@ -22,7 +22,7 @@ public:
   AliCascadeVertexer(const Double_t cuts[8]);
   void SetCuts(const Double_t cuts[8]);
 
-  Int_t V0sTracks2CascadeVertices(const TFile *in, TFile *out);
+  Int_t V0sTracks2CascadeVertices(TTree *v, TTree *t, TTree *x);
   Double_t PropagateToDCA(AliV0vertex *vtx, AliITStrackV2 *trk);
 
   void GetCuts(Double_t cuts[8]) const;
@@ -69,4 +69,3 @@ inline void AliCascadeVertexer::GetCuts(Double_t cuts[8]) const {
 
 #endif
 
-
index f93a34b4db6e7d7fe57a199ddfc3ab18853d32e5..f483739260be5a69de72261eaad5774ad5f02ada 100644 (file)
@@ -7,6 +7,8 @@
 const TString AliITSLoader::fgkDefaultRawClustersContainerName = "TreeC";
 const TString AliITSLoader::fgkDefaultBackTracksContainerName = "TreeB";
 const TString AliITSLoader::fgkDefaultVerticesContainerName = "Vertex";
+const TString AliITSLoader::fgkDefaultV0ContainerName = "V0";
+const TString AliITSLoader::fgkDefaultCascadeContainerName = "Cascade";
 
 ClassImp(AliITSLoader)
 
@@ -15,7 +17,9 @@ AliITSLoader::AliITSLoader(const Char_t *name,const Char_t *topfoldername):
  AliLoader(name,topfoldername),
  fRawClustersDataLoader(fDetectorName + ".RawCl.root",fgkDefaultRawClustersContainerName,"Raw Clusters"),
  fBackTracksDataLoader(fDetectorName + ".BackTracks.root",fgkDefaultBackTracksContainerName,"Back Propagated Tracks"),
-  fVertexDataLoader(fDetectorName + ".Vertex.root",fgkDefaultVerticesContainerName,"Primary Vertices","O")
+ fVertexDataLoader(fDetectorName + ".Vertex.root",fgkDefaultVerticesContainerName,"Primary Vertices","O"),
+ fV0DataLoader(fDetectorName + ".V0s.root",fgkDefaultV0ContainerName,"V0 Vertices"),
+  fCascadeDataLoader(fDetectorName + ".Cascades.root",fgkDefaultCascadeContainerName,"Cascades")
 {
 //ctor   
    fDataLoaders->Add(&fRawClustersDataLoader);
@@ -30,6 +34,14 @@ AliITSLoader::AliITSLoader(const Char_t *name,const Char_t *topfoldername):
    fVertexDataLoader.SetEventFolder(fEventFolder);
    fVertexDataLoader.SetFolder(GetDetectorDataFolder());
    
+   fDataLoaders->Add(&fV0DataLoader);
+   fV0DataLoader.SetEventFolder(fEventFolder);
+   fV0DataLoader.SetFolder(GetDetectorDataFolder());
+   
+   fDataLoaders->Add(&fCascadeDataLoader);
+   fCascadeDataLoader.SetEventFolder(fEventFolder);
+   fCascadeDataLoader.SetFolder(GetDetectorDataFolder());
+   
 }
 /*****************************************************************************/ 
 
@@ -37,7 +49,9 @@ AliITSLoader::AliITSLoader(const Char_t *name,TFolder *topfolder):
  AliLoader(name,topfolder),
  fRawClustersDataLoader(fDetectorName + ".RawCl.root",fgkDefaultRawClustersContainerName,"Raw Clusters"),
  fBackTracksDataLoader(fDetectorName + ".BackTracks.root",fgkDefaultBackTracksContainerName,"Back Propagated Tracks"),
-  fVertexDataLoader(fDetectorName + ".Vertex.root",fgkDefaultVerticesContainerName,"Primary Vertices","O")
+ fVertexDataLoader(fDetectorName + ".Vertex.root",fgkDefaultVerticesContainerName,"Primary Vertices","O"),
+ fV0DataLoader(fDetectorName + ".V0.root",fgkDefaultV0ContainerName,"V0 Vertices"),
+  fCascadeDataLoader(fDetectorName + ".Cascade.root",fgkDefaultCascadeContainerName,"Cascades")
 {
 //ctor   
    fDataLoaders->Add(&fRawClustersDataLoader);
@@ -52,6 +66,14 @@ AliITSLoader::AliITSLoader(const Char_t *name,TFolder *topfolder):
    fVertexDataLoader.SetEventFolder(fEventFolder);
    fVertexDataLoader.SetFolder(GetDetectorDataFolder());
 
+   fDataLoaders->Add(&fV0DataLoader);
+   fV0DataLoader.SetEventFolder(fEventFolder);
+   fV0DataLoader.SetFolder(GetDetectorDataFolder());
+   
+   fDataLoaders->Add(&fCascadeDataLoader);
+   fCascadeDataLoader.SetEventFolder(fEventFolder);
+   fCascadeDataLoader.SetFolder(GetDetectorDataFolder());
+   
 }
 /*****************************************************************************/ 
 AliITSLoader::~AliITSLoader()
@@ -66,6 +88,12 @@ AliITSLoader::~AliITSLoader()
   UnloadVertices();
   fDataLoaders->Remove(&fVertexDataLoader);
 
+  UnloadV0s();
+  fDataLoaders->Remove(&fV0DataLoader);
+
+  UnloadCascades();
+  fDataLoaders->Remove(&fCascadeDataLoader);
+
 }
 
 void AliITSLoader::MakeTree(Option_t *opt){
@@ -78,4 +106,10 @@ void AliITSLoader::MakeTree(Option_t *opt){
   const char *oB = strstr(opt,"B");
   if (oB) MakeBackTracksContainer();
   
+  const char *oV0 = strstr(opt,"V0");
+  if (oV0) MakeV0Container();
+  
+  const char *oX = strstr(opt,"X");
+  if (oX) MakeCascadeContainer();
+  
 }
index c3490a44f77a7a0c562ac959349b448d1391ebd2..8386d1c0793ffcc8c9239ae388d53e604fad76b2 100644 (file)
@@ -33,6 +33,22 @@ class AliITSLoader: public AliLoader
     //    virtual void SetVerticesContName(const char *name){fVertexDataLoader.GetBaseLoader(0)->SetName(name);}
     AliITSVertex *GetVertex(){return static_cast <AliITSVertex*>(fVertexDataLoader.GetBaseLoader(0)->Get());}
 
+    //V0s
+    virtual void   CleanV0s() {fV0DataLoader.GetBaseLoader(0)->Clean();}
+    Int_t          LoadV0s(Option_t* opt=""){return fV0DataLoader.GetBaseLoader(0)->Load(opt);}
+    void           SetV0FileName(const TString& fname){fV0DataLoader.SetFileName(fname);}
+    void           UnloadV0s(){fV0DataLoader.GetBaseLoader(0)->Unload();}
+    virtual Int_t  WriteV0s(Option_t* opt=""){return fV0DataLoader.GetBaseLoader(0)->WriteData(opt);}
+    TTree*         TreeV0(){ return fV0DataLoader.Tree();}
+
+    //Cascades
+    virtual void   CleanCascades() {fCascadeDataLoader.GetBaseLoader(0)->Clean();}
+    Int_t          LoadCascades(Option_t* opt=""){return fCascadeDataLoader.GetBaseLoader(0)->Load(opt);}
+    void           SetCascadeFileName(const TString& fname){fCascadeDataLoader.SetFileName(fname);}
+    void           UnloadCascades(){fCascadeDataLoader.GetBaseLoader(0)->Unload();}
+    virtual Int_t  WriteCascades(Option_t* opt=""){return fCascadeDataLoader.GetBaseLoader(0)->WriteData(opt);}
+    TTree*         TreeX(){ return fCascadeDataLoader.Tree();}
+
     //Back Propagated Tracks
 
     virtual void   CleanBackTracks() {fBackTracksDataLoader.GetBaseLoader(0)->Clean();}
@@ -51,6 +67,11 @@ class AliITSLoader: public AliLoader
 
     virtual void   MakeBackTracksContainer() {fBackTracksDataLoader.MakeTree();}
     Int_t          PostBackTracks(){return fBackTracksDataLoader.GetBaseLoader(0)->Post();}
+    virtual void   MakeV0Container() {fV0DataLoader.MakeTree();}
+    Int_t          PostV0s(){return fV0DataLoader.GetBaseLoader(0)->Post();}
+
+    virtual void   MakeCascadeContainer() {fCascadeDataLoader.MakeTree();}
+    Int_t          PostCascades(){return fCascadeDataLoader.GetBaseLoader(0)->Post();}
 
     // DATA
     AliDataLoader fRawClustersDataLoader;
@@ -62,6 +83,12 @@ class AliITSLoader: public AliLoader
     AliDataLoader fVertexDataLoader;
     static const TString fgkDefaultVerticesContainerName;
 
+    AliDataLoader fV0DataLoader;
+    static const TString fgkDefaultV0ContainerName;
+
+    AliDataLoader fCascadeDataLoader;
+    static const TString fgkDefaultCascadeContainerName;
+
    public:
      ClassDef(AliITSLoader,2)
  };
index da772af851ab091ad3fa9d1d8bc898014ad78912..f3f9dfb54777212781f5d2bfacc965ab76b98796 100644 (file)
@@ -7,10 +7,15 @@
  *   Origin: I.Belikov, IReS, Strasbourg, Jouri.Belikov@cern.ch             *
  ****************************************************************************/
 
-#ifndef __CINT__
+#if !defined(__CINT__) || defined(__MAKECINT__)
   #include "Riostream.h"
   #include <fstream.h>
 
+  #include "AliRun.h"
+  #include "AliHeader.h"
+  #include "AliRunLoader.h"
+  #include "AliITSLoader.h"
+
   #include "TH1.h"
   #include "TFile.h"
   #include "TTree.h"
@@ -35,9 +40,13 @@ struct GoodVertex {
 };
 Int_t good_vertices(GoodVertex *gt, Int_t max);
 
+extern AliRun *gAlice;
+
 Int_t AliV0Comparison(Int_t code=310) { //Lambda=3122, LambdaBar=-3122
    cerr<<"Doing comparison...\n";
 
+   TStopwatch timer;
+
    const Double_t V0window=0.05;
    Double_t ptncut=0.13, ptpcut=0.13, kinecut=0.03; 
    Double_t V0mass=0.497672, V0width=0.020;
@@ -53,13 +62,59 @@ Int_t AliV0Comparison(Int_t code=310) { //Lambda=3122, LambdaBar=-3122
    default: cerr<<"Invalid PDG code !\n"; return 1;
    }
 
-   TStopwatch timer;
+   TH1F *hp=new TH1F("hp","Angular Resolution",30,-30.,30.); //phi resolution 
+   hp->SetXTitle("(mrad)"); hp->SetFillColor(2);
+   TH1F *hl=new TH1F("hl","Lambda Resolution",30,-30,30);
+   hl->SetXTitle("(mrad)"); hl->SetFillColor(1); hl->SetFillStyle(3013); 
+   TH1F *hpt=new TH1F("hpt","Relative Pt Resolution",30,-10.,10.); 
+   hpt->SetXTitle("(%)"); hpt->SetFillColor(2); 
+
+   TH1F *hx=new TH1F("hx","Position Resolution (X,Y)",30,-3.,3.); //x res. 
+   hx->SetXTitle("(mm)"); hx->SetFillColor(6);
+   TH1F *hy=new TH1F("hy","Position Resolution (Y)",30,-3.,3.);   //y res
+   hy->SetXTitle("(mm)"); hy->SetFillColor(1); hy->SetFillStyle(3013);
+   TH1F *hz=new TH1F("hz","Position Resolution (Z)",30,-3.,3.);   //z res. 
+   hz->SetXTitle("(mm)"); hz->SetFillColor(6);
+
+
+   Double_t pmin=0.2, pmax=4.2; Int_t nchan=20;
+   TH1F *hgood=new TH1F("hgood","Good Vertices",nchan,pmin,pmax);    
+   TH1F *hfound=new TH1F("hfound","Found Vertices",nchan,pmin,pmax);
+   TH1F *hfake=new TH1F("hfake","Fake Vertices",nchan,pmin,pmax);
+   TH1F *hg=new TH1F("hg","Efficiency for Good Vertices",nchan,pmin,pmax);
+   hg->SetLineColor(4); hg->SetLineWidth(2);
+   TH1F *hf=new TH1F("hf","Probability of Fake Vertices",nchan,pmin,pmax);
+   hf->SetFillColor(1); hf->SetFillStyle(3013); hf->SetLineWidth(2);
+
+   Double_t mmin=V0mass-V0window, mmax=V0mass+V0window;
+   TH1F *v0s =new TH1F("v0s","V0s Effective Mass",40, mmin, mmax);
+   v0s->SetXTitle("(GeV)");
+   v0s->SetLineColor(4); v0s->SetLineWidth(4);
+   TH1F *v0sf =new TH1F("v0sf","Fake V0s Effective Mass",40, mmin, mmax);
+   v0sf->SetXTitle("(GeV)"); v0sf->SetFillColor(6);
+
+
+   if (gAlice) {
+      delete gAlice->GetRunLoader();
+      delete gAlice; 
+      gAlice=0;
+   }   
+   AliRunLoader *rl = AliRunLoader::Open("galice.root");
+   if (!rl) {
+       cerr<<"AliV0Comparison.C :Can't start sesion !\n";
+       return 1;
+   }
+   AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
+   if (itsl == 0x0) {
+       cerr<<"AliV0Comparison.C : Can not find the ITSLoader\n";
+       delete rl;
+       return 2;
+   }
 
    /*** Load reconstructed vertices ***/
-   TFile *vf=TFile::Open("AliV0vertices.root");
-   if (!vf->IsOpen()) {cerr<<"Can't open AliV0vertices.root !\n"; return 2;}
    TObjArray varray(1000);
-   TTree *vTree=(TTree*)vf->Get("TreeV0");
+   itsl->LoadV0s();
+   TTree *vTree=itsl->TreeV0();
    TBranch *branch=vTree->GetBranch("vertices");
    Int_t nentr=(Int_t)vTree->GetEntries();
    for (Int_t i=0; i<nentr; i++) {
@@ -99,40 +154,6 @@ Int_t AliV0Comparison(Int_t code=310) { //Lambda=3122, LambdaBar=-3122
       out.close();
    }
 
-   vf->Close();
-
-
-   TH1F *hp=new TH1F("hp","Angular Resolution",30,-30.,30.); //phi resolution 
-   hp->SetXTitle("(mrad)"); hp->SetFillColor(2);
-   TH1F *hl=new TH1F("hl","Lambda Resolution",30,-30,30);
-   hl->SetXTitle("(mrad)"); hl->SetFillColor(1); hl->SetFillStyle(3013); 
-   TH1F *hpt=new TH1F("hpt","Relative Pt Resolution",30,-10.,10.); 
-   hpt->SetXTitle("(%)"); hpt->SetFillColor(2); 
-
-   TH1F *hx=new TH1F("hx","Position Resolution (X,Y)",30,-3.,3.); //x res. 
-   hx->SetXTitle("(mm)"); hx->SetFillColor(6);
-   TH1F *hy=new TH1F("hy","Position Resolution (Y)",30,-3.,3.);   //y res
-   hy->SetXTitle("(mm)"); hy->SetFillColor(1); hy->SetFillStyle(3013);
-   TH1F *hz=new TH1F("hz","Position Resolution (Z)",30,-3.,3.);   //z res. 
-   hz->SetXTitle("(mm)"); hz->SetFillColor(6);
-
-
-   Double_t pmin=0.2, pmax=4.2; Int_t nchan=20;
-   TH1F *hgood=new TH1F("hgood","Good Vertices",nchan,pmin,pmax);    
-   TH1F *hfound=new TH1F("hfound","Found Vertices",nchan,pmin,pmax);
-   TH1F *hfake=new TH1F("hfake","Fake Vertices",nchan,pmin,pmax);
-   TH1F *hg=new TH1F("hg","Efficiency for Good Vertices",nchan,pmin,pmax);
-   hg->SetLineColor(4); hg->SetLineWidth(2);
-   TH1F *hf=new TH1F("hf","Probability of Fake Vertices",nchan,pmin,pmax);
-   hf->SetFillColor(1); hf->SetFillStyle(3013); hf->SetLineWidth(2);
-
-   Double_t mmin=V0mass-V0window, mmax=V0mass+V0window;
-   TH1F *v0s =new TH1F("v0s","V0s Effective Mass",40, mmin, mmax);
-   v0s->SetXTitle("(GeV)");
-   v0s->SetLineColor(4); v0s->SetLineWidth(4);
-   TH1F *v0sf =new TH1F("v0sf","Fake V0s Effective Mass",40, mmin, mmax);
-   v0sf->SetXTitle("(GeV)"); v0sf->SetFillColor(6);
-
 
    Double_t pxg=0.,pyg=0.,ptg=0.;
    Int_t nlab=-1, plab=-1;
@@ -284,6 +305,8 @@ Int_t AliV0Comparison(Int_t code=310) { //Lambda=3122, LambdaBar=-3122
 
    timer.Stop(); timer.Print();
 
+   delete rl;
+
    return 0;
 }
 
@@ -313,16 +336,23 @@ Int_t good_vertices(GoodVertex *gv, Int_t max) {
    }
 
    /*** Get an access to the kinematics ***/
-   if (gAlice) {delete gAlice; gAlice=0;}
+   AliRunLoader *rl = 
+        AliRunLoader::GetRunLoader(AliConfig::fgkDefaultEventFolderName);
+   if (rl == 0x0) {
+     ::Fatal("AliV0Comparison.C::good_vertices","Can not find Run Loader !");
+   }
 
-   TFile *file=TFile::Open("galice.root");
-   if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; exit(4);}
-   if (!(gAlice=(AliRun*)file->Get("gAlice"))) {
-     cerr<<"gAlice has not been found on galice.root !\n";
-     exit(5);
+   AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
+   if (itsl == 0x0) {
+       cerr<<"AliITSComparisonV2.C : Can not find TPCLoader\n";
+       delete rl;
+       return 1;
    }
+   rl->LoadgAlice();
+   rl->LoadHeader();
+   rl->LoadKinematics();
+   Int_t np = rl->GetHeader()->GetNtrack();
 
-   Int_t np=gAlice->GetEvent(0);
    while (np--) {
       cerr<<np<<'\r';
       TParticle *p0=gAlice->Particle(np);
@@ -361,9 +391,7 @@ Int_t good_vertices(GoodVertex *gv, Int_t max) {
       nv++;
    }
  
-   delete gAlice; gAlice=0;
-
-   file->Close();  
+   delete rl;
 
    return nv;
 }
index 61a423d2c022f3651a04665dcdf50fd7d5322f63..4c286df4497f73edf2560f328c4f58e5a5c1dd89 100644 (file)
@@ -1,18 +1,36 @@
-#ifndef __CINT__
+#if !defined(__CINT__) || defined(__MAKECINT__)
   #include "Riostream.h"
   #include "AliV0vertexer.h"
   #include "TFile.h"
   #include "TStopwatch.h"
+
+  #include "AliRun.h"
+  #include "AliRunLoader.h"
+  #include "AliITSLoader.h"
 #endif
 
-Int_t AliV0FindVertices(Int_t nev=1) {
-   cerr<<"Looking for V0 vertices...\n";
+extern AliRun *gAlice;
 
-   TFile *out=TFile::Open("AliV0vertices.root","new");
-   if (!out->IsOpen()) {cerr<<"Delete old AliV0vertices.root !\n"; return 1;}
+Int_t AliV0FindVertices(Int_t nev=5) {
+   cerr<<"Looking for V0 vertices...\n";
 
-   TFile *in=TFile::Open("AliITStracksV2.root");
-   if (!in->IsOpen()) {cerr<<"Can't open AliITStracksV2.root !\n"; return 2;}
+   if (gAlice) {
+      delete gAlice->GetRunLoader();
+      delete gAlice; 
+      gAlice=0;
+   } 
+   AliRunLoader* rl = AliRunLoader::Open("galice.root");
+   if (rl == 0x0) {
+      cerr<<"AliV0FindVertices.C : Can not open session RL=NULL"<< endl;
+      return 1;
+   }
+   AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
+   if (itsl == 0x0) {
+      cerr<<"AliV0FindVertices.C : Can not get ITS loader"<<endl;
+      return 2;
+   }
+   itsl->LoadTracks("read");
+   itsl->LoadV0s("recreate");
 
    Double_t cuts[]={33,  // max. allowed chi2
                     0.16,// min. allowed negative daughter's impact parameter 
@@ -25,15 +43,29 @@ Int_t AliV0FindVertices(Int_t nev=1) {
    TStopwatch timer;
    AliV0vertexer vtxer(cuts);
    Int_t rc=0;
+   if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
    for (Int_t i=0; i<nev; i++) {
+     rl->GetEvent(i);
      //Double_t vtx[3]={0.,0.,0.}; vtxer.SetVertex(vtx); // primary vertex (cm)
-     vtxer.SetEvent(i);
-     rc=vtxer.Tracks2V0vertices(in,out);
+
+     TTree *tTree=itsl->TreeT();
+     if (!tTree) {
+        cerr<<"AliV0FindVertices.C : Can't get the ITS track tree !"<<endl;
+        return 3;
+     }
+     TTree *vTree=itsl->TreeV0();
+     if (!vTree) {
+        itsl->MakeTree("V0");
+        vTree=itsl->TreeV0();
+     }
+
+     rc=vtxer.Tracks2V0vertices(tTree,vTree);
+
+     itsl->WriteV0s("OVERWRITE");
    }
    timer.Stop(); timer.Print();
     
-   in->Close();
-   out->Close();
+   delete rl;
 
    return rc;
 }
index 0ba5a7656303a0f7172410b6781f81aae124184e..49e2232728c09ef7dc5842dbc5a81e9debc7f8f9 100644 (file)
@@ -19,7 +19,6 @@
 //     Origin: Iouri Belikov, IReS, Strasbourg, Jouri.Belikov@cern.ch
 //-------------------------------------------------------------------------
 #include <Riostream.h>
-#include <TFile.h>
 #include <TPDGCode.h>
 #include <TObjArray.h>
 #include <TTree.h>
 
 ClassImp(AliV0vertexer)
 
-Int_t AliV0vertexer::Tracks2V0vertices(const TFile *inp, TFile *out) {
+Int_t AliV0vertexer::Tracks2V0vertices(TTree *tTree, TTree *vTree) {
   //--------------------------------------------------------------------
   //This function reconstructs V0 vertices
   //--------------------------------------------------------------------
-   TFile *in=(TFile*)inp;
-   TDirectory *savedir=gDirectory; 
-
-   if (!in->IsOpen()) {
-     cerr<<"AliV0vertexer::Tracks2V0vertices(): ";
-     cerr<<"file with ITS tracks has not been open !\n";
-     return 1;
-   }
-
-   if (!out->IsOpen()) {
-     cerr<<"AliV0vertexer::Tracks2V0vertices(): ";
-     cerr<<"file for V0 vertices has not been open !\n";
-     return 2;
+   TBranch *branch=tTree->GetBranch("tracks");
+   if (!branch) {
+      Error("Tracks2V0vertices","Can't get the branch !");
+      return 1;
    }
-
-   in->cd();
-
-   Char_t name[100];
-   sprintf(name,"TreeT_ITS_%d",fEventN);
-   TTree *trkTree=(TTree*)in->Get(name);
-   TBranch *branch=trkTree->GetBranch("tracks");
-   Int_t nentr=(Int_t)trkTree->GetEntries();
+   Int_t nentr=(Int_t)tTree->GetEntries();
 
    TObjArray negtrks(nentr/2);
    TObjArray postrks(nentr/2);
@@ -66,7 +49,7 @@ Int_t AliV0vertexer::Tracks2V0vertices(const TFile *inp, TFile *out) {
    for (i=0; i<nentr; i++) {
        AliITStrackV2 *iotrack=new AliITStrackV2;
        branch->SetAddress(&iotrack);
-       trkTree->GetEvent(i);
+       tTree->GetEvent(i);
 
        iotrack->PropagateTo(3.,0.0023,65.19); iotrack->PropagateTo(2.5,0.,0.);
 
@@ -75,11 +58,10 @@ Int_t AliV0vertexer::Tracks2V0vertices(const TFile *inp, TFile *out) {
    }   
 
 
-   out->cd();
-   sprintf(name,"TreeV%d",fEventN);
-   TTree vtxTree(name,"Tree with V0 vertices");
    AliV0vertex *ioVertex=0;
-   vtxTree.Branch("vertices","AliV0vertex",&ioVertex,32000,0);
+   branch=vTree->GetBranch("vertices");
+   if (!branch) vTree->Branch("vertices","AliV0vertex",&ioVertex,32000,3);
+   else branch->SetAddress(&ioVertex);
 
 
    for (i=0; i<nneg; i++) {
@@ -127,7 +109,7 @@ Int_t AliV0vertexer::Tracks2V0vertices(const TFile *inp, TFile *out) {
 
          //vertex.ChangeMassHypothesis(); //default is Lambda0 
 
-         ioVertex=&vertex; vtxTree.Fill();
+         ioVertex=&vertex; vTree->Fill();
 
          nvtx++;
       }
@@ -135,15 +117,9 @@ Int_t AliV0vertexer::Tracks2V0vertices(const TFile *inp, TFile *out) {
 
    cerr<<"Number of reconstructed V0 vertices: "<<nvtx<<endl;
 
-   vtxTree.Write();
-
    negtrks.Delete();
    postrks.Delete();
 
-   savedir->cd();
-   
-   delete trkTree;
-
    return 0;
 }
 
index 3682c40198eaad0d12c48d8eacb2d85249098e1d..621bca75f811092f868ba9613e6ed9f912e44852 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "TObject.h"
 
-class TFile;
+class TTree;
 class AliITStrackV2;
 
 //_____________________________________________________________________________
@@ -21,16 +21,14 @@ public:
   AliV0vertexer(const Double_t cuts[7]);
   void SetCuts(const Double_t cuts[7]);
   void SetVertex(Double_t *vtx) { fX=vtx[0]; fY=vtx[1]; fZ=vtx[2]; }
-  void SetEvent(Int_t ev) {fEventN=ev;}
 
-  Int_t Tracks2V0vertices(const TFile *in, TFile *out);
+  Int_t Tracks2V0vertices(TTree *in, TTree *out);
   Double_t PropagateToDCA(AliITStrackV2 *nt, AliITStrackV2 *pt);
 
   void GetCuts(Double_t cuts[7]) const;
   void GetVertex(Double_t *vtx) { vtx[0]=fX; vtx[1]=fY; vtx[2]=fZ; }
 
 private:
-  Int_t fEventN;          //event number
 
   Double_t fChi2max;      // maximal allowed chi2 
   Double_t fDNmin;        // min. allowed negative daughter's impact parameter
@@ -47,7 +45,6 @@ private:
 };
 
 inline AliV0vertexer::AliV0vertexer() {
-  fEventN=0;
   fChi2max=33.; 
   fDNmin=0.015; fDPmin=0.015;
   fDCAmax=0.01; fCPAmax=0.025; 
@@ -56,7 +53,6 @@ inline AliV0vertexer::AliV0vertexer() {
 }
 
 inline AliV0vertexer::AliV0vertexer(const Double_t cuts[7]) {
-  fEventN=0;
   fChi2max=cuts[0]; 
   fDNmin=cuts[1];   fDPmin=cuts[2];
   fDCAmax=cuts[3];  fCPAmax=cuts[4];