From 1621ded284a45f2271416be579d0f3fa44368166 Mon Sep 17 00:00:00 2001 From: masera Date: Fri, 21 Feb 2003 16:24:41 +0000 Subject: [PATCH] Test macros for primary vertex finding --- ITS/AliITSDumpVertices.C | 20 ++++++ ITS/AliITSVertexerTracksTest.C | 79 +++++++++++++++++++++++ ITS/AliITSVertexerTracksTest2.C | 108 ++++++++++++++++++++++++++++++++ ITS/AliITSVertexerZTest.C | 89 ++++++++++++++++++++++++++ 4 files changed, 296 insertions(+) create mode 100644 ITS/AliITSDumpVertices.C create mode 100644 ITS/AliITSVertexerTracksTest.C create mode 100644 ITS/AliITSVertexerTracksTest2.C create mode 100644 ITS/AliITSVertexerZTest.C diff --git a/ITS/AliITSDumpVertices.C b/ITS/AliITSDumpVertices.C new file mode 100644 index 00000000000..9e757ac95ba --- /dev/null +++ b/ITS/AliITSDumpVertices.C @@ -0,0 +1,20 @@ +void AliITSDumpVertices(Int_t firstEv=0, Int_t noev=1, + TString fileimp="AliITSVertices.root", + TString objbasename="VertexTracks_"){ + // This is a simple example on how to access the vertex objects + // The default object base name is VertexTracks_ for AliITSVertexerTracks + // Vertex_ for AliITSVertexerPPZ + // Vertex_ for AliITSVertexerIons + Int_t evmax = firstEv+noev; + TFile *file = new TFile(fileimp); + for(Int_t i=firstEv; iGet(name.Data()); + if(vert){ + cout <<"===============================================\n"; + cout <<" Event n. "<PrintStatus(); + } + } +} diff --git a/ITS/AliITSVertexerTracksTest.C b/ITS/AliITSVertexerTracksTest.C new file mode 100644 index 00000000000..5ca857e8b82 --- /dev/null +++ b/ITS/AliITSVertexerTracksTest.C @@ -0,0 +1,79 @@ +#if !defined(__CINT__) || defined(__MAKECINT__) +//-- --- standard headers------------- +#include +//--------Root headers --------------- +#include +#include +#include +#include +#include +//----- AliRoot headers --------------- +#include "alles.h" +#include "AliRun.h" +#include "AliMagF.h" +#include "AliKalmanTrack.h" +#include "AliITSVertex.h" +#include "AliITSVertexer.h" +#include "AliITSVertexerTracks.h" +//------------------------------------- +#endif +void AliITSVertexerTracksTest(Int_t evFirst=0,Int_t evLast=0, + const Char_t *galiceName="galice.root", + const Char_t *trksName="AliITStracksV2.root", + const Char_t *vtxName="AliITSVertices.root") { + /******************************************************************* + * * + * Test macro for vertexing in pp using tracks. * + * Input file must contain trees with AliITStrackV2 objects. * + * Output file can be the same file with the tracks * + * or another file. * + * If the file galice.root is available, B is taken from there, * + * otherwise is can be set here "by hand". * + * * + * Origin: A.Dainese, Padova andrea.dainese@pd.infn.it * + *******************************************************************/ + + // Look for field value in galice.root + Double_t field = 0.4; + if(!gSystem->AccessPathName(galiceName,kFileExists)) { + TFile *galice = new TFile(galiceName); + gAlice = (AliRun*)galice->Get("gAlice"); + AliMagF *fiel = (AliMagF*)gAlice->Field(); + field=(Double_t)fiel->SolenoidField()/10.; + AliKalmanTrack::SetConvConst(100/0.299792458/field); + printf(" B = %3.1f read from gAlice and set\n",field); + delete gAlice; + gAlice = 0; + galice->Close(); + delete galice; + } else { + printf(" File galice.root not found: default 0.4 T being used!\n"); + } + + // Open input and output files + TFile *inFile = TFile::Open(trksName); + TFile *outFile = TFile::Open(vtxName,"recreate"); + + // Create vertexer + AliITSVertexerTracks *vertexer = + new AliITSVertexerTracks(inFile,outFile,field); + vertexer->SetFirstEvent(evFirst); + vertexer->SetLastEvent(evLast); + vertexer->SetDebug(0); + vertexer->SetUseThrustFrame(0); + vertexer->PrintStatus(); + // Find vertices + vertexer->FindVertices(); + + + delete vertexer; + + + + inFile->Close(); + outFile->Close(); + delete inFile; + delete outFile; + + return; +} diff --git a/ITS/AliITSVertexerTracksTest2.C b/ITS/AliITSVertexerTracksTest2.C new file mode 100644 index 00000000000..470909e541a --- /dev/null +++ b/ITS/AliITSVertexerTracksTest2.C @@ -0,0 +1,108 @@ +#if !defined(__CINT__) || defined(__MAKECINT__) +//-- --- standard headers------------- +#include +//--------Root headers --------------- +#include +#include +#include +#include +#include +//----- AliRoot headers --------------- +#include "alles.h" +#include "AliRun.h" +#include "AliMagF.h" +#include "AliKalmanTrack.h" +#include "AliITSVertex.h" +#include "AliITSVertexer.h" +#include "AliITSVertexerTracks.h" +#include +#include +//------------------------------------- +#endif +void AliITSVertexerTracksTest2(Int_t evFirst=0,Int_t evLast=0, + const Char_t *galiceName="galice.root", + const Char_t *trksName="AliITStracksV2.root", + const Char_t *vtxName="AliITSVertices.root") { + /******************************************************************* + * * + * Test macro for vertexing in pp using tracks. * + * Input file must contain trees with AliITStrackV2 objects. * + * Output file can be the same file with the tracks * + * or another file. * + * If the file galice.root is available, B is taken from there, * + * otherwise is can be set here "by hand". * + * * + * Origin: A.Dainese, Padova andrea.dainese@pd.infn.it * + *******************************************************************/ + + // Look for field value in galice.root + Double_t field = 0.4; + Int_t kDebug = 0; + TFile *galice = 0; + if(!gSystem->AccessPathName(galiceName,kFileExists)) { + galice = new TFile(galiceName); + gAlice = (AliRun*)galice->Get("gAlice"); + AliMagF *fiel = (AliMagF*)gAlice->Field(); + field=(Double_t)fiel->SolenoidField()/10.; + AliKalmanTrack::SetConvConst(100/0.299792458/field); + printf(" B = %3.1f read from gAlice and set\n",field); + } else { + printf(" File galice.root not found: default 0.4 T being used!\n"); + } + + // Open input and output files + TFile *inFile = TFile::Open(trksName); + TFile *outFile = TFile::Open(vtxName,"recreate"); + + // Create vertexer + AliITSVertexerTracks *vertexer = + new AliITSVertexerTracks(inFile,outFile,field,0.,0.); + vertexer->SetDebug(0); + vertexer->SetUseThrustFrame(0); + vertexer->PrintStatus(); + + AliITSVertex *vert = 0; + // Find vertices + + for(Int_t i=evFirst; i<=evLast; i++){ + if(i%100==0)cout<<"processing event "<GetEvent(i); + // The true Z coord. is fetched for comparison + AliHeader *header = gAlice->GetHeader(); + AliGenEventHeader* genEventHeader = header->GenEventHeader(); + TArrayF primaryVertex(3); + genEventHeader->PrimaryVertex(primaryVertex); + vert = vertexer->FindVertexForCurrentEvent(i); + if(kDebug>0){ + // Prints the results + cout <<"========================================================\n"; + cout << "Event number: "<GetZv()<<"; "<GetZRes()<SetTruePos(pos); + vertexer->WriteCurrentVertex(); + } + } + + delete vertexer; + + + + inFile->Close(); + outFile->Close(); + delete inFile; + delete outFile; + galice->Close(); + delete galice; + return; +} diff --git a/ITS/AliITSVertexerZTest.C b/ITS/AliITSVertexerZTest.C new file mode 100644 index 00000000000..fabd4e2b92b --- /dev/null +++ b/ITS/AliITSVertexerZTest.C @@ -0,0 +1,89 @@ +#if !defined(__CINT__) || defined(__MAKECINT__) +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif + +void AliITSVertexerZTest(Float_t delphi=0.05,Float_t window=3.,Float_t initx=0., Float_t inity=0.,TString FileWithKine="galice.root", TString FileWithRecP="galice.root"){ + // delphi ---> azimuthal range to accept tracklets + // window ---> window in Z around the peak of tracklets proj. in mm + Int_t kDebug = 0; + TH2F *diff2 = new TH2F("diff2","Zfound vs Ztrue",100,-6,6,100,-6,6); + TH1F *diff1 = new TH1F("diff1","Zfound - Ztrue(#mu m)",100,-500,500); + delete gAlice; + gAlice = 0; + TFile *in = new TFile("galice.root"); + gAlice = (AliRun*)in->Get("gAlice"); + if(FileWithKine != FileWithRecP)gAlice->SetTreeRFileName(FileWithRecP); + TFile *fo = new TFile("vertici.root","recreate"); + AliITSVertexerPPZ *dovert = new AliITSVertexerPPZ(in,fo,initx,inity); + dovert->SetDebug(0); + dovert->SetDiffPhiMax(delphi); + dovert->SetWindow(window); + dovert->PrintStatus(); + Int_t meno100=0; + Int_t meno200=0; + Int_t meno110=0; + Int_t sigmazero=0; + AliITSVertex *vert = 0; + for(Int_t i=0; iTreeE()->GetEntries(); i++){ + gAlice->GetEvent(i); + // The true Z coord. is fetched for comparison + AliHeader *header = gAlice->GetHeader(); + AliGenEventHeader* genEventHeader = header->GenEventHeader(); + TArrayF primaryVertex(3); + genEventHeader->PrimaryVertex(primaryVertex); + vert = dovert->FindVertexForCurrentEvent(i); + if(kDebug>0){ + // Prints the results + cout <<"========================================================\n"; + cout << "Event number: "<GetZv()<<"; "; + cout<GetZRes()<<"; "<GetNContributors()<