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