]> git.uio.no Git - u/mrichter/AliRoot.git/blame - prod/LHC08d12/sim.C
Working on the electron cut
[u/mrichter/AliRoot.git] / prod / LHC08d12 / sim.C
CommitLineData
333b9f18 1void sim(Int_t nev=10) {
2 AliSimulation simu;
3 //simu.SetMakeSDigits("TRD TOF PHOS HMPID EMCAL FMD PMD T0 ZDC VZERO MUON HLT");
4 //simu.SetMakeDigits ("TRD TOF PHOS HMPID EMCAL FMD PMD T0 ZDC VZERO MUON HLT");
5 //simu.SetMakeDigitsFromHits("ITS TPC");
6 //simu.SetWriteRawData("ALL","raw.root",kTRUE);
7 simu.SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal/?cacheFold=/tmp/CDBCache?operateDisconnected=kFALSE");
8
9 // No write access to the OCDB => specific storage
10 simu.SetSpecificStorage("GRP/GRP/Data",
11 Form("local://%s",gSystem->pwd()));
12
13 //simu.SetRunQA(":") ;
14 //simu.SetRunHLT("");
15 //simu.SetWriteGRPEntry(kFALSE);
16
17 //Merge with HIJING
18 //Load necessary libraries and connect to the GRID
19 gSystem->Load("libNetx.so") ;
20 gSystem->Load("libRAliEn.so");
21 TGrid::Connect("alien://") ;
22
23 //Feed Grid with collection file
24 TGridCollection * collection = (TGridCollection*) TAlienCollection::Open("collection.xml");
25 if (! collection) {
26 AliError(Form("collection: %s not found", kXML)) ;
27 return kFALSE ;
28 }
29 TGridResult* result = collection->GetGridResult("",0 ,0);
30 TString alienURL = result->GetKey(0, "turl") ;//split all files in collection, only one is sent per job
31 cout << "================== " << alienURL << endl ;
32 simu.MergeWith(alienURL);
33
34 TStopwatch timer;
35 timer.Start();
36 simu.Run(nev);
37 WriteXsection();
38 timer.Stop();
39 timer.Print();
40}
41
42WriteXsection()
43{
44 TPythia6 *pythia = TPythia6::Instance();
45 pythia->Pystat(1);
46 Double_t xsection = pythia->GetPARI(1);
47 Int_t ntrials = pythia->GetMSTI(5);
48
49 TTree *tree = new TTree("Xsection","Pythia cross section");
50 TBranch *branch = tree->Branch("xsection", &xsection, "X/D");
51 TBranch *branch = tree->Branch("ntrials" , &ntrials , "X/i");
52 tree->Fill();
53
54 TFile *file = new TFile("pyxsec.root","recreate");
55 tree->Write();
56 file->Close();
57
58 cout << "Pythia cross section: " << xsection
59 << ", number of trials: " << ntrials << endl;
60}