1 void MUONtracking (Int_t evNumber1=0, Int_t evNumber2=99, Int_t idres=116, Int_t ireadgeant=1, Int_t ibgr=1, Int_t nev_bgd=10)
3 //////////////////////////////////////
5 // ROOT macro for ALICE Dimuon Arm: //
6 // Track reconstruction //
8 //////////////////////////////////////
10 // Reconstructs tracks from events in the ROOT file "galice.root".
11 // Track reconstruction is performed (argument "ireadgeant")
12 // either directly from GEANT hits (tree TH),
13 // or from raw clusters (tree TR) constructed from digits (tree TD).
14 // Eventually (argument "ibgr"), background GEANT hits
15 // are also taken into account from the ROOT file "galice_bgr.root".
18 // evNumber1 = first event number to act on in file "galice.root"
19 // evNumber2 = last event number to act on in file "galice.root"
20 // idres : used for statistics
23 // ireadgeant = 1 to reconstruct tracks directly from GEANT hits
24 // = 0 to reconstruct tracks from raw clusters
25 // ibg : used only if "ireadgeant" = 1
26 // = 0 if no background GEANT hits to be taken into account;
27 // = 1 if background GEANT hits
28 // to be taken into account in file "galice_bgr.root"
29 // used only if "ireadgeant" = 1
30 // nev_bgd : used only if "ireadgeant" = 1 and "ibg" = 1
31 // = number of events in the background file "galice_bgr.root";
32 // successive signal events are mixed
33 // with different background events in file "galice_bgr.root",
34 // starting from event number 0,
35 // incrementing it by 1 till event number ("nev_bgd" - 1),
36 // continuing with event number 0 and so on.
37 // Strictly speaking, "nev_bgd" can be smaller than
38 // the number of events in the background file,
39 // in which case one will only use
40 // the first "nev_bgd" events of the background file.
41 // But it SHOULD NOT BE LARGER THAN
42 // THE ACTUAL NUMBER OF EVENTS IN THE BACKGROUND FILE.
45 // "galice.root" for GEANT hits or raw clusters
46 // "galice_bgr.root" for background GEANT hits
47 // (used only if "ireadgeant" = 1 and "ibg" = 1)
50 // "reconst.root" for ROOT ntuples
52 //__________________________________________________________________________
54 // Dynamically link some shared libs
56 if (gClassTable->GetID("AliRun") < 0) {
57 gROOT->LoadMacro("loadlibs.C");
60 // Connect the Root Galice file containing Geometry, Kine and Hits
62 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
65 printf("\n Creating galice.root \n");
66 file = new TFile("galice.root");
67 } else { printf("\n galice.root found in file list");
70 // Get AliRun object from file or create it if not on file
72 gAlice = (AliRun*)(file->Get("gAlice"));
73 if (gAlice) printf("AliRun object found on file\n");
75 printf("\n create new gAlice object");
76 gAlice = new AliRun("gAlice","Alice test program");
80 // seff = efficiency per chamber (ireadgeant=1)
82 // Double_t seff = 1.;
83 // sb0 = magn. field in dipole, sbl3 = magn. field in L3
84 // necessary for trackfinding only.
88 // ifit = 0 trackfinding only
89 // ifit = 1 trackfinding + fit
91 // idebug = 0,1,2 print level for reco_muon.F
94 AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON");
95 AliMUONTrackReconstructor *Reconstruction = new AliMUONTrackReconstructor();
96 Int_t nparticles = gAlice->GetEvent(evNumber1);
97 if (nparticles <= 0) return;
99 Reconstruction->Init(seff,sb0,sbl3);
105 for (Int_t nev= evNumber1; nev<= evNumber2; nev++)
107 printf("nev=%d\n",nev);
108 if (nev != evNumber1) Int_t nparticles = gAlice->GetEvent(nev);
109 if (nev < evNumber1) continue;
110 if (nparticles <= 0) return;
111 Reconstruction->FinishEvent();
112 if (ireadgeant==1 && ibgr==1) {
113 if (inev_bgd==nev_bgd) inev_bgd=0;
114 Reconstruction->Reconst(ifit,idebug,inev_bgd,nev,idres,ireadgeant,"Add","galice_bgr.root");
115 Reconstruction->FinishEvent();
119 // printf("ireadgeant=%d\n",ireadgeant);
120 Reconstruction->Reconst(ifit,idebug,inev_bgd,nev,idres,ireadgeant,"rien1","rien2");
121 Reconstruction->FinishEvent();
127 Reconstruction->Close();