]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONV1DStore.cxx
Adding Print method (Laurent)
[u/mrichter/AliRoot.git] / MUON / AliMUONV1DStore.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 #include "AliMUONV1DStore.h"
19
20 #include "AliMUONVDataIterator.h"
21 #include "AliMUONObjectPair.h"
22 #include "AliMpIntPair.h"
23 #include "AliMpHelper.h"
24 #include <TMap.h>
25 #include <TString.h>
26 #include <Riostream.h>
27
28 /// \class AliMUONV1DStore
29 /// Defines an interface equivalent to a list of TObject, indexed
30 /// by integer (somehow a vector, except that indices are not necessarily
31 /// sequential).
32 /// 
33 /// It's extremely simple and hopefully allow many implementations.
34 /// It also makes the object ownership self-evident.
35 ///
36 /// \author Laurent Aphecetche
37
38 /// \cond CLASSIMP
39 ClassImp(AliMUONV1DStore)
40 /// \endcond
41
42 //_____________________________________________________________________________
43 AliMUONV1DStore::AliMUONV1DStore()
44 {
45 /// Default constructor
46 }
47
48 //_____________________________________________________________________________
49 AliMUONV1DStore::~AliMUONV1DStore()
50 {
51 /// Destructor
52 }
53
54 void
55 AliMUONV1DStore::Print(Option_t* opt) const
56 {
57   /// Printout
58   /// opt is used to filter which i you want to see
59   /// e.g opt="I=12;opt=Full" to see complete values, but only for i=12
60   /// Warning : decoding of opt format is not really bullet-proof (yet?)
61   
62   AliMUONVDataIterator* it = this->Iterator();
63   
64   AliMUONObjectPair* pair;
65   
66   TMap* m = AliMpHelper::Decode(opt);
67   
68   TString si;  
69   Bool_t selectI = AliMpHelper::Decode(*m,"i",si);
70   TString sopt;
71   AliMpHelper::Decode(*m,"opt",sopt);
72   
73   m->DeleteAll();
74   delete m;
75   
76   while ( ( pair = static_cast<AliMUONObjectPair*>(it->Next() ) ) )
77   {
78     AliMpIntPair* ip = static_cast<AliMpIntPair*>(pair->First());
79     Int_t i = ip->GetFirst();
80     if ( selectI && i != si.Atoi() ) continue;
81     cout << Form("[%d]",i) << endl;
82     TObject* o = pair->Second();
83     if (o) 
84     {
85       o->Print(sopt.Data());
86     }
87   }
88   
89   delete it;
90 }
91
92
93
94