remoe duplicate QA initialisation and do ESD QA for same detectors as RecPoint QA
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerTrackStoreV1.cxx
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 ClassImp(AliMUONTriggerTrackStoreV1)
37 /// \endcond
38
39 //_____________________________________________________________________________
40 AliMUONTriggerTrackStoreV1::AliMUONTriggerTrackStoreV1() : AliMUONVTriggerTrackStore(),
41  fTracks(new TClonesArray("AliMUONTriggerTrack",10))
42 {
43    /// ctor
44    fTracks->SetOwner(kTRUE);
45 }
46
47 //_____________________________________________________________________________
48 AliMUONTriggerTrackStoreV1::~AliMUONTriggerTrackStoreV1()
49 {
50   /// Dtor
51   delete fTracks;
52 }
53
54 //_____________________________________________________________________________
55 void 
56 AliMUONTriggerTrackStoreV1::Add(const AliMUONTriggerTrack& track)
57 {
58   /// Add a new trigger track
59   new((*fTracks)[fTracks->GetLast()+1]) AliMUONTriggerTrack(track);
60 }
61
62 //_____________________________________________________________________________
63 Bool_t
64 AliMUONTriggerTrackStoreV1::Connect(TTree& tree, Bool_t alone) const
65 {
66   /// Connect this to the tree
67   AliMUONTreeManager tman;
68   Bool_t ok;
69   
70   if ( tree.GetBranch("MUONTriggerTrack") ) 
71   {
72     if ( alone ) tman.UpdateBranchStatuses(tree,"MUONTriggerTrack");
73     ok = tman.SetAddress(tree,"MUONTriggerTrack",TracksPtr());
74   }
75   else
76   {
77     ok = tman.MakeBranch(tree,ClassName(),"TClonesArray","MUONTriggerTrack",
78                          TracksPtr());
79   }
80
81   return kTRUE;
82 }
83
84 //_____________________________________________________________________________
85 Int_t
86 AliMUONTriggerTrackStoreV1::GetSize() const
87 {
88   /// Return the number of trigger tracks we hold
89   return fTracks->GetSize();
90 }
91
92 //_____________________________________________________________________________
93 TIterator*
94 AliMUONTriggerTrackStoreV1::CreateIterator() const
95 {
96   /// Return an iterator to loop over trigger tracks
97   return fTracks->MakeIterator();
98 }
99
100 //_____________________________________________________________________________
101 void 
102 AliMUONTriggerTrackStoreV1::Clear(Option_t*)
103 {
104   /// Reset
105   fTracks->Clear("C");
106 }