1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 /// \file runSimulation.C
20 /// \brief Macro for running simulation
22 /// Macro extracted from the MUON test script
24 /// \author Laurent Aphecetche
26 #if !defined(__CINT__) || defined(__MAKECINT__)
27 #include "AliCDBManager.h"
28 #include "AliSimulation.h"
30 #include "AliHeader.h"
32 #include <Riostream.h>
35 void runSimulation(int seed,
38 const char* embedwith,
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");
47 AliSimulation MuonSim(config);
49 if ( strlen(embedwith) > 0 )
51 // setups specific to embedding
53 gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2S\",kTRUE);");
55 // get the run number from real data
57 AliRunLoader* runLoader = AliRunLoader::Open(embedwith,"titi");
60 cerr << Form("Cannot open file %s",embedwith) << endl;
64 runLoader->LoadHeader();
66 if ( ! runLoader->GetHeader() ) {
67 cerr << "Cannot load header." << endl;
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;
75 runLoader->UnloadHeader();
78 cout << "***** EMBEDDING MODE : USING RAW OCDB" << endl;
79 AliCDBManager::Instance()->SetDefaultStorage("raw://");
80 AliCDBManager::Instance()->SetSpecificStorage("local://$ALICE_ROOT/OCDB","MUON/Align/Data");
83 else if ( runnumber > 0 )
85 // simulation with anchor run
87 cout << "***** ANCHOR RUN MODE : USING RAW OCDB AS MUCH AS POSSIBLE" << endl;
88 cout << "***** AND TAKING VERTEX FROM OCDB IF AVAILABLE" << endl;
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);");
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...
98 AliCDBManager::Instance()->SetSpecificStorage("MUON/Align/Data","alien://folder=/alice/cern.ch/user/j/jcastill/LHC10hMisAlignCDB");
100 MuonSim.SetRunNumber(runnumber);
102 MuonSim.UseVertexFromCDB();
106 gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2S\",kFALSE);");
109 MuonSim.SetSeed(seed);
110 MuonSim.SetTriggerConfig("MUON");
111 MuonSim.SetWriteRawData("MUON HLT","raw.root",kTRUE);
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
117 MuonSim.SetRunHLT("libAliHLTMUON.so chains=dHLT-sim");
119 MuonSim.SetRunQA("MUON:ALL");
121 if ( strlen(embedwith) > 0 )
123 MuonSim.MergeWith(embedwith);
126 MuonSim.Run(nevents);
127 //gObjectTable->Print();