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 //-----------------------------------------------------------------------------
37 ClassImp(AliMUONCheckItem)
40 //_____________________________________________________________________________
41 AliMUONCheckItem::AliMUONCheckItem(Int_t id, Int_t maxNumber, const char* name) :
46 fMissing(new AliMpExMap)
48 /// ctor. id is the number of that item, maxNumber is the maximum number
49 /// of sub-item it can contains, and name is a label, e.g. de, chamber, manu.
50 /// Note that name="manu" has a special influence on the IsDead() method.
52 fMissing->SetSize(fMaximum);
53 AliDebug(1,Form("ID %d maxNumber %d name %s",id,maxNumber,name));
56 //_____________________________________________________________________________
57 AliMUONCheckItem::~AliMUONCheckItem()
63 //_____________________________________________________________________________
64 Bool_t AliMUONCheckItem::AddItem(Int_t id, TObject* item)
66 /// Add an item, if possible.
70 AliError("I'm already full!");
74 TObject* test = GetItem(id);
77 AliError(Form("id %d is already there !",id));
82 fMissing->Add(id,item);
88 //_____________________________________________________________________________
90 AliMUONCheckItem::ComputeDead() const
92 /// Decide whether this item is completely dead, which is determined by
93 /// the fact that all its sub-items are dead, or for name="manu", by
94 /// the fact that all channels are missing, i.e. IsFull()==kTRUE
96 TString name(GetName());
99 if ( name.Contains("manu") )
112 TIter next(CreateIterator());
113 AliMUONCheckItem* item;
116 while ( ( item = dynamic_cast<AliMUONCheckItem*>(next()) ) )
118 if ( item->IsDead() ) ++ndead;
120 if ( ndead == fMaximum ) fDead = 1;
124 //_____________________________________________________________________________
126 AliMUONCheckItem::CreateIterator() const
128 /// Create iterator on this item
129 return fMissing->CreateIterator();
132 //_____________________________________________________________________________
134 AliMUONCheckItem::GetItem(Int_t id) const
136 /// Return item of a given id
137 return fMissing->GetValue(id);
140 //_____________________________________________________________________________
142 AliMUONCheckItem::IsDead() const
144 /// Return (and compute it first if not done already) dead status
152 //_____________________________________________________________________________
154 AliMUONCheckItem::IsFull() const
156 /// Whether we have as many sub-items as possible
157 return (fMissing->GetSize() == fMaximum);
160 //_____________________________________________________________________________
162 AliMUONCheckItem::Print(Option_t* opt) const
165 cout << Form("<AliMUONCheckItem> %s ID %d has %d items over %d max. Dead %d",
166 GetName(),fID,fMissing->GetSize(),fMaximum,IsDead()) << endl;
169 if (sopt.Contains("all") )
171 TObject* object(0x0);
173 TIter next(CreateIterator());
175 while ( ( object = next() ) )