]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTrackStoreV1.cxx
coding violation fixes
[u/mrichter/AliRoot.git] / MUON / AliMUONTrackStoreV1.cxx
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 //-----------------------------------------------------------------------------
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
25 //-----------------------------------------------------------------------------
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
35 ClassImp(AliMUONTrackStoreV1)
36 /// \endcond
37
38 //_____________________________________________________________________________
39 AliMUONTrackStoreV1::AliMUONTrackStoreV1() : AliMUONVTrackStore(),
40  fTracks(new TClonesArray("AliMUONTrack",10))
41 {
42    /// Ctor
43    fTracks->SetOwner(kTRUE);
44 }
45
46 //_____________________________________________________________________________
47 AliMUONTrackStoreV1::~AliMUONTrackStoreV1()
48 {
49   /// dtor
50   delete fTracks;
51 }
52
53 //_____________________________________________________________________________
54 void 
55 AliMUONTrackStoreV1::Add(const AliMUONTrack& track)
56 {
57   /// Add a track
58   new((*fTracks)[fTracks->GetLast()+1]) AliMUONTrack(track);
59 }
60
61 //_____________________________________________________________________________
62 Bool_t
63 AliMUONTrackStoreV1::Connect(TTree& tree, Bool_t alone) const
64 {
65   /// Connect this store to the tree
66   AliMUONTreeManager tman;
67   Bool_t ok;
68   
69   if ( tree.GetBranch("MUONTrack") )
70   {
71     if ( alone ) tman.UpdateBranchStatuses(tree,"MUONTrack");
72     ok = tman.SetAddress(tree,"MUONTrack",TracksPtr());
73   }
74   else
75   {
76     ok = tman.MakeBranch(tree,ClassName(),"TClonesArray","MUONTrack",
77                          TracksPtr());
78   }
79   return ok;
80 }
81
82 //_____________________________________________________________________________
83 TIterator*
84 AliMUONTrackStoreV1::CreateIterator() const
85 {
86   /// Create an iterator to loop over tracks
87   return fTracks->MakeIterator();
88 }
89
90 //_____________________________________________________________________________
91 void 
92 AliMUONTrackStoreV1::Clear(Option_t*)
93 {
94   /// Reset
95   fTracks->Clear("C");
96 }
97
98 //_____________________________________________________________________________
99 Int_t
100 AliMUONTrackStoreV1::GetSize() const
101 {
102   /// Return the number of tracks we hold
103   return fTracks->GetLast()+1;
104 }