- Modifications in the GRP preprocessor to retrieve and store CTP time info.
authorzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Oct 2009 23:44:42 +0000 (23:44 +0000)
committerzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Oct 2009 23:44:42 +0000 (23:44 +0000)
- Corresponding changes in the test macro for the GRP preprocessor
  (TestGRPPreprocessor.C), and in the one for the creation of
  dummy CTP time entries (MakeCTPDummyEntries.C).

- Commit of the CTP time file for local test, and for the nightly test in
  the Shuttle.

- Commit of the OCDB entry used to populate the testdata and data OCDB in
  alien with the CTP time Dummy entry.

GRP/MakeCTPDummyEntries.C
GRP/ShuttleInput/ctptime.tim [new file with mode: 0644]
GRP/TestGRPPreprocessor.C
OCDB/GRP/CTP/DummyCTPtime/Run0_999999999_v0_s0.root [new file with mode: 0644]
STEER/AliGRPPreprocessor.cxx

index 6bf0c36..6e0dc10 100644 (file)
@@ -8,9 +8,11 @@ void MakeCTPDummyEntries(){
        man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
        Char_t * filenameConfig = gSystem->ExpandPathName("$ALICE_ROOT/GRP/CTP/stdln.cfg");
        Char_t * filenameScalers = gSystem->ExpandPathName("$ALICE_ROOT/GRP/CTP/stdln.cnt");
+        Char_t * filenameCTPtime = gSystem->ExpandPathName("$ALICE_ROOT/GRP/CTP/stdln.tim");
 
        AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(filenameConfig);
        AliTriggerRunScalers *scalers = AliTriggerRunScalers::ReadScalers(filenameScalers);
+       AliCTPTimeParams *ctptime = AliCTPTimeParams::LoadCTPTimeParams(filenameCTPtime);
 
        AliCDBMetaData* metaconfig = new AliCDBMetaData();
        metaconfig->SetResponsible("Roman Lietava");
@@ -23,5 +25,12 @@ void MakeCTPDummyEntries(){
        metascalers->SetComment("Dummy CTP scalers for standalone runs");
        AliCDBId idscalers("GRP/CTP/DummyScalers",0,AliCDBRunRange::Infinity());
        man->Put(scalers,idscalers, metascalers);
+
+       AliCDBMetaData* metactptime = new AliCDBMetaData();
+       metactptime->SetResponsible("Roman Lietava");
+       metactptime->SetComment("Dummy CTP time params for standalone runs");
+       AliCDBId idctptime("GRP/CTP/DummyCTPtime",0,AliCDBRunRange::Infinity());
+       man->Put(ctptime,idctptime, metactptime);
+
        return;
 }
diff --git a/GRP/ShuttleInput/ctptime.tim b/GRP/ShuttleInput/ctptime.tim
new file mode 100644 (file)
index 0000000..1c7aa18
--- /dev/null
@@ -0,0 +1,4 @@
+L012 260 3952
+0ASC P 0
+0ASC P 0
+0SH1 P 0
index e19f6fa..bbdd148 100644 (file)
@@ -34,7 +34,7 @@ void TestGRPPreprocessor(const char* runtype="PHYSICS", TString partition="ALICE
 
   AliLog::SetClassDebugLevel("AliGRPPreprocessor",3);
   Int_t kRun = 7;
-  AliTestShuttle* shuttle = new AliTestShuttle(kRun, 1, 10);
+  AliTestShuttle* shuttle = new AliTestShuttle(kRun, 1000, 2000);
 
   AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
   AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestReference");
@@ -51,11 +51,16 @@ void TestGRPPreprocessor(const char* runtype="PHYSICS", TString partition="ALICE
 
   // simulating input from DAQ FXS
   if (errorLevel != 2){
-         // $ALICE_ROT to be expanded manually by the user for this test macro 
+         //$ALICE_ROOT to be expanded manually by the user for this test macro 
          shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC35", "$ALICE_ROOT/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc035_Period_LHC09c.Seq_0.tag.root");
          shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC36", "$ALICE_ROOT/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc036_Period_LHC09c.Seq_0.tag.root");
          shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC44", "$ALICE_ROOT/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc044_Period_LHC09c.Seq_0.tag.root");
          shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC45", "$ALICE_ROOT/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc045_Period_LHC09c.Seq_0.tag.root");
+         // for example:
+         //shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC35", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc035_Period_LHC09c.Seq_0.tag.root");
+         //shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC36", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc036_Period_LHC09c.Seq_0.tag.root");
+         //shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC44", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc044_Period_LHC09c.Seq_0.tag.root");
+         //shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC45", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc045_Period_LHC09c.Seq_0.tag.root");
          
   }
 
@@ -84,15 +89,36 @@ void TestGRPPreprocessor(const char* runtype="PHYSICS", TString partition="ALICE
          shuttle->SetInputTriggerConfiguration(emptybuffer);
   }
   
+  // open text file with CTP timing params
+  Char_t * fileNameTiming = gSystem->ExpandPathName("$ALICE_ROOT/GRP/ShuttleInput/ctptime.tim");
+  ifstream ifstrTiming;
+  ifstrTiming.open(fileNameTiming);
+  ifstrTiming.seekg(0,ios::end);
+  int lengthTiming = ifstrTiming.tellg();
+  const char *bufferTiming = new char[lengthTiming];
+  ifstrTiming.seekg(0,ios::beg);
+  ifstrTiming.read(bufferTiming,lengthTiming);
+  ifstrTiming.close();
+  //  const char *emptybuffer = NULL;
+
+  // simulating input from DAQ logbook_ctp_timing_params
+  if (errorLevel != 3 && errorLevel != 7 && !partition.IsNull() && detector.IsNull()) {
+                 cout << " adding ctp timing params " <<endl;
+                 shuttle->SetInputCTPTimeParams(bufferTiming);
+  }
+  else if (errorLevel == 7) {
+         shuttle->SetInputCTPTimeParams(emptybuffer);
+  }
+
   // simulating input from DAQ logbook
   if (errorLevel != 1){
-       shuttle->AddInputRunParameter("DAQ_time_start", "1233213.22");
+       shuttle->AddInputRunParameter("DAQ_time_start", "1020");
   }
   if (errorLevel != 6){
        shuttle->AddInputRunParameter("beamEnergy", "1400.");
   }
 
-  shuttle->AddInputRunParameter("DAQ_time_end",   "1345645.22");
+  shuttle->AddInputRunParameter("DAQ_time_end",   "1980");
   shuttle->AddInputRunParameter("beamType",    beamType);
   shuttle->AddInputRunParameter("numberOfDetectors", "5");
   shuttle->AddInputRunParameter("detectorMask", "34555");
@@ -196,17 +222,25 @@ TMap* CreateDCSAliasMap(Int_t errorLevel)
   aliasMap = new TMap;
   aliasMap->SetOwner(1);
   
+  /*
   // LHCState
   valueSet = new TObjArray;
   valueSet->SetOwner(1);
   dcsVal = new AliDCSValue( 'F', 2 );
   valueSet->Add(dcsVal);
   aliasMap->Add( new TObjString(fgkDCSDataPoints[0]), valueSet );
+  */
 
   // L3Polarity
   valueSet = new TObjArray;
   valueSet->SetOwner(1);
-  dcsVal = new AliDCSValue( kTRUE, 2 );
+  dcsVal = new AliDCSValue( kTRUE, 1010 );
+  valueSet->Add(dcsVal);
+  dcsVal = new AliDCSValue( kTRUE, 1100 );
+  valueSet->Add(dcsVal);
+  dcsVal = new AliDCSValue( kTRUE, 1500 );
+  valueSet->Add(dcsVal);
+  dcsVal = new AliDCSValue( kTRUE, 1990 );
   valueSet->Add(dcsVal);
   // add the following two lines to test errors for changing polarity
   //  dcsVal = new AliDCSValue( kFALSE, 2 );
@@ -216,10 +250,28 @@ TMap* CreateDCSAliasMap(Int_t errorLevel)
   // DipolePolarity
   valueSet = new TObjArray;
   valueSet->SetOwner(1);
-  dcsVal = new AliDCSValue( kTRUE, 2 );
+  dcsVal = new AliDCSValue( kTRUE, 1010 );
+  valueSet->Add(dcsVal);
+  dcsVal = new AliDCSValue( kTRUE, 1100 );
   valueSet->Add(dcsVal);
+  dcsVal = new AliDCSValue( kTRUE, 1500 );
+  valueSet->Add(dcsVal);
+  dcsVal = new AliDCSValue( kTRUE, 1990 );
   aliasMap->Add( new TObjString(fgkDCSDataPoints[2]), valueSet );
-  
+
+  // LHCLuminosity - keeping outside look to check procedure to calculate statistics values
+  valueSet = new TObjArray;
+  valueSet->SetOwner(1);
+  dcsVal = new AliDCSValue( (Float_t)2, 1010 );
+  valueSet->Add(dcsVal);
+  dcsVal = new AliDCSValue( (Float_t)4, 1100 );
+  valueSet->Add(dcsVal);
+  dcsVal = new AliDCSValue( (Float_t)6, 1200 );
+  valueSet->Add(dcsVal);
+  dcsVal = new AliDCSValue( (Float_t)8, 1985 );
+  valueSet->Add(dcsVal);
+  aliasMap->Add( new TObjString(fgkDCSDataPoints[3]), valueSet );
+
   TRandom random;
 
   Int_t maxDPindex = 0;
@@ -230,13 +282,16 @@ TMap* CreateDCSAliasMap(Int_t errorLevel)
          maxDPindex = 3;  // simulating only a few DP in case errorLevel=5
   }
 
-  for( int nAlias=3; nAlias<maxDPindex; nAlias++)  {
+  for( int nAlias=4; nAlias<maxDPindex; nAlias++)  {
          if (nAlias>=7 && nAlias < 47) continue; 
     valueSet = new TObjArray;
     valueSet->SetOwner(1);
 
+    Int_t timeStampValue[10] = { 1010, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1990};
+
+
     for (int timeStamp=0; timeStamp<10; timeStamp++) {
-      dcsVal = new AliDCSValue((Float_t) (timeStamp+1+10*nAlias), timeStamp+1);
+      dcsVal = new AliDCSValue((Float_t) (timeStamp+1+10*nAlias), timeStampValue[timeStamp]);
       valueSet->Add(dcsVal);
     }
     aliasMap->Add( new TObjString( fgkDCSDataPoints[nAlias]), valueSet );
@@ -255,7 +310,7 @@ TMap* CreateDCSAliasMap(Int_t errorLevel)
                          valueSet = new TObjArray;
                          valueSet->SetOwner(1);
                          for (int timeStamp=0; timeStamp<10; timeStamp++) {
-                                 dcsVal = new AliDCSValue((Float_t) (timeStamp+1+10*hp), timeStamp+1);
+                                 dcsVal = new AliDCSValue((Float_t) (timeStamp+1+10*hp), timeStampValue[timeStamp]);
                                  valueSet->Add(dcsVal);
                                  //cout << " hall probe = " << dpAlias << " with value = " << dcsVal->GetFloat() << endl;
                          }
diff --git a/OCDB/GRP/CTP/DummyCTPtime/Run0_999999999_v0_s0.root b/OCDB/GRP/CTP/DummyCTPtime/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..5104e47
Binary files /dev/null and b/OCDB/GRP/CTP/DummyCTPtime/Run0_999999999_v0_s0.root differ
index 33f4cfc..bc76219 100644 (file)
@@ -56,6 +56,7 @@ class AliShuttleInterface;
 #include <AliCDBMetaData.h>
 #include <AliCDBId.h>
 #include <AliTriggerConfiguration.h>
+#include <AliCTPTimeParams.h>
 
 const Double_t kFitFraction = 0.7;                 // Fraction of DCS sensor fits required
 
@@ -186,7 +187,8 @@ ClassImp(AliGRPPreprocessor)
                    "(Trigger Scalers not found in DCS FXS - ERROR)",
                    "(DCS data points ERROR)",
                    "(Trigger Configuration ERROR)",
-                   "(DAQ logbook ERROR determining partition of the run)"
+                   "(DAQ logbook ERROR determining partition of the run)",
+                   "(CTP timing ERROR)"
   };
 
 //_______________________________________________________________
@@ -396,6 +398,74 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap)
                error |= 32;
        }
 
+        //===========================//
+       // Trigger Timing Parameters //
+        //===========================//
+
+       
+       const char * triggerCTPtiming = GetCTPTimeParams();
+
+       if (partition.IsNull() && !detector.IsNull()){ // standalone partition
+               Log("STANDALONE partition for current run, using CTP timing params dummy value");
+               AliCDBEntry *cdbEntry = GetFromOCDB("CTP","DummyCTPtime");
+               if (!cdbEntry) {
+                       Log(Form("No dummy CTP timing parameters entry found, going into error..."));
+                       error |= 64;
+               }
+               else{
+                       AliCTPTimeParams *runCTPtiming = (AliCTPTimeParams*)cdbEntry->GetObject();
+                       if (!runCTPtiming){
+                               Log(Form("dummy CTP timing parameters not found in OCDB entry, going into error..."));
+                               error |= 64;
+                       }
+                       else {
+                               TString titleCTPtiming = Form("CTP timing params for run %i from Dummy entry in OCDB",fRun);
+                               runCTPtiming->SetTitle(titleCTPtiming);
+                               AliCDBMetaData metadata;
+                               metadata.SetResponsible("Roman Lietava");
+                               metadata.SetComment("CTP run timing parameters from dummy entry in OCDB");
+                               if (!Store("CTP","CTPtiming", runCTPtiming, &metadata, 0, 0)) {
+                                       Log("Unable to store the dummy CTP timing params object to OCDB!");
+                                       error |= 64;
+                               }
+                       }
+               }
+       }
+
+       else if (!partition.IsNull() && detector.IsNull()){ // global partition
+               Log("GLOBAL partition for current run, using Trigger Timing Parameters from DAQ Logbook");
+               if (triggerCTPtiming!= NULL) {
+                       Log("Found trigger timing params in DAQ logbook");
+                       AliDebug(2,Form("%s",triggerCTPtiming));
+                       AliCTPTimeParams *runCTPtiming = runCTPtiming = AliCTPTimeParams::LoadCTPTimeParamsFromString(triggerCTPtiming);          
+                       if (!runCTPtiming) {
+                               Log("Bad CTP trigger timing params file from DAQ logbook! The corresponding CDB entry will not be filled!");
+                               error |= 64;
+                       }
+                       else {
+                               TString titleCTPtiming = Form("CTP timing params for run %i from DAQ",fRun);
+                               runCTPtiming->SetTitle(titleCTPtiming);
+                               AliCDBMetaData metadata;
+                               metadata.SetBeamPeriod(0);
+                               metadata.SetResponsible("Roman Lietava");
+                               metadata.SetComment("CTP timing params from DAQ logbook");
+                               if (!Store("CTP","CTPtiming", runCTPtiming, &metadata, 0, 0)) {
+                                       Log("Unable to store the CTP timing params object to OCDB!");
+                                       error |= 64;
+                               }
+                       }
+               }
+
+               else {
+                       Log("Trigger timing params NULL in DAQ logbook");
+                       error |= 64;
+               }
+       }
+
+       else {
+               Log(Form("Incorrect field in DAQ logbook for partition = %s and detector = %s, going into error without trigger timing parameters...",partition.Data(),detector.Data()));
+               error |= 32;
+       }
        // storing AliGRPObject in OCDB
 
        AliCDBMetaData md;
@@ -410,13 +480,14 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap)
                Log("GRP Preprocessor Success");
                return 0;
        } else {
-               Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s%s%s",
+               Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s%s%s%s",
                          kppError[(error&1)?1:0],
                          kppError[(error&2)?2:0],
                          kppError[(error&4)?3:0],
                          kppError[(error&8)?4:0],
                          kppError[(error&16)?5:0],
-                         kppError[(error&32)?6:0]
+                         kppError[(error&32)?6:0],
+                         kppError[(error&64)?7:0]
                          ));
                return error;
        }