X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FTestMUONPreprocessor.C;h=340879a38a3e844186eefa5275ed892766ddd67d;hb=91870222f85b1ba7bd535116951c2fa7abc099e0;hp=53447cee5ecacd3155e2b972b296de1f4f9b8c0f;hpb=49419555ad4a62c37cff03b3263946838aee56db;p=u%2Fmrichter%2FAliRoot.git
diff --git a/MUON/TestMUONPreprocessor.C b/MUON/TestMUONPreprocessor.C
index 53447cee5ec..340879a38a3 100644
--- a/MUON/TestMUONPreprocessor.C
+++ b/MUON/TestMUONPreprocessor.C
@@ -24,6 +24,38 @@
/// This macro runs the test preprocessor for MUON.
/// It uses AliTestShuttle to simulate a full Shuttle process
///
+/// You must load relevant libraries (besides normal MUON ones -which is done
+/// easily by executing root from the $ALICE_ROOT/MUON directory to use
+/// the rootlogon.C there) before compiling this macro :
+///
+/// gSystem->Load("$ALICE_ROOT/SHUTTLE/TestShuttle/libTestShuttle");
+/// gSystem->Load("libMUONshuttle");
+///
+/// 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...
+///
+/// You must also make a link of some OCDB entries to have the mapping loaded
+/// correctly :
+///
+///
+/// cd $ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestCDB
+/// mkdir -p MUON/Calib
+/// cd MUON/Calib
+/// ln -si $ALICE_ROOT/OCDB/MUON/Calib/MappingData .
+///
+///
+/// and Align/Baseline if you'd like to test GMS subprocessor :
+///
+///
+/// cd $ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestCDB
+/// mkdir -p MUON/Align
+/// cd MUON/Align
+/// ln -si $ALICE_ROOT/OCDB/MUON/Align/Baseline .
+///
+///
/// The input data has to be created first by other processes (or is created
/// here by CreateDCSAliasMap() for tracker HV).
///
@@ -32,16 +64,57 @@
/// - b) select run type, using shuttle->AddInputRunParameter() (the run type
/// dictates which task is really performed by the MUONPreprocessor
///
-/// You must load relevant libraries (besides normal MUON ones) before
-/// compiling this macro :
+/// The sourceDirectory is there to "emulate" what the real preprocessor will
+/// find on the FXS, and is assumed to have the following structure :
///
-/// gSystem->Load("$ALICE_ROOT/SHUTTLE/TestShuttle/libTestShuttle");
-/// gSystem->Load("libMUONshuttle.so");
+/// CONFIG/
+/// LDC0.config
+/// LDC1.config
+/// LDC2.config
+/// LDC3.config
+/// GAINS/
+/// LDC0.gain
+/// LDC1.gain
+/// LDC2.gain
+/// LDC3.gain
+/// GMS/
+/// GMS.root
+/// OCCUPANCY/
+/// mch.occupancy
+/// PEDESTALS/
+/// LDC0.ped
+/// 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
+/// MtgLocalLut-1.dat
+/// MtgLocalMask-1.dat
+/// MtgRegionalCrate-1.dat
+///
+///
+/// IMPORTANT:
+/// The trigger files have to be present in order for the algorithm to work correctly.
+/// If you want to test the Trigger DCS maps only, but you don't have the .dat trigger files,
+/// you have to create dummy files through :
+///
+/// cd sourceDirectory/TRIGGER
+/// echo -e "MtgLocalMask-1.dat\nMtgRegionalCrate-1.dat\nMtgGlobalCrate-1.dat\nMtgLocalLut-1.dat" > ExportedFiles.dat
+/// touch MtgLocalMask-1.dat MtgRegionalCrate-1.dat MtgGlobalCrate-1.dat MtgLocalLut-1.dat
///
///
/// For more information on usage, please see the \ref README_shuttle page.
///
-/// \author Laurent Aphecetche, SUBATECH Nantes
+/// \author Laurent Aphecetche, SUBATECH Nantes; \n
+/// Diego Stocco, SUBATECH Nantes
#include "TestMUONPreprocessor.h"
@@ -50,9 +123,11 @@
#include "AliLog.h"
+#include "AliMpBusPatch.h"
#include "AliMpExMap.h"
#include "AliMpHelper.h"
-#include "AliMpHVNamer.h"
+#include "AliMpDDLStore.h"
+#include "AliMpDCSNamer.h"
#include "AliMpCDB.h"
#include "AliCDBManager.h"
@@ -71,7 +146,10 @@
#include "TRandom.h"
#endif
-void TestMUONPreprocessor(Int_t runNumber=80, const char* runType="CALIBRATION")
+//______________________________________________________________________________
+void TestMUONPreprocessor(Int_t runNumber=80,
+ const char* runType="CALIBRATION",
+ const char* sourceDirectory="/afs/cern.ch/user/l/laphecet/public")
{
// runType can be :
//
@@ -79,24 +157,30 @@ void TestMUONPreprocessor(Int_t runNumber=80, const char* runType="CALIBRATION")
// CALIBRATION -> gains
// PHYSICS -> HV
// GMS
-
+
// 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/SHUTTLE/TestShuttle/TestCDB";
-
+ const char* inputCDB = "local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestCDB";
+ //const char* inputCDB = "alien://folder=/alice/testdata/2008/TS08a/OCDB";
+
AliTestShuttle::SetMainCDB(inputCDB);
- AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestReference");
+ AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestReference");
TString rt(runType);
rt.ToUpper();
if ( rt.Contains("PHYSICS") )
{
- // Create DCS HV aliases
+ // Create DCS aliases
+ UInt_t startTime, endTime;
+
TMap* dcsAliasMap = CreateDCSAliasMap(inputCDB, runNumber);
-
+
if ( dcsAliasMap )
{
// now give the alias map to the shuttle
@@ -119,41 +203,43 @@ void TestMUONPreprocessor(Int_t runNumber=80, const char* runType="CALIBRATION")
// AddInputFile(, , , , )
// In this example we add 4 files originating from different LDCs but with the same id (PEDESTALS)
-// shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC0","$ALICE_ROOT/MUON/data/LDC0.ped");
-// shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC1","$ALICE_ROOT/MUON/data/LDC1.ped");
-// shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC2","$ALICE_ROOT/MUON/data/LDC2.ped");
-// shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC3","$ALICE_ROOT/MUON/data/LDC3.ped");
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC0",Form("%s/PEDESTALS/LDC0.ped",sourceDirectory));
+ 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","PEDESTALS","LDC0","$HOME/Alice/Online/GAINRUN/raw.81.LDC0.ped");
- shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC1","$HOME/Alice/Online/GAINRUN/raw.81.LDC1.ped");
- shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC2","$HOME/Alice/Online/GAINRUN/raw.81.LDC2.ped");
-// shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC3","$HOME/Alice/Online/GAINRUN/raw.81.LDC3.ped");
+ 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","$HOME/Desktop/Jean-Luc Charvet/run000001191_MCH_ldc-MTRK-S1-0_GAINS");
+ 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->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC3",Form("%s/GAINS/LDC3.gain",sourceDirectory));
-// shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC0","$HOME/Desktop/Jean-Luc Charvet/run000001183_MCH_ldc-MTRK-S1-0_GAINS");
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","OCCUPANCY","MON",Form("%s/OCCUPANCY/mch.occupancy",sourceDirectory));
- shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC0","$HOME/Alice/Online/GAINRUN/LDC0.gain");
-// shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC1","$ALICE_ROOT/MUON/data/LDC1.gain");
-// shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC2","$ALICE_ROOT/MUON/data/LDC2.gain");
-// shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC3","$ALICE_ROOT/MUON/data/LDC3.gain");
-
// and GMS file
- shuttle->AddInputFile(AliTestShuttle::kDCS,"MCH","GMS","GMS","$ALICE_ROOT/MUON/data/GMS.root");
+ shuttle->AddInputFile(AliTestShuttle::kDCS,"MCH","GMS","GMS",Form("%s/GMS/GMS.root",sourceDirectory));
// and then the trigger stuff
- shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","LOCAL","LDC0","$ALICE_ROOT/MUON/data/MtgLocalMask-1.dat");
- shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","REGIONAL","LDC0","$ALICE_ROOT/MUON/data/MtgRegionalCrate-1.dat");
- shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","GLOBAL","LDC0","$ALICE_ROOT/MUON/data/MtgGlobalCrate-1.dat");
- shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","LUT","LDC0","$ALICE_ROOT/MUON/data/MtgLocalLut-1.dat");
- shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","EXPORTED","LDC0","$ALICE_ROOT/MUON/data/ExportedFiles.dat");
-
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","LOCAL","LDC0",Form("%s/TRIGGER/MtgLocalMask-1.dat",sourceDirectory));
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","REGIONAL","LDC0",Form("%s/TRIGGER/MtgRegionalCrate-1.dat",sourceDirectory));
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","GLOBAL","LDC0",Form("%s/TRIGGER/MtgGlobalCrate-1.dat",sourceDirectory));
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","LUT","LDC0",Form("%s/TRIGGER/MtgLocalLut-1.dat",sourceDirectory));
+ shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","EXPORTED","LDC0",Form("%s/TRIGGER/ExportedFiles.dat",sourceDirectory));
+
// The shuttle can read run parameters stored in the DAQ run logbook.
// To test it, we must provide the run parameters manually. They will be retrieved in the preprocessor
// using GetRunParameter function.
// In real life the parameters will be retrieved automatically from the run logbook;
shuttle->SetInputRunType(runType);
+ shuttle->AddInputRunParameter("totalEvents","20");
+
// Create the preprocessor that should be tested, it registers itself automatically to the shuttle
new AliMUONTrackerPreprocessor(shuttle);
new AliMUONTriggerPreprocessor(shuttle);
@@ -164,9 +250,73 @@ void TestMUONPreprocessor(Int_t runNumber=80, const char* runType="CALIBRATION")
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(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
+ /// Creates a DCS structure for MUON Tracker HV and Trigger DCS and Currents
///
/// The structure is the following:
/// TMap (key --> value)
@@ -203,50 +353,72 @@ TMap* CreateDCSAliasMap(const char* inputCDB, Int_t runNumber)
aliasMap->SetOwner(kTRUE);
TRandom random(0);
+
+ const Char_t* detName[2] = { "TRACKER", "TRIGGER" };
+
+ for(Int_t idet=0; idet<2; idet++){
+
+ TString sDetName(detName[idet]);
+ sDetName.ToUpper();
- AliMpHVNamer hvNamer;
+ AliMpDCSNamer dcsNamer(detName[idet]);
- TObjArray* aliases = hvNamer.GenerateAliases();
+ TObjArray* aliases = dcsNamer.GenerateAliases();
- for ( Int_t i = 0; i < aliases->GetEntries(); ++i )
- {
- TObjString* alias = static_cast(aliases->At(i));
- TString& aliasName = alias->String();
- if ( aliasName.Contains("sw") )
+ for ( Int_t i = 0; i < aliases->GetEntries(); ++i )
{
- // HV Switch (St345 only)
- TObjArray* valueSet = new TObjArray;
- valueSet->SetOwner(kTRUE);
- Bool_t value = 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 )
+ TObjString* alias = static_cast(aliases->At(i));
+ TString& aliasName = alias->String();
+ if ( aliasName.Contains("sw") && sDetName.Contains("TRACKER"))
{
- AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp);
- valueSet->Add(dcsValue);
+ // 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);
}
- aliasMap->Add(new TObjString(*alias),valueSet);
- }
- else
- {
- TObjArray* valueSet = new TObjArray;
- valueSet->SetOwner(kTRUE);
- for ( UInt_t timeStamp = 0; timeStamp < 60*15; timeStamp += 120 )
+ else
{
- Float_t value = random.Gaus(1750,62.5);
- if ( aliasName == "MchHvLvLeft/Chamber00Left/Quad2Sect1.actual.vMon") value = 500;
- AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp);
- valueSet->Add(dcsValue);
+ 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);
}
- if ( aliasName == "MchHvLvLeft/Chamber04Left/Slat06.actual.vMon" ) continue;
- aliasMap->Add(new TObjString(*alias),valueSet);
- }
- }
-
- delete aliases;
+ } // loop on aliases
+ delete aliases;
+ } // loop on detectors (tracker and trigger)
+
+ AliMpCDB::UnloadAll();
+
return aliasMap;
}