]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/runSimulation.C
Update for the value of the density of the foam inside the support cylinder between...
[u/mrichter/AliRoot.git] / MUON / runSimulation.C
... / ...
CommitLineData
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
35void runSimulation(int seed,
36 int nevents,
37 const char* config,
38 const char* embedwith,
39 int runnumber)
40{
41// Uncoment following lines to run simulation with local residual mis-alignment
42// (generated via MUONGenerateGeometryData.C macro)
43// AliCDBManager* man = AliCDBManager::Instance();
44// man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
45// man->SetSpecificStorage("MUON/Align/Data","local://$ALICE_ROOT/OCDB/MUON/ResMisAlignCDB");
46
47 AliSimulation MuonSim(config);
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 {
60 cerr << Form("Cannot open file %s",embedwith) << endl;
61 return;
62 }
63
64 runLoader->LoadHeader();
65
66 if ( ! runLoader->GetHeader() ) {
67 cerr << "Cannot load header." << endl;
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://");
80 AliCDBManager::Instance()->SetSpecificStorage("local://$ALICE_ROOT/OCDB","MUON/Align/Data");
81
82 }
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 }
104 else
105 {
106 gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2S\",kFALSE);");
107 }
108
109 MuonSim.SetSeed(seed);
110 MuonSim.SetTriggerConfig("MUON");
111 MuonSim.SetWriteRawData("MUON ","raw.root",kTRUE);
112
113 MuonSim.SetMakeSDigits("MUON");
114 MuonSim.SetMakeDigits("MUON ITS"); // ITS needed to propagate the simulated vertex
115 MuonSim.SetMakeDigitsFromHits("ITS"); // ITS needed to propagate the simulated vertex
116
117 MuonSim.SetRunHLT("libAliHLTMUON.so chains=dHLT-sim");
118
119 MuonSim.SetRunQA("MUON:ALL");
120
121 if ( strlen(embedwith) > 0 )
122 {
123 MuonSim.MergeWith(embedwith);
124 }
125
126 MuonSim.Run(nevents);
127 //gObjectTable->Print();
128
129}