- AliMUONVSubprocessor::Initialize method now returns a boolean to know whether the init was ok or not (previously the preprocessor could announce Init OK while it was not...)
- Adding the handling of the tracker configuration in the Pedestal subprocessor, creating a new OCDB object = MUON/Calib/Config. This object is around 85 KBytes, and hopefully will change rarely (only when we have to remove part of the detector from the readout for whatever serious reason).
- Allow mchview to plot the new MUON/Calib/Config object.
//_____________________________________________________________________________
TObjArray*
-AliMUON2DStoreValidator::Validate(const AliMUONVStore& store)
+AliMUON2DStoreValidator::Validate(const AliMUONVStore& store,
+ AliMUONVStore* config)
{
/// Validate the store. Check only the presence of all manus (i.e.
- /// check nothing about the values themselves)
+ /// check nothing about the values themselves).
+ /// Absence of manus which are not in the config is considered as normal.
Bool_t (*kCheck)(const AliMUONVCalibParam&,Int_t) = 0x0;
- return Validate(store,kCheck);
+ return Validate(store,kCheck,config);
}
//_____________________________________________________________________________
TObjArray*
AliMUON2DStoreValidator::Validate(const AliMUONVStore& store,
- Bool_t (*check)(const AliMUONVCalibParam&,Int_t))
+ Bool_t (*check)(const AliMUONVCalibParam&,Int_t),
+ AliMUONVStore* config)
{
/// Validate the store.
/// The check method is used to decide if a store content value
if (!test)
{
// completely missing manu
- AddMissingManu(detElemId,manuId);
+ if ( !config || ( config && config->FindObject(detElemId,manuId ) ) )
+ {
+ // manu is in the config but not in the store : that's an error
+ AddMissingManu(detElemId,manuId);
+ }
}
else
{
//_____________________________________________________________________________
TObjArray*
AliMUON2DStoreValidator::Validate(const AliMUONVStore& store,
- Float_t invalidFloatValue)
+ Float_t invalidFloatValue,
+ AliMUONVStore* config)
{
/// Validate the store.
/// The invalidFloatValue is used to decide if a store content value
static_cast<AliMUONVCalibParam*>(store.FindObject(detElemId,manuId));
if (!test)
{
- // completely missing manu
- AddMissingManu(detElemId,manuId);
+ if ( !config || ( config && config->FindObject(detElemId,manuId ) ) )
+ {
+ // completely missing manu
+ AddMissingManu(detElemId,manuId);
+ }
}
else
{
AliMUON2DStoreValidator();
virtual ~AliMUON2DStoreValidator();
- TObjArray* Validate(const AliMUONVStore& store, Float_t invalidFloatValue);
+ TObjArray* Validate(const AliMUONVStore& store, Float_t invalidFloatValue, AliMUONVStore* config=0x0);
- TObjArray* Validate(const AliMUONVStore& store);
+ TObjArray* Validate(const AliMUONVStore& store, AliMUONVStore* config=0x0);
TObjArray* Validate(const AliMUONVStore& store,
- Bool_t (*check)(const AliMUONVCalibParam&,Int_t));
+ Bool_t (*check)(const AliMUONVCalibParam&,Int_t),
+ AliMUONVStore* config=0x0);
/// Return statuses
AliMUONVStore* GetStatus() const { return fStatus; }
fCapacitances(0x0),
fNeighbours(0x0),
fOccupancyMap(0x0),
-fRejectList(0x0)
+fRejectList(0x0),
+fConfig(0x0)
{
/// Default ctor.
TriggerEfficiency();
Capacitances();
Neighbours();
+ Config();
}
}
return dynamic_cast<AliMUONVStore*>(CreateObject(runNumber,"MUON/Calib/Pedestals",startOfValidity));
}
+//_____________________________________________________________________________
+AliMUONVStore*
+AliMUONCalibrationData::CreateConfig(Int_t runNumber, Int_t* startOfValidity)
+{
+ /// Create a new config store from the OCDB for a given run
+ return dynamic_cast<AliMUONVStore*>(CreateObject(runNumber,"MUON/Calib/Config",startOfValidity));
+}
+
//_____________________________________________________________________________
AliMUONRegionalTriggerConfig*
return fPedestals;
}
+//_____________________________________________________________________________
+AliMUONVStore*
+AliMUONCalibrationData::Config() const
+{
+ /// Return config
+
+ if (!fConfig)
+ {
+ fConfig = CreateConfig(fRunNumber);
+ }
+ return fConfig;
+}
+
//_____________________________________________________________________________
AliMUONVCalibParam*
AliMUONCalibrationData::Pedestals(Int_t detElemId, Int_t manuId) const
cout << "RunNumber " << RunNumber()
<< " fGains=" << fGains
<< " fPedestals=" << fPedestals
+ << " fConfig=" << fConfig
<< " fHV=" << fHV
<< " fTriggerDCS=" << fTriggerDCS
<< " fLocalTriggerBoardMasks=" << fLocalTriggerBoardMasks
{
/// Reset all data
+ delete fConfig;
+ fConfig = 0x0;
delete fPedestals;
fPedestals = 0x0;
delete fGains;
{
AliInfoClass("Pedestals read OK");
}
+
+ if ( ! CreateConfig(runNumber) )
+ {
+ AliErrorClass("Could not read config");
+ }
+ else
+ {
+ AliInfoClass("Config read OK");
+ }
if ( ! CreateRegionalTriggerConfig(runNumber) )
{
/// Create a pedestal store (which must be deleted) from OCDB for the given run
static AliMUONVStore* CreatePedestals(Int_t runNumber, Int_t* startOfValidity=0);
+ /// Create a configuration store (which must be deleted) from OCDB for the given run
+ static AliMUONVStore* CreateConfig(Int_t runNumber, Int_t* startOfValidity=0);
+
/// Create a regional trigger mask store (which must be deleted) for a given run
static AliMUONRegionalTriggerConfig* CreateRegionalTriggerConfig(Int_t runNumber, Int_t* startOfValidity=0);
/// Get the pedestal store
AliMUONVStore* Pedestals() const;
+ /// Get the config store
+ AliMUONVStore* Config() const;
+
/// Get the occupancy map store
AliMUONVStore* OccupancyMap() const;
static AliMUONVStore* fBypassPedestals;
static AliMUONVStore* fBypassGains;
-
- ClassDef(AliMUONCalibrationData,12) // Storage for all MUON calibration data.
+
+ mutable AliMUONVStore* fConfig; //!< configuration of the tracker
+
+ ClassDef(AliMUONCalibrationData,13) // Storage for all MUON calibration data.
};
#endif
//______________________________________________________________________________
-void AliMUONGMSSubprocessor::Initialize(Int_t /*run*/,
+Bool_t AliMUONGMSSubprocessor::Initialize(Int_t /*run*/,
UInt_t /*startTime*/, UInt_t /*endTime*/)
{
/// Instantiate geometry transformer
fTransformer = new AliMUONGeometryTransformer();
fTransformer->CreateModules();
}
+ return kTRUE;
}
//______________________________________________________________________________
virtual ~AliMUONGMSSubprocessor();
// methods
- virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+ virtual Bool_t Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
virtual UInt_t Process(TMap* /*dcsAliasMap*/);
private:
}
//_____________________________________________________________________________
-void
+Bool_t
AliMUONGainSubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
{
/// When starting a new run, reads in the Gains ASCII files.
}
}
+ delete sources;
+
if ( fSkip )
{
delete fGains;
Master()->Log("Failed to read any Gains");
delete fGains;
fGains = 0x0;
+ return kFALSE;
}
- delete sources;
+ return kTRUE;
}
//_____________________________________________________________________________
AliMUONGainSubprocessor(AliMUONPreprocessor* master);
virtual ~AliMUONGainSubprocessor();
- void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+ Bool_t Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
UInt_t Process(TMap* dcsAliasMap);
private:
TGTextView* rn = new TGTextView(t);
+ rn->AddLine("1.01");
+ rn->AddLine("");
+ rn->AddLine("Added the configuration as a possible OCDB data source");
+ rn->AddLine("");
+
rn->AddLine("1.00");
rn->AddLine("");
rn->AddLine("Added the Status and StatusMap as a possible OCDB data source");
rn->AddLine("");
rn->AddLine("Added one (computed) dimension to the Gains data source = 1/a1/0.2 (mV/fC)");
rn->AddLine("");
-
-
+
rn->AddLine("0.99a");
rn->AddLine("");
rn->AddLine("Added the --de and --chamber options");
void HandleMenu(Int_t i);
/// Return the version number of the mchview application
- static const char* Version() { return "1.00"; }
+ static const char* Version() { return "1.01"; }
/// Return the SVN revision and version number of the mchview application
static const char* FullVersion() { return Form("mchview Version %s ($Id$)",Version()); }
}
//_____________________________________________________________________________
-void
+Bool_t
AliMUONOccupancySubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
{
/// When starting a new run, reads in the occupancy ASCII files.
}
}
+ delete sources;
+
if (!n)
{
Master()->Log("Failed to read any occupancy");
delete fOccupancyMap;
fOccupancyMap = 0;
+ return kFALSE;
}
- delete sources;
+ return kTRUE;
}
//_____________________________________________________________________________
AliMUONOccupancySubprocessor(AliMUONPreprocessor* master);
virtual ~AliMUONOccupancySubprocessor();
- void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+ Bool_t Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
UInt_t Process(TMap* dcsAliasMap);
void Print(Option_t* opt="") const;
fOCDBTypes->AddEntry("Occupancy",4);
fOCDBTypes->AddEntry("StatusMap",5);
fOCDBTypes->AddEntry("Status",6);
+ fOCDBTypes->AddEntry("Config",7);
fOCDBTypes->Select(0);
fOCDBTypes->Resize(100,20);
const Int_t kIDet = AliDAQ::DetectorID("MUONTRK");
- const Int_t kNLDCs = TMath::CeilNint(AliDAQ::NumberOfLdcs(kIDet));
+ const Int_t kNLDCs = 5;//TMath::CeilNint(AliDAQ::NumberOfLdcs(kIDet));
char* path = gSystem->Which(gSystem->Getenv("PATH"), "dateStream");
if (!path)
char command[256];
// Note the option -s. It is used in order to avoid
// the generation of SOR/EOR events.
- sprintf(command, "dateStream -s -D -o %s.LDC%d -# %d -C",
+ sprintf(command, "dateStream -c -D -o %s.LDC%d -# %d -C",
fDateFileName.Data(), iFile, runLoader->GetNumberOfEvents());
pipe[iFile] = gSystem->OpenPipe(command, "w");
}
: AliMUONVSubprocessor(master,
"Pedestals",
"Upload MUON Tracker pedestals to OCDB"),
-fPedestals(0x0)
+fPedestals(0x0),
+fConfig(0x0),
+fConfigChanged(kFALSE)
{
/// default ctor
}
{
/// dtor
delete fPedestals;
+ delete fConfig;
}
//_____________________________________________________________________________
-void
+Bool_t
AliMUONPedestalSubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
{
/// When starting a new run, reads in the pedestals ASCII files.
delete fPedestals;
fPedestals = new AliMUON2DMap(kTRUE);
+ delete fConfig;
+ fConfig = new AliMUON2DMap(kTRUE);
+
Master()->Log(Form("Reading pedestal files for Run %d startTime %ld endTime %ld",
run,startTime,endTime));
TIter next(sources);
TObjString* o(0x0);
Int_t n(0);
+ Int_t npedFiles(0);
while ( ( o = static_cast<TObjString*>(next()) ) )
{
TString fileName(Master()->GetFile(kSystem,kId,o->GetName()));
- Int_t ok = ReadFile(fileName.Data());
+ Int_t ok = ReadPedestalFile(fileName.Data());
if (ok>0)
{
n += ok;
+ ++npedFiles;
}
}
+
+ delete sources;
if (!n)
{
Master()->Log("Failed to read any pedestals");
delete fPedestals;
fPedestals = 0;
+ delete fConfig;
+ fConfig = 0;
+ return kFALSE;
+ }
+
+ const char* kIdConf = "CONFIG";
+
+ sources = Master()->GetFileSources(kSystem,kIdConf);
+ TIter nextConf(sources);
+ Int_t nconf(0);
+ Int_t nconfFiles(0);
+
+ fConfigChanged = kFALSE;
+
+ while ( ( o = static_cast<TObjString*>(nextConf()) ) )
+ {
+ TString fileName(Master()->GetFile(kSystem,kIdConf,o->GetName()));
+ Int_t ok = ReadConfigFile(fileName.Data());
+ if (ok>0)
+ {
+ nconf += ok;
+ ++nconfFiles;
+ }
}
+
delete sources;
+
+ if ( npedFiles != nconfFiles )
+ {
+ Master()->Log(Form("ERROR : Number of config files (%d) different from number of pedestal files (%d)",nconfFiles,npedFiles));
+ delete fPedestals;
+ fPedestals = 0;
+ delete fConfig;
+ fConfig = 0;
+ return kFALSE;
+ }
+
+ return kTRUE;
}
//_____________________________________________________________________________
{
/// Store the pedestals into the CDB
- if (!fPedestals)
+ if (!fPedestals || !fConfig)
{
- // this is the only reason to fail for the moment : getting no pedestal
+ // this is the only reason to fail for the moment : getting no pedestal or no config
// at all.
return 1;
}
Master()->Log("Validating");
- TObjArray* chambers = validator.Validate(*fPedestals);
+ TObjArray* chambers = validator.Validate(*fPedestals,fConfig);
if (chambers)
{
}
}
- Master()->Log("Storing pedestals");
+ Master()->Log("Storing pedestals...");
+ if ( fConfigChanged )
+ {
+ Master()->Log("...and configuration, as it has changed");
+ }
AliCDBMetaData metaData;
metaData.SetBeamPeriod(0);
Bool_t validToInfinity = kTRUE;
Bool_t result = Master()->Store("Calib", "Pedestals", fPedestals, &metaData, 0, validToInfinity);
-
+ if ( fConfigChanged )
+ {
+ result = result && Master()->Store("Calib", "Config", fConfig, &metaData, 0, validToInfinity);
+ }
return ( result != kTRUE ); // return 0 if everything is ok.
}
//_____________________________________________________________________________
Int_t
-AliMUONPedestalSubprocessor::ReadFile(const char* filename)
+AliMUONPedestalSubprocessor::ReadPedestalFile(const char* filename)
{
/// Read the pedestals from an ASCII file. \n
/// Format of that file is one line per channel : \n
return n;
}
+//_____________________________________________________________________________
+Int_t
+AliMUONPedestalSubprocessor::ReadConfigFile(const char* filename)
+{
+ /// Read the configuration from an ASCII file.
+ /// Format of that file is one line per manu :
+ /// BUS_PATCH MANU_ADDR
+ /// And the first line contains "unchanged" if the configuration is the same
+ /// as before.
+ /// Return kFALSE if reading was not successfull.
+ ///
+
+ TString sFilename(gSystem->ExpandPathName(filename));
+
+ Master()->Log(Form("Reading %s",sFilename.Data()));
+
+ Int_t n = AliMUONTrackerIO::ReadConfig(sFilename.Data(),*fConfig,fConfigChanged);
+
+ switch (n)
+ {
+ case -1:
+ Master()->Log(Form("Could not open %s",sFilename.Data()));
+ break;
+ }
+
+ return n;
+}
+
//_____________________________________________________________________________
void
{
/// ouput to screen
if (fPedestals) fPedestals->Print("",opt);
+ if (fConfig) fConfig->Print("",opt);
}
+
AliMUONPedestalSubprocessor(AliMUONPreprocessor* master);
virtual ~AliMUONPedestalSubprocessor();
- void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+ Bool_t Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
UInt_t Process(TMap* dcsAliasMap);
void Print(Option_t* opt="") const;
/// Not implemented
AliMUONPedestalSubprocessor& operator=(const AliMUONPedestalSubprocessor&);
- Int_t ReadFile(const char* filename);
+ Int_t ReadPedestalFile(const char* filename);
+ Int_t ReadConfigFile(const char* filename);
private:
AliMUONVStore* fPedestals; //!< Pedestals for the MUON TRK
+ AliMUONVStore* fConfig; //!< Configuration (i.e. list of (buspatch,manu)) for the MUON TRK
+ Bool_t fConfigChanged; //!< flag to trigger the saving of the configuration
- ClassDef(AliMUONPedestalSubprocessor,1) // A shuttle preprocessor for MUON TRK pedestals
+ ClassDef(AliMUONPedestalSubprocessor,2) // A shuttle preprocessor for MUON TRK pedestals
};
#endif
}
}
+ Int_t nok(0);
+
if (IsValid())
{
// loop over subtasks and initialize them
for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
{
- Subprocessor(i)->Initialize(run,startTime,endTime);
+ Bool_t ok = Subprocessor(i)->Initialize(run,startTime,endTime);
+ if (ok) ++nok;
}
+ if (nok != fSubprocessors->GetLast()+1) fIsValid = kFALSE;
}
Log(Form("Initialize was %s",( IsValid() ? "fine" : "NOT OK")));
}
/// Whether we should do something or not
Bool_t IsApplicable() { return fIsApplicable; }
+ TString GetLogBookParam(const char* parname)
+ { return TString(AliPreprocessor::GetRunParameter(parname)); }
+
protected:
AliMUONPreprocessor(const char* detName, AliShuttleInterface* shuttle);
virtual ~AliMUONPreprocessor();
ClassImp(AliMUONTrackerIO)
/// \endcond
+#include "AliDCSValue.h"
#include "AliLog.h"
#include "AliMUONCalibParamND.h"
#include "AliMUONCalibParamNF.h"
#include "AliMUONVStore.h"
#include "AliMpConstants.h"
#include "AliMpDDLStore.h"
+#include "AliMpDEManager.h"
#include "AliMpDetElement.h"
#include <Riostream.h>
#include <TClass.h>
std::istringstream sin(line);
sin >> busPatchID >> manuID >> manuChannel >> pedMean >> pedSigma;
Int_t detElemID = AliMpDDLStore::Instance()->GetDEfromBus(busPatchID);
+
+ if ( !AliMpDEManager::IsValidDetElemId(detElemID) )
+ {
+ AliErrorClass(Form("Got an invalid DE = %d from busPatchId=%d manuId=%d",
+ detElemID,busPatchID,manuID));
+ continue;
+ }
+
AliDebugClass(3,Form("BUSPATCH %3d DETELEMID %4d MANU %3d CH %3d MEAN %7.2f SIGMA %7.2f",
busPatchID,detElemID,manuID,manuChannel,pedMean,pedSigma));
&a0,&a1,&thres,&qual);
AliDebugClass(3,Form("line=%s",line));
Int_t detElemID = AliMpDDLStore::Instance()->GetDEfromBus(busPatchID);
+
+ if ( !AliMpDEManager::IsValidDetElemId(detElemID) )
+ {
+ AliErrorClass(Form("Got an invalid DE = %d from busPatchId=%d manuId=%d",
+ detElemID,busPatchID,manuID));
+ continue;
+ }
+
AliDebugClass(3,Form("BUSPATCH %3d DETELEMID %4d MANU %3d CH %3d A0 %7.2f "
"A1 %e THRES %5d QUAL %x",
busPatchID,detElemID,manuID,manuChannel,a0,a1,thres,qual));
return ngenerated;
}
+
+//_____________________________________________________________________________
+Int_t
+AliMUONTrackerIO::ReadConfig(const char* filename, AliMUONVStore& confStore, Bool_t& changed)
+{
+ /// Read config file (produced by the MUONTRKda.exe program for instance)
+ /// and append the read values into the given VStore
+ /// To be used when the input is a file (for instance when reading data
+ /// from the OCDB).
+ /// changed must be set to kFALSE before calling this method for the first time
+ /// (then the subsequent calls must not set it !)
+ ///
+
+ TString sFilename(gSystem->ExpandPathName(filename));
+
+ std::ifstream in(sFilename.Data());
+ if (!in.good())
+ {
+ return kCannotOpenFile;
+ }
+
+ TString datastring;
+ ostringstream stream;
+ char line[1024];
+ while ( in.getline(line,1024) )
+ stream << line << "\n";
+ datastring = TString(stream.str().c_str());
+
+ in.close();
+
+ return DecodeConfig(datastring,confStore,changed);
+}
+
+//_____________________________________________________________________________
+Int_t
+AliMUONTrackerIO::DecodeConfig(TString data, AliMUONVStore& confStore, Bool_t& changed)
+{
+ /// Read config data (produced by the MUONTRKda.exe program for instance)
+ /// and append the read values into the given VStore
+ /// To be used when the input is a TString (for instance when getting data
+ /// from AMORE DB).
+ /// changed must be set to kFALSE before calling this method for the first time
+ /// (then the subsequent calls must not set it !)
+
+ char line[1024];
+ Int_t busPatchID, manuID;
+ Int_t n(0);
+ istringstream in(data.Data());
+
+ while ( in.getline(line,1024) )
+ {
+ AliDebugClass(3,Form("line=%s",line));
+ if ( line[0] == '#' )
+ {
+ TString sline(line);
+ sline.ToUpper();
+ if (sline.Contains("CHANGED") && !sline.Contains("UNCHANGED")) changed = kTRUE;
+ continue;
+ }
+ std::istringstream sin(line);
+ sin >> busPatchID >> manuID;
+
+ Int_t detElemID = AliMpDDLStore::Instance()->GetDEfromBus(busPatchID);
+
+ if ( !AliMpDEManager::IsValidDetElemId(detElemID) )
+ {
+ AliErrorClass(Form("Got an invalid DE = %d from busPatchId=%d manuId=%d",
+ detElemID,busPatchID,manuID));
+ continue;
+ }
+
+ AliMUONVCalibParam* conf =
+ static_cast<AliMUONVCalibParam*>(confStore.FindObject(detElemID,manuID));
+ if (!conf)
+ {
+ conf = new AliMUONCalibParamNF(1,1,detElemID,manuID,1);
+ confStore.Add(conf);
+ }
+ ++n;
+ }
+
+ return n;
+}
+
+//_____________________________________________________________________________
+Int_t
+AliMUONTrackerIO::WriteConfig(ofstream& out, AliMUONVStore& confStore)
+{
+ /// Write the conf store as an ASCII file
+ /// Note that we are converting (back) the detElemId into a busPatchId
+ /// Return the number of lines written
+
+ if ( !AliMpDDLStore::Instance() )
+ {
+ cout << "ERROR: mapping not loaded. Cannot work" << endl;
+ return 0;
+ }
+
+ TIter next(confStore.CreateIterator());
+ AliMUONVCalibParam* param;
+ Int_t n(0);
+
+ while ( (param=static_cast<AliMUONVCalibParam*>(next())) )
+ {
+ Int_t detElemId = param->ID0();
+ Int_t manuId = param->ID1();
+
+ Int_t busPatchId = AliMpDDLStore::Instance()->GetBusPatchId(detElemId,manuId);
+ ++n;
+
+ out << busPatchId << " " << manuId << endl;
+ }
+ return n;
+}
+
AliMUONTrackerIO();
virtual ~AliMUONTrackerIO();
+ static Int_t ReadConfig(const char* filename, AliMUONVStore& confStore, Bool_t& changed);
+ static Int_t DecodeConfig(TString data, AliMUONVStore& confStore, Bool_t& changed);
+ static Int_t WriteConfig(ofstream& out, AliMUONVStore& confStore);
+
static Int_t ReadPedestals(const char* filename, AliMUONVStore& pedStore);
static Int_t DecodePedestals(TString data, AliMUONVStore& pedStore);
store = AliMUONCalibrationData::CreatePedestals(runNumber,&startOfValidity);
fData = CreateDataPedestals(startOfValidity);
}
+ else if ( stype == "CONFIG" )
+ {
+ store = AliMUONCalibrationData::CreateConfig(runNumber,&startOfValidity);
+ fData = new AliMUONTrackerData(Form("CONFIG%d",startOfValidity),"Configuration",1);
+ fData->SetDimensionName(0,"there");
+ fData->DisableChannelLevel();
+ }
else if ( stype == "OCCUPANCY" )
{
store = AliMUONCalibrationData::CreateOccupancyMap(runNumber,&startOfValidity);
}
//_____________________________________________________________________________
-void
+Bool_t
AliMUONTriggerSubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
{
/// When starting a new run, reads in the trigger online files.
{
Master()->Log("FATAL ERROR : DA does not seem to have been run !!!");
Master()->Invalidate();
- return;
+ return kFALSE;
}
// OK. We have an exportedFiles.dat file at hand.
if ((globalFile+regionalFile+localFile+lutFile) == 0) {
Master()->Log("No file(s) to be processed for this run. Exiting.");
- return;
+ return kTRUE;
}
delete fRegionalConfig; fRegionalConfig = 0x0;
{
Master()->Log("Could not read some input file(s). Aborting");
Master()->Invalidate();
- return;
+ return kFALSE;
}
if ( regionalFile ) fRegionalConfig = new AliMUONRegionalTriggerConfig();
fLUT = 0x0;
}
}
+ return kTRUE;
}
//_____________________________________________________________________________
AliMUONTriggerSubprocessor(AliMUONPreprocessor* master);
virtual ~AliMUONTriggerSubprocessor();
- void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+ Bool_t Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
UInt_t Process(TMap* dcsAliasMap);
private:
}
//_____________________________________________________________________________
-void
+Bool_t
AliMUONVSubprocessor::Initialize(Int_t /*run*/,
UInt_t startTime,
UInt_t endTime)
{
/// optional
- fStartTime = startTime;
- fEndTime = endTime;
+ fStartTime = startTime; // time_created
+ fEndTime = endTime; // time_completed
+ return kTRUE;
}
//_____________________________________________________________________________
const char* name="", const char* title="");
virtual ~AliMUONVSubprocessor();
- virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+ virtual Bool_t Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
/// Process this sub-task
virtual UInt_t Process(TMap* dcsAliasMap) = 0;
/// the rootlogon.C there) before compiling this macro :
/// <pre>
/// gSystem->Load("$ALICE_ROOT/SHUTTLE/TestShuttle/libTestShuttle");
-/// gSystem->Load("$ALICE_ROOT/MUON/libMUONshuttle");
+/// gSystem->Load("libMUONshuttle");
/// </pre>
+/// Last line above assume you have $ALICE_ROOT/MUON/lib/tgt_[arch] (where
+/// libMUONshuttle is located) in your LD_LIBRARY_PATH
///
/// Having $ALICE_ROOT/SHUTTLE/TestShuttle directory in your LD_LIBRARY_PATH
/// (or DYLD_LIBRARY_PATH on Mac OS X) won't hurt either...
/// LDC1.ped
/// LDC2.ped
/// LDC3.ped
+/// LDC4.conf
+/// CONFIG/
+/// LDC0.conf
+/// LDC1.conf
+/// LDC2.conf
+/// LDC3.conf
+/// LDC4.conf
/// TRIGGER/
/// ExportedFiles.dat (mandatory)
/// MtgGlobalCrate-1.dat
#include "AliLog.h"
+#include "AliMpBusPatch.h"
#include "AliMpExMap.h"
#include "AliMpHelper.h"
+#include "AliMpDDLStore.h"
#include "AliMpDCSNamer.h"
#include "AliMpCDB.h"
#include "TRandom.h"
#endif
+//______________________________________________________________________________
void TestMUONPreprocessor(Int_t runNumber=80,
const char* runType="CALIBRATION",
const char* sourceDirectory="/afs/cern.ch/user/l/laphecet/public")
// create AliTestShuttle instance
// The parameters are run, startTime, endTime
+
+ gSystem->Load("libTestShuttle.so");
+
AliTestShuttle* shuttle = new AliTestShuttle(runNumber, 0, 1);
const char* inputCDB = "local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestCDB";
if ( rt.Contains("PHYSICS") )
{
// Create DCS aliases
+ UInt_t startTime, endTime;
+
TMap* dcsAliasMap = CreateDCSAliasMap(inputCDB, runNumber);
if ( dcsAliasMap )
shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC1",Form("%s/PEDESTALS/LDC1.ped",sourceDirectory));
shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC2",Form("%s/PEDESTALS/LDC2.ped",sourceDirectory));
shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC3",Form("%s/PEDESTALS/LDC3.ped",sourceDirectory));
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC4",Form("%s/PEDESTALS/LDC4.ped",sourceDirectory));
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","CONFIG","LDC0",Form("%s/CONFIG/LDC0.conf",sourceDirectory));
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","CONFIG","LDC1",Form("%s/CONFIG/LDC1.conf",sourceDirectory));
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","CONFIG","LDC2",Form("%s/CONFIG/LDC2.conf",sourceDirectory));
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","CONFIG","LDC3",Form("%s/CONFIG/LDC3.conf",sourceDirectory));
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","CONFIG","LDC4",Form("%s/CONFIG/LDC4.conf",sourceDirectory));
+
shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC0",Form("%s/GAINS/LDC0.gain",sourceDirectory));
shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC1",Form("%s/GAINS/LDC1.gain",sourceDirectory));
shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC2",Form("%s/GAINS/LDC2.gain",sourceDirectory));
shuttle->Process();
}
+//______________________________________________________________________________
+void GenerateConfig()
+{
+ /// Generate "fake" configuration files for the tracker. One per LDC.
+
+ Bool_t undefStorage(kFALSE);
+
+ AliCDBManager* man = AliCDBManager::Instance();
+ if (!man->IsDefaultStorageSet())
+ {
+ undefStorage = kTRUE;
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+ man->SetRun(0);
+ }
+
+ // Load mapping
+ Bool_t ok = AliMpCDB::LoadDDLStore();
+
+ if (undefStorage)
+ {
+ man->UnsetDefaultStorage();
+ }
+
+ if (!ok)
+ {
+ AliErrorGeneral("GenerateConfig","Could not load DDLStore from OCDB");
+ return;
+ }
+
+ ofstream* files[5];
+ for ( Int_t i = 0; i < 5; ++i )
+ {
+ files[i]=0;
+ }
+
+ TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator());
+ AliMpBusPatch* bp;
+
+ while ( ( bp = static_cast<AliMpBusPatch*>(next()) ) )
+ {
+ Int_t ddl = bp->GetDdlId();
+
+ Int_t ldc = ddl/4;
+
+ if (!files[ldc])
+ {
+ files[ldc] = new ofstream(Form("LDC%d.conf",ldc));
+ *(files[ldc]) << "# changed" << endl;
+ }
+
+ for ( Int_t imanu = 0; imanu < bp->GetNofManus(); ++imanu )
+ {
+ *(files[ldc]) << bp->GetId() << " " << bp->GetManuId(imanu) << endl;
+ }
+ }
+
+ for ( Int_t i = 0; i < 5; ++i )
+ {
+ if ( files[i] ) files[i]->close();
+ delete files[i];
+ }
+}
+
+//______________________________________________________________________________
TMap* CreateDCSAliasMap(const char* inputCDB, Int_t runNumber)
{
/// Creates a DCS structure for MUON Tracker HV and Trigger DCS and Currents
TString& aliasName = alias->String();
if ( aliasName.Contains("sw") && sDetName.Contains("TRACKER"))
{
- // HV Switch (St345 only)
- TObjArray* valueSet = new TObjArray;
- valueSet->SetOwner(kTRUE);
- Bool_t bvalue = kTRUE;
-// Float_t r = random.Uniform();
-// if ( r < 0.007 ) value = kFALSE;
-// if ( aliasName.Contains("DE513sw2") ) value = kFALSE;
-
- for ( UInt_t timeStamp = 0; timeStamp < 60*3; timeStamp += 60 )
- {
- AliDCSValue* dcsValue = new AliDCSValue(bvalue,timeStamp);
- valueSet->Add(dcsValue);
- }
- aliasMap->Add(new TObjString(*alias),valueSet);
+ // HV Switch (St345 only)
+ TObjArray* valueSet = new TObjArray;
+ valueSet->SetOwner(kTRUE);
+ Bool_t bvalue = kTRUE;
+ // Float_t r = random.Uniform();
+ // if ( r < 0.007 ) value = kFALSE;
+ // if ( aliasName.Contains("DE513sw2") ) value = kFALSE;
+
+ for ( UInt_t timeStamp = 0; timeStamp < 60*3; timeStamp += 60 )
+ {
+ AliDCSValue* dcsValue = new AliDCSValue(bvalue,timeStamp);
+ valueSet->Add(dcsValue);
+ }
+ aliasMap->Add(new TObjString(*alias),valueSet);
}
else
{
- TObjArray* valueSet = new TObjArray;
- valueSet->SetOwner(kTRUE);
- for ( UInt_t timeStamp = 0; timeStamp < 60*15; timeStamp += 120 )
- {
- Float_t value = 0;
- if(sDetName.Contains("TRACKER")){
- value = random.Gaus(1750,62.5);
- if ( aliasName == "MchHvLvLeft/Chamber00Left/Quad2Sect1.actual.vMon") value = 500;
- }
- else if(aliasName.Contains("iMon")){
- value = random.Gaus(2.,0.4);
- }
- else {
- value = random.Gaus(8000.,16.);
- }
-
- AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp);
- valueSet->Add(dcsValue);
- }
- if ( aliasName == "MchHvLvLeft/Chamber04Left/Slat06.actual.vMon" ) continue;
- if ( aliasName == "MTR_INSIDE_MT22_RPC3_HV.vEff" ) continue;
- if ( aliasName == "MTR_OUTSIDE_MT21_RPC4_HV.actual.iMon" ) continue;
- aliasMap->Add(new TObjString(*alias),valueSet);
+ TObjArray* valueSet = new TObjArray;
+ valueSet->SetOwner(kTRUE);
+ for ( UInt_t timeStamp = 0; timeStamp < 60*15; timeStamp += 120 )
+ {
+ Float_t value = 0;
+ if(sDetName.Contains("TRACKER")){
+ value = random.Gaus(1750,62.5);
+ if ( aliasName == "MchHvLvLeft/Chamber00Left/Quad2Sect1.actual.vMon") value = 500;
+ }
+ else if(aliasName.Contains("iMon")){
+ value = random.Gaus(2.,0.4);
+ }
+ else {
+ value = random.Gaus(8000.,16.);
+ }
+
+ AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp);
+ valueSet->Add(dcsValue);
+ }
+ if ( aliasName == "MchHvLvLeft/Chamber04Left/Slat06.actual.vMon" ) continue;
+ if ( aliasName == "MTR_INSIDE_MT22_RPC3_HV.vEff" ) continue;
+ if ( aliasName == "MTR_OUTSIDE_MT21_RPC4_HV.actual.iMon" ) continue;
+ aliasMap->Add(new TObjString(*alias),valueSet);
}
} // loop on aliases
-
+
delete aliases;
} // loop on detectors (tracker and trigger)
-
-
AliMpCDB::UnloadAll();
return aliasMap;