fRegionalTriggerBoardMasks(0x0),
fGlobalTriggerBoardMasks(0x0),
fTriggerLut(0x0),
-fTriggerEfficiency(0x0)
+fTriggerEfficiency(0x0),
+fCapacitances(0x0)
{
/// Default ctor.
OnDemandGlobalTriggerBoardMasks();
OnDemandTriggerLut();
OnDemandTriggerEfficiency();
+ OnDemandCapacitances();
}
}
//_____________________________________________________________________________
AliMUONCalibrationData::~AliMUONCalibrationData()
{
-/// Destructor. Note that we're the owner of our pointers.
-
- delete fPedestals;
- delete fGains;
- delete fHV;
- delete fLocalTriggerBoardMasks;
- delete fRegionalTriggerBoardMasks;
- delete fGlobalTriggerBoardMasks;
- delete fTriggerLut;
- delete fTriggerEfficiency;
+ /// Destructor. Note that we're the owner of our pointers.
+ Reset();
}
-
//_____________________________________________________________________________
TMap*
AliMUONCalibrationData::HV() const
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::Gains() const
return OnDemandGains();
}
+//_____________________________________________________________________________
+AliMUONV1DStore*
+AliMUONCalibrationData::OnDemandCapacitances() const
+{
+ /// Create (if needed) and return the internal store for capacitances.
+
+ if (!fCapacitances)
+ {
+ 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 fCapacitances;
+}
+
//_____________________________________________________________________________
AliMUONV2DStore*
AliMUONCalibrationData::OnDemandGains() const
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;
+}
+
AliMUONCalibrationData(Int_t runNumber=-1, Bool_t deferredInitialization=kTRUE);
virtual ~AliMUONCalibrationData();
+ AliMUONV1DStore* Capacitances() const;
+
AliMUONV2DStore* Gains() const;
/// Get the Gain calibration object for channels within (detElemId,manuId).
/// Get the trigger efficiency map
AliMUONTriggerEfficiencyCells* TriggerEfficiency() const;
+ void Reset();
+
protected:
/// Not implemented
AliMUONCalibrationData(const AliMUONCalibrationData& other);
private:
AliCDBEntry* GetEntry(const char* path) const;
+ AliMUONV1DStore* OnDemandCapacitances() const;
AliMUONV2DStore* OnDemandGains() const;
AliMUONV2DStore* OnDemandPedestals() const;
TMap* OnDemandHV() const;
mutable AliMUONVCalibParam* fGlobalTriggerBoardMasks; //!< Global trigger board maska
mutable AliMUONTriggerLut* fTriggerLut; //!< TRigger LUTs
mutable AliMUONTriggerEfficiencyCells* fTriggerEfficiency; //!< Trigger efficiency cells
+ mutable AliMUONV1DStore* fCapacitances; //!< Manu capacitances
- ClassDef(AliMUONCalibrationData,4) // Storage for all MUON calibration data.
+ ClassDef(AliMUONCalibrationData,5) // Storage for all MUON calibration data.
};
#endif
#include "AliCDBManager.h"
#include "AliDCSValue.h"
#include "AliMUON1DArray.h"
+#include "AliMUON1DMap.h"
#include "AliMUON2DMap.h"
#include "AliMUON2DStoreValidator.h"
#include "AliMUONCalibParam1I.h"
#include "AliMUONVCalibParam.h"
#include "AliMUONVCalibParam.h"
#include "AliMUONVDataIterator.h"
+#include "AliMpDDLStore.h"
#include "AliMpDEIterator.h"
#include "AliMpDEManager.h"
+#include "AliMpDetElement.h"
#include "AliMpManuList.h"
#include "AliMpSegmentation.h"
#include "AliMpStationType.h"
#include "TList.h"
#include "TMap.h"
#include "TObjString.h"
+#include "TROOT.h"
#include "TRandom.h"
#include "TStopwatch.h"
#include "TSystem.h"
-#include "TROOT.h"
#include <map>
#endif
}
+//_____________________________________________________________________________
+Int_t makeCapacitanceStore(AliMUONV1DStore& capaStore, Bool_t defaultValues)
+{
+ TList* list = AliMpManuList::ManuList();
+ TIter next(list);
+
+ AliMpIntPair* p;
+
+ Int_t nchannels(0);
+ Int_t nmanus(0);
+ Int_t nmanusOK(0); // manus for which we got the serial number
+
+ Bool_t replace = kFALSE;
+
+ const Int_t nChannels(64);
+ const Float_t kCapaMean(1.0);
+ const Float_t kCapaSigma(0.5);
+
+ while ( ( p = (AliMpIntPair*)next() ) )
+ {
+ ++nmanus;
+
+ Int_t detElemId = p->GetFirst();
+ Int_t manuId = p->GetSecond();
+
+ AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
+ Int_t serialNumber = de->GetManuSerialFromId(manuId);
+
+ if ( serialNumber > 0 ) ++nmanusOK;
+
+ const AliMpVSegmentation* seg =
+ AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
+
+ AliMUONVCalibParam* capa = static_cast<AliMUONVCalibParam*>(capaStore.Get(serialNumber));
+
+ if (!capa)
+ {
+ capa = new AliMUONCalibParamNF(1,nChannels,1.0);
+ Bool_t ok = capaStore.Set(serialNumber,capa,replace);
+ if (!ok)
+ {
+ cout << "Could not set serialNumber=" << serialNumber << " manuId="
+ << manuId << endl;
+ }
+ }
+
+ for ( Int_t manuChannel = 0; manuChannel < nChannels; ++manuChannel )
+ {
+ AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId,manuChannel),kFALSE);
+ if (!pad.IsValid()) continue;
+
+ ++nchannels;
+
+ Float_t capaValue;
+
+ if ( defaultValues )
+ {
+ capaValue = 1.0;
+ }
+ else
+ {
+ capaValue = -1;
+ while ( capaValue < 0 )
+ {
+ capaValue = gRandom->Gaus(kCapaMean,kCapaSigma);
+ }
+ }
+ capa->SetValueAsFloat(manuChannel,0,capaValue);
+ }
+ }
+
+ delete list;
+ Float_t percent = 0;
+ if ( nmanus ) percent = 100*nmanusOK/nmanus;
+ cout << Form("%5d manus with serial number (out of %5d manus = %3.0f%%)",
+ nmanusOK,nmanus,percent) << endl;
+ cout << Form("%5d channels",nchannels) << endl;
+ if ( percent < 100 )
+ {
+ cout << "WARNING : did not get all serial numbers. capaStore is incomplete !!!!"
+ << endl;
+ }
+ return nchannels;
+
+}
+
//_____________________________________________________________________________
Int_t makeGainStore(AliMUONV2DStore& gainStore, Bool_t defaultValues)
{
delete pedestalStore;
}
+
//_____________________________________________________________________________
void writeGains(const char* cdbpath, Bool_t defaultValues,
Int_t startRun, Int_t endRun)
{
/// generate gain values (either 1 if defaultValues=true or random
- /// if defaultValues=false, see makePedestalStore) and
+ /// if defaultValues=false, see makeGainStore) and
/// store them into CDB located at cdbpath, with a validity period
/// ranging from startRun to endRun
delete gainStore;
}
+//_____________________________________________________________________________
+void writeCapacitances(const char* cdbpath, Bool_t defaultValues,
+ Int_t startRun, Int_t endRun)
+{
+ /// generate manu capacitance values (either 1 if defaultValues=true or random
+ /// if defaultValues=false, see makeCapacitanceStore) and
+ /// store them into CDB located at cdbpath, with a validity period
+ /// ranging from startRun to endRun
+
+ AliMUONV1DStore* capaStore = new AliMUON1DMap(16828);
+ Int_t ngenerated = makeCapacitanceStore(*capaStore,defaultValues);
+ cout << "Ngenerated = " << ngenerated << endl;
+
+ writeToCDB(cdbpath,"MUON/Calib/Capacitances",capaStore,startRun,endRun,defaultValues);
+ delete capaStore;
+}
+
//_____________________________________________________________________________
Bool_t check1I(const AliMUONVCalibParam& calib, Int_t channel)
{