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