X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUON2DStoreValidator.cxx;h=ca12872181e4d74ed65d46791abbb5e501e38f58;hb=65a7dc2a5a307d8bfc1582bc9c9e5d114b89e7c2;hp=81f57d60bf147fdc8c1b482da87fe4fa9ccbf715;hpb=9b955acc7069f4186faa45a764194e6e0c27fa0f;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUON2DStoreValidator.cxx b/MUON/AliMUON2DStoreValidator.cxx index 81f57d60bf1..ca12872181e 100644 --- a/MUON/AliMUON2DStoreValidator.cxx +++ b/MUON/AliMUON2DStoreValidator.cxx @@ -18,23 +18,26 @@ #include "AliMUON2DStoreValidator.h" #include "AliLog.h" -#include "AliMUONCalibParam1I.h" -#include "AliMpIntPair.h" -#include "AliMpManuList.h" -#include "AliMUONV2DStore.h" -#include "TList.h" -#include "TObjArray.h" #include "AliMUONCheckItem.h" -#include "AliMUONCheckItemIterator.h" +#include "AliMUONVCalibParam.h" +#include "AliMUONVStore.h" +#include "AliMpConstants.h" +#include "AliMpDDLStore.h" #include "AliMpDEManager.h" -#include "TObjString.h" -#include "AliMUONConstants.h" -#include "Riostream.h" +#include "AliMpDetElement.h" +#include "AliMpManuIterator.h" +#include +#include +#include +#include +//----------------------------------------------------------------------------- /// \class AliMUON2DStoreValidator /// /// Determine which channels, manus, DEs, stations are missing -/// from a 2DStore. This is mainly to be used during (shuttle) preprocessing +/// from a VStore, which must be 2D, and the 2 dimensions must be +/// (detElemId,manuId). +/// This is mainly to be used during (shuttle) preprocessing /// to insure that what we'll put in the CDB is as complete as possible, /// and to detect possible problem. /// @@ -45,14 +48,18 @@ /// The list of missing things is kept in a structure of objects defined as : /// /// fMissing = TObjArray[0..N tracking chambers] +/// /// fMissing[iChamber] = AliMUONCheckItem which contains n AliMUONCheckItem, /// where n is the number of DE for that chamber +/// /// fMissing[iChamber]->GetItem(de) = AliMUONCheckItem which contains m /// AliMUONCheckItem where m is the number of Manu for that DE +/// /// fMissing[iChamber]->GetItem(de)->GetItem(manu) = AliMUONCheckItem which /// contains k TObjString = Form("%d",manuChannel) /// /// \author Laurent Aphecetche +//----------------------------------------------------------------------------- /// \cond CLASSIMP ClassImp(AliMUON2DStoreValidator) @@ -61,7 +68,6 @@ ClassImp(AliMUON2DStoreValidator) //_____________________________________________________________________________ AliMUON2DStoreValidator::AliMUON2DStoreValidator() : TObject(), - fManuList(0x0), fChambers(0x0), fStatus(0x0) { @@ -72,7 +78,6 @@ AliMUON2DStoreValidator::AliMUON2DStoreValidator() AliMUON2DStoreValidator::~AliMUON2DStoreValidator() { /// dtor - delete fManuList; delete fChambers; delete fStatus; } @@ -84,7 +89,7 @@ AliMUON2DStoreValidator::GetChamber(Int_t chamberID) /// Return (and create if not present) the given chamber /// chamberID in 0..NCh() - if ( chamberID < 0 || chamberID >= AliMUONConstants::NCh() ) + if ( chamberID < 0 || chamberID >= AliMpConstants::NofTrackingChambers() ) { AliFatal(Form("Invalid chamber number %d",chamberID)); return 0x0; @@ -92,7 +97,7 @@ AliMUON2DStoreValidator::GetChamber(Int_t chamberID) if (!fChambers) { - fChambers = new TObjArray(AliMUONConstants::NCh()); + fChambers = new TObjArray(AliMpConstants::NofTrackingChambers()); } AliMUONCheckItem* chamber = @@ -123,7 +128,7 @@ AliMUON2DStoreValidator::GetDE(Int_t detElemId) AliDebug(3,Form("Did not find DE %4d into chamber %d, will create it", detElemId,chamberID)); de = new AliMUONCheckItem(detElemId, - AliMpManuList::NumberOfManus(detElemId), + AliMpDDLStore::Instance()->GetDetElement(detElemId)->NofManus(), "Detection Element"); Bool_t ok = chamber->AddItem(detElemId,de); if (!ok) @@ -144,7 +149,7 @@ AliMUON2DStoreValidator::GetManu(Int_t detElemId, Int_t manuId) AliMUONCheckItem* manu = static_cast(de->GetItem(manuId)); if (!manu) { - manu = new AliMUONCheckItem(manuId,AliMpManuList::NumberOfChannels(detElemId,manuId),"Manu"); + manu = new AliMUONCheckItem(manuId,AliMpDDLStore::Instance()->GetDetElement(detElemId)->NofChannelsInManu(manuId),"Manu"); Bool_t ok = de->AddItem(manuId,manu); if (!ok) { @@ -183,7 +188,7 @@ AliMUON2DStoreValidator::AddMissingManu(Int_t detElemId, Int_t manuId) AliDebug(3,Form("DE %4d Manu %4d is completely missing", detElemId,manuId)); - Int_t n(AliMpManuList::NumberOfChannels(detElemId,manuId)); + Int_t n(AliMpDDLStore::Instance()->GetDetElement(detElemId)->NofChannelsInManu(manuId)); for ( Int_t i = 0; i < n; ++i ) { @@ -193,16 +198,14 @@ AliMUON2DStoreValidator::AddMissingManu(Int_t detElemId, Int_t manuId) //_____________________________________________________________________________ void -AliMUON2DStoreValidator::ReportManu(TList& lines, AliMUONCheckItem& manu) +AliMUON2DStoreValidator::ReportManu(TList& lines, const AliMUONCheckItem& manu) { /// Report list of missing channels from this manu TObjString* channel(0x0); - AliMUONCheckItemIterator it(manu); + TIter next(manu.CreateIterator()); - it.First(); - - while ( ( channel = static_cast(it.Next()) ) ) + while ( ( channel = static_cast(next()) ) ) { lines.Add(new TObjString(Form("\t\t\tChannel %s is missing or dead", channel->GetString().Data()))); @@ -212,17 +215,17 @@ AliMUON2DStoreValidator::ReportManu(TList& lines, AliMUONCheckItem& manu) //_____________________________________________________________________________ void -AliMUON2DStoreValidator::ReportDE(TList& lines, AliMUONCheckItem& de) +AliMUON2DStoreValidator::ReportDE(TList& lines, const AliMUONCheckItem& de) { /// Report list of missing manus from this de AliMUONCheckItem* manu(0x0); - AliMUONCheckItemIterator it(de); + + TIter next(de.CreateIterator()); lines.Add(new TObjString(Form("DE %5d",de.GetID()))); - it.First(); - while ( ( manu = static_cast(it.Next()) ) ) + while ( ( manu = static_cast(next()) ) ) { if ( manu->IsDead() ) { @@ -237,16 +240,14 @@ AliMUON2DStoreValidator::ReportDE(TList& lines, AliMUONCheckItem& de) //_____________________________________________________________________________ void -AliMUON2DStoreValidator::ReportChamber(TList& lines, AliMUONCheckItem& chamber) +AliMUON2DStoreValidator::ReportChamber(TList& lines, const AliMUONCheckItem& chamber) { /// Report list of missing de from this chamber AliMUONCheckItem* de(0x0); - AliMUONCheckItemIterator it(chamber); - - it.First(); + TIter next(chamber.CreateIterator()); - while ( ( de = static_cast(it.Next()) ) ) + while ( ( de = static_cast(next()) ) ) { if ( de->IsDead() ) { @@ -295,8 +296,22 @@ AliMUON2DStoreValidator::Report(TList& lines, const TObjArray& chambers) //_____________________________________________________________________________ TObjArray* -AliMUON2DStoreValidator::Validate(const AliMUONV2DStore& store, - Bool_t (*check)(const AliMUONVCalibParam&,Int_t)) +AliMUON2DStoreValidator::Validate(const AliMUONVStore& store, + AliMUONVStore* config) +{ + /// Validate the store. Check only the presence of all manus (i.e. + /// check nothing about the values themselves). + /// Absence of manus which are not in the config is considered as normal. + + Bool_t (*kCheck)(const AliMUONVCalibParam&,Int_t) = 0x0; + return Validate(store,kCheck,config); +} + +//_____________________________________________________________________________ +TObjArray* +AliMUON2DStoreValidator::Validate(const AliMUONVStore& store, + Bool_t (*check)(const AliMUONVCalibParam&,Int_t), + AliMUONVStore* config) { /// Validate the store. /// The check method is used to decide if a store content value @@ -305,30 +320,36 @@ AliMUON2DStoreValidator::Validate(const AliMUONV2DStore& store, delete fChambers; fChambers = 0x0; - if (!fManuList) fManuList = AliMpManuList::ManuList(); - // Now checks if some full manus are missing - TIter next(fManuList); - AliMpIntPair* p; + + AliMpManuIterator it; + + Int_t detElemId; + Int_t manuId; - while ( ( p = (AliMpIntPair*)next() ) ) + while ( it.Next(detElemId,manuId) ) { - Int_t detElemId = p->GetFirst(); - Int_t manuId = p->GetSecond(); AliMUONVCalibParam* test = - static_cast(store.Get(detElemId,manuId)); + static_cast(store.FindObject(detElemId,manuId)); if (!test) { // completely missing manu - AddMissingManu(detElemId,manuId); + if ( !config || ( config && config->FindObject(detElemId,manuId ) ) ) + { + // manu is in the config but not in the store : that's an error + AddMissingManu(detElemId,manuId); + } } else { if (!check) continue; + + AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); + // manu is there, check all its channels for ( Int_t manuChannel = 0 ; manuChannel < test->Size(); ++manuChannel ) { - if ( AliMpManuList::DoesChannelExist(detElemId,manuId,manuChannel) && + if ( de->IsConnectedChannel(manuId,manuChannel) && !check(*test,manuChannel) ) { AddMissingChannel(detElemId,manuId,manuChannel); @@ -343,8 +364,9 @@ AliMUON2DStoreValidator::Validate(const AliMUONV2DStore& store, //_____________________________________________________________________________ TObjArray* -AliMUON2DStoreValidator::Validate(const AliMUONV2DStore& store, - Float_t invalidFloatValue) +AliMUON2DStoreValidator::Validate(const AliMUONVStore& store, + Float_t invalidFloatValue, + AliMUONVStore* config) { /// Validate the store. /// The invalidFloatValue is used to decide if a store content value @@ -353,29 +375,32 @@ AliMUON2DStoreValidator::Validate(const AliMUONV2DStore& store, delete fChambers; fChambers = 0x0; - if (!fManuList) fManuList = AliMpManuList::ManuList(); - // Now checks if some full manus are missing - TIter next(fManuList); - AliMpIntPair* p; - while ( ( p = (AliMpIntPair*)next() ) ) + AliMpManuIterator it; + Int_t detElemId; + Int_t manuId; + + while ( it.Next(detElemId,manuId) ) { - Int_t detElemId = p->GetFirst(); - Int_t manuId = p->GetSecond(); AliMUONVCalibParam* test = - static_cast(store.Get(detElemId,manuId)); + static_cast(store.FindObject(detElemId,manuId)); if (!test) { - // completely missing manu - AddMissingManu(detElemId,manuId); + if ( !config || ( config && config->FindObject(detElemId,manuId ) ) ) + { + // completely missing manu + AddMissingManu(detElemId,manuId); + } } else { // manu is there, check all its channels + AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); + for ( Int_t manuChannel = 0 ; manuChannel < test->Size(); ++manuChannel ) { - if ( AliMpManuList::DoesChannelExist(detElemId,manuId,manuChannel) && + if ( de->IsConnectedChannel(manuId,manuChannel) && ( test->ValueAsFloat(manuChannel,0) == invalidFloatValue || test->ValueAsFloat(manuChannel,1) == invalidFloatValue ) ) {