1 void AliBarrelRec_TPCparam(Int_t firstEvent=0,Int_t lastEvent=0) {
3 // Macro to create AliESDs.root using parametrized TPC tracking
9 // - TrackReferences.root
10 // - ITS.RecPoints.root (use AliRecontruction class)
11 // - ITS.Vertex.root (use $ALICE_ROOT/ITS/AliITSVertexerZTest.C)
17 /**** Initialization of the NewIO *******/
20 delete gAlice->GetRunLoader();
25 AliRunLoader *rl = AliRunLoader::Open("galice.root");
27 cerr<<"Can not open session"<<endl;
30 Int_t retval = rl->LoadgAlice();
32 cerr<<"LoadgAlice returned error"<<endl;
36 retval = rl->LoadHeader();
38 cerr<<"LoadHeader returned error"<<endl;
42 gAlice=rl->GetAliRun();
45 TDatabasePDG *DataBase = TDatabasePDG::Instance();
47 // Get field from galice.root
48 AliMagF *fiel = (AliMagF*)gAlice->Field();
49 Double_t fieval=TMath::Abs((Double_t)fiel->SolenoidField()/10.);
50 // Set the conversion constant between curvature and Pt
51 AliTracker::SetFieldMap(fiel,kTRUE);
53 /**** The TPC corner ********************/
55 Int_t collcode = 1; // pp collisions
56 AliTPCtrackerParam tpcTrackerPar(collcode,fieval);
59 //**** Switch on the PID class (mandatory!)
62 /**** The ITS corner ********************/
64 AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
66 cerr<<"Cannot get the ITS loader"<<endl;
69 itsl->LoadRecPoints("read");
71 AliITS *dITS = (AliITS*)gAlice->GetDetector("ITS");
73 cerr<<"Cannot find the ITS detector !"<<endl;
76 AliITSgeom *geom = dITS->GetITSgeom();
78 //An instance of the ITS tracker
79 AliITStrackerV2 itsTracker(geom);
80 Int_t ITSclusters[6] = {1,1,1,1,1,1};
81 itsTracker.SetLayersNotToSkip(ITSclusters);
83 /***** The TREE is born *****/
85 TTree *esdTree=new TTree("esdTree","Tree with ESD objects");
87 esdTree->Branch("ESD","AliESD",&event);
89 if(firstEvent>rl->GetNumberOfEvents()) firstEvent=rl->GetNumberOfEvents()-1;
90 if(lastEvent>rl->GetNumberOfEvents()) lastEvent=rl->GetNumberOfEvents()-1;
91 cout<<" Number of events: "<<1+lastEvent-firstEvent<<endl;
93 TFile *ppZ = TFile::Open("ITS.Vertex.root"); // z vertices from SPD
94 AliESDVertex *myvertex = new AliESDVertex();
100 //<----------------------------------The Loop over events begins
103 for(Int_t i=firstEvent; i<=lastEvent; i++) {
105 cerr<<" Processing event number : "<<i<<endl;
106 AliESD *event = new AliESD();
107 event->SetRunNumber(gAlice->GetRunNumber());
108 event->SetEventNumber(i);
109 event->SetMagneticField(gAlice->Field()->SolenoidField());
112 //***** Primary vertex
113 sprintf(zver,"Event%d/Vertex",i);
114 myvertex = (AliESDVertex*)ppZ->Get(zver);
116 esdTree->Fill(); delete event;
119 event->SetVertex(myvertex);
120 myvertex->GetXYZ(vtx);
121 myvertex->GetCovMatrix(cvtx);
124 if ( (trc=tpcTrackerPar.BuildTPCtracks(event)) ) {
125 printf("exiting TPC tracker with code %d in event %d\n",trc,i);
126 esdTree->Fill(); delete event;
131 itsTracker.SetVertex(vtx,cvtx);
132 TTree *itsTree=itsl->TreeR();
134 cerr<<"Can't get the ITS cluster tree !\n";
135 esdTree->Fill(); delete event;
138 itsTracker.UnloadClusters();
139 itsTracker.LoadClusters(itsTree);
140 if ( (trc=itsTracker.Clusters2Tracks(event)) ) {
141 printf("exiting ITS tracker with code %d in event %d\n",trc,i);
142 esdTree->Fill(); delete event;
150 }//<-----------------------------------The Loop over events ends here
151 timer.Stop(); timer.Print();
153 // The AliESDs.root is born
154 TFile *ef = TFile::Open("AliESDs.root","RECREATE");
155 if (!ef || !ef->IsOpen()) {cerr<<"Can't open AliESDs.root !\n"; return;}
157 esdTree->Write(); //Write the TREE and close everything