50 #include "AliCDBEntry.h"
51 #include "AliCDBManager.h"
52 #include "AliCodeTimer.h"
53 #include "AliDCSValue.h"
56 #include <Riostream.h>
75 fGainA1Limits(0,1E30),
76 fGainA2Limits(-1E-30,1E30),
77 fGainThresLimits(0,4095),
78 fPedMeanLimits(0,4095),
79 fPedSigmaLimits(0,4095),
80 fManuOccupancyLimits(0,1.0),
81 fBuspatchOccupancyLimits(0,1.0),
82 fDEOccupancyLimits(0,1.0),
85 fPedestals(calibData.Pedestals()),
86 fGains(calibData.Gains()),
90 if ( calibData.OccupancyMap() )
122 return "Brave New World";
130 DecodeStatus(status,pedStatus,hvStatus,gainStatus,occStatus);
134 if ( pedStatus &
kPedMeanZero ) s +=
"& Ped Mean is Zero ";
139 if ( pedStatus &
kPedMissing ) s +=
"& Ped is missing ";
141 if ( gainStatus &
kGainA1TooLow ) s+=
"& Gain A1 is Too Low ";
143 if ( gainStatus &
kGainA2TooLow ) s+=
"& Gain A2 is Too Low ";
147 if ( gainStatus &
kGainMissing ) s+=
"& Gain is missing ";
149 if ( hvStatus &
kHVError ) s+=
"& HV is on error ";
150 if ( hvStatus &
kHVTooLow ) s+=
"& HV is Too Low ";
151 if ( hvStatus &
kHVTooHigh ) s+=
"& HV is Too High ";
153 if ( hvStatus &
kHVSwitchOFF ) s+=
"& HV has switch OFF ";
154 if ( hvStatus &
kHVMissing ) s+=
"& HV is missing ";
163 if ( s[0] ==
'&' ) s[0] =
' ';
176 s.ReplaceAll(
"&",
"|");
190 return ( hvStatus & 0xFF ) | ( ( pedStatus & 0xFF ) << 8 ) |
191 ( ( gainStatus & 0xFF ) << 16 ) |
192 ( ( occStatus & 0xFF ) << 24 ) ;
205 occStatus = ( status & 0xFF000000 ) >> 24;
206 gainStatus = ( status & 0xFF0000 ) >> 16;
207 pedStatus = ( status & 0xFF00 ) >> 8;
208 hvStatus = (status & 0xFF);
214 Bool_t& hvChannelTooLow,
215 Bool_t& hvChannelTooHigh,
216 Bool_t& hvChannelON)
const
224 AliCodeTimerAuto(
"",0)
226 if (!
fHV)
return kFALSE;
228 Bool_t error = kFALSE;
229 hvChannelTooLow = kFALSE;
230 hvChannelTooHigh = kFALSE;
237 TString hvChannel(hvNamer.
DCSAliasName(detElemId,sector));
240 TPair* hvPair =
static_cast<TPair*
>(hvMap->FindObject(hvChannel.Data()));
243 AliError(Form(
"Did not find expected alias (%s) for DE %d",
244 hvChannel.Data(),detElemId));
252 AliError(Form(
"Could not get values for alias %s",hvChannel.Data()));
262 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
264 Float_t hv = val->GetFloat();
265 hvMin = TMath::Min(hv,hvMin);
268 float lowThreshold =
HVLimit(chamberId);
270 if ( hvMin < lowThreshold ) hvChannelTooLow = kTRUE;
271 if ( hvMin < hvNamer.
TrackerHVOFF() ) hvChannelON = kFALSE;
290 TIter next(&dcsArray);
293 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
295 if ( val->GetBool() )
305 if ( (nTrue>0 && nFalse>0) )
324 Bool_t& hvChannelTooLow,
325 Bool_t& hvChannelTooHigh,
327 Bool_t& hvSwitchON)
const
334 AliCodeTimerAuto(
"",0)
336 if (!
fHV)
return kFALSE;
338 Bool_t error = kFALSE;
339 hvChannelTooLow = kFALSE;
340 hvChannelTooHigh = kFALSE;
352 TPair* hvPair =
static_cast<TPair*
>(hvMap->FindObject(hvChannel.Data()));
355 AliError(Form(
"Did not find expected alias (%s) for DE %d",
356 hvChannel.Data(),detElemId));
364 AliError(Form(
"Could not get values for alias %s",hvChannel.Data()));
374 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
376 Float_t hv = val->GetFloat();
377 hvMin = TMath::Min(hv,hvMin);
380 float lowThreshold =
HVLimit(chamberId);
382 if ( hvMin < lowThreshold ) hvChannelTooLow = kTRUE;
383 if ( hvMin < hvNamer.
TrackerHVOFF() ) hvChannelON = kFALSE;
388 TPair* switchPair =
static_cast<TPair*
>(hvMap->FindObject(hvSwitch.Data()));
391 AliError(Form(
"Did not find expected alias (%s) for DE %d PCB %d",
392 hvSwitch.Data(),detElemId,pcbIndex));
400 AliError(Form(
"Could not get values for alias %s",hvSwitch.Data()));
406 if ( sv < 0.99 ) hvSwitchON = kFALSE;
418 AliCodeTimerAuto(
"",0)
426 return (Int_t)(lint - 1);
440 Bool_t hvChannelTooLow, hvChannelTooHigh, hvChannelON;
446 if ( hvChannelTooLow ) status |=
kHVTooLow;
459 Bool_t hvChannelTooLow, hvChannelTooHigh, hvChannelON,hvSwitchON;
461 hvChannelTooLow,hvChannelTooHigh,
462 hvChannelON,hvSwitchON);
464 if ( hvChannelTooLow ) status |=
kHVTooLow;
511 Int_t hvStatus =
HVStatus(detElemId,manuId);
515 for ( Int_t manuChannel = 0; manuChannel < param->
Size(); ++manuChannel )
554 Int_t status =
BuildStatus(pedStatus,hvStatus,gainStatus,occStatus);
572 const Int_t occIndex = 2;
622 AliCodeTimerAuto(
"ComputeStatus",0);
650 AliCodeTimerAuto(
"",0)
656 for ( Int_t i = 0; i < manus->
GetSize(); ++ i )
668 if ( chamberId >=0 && chamberId < 10 )
681 if ( chamberId == -1 )
683 for ( Int_t i = 0; i < 10; ++i )
688 else if ( chamberId >= 0 && chamberId < 10 )
694 AliError(Form(
"chamberId=%d is invalid",chamberId));
704 for (
int i = 0; i < 10; ++i )
729 AliCodeTimerAuto(
"",0);
738 Int_t detElemId, manuId;
740 while ( it.
Next(detElemId,manuId) )
750 Int_t status =
PadStatus(detElemId,manuId,i);
752 if ( mask && ( status & mask) )
763 AliError(
"Got no pad from the iterator ?! That's not normal. Please check !");
770 cout << Form(
"According to mask %x (human readable form below) %6d pads are bad (over a total of %6d, i.e. %7.2f %%)",
771 mask,nBadPads,nPads,nBadPads*100.0/nPads) << endl;
773 cout <<
"--------" << endl;
775 while ( log.
Next(msg,ntimes) )
777 cout << Form(
"The message (%120s) occured %15d times (%7.4f %%)",msg.Data(),ntimes,ntimes*100.0/nPads) << endl;
AliMUONVCalibParam * Neighbours(Int_t detElemId, Int_t manuId) const
Float_t ManuOccupancyHighLimit() const
Retrieve high value of manu occupancy limit.
virtual Double_t DetectionElement(Int_t detElemId, Int_t dim=0) const =0
Get the value for a given DE and given dimension.
AliMUONVStore * fPedestals
! pedestal values
Implementation of AliMUONVTrackerData.
void SetDEOccupancyLimits(float low, float high)
Set Low and High DE occupancy limits.
void SetGainThresLimits(float low, float high)
Set Low and High threshold for gain threshold term.
static UInt_t BuildUniqueID(Int_t detElemId, Int_t manuId)
Int_t ManuId2PCBIndex(Int_t detElemId, Int_t manuId) const
Returns the index of PCB (within a St345 slat) for a given manu number.
const AliMUONCalibrationData & fkCalibrationData
! helper class to get data access (not owner)
TVector2 fManuOccupancyLimits
! Low and High manu occupancy limits
static Float_t SwitchValue(const TObjArray &dcsArray)
static TString AsString(Int_t status)
TMap * HV(Bool_t patched=kTRUE) const
Get the HV values. Use patched=kFALSE to get unprocessed (i.e. "raw") values as they are in the OCDB...
static Int_t BuildStatus(Int_t pedStatus, Int_t hvStatus, Int_t gainStatus, Int_t otherStatus)
static void DecodeStatus(Int_t status, Int_t &pedStatus, Int_t &hvStatus, Int_t &gainStatus, Int_t &otherStatus)
Bool_t HVSt345Status(Int_t detElemId, Int_t pcbIndex, Bool_t &hvChannelTooLow, Bool_t &hvChannelTooHigh, Bool_t &hvChannelON, Bool_t &hvSwitchON) const
AliMUONVStore * Neighbours() const
Get the neighbours store.
virtual Int_t Size() const =0
The number of channels handled by this object.
static Float_t TrackerHVOFF()
void SetBuspatchOccupancyLimits(float low, float high)
Set Low and High bus patch occupancy limits.
virtual Float_t ValueAsFloatFast(Int_t i, Int_t j=0) const =0
Same as above but without bound checking.
Int_t ManuId2Sector(Int_t detElemId, Int_t manuId) const
Return the HV-sector number (within a St12 quadrant) for a given manu number.
Double_t fHVLimit[10]
! Low thresholds for HV
Float_t PedMeanHighLimit() const
Retrieve high limit of ped mean.
Int_t Log(const char *message)
Float_t BuspatchOccupancyLowLimit() const
Retrieve low value of bp occupancy limit.
Float_t GainThresLowLimit() const
Retrieve low limit on threshold gain parameter.
Collection of methods usefull to DCS handling for MUON TRK and TRG.
void SetHVLimit(Int_t chamberId, Double_t hv)
Set HV limit.
TVector2 fDEOccupancyLimits
! Low and High DE occupancy limits
Class with MUON reconstruction parameters.
AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true) const
Float_t GainA2LowLimit() const
Retrieve low limit of a2 (quadratic term) gain parameter.
The class defines the electronics properties of detection element.
Bool_t Next(TString &msg, Int_t &occurance)
Bool_t Next(Int_t &detElemId, Int_t &manuId)
Class to loop over all manus of MUON Tracker.
void SetManuOccupancyLimits(float low, float high)
Set Low and High manu occupancy limits.
A logger that keeps track of the number of times a message appeared.
Container of calibration values for a given number of channels.
static AliMpDDLStore * Instance(Bool_t warn=true)
static Int_t GetChamberId(Int_t detElemId, Bool_t warn=true)
static Int_t ManuNofChannels()
Max number of channels per manu.
AliMUONVCalibParam * PadStatus(Int_t detElemId, Int_t manuId) const
virtual Double_t Manu(Int_t detElemId, Int_t manuId, Int_t dim=0) const =0
Get the value for a given manu and given dimension.
Int_t GetBusPatchId(Int_t detElemId, Int_t manuId) const
TVector2 fBuspatchOccupancyLimits
! Low and High buspatch occupancy limits
Implementation of AliMUONVCalibParam for tuples of ints.
void SetGainA2Limits(float low, float high)
Set Low and High threshold for gain a1 term.
Double_t HVLimit(Int_t chamberId) const
Return HV threshold.
void SetHVStatus(Int_t detElemId, Int_t index, Int_t status) const
Double_t HVLimit(Int_t chamberId) const
Retrieve HV limit for chamber (chamberId=0..9)
Float_t PedSigmaLowLimit() const
Retrieve low limit of ped sigma.
static AliMp::StationType GetStationType(Int_t detElemId)
static TString AsCondition(Int_t status)
TVector2 fGainA2Limits
! Low and High threshold for gain a1 parameter
Bool_t HVSt12Status(Int_t detElemId, Int_t sector, Bool_t &hvChannelTooLow, Bool_t &hvChannelTooHigh, Bool_t &hvChannelON) const
Float_t GainA1HighLimit() const
Retrieve high limit of a1 (linear term) gain parameter.
Helper class for sorted integer array.
AliMUONVStore * fGains
! gain values
Float_t DEOccupancyLowLimit() const
Retrieve low value of DE occupancy limit.
virtual Int_t ValueAsInt(Int_t i, Int_t j=0) const =0
Basic implementation of AliMUONVStore container using AliMpExMap internally.
Int_t OccupancyStatus(Int_t detElemId, Int_t manuId) const
AliMUONCalibrationData * calibData
virtual Bool_t Add(TObject *object)=0
Add an object to the store.
TVector2 fPedMeanLimits
! Low and High threshold for pedestal mean
Single entry point to access MUON calibration data.
Float_t PedMeanLowLimit() const
Retrieve low limit of ped mean.
AliMUONVStore * fStatus
! statuses of the pads
virtual Double_t BusPatch(Int_t busPatchId, Int_t dim=0) const =0
Get the value for a given buspatch and given dimension.
TExMap * fHV
! cache of hv statuses
virtual void SetValueAsIntFast(Int_t i, Int_t j, Int_t value)=0
Same as above but w/o bound checkings.
TVector2 fGainThresLimits
! Low and High threshold for gain threshold parameter
AliMUONVTrackerData * fTrackerData
! to get occupancies...
Float_t GainA2HighLimit() const
Retrieve high limit of a2 (quadratic term) gain parameter.
TString DCSSwitchAliasName(Int_t detElemId, Int_t pcbNumber) const
Float_t GainA1LowLimit() const
Retrieve low limit of a1 (linear term) gain parameter.
Int_t HVStatus(Int_t detElemId, Int_t manuId) const
const AliMpArrayI * ManusForHV(Int_t hvIndex) const
void SetPedSigmaLimits(float low, float high)
Set Low and High threshold for pedestal sigma.
AliMUONVCalibParam * ComputeStatus(Int_t detElemId, Int_t manuId) const
Int_t GetValue(Int_t index) const
Bool_t IsConnectedChannel(Int_t manuId, Int_t manuChannel) const
Float_t ManuOccupancyLowLimit() const
Retrieve low value of manu occupancy limit.
void SetPedMeanLimits(float low, float high)
Set Low and High threshold for pedestal mean.
Base class for MUON data stores.
TString DCSAliasName(Int_t detElemId, Int_t sector=0, Int_t dcsMeasure=0) const
Float_t GainThresHighLimit() const
Retrieve high limit on threshold gain parameter.
TVector2 fGainA1Limits
! Low and High threshold for gain a0 parameter
Float_t PedSigmaHighLimit() const
Retrieve high limit of ped sigma.
virtual ~AliMUONPadStatusMaker()
AliMUONVStore * NeighboursStore() const
Float_t DEOccupancyHighLimit() const
Retrieve high value of DE occupancy limit.
void SetGainA1Limits(float low, float high)
Set Low and High threshold for gain a0 term.
TVector2 fPedSigmaLimits
! Low and High threshold for pedestal sigma
Make a 2DStore of pad statuses, using different sources of information.
Float_t BuspatchOccupancyHighLimit() const
Retrieve high value of bp occupancy limit.
virtual TObject * FindObject(const char *name) const
Find an object by name.
void SetLimits(const AliMUONRecoParam &recoParams)