]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/dielectron/AliAnalysisTaskMultiDielectron.cxx
Add dielectron framework to PWG3
[u/mrichter/AliRoot.git] / PWG3 / dielectron / AliAnalysisTaskMultiDielectron.cxx
1 /*************************************************************************
2 * Copyright(c) 1998-2009, 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 ///////////////////////////////////////////////////////////////////////////
17 //                                                                       //
18 //                        Basic Analysis Task                            //
19 //                                                                       //
20 ///////////////////////////////////////////////////////////////////////////
21
22 #include <TChain.h>
23
24 #include <AliCFContainer.h>
25 #include <AliVEvent.h>
26
27 #include "AliDielectron.h"
28 #include "AliDielectronHistos.h"
29 #include "AliDielectronCF.h"
30 #include "AliAnalysisTaskMultiDielectron.h"
31
32 ClassImp(AliAnalysisTaskMultiDielectron)
33
34 //_________________________________________________________________________________
35 AliAnalysisTaskMultiDielectron::AliAnalysisTaskMultiDielectron() :
36   AliAnalysisTaskSE(),
37   fListDielectron(),
38   fListHistos(),
39   fListCF()
40 {
41   //
42   // Constructor
43   //
44 }
45
46 //_________________________________________________________________________________
47 AliAnalysisTaskMultiDielectron::AliAnalysisTaskMultiDielectron(const char *name) :
48   AliAnalysisTaskSE(name),
49   fListDielectron(),
50   fListHistos(),
51   fListCF()
52 {
53   //
54   // Constructor
55   //
56   DefineInput(0,TChain::Class());
57   DefineOutput(1, TList::Class());
58   DefineOutput(2, TList::Class());
59   fListHistos.SetName("Dielectron_Histos_Multi");
60   fListCF.SetName("Dielectron_CF_Multi");
61 }
62
63
64 //_________________________________________________________________________________
65 void AliAnalysisTaskMultiDielectron::UserCreateOutputObjects()
66 {
67   //
68   // Add all histogram manager histogram lists to the output TList
69   //
70
71   if (!fListHistos.IsEmpty()) return; //already initialised
72
73   TIter nextDie(&fListDielectron);
74   AliDielectron *die=0;
75   while ( (die=static_cast<AliDielectron*>(nextDie())) ){
76     die->Init();
77     if (die->GetHistogramList()) fListHistos.Add(const_cast<THashList*>(die->GetHistogramList()));
78     if (die->GetCFManagerPair()) fListCF.Add(const_cast<AliCFContainer*>(die->GetCFManagerPair()->GetContainer()));
79   }
80 }
81
82 //_________________________________________________________________________________
83 void AliAnalysisTaskMultiDielectron::UserExec(Option_t *)
84 {
85   //
86   // Main loop. Called for every event
87   //
88
89   if (fListHistos.IsEmpty()) return;
90   
91   //bz for AliKF
92   Double_t bz = InputEvent()->GetMagneticField();
93   AliKFParticle::SetField( bz );
94
95   //Process event in all AliDielectron instances
96   TIter nextDie(&fListDielectron);
97   AliDielectron *die=0;
98   while ( (die=static_cast<AliDielectron*>(nextDie())) ){
99 //     printf("Processing '%s'\n",die->GetName());
100     die->Process(InputEvent());
101     die->FillHistograms();
102   }
103   
104   PostData(1, &fListHistos);
105   PostData(2, &fListCF);
106 }
107