AliRoot Core  edcc906 (edcc906)
AliMUONHitStoreV1.cxx
Go to the documentation of this file.
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 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
27 
28 #include <TClonesArray.h>
29 #include <TTree.h>
30 #include "AliMUONTreeManager.h"
31 #include "AliMUONHit.h"
32 
34 ClassImp(AliMUONHitStoreV1)
36 
37 //_____________________________________________________________________________
39 fHits(0x0)
40 {
42 }
43 
44 //_____________________________________________________________________________
46  fHits(new TClonesArray("AliMUONHit",10))
47 {
49  fHits->SetOwner(kTRUE);
50 }
51 
52 //_____________________________________________________________________________
54 {
56  delete fHits;
57 }
58 
59 //_____________________________________________________________________________
60 void
62 {
64  new((*fHits)[fHits->GetLast()+1]) AliMUONHit(hit);
65 }
66 
67 //_____________________________________________________________________________
68 TCollection*
70 {
71  return fHits;
72 }
73 
74 //_____________________________________________________________________________
75 Bool_t
76 AliMUONHitStoreV1::Connect(TTree& tree, Bool_t /*alone*/) const
77 {
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*
97 {
99  return fHits->MakeIterator();
100 }
101 
102 //____________________________________________________________________________
103 Int_t
105 {
106  return fHits->GetLast()+1;
107 }
108 
109 //____________________________________________________________________________
110 void
112 {
114  fHits->Clear("C");
115 }
Bool_t SetAddress(TTree &tree, const char *branchName, void *address) const
TClonesArray ** HitsPtr() const
Return the address of array of hits.
Virtual store to hold digit.
Implementation of AliMUONVHitStore.
virtual Int_t GetSize() const
The number of objects stored.
TTree * tree
Helper class to ease TTree (MUON) branches manipulations.
virtual TCollection * Collection()
Must be implemented to allow connection using MCApp()->AddHitList()
virtual Bool_t Connect(TTree &tree, Bool_t alone=kTRUE) const
Connect us to a TTree (only valid if CanConnect()==kTRUE)
virtual void Add(const AliMUONHit &hit)
Add a digit.
TClonesArray * fHits
array of hits
MonteCarlo hit.
Definition: AliMUONHit.h:24
Bool_t MakeBranch(TTree &tree, const char *storeClassName, const char *branchClassName, const char *branchName, void *address, Int_t bufferSize=4000, Int_t splitLevel=99) const
virtual void Clear(Option_t *opt="")
Clear ourselves (i.e. Reset)
virtual TIterator * CreateIterator() const
Return an iterator to loop over hits.