]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/UNICOR/AliAnalysisTaskUnicor.cxx
Adding QA ref object for Calib specie
[u/mrichter/AliRoot.git] / PWG2 / UNICOR / AliAnalysisTaskUnicor.cxx
1 /************************************************************************* 
2 * Copyright(c) 1998-2048, 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 //Author: Dariusz Miskowiec 2007
17
18 //=============================================================================
19 // unicor analysis task
20 //=============================================================================
21 #include "AliUnicorAnalGlobal.h"
22 #include "AliUnicorAnalSingle.h"
23 #include "AliUnicorAnalCorrel.h"
24 #include "AliUnicorAnalPtfluc.h"
25 #include "AliUnicorAnalHighpt.h"
26 #include "AliUnicorEventAliceESD.h"
27 #include "AliAnalysisTaskUnicor.h"
28
29 ClassImp(AliAnalysisTaskUnicor)
30
31 //=============================================================================
32 AliAnalysisTaskUnicor::AliAnalysisTaskUnicor(const char *name) : 
33   AliAnalysisTaskSE(name), 
34   fEv0(0),
35   fOutputList(0)
36 {
37   // constructor
38
39   fEv0 = new AliUnicorEventAliceESD(); // needed for eta ranges only
40   DefineOutput(1, TList::Class());
41 }
42 //=============================================================================
43 void AliAnalysisTaskUnicor::UserCreateOutputObjects() 
44 {
45   // executed once on each worker 
46
47   fOutputList = new TList();
48   fOutputList->Add(new AliUnicorAnalGlobal("dag"));
49   fOutputList->Add(new AliUnicorAnalSingle("all",fEv0->Etamin(),fEv0->Etamax(),0));
50   fOutputList->Add(new AliUnicorAnalSingle("pim",fEv0->Etamin(),fEv0->Etamax(),-211));
51   fOutputList->Add(new AliUnicorAnalSingle("pip",fEv0->Etamin(),fEv0->Etamax(), 211));
52   fOutputList->Add(new AliUnicorAnalCorrel("cnn",fEv0->Etamin(),fEv0->Etamax(),-211,-211));
53   fOutputList->Add(new AliUnicorAnalCorrel("cpp",fEv0->Etamin(),fEv0->Etamax(), 211, 211));
54   fOutputList->Add(new AliUnicorAnalCorrel("cnp",fEv0->Etamin(),fEv0->Etamax(),-211, 211));
55   fOutputList->Add(new AliUnicorAnalPtfluc("ptf",0,0));
56   fOutputList->Add(new AliUnicorAnalHighpt("hpt",fEv0->Etamin(),fEv0->Etamax(),0,0));
57 }
58 //=============================================================================
59 void AliAnalysisTaskUnicor::UserExec(Option_t */*option*/)
60 {
61   // process one event
62
63   fEv0->SetESD(((AliESDEvent*) InputEvent()));
64   if (!fEv0->Good()) return;
65   ((AliUnicorAnalGlobal *) fOutputList->At(0))->Process(fEv0);
66   ((AliUnicorAnalSingle *) fOutputList->At(1))->Process(fEv0);
67   ((AliUnicorAnalSingle *) fOutputList->At(2))->Process(fEv0);
68   ((AliUnicorAnalSingle *) fOutputList->At(3))->Process(fEv0);
69   ((AliUnicorAnalCorrel *) fOutputList->At(4))->Process(0,fEv0,fEv0,0);
70   ((AliUnicorAnalCorrel *) fOutputList->At(4))->Process(2,fEv0,fEv0,TMath::DegToRad()*180);
71   ((AliUnicorAnalCorrel *) fOutputList->At(5))->Process(0,fEv0,fEv0,0);
72   ((AliUnicorAnalCorrel *) fOutputList->At(5))->Process(2,fEv0,fEv0,TMath::DegToRad()*180);
73   ((AliUnicorAnalCorrel *) fOutputList->At(6))->Process(0,fEv0,fEv0,0);
74   ((AliUnicorAnalCorrel *) fOutputList->At(6))->Process(2,fEv0,fEv0,TMath::DegToRad()*180);
75   ((AliUnicorAnalPtfluc *) fOutputList->At(7))->Process(0,fEv0,fEv0);
76   ((AliUnicorAnalHighpt *) fOutputList->At(8))->Process(fEv0,fEv0);
77   PostData(1, fOutputList);
78
79 //=============================================================================
80 void AliAnalysisTaskUnicor::Terminate(Option_t */*option*/)
81 {
82   // terminate
83
84   printf("terminate \n");
85   TList *outputlist = (TList*) GetOutputData(1);
86   int n = outputlist->GetEntries();
87   if (n) ((AliUnicorAnal *) outputlist->At(0))->Save("unicor-result.root","recreate");
88   for (int i=1; i<n; i++) ((AliUnicorAnal *) outputlist->At(i))->Save("unicor-result.root");
89 }
90 //=============================================================================