]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTrackStoreV1.cxx
Coding conventions fixed.
[u/mrichter/AliRoot.git] / MUON / AliMUONTrackStoreV1.cxx
CommitLineData
3a018b82 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
3d1463c8 18//-----------------------------------------------------------------------------
3a018b82 19/// \class AliMUONTrackStoreV1
20///
21/// Implementation of AliMUONTrackStoreV1, which should be backward
22/// compatible, i.e. able to read old TreeT files
23///
24/// \author Laurent Aphecetche, Subatech
3d1463c8 25//-----------------------------------------------------------------------------
3a018b82 26
27#include "AliMUONTrackStoreV1.h"
28
29#include <TClonesArray.h>
30#include <TTree.h>
31#include "AliMUONTrack.h"
32#include "AliMUONTreeManager.h"
33
34/// \cond CLASSIMP
35ClassImp(AliMUONTrackStoreV1)
36/// \endcond
37
38//_____________________________________________________________________________
39AliMUONTrackStoreV1::AliMUONTrackStoreV1() : AliMUONVTrackStore(),
40 fTracks(new TClonesArray("AliMUONTrack",10))
41{
42 /// Ctor
3a018b82 43}
44
45//_____________________________________________________________________________
46AliMUONTrackStoreV1::~AliMUONTrackStoreV1()
47{
48 /// dtor
49 delete fTracks;
50}
51
52//_____________________________________________________________________________
7332f213 53AliMUONTrack*
3a018b82 54AliMUONTrackStoreV1::Add(const AliMUONTrack& track)
55{
56 /// Add a track
7332f213 57 return new((*fTracks)[fTracks->GetLast()+1]) AliMUONTrack(track);
58}
59
60//_____________________________________________________________________________
61AliMUONTrack*
62AliMUONTrackStoreV1::Remove(AliMUONTrack& track)
63{
64 /// Remove a track from the store
65 AliMUONTrack* t = static_cast<AliMUONTrack*>(fTracks->Remove(&track));
66 if (t) fTracks->Compress();
67 return t;
3a018b82 68}
69
70//_____________________________________________________________________________
71Bool_t
72AliMUONTrackStoreV1::Connect(TTree& tree, Bool_t alone) const
73{
74 /// Connect this store to the tree
75 AliMUONTreeManager tman;
76 Bool_t ok;
77
78 if ( tree.GetBranch("MUONTrack") )
79 {
80 if ( alone ) tman.UpdateBranchStatuses(tree,"MUONTrack");
81 ok = tman.SetAddress(tree,"MUONTrack",TracksPtr());
82 }
83 else
84 {
85 ok = tman.MakeBranch(tree,ClassName(),"TClonesArray","MUONTrack",
86 TracksPtr());
87 }
88 return ok;
89}
90
91//_____________________________________________________________________________
92TIterator*
93AliMUONTrackStoreV1::CreateIterator() const
94{
95 /// Create an iterator to loop over tracks
96 return fTracks->MakeIterator();
97}
98
99//_____________________________________________________________________________
100void
101AliMUONTrackStoreV1::Clear(Option_t*)
102{
103 /// Reset
104 fTracks->Clear("C");
105}
106
107//_____________________________________________________________________________
108Int_t
109AliMUONTrackStoreV1::GetSize() const
110{
111 /// Return the number of tracks we hold
112 return fTracks->GetLast()+1;
113}