1 /*************************************************************************
2 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////
18 // Basic Analysis Task //
19 // for Dielectron Analysis //
21 ///////////////////////////////////////////////////////////////////////////
26 #include <AliCFContainer.h>
27 #include <AliVEvent.h>
28 #include <AliInputEventHandler.h>
29 #include <AliESDInputHandler.h>
30 #include <AliAnalysisManager.h>
32 #include "AliDielectron.h"
33 #include "AliDielectronHistos.h"
34 #include "AliDielectronCF.h"
35 #include "AliAnalysisTaskDielectronSE.h"
37 ClassImp(AliAnalysisTaskDielectronSE)
39 //_________________________________________________________________________________
40 AliAnalysisTaskDielectronSE::AliAnalysisTaskDielectronSE() :
43 fSelectPhysics(kFALSE),
44 fTriggerMask(AliVEvent::kMB),
52 //_________________________________________________________________________________
53 AliAnalysisTaskDielectronSE::AliAnalysisTaskDielectronSE(const char *name) :
54 AliAnalysisTaskSE(name),
56 fSelectPhysics(kFALSE),
57 fTriggerMask(AliVEvent::kMB),
63 DefineInput(0,TChain::Class());
64 DefineOutput(1, THashList::Class());
65 DefineOutput(2, AliCFContainer::Class());
66 DefineOutput(3, TH1D::Class());
69 //_________________________________________________________________________________
70 void AliAnalysisTaskDielectronSE::UserCreateOutputObjects()
73 // Initialise the framework objects
76 AliError("No Dielectron framework object set !!!");
80 if (fDielectron->GetHistogramList()){
81 PostData(1, const_cast<THashList*>(fDielectron->GetHistogramList()));
83 if (fDielectron->GetCFManagerPair()){
84 PostData(2, const_cast<AliCFContainer*>(fDielectron->GetCFManagerPair()->GetContainer()));
88 fEventStat=new TH1D("hEventStat","Event statistics",5,0,5);
89 fEventStat->GetXaxis()->SetBinLabel(1,"Before Phys. Sel.");
90 fEventStat->GetXaxis()->SetBinLabel(2,"After Phys. Sel.");
93 PostData(3,fEventStat);
97 //_________________________________________________________________________________
98 void AliAnalysisTaskDielectronSE::UserExec(Option_t *)
101 // Main loop. Called for every event
104 if (!fDielectron) return;
106 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
107 AliESDInputHandler *esdHandler=0x0;
108 if ( (esdHandler=dynamic_cast<AliESDInputHandler*>(man->GetInputEventHandler())) && esdHandler->GetESDpid() ){
109 AliDielectronVarManager::SetESDpid(esdHandler->GetESDpid());
111 //load esd pid bethe bloch parameters depending on the existance of the MC handler
112 // yes: MC parameters
113 // no: data parameters
114 if (!AliDielectronVarManager::GetESDpid()){
115 if (AliDielectronMC::Instance()->HasMC()) {
116 AliDielectronVarManager::InitESDpid();
118 AliDielectronVarManager::InitESDpid(1);
122 // Was event selected ?
123 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
124 UInt_t isSelected = AliVEvent::kAny;
125 if( fSelectPhysics && inputHandler && inputHandler->GetEventSelection() ) {
126 isSelected = inputHandler->IsEventSelected();
127 isSelected&=fTriggerMask;
130 //Before physics selection
131 fEventStat->Fill(0.);
133 PostData(3,fEventStat);
136 //after physics selection
137 fEventStat->Fill(1.);
140 Double_t bz = InputEvent()->GetMagneticField();
141 AliKFParticle::SetField( bz );
143 fDielectron->Process(InputEvent());
145 if (fDielectron->GetHistogramList()){
146 PostData(1, const_cast<THashList*>(fDielectron->GetHistogramList()));
148 if (fDielectron->GetCFManagerPair()){
149 PostData(2, const_cast<AliCFContainer*>(fDielectron->GetCFManagerPair()->GetContainer()));
151 PostData(3,fEventStat);