]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/runSimulation.C
Fix for the problem during PbPb run of Nov 2010 (Indra)
[u/mrichter/AliRoot.git] / MUON / runSimulation.C
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
16 /* $Id$ */
17
18 /// \ingroup macros
19 /// \file runSimulation.C
20 /// \brief Macro for running simulation
21 ///
22 /// Macro extracted from the MUON test script
23 ///
24 /// \author Laurent Aphecetche
25
26 #if !defined(__CINT__) || defined(__MAKECINT__)
27 #include "AliCDBManager.h"
28 #include "AliSimulation.h"
29 #include "AliRun.h"
30 #include "AliHeader.h"
31 #include <TRandom.h>
32 #include <Riostream.h>
33 #endif
34
35 void runSimulation(int seed, 
36                    int nevents, 
37                    const char* config,
38                    const char* embedwith)
39
40 // Uncoment following lines to run simulation with local residual mis-alignment
41 // (generated via MUONGenerateGeometryData.C macro)
42 // AliCDBManager* man = AliCDBManager::Instance();
43 // man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
44 // man->SetSpecificStorage("MUON/Align/Data","local://$ALICE_ROOT/OCDB/MUON/ResMisAlignCDB");
45
46   AliSimulation MuonSim(config);
47   
48   if ( strlen(embedwith) > 0 )
49   {
50     // setups specific to embedding
51     
52     gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2S\",kTRUE);");
53     
54     // get the run number from real data
55     
56     AliRunLoader* runLoader = AliRunLoader::Open(embedwith,"titi");
57     if (runLoader == 0x0) 
58     {
59       cerr << Form("Cannot open file %s",embedwith) << endl;    
60       return;
61     }
62     
63     runLoader->LoadHeader();
64     
65     if ( ! runLoader->GetHeader() ) {
66       cerr << "Cannot load header." << endl;   
67       return;
68     }
69     else {
70       Int_t runNumber = runLoader->GetHeader()->GetRun();
71       MuonSim.SetRunNumber(runNumber);
72       cout << Form("***** RUN NUMBER SET TO %09d ACCORDING TO %s ",runNumber,embedwith) << endl;
73     }  
74     runLoader->UnloadHeader(); 
75     delete runLoader;
76     
77     cout << "***** EMBEDDING MODE : USING RAW OCDB" << endl;
78     AliCDBManager::Instance()->SetDefaultStorage("raw://");
79     AliCDBManager::Instance()->SetSpecificStorage("local://$ALICE_ROOT/OCDB","MUON/Calib/Gains");
80     AliCDBManager::Instance()->SetSpecificStorage("local://$ALICE_ROOT/OCDB","MUON/Align/Data");
81     
82   }
83   else
84   {
85     gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2S\",kFALSE);");    
86   }
87   
88   MuonSim.SetSeed(seed);
89   MuonSim.SetTriggerConfig("MUON");
90   MuonSim.SetWriteRawData("MUON HLT","raw.root",kTRUE);
91
92   MuonSim.SetMakeDigits("MUON");
93   MuonSim.SetMakeSDigits("MUON");
94   MuonSim.SetMakeDigitsFromHits("");
95
96   MuonSim.SetRunHLT("libAliHLTMUON.so chains=dHLT-sim");
97
98   MuonSim.SetRunQA("MUON:ALL");
99   
100   if ( strlen(embedwith) > 0 ) 
101   {
102     MuonSim.MergeWith(embedwith);
103   }
104   
105   MuonSim.Run(nevents);
106   //gObjectTable->Print();
107
108 }