]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/muon/AliAODMuonReplicator.cxx
Removing redundant code (Yuri)
[u/mrichter/AliRoot.git] / PWG3 / muon / AliAODMuonReplicator.cxx
CommitLineData
26ba01d4 1/**************************************************************************
2* Copyright(c) 1998-1999, 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// $Id$
17
18#include "AliAODMuonReplicator.h"
19#include "AliAnalysisCuts.h"
20#include "AliAODEvent.h"
21#include "AliAODTrack.h"
22#include <cassert>
23
24ClassImp(AliAODMuonReplicator)
25
26//_____________________________________________________________________________
27AliAODMuonReplicator::AliAODMuonReplicator(const char* name, const char* title,
28 AliAnalysisCuts* trackCut,
29 AliAnalysisCuts* vertexCut)
30: AliAODBranchReplicator(name,title),
31fTrackCut(trackCut), fTracks(0x0),
32fVertexCut(vertexCut), fVertices(0x0),
33fList(0x0)
34{
35 // default ctor
36}
37
38//_____________________________________________________________________________
39AliAODMuonReplicator::~AliAODMuonReplicator()
40{
41 // dtor
42 delete fTrackCut;
43 delete fVertexCut;
44 delete fList;
45}
46
47//_____________________________________________________________________________
48TList* AliAODMuonReplicator::GetList() const
49{
50 // return (and build if not already done) our internal list of managed objects
51 if (!fList)
52 {
53 fList = new TList;
54 fList->SetOwner(kTRUE);
55 fTracks = new TClonesArray("AliAODTrack",100);
56 fTracks->SetName("tracks");
57 fVertices = new TClonesArray("AliAODVertex",10);
58 fVertices->SetName("vertices");
59 fList->Add(fTracks);
60 fList->Add(fVertices);
61 }
62 return fList;
63}
64
65//_____________________________________________________________________________
66void AliAODMuonReplicator::ReplicateAndFilter(const AliAODEvent& source)
67{
68 // Replicate (and filter if filters are there) the relevant parts we're interested in AODEvent
69
70 static int n(0);
71
72 ++n;
73
74 assert(fTracks!=0x0);
75 fTracks->Clear("C");
76 TIter next(source.GetTracks());
77 AliAODTrack* t;
78 Int_t ntracks(0);
79
80
81 while ( ( t = static_cast<AliAODTrack*>(next()) ) )
82 {
83 if ( !fTrackCut || fTrackCut->IsSelected(t) )
84 {
85 new((*fTracks)[ntracks++]) AliAODTrack(*t);
86 }
87 }
88
89 assert(fVertices!=0x0);
90 fVertices->Clear("C");
91 TIter nextV(source.GetVertices());
92 AliAODVertex* v;
93 Int_t nvertices(0);
94
95 while ( ( v = static_cast<AliAODVertex*>(nextV()) ) )
96 {
97 if ( !fVertexCut || fVertexCut->IsSelected(v) )
98 {
99 AliAODVertex* tmp = v->CloneWithoutRefs();
100 new((*fVertices)[nvertices++]) AliAODVertex(*tmp);
101 delete tmp;
102 }
103 }
104
105 AliInfo(Form("n=%d tracks=%d vertices=%d",n,fTracks->GetEntries(),fVertices->GetEntries()));
106}
107