From: coppedis Date: Fri, 1 Mar 2002 16:40:25 +0000 (+0000) Subject: Macro to perform digitization for the ZDC X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=750bb5c0819eae1c96e1dfe4b4cfdb6386887e94;ds=inline Macro to perform digitization for the ZDC --- diff --git a/ZDC/ZDCHits2Digits.C b/ZDC/ZDCHits2Digits.C new file mode 100644 index 00000000000..e4042da6148 --- /dev/null +++ b/ZDC/ZDCHits2Digits.C @@ -0,0 +1,56 @@ +// ------------------------------------------------------------ +// Macro for ZDC digitization +// Macro arguments: totnev = num. of events to be processed +// mode = 0 -> Only digitization (without merging) is performed +// mode = 1 -> Signal for spectators is added to the generated +// background and then the complete event is digitized +// ------------------------------------------------------------ +void ZDCHits2Digits(Int_t totnev, Int_t mode=1) +{ + delete gAlice; + gAlice=0; +// Dynamically link some shared libs + if (gClassTable->GetID("AliRun") < 0) { + gROOT->LoadMacro("loadlibs.C"); + loadlibs(); + } + +// Connect the Root Galice file containing Geometry, Kine, Hits and Digits + TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); + if (!file) { + printf("\n Creating galice.root \n"); + file = new TFile("galice.root"); + } else { + printf("\n galice.root found in file list"); + } + +// Get AliRun object from file or create it if not on file + if (!gAlice) { + gAlice = (AliRun*)file->Get("gAlice"); + if (gAlice) printf("AliRun object found on file\n"); + if (!gAlice) { + printf("\n create new gAlice object"); + gAlice = new AliRun("gAlice","Alice test program"); + } + } + + AliZDCMerger *merger=0; + AliZDC *ZDC = (AliZDC*) gAlice->GetModule("ZDC"); + if (ZDC && mode) { + printf("\n Initializing AliZDCMerger\n"); + merger = new AliZDCMerger(); + merger->SetMode(mode); + merger->SetBackgroundFileName("galice.root"); + ZDC->SetMerger(merger); + } +// +// Loop over events +// + for(Int_t iev=0; ievSetBackgroundEventNum(iev); + } + gAlice->Hits2SDigits("ZDC"); + gAlice->SDigits2Digits("ZDC"); + } // event loop +}