Line data Source code
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 : //-----------------------------------------------------------------------------
19 : /// \class AliMUONTriggerTrackStoreV1
20 : ///
21 : /// Implementation of AliMUONVTriggerTrackStore which should be
22 : /// backward compatible, i.e. able to read TreeT produced before
23 : /// the introduction of the AliMUONVStore concept
24 : ///
25 : /// \author Laurent Aphecetche, Subatech
26 : //-----------------------------------------------------------------------------
27 :
28 : #include "AliMUONTriggerTrackStoreV1.h"
29 :
30 : #include <TClonesArray.h>
31 : #include "AliMUONTreeManager.h"
32 : #include "AliMUONTriggerTrack.h"
33 : #include <TTree.h>
34 :
35 : /// \cond CLASSIMP
36 18 : ClassImp(AliMUONTriggerTrackStoreV1)
37 : /// \endcond
38 :
39 : //_____________________________________________________________________________
40 0 : AliMUONTriggerTrackStoreV1::AliMUONTriggerTrackStoreV1(TRootIOCtor* /*dummy*/) : AliMUONVTriggerTrackStore(),
41 0 : fTracks(0x0)
42 0 : {
43 : /// ctor
44 0 : }
45 :
46 : //_____________________________________________________________________________
47 2 : AliMUONTriggerTrackStoreV1::AliMUONTriggerTrackStoreV1() : AliMUONVTriggerTrackStore(),
48 6 : fTracks(new TClonesArray("AliMUONTriggerTrack",10))
49 10 : {
50 : /// ctor
51 2 : fTracks->SetOwner(kTRUE);
52 4 : }
53 :
54 : //_____________________________________________________________________________
55 : AliMUONTriggerTrackStoreV1::~AliMUONTriggerTrackStoreV1()
56 12 : {
57 : /// Dtor
58 4 : delete fTracks;
59 6 : }
60 :
61 : //_____________________________________________________________________________
62 : void
63 : AliMUONTriggerTrackStoreV1::Add(const AliMUONTriggerTrack& track)
64 : {
65 : /// Add a new trigger track
66 28 : new((*fTracks)[fTracks->GetLast()+1]) AliMUONTriggerTrack(track);
67 14 : }
68 :
69 : //_____________________________________________________________________________
70 : Bool_t
71 : AliMUONTriggerTrackStoreV1::Connect(TTree& tree, Bool_t alone) const
72 : {
73 : /// Connect this to the tree
74 0 : AliMUONTreeManager tman;
75 : Bool_t ok;
76 :
77 0 : if ( tree.GetBranch("MUONTriggerTrack") )
78 : {
79 0 : if ( alone ) tman.UpdateBranchStatuses(tree,"MUONTriggerTrack");
80 0 : ok = tman.SetAddress(tree,"MUONTriggerTrack",TracksPtr());
81 0 : }
82 : else
83 : {
84 0 : ok = tman.MakeBranch(tree,ClassName(),"TClonesArray","MUONTriggerTrack",
85 0 : TracksPtr());
86 : }
87 :
88 : return kTRUE;
89 0 : }
90 :
91 : //_____________________________________________________________________________
92 : Int_t
93 : AliMUONTriggerTrackStoreV1::GetSize() const
94 : {
95 : /// Return the number of trigger tracks we hold
96 16 : return fTracks->GetLast()+1;
97 : }
98 :
99 : //_____________________________________________________________________________
100 : TIterator*
101 : AliMUONTriggerTrackStoreV1::CreateIterator() const
102 : {
103 : /// Return an iterator to loop over trigger tracks
104 64 : return fTracks->MakeIterator();
105 : }
106 :
107 : //_____________________________________________________________________________
108 : void
109 : AliMUONTriggerTrackStoreV1::Clear(Option_t*)
110 : {
111 : /// Reset
112 16 : fTracks->Clear("C");
113 8 : }
|