1 void MUONdigit (Int_t evNumber1=0, Int_t evNumber2=0, Int_t ibg=0, Int_t bgr=10)
3 // Dynamically link some shared libs
5 if (gClassTable->GetID("AliRun") < 0) {
6 gROOT->LoadMacro("loadlibs.C");
10 // Connect the Root Galice file containing Geometry, Kine and Hits
12 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
13 if (file) file->Close();
14 file = new TFile("galice.root","UPDATE");
16 // Get AliRun object from file or create it if not on file
19 gAlice = (AliRun*)file->Get("gAlice");
20 if (gAlice) printf("AliRun object found on file\n");
21 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
23 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON");
26 AliMUONMerger* merger = new AliMUONMerger();
30 merger->SetBackgroundFileName("bg.root");
33 pMUON->SetMerger(merger);
39 for (int nev=evNumber1; nev<= evNumber2; nev++) {
40 Int_t nparticles = gAlice->GetEvent(nev);
41 cout << "nev " << nev <<endl;
42 cout << "nparticles " << nparticles <<endl;
43 if (nev < evNumber1) continue;
44 if (nparticles <= 0) return;
45 Int_t nbgr_ev = Int_t(nev*bgr/(evNumber2+1));
48 merger->SetBackgroundEventNumber(nbgr_ev);
51 gAlice->SDigits2Digits();
54 sprintf(hname,"TreeD%d",nev);
55 gAlice->TreeD()->Write(hname);
57 gAlice->TreeD()->Reset();