added cdb stuff
[u/mrichter/AliRoot.git] / PHOS / Simulation.C
CommitLineData
12391a12 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15/* $Id$ */
16//_________________________________________________________________________
17// Macros performing the full simulation chain
18// Use Case :
19// root> .L Simulation.C++
20// root> sim(2, "GSD", "PHOS EMCAL") --> generates 2 events (Config.C)
21// and produces Digits and SDigits
22// for PHOS and EMCAL
23// root> sim(2, "GSDM", "PHOS EMCAL") --> same as before but before making Digits
24// the 2 signal events are merged with one
25// background event in ./bgrd/galice.root
26// author : Yves Schutz (CERN/SUBATECH)
27// February 2004
28//_________________________________________________________________________
baf5b427 29#include "AliSimulation.h"
30#include "TString.h"
baf5b427 31#include "Riostream.h"
54df6e4d 32#include "TStopwatch.h"
baf5b427 33
54df6e4d 34void simu(Int_t nevents=1, TString opt="GSD", TString name="all", TString cdb="")
baf5b427 35{
36 AliSimulation sim ;
37 // Generation and simulation
38 if ( !opt.Contains("G") )
39 sim.SetRunGeneration(kFALSE) ;
40 // Making SDigits
41 if ( !opt.Contains("S") )
42 sim.SetMakeSDigits("") ;
54df6e4d 43 else {
44 sim.SetMakeSDigits(name.Data()) ;
45 if (name.Contains("ITS") || name.Contains("all"))
46 sim.SetMakeDigitsFromHits("ITS ") ;
47 if (name.Contains("TPC") || name.Contains("all"))
48 sim.SetMakeDigitsFromHits("TPC") ;
49 }
baf5b427 50 // Making Digits
51 if ( !opt.Contains("D") )
52 sim.SetMakeDigits("") ;
53 else
54 sim.SetMakeDigits(name.Data()) ;
55 //Merging
4f36a998 56 if ( opt.Contains("M") )
23c75532 57 sim.MergeWith("bgrd/galice.root") ;
0068d40c 58 //Region of Interest
59 sim.SetRegionOfInterest(kFALSE) ;
60 if ( opt.Contains("W") )
54df6e4d 61 sim.SetWriteRawData(name.Data(),"raw.root",kTRUE) ;
62 if ( !cdb.IsNull() )
63 sim.SetDefaultStorage(cdb.Data()) ;
64
65 TStopwatch timer;
66 timer.Start();
23c75532 67 sim.Run(nevents) ;
54df6e4d 68 timer.Stop();
69 timer.Print();
70
baf5b427 71}