Bug fix in TRF parametrization (Alex)
[u/mrichter/AliRoot.git] / ITS / AliITSHits2FastRecPoints.C
CommitLineData
88cb7938 1void AliITSHits2FastRecPoints (Int_t evNumber1=0,Int_t evNumber2=0, TString inFile = "galice.root", Int_t nsignal=25, Int_t size=-1)
af8e1c2d 2{
cc2535cd 3 /////////////////////////////////////////////////////////////////////////
4 //
5 // This macro creates fast recpoints, optionally on a separate file
6 //
7 /////////////////////////////////////////////////////////////////////////
8
88cb7938 9
cc2535cd 10 // Dynamically link some shared libs
11
12 if (gClassTable->GetID("AliRun") < 0) {
13 gROOT->LoadMacro("loadlibs.C");
14 loadlibs();
88cb7938 15 } else if (gAlice){
16 delete gAlice->GetRunLoader();
17 delete gAlice;
18 gAlice=0;
cc2535cd 19 }
20
21 // Connect the Root Galice file containing Geometry, Kine and Hits
88cb7938 22 AliRunLoader* rl = AliRunLoader::Open("galice.root");
23 if (rl == 0x0)
24 {
25 ::Error("AliITSHits2FastRecPoints.C","Can not open session RL=NULL");
26 return;
27 }
28
29 Int_t retval = rl->LoadgAlice();
30 if (retval)
31 {
32 ::Error("AliITSHits2FastRecPoints.C","LoadgAlice returned error");
33 delete rl;
34 return;
35 }
36 gAlice=rl->GetAliRun();
37 rl->LoadHeader();
38 retval = rl->LoadKinematics();
39 if (retval)
40 {
41 ::Error("AliITSHits2FastRecPoints.C","LoadKinematics returned error");
42 delete rl;
43 return;
44 }
45
46 AliITSLoader* gime = (AliITSLoader*)rl->GetLoader("ITSLoader");
47 if (gime == 0x0)
48 {
49 ::Error("AliITSHits2FastRecPoints.C","can not get ITS loader");
50 delete rl;
51 return;
52 }
53 retval = gime->LoadHits("read");
54 if (retval)
55 {
56 ::Error("AliITSHits2FastRecPoints.C","LoadHits returned error");
57 delete rl;
58 return;
59 }
60 gime->SetRecPointsFileName("ITS.FastRecPoints.root");
61 retval = gime->LoadRecPoints("update");
62 if (retval)
63 {
64 ::Error("AliITSHits2FastRecPoints.C","LoadRecPoints returned error");
65 delete rl;
66 return;
67 }
68
00a7cc50 69
70 TDirectory * olddir = gDirectory;
71 rl->CdGAFile();
72 AliITSgeom* geom = (AliITSgeom*)gDirectory->Get("AliITSgeom");
73 olddir->cd();
74 if(!geom){
75 Error("GetITSgeom","no ITS geometry available");
76 return NULL;
77 }
78
79
88cb7938 80 AliITS *ITS = (AliITS*) gAlice->GetModule("ITS");
81 if (!ITS) return;
af8e1c2d 82
83 // Set the simulation model
84
af8e1c2d 85
86
cc2535cd 87 //
88 // Event Loop
89 //
90
91 Int_t nbgr_ev=0;
92 TStopwatch timer;
93
94 cout << "Creating fast reconstructed points from hits for the ITS..." << endl;
00a7cc50 95 AliITSDetTypeSim* dettyp = new AliITSDetTypeSim();
96 dettyp->SetITSgeom(geom);
97 dettyp->SetLoader(gime);
98 ITS->SetDetTypeSim(dettyp);
99 for (Int_t i=0;i<3;i++) {
100 ITS->SetSimulationModel(i,new AliITSsimulationFastPoints());
101 }
cc2535cd 102
00a7cc50 103
cc2535cd 104 for (int ev=evNumber1; ev<= evNumber2; ev++) {
105 cout << "...working on event "<< ev << " ..." << endl;
106 Int_t nparticles = gAlice->GetEvent(ev);
107 cout << "event " <<ev<<endl;
108 cout << "nparticles " <<nparticles<<endl;
88cb7938 109 rl->GetEvent(ev);
00a7cc50 110 //if(gime->TreeR() == 0x0) gime->MakeTree("R");
111
112 if (ev < evNumber1) continue;
cc2535cd 113 if (nparticles <= 0) return;
114
115 Int_t bgr_ev=Int_t(ev/nsignal);
cc2535cd 116 timer.Start();
117 ITS->HitsToFastRecPoints(ev,bgr_ev,size," ","All"," ");
118 timer.Stop(); timer.Print();
119 } // event loop
120
88cb7938 121 delete rl;
af8e1c2d 122}
123