]>
Commit | Line | Data |
---|---|---|
456e5e72 | 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 "AliMUONHitStoreV1.h" | |
19 | ||
3d1463c8 | 20 | //----------------------------------------------------------------------------- |
456e5e72 | 21 | /// \class AliMUONHitStoreV1 |
22 | /// | |
23 | /// Implementation of AliMUONVHitStore | |
24 | /// | |
25 | /// \author Laurent Aphecetche, Subatech | |
3d1463c8 | 26 | //----------------------------------------------------------------------------- |
456e5e72 | 27 | |
28 | #include <TClonesArray.h> | |
29 | #include <TTree.h> | |
30 | #include "AliMUONTreeManager.h" | |
31 | #include "AliMUONHit.h" | |
32 | ||
33 | /// \cond CLASSIMP | |
34 | ClassImp(AliMUONHitStoreV1) | |
35 | /// \endcond | |
36 | ||
ce350193 | 37 | //_____________________________________________________________________________ |
38 | AliMUONHitStoreV1::AliMUONHitStoreV1(TRootIOCtor* /*dummy*/) : AliMUONVHitStore(), | |
39 | fHits(0x0) | |
40 | { | |
41 | /// default ctor from file | |
42 | } | |
43 | ||
456e5e72 | 44 | //_____________________________________________________________________________ |
45 | AliMUONHitStoreV1::AliMUONHitStoreV1() : AliMUONVHitStore(), | |
46 | fHits(new TClonesArray("AliMUONHit",10)) | |
47 | { | |
48 | /// ctor | |
49 | fHits->SetOwner(kTRUE); | |
50 | } | |
51 | ||
52 | //_____________________________________________________________________________ | |
53 | AliMUONHitStoreV1::~AliMUONHitStoreV1() | |
54 | { | |
55 | /// dtor | |
56 | delete fHits; | |
57 | } | |
58 | ||
59 | //_____________________________________________________________________________ | |
60 | void | |
61 | AliMUONHitStoreV1::Add(const AliMUONHit& hit) | |
62 | { | |
63 | /// add a hit | |
64 | new((*fHits)[fHits->GetLast()+1]) AliMUONHit(hit); | |
65 | } | |
66 | ||
67 | //_____________________________________________________________________________ | |
68 | TCollection* | |
69 | AliMUONHitStoreV1::Collection() | |
70 | { | |
71 | return fHits; | |
72 | } | |
73 | ||
74 | //_____________________________________________________________________________ | |
75 | Bool_t | |
76 | AliMUONHitStoreV1::Connect(TTree& tree, Bool_t /*alone*/) const | |
77 | { | |
78 | /// Connect this to tree. | |
79 | AliMUONTreeManager tman; | |
80 | Bool_t ok; | |
81 | ||
82 | if ( tree.GetBranch("MUONHits") ) | |
83 | { | |
84 | ok = tman.SetAddress(tree,"MUONHits",HitsPtr()); | |
85 | } | |
86 | else | |
87 | { | |
88 | ok = tman.MakeBranch(tree,ClassName(),"TClonesArray","MUONHits", | |
89 | HitsPtr()); | |
90 | } | |
91 | return ok; | |
92 | } | |
93 | ||
94 | //_____________________________________________________________________________ | |
95 | TIterator* | |
96 | AliMUONHitStoreV1::CreateIterator() const | |
97 | { | |
98 | /// create an iterator on hits | |
99 | return fHits->MakeIterator(); | |
100 | } | |
101 | ||
102 | //____________________________________________________________________________ | |
103 | Int_t | |
104 | AliMUONHitStoreV1::GetSize() const | |
105 | { | |
106 | return fHits->GetLast()+1; | |
107 | } | |
108 | ||
109 | //____________________________________________________________________________ | |
110 | void | |
111 | AliMUONHitStoreV1::Clear(Option_t*) | |
112 | { | |
113 | /// reset the internal array | |
114 | fHits->Clear("C"); | |
115 | } |