1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliMUONCheckItem.h"
21 #include "AliMpExMap.h"
22 #include "AliMpExMapIterator.h"
23 #include "Riostream.h"
25 //-----------------------------------------------------------------------------
26 /// \class AliMUONCheckItem
28 /// A structure used to gather information at different levels (ch,manu,de,chamber)
30 /// Used by AliMUON2DStoreValidator to present results in a concise way
33 /// \author Laurent Aphecetche
34 //-----------------------------------------------------------------------------
39 ClassImp(AliMUONCheckItem)
42 //_____________________________________________________________________________
43 AliMUONCheckItem::AliMUONCheckItem(Int_t id, Int_t maxNumber, const char* name) :
48 fMissing(new AliMpExMap)
50 /// ctor. id is the number of that item, maxNumber is the maximum number
51 /// of sub-item it can contains, and name is a label, e.g. de, chamber, manu.
52 /// Note that name="manu" has a special influence on the IsDead() method.
54 fMissing->SetSize(fMaximum);
55 AliDebug(1,Form("ID %d maxNumber %d name %s",id,maxNumber,name));
58 //_____________________________________________________________________________
59 AliMUONCheckItem::~AliMUONCheckItem()
65 //_____________________________________________________________________________
66 Bool_t AliMUONCheckItem::AddItem(Int_t id, TObject* item)
68 /// Add an item, if possible.
72 AliError("I'm already full!");
76 TObject* test = GetItem(id);
79 AliError(Form("id %d is already there !",id));
84 fMissing->Add(id,item);
90 //_____________________________________________________________________________
92 AliMUONCheckItem::ComputeDead() const
94 /// Decide whether this item is completely dead, which is determined by
95 /// the fact that all its sub-items are dead, or for name="manu", by
96 /// the fact that all channels are missing, i.e. IsFull()==kTRUE
98 TString name(GetName());
101 if ( name.Contains("manu") )
114 TIter next(CreateIterator());
115 AliMUONCheckItem* item;
118 while ( ( item = dynamic_cast<AliMUONCheckItem*>(next()) ) )
120 if ( item->IsDead() ) ++ndead;
122 if ( ndead == fMaximum ) fDead = 1;
126 //_____________________________________________________________________________
128 AliMUONCheckItem::CreateIterator() const
130 /// Create iterator on this item
131 return fMissing->CreateIterator();
134 //_____________________________________________________________________________
136 AliMUONCheckItem::GetItem(Int_t id) const
138 /// Return item of a given id
139 return fMissing->GetValue(id);
142 //_____________________________________________________________________________
144 AliMUONCheckItem::IsDead() const
146 /// Return (and compute it first if not done already) dead status
154 //_____________________________________________________________________________
156 AliMUONCheckItem::IsFull() const
158 /// Whether we have as many sub-items as possible
159 return (fMissing->GetSize() == fMaximum);
162 //_____________________________________________________________________________
164 AliMUONCheckItem::Print(Option_t* opt) const
167 cout << Form("<AliMUONCheckItem> %s ID %d has %d items over %d max. Dead %d",
168 GetName(),fID,fMissing->GetSize(),fMaximum,IsDead()) << endl;
171 if (sopt.Contains("all") )
173 TObject* object(0x0);
175 TIter next(CreateIterator());
177 while ( ( object = next() ) )