Using new for arrays with undefined size
[u/mrichter/AliRoot.git] / RICH / RICHdetect.C
CommitLineData
11970270 1RICHdetect (Int_t evNumber1=0,Int_t evNumber2=0, Int_t type, Int_t version) {
91bba962 2// Dynamically link some shared libs
3
4 if (gClassTable->GetID("AliRun") < 0) {
5 gROOT->LoadMacro("loadlibs.C");
6 loadlibs();
7 }
8 else {
5cfb142a 9 //delete gAlice;
91bba962 10 gAlice = 0;
11 }
12// Connect the Root Galice file containing Geometry, Kine and Hits
13
14 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
15 if (file) file->Close();
16 file = new TFile("galice.root","UPDATE");
17 file->ls();
18
19 //printf ("I'm after Map \n");
20
21// Get AliRun object from file or create it if not on file
22
23 if (!gAlice) {
24 gAlice = (AliRun*)file->Get("gAlice");
25 if (gAlice) printf("AliRun object found on file\n");
26 if (!gAlice) gAlice = new AliRun("gAlice","RICH reconstruction program");
27 } else {
28 delete gAlice;
29 gAlice = (AliRun*)file->Get("gAlice");
30 if (gAlice) printf("AliRun object found on file\n");
31 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
32 }
33
34 //printf ("I'm after gAlice \n");
35
36 AliRICH *RICH = (AliRICH*) gAlice->GetDetector("RICH");
5cfb142a 37
91bba962 38 // Create Recontruction algorithm object
91bba962 39
11970270 40 //V0
41 if(version == 0)
42 AliRICHDetect *detect = new AliRICHDetect("RICH reconstruction algorithm","Reconstruction");
43
44 if(version == 1)
45 AliRICHDetect *detect = new AliRICHDetectV1("RICH reconstruction algorithm","Reconstruction");
46
47
91bba962 48// Reconstruct
49 // Event Loop
50 //
51 for (int nev=0; nev<= evNumber2; nev++) {
52 Int_t nparticles = gAlice->GetEvent(nev);
68415bd3 53 printf("\nProcessing event: %d\n",nev);
54 printf("\nParticles : %d\n",nparticles);
91bba962 55 if (nev < evNumber1) continue;
56 if (nparticles <= 0) return;
11970270 57 if (RICH) detect->Detect(nev, type);
91bba962 58 char hname[30];
59 sprintf(hname,"TreeR%d",nev);
60 gAlice->TreeR()->Write(hname);
61 gAlice->TreeR()->Reset();
62 } // event loop
63
64 //delete gAlice;
65 printf("\nEnd of Macro *************************************\n");
66}
67
68
69