]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/muon/AliAnalysisTaskAOD2MuonAOD.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / muon / AliAnalysisTaskAOD2MuonAOD.cxx
CommitLineData
8dda6345 1/**************************************************************************
2 * Copyright(c) 1998-2013, 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#include "AliAnalysisTaskAOD2MuonAOD.h"
17
18#include "AliAnalysisManager.h"
19#include "AliAnalysisNonMuonTrackCuts.h"
20#include "AliAnalysisNonPrimaryVertices.h"
21#include "AliAnalysisTaskESDMuonFilter.h"
22#include "AliAODEvent.h"
23#include "AliAODHandler.h"
24#include "AliAODMuonReplicator.h"
25#include "AliLog.h"
26///
27/// \brief AliAnalysisTaskAOD2MuonAOD : a class to convert full AODs to muon ones
28///
29/// The actual work is done, like for the ESD->muon AOD case, by the
30/// AliAODMuonReplicator class. This very class is just steering it.
31///
32
33/// \cond CLASSIMP
34ClassImp(AliAnalysisTaskAOD2MuonAOD)
35/// \endcond
36
37//_____________________________________________________________________________
38AliAnalysisTaskAOD2MuonAOD::AliAnalysisTaskAOD2MuonAOD(Int_t mcMode, Bool_t withSPDTracklets)
39: AliAnalysisTaskSE("AliAnalysisTaskAOD2MuonAOD"),
40fBranchReplicator(new AliAODMuonReplicator("MuonReplicator",
41 "remove non muon tracks and non primary or pileup vertices",
42 new AliAnalysisNonMuonTrackCuts,
43 new AliAnalysisNonPrimaryVertices,
44 mcMode,
45 kTRUE,
46 withSPDTracklets))
47{
48 /// ctor. For the parameters \see AliAODMuonReplicator::AliAODMuonReplicator
49}
50
51//_____________________________________________________________________________
52AliAnalysisTaskAOD2MuonAOD::~AliAnalysisTaskAOD2MuonAOD()
53{
54 /// dtor. Delete our internal worker class
55 delete fBranchReplicator;
56}
57
58//_____________________________________________________________________________
59void AliAnalysisTaskAOD2MuonAOD::UserCreateOutputObjects()
60{
61 /// Create the output AOD branches, from the list of object
62 /// we have in the replicator
63
64 TList* list = fBranchReplicator->GetList();
65
66 TIter next(list);
67 TObject* o;
68
69 while ( (o = next()) )
70 {
71 AddAODBranch(o->ClassName(),list->GetObjectRef(o));
72 }
73}
74
75//_____________________________________________________________________________
76void AliAnalysisTaskAOD2MuonAOD::UserExec(Option_t*)
77{
78 /// Main method doing the actual filtering (delegating it to
79 /// the muon replicator)
80
81 AliAODEvent* event = dynamic_cast<AliAODEvent*>(InputEvent());
82 if (!event)
83 {
84 AliError("Event is not a the AOD type");
85 return;
86 }
87
88 // not sure why but the fillAOD flag seems to be lost somewhere, so must
89 // set it per event.
90 AliAODHandler* aodH = static_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
91
92 aodH->SetFillAOD(kTRUE);
93
94 fBranchReplicator->ReplicateAndFilter(*event);
95}