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