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 /// \class AliMUONCheckItem
27 /// A structure used to gather information at different levels (ch,manu,de,chamber)
29 /// Used by AliMUON2DStoreValidator to present results in a concise way
32 /// \author Laurent Aphecetche
35 ClassImp(AliMUONCheckItem)
38 //_____________________________________________________________________________
39 AliMUONCheckItem::AliMUONCheckItem(Int_t id, Int_t maxNumber, const char* name) :
44 fMissing(new AliMpExMap(kTRUE))
46 /// ctor. id is the number of that item, maxNumber is the maximum number
47 /// of sub-item it can contains, and name is a label, e.g. de, chamber, manu.
48 /// Note that name="manu" has a special influence on the IsDead() method.
50 fMissing->SetSize(fMaximum);
51 AliDebug(1,Form("ID %d maxNumber %d name %s",id,maxNumber,name));
54 //_____________________________________________________________________________
55 AliMUONCheckItem::~AliMUONCheckItem()
61 //_____________________________________________________________________________
62 Bool_t AliMUONCheckItem::AddItem(Int_t id, TObject* item)
64 /// Add an item, if possible.
68 AliError("I'm already full!");
72 TObject* test = GetItem(id);
75 AliError(Form("id %d is already there !",id));
80 fMissing->Add(id,item);
86 //_____________________________________________________________________________
88 AliMUONCheckItem::ComputeDead() const
90 /// Decide whether this item is completely dead, which is determined by
91 /// the fact that all its sub-items are dead, or for name="manu", by
92 /// the fact that all channels are missing, i.e. IsFull()==kTRUE
94 TString name(GetName());
97 if ( name.Contains("manu") )
110 AliMUONCheckItemIterator it(*this);
111 AliMUONCheckItem* item;
115 while ( ( item = dynamic_cast<AliMUONCheckItem*>(it.Next()) ) )
117 if ( item->IsDead() ) ++ndead;
119 if ( ndead == fMaximum ) fDead = 1;
123 //_____________________________________________________________________________
125 AliMUONCheckItem::GetItem(Int_t id) const
127 /// Return item of a given id
128 return fMissing->GetValue(id);
131 //_____________________________________________________________________________
133 AliMUONCheckItem::IsDead() const
135 /// Return (and compute it first if not done already) dead status
143 //_____________________________________________________________________________
145 AliMUONCheckItem::IsFull() const
147 /// Whether we have as many sub-items as possible
148 return (fMissing->GetSize() == fMaximum);
151 //_____________________________________________________________________________
153 AliMUONCheckItem::Print(Option_t* opt) const
156 cout << Form("<AliMUONCheckItem> %s ID %d has %d items over %d max. Dead %d",
157 GetName(),fID,fMissing->GetSize(),fMaximum,IsDead()) << endl;
160 if (sopt.Contains("all") )
162 TObject* object(0x0);
164 AliMUONCheckItemIterator it(*this);
168 while ( ( object = it.Next() ) )