Adding PiKP-only histograms and eliminating a number of switches where histograms...
[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//_____________________________________________________________________________
ce350193 38AliMUONHitStoreV1::AliMUONHitStoreV1(TRootIOCtor* /*dummy*/) : AliMUONVHitStore(),
39fHits(0x0)
40{
41 /// default ctor from file
42}
43
44//_____________________________________________________________________________
456e5e72 45AliMUONHitStoreV1::AliMUONHitStoreV1() : AliMUONVHitStore(),
46 fHits(new TClonesArray("AliMUONHit",10))
47{
48 /// ctor
49 fHits->SetOwner(kTRUE);
50}
51
52//_____________________________________________________________________________
53AliMUONHitStoreV1::~AliMUONHitStoreV1()
54{
55 /// dtor
56 delete fHits;
57}
58
59//_____________________________________________________________________________
60void
61AliMUONHitStoreV1::Add(const AliMUONHit& hit)
62{
63 /// add a hit
64 new((*fHits)[fHits->GetLast()+1]) AliMUONHit(hit);
65}
66
67//_____________________________________________________________________________
68TCollection*
69AliMUONHitStoreV1::Collection()
70{
71 return fHits;
72}
73
74//_____________________________________________________________________________
75Bool_t
76AliMUONHitStoreV1::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//_____________________________________________________________________________
95TIterator*
96AliMUONHitStoreV1::CreateIterator() const
97{
98 /// create an iterator on hits
99 return fHits->MakeIterator();
100}
101
102//____________________________________________________________________________
103Int_t
104AliMUONHitStoreV1::GetSize() const
105{
106 return fHits->GetLast()+1;
107}
108
109//____________________________________________________________________________
110void
111AliMUONHitStoreV1::Clear(Option_t*)
112{
113 /// reset the internal array
114 fHits->Clear("C");
115}