]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/UNICOR/AliAnalysisTaskUnicorME.cxx
updated macros for Kaon Femto analysis
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / UNICOR / AliAnalysisTaskUnicorME.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 "AliMultiEventInputHandler.h"
22 #include "AliESDEvent.h"
23 #include "AliUnicorAnalGlobal.h"
24 #include "AliUnicorAnalSingle.h"
25 #include "AliUnicorAnalCorrel.h"
26 #include "AliUnicorAnalPtfluc.h"
27 #include "AliUnicorAnalHighpt.h"
28 #include "AliUnicorEventAliceESD.h"
29 #include "AliAnalysisTaskUnicorME.h"
30
31 ClassImp(AliAnalysisTaskUnicorME)
32
33 //=============================================================================
34 AliAnalysisTaskUnicorME::AliAnalysisTaskUnicorME(const char *name) : 
35   AliAnalysisTaskME(name), 
36   fEv0(0),
37   fEv1(0),
38   fOutputList(0)
39 {
40   // constructor
41
42   fEv0 = new AliUnicorEventAliceESD();
43   fEv1 = new AliUnicorEventAliceESD();
44   DefineOutput(1, TList::Class());
45 }
46 //=============================================================================
47 void AliAnalysisTaskUnicorME::UserCreateOutputObjects() 
48 {
49   // executed once on each worker 
50
51   fOutputList = new TList();
52   fOutputList->SetOwner();
53   fOutputList->Add(new AliUnicorAnalGlobal("dag"));
54   fOutputList->Add(new AliUnicorAnalSingle("all",fEv0->Etamin(),fEv0->Etamax(),0));
55   fOutputList->Add(new AliUnicorAnalSingle("pim",fEv0->Etamin(),fEv0->Etamax(),-211));
56   fOutputList->Add(new AliUnicorAnalSingle("pip",fEv0->Etamin(),fEv0->Etamax(), 211));
57   AliUnicorAnalCorrel::AnalysisFrame frame = AliUnicorAnalCorrel::kLCMS;
58   fOutputList->Add(new AliUnicorAnalCorrel("cnn",fEv0->Etamin(),fEv0->Etamax(),-211,-211, frame));
59   fOutputList->Add(new AliUnicorAnalCorrel("cpp",fEv0->Etamin(),fEv0->Etamax(), 211, 211, frame));
60   fOutputList->Add(new AliUnicorAnalCorrel("cnp",fEv0->Etamin(),fEv0->Etamax(),-211, 211, frame));
61   fOutputList->Add(new AliUnicorAnalPtfluc("ptf",0,0));
62   fOutputList->Add(new AliUnicorAnalHighpt("hpt",fEv0->Etamin(),fEv0->Etamax(),0,0));
63 }
64 //=============================================================================
65 void AliAnalysisTaskUnicorME::UserExec(Option_t */*option*/)
66 {
67   // process one event pair
68
69   static int nic0=0;
70   static int nic1=0;
71   static int nic2=0;
72   static int nic3=0;
73
74   nic0++;
75
76   if (fInputHandler->GetBufferSize() < 2) return;
77   nic1++;
78   AliESDEvent *esd0 = dynamic_cast<AliESDEvent*>(GetEvent(0));
79   AliESDEvent *esd1 = dynamic_cast<AliESDEvent*>(GetEvent(1));
80
81   if (!esd0) return;
82   nic2++;
83   //  if (esd0->GetEventType() != 7) return; // physics event
84   fEv0->SetESD(esd0);
85   if (!fEv0->Good()) return;
86   nic3++;
87   ((AliUnicorAnalGlobal *) fOutputList->At(0))->Process(fEv0);
88   ((AliUnicorAnalSingle *) fOutputList->At(1))->Process(fEv0);
89   ((AliUnicorAnalSingle *) fOutputList->At(2))->Process(fEv0);
90   ((AliUnicorAnalSingle *) fOutputList->At(3))->Process(fEv0);
91   ((AliUnicorAnalCorrel *) fOutputList->At(4))->Process(0,fEv0,fEv0,0);
92   ((AliUnicorAnalCorrel *) fOutputList->At(4))->Process(2,fEv0,fEv0,TMath::DegToRad()*180);
93   ((AliUnicorAnalCorrel *) fOutputList->At(5))->Process(0,fEv0,fEv0,0);
94   ((AliUnicorAnalCorrel *) fOutputList->At(5))->Process(2,fEv0,fEv0,TMath::DegToRad()*180);
95   ((AliUnicorAnalCorrel *) fOutputList->At(6))->Process(0,fEv0,fEv0,0);
96   ((AliUnicorAnalCorrel *) fOutputList->At(6))->Process(2,fEv0,fEv0,TMath::DegToRad()*180);
97   ((AliUnicorAnalPtfluc *) fOutputList->At(7))->Process(0,fEv0,fEv0);
98   ((AliUnicorAnalHighpt *) fOutputList->At(8))->Process(fEv0,fEv0);
99
100   if (!esd1) return;
101   //  if (esd1->GetEventType() != 7) return; // physics event
102   printf("esd0 nr %3d mult %3d     esd1 nr %3d mult %3d\n",
103          esd0->GetEventNumberInFile(), esd0->GetNumberOfTracks(), 
104          esd1->GetEventNumberInFile(), esd1->GetNumberOfTracks());
105   fEv1->SetESD(esd1);
106   if (!fEv1->Good()) return;
107   ((AliUnicorAnalCorrel *) fOutputList->At(4))->Process(1,fEv0,fEv1,0);
108   ((AliUnicorAnalCorrel *) fOutputList->At(5))->Process(1,fEv0,fEv1,0);
109   ((AliUnicorAnalCorrel *) fOutputList->At(6))->Process(1,fEv0,fEv1,0);
110   ((AliUnicorAnalPtfluc *) fOutputList->At(7))->Process(1,fEv0,fEv1);
111   ((AliUnicorAnalHighpt *) fOutputList->At(8))->Process(fEv0,fEv1);
112
113   printf("counts: %6d %6d %6d %6d\n",nic0,nic1,nic2,nic3);
114   PostData(1, fOutputList);
115
116 //=============================================================================
117 void AliAnalysisTaskUnicorME::Terminate(Option_t */*option*/)
118 {
119   // terminate
120
121   printf("terminate \n");
122   TList *outputlist = (TList*) GetOutputData(1);
123   int n = outputlist->GetEntries();
124   if (n) ((AliUnicorAnal *) outputlist->At(0))->Save("unicor-result.root","recreate");
125   for (int i=1; i<n; i++) ((AliUnicorAnal *) outputlist->At(i))->Save("unicor-result.root");
126 }
127 //=============================================================================