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