-#include "iostream.h"
-
-void MUONdigit (Int_t evNumber1=0, Int_t evNumber2=9, Int_t ibg=1, Int_t bgr=10)
+void MUONdigit (Int_t evNumber1=0, Int_t evNumber2=0, Int_t ibg=0, Int_t bgr=10)
{
//////////////////////////////////////
// //
// to the ROOT file "galice.root"
// containing the signal hit coordinates from simulation (tree TH).
// Eventually (argument "ibg"), background hits are also taken into account,
- // from the ROOT file "galice_bgr.root".
+ // from the ROOT file "bg.root".
//
// Arguments:
// evNumber1 = first event number to digitize in file "galice.root"
// evNumber2 = last event number to digitize in file "galice.root"
// ibg = 0 if no background hits to be taken into account;
// = 1 if background hits to be taken into account
- // in file "galice_bgr.root"
+ // in file "bg.root"
// bgr : used only if "ibg" = 1
- // = number of events in the background file "galice_bgr.root";
+ // = number of events in the background file "bg.root";
// the signal events are divided into "bgr" successive parts,
// all events of each part are associated
// with the same background event,
//
// Input file(s):
// "galice.root" for signal
- // "galice_bgr.root" for background (used only if "ibg" = 1)
+ // "bg.root" for background (used only if "ibg" = 1)
//
// Output file:
// "galice.root"
if (gAlice) printf("AliRun object found on file\n");
if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
}
- printf ("I'm after gAlice \n");
-
- AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON");
-
-//
-// Event Loop
-//
- Int_t nbgr_ev = 0;
-
- for (int nev=evNumber1; nev<= evNumber2; nev++) {
- Int_t nparticles = gAlice->GetEvent(nev);
- cout << "nev " <<nev<<endl;
- cout << "nparticles " <<nparticles<<endl;
- if (nparticles <= 0) return;
-
- nbgr_ev = Int_t(nev*bgr/(evNumber2+1));
-
+ AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON");
+ if (pMUON) {
+// creation
+ AliMUONMerger* merger = new AliMUONMerger();
+// configuration
if (ibg) {
- printf("nbgr_ev %d\n",nbgr_ev);
- if (MUON) MUON->Digitise(nev,nbgr_ev,"Add"," ","galice_bgr.root");
- } else {
- if (MUON) MUON->Digitise(nev,nbgr_ev,"rien"," ","galice_bgr.root");
+ merger->SetMode(ibg);
+ merger->SetBackgroundFileName("bg.root");
}
-
- } // event loop
- file->Close();
+ // pass
+ pMUON->SetMerger(merger);
+ }
+// Action !
+//
+// Loop over events
+//
+ for (int nev=evNumber1; nev<= evNumber2; nev++) {
+ Int_t nparticles = gAlice->GetEvent(nev);
+ cout << "nev " << nev <<endl;
+ cout << "nparticles " << nparticles <<endl;
+ if (nev < evNumber1) continue;
+ if (nparticles <= 0) return;
+ Int_t nbgr_ev = Int_t(nev*bgr/(evNumber2+1));
+
+ if (ibg) {
+ merger->SetBackgroundEventNumber(nbgr_ev);
+ }
+
+ gAlice->SDigits2Digits();
+
+ char hname[30];
+ sprintf(hname,"TreeD%d",nev);
+ gAlice->TreeD()->Write(hname);
+ // reset tree
+ gAlice->TreeD()->Reset();
+
+ } // event loop
}