#include "AliMUON2DStoreValidator.h"
#include "AliMUONCalibParamNI.h"
#include "AliMUONCalibrationData.h"
+#include "AliMUONLogger.h"
+#include "AliMUONRecoParam.h"
#include "AliMUONStringIntMap.h"
-#include "AliMUONVCalibParam.h"
#include "AliMUONTrackerData.h"
+#include "AliMUONVCalibParam.h"
#include "AliMpArea.h"
#include "AliMpArrayI.h"
+#include "AliMpCDB.h"
#include "AliMpConstants.h"
#include "AliMpDDLStore.h"
#include "AliMpDEManager.h"
#include "AliMpDetElement.h"
#include "AliMpDCSNamer.h"
+#include "AliMpManuIterator.h"
#include "AliMpManuUID.h"
#include "AliCDBEntry.h"
fPedMeanLimits(0,4095),
fPedSigmaLimits(0,4095),
fManuOccupancyLimits(0,1.0),
-fBusPatchOccupancyLimits(0,1.0),
+fBuspatchOccupancyLimits(0,1.0),
fDEOccupancyLimits(0,1.0),
fStatus(new AliMUON2DMap(true)),
-fHV(new TExMap),
+fHV(0x0),
fPedestals(calibData.Pedestals()),
fGains(calibData.Gains()),
fTrackerData(0x0)
{
/// ctor
- AliDebug(1,Form("ped store %s gain store %s",
- fPedestals->ClassName(),
- fGains->ClassName()));
-
if ( calibData.OccupancyMap() )
{
- AliInfo("Will use occupancy map to cut, if so required in AliMUONRecoParam");
/// create a tracker data from the occupancy map
fTrackerData = new AliMUONTrackerData("OCC","OCC",*(calibData.OccupancyMap()));
- }
+ }
+ if ( calibData.HV() )
+ {
+ /// Only create the fHV internal store if there are some HV values available
+ fHV = new TExMap;
+ }
}
//_____________________________________________________________________________
AliMUONPadStatusMaker::~AliMUONPadStatusMaker()
{
/// dtor.
+
delete fStatus;
delete fHV;
delete fTrackerData;
{
/// return a human readable version of the integer status
+ if ( status == 0 )
+ {
+ return "Brave New World";
+ }
+
Int_t pedStatus;
Int_t gainStatus;
Int_t hvStatus;
/// and the switch).
/// Returns false if hv switch changed during the run.
- AliCodeTimerAuto("")
+ AliCodeTimerAuto("",0)
+
+ if (!fHV) return kFALSE;
Bool_t error = kFALSE;
hvChannelTooLow = kFALSE;
return error;
}
+//_____________________________________________________________________________
+Float_t
+AliMUONPadStatusMaker::SwitchValue(const TObjArray& dcsArray)
+{
+ /// Loop over the dcs value for a single switch to decide whether
+ /// we should consider it on or off
+
+ // we'll count the number of ON/OFF for this pad, to insure
+ // consistency (i.e. if status changed during the run, we should
+ // at least notify this fact ;-) and hope it's not the norm)
+ Int_t nTrue(0);
+ Int_t nFalse(0);
+ TIter next(&dcsArray);
+ AliDCSValue* val;
+
+ while ( ( val = static_cast<AliDCSValue*>(next()) ) )
+ {
+ if ( val->GetBool() )
+ {
+ ++nTrue;
+ }
+ else
+ {
+ ++nFalse;
+ }
+ }
+
+ if ( (nTrue>0 && nFalse>0) )
+ {
+ // change of state during the run, consider it off
+ return 0.0;
+ }
+
+ if ( nFalse )
+ {
+ /// switch = FALSE means the HV was flowding up to the PCB.
+ /// i.e. switch = FALSE = ON
+ return 1.0;
+ }
+
+ return 0.0;
+}
+
//_____________________________________________________________________________
Bool_t
AliMUONPadStatusMaker::HVSt345Status(Int_t detElemId, Int_t pcbIndex,
/// Returns false if something goes wrong (in particular if
/// hv switch changed during the run).
- AliCodeTimerAuto("")
+ AliCodeTimerAuto("",0)
+
+ if (!fHV) return kFALSE;
Bool_t error = kFALSE;
hvChannelTooLow = kFALSE;
}
else
{
- // we'll count the number of ON/OFF for this pad, to insure
- // consistency (i.e. if status changed during the run, we should
- // at least notify this fact ;-) and hope it's not the norm)
- Int_t nTrue(0);
- Int_t nFalse(0);
- TIter next(values);
- AliDCSValue* val;
-
- while ( ( val = static_cast<AliDCSValue*>(next()) ) )
- {
- if ( val->GetBool() )
- {
- ++nTrue;
- }
- else
- {
- ++nFalse;
- }
- }
-
- if ( (nTrue>0 && nFalse>0) )
- {
- AliWarning(Form("Status of HV Switch %s changed during this run nTrue=%d nFalse=%d! Will consider it OFF",
- hvSwitch.Data(),nTrue,nFalse));
- error = kTRUE;
- }
-
- if ( nFalse ) hvSwitchON = kFALSE;
+ Float_t sv = SwitchValue(*values);
+ if ( sv < 0.99 ) hvSwitchON = kFALSE;
}
}
return error;
{
/// Get HV status of one manu
- AliCodeTimerAuto("")
+ AliCodeTimerAuto("",0)
- if ( !fkCalibrationData.HV() ) return kMissing;
+ if ( !fHV ) return kMissing;
Long_t lint = fHV->GetValue(AliMpManuUID::BuildUniqueID(detElemId,manuId));
occ = fTrackerData->BusPatch(busPatchId,occIndex);
- if ( occ <= fBusPatchOccupancyLimits.X() )
+ if ( occ <= fBuspatchOccupancyLimits.X() )
{
rv |= kBusPatchOccupancyTooLow;
}
- else if ( occ > fBusPatchOccupancyLimits.Y() )
+ else if ( occ > fBuspatchOccupancyLimits.Y() )
{
rv |= kBusPatchOccupancyTooHigh;
}
if (!param)
{
// not already there, so compute it now
- AliCodeTimerAuto("ComputeStatus");
+ AliCodeTimerAuto("ComputeStatus",0);
param = ComputeStatus(detElemId,manuId);
}
return param;
/// Assign status to all manus in a given HV "zone" (defined by index, meaning
/// is different thing from St12 and St345)
- AliCodeTimerAuto("")
+ AliCodeTimerAuto("",0)
AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
fHV->Add(AliMpManuUID::BuildUniqueID(detElemId,manuId),status + 1);
}
}
+
+//_____________________________________________________________________________
+void
+AliMUONPadStatusMaker::SetLimits(const AliMUONRecoParam& recoParams)
+{
+ /// Set the limits from the recoparam
+
+ SetHVSt12Limits(recoParams.HVSt12LowLimit(),recoParams.HVSt12HighLimit());
+ SetHVSt345Limits(recoParams.HVSt345LowLimit(),recoParams.HVSt345HighLimit());
+
+ SetPedMeanLimits(recoParams.PedMeanLowLimit(),recoParams.PedMeanHighLimit());
+ SetPedSigmaLimits(recoParams.PedSigmaLowLimit(),recoParams.PedSigmaHighLimit());
+
+ SetGainA1Limits(recoParams.GainA1LowLimit(),recoParams.GainA1HighLimit());
+ SetGainA2Limits(recoParams.GainA2LowLimit(),recoParams.GainA2HighLimit());
+ SetGainThresLimits(recoParams.GainThresLowLimit(),recoParams.GainThresHighLimit());
+
+ SetManuOccupancyLimits(recoParams.ManuOccupancyLowLimit(),recoParams.ManuOccupancyHighLimit());
+ SetBuspatchOccupancyLimits(recoParams.BuspatchOccupancyLowLimit(),recoParams.BuspatchOccupancyHighLimit());
+ SetDEOccupancyLimits(recoParams.DEOccupancyLowLimit(),recoParams.DEOccupancyHighLimit());
+}
+
+//_____________________________________________________________________________
+void
+AliMUONPadStatusMaker::Report(UInt_t mask)
+{
+ /// Report the number of bad pads, according to the mask,
+ /// and the various reasons why they are bad (with occurence rates)
+
+ AliInfo("");
+ AliCodeTimerAuto("",0);
+
+ AliMUONLogger log(1064008);
+
+ Int_t nBadPads(0);
+ Int_t nPads(0);
+
+ AliMpManuIterator it;
+
+ Int_t detElemId, manuId;
+
+ while ( it.Next(detElemId,manuId) )
+ {
+ AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
+
+ for ( Int_t i = 0; i < AliMpConstants::ManuNofChannels(); ++i )
+ {
+ if ( de->IsConnectedChannel(manuId,i) )
+ {
+ ++nPads;
+
+ Int_t status = PadStatus(detElemId,manuId,i);
+
+ if ( mask && ( status & mask) ) // note that if mask == 0, all pads are good...
+ {
+ ++nBadPads;
+ log.Log(AsString(status));
+ }
+ }
+ }
+ }
+
+ TString msg;
+ Int_t ntimes;
+
+ cout << Form("According to mask %x (human readable form below) %6d pads are bad (over a total of %6d, i.e. %7.2f %%)",
+ mask,nBadPads,nPads,nPads ? nBadPads*100.0/nPads : 0.0) << endl;
+ cout << AliMUONPadStatusMaker::AsCondition(mask) << endl;
+ cout << "--------" << endl;
+
+ while ( log.Next(msg,ntimes) )
+ {
+ cout << Form("The message (%120s) occured %15d times (%7.4f %%)",msg.Data(),ntimes,ntimes*100.0/nPads) << endl;
+ }
+
+}
+