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