#include "AliCDBEntry.h"
#include "AliCDBManager.h"
#include "AliCodeTimer.h"
+#include "AliDCSValue.h"
#include "AliLog.h"
+#include "AliMpDCSNamer.h"
+#include "AliMUONConstants.h"
+#include "AliMUONGlobalCrateConfig.h"
+#include "AliMUONRegionalTriggerConfig.h"
#include "AliMUONRejectList.h"
#include "AliMUONTriggerEfficiencyCells.h"
#include "AliMUONTriggerLut.h"
+#include "AliMUONVCalibParam.h"
#include "AliMUONVStore.h"
#include "AliMUONVStore.h"
-#include "AliMUONVCalibParam.h"
-#include "AliMUONGlobalCrateConfig.h"
-#include "AliMUONRegionalTriggerConfig.h"
#include <Riostream.h>
#include <TClass.h>
}
+//______________________________________________________________________________
+void AliMUONCalibrationData::PatchHVValues(TObjArray& values,
+ Int_t& nbelowready,
+ Int_t& noff,
+ Int_t& ntrips,
+ Int_t& neor,
+ TString* msg)
+{
+ /// We do here a little bit of massaging of the HV values, if needed.
+ ///
+ /// The main point is to "gather" the values near the end of the run (the last XX seconds)
+ /// to avoid the ramp-down before end-of-run syndrom...
+ ///
+ /// The rest is more of a debug/expert tool to have closer look at trends
+ ///
+
+ Double_t HVBEAMTUNING(1300);
+
+ Bool_t eorProblem(kFALSE);
+
+ UInt_t mergeDelay(300); // in seconds
+
+ // First start by removing values within the last mergeDelay seconds, keeping only
+ // the last one
+
+ AliDCSValue* last = static_cast<AliDCSValue*>(values.At(values.GetLast()));
+
+ Int_t* toberemoved = new Int_t[values.GetLast()+1];
+
+ memset(toberemoved,0,(values.GetLast()+1)*sizeof(Int_t));
+
+ Int_t ntoberemoved(0);
+
+ for ( Int_t i = values.GetLast()-1; i > 0; --i )
+ {
+ AliDCSValue* val = static_cast<AliDCSValue*>(values.At(i));
+
+ if ( last->GetTimeStamp() - val->GetTimeStamp() < mergeDelay )
+ {
+ toberemoved[i]=1;
+ ++ntoberemoved;
+ }
+ }
+
+ if (ntoberemoved)
+ {
+ // ok, we have some values within the same mergeDelay seconds
+ // we'll "merge" them by taking the last one, except if
+ // the last one is below HVBEAMTUNING, in which case we
+ // remove that one too (meaning the ramp-down was requesting
+ // before the end-of-run)
+
+ if ( last->GetFloat() < HVBEAMTUNING )
+ {
+ eorProblem=kTRUE;
+ if (msg) *msg = "ERROR RAMP-DOWN BEFORE EOR";
+ toberemoved[values.GetLast()]=1;
+ }
+
+ for ( Int_t i = 0; i <= values.GetLast(); ++i )
+ {
+ if ( toberemoved[i] ) values.RemoveAt(i);
+ }
+
+ values.Compress();
+
+ }
+
+ delete[] toberemoved;
+
+ if (eorProblem)
+ {
+ ++neor;
+ return;
+ }
+
+ // now for the rest of the diagnosis
+
+ Int_t ntmpoff(0);
+ Int_t ntmpready(0);
+
+ for ( Int_t i = 0; i <= values.GetLast(); ++i )
+ {
+ AliDCSValue* val = static_cast<AliDCSValue*>(values.At(i));
+
+ if ( val->GetFloat() < AliMpDCSNamer::TrackerHVOFF() )
+ {
+ ++ntmpoff;
+ }
+ else if ( val->GetFloat() < HVBEAMTUNING )
+ {
+ ++ntmpready;
+ }
+ }
+
+ if ( ntmpoff )
+ {
+ if ( ntmpoff == values.GetLast()+1 )
+ {
+ if (msg) *msg = "ERROR HV OFF";
+ ++noff;
+ }
+ else
+ {
+ if (msg) *msg = "ERROR TRIP";
+ ++ntrips;
+ }
+ }
+
+ if ( ntmpready == values.GetLast()+1 )
+ {
+ if (msg) *msg = "ERROR BELOW READY";
+ }
+
+ if (ntmpready) ++nbelowready;
+}
//_____________________________________________________________________________
TMap*
-AliMUONCalibrationData::CreateHV(Int_t runNumber, Int_t* startOfValidity)
+AliMUONCalibrationData::CreateHV(Int_t runNumber, Int_t* startOfValidity, Bool_t patched)
{
/// Create a new HV map from the OCDB for a given run
- return dynamic_cast<TMap*>(CreateObject(runNumber,"MUON/Calib/HV",startOfValidity));
+ TMap* hvMap = dynamic_cast<TMap*>(CreateObject(runNumber,"MUON/Calib/HV",startOfValidity));
+ if (patched)
+ {
+ TIter next(hvMap);
+ TObjString* hvChannelName;
+
+ while ( ( hvChannelName = static_cast<TObjString*>(next()) ) )
+ {
+ TString name(hvChannelName->String());
+
+ if ( name.Contains("sw") ) continue; // skip switches
+
+ TPair* hvPair = static_cast<TPair*>(hvMap->FindObject(name.Data()));
+ TObjArray* values = static_cast<TObjArray*>(hvPair->Value());
+ if (!values)
+ {
+ AliErrorClass(Form("Could not get values for alias %s",name.Data()));
+ }
+ else
+ {
+ int nbelowready(0);
+ int noff(0);
+ int ntrips(0);
+ int neor(0);
+
+ PatchHVValues(*values,nbelowready,noff,ntrips,neor,0x0);
+ if (neor)
+ {
+ nbelowready=noff=ntrips=neor=0;
+ PatchHVValues(*values,nbelowready,noff,ntrips,neor,0x0);
+ if (neor)
+ {
+ AliErrorClass("neor is not null after PatchHVValue ! This is serious !");
+ }
+ }
+ }
+ }
+
+ }
+ return hvMap;
}
//_____________________________________________________________________________
//_____________________________________________________________________________
TMap*
-AliMUONCalibrationData::HV() const
+AliMUONCalibrationData::HV(Bool_t patched) const
{
/// Return the calibration for a given (detElemId, manuId) pair
if (!fHV)
{
- fHV = CreateHV(fRunNumber);
+ fHV = CreateHV(fRunNumber,0,patched);
}
return fHV;
}
static AliMUONGlobalCrateConfig* CreateGlobalTriggerCrateConfig(Int_t runNumber, Int_t* startOfValidity=0);
/// Create a hv map (which must be deleted) from OCDB for the given run
- static TMap* CreateHV(Int_t runNumber, Int_t* startOfValidity=0);
+ static TMap* CreateHV(Int_t runNumber, Int_t* startOfValidity=0, Bool_t patched=kTRUE);
/// Create a Trigger HV and current map (which must be deleted) from OCDB for the given run
static TMap* CreateTriggerDCS(Int_t runNumber, Int_t* startOfValidity=0);
/// Get the Gain calibration object for channels within (detElemId,manuId).
AliMUONVCalibParam* Gains(Int_t detElemId, Int_t manuId) const;
- /// Get the HV values
- TMap* HV() const;
+ /// Get the HV values. Use patched=kFALSE to get unprocessed (i.e. "raw") values as they are in the OCDB
+ TMap* HV(Bool_t patched=kTRUE) const;
/// Get the Trigger HV and current values
TMap* TriggerDCS() const;
static void BypassStores(AliMUONVStore* ped, AliMUONVStore* gain);
+ static void PatchHVValues(TObjArray& values,
+ Int_t& nbelowready,
+ Int_t& noff,
+ Int_t& ntrips,
+ Int_t& neor,
+ TString* msg);
+
protected:
/// Not implemented
AliMUONCalibrationData(const AliMUONCalibrationData& other);
fGainA1Limits(0,1E30),
fGainA2Limits(-1E-30,1E30),
fGainThresLimits(0,4095),
-fHVSt12Limits(0,5000),
-fHVSt345Limits(0,5000),
fPedMeanLimits(0,4095),
fPedSigmaLimits(0,4095),
fManuOccupancyLimits(0,1.0),
/// Only create the fHV internal store if there are some HV values available
fHV = new TExMap;
}
+
+ SetHVLimit(-1,0.0);
}
//_____________________________________________________________________________
hvChannelTooHigh = kFALSE;
hvChannelON = kTRUE;
+ Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
+
AliMpDCSNamer hvNamer("TRACKER");
TString hvChannel(hvNamer.DCSChannelName(detElemId,sector));
}
else
{
- // find out min and max value, and makes a cut
+ // find out min value, and makes a cut
Float_t hvMin(1E9);
- Float_t hvMax(0);
TIter next(values);
AliDCSValue* val;
{
Float_t hv = val->GetFloat();
hvMin = TMath::Min(hv,hvMin);
- hvMax = TMath::Max(hv,hvMax);
}
- float lowThreshold = fHVSt12Limits.X();
- float highThreshold = fHVSt12Limits.Y();
+ float lowThreshold = fHVLimit[chamberId];
if ( hvMin < lowThreshold ) hvChannelTooLow = kTRUE;
- if ( hvMax > highThreshold ) hvChannelTooHigh = kTRUE;
- if ( hvMin < 1 ) hvChannelON = kFALSE;
+ if ( hvMin < hvNamer.TrackerHVOFF() ) hvChannelON = kFALSE;
}
}
AliMpDCSNamer hvNamer("TRACKER");
+ Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
+
TString hvChannel(hvNamer.DCSChannelName(detElemId));
TMap* hvMap = fkCalibrationData.HV();
}
else
{
- // find out min and max value, and makes a cut
+ // find out min value, and makes a cut
Float_t hvMin(1E9);
- Float_t hvMax(0);
TIter next(values);
AliDCSValue* val;
{
Float_t hv = val->GetFloat();
hvMin = TMath::Min(hv,hvMin);
- hvMax = TMath::Max(hv,hvMax);
}
- float lowThreshold = fHVSt345Limits.X();
- float highThreshold = fHVSt345Limits.Y();
+ float lowThreshold = fHVLimit[chamberId];
if ( hvMin < lowThreshold ) hvChannelTooLow = kTRUE;
- else if ( hvMax > highThreshold ) hvChannelTooHigh = kTRUE;
- if ( hvMin < 1 ) hvChannelON = kFALSE;
+ if ( hvMin < hvNamer.TrackerHVOFF() ) hvChannelON = kFALSE;
}
}
}
}
+//_____________________________________________________________________________
+void
+AliMUONPadStatusMaker::SetHVLimit(Int_t chamberId, Double_t hv)
+{
+ /// Set hv limit for a given chamber (or all if chamberId==-1)
+
+ if ( chamberId == -1 )
+ {
+ for ( Int_t i = 0; i < 10; ++i )
+ {
+ fHVLimit[i] = hv;
+ }
+ }
+ else if ( chamberId >= 0 && chamberId < 10 )
+ {
+ fHVLimit[chamberId]=hv;
+ }
+ else
+ {
+ AliError(Form("chamberId=%d is invalid",chamberId));
+ }
+}
+
//_____________________________________________________________________________
void
AliMUONPadStatusMaker::SetLimits(const AliMUONRecoParam& recoParams)
{
/// Set the limits from the recoparam
- SetHVSt12Limits(recoParams.HVSt12LowLimit(),recoParams.HVSt12HighLimit());
- SetHVSt345Limits(recoParams.HVSt345LowLimit(),recoParams.HVSt345HighLimit());
+ for ( int i = 0; i < 10; ++i )
+ {
+ SetHVLimit(i,recoParams.HVLimit(i));
+ }
SetPedMeanLimits(recoParams.PedMeanLowLimit(),recoParams.PedMeanHighLimit());
SetPedSigmaLimits(recoParams.PedSigmaLowLimit(),recoParams.PedSigmaHighLimit());
/// Return Low and High limits for thres parameter of gain
TVector2 GainThresLimits() const { return fGainThresLimits; }
- /// Return Low and High threshold for St12 HV
- TVector2 HVSt12Limits() const { return fHVSt12Limits; }
- /// Return Low and High threshold for St345 HV
- TVector2 HVSt345Limits() const { return fHVSt345Limits; }
+ /// Return HV threshold
+ Double_t HVLimit(Int_t chamberId) const;
/// Return Low and High threshold for pedestal mean
TVector2 PedMeanLimits() const { return fPedMeanLimits; }
/// Set Low and High limits for thres parameter of gain
void GainThresLimits(float low, float high) { fGainThresLimits.Set(low,high); }
- /// Set Low and High threshold for St12 HV
- void SetHVSt12Limits(float low, float high) { fHVSt12Limits.Set(low,high); }
- /// Set Low and High threshold for St345 HV
- void SetHVSt345Limits(float low, float high) { fHVSt345Limits.Set(low,high); }
+ /// Set HV limit
+ void SetHVLimit(Int_t chamberId, Double_t hv);
/// Set Low and High threshold for pedestal mean
void SetPedMeanLimits(float low, float high) { fPedMeanLimits.Set(low,high); }
kHVOK = 0,
kHVError = (1<<0),
kHVTooLow = (1<<1),
- kHVTooHigh = (1<<2),
+ kHVTooHigh = (1<<2), // no longer to be used
kHVChannelOFF = (1<<3),
kHVSwitchOFF = (1<<4),
TVector2 fGainA2Limits; //!< Low and High threshold for gain a1 parameter
TVector2 fGainThresLimits; //!< Low and High threshold for gain threshold parameter
- TVector2 fHVSt12Limits; //!< Low and High threshold for St12 HV
- TVector2 fHVSt345Limits; //!< Low and High threshold for St345 HV
+ Double_t fHVLimit[10]; //!< Low thresholds for HV
TVector2 fPedMeanLimits; //!< Low and High threshold for pedestal mean
TVector2 fPedSigmaLimits; //!< Low and High threshold for pedestal sigma
cout << "The pad limits we are using are :" << endl;
- cout << Form("%5.0f <= HVSt12 <= %5.0f Volts",HVSt12LowLimit(),HVSt12HighLimit()) << endl;
- cout << Form("%5.0f <= HVSt345 <= %5.0f Volts",HVSt345LowLimit(),HVSt345HighLimit()) << endl;
+ for ( int ichamber = 0; ichamber < 10; ++ichamber )
+ {
+ cout << Form("HV Ch %d must be >= %5.2f",ichamber,HVLimit(ichamber)) << endl;
+ }
+
cout << Form("%7.2f <= Pedestal mean <= %7.2f",PedMeanLowLimit(),PedMeanHighLimit()) << endl;
cout << Form("%7.2f <= Pedestal sigma <= %7.2f",PedSigmaLowLimit(),PedSigmaHighLimit()) << endl;
cout << Form("%e <= Gain linear term <= %e",GainA1LowLimit(),GainA1HighLimit()) << endl;
//_____________________________________________________________________________
void
-AliMUONRecoParam::SetDefaultLimits()
+AliMUONRecoParam::SetHVLimit(Int_t chamberId, Double_t value)
{
- /// Set the default limits and pad goodness policy
+ /// Set the HV limit for a given chamber (or all chambers
+ /// if chamberId==-1
+
+ if ( chamberId == -1 )
+ {
+ for ( Int_t i = 0; i < 10; ++i )
+ {
+ fHVLimit[i] = value;
+ }
+ }
+ else if ( chamberId >= 0 && chamberId < 10 )
+ {
+ fHVLimit[chamberId]=value;
+ }
+ else
+ {
+ AliError(Form("chamberId = %d is not a valid chamberId",chamberId));
+ }
+}
- fHVSt12Limits[0]=1500;
- fHVSt12Limits[1]=2000;
+//_____________________________________________________________________________
+Double_t AliMUONRecoParam::HVLimit(Int_t chamberId) const
+{
+ /// Get the HV limit for a given chamber
+ if ( chamberId >= 0 && chamberId < 10 )
+ {
+ return fHVLimit[chamberId];
+ }
+ AliError(Form("chamberId = %d is not a valid chamberId",chamberId));
- fHVSt345Limits[0]=1500;
- fHVSt345Limits[1]=2000;
+ return 0.0;
+}
+//_____________________________________________________________________________
+void
+AliMUONRecoParam::SetDefaultLimits()
+{
+ /// Set the default limits and pad goodness policy
+
+ fHVSt12Limits[0]=1500; // kept for backward compatibility only
+ fHVSt12Limits[1]=2000; // kept for backward compatibility only
+ fHVSt345Limits[0]=1500; // kept for backward compatibility only
+ fHVSt345Limits[1]=2000; // kept for backward compatibility only
+
+ SetHVLimit(-1,1600); // this one is the real HV limit used now
+
fPedMeanLimits[0] = 20;
fPedMeanLimits[1] = 1024;
fDEOccupancyLimits[1] = 1.0;
fMissingPadFractionLimit = -1; // DEPRECATED
- fFractionOfBuspatchOutsideOccupancyLimit = 0.10; // 10 %
+ fFractionOfBuspatchOutsideOccupancyLimit = 0.05; // 5 %
ChargeSigmaCut(4.0); // pad with charge < 4.0 x sigma will be removed (where sigma is the actual noise of that very pad, i.e. not the average)
param->SetManuOccupancyLimits(-1.,0.01);
param->SetBuspatchOccupancyLimits(-1.,0.01);
param->SetFractionOfBuspatchOutsideOccupancyLimit(0.05); // 5 %
+ param->SetEventSizeLimits(45., 65.);
// specific parameters for p-p data or realistic p-p simu
if ( stype == "ppreal" || stype == "pprealnofield" )
{
- param->SetPadGoodnessMask(0x400BE80);
+ param->SetPadGoodnessMask(0x400BE9B);
}
else
{
param->TryRecover(kTRUE);
}
}
+ else if ( stype == "pbpbreal" || stype == "pbpbrealsim" )
+ {
+ // common parameters for Pb-Pb data and realistic Pb-Pb simu
+ param = AliMUONRecoParam::GetHighFluxParam();
+ defaultParam = AliRecoParam::kHighMult;
+ param->SaveFullClusterInESD(kTRUE, 100.);
+ for (Int_t iCh=0; iCh<10; iCh++)
+ {
+ param->SetDefaultNonBendingReso(iCh,0.2);
+ param->SetDefaultBendingReso(iCh,0.2);
+ }
+ param->SetSigmaCutForTracking(5.);
+ param->SetStripCutForTrigger(1.5);
+ param->SetSigmaCutForTrigger(4.);
+ param->ImproveTracks(kTRUE, 4.);
+ param->SetPedMeanLimits(20, 700);
+ param->SetManuOccupancyLimits(-1.,0.01);
+ param->SetBuspatchOccupancyLimits(-1.,0.01);
+ param->SetFractionOfBuspatchOutsideOccupancyLimit(0.05); // 5 %
+ param->SetEventSizeLimits(100., 150.);
+
+ // specific parameters for Pb-Pb data or realistic Pb-Pb simu
+ if ( stype == "pbpbreal" )
+ {
+ param->SetPadGoodnessMask(0x400BE9B);
+ }
+ else
+ {
+ param->SetPadGoodnessMask(0x8080);
+ }
+ }
else
{
AliErrorClass("Unknown settings !");
/// return kTRUE if we should replace clusters in St 5 by generated clusters from trigger tracks
Bool_t BypassSt5() const { return BypassSt45() || fBypassSt45==5 ; }
- /// Set Low and High threshold for St12 HV
- void SetHVSt12Limits(float low, float high) { fHVSt12Limits[0]=low; fHVSt12Limits[1]=high; }
- /// Retrieve low limit for St12's HV
- Float_t HVSt12LowLimit() const { return fHVSt12Limits[0]; }
- /// Retrieve high limit for St12's HV
- Float_t HVSt12HighLimit() const { return fHVSt12Limits[1]; }
-
- /// Set Low and High threshold for St345 HV
- void SetHVSt345Limits(float low, float high) { fHVSt345Limits[0]=low; fHVSt345Limits[1]=high; }
- /// Retrieve low limit for St345's HV
- Float_t HVSt345LowLimit() const { return fHVSt345Limits[0]; }
- /// Retrieve high limit for St345's HV
- Float_t HVSt345HighLimit() const { return fHVSt345Limits[1]; }
+ /// Set HV threshold for chambers (chamberId=0..9, use -1 to set all chambers equal)
+ void SetHVLimit(Int_t chamberId, Double_t ichamber);
+ /// Retrieve HV limit for chamber (chamberId=0..9)
+ Double_t HVLimit(Int_t chamberId) const;
/// Set Low and High threshold for pedestal mean
void SetPedMeanLimits(float low, float high) { fPedMeanLimits[0]=low; fPedMeanLimits[1]=high; }
Double32_t fGainA1Limits[2]; ///< Low and High threshold for gain a0 parameter
Double32_t fGainA2Limits[2]; ///< Low and High threshold for gain a1 parameter
Double32_t fGainThresLimits[2]; ///< Low and High threshold for gain threshold parameter
- Double32_t fHVSt12Limits[2]; ///< Low and High threshold for St12 HV
- Double32_t fHVSt345Limits[2]; ///< Low and High threshold for St345 HV
+ Double32_t fHVSt12Limits[2]; ///< DEPRECATED. See fHVLimits
+ Double32_t fHVSt345Limits[2]; ///< DEPRECATED. See fHVLimits
Double32_t fPedMeanLimits[2]; ///< Low and High threshold for pedestal mean
Double32_t fPedSigmaLimits[2]; ///< Low and High threshold for pedestal sigma
Double32_t fTokenLostLimit; ///< limit on the fraction of token lost error per event we allow
Bool_t fTryRecover; ///< try to recover corrupted raw data
+
+ Double32_t fHVLimit[10]; // HV limit (below which we consider that chamber efficiency is to be considered zero)
// functions
void SetLowFluxParam();
void SetCosmicParam();
void SetCalibrationParam();
- ClassDef(AliMUONRecoParam,168) // MUON reco parameters
+ ClassDef(AliMUONRecoParam,169) // MUON reco parameters
// we're at 167 not because we had that many versions, but because at some point (version 15->16)
// 166 was committed by error, and we did not to go reverse afterwards...
};
TObjArray* CompactAliases() const;
void AliasesAsLdif(const char* ldiffile) const;
+ // Below this value we consider tracking HV is off
+ static Float_t TrackerHVOFF() { return 30.0; }
+
enum
{
kDCSHV, ///< High Voltage