Corrected library names and paths to macros
[u/mrichter/AliRoot.git] / test / testdEdx / sim.C
CommitLineData
533f5c16 1//
2// parameter to take from config file
3//
4const char * recoStorage="local:///cvmfs/alice.gsi.de/alice/data/2010/OCDB";
5Int_t run=0;
6
7
8void ModifyRecoParam(TObjArray* recoArray, Bool_t useIonTail, Double_t crossTalkCorrection){
9 //
10 // Modify reco param - and store it in the OCDB in local directory
11 //
12 AliCDBManager * man = AliCDBManager::Instance();
13 for (Int_t i=0; i<4; i++){
14 AliTPCRecoParam* p = ( AliTPCRecoParam*)recoArray->At(i);
15 p->SetUseIonTailCorrection(useIonTail);
16 p->SetCrosstalkCorrection(crossTalkCorrection);
17 }
18 TString localStorage = "local://"+gSystem->GetFromPipe("pwd")+"/OCDBsim";
19 AliCDBStorage*pocdbStorage = AliCDBManager::Instance()->GetStorage(localStorage.Data());
20 AliCDBMetaData *metaData= new AliCDBMetaData();
650f90f6 21 AliCDBId* id1=new AliCDBId("TPC/Calib/RecoParam/", man->GetRun(), AliCDBRunRange::Infinity());
533f5c16 22 pocdbStorage->Put(recoArray, (*id1), metaData);
23 AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/RecoParam/",localStorage.Data());
24}
25
26
27void sim(Int_t nev, Bool_t useIonTail, Double_t crossTalkCorrection) {
253e70f4 28 gSystem->Load("liblhapdf");
29 gSystem->Load("libEGPythia6");
30 gSystem->Load("libpythia6");
31 gSystem->Load("libAliPythia6");
257e1b2b 32 gSystem->Load("libHIJING");
253e70f4 33 gSystem->Load("libTHijing");
34 gSystem->Load("libgeant321");
35
650f90f6 36 if (nev<0){
37 AliCDBManager * man = AliCDBManager::Instance();
38 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
39 man->SetSpecificStorage("TPC/Calib/RecoParam/",recoStorage);
40 man->SetRun(run);
41 AliCDBEntry* e = man->Get("TPC/Calib/RecoParam/",run); // get default
42 // modify content
43 TObjArray* recoArray = (TObjArray*)e->GetObject();
44 ModifyRecoParam(recoArray, useIonTail, crossTalkCorrection);
45 return;
46 }
533f5c16 47
48 if (gSystem->Getenv("EVENT")) nev = atoi(gSystem->Getenv("EVENT")) ;
253e70f4 49
50 AliSimulation simulator;
51 simulator.SetMakeSDigits("ITS TPC TRD TOF PHOS HMPID EMCAL MUON FMD ZDC PMD T0");
87e48da5 52 //simulator.SetMakeDigitsFromHits( "ITS TPC");
253e70f4 53 simulator.SetWriteRawData("ALL","raw.root",kTRUE);
54
55 simulator.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
533f5c16 56 simulator.SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd()));
650f90f6 57 TString localStorage = "local://"+gSystem->GetFromPipe("pwd")+"/OCDBsim";
87e48da5 58 simulator.SetSpecificStorage("TPC/Calib/RecoParam/",localStorage.Data());
253e70f4 59
9e75bcab 60 simulator.SetRunQA(":") ;
253e70f4 61
62 TStopwatch timer;
63 timer.Start();
64 simulator.Run(nev);
65 timer.Stop();
66 timer.Print();
87e48da5 67 //
533f5c16 68 // Print the OCDB setup which we used
69 //
87e48da5 70 AliCDBManager * man = AliCDBManager::Instance();
533f5c16 71 AliCDBEntry* ocdbEntry = man->Get("TPC/Calib/RecoParam/",run);
72 TObjArray* recoArray = (TObjArray*)ocdbEntry->GetObject();
73 for (Int_t i=0; i<4; i++){
74 AliTPCRecoParam* recoParam = ( AliTPCRecoParam*)recoArray->At(i);
75 printf("ipar=%d\t%d\t%f\n",i,recoParam->GetUseIonTailCorrection(), recoParam->GetCrosstalkCorrection());
76 }
8a94851d 77 printf("End of the simulation\n");
533f5c16 78
79
253e70f4 80}