#include "AliMUONV2DStore.h"
#include "AliMUONVCalibParam.h"
#include "Riostream.h"
+#include "TMap.h"
+/// \class AliMUONCalibrationData
+///
+/// For the moment, this class stores pedestals, gains, hv (for tracker)
+/// and lut, masks and efficiencies (for trigger) that are fetched from the CDB.
///
/// This class is to be considered as a convenience class.
/// Its aim is to ease retrieval of calibration data from the
/// It acts as a "facade" to a bunch of underlying
/// containers/calibration classes.
///
+/// \author Laurent Aphecetche
+/// \cond CLASSIMP
ClassImp(AliMUONCalibrationData)
+/// \endcond
//_____________________________________________________________________________
AliMUONCalibrationData::AliMUONCalibrationData(Int_t runNumber,
fRunNumber(runNumber),
fGains(0x0),
fPedestals(0x0),
-fDeadChannels(0x0),
+fHV(0x0),
fLocalTriggerBoardMasks(0x0),
fRegionalTriggerBoardMasks(0x0),
fGlobalTriggerBoardMasks(0x0),
fTriggerLut(0x0),
-fTriggerEfficiency(0x0)
+fTriggerEfficiency(0x0),
+fCapacitances(0x0),
+fNeighbours(0x0)
{
- //
- // Default ctor.
+/// Default ctor.
+
// If deferredInitialization is false, we read *all* calibrations
// at once.
// So when using this class to access only one kind of calibrations (e.g.
// only pedestals), you should put deferredInitialization to kTRUE, which
// will instruct this object to fetch the data only when neeeded.
- //
+
if ( deferredInitialization == kFALSE )
{
OnDemandGains();
OnDemandPedestals();
- OnDemandDeadChannels();
+ OnDemandHV();
OnDemandLocalTriggerBoardMasks();
OnDemandRegionalTriggerBoardMasks();
OnDemandGlobalTriggerBoardMasks();
OnDemandTriggerLut();
OnDemandTriggerEfficiency();
+ OnDemandCapacitances();
+ OnDemandNeighbours();
}
}
//_____________________________________________________________________________
-AliMUONCalibrationData::AliMUONCalibrationData(const AliMUONCalibrationData&)
-: TObject()
+AliMUONCalibrationData::~AliMUONCalibrationData()
{
- AliFatal("Implement me if needed");
+ /// Destructor. Note that we're the owner of our pointers.
+ Reset();
}
-
//_____________________________________________________________________________
-AliMUONCalibrationData&
-AliMUONCalibrationData::operator=(const AliMUONCalibrationData&)
+TMap*
+AliMUONCalibrationData::HV() const
{
- AliFatal("Implement me if needed");
- return *this;
-}
+/// Return the calibration for a given (detElemId, manuId) pair
-//_____________________________________________________________________________
-AliMUONCalibrationData::~AliMUONCalibrationData()
-{
- //
- // dtor. Note that we're the owner of our pointers.
- //
- delete fPedestals;
- delete fGains;
- delete fDeadChannels;
- delete fLocalTriggerBoardMasks;
- delete fRegionalTriggerBoardMasks;
- delete fGlobalTriggerBoardMasks;
- delete fTriggerLut;
- delete fTriggerEfficiency;
+ return OnDemandHV();
}
//_____________________________________________________________________________
-AliMUONVCalibParam*
-AliMUONCalibrationData::DeadChannels(Int_t detElemId, Int_t manuId) const
+TMap*
+AliMUONCalibrationData::OnDemandHV() const
{
- //
- // Return the calibration for a given (detElemId, manuId) pair
- // Note that for DeadChannel, it's "legal" to return 0x0 (e.g. if a manu
- // is perfect, we might simply forget it in the store).
- //
- return
- static_cast<AliMUONVCalibParam*>(OnDemandDeadChannels()->Get(detElemId,manuId));
-}
+/// Create (if needed) and return the internal store for DeadChannels.
-//_____________________________________________________________________________
-AliMUONV2DStore*
-AliMUONCalibrationData::OnDemandDeadChannels() const
-{
- //
- // Create (if needed) and return the internal store for DeadChannels.
- //
- if (!fDeadChannels)
+ if (!fHV)
{
- AliCDBEntry* entry = GetEntry("MUON/Calib/DeadChannels");
+ AliCDBEntry* entry = GetEntry("MUON/Calib/HV");
if (entry)
{
- fDeadChannels = dynamic_cast<AliMUONV2DStore*>(entry->GetObject());
- if (!fDeadChannels)
+ fHV = dynamic_cast<TMap*>(entry->GetObject());
+ if (!fHV)
{
- AliError("fDeadChannels not of the expected type !!!");
+ AliError("fHV not of the expected type !!!");
}
}
else
{
- AliError("Could not get dead channels !");
+ AliError("Could not get HV values !");
}
}
- return fDeadChannels;
+ return fHV;
}
//_____________________________________________________________________________
AliCDBEntry*
AliMUONCalibrationData::GetEntry(const char* path) const
{
- //
- // Access the CDB for a given path (e.g. MUON/Calib/Pedestals),
- // and return the corresponding CDBEntry.
- //
+/// Access the CDB for a given path (e.g. MUON/Calib/Pedestals),
+/// and return the corresponding CDBEntry.
+
return AliCDBManager::Instance()->Get(path,fRunNumber);
}
AliMUONVCalibParam*
AliMUONCalibrationData::Gains(Int_t detElemId, Int_t manuId) const
{
- //
- // Return the gains for a given (detElemId, manuId) pair
- // Note that, unlike the DeadChannel case, if the result is 0x0, that's an
- // error (meaning that we should get gains for all channels).
- //
- AliMUONVCalibParam* gain =
- static_cast<AliMUONVCalibParam*>(OnDemandGains()->Get(detElemId,manuId));
- if (!gain)
+/// Return the gains for a given (detElemId, manuId) pair
+/// Note that, unlike the DeadChannel case, if the result is 0x0, that's an
+/// error (meaning that we should get gains for all channels).
+
+ AliMUONV2DStore* gains = Gains();
+ if (!gains)
+ {
+ return 0x0;
+ }
+
+ return static_cast<AliMUONVCalibParam*>(gains->Get(detElemId,manuId));
+}
+
+//_____________________________________________________________________________
+AliMUONV1DStore*
+AliMUONCalibrationData::Capacitances() const
+{
+ /// Create (if needed) and return the internal store for capacitances.
+ return OnDemandCapacitances();
+}
+
+//_____________________________________________________________________________
+AliMUONV2DStore*
+AliMUONCalibrationData::Neighbours() const
+{
+ /// Create (if needed) and return the internal store for neighbours.
+ return OnDemandNeighbours();
+}
+
+//_____________________________________________________________________________
+AliMUONV2DStore*
+AliMUONCalibrationData::Gains() const
+{
+ /// Create (if needed) and return the internal store for gains.
+ return OnDemandGains();
+}
+
+//_____________________________________________________________________________
+AliMUONV2DStore*
+AliMUONCalibrationData::OnDemandNeighbours() const
+{
+ /// Create (if needed) and return the internal store for neighbours.
+
+ if (!fNeighbours)
+ {
+ AliCDBEntry* entry = GetEntry("MUON/Calib/Neighbours");
+ if (entry)
+ {
+ fNeighbours = dynamic_cast<AliMUONV2DStore*>(entry->GetObject());
+ if (!fNeighbours)
+ {
+ AliError("Neighbours not of the expected type !!!");
+ }
+ }
+ else
+ {
+ AliError("Could not get neighbours !");
+ }
+ }
+ return fNeighbours;
+}
+
+//_____________________________________________________________________________
+AliMUONV1DStore*
+AliMUONCalibrationData::OnDemandCapacitances() const
+{
+ /// Create (if needed) and return the internal store for capacitances.
+
+ if (!fCapacitances)
{
- AliError(Form("Could not get gain for detElemId=%d manuId=%d ",
- detElemId,manuId));
+ AliCDBEntry* entry = GetEntry("MUON/Calib/Capacitances");
+ if (entry)
+ {
+ fCapacitances = dynamic_cast<AliMUONV1DStore*>(entry->GetObject());
+ if (!fCapacitances)
+ {
+ AliError("Capacitances not of the expected type !!!");
+ }
+ }
+ else
+ {
+ AliError("Could not get capacitances !");
+ }
}
- return gain;
+ return fCapacitances;
}
//_____________________________________________________________________________
AliMUONV2DStore*
AliMUONCalibrationData::OnDemandGains() const
{
- //
- // Create (if needed) and return the internal store for gains.
- //
+/// Create (if needed) and return the internal store for gains.
+
if (!fGains)
{
AliCDBEntry* entry = GetEntry("MUON/Calib/Gains");
return fGains;
}
+
//_____________________________________________________________________________
AliMUONVCalibParam*
AliMUONCalibrationData::GlobalTriggerBoardMasks() const
{
- //
- // Return the masks for the global trigger board.
- //
+/// Return the masks for the global trigger board.
+
return OnDemandGlobalTriggerBoardMasks();
}
AliMUONVCalibParam*
AliMUONCalibrationData::OnDemandGlobalTriggerBoardMasks() const
{
- //
- // Create (if needed) and return the internal store for GlobalTriggerBoardMasks.
- //
+/// Create (if needed) and return the internal store for GlobalTriggerBoardMasks.
+
if (!fGlobalTriggerBoardMasks)
{
AliCDBEntry* entry = GetEntry("MUON/Calib/GlobalTriggerBoardMasks");
AliMUONVCalibParam*
AliMUONCalibrationData::LocalTriggerBoardMasks(Int_t localBoardNumber) const
{
- //
- // Return the masks for a given trigger local board.
- //
+/// Return the masks for a given trigger local board.
+
+ AliMUONV1DStore* store = OnDemandLocalTriggerBoardMasks();
+ if (!store)
+ {
+ AliError("Could not get LocalTriggerBoardMasks");
+ return 0x0;
+ }
+
AliMUONVCalibParam* ltbm =
- static_cast<AliMUONVCalibParam*>(OnDemandLocalTriggerBoardMasks()->Get(localBoardNumber));
+ static_cast<AliMUONVCalibParam*>(store->Get(localBoardNumber));
if (!ltbm)
{
AliError(Form("Could not get mask for localBoardNumber=%d",localBoardNumber));
AliMUONV1DStore*
AliMUONCalibrationData::OnDemandLocalTriggerBoardMasks() const
{
- //
- // Create (if needed) and return the internal store for LocalTriggerBoardMasks.
- //
+/// Create (if needed) and return the internal store for LocalTriggerBoardMasks.
+
if (!fLocalTriggerBoardMasks)
{
AliCDBEntry* entry = GetEntry("MUON/Calib/LocalTriggerBoardMasks");
AliMUONV2DStore*
AliMUONCalibrationData::OnDemandPedestals() const
{
- //
- // Create (if needed) and return the internal storage for pedestals.
- //
+/// Create (if needed) and return the internal storage for pedestals.
+
if (!fPedestals)
{
AliCDBEntry* entry = GetEntry("MUON/Calib/Pedestals");
void
AliMUONCalibrationData::Print(Option_t*) const
{
- //
- // A very basic dump of our guts.
- //
+/// A very basic dump of our guts.
+
cout << "RunNumber " << RunNumber()
<< " fGains=" << fGains
<< " fPedestals=" << fPedestals
- << " fDeadChannels=" << fDeadChannels
+ << " fHV=" << fHV
<< " fLocalTriggerBoardMasks=" << fLocalTriggerBoardMasks
<< " fRegionalTriggerBoardMasks=" << fRegionalTriggerBoardMasks
<< " fGlobalTriggerBoardMasks=" << fGlobalTriggerBoardMasks
<< endl;
}
+//_____________________________________________________________________________
+AliMUONV2DStore*
+AliMUONCalibrationData::Pedestals() const
+{
+ /// Return pedestals
+ return OnDemandPedestals();
+}
//_____________________________________________________________________________
AliMUONVCalibParam*
AliMUONCalibrationData::Pedestals(Int_t detElemId, Int_t manuId) const
{
- //
- // Return the pedestals for a given (detElemId, manuId) pair.
- // A return value of 0x0 is considered an error, meaning we should get
- // pedestals for all channels.
- //
- AliMUONVCalibParam* ped =
- static_cast<AliMUONVCalibParam*>(OnDemandPedestals()->Get(detElemId,manuId));
- if (!ped)
+/// Return the pedestals for a given (detElemId, manuId) pair.
+/// A return value of 0x0 is considered an error, meaning we should get
+/// pedestals for all channels.
+
+ AliMUONV2DStore* pedestals = OnDemandPedestals();
+ if (!pedestals)
{
- AliError(Form("Could not get pedestal for detElemId=%d manuId=%d ",
- detElemId,manuId));
+ return 0x0;
}
- return ped;
+
+ return static_cast<AliMUONVCalibParam*>(pedestals->Get(detElemId,manuId));
}
//_____________________________________________________________________________
AliMUONVCalibParam*
AliMUONCalibrationData::RegionalTriggerBoardMasks(Int_t index) const
{
- //
- // Return the masks for a given trigger regional board.
- //
+/// Return the masks for a given trigger regional board.
+
+ AliMUONV1DStore* store = OnDemandRegionalTriggerBoardMasks();
+
+ if (!store)
+ {
+ AliError("Could not get RegionalTriggerBoardMasks");
+ return 0x0;
+ }
+
AliMUONVCalibParam* rtbm =
- static_cast<AliMUONVCalibParam*>(OnDemandRegionalTriggerBoardMasks()->Get(index));
+ static_cast<AliMUONVCalibParam*>(store->Get(index));
if (!rtbm)
{
AliError(Form("Could not get mask for regionalBoard index=%d",index));
AliMUONV1DStore*
AliMUONCalibrationData::OnDemandRegionalTriggerBoardMasks() const
{
- //
- // Create (if needed) and return the internal store for RegionalTriggerBoardMasks.
- //
+/// Create (if needed) and return the internal store for RegionalTriggerBoardMasks.
+
if (!fRegionalTriggerBoardMasks)
{
AliCDBEntry* entry = GetEntry("MUON/Calib/RegionalTriggerBoardMasks");
AliMUONTriggerEfficiencyCells*
AliMUONCalibrationData::TriggerEfficiency() const
{
- //
- // Return the trigger efficiency.
- //
+/// Return the trigger efficiency.
+
return OnDemandTriggerEfficiency();
}
AliMUONTriggerEfficiencyCells*
AliMUONCalibrationData::OnDemandTriggerEfficiency() const
{
- //
- //
- //
+/// \todo: add comment
+
if (!fTriggerEfficiency)
{
AliCDBEntry* entry = GetEntry("MUON/Calib/TriggerEfficiency");
AliMUONTriggerLut*
AliMUONCalibrationData::TriggerLut() const
{
- //
- // Return the trigger look up table.
- //
+/// Return the trigger look up table.
+
return OnDemandTriggerLut();
}
AliMUONTriggerLut*
AliMUONCalibrationData::OnDemandTriggerLut() const
{
- //
- //
- //
+/// \todo: add comment
+
if (!fTriggerLut)
{
AliCDBEntry* entry = GetEntry("MUON/Calib/TriggerLut");
return fTriggerLut;
}
+//_____________________________________________________________________________
+void
+AliMUONCalibrationData::Reset()
+{
+/// Reset all data
+
+ delete fPedestals;
+ fPedestals = 0x0;
+ delete fGains;
+ fGains = 0x0;
+ delete fHV;
+ fHV = 0x0;
+ delete fLocalTriggerBoardMasks;
+ fLocalTriggerBoardMasks = 0x0;
+ delete fRegionalTriggerBoardMasks;
+ fRegionalTriggerBoardMasks = 0x0;
+ delete fGlobalTriggerBoardMasks;
+ fGlobalTriggerBoardMasks = 0x0;
+ delete fTriggerLut;
+ fTriggerLut = 0x0;
+ delete fTriggerEfficiency;
+ fTriggerEfficiency = 0x0;
+ delete fCapacitances;
+ fCapacitances = 0x0;
+ delete fNeighbours;
+ fNeighbours = 0x0;
+}
+