]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Macro to perform digitization for the ZDC
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 1 Mar 2002 16:40:25 +0000 (16:40 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 1 Mar 2002 16:40:25 +0000 (16:40 +0000)
ZDC/ZDCHits2Digits.C [new file with mode: 0644]

diff --git a/ZDC/ZDCHits2Digits.C b/ZDC/ZDCHits2Digits.C
new file mode 100644 (file)
index 0000000..e4042da
--- /dev/null
@@ -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; iev<totnev; iev++) {
+       if(mode){
+         merger->SetBackgroundEventNum(iev);
+       }
+       gAlice->Hits2SDigits("ZDC");
+       gAlice->SDigits2Digits("ZDC");
+    }   // event loop 
+}