]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG0/dNdEta/runMultiplicitySelector.C
adding selector that creates histograms needed for systematic uncertainty
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / runMultiplicitySelector.C
1 /* $Id$ */
2
3 //
4 // script to run the AliMultiplicityESDSelector
5 //
6
7 #include "../CreateESDChain.C"
8
9 void runMultiplicitySelector(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aMC = kFALSE, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE)
10 {
11   TStopwatch timer;
12   timer.Start();
13
14   gSystem->Load("libEG");
15   gSystem->Load("libGeom");
16   gSystem->Load("libESD");
17   gSystem->Load("libPWG0base");
18   if (aMC != kFALSE)
19     gSystem->Load("libPWG0dep");
20
21   gROOT->ProcessLine(".L CreatedNdEta.C");
22   gROOT->ProcessLine(".L CreateCuts.C");
23   gROOT->ProcessLine(".L drawPlots.C");
24
25   TChain* chain = CreateESDChain(data, nRuns, offset);
26   TVirtualProof* proof = 0;
27
28   if (aProof != kFALSE)
29   {
30     proof = TProof::Open("jgrosseo@lxb6046");
31
32     if (!proof)
33     {
34       printf("ERROR: PROOF connection not established.\n");
35       return;
36     }
37
38     if (proof->EnablePackage("ESD"))
39     {
40       printf("ERROR: ESD package could not be enabled.\n");
41       return;
42     }
43
44     if (proof->EnablePackage("PWG0base"))
45     {
46       printf("ERROR: PWG0base package could not be enabled.\n");
47       return;
48     }
49
50     if (aMC != kFALSE)
51     {
52       if (proof->EnablePackage("PWG0dep"))
53       {
54         printf("ERROR: PWG0dep package could not be enabled.\n");
55         return;
56       }
57     }
58
59     //chain->SetProof(proof);
60   }
61
62   // ########################################################
63   // selection of esd tracks
64   AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
65   if (!esdTrackCuts)
66   {
67     printf("ERROR: esdTrackCuts could not be created\n");
68     return;
69   }
70
71   chain->GetUserInfo()->Add(esdTrackCuts);
72   if (proof)
73     proof->AddInput(esdTrackCuts);
74
75   TString selectorName = ((aMC == kFALSE) ? "AliMultiplicityESDSelector" : "AliMultiplicityMCSelector");
76   AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
77
78   selectorName += ".cxx++";
79
80   if (aDebug != kFALSE)
81     selectorName += "g";
82
83   Long64_t result = -1;
84
85   if (proof != kFALSE)
86     result = chain->MakeTDSet()->Process(selectorName);
87   else
88     result = chain->Process(selectorName);
89
90   if (result != 0)
91   {
92     printf("ERROR: Executing process failed with %d.\n", result);
93     return;
94   }
95
96   timer.Stop();
97   timer.Print();
98 }
99