1 /**************************************************************************
2 * Copyright(c) 1998-2013, 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 #include "AliAnalysisTaskAOD2MuonAOD.h"
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"
27 /// \brief AliAnalysisTaskAOD2MuonAOD : a class to convert full AODs to muon ones
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.
34 ClassImp(AliAnalysisTaskAOD2MuonAOD)
37 //_____________________________________________________________________________
38 AliAnalysisTaskAOD2MuonAOD::AliAnalysisTaskAOD2MuonAOD(Int_t mcMode, Bool_t withSPDTracklets)
39 : AliAnalysisTaskSE("AliAnalysisTaskAOD2MuonAOD"),
40 fBranchReplicator(new AliAODMuonReplicator("MuonReplicator",
41 "remove non muon tracks and non primary or pileup vertices",
42 new AliAnalysisNonMuonTrackCuts,
43 new AliAnalysisNonPrimaryVertices,
48 /// ctor. For the parameters \see AliAODMuonReplicator::AliAODMuonReplicator
51 //_____________________________________________________________________________
52 AliAnalysisTaskAOD2MuonAOD::~AliAnalysisTaskAOD2MuonAOD()
54 /// dtor. Delete our internal worker class
55 delete fBranchReplicator;
58 //_____________________________________________________________________________
59 void AliAnalysisTaskAOD2MuonAOD::UserCreateOutputObjects()
61 /// Create the output AOD branches, from the list of object
62 /// we have in the replicator
64 TList* list = fBranchReplicator->GetList();
69 while ( (o = next()) )
71 AddAODBranch(o->ClassName(),list->GetObjectRef(o));
75 //_____________________________________________________________________________
76 void AliAnalysisTaskAOD2MuonAOD::UserExec(Option_t*)
78 /// Main method doing the actual filtering (delegating it to
79 /// the muon replicator)
81 AliAODEvent* event = dynamic_cast<AliAODEvent*>(InputEvent());
84 AliError("Event is not a the AOD type");
88 // not sure why but the fillAOD flag seems to be lost somewhere, so must
90 AliAODHandler* aodH = static_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
92 aodH->SetFillAOD(kTRUE);
94 fBranchReplicator->ReplicateAndFilter(*event);