1 //Author: Dariusz Miskowiec 2007
3 //=============================================================================
5 //=============================================================================
7 #include "AliESDInputHandler.h"
8 #include "AliAnalysisManager.h"
9 #include "AliDAnalysisTask.h"
10 #include "AliDAnalGlobal.h"
11 #include "AliDAnalSingle.h"
12 #include "AliDAnalCorrel.h"
13 #include "AliDAnalPtfluc.h"
14 #include "AliDEventAliceESD.h"
16 ClassImp(AliDAnalysisTask)
18 /*****************************************************************************/
19 AliDAnalysisTask::AliDAnalysisTask() :
20 AliAnalysisTask("dali", ""),
21 fESD(0), fEv0(0), fEv1(0),
22 fDag(0), fAll(0), fPim(0), fPip(0),
23 fCnn(0), fCpp(0), fPtf(0),
28 fEv0 = new AliDEventAliceESD();
29 DefineInput(0, TChain::Class());
30 DefineOutput(0, TList::Class());
32 /*****************************************************************************/
33 void AliDAnalysisTask::CreateOutputObjects()
35 // executed once on each worker
37 fDag = new AliDAnalGlobal("dag");
38 fAll = new AliDAnalSingle("all",fEv0->Etamin(),fEv0->Etamax(),0);
39 fPim = new AliDAnalSingle("pim",fEv0->Etamin(),fEv0->Etamax(),-211);
40 fPip = new AliDAnalSingle("pip",fEv0->Etamin(),fEv0->Etamax(), 211);
41 fCnn = new AliDAnalCorrel("cnn",fEv0->Etamin(),fEv0->Etamax(),-211,-211);
42 fCpp = new AliDAnalCorrel("cpp",fEv0->Etamin(),fEv0->Etamax(), 211, 211);
43 fPtf = new AliDAnalPtfluc("ptf",0,0);
44 fOutputList = new TList();
45 fOutputList->Add(fDag);
46 fOutputList->Add(fAll);
47 fOutputList->Add(fPim);
48 fOutputList->Add(fPip);
49 fOutputList->Add(fCnn);
50 fOutputList->Add(fCpp);
51 fOutputList->Add(fPtf);
53 /*****************************************************************************/
54 void AliDAnalysisTask::ConnectInputData(Option_t *)
56 // connect ESD or AOD here
57 // called on each input data change.
59 TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
61 Printf("ERROR: Could not read chain from input slot 0");
63 fEv0->AttachTree(tree);
65 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*>
66 (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
68 if (!esdH) Printf("ERROR: Could not get ESDInputHandler");
69 else fESD = esdH->GetEvent();
71 /*****************************************************************************/
72 void AliDAnalysisTask::Exec(Option_t */*option*/)
78 Printf("ERROR: fESD not available");
81 // If AttachTree aka ReadFromTree above cannot be done then this is
82 // the alternative: shallow copy of the current alice esd event to fEv0
83 // memcpy((AliESDEvent*)fEv0, fESD, sizeof(AliESDEvent));
85 if (!fEv0->Good()) return;
90 fCnn->Process(0,fEv0,fEv0,0);
91 fCnn->Process(2,fEv0,fEv0,TMath::DegToRad()*180);
92 fCpp->Process(0,fEv0,fEv0,0);
93 fCpp->Process(2,fEv0,fEv0,TMath::DegToRad()*180);
94 fPtf->Process(0,fEv0,fEv0);
95 PostData(0, fOutputList);
97 /*****************************************************************************/
98 void AliDAnalysisTask::Terminate(Option_t *)
101 printf("terminate\n");
102 fDag->Save("unicor-result.root","recreate");
103 fAll->Save("unicor-result.root");
104 fPim->Save("unicor-result.root");
105 fPip->Save("unicor-result.root");
106 fCnn->Save("unicor-result.root");
107 fCpp->Save("unicor-result.root");
108 fPtf->Save("unicor-result.root");
110 /*****************************************************************************/