* 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"
};
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
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;
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];
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;
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 ***/
}
/*** 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);
}
+ delete rl;
return nc;
}
-#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
};
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;
}
// 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);
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);
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.);
}
- // 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
//cascade.ChangeMassHypothesis(); //default is Xi
- ioCascade=&cascade; cascTree.Fill();
+ ioCascade=&cascade; xTree->Fill();
ncasc++;
cerr<<"Number of reconstructed cascades: "<<ncasc<<endl;
- cascTree.Write();
-
trks.Delete();
vtxV0.Delete();
- savedir->cd();
-
return 0;
}
#include "TObject.h"
-class TFile;
+class TTree;
class AliITStrackV2;
class AliV0vertex;
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;
#endif
-
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)
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);
fVertexDataLoader.SetEventFolder(fEventFolder);
fVertexDataLoader.SetFolder(GetDetectorDataFolder());
+ fDataLoaders->Add(&fV0DataLoader);
+ fV0DataLoader.SetEventFolder(fEventFolder);
+ fV0DataLoader.SetFolder(GetDetectorDataFolder());
+
+ fDataLoaders->Add(&fCascadeDataLoader);
+ fCascadeDataLoader.SetEventFolder(fEventFolder);
+ fCascadeDataLoader.SetFolder(GetDetectorDataFolder());
+
}
/*****************************************************************************/
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);
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()
UnloadVertices();
fDataLoaders->Remove(&fVertexDataLoader);
+ UnloadV0s();
+ fDataLoaders->Remove(&fV0DataLoader);
+
+ UnloadCascades();
+ fDataLoaders->Remove(&fCascadeDataLoader);
+
}
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();
+
}
// 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();}
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;
AliDataLoader fVertexDataLoader;
static const TString fgkDefaultVerticesContainerName;
+ AliDataLoader fV0DataLoader;
+ static const TString fgkDefaultV0ContainerName;
+
+ AliDataLoader fCascadeDataLoader;
+ static const TString fgkDefaultCascadeContainerName;
+
public:
ClassDef(AliITSLoader,2)
};
* 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"
};
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;
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++) {
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;
timer.Stop(); timer.Print();
+ delete rl;
+
return 0;
}
}
/*** 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);
nv++;
}
- delete gAlice; gAlice=0;
-
- file->Close();
+ delete rl;
return nv;
}
-#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
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;
}
// 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);
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.);
}
- 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++) {
//vertex.ChangeMassHypothesis(); //default is Lambda0
- ioVertex=&vertex; vtxTree.Fill();
+ ioVertex=&vertex; vTree->Fill();
nvtx++;
}
cerr<<"Number of reconstructed V0 vertices: "<<nvtx<<endl;
- vtxTree.Write();
-
negtrks.Delete();
postrks.Delete();
- savedir->cd();
-
- delete trkTree;
-
return 0;
}
#include "TObject.h"
-class TFile;
+class TTree;
class AliITStrackV2;
//_____________________________________________________________________________
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
};
inline AliV0vertexer::AliV0vertexer() {
- fEventN=0;
fChi2max=33.;
fDNmin=0.015; fDPmin=0.015;
fDCAmax=0.01; fCPAmax=0.025;
}
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];