]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/Simulation.C
removing duplicated code (Christian)
[u/mrichter/AliRoot.git] / PHOS / Simulation.C
index 2a6932dc99f01c03fb3bd3a1ea55930d274790e6..d1763087ea2c3fa0be3c1b1d25883e12e58043a1 100644 (file)
@@ -1,10 +1,38 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+/* $Id$ */
+//_________________________________________________________________________
+// Macros performing the full simulation chain 
+// Use Case : 
+//          root> .L Simulation.C++
+//          root> sim(2, "GSD", "PHOS EMCAL") --> generates 2 events (Config.C)
+//                                                and produces Digits and SDigits  
+//                                                for PHOS and EMCAL 
+//          root> sim(2, "GSDM", "PHOS EMCAL") --> same as before but before making Digits
+//                                                 the 2 signal events are merged with one 
+//                                                 background event in ./bgrd/galice.root
+// author  : Yves Schutz (CERN/SUBATECH)
+// February 2004
+//_________________________________________________________________________
 #include "AliSimulation.h"
 #include "TString.h"
 #include "AliPHOSGetter.h"
 #include "AliEMCALGetter.h"
 #include "Riostream.h"
 
-void simu(TString opt, TString name
+void simu(Int_t nevents=1, TString opt="GSD", TString name="all"
 {
   AliSimulation sim ; 
   // Generation and simulation
@@ -21,29 +49,11 @@ void simu(TString opt, TString name)
   else 
     sim.SetMakeDigits(name.Data()) ;    
   //Merging
-  // to implement 
-  sim.Run() ;  
-  // Checking result
-  if ( name.Contains("PHOS") ) {
-    cout << ">>>>>>>>>>>> PHOS " << endl ; 
-    AliPHOSGetter * gime = AliPHOSGetter::Instance("galice.root") ;
-    Int_t event ; 
-    for (event = 0; event < gime->MaxEvent(); event++) {
-      cout << "event # " << event << endl ; 
-      gime->Event(event, "SD") ; 
-      cout << "  SDigits # " << gime->SDigits()->GetEntries() << endl ; 
-      cout << "   Digits # " << gime->Digits()->GetEntries() << endl ; 
-    }
-  }
-  if ( name.Contains("EMCAL") ) {
-    cout << ">>>>>>>>>>>> EMCAL " << endl ; 
-    AliEMCALGetter * gime = AliEMCALGetter::Instance("galice.root") ;
-    Int_t event ; 
-    for (event = 0; event < gime->MaxEvent(); event++) {
-      cout << "event # " << event << endl ; 
-      gime->Event(event, "SD") ; 
-      cout << "  SDigits # " << gime->SDigits()->GetEntries() << endl ; 
-      cout << "   Digits # " << gime->Digits()->GetEntries() << endl ; 
-    }
-  }
+  if ( opt.Contains("M") )
+    sim.MergeWith("bgrd/galice.root") ;  
+  //Region of Interest
+  sim.SetRegionOfInterest(kFALSE) ; 
+  if ( opt.Contains("W") )
+     sim.SetWriteRawData(name.Data()) ;
+  sim.Run(nevents) ;    
 }