]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/exa/MCGeneratorPublisher.C
Merge branch 'master_patch'
[u/mrichter/AliRoot.git] / HLT / exa / MCGeneratorPublisher.C
1 /**
2  * @file MCGeneratorPublisher.C
3  * @brief Macro for testing of the generation and publishing of AliHLTMCEvent
4  *
5  * This macro is a testing/example macro of how to use the MCGenerator 
6  * (AliHLTMCGeneratorComponent) and RootFileWriter (AliHLTRootFileWriter). 
7  * It defines only two component in the chain, the publisher, which 
8  * publishes the content of the root files according to the selection. 
9  * Be aware there can be several root objects in one root file.
10  *
11  * For more descriptions, especially the used datatypes and specification:
12  * @see AliHLTMCGeneratorComponent
13  *
14  * @author thaeder@kip.uni-heidelberg.de
15  * @ingroup alihlt_tutorial
16  */
17
18 // ---------------------------------------------------------------------------- 
19 // -- Pythia Parameter 
20 // ---------------------------------------------------------------------------- 
21
22 enum PprRun_t {
23   kPythia6Jets20_24,   kPythia6Jets24_29,   kPythia6Jets29_35,
24   kPythia6Jets35_42,   kPythia6Jets42_50,   kPythia6Jets50_60,
25   kPythia6Jets60_72,   kPythia6Jets72_86,   kPythia6Jets86_104,
26   kPythia6Jets104_125, kPythia6Jets125_150, kPythia6Jets150_180,
27   kPyJetJet, kPyGammaJetPHOS, kRunMax
28 };
29
30 const Char_t* pprRunName[] = {
31   "kPythia6Jets20_24",   "kPythia6Jets24_29",   "kPythia6Jets29_35",
32   "kPythia6Jets35_42",   "kPythia6Jets42_50",   "kPythia6Jets50_60",
33   "kPythia6Jets60_72",   "kPythia6Jets72_86",   "kPythia6Jets86_104",
34   "kPythia6Jets104_125", "kPythia6Jets125_150", "kPythia6Jets150_180",
35   "kPyJetJet", "kPyGammaJetPHOS"
36 };
37
38
39 /** ESDMCEventPublisher test macro
40  *  @param nEvents Number of events which should be processed
41  */
42 void MCGeneratorPublisher(Int_t nEvents=10, PprRun_t runType = kPythia6Jets104_125) {
43
44   TString writerInput;
45
46   // -- Switch Logging
47   // -------------------
48   AliLog::SetGlobalLogLevel( AliLog::kError );
49   AliHLTLogging log;
50   log.SwitchAliLog(0);
51
52   // -- Initialize HLT
53   // -------------------
54   AliHLTSystem gHLT;
55   gHLT.SetGlobalLoggingLevel(0x7D);
56   
57   gHLT.LoadComponentLibraries("libAliHLTUtil.so");
58
59   gHLT.LoadComponentLibraries("liblhapdf.so");  
60   gHLT.LoadComponentLibraries("libEGPythia6.so");   
61   gHLT.LoadComponentLibraries("libpythia6.so");  
62   gHLT.LoadComponentLibraries("libAliPythia6.so");  
63
64   // ----------------------------//
65   // -                         - //
66   // -- Parameters            -- //
67   // -                         - //
68   // ----------------------------//
69
70   Float_t coneRadius = 0.7;
71   Float_t cutPtSeed  = 4.0;
72   Float_t cutEtJet   = 7.0;
73
74   Int_t seed = 12345;
75
76   // ----------------------------//
77   // -                         - //
78   // -- Publisher  Components -- //
79   // -                         - //
80   // ----------------------------//
81  
82   TString generatorId( Form("MCGenerator_%s", pprRunName[runType]) );
83   
84   TString generatorArg( Form("-seed %d -nevents %d -runtype %d -coneRadius %.1f -jetCutMinEt %.1f", 
85                              seed, nEvents, runType, coneRadius, cutEtJet));
86   
87   AliHLTConfiguration mcGenerator(generatorId.Data(), "MCGenerator", NULL, generatorArg.Data() );
88   
89   if (!writerInput.IsNull()) writerInput+=" ";
90   writerInput += generatorId;
91
92   // ----------------------------//
93   // -                         - //
94   // --    Sink Components    -- //
95   // -                         - //
96   // ----------------------------//
97   
98   TString writerArg( Form("-directory analysis -datafile analyze_%d_%s -write-all-events", nEvents, pprRunName[runType] ));
99
100   // -- The RootFileWriter 
101   AliHLTConfiguration rootWriter("RootWriter", "ROOTFileWriter", 
102                                  writerInput.Data(), writerArg.Data() );
103   
104   // --------------------------- //
105   // -                         - //
106   // --         Run           -- //
107   // -                         - //
108   // --------------------------- //
109
110   gHLT.BuildTaskList("RootWriter");
111   gHLT.Run(nEvents);
112
113   return;
114 }