new macros added
[u/mrichter/AliRoot.git] / PWG0 / dNdPt / macros / rundNdPt.C
CommitLineData
0aaa8b91 1void rundNdPt(const char *fileList ="inputList.txt",const char *outFile = "outputFile.root", Int_t NumberOfFiles=10,Int_t fromFile=0, Int_t nEvents=1000, Int_t firstEvent =0, Bool_t bUseMCInfo=kTRUE, Float_t zvWindow=20., Int_t cutMode=9,Float_t etaWindow=0.9, Float_t ptMin=0.15,AlidNdPtHelper::AnalysisMode analysisMode = AlidNdPtHelper::kTPC, AlidNdPtHelper::OutputObject outputObject=AlidNdPtHelper::kCorrection,const char *corrFile = "corrMatricesFile.root",Bool_t bProof=kFALSE)
2{
3 // set Proof
4 if(bProof) {
5
6 //cout << "*** START PROOF Lite SESSION ***" << endl;
7 //TProof::Open(""); // 1. Enter your username here
8
9 TProofMgr * proofmgr = TProof::Mgr("lxialpod2.gsi.de:21001");
10 TProof * proof = proofmgr->CreateSession();
11 proof->SetParameter("PROOF_MaxSlavesPerNode", (Long_t)1000);
12
13 // -- Load AliRoot Libraries
4fa29112 14 gROOT->LoadMacro("ProofEnableAliRootGSI.C");
0aaa8b91 15 ProofEnableAliRoot("/u/jacek/alice/AliRoot/trunk");
16 }
17
18 // Swtich off all AliInfo (too much output!!!)
19 AliLog::SetGlobalLogLevel(AliLog::kError);
20
21 // Create analysis manager
22 AliAnalysisManager *mgr = new AliAnalysisManager;
23
24 //
25 // Create event cuts
26 //
27 AlidNdPtEventCuts *evtCuts = new AlidNdPtEventCuts("AlidNdPtEventCuts","Event cuts");
28 evtCuts->SetZvRange(-zvWindow,zvWindow);
29 evtCuts->SetMeanXYZv(0.0,0.0,0.0);
30 evtCuts->SetSigmaMeanXYZv(1.0,1.0,10.0);
31 //evtCuts->SetTriggerRequired(kFALSE);
32
33 // Create geom. acceptance cuts
34 AlidNdPtAcceptanceCuts *accCuts = new AlidNdPtAcceptanceCuts("AlidNdPtAcceptanceCuts","Geom. acceptance cuts");
35 accCuts->SetEtaRange(-etaWindow,etaWindow);
36 accCuts->SetPtRange(ptMin,1.e10);
37 accCuts->SetMaxDCAr(3.0);
38 accCuts->SetMaxDCAz(30.0);
39
40 // Create standard esd track cuts
4fa29112 41 gROOT->LoadMacro("CreatedNdPtTrackCuts.C");
0aaa8b91 42 AliESDtrackCuts* esdTrackCuts = CreateTrackCuts(cutMode);
43 if (!esdTrackCuts) {
44 printf("ERROR: esdTrackCuts could not be created\n");
45 return;
46 } else {
47 esdTrackCuts->SetHistogramsOn(kTRUE);
48 }
49
50 //
51 // Create task
52 //
53 AlidNdPtTask *task = new AlidNdPtTask("AlidNdPtTask");
54 if (bUseMCInfo) task->SetUseMCInfo(kTRUE);
55
56 // create cut analysis object
57 if(outputObject==AlidNdPtHelper::kCutAnalysis)
58 {
59 AlidNdPtCutAnalysis *fdNdPtCutAnalysis = new AlidNdPtCutAnalysis("dNdPtCutAnalysis","dN/dPt Cut Analysis");
60 fdNdPtCutAnalysis->SetEventCuts(evtCuts);
61 fdNdPtCutAnalysis->SetAcceptanceCuts(accCuts);
62 fdNdPtCutAnalysis->SetTrackCuts(esdTrackCuts);
63 fdNdPtCutAnalysis->SetAnalysisMode(analysisMode);
64 fdNdPtCutAnalysis->SetTrigger(AlidNdPtHelper::kMB1);
65 if (bUseMCInfo) fdNdPtCutAnalysis->SetUseMCInfo(kTRUE);
66
67 task->AddAnalysisObject( fdNdPtCutAnalysis );
68 }
69
70 // create analysis object
71 if(outputObject==AlidNdPtHelper::kAnalysis)
72 {
73 AlidNdPtAnalysis *fdNdPtAnalysis = new AlidNdPtAnalysis("dNdPtAnalysis","dN/dPt Analysis");
74 fdNdPtAnalysis->SetEventCuts(evtCuts);
75 fdNdPtAnalysis->SetAcceptanceCuts(accCuts);
76 fdNdPtAnalysis->SetTrackCuts(esdTrackCuts);
77 fdNdPtAnalysis->SetAnalysisMode(analysisMode);
78 fdNdPtAnalysis->SetTrigger(AlidNdPtHelper::kMB1);
79 if (bUseMCInfo) fdNdPtAnalysis->SetUseMCInfo(kTRUE);
80
81 fdNdPtAnalysis->SetHistogramsOn(kTRUE);
82 //fdNdPtAnalysis->SetHistogramsOn(kFALSE);
83 task->AddAnalysisObject( fdNdPtAnalysis );
84 }
85
86 // create correction object
87 if(outputObject == AlidNdPtHelper::kCorrection)
88 {
89 AlidNdPtCorrection *fdNdPtCorrection = new AlidNdPtCorrection("dNdPtCorrection","dN/dPt Correction", corrFile);
90
91 fdNdPtCorrection->SetEventCuts(evtCuts);
92 fdNdPtCorrection->SetAcceptanceCuts(accCuts);
93 fdNdPtCorrection->SetTrackCuts(esdTrackCuts);
94 fdNdPtCorrection->SetAnalysisMode(analysisMode);
95 fdNdPtCorrection->SetTrigger(AlidNdPtHelper::kMB1);
96 if (bUseMCInfo) fdNdPtCorrection->SetUseMCInfo(kTRUE);
97
98 task->AddAnalysisObject( fdNdPtCorrection );
99 }
100
101 // Add task
102 mgr->AddTask(task);
103
104 // Add ESD handler
105 AliESDInputHandler* esdH = new AliESDInputHandler;
106 //esdH->SetInactiveBranches("*");
107 mgr->SetInputEventHandler(esdH);
108
109 if(bUseMCInfo) {
110 // Enable MC event handler
111 AliMCEventHandler* handler = new AliMCEventHandler;
112 handler->SetReadTR(kFALSE);
113 //handler->SetReadTR(kTRUE);
114 mgr->SetMCtruthEventHandler(handler);
115 }
116
117 // Create input chain
118 gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
119 TChain* chain = CreateESDChain(fileList, NumberOfFiles, fromFile);
120 if(!chain) {
121 printf("ERROR: chain cannot be created\n");
122 return;
123 }
124
125 // Create containers for input
126 //AliAnalysisDataContainer *cinput = mgr->CreateContainer("cchain", TChain::Class(), AliAnalysisManager::kInputContainer);
127 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
128 mgr->ConnectInput(task, 0, cinput);
129
130 // Create containers for output
131 AliAnalysisDataContainer *coutput = mgr->CreateContainer("coutput", TList::Class(), AliAnalysisManager::kOutputContainer, outFile);
132 mgr->ConnectOutput(task, 0, coutput);
133
134 // Enable debug printouts
135 mgr->SetDebugLevel(0);
136
137 if (!mgr->InitAnalysis())
138 return;
139
140 mgr->PrintStatus();
141
142 if(bProof) mgr->StartAnalysis("proof",chain, nEvents, firstEvent);
143 else mgr->StartAnalysis("local",chain,nEvents, firstEvent);
144}
145