]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliMerge.C
Macro to plot pathlengths of back-to-back jets. (A. Dainese)
[u/mrichter/AliRoot.git] / STEER / AliMerge.C
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // name: AliMerge
4 // date: 21.07.2003
5 // last update: 21.07.2003
6 // author: Thomas Kuhr
7 // version: 1.0
8 //
9 // description: 
10 //    merges sdigits from a signal and a background event
11 //    to digits for several detectors
12 //    (for advanced features like more input streams see 
13 //     AliRunDigitizer.cxx)
14 //
15 // input:
16 //    const char* fileNameSignal : galice file of the signal event
17 //    const char* fileNameBkgrd  : galice file of the background event
18 //    Int_t nEvents              : how many events to process (<0 means all)
19 //    Int_t signalPerBkgrd       : number of signal events merged with 
20 //                                 the same background event
21 //    Int_t ITS, TPC, ...        : flags for diff. detectors
22 //
23 // History:
24 //
25 // 21.07.03 - first version
26 // 
27 ////////////////////////////////////////////////////////////////////////
28
29 #if !defined(__CINT__) || defined(__MAKECINT__)
30 #include "STEER/AliRun.h"
31 #include "STEER/AliRunDigitizer.h"
32 #include "ITS/AliITSDigitizer.h"
33 #include "ITS/AliITSFDigitizer.h"
34 #include "TPC/AliTPCDigitizer.h"
35 #include "TRD/AliTRDdigitizer.h"
36 #include "PHOS/AliPHOSDigitizer.h"
37 #include "MUON/AliMUONDigitizer.h"
38 #include "RICH/AliRICHDigitizer.h"
39 #include "TStopwatch.h"
40 #endif
41
42 Bool_t AliMerge(const char* fileNameSignal = "signal/galice.root",
43                 const char* fileNameBkgrd = "bkgrd/galice.root",
44                 Int_t nEvents = -1, Int_t signalPerBkgrd = 1,
45                 Int_t iITS = 0, Int_t iTPC = 0, Int_t iTRD = 0,
46                 Int_t iPHOS = 0, Int_t iMUON = 0, Int_t iRICH = 0)
47 {
48   if (gAlice) delete gAlice;
49   gAlice = NULL;
50
51   AliRunDigitizer* manager = new AliRunDigitizer(2, signalPerBkgrd);
52   manager->SetInputStream(0, fileNameSignal);
53   manager->SetInputStream(1, fileNameBkgrd);
54   if (nEvents >= 0) manager->SetNrOfEventsToWrite(nEvents);
55
56   if (iITS == 1) new AliITSDigitizer(manager);
57   if (iITS == 2) new AliITSFDigitizer(manager);
58   if (iTPC) new AliTPCDigitizer(manager);
59   if (iTRD) new AliTRDdigitizer(manager);
60   if (iPHOS) new AliPHOSDigitizer(manager);
61   if (iMUON) new AliMUONDigitizer(manager);
62   if (iRICH) new AliRICHDigitizer(manager);
63
64   TStopwatch timer;
65   timer.Start();
66   manager->Exec("deb all");
67   timer.Stop(); 
68   timer.Print();
69
70   delete manager;
71   return kTRUE;
72 }
73