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 "Riostream.h"
23 #include "AliMUONCheckItemIterator.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(kTRUE))
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 AliMUONCheckItemIterator it(*this);
113 AliMUONCheckItem* item;
117 while ( ( item = dynamic_cast<AliMUONCheckItem*>(it.Next()) ) )
119 if ( item->IsDead() ) ++ndead;
121 if ( ndead == fMaximum ) fDead = 1;
125 //_____________________________________________________________________________
127 AliMUONCheckItem::GetItem(Int_t id) const
129 /// Return item of a given id
130 return fMissing->GetValue(id);
133 //_____________________________________________________________________________
135 AliMUONCheckItem::IsDead() const
137 /// Return (and compute it first if not done already) dead status
145 //_____________________________________________________________________________
147 AliMUONCheckItem::IsFull() const
149 /// Whether we have as many sub-items as possible
150 return (fMissing->GetSize() == fMaximum);
153 //_____________________________________________________________________________
155 AliMUONCheckItem::Print(Option_t* opt) const
158 cout << Form("<AliMUONCheckItem> %s ID %d has %d items over %d max. Dead %d",
159 GetName(),fID,fMissing->GetSize(),fMaximum,IsDead()) << endl;
162 if (sopt.Contains("all") )
164 TObject* object(0x0);
166 AliMUONCheckItemIterator it(*this);
170 while ( ( object = it.Next() ) )