Remove the dollar-id-dollar in the responsible name which interfere with CDB_MD metad...
[u/mrichter/AliRoot.git] / MUON / runSimulation.C
CommitLineData
4d717204 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
e54bf126 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
4d717204 25
26#if !defined(__CINT__) || defined(__MAKECINT__)
bde793f3 27#include "AliCDBManager.h"
28#include "AliSimulation.h"
67c48a1e 29#include "AliRun.h"
30#include "AliHeader.h"
bde793f3 31#include <TRandom.h>
67c48a1e 32#include <Riostream.h>
4d717204 33#endif
34
ca8c8223 35void runSimulation(int seed,
36 int nevents,
37 const char* config,
05315e71 38 const char* embedwith,
39 int runnumber)
4d717204 40{
41// Uncoment following lines to run simulation with local residual mis-alignment
42// (generated via MUONGenerateGeometryData.C macro)
43// AliCDBManager* man = AliCDBManager::Instance();
162637e4 44// man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
45// man->SetSpecificStorage("MUON/Align/Data","local://$ALICE_ROOT/OCDB/MUON/ResMisAlignCDB");
745f6baf 46
4d717204 47 AliSimulation MuonSim(config);
ca8c8223 48
49 if ( strlen(embedwith) > 0 )
50 {
51 // setups specific to embedding
52
53 gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2S\",kTRUE);");
54
55 // get the run number from real data
56
57 AliRunLoader* runLoader = AliRunLoader::Open(embedwith,"titi");
58 if (runLoader == 0x0)
59 {
67c48a1e 60 cerr << Form("Cannot open file %s",embedwith) << endl;
ca8c8223 61 return;
62 }
63
64 runLoader->LoadHeader();
65
66 if ( ! runLoader->GetHeader() ) {
67c48a1e 67 cerr << "Cannot load header." << endl;
ca8c8223 68 return;
69 }
70 else {
71 Int_t runNumber = runLoader->GetHeader()->GetRun();
72 MuonSim.SetRunNumber(runNumber);
73 cout << Form("***** RUN NUMBER SET TO %09d ACCORDING TO %s ",runNumber,embedwith) << endl;
74 }
75 runLoader->UnloadHeader();
76 delete runLoader;
77
78 cout << "***** EMBEDDING MODE : USING RAW OCDB" << endl;
79 AliCDBManager::Instance()->SetDefaultStorage("raw://");
ca8c8223 80 AliCDBManager::Instance()->SetSpecificStorage("local://$ALICE_ROOT/OCDB","MUON/Align/Data");
81
82 }
05315e71 83 else if ( runnumber > 0 )
84 {
85 // simulation with anchor run
86
87 cout << "***** ANCHOR RUN MODE : USING RAW OCDB AS MUCH AS POSSIBLE" << endl;
88 cout << "***** AND TAKING VERTEX FROM OCDB IF AVAILABLE" << endl;
89
90 // Last parameter of Config.C indicates we're doing realistic simulations, so we NEED
91 // the ITS in the geometry
92 gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2S\",kFALSE,kTRUE);");
93
94 AliCDBManager::Instance()->SetDefaultStorage("raw://");
95 // use something like : "alien://folder=/alice/data/2011/OCDB?cacheFold=/Users/laurent/OCDBcache" instead of "raw://"
96 // if getting slow/problematic accesses to OCDB...
97
98 AliCDBManager::Instance()->SetSpecificStorage("MUON/Align/Data","alien://folder=/alice/cern.ch/user/j/jcastill/LHC10hMisAlignCDB");
99
100 MuonSim.SetRunNumber(runnumber);
101
102 MuonSim.UseVertexFromCDB();
103 }
ca8c8223 104 else
105 {
106 gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2S\",kFALSE);");
107 }
108
034dd3ad 109 MuonSim.SetSeed(seed);
75e6f056 110 MuonSim.SetTriggerConfig("MUON");
820b4d9e 111 MuonSim.SetWriteRawData("MUON ","raw.root",kTRUE);
1fa49dab 112
1fa49dab 113 MuonSim.SetMakeSDigits("MUON");
05315e71 114 MuonSim.SetMakeDigits("MUON ITS"); // ITS needed to propagate the simulated vertex
115 MuonSim.SetMakeDigitsFromHits("ITS"); // ITS needed to propagate the simulated vertex
1fa49dab 116
e3817f97 117 MuonSim.SetRunHLT("libAliHLTMUON.so chains=dHLT-sim");
f1cdfa6d 118
ef0eadd8 119 MuonSim.SetRunQA("MUON:ALL");
120
ca8c8223 121 if ( strlen(embedwith) > 0 )
122 {
123 MuonSim.MergeWith(embedwith);
124 }
125
4d717204 126 MuonSim.Run(nevents);
127 //gObjectTable->Print();
1fa49dab 128
4d717204 129}