]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliGRPPreprocessor.cxx
Fix fixed-string length bug
[u/mrichter/AliRoot.git] / STEER / AliGRPPreprocessor.cxx
index e392ee214d704e8633ebb088d856bd6950df737a..2d7c13e6552ad061dd72697586b649b76f1146d0 100644 (file)
@@ -60,22 +60,22 @@ ClassImp(AliGRPPreprocessor)
 
 //_______________________________________________________________
   const Int_t AliGRPPreprocessor::fgknDAQLbPar = 8; // num parameters in the logbook
-  const Int_t AliGRPPreprocessor::fgknDCSDP = 11;   // number of dcs dps
+  const Int_t AliGRPPreprocessor::fgknDCSDP = 10;   // number of dcs dps
   const char* AliGRPPreprocessor::fgkDCSDataPoints[AliGRPPreprocessor::fgknDCSDP] = {
-                   "LHCState",                         // missing in DCS
+                   "LHCState",              // missing in DCS
                    "L3Polarity",
                    "DipolePolarity",
-                   "LHCLuminosity",            // missing in DCS
-                   "BeamIntensity",            // missing in DCS
+                   "LHCLuminosity",         // missing in DCS
+                   "BeamIntensity",         // missing in DCS
                    "L3Current",
                    "DipoleCurrent",
                    "CavernTemperature",
                    "CavernAtmosPressure",
-                   "gva_cr5AtmosphericPressure", // missing in DCS
-                   "gva_meyrinAtmosphericPressure" // missing in DCS
+                   "SurfaceAtmosPressure"
                  };
                  
   const Short_t kSensors = 9; // start index position of sensor in DCS DPs
+  const Short_t kNumSensors = 1; // Number of sensors in DCS DPs
 
   const char* AliGRPPreprocessor::fgkLHCState[20] = {
                    "P", "PREPARE",
@@ -95,12 +95,13 @@ ClassImp(AliGRPPreprocessor)
                    "(DAQ logbook ERROR)",
                    "(DAQ FXS ERROR)",
                    "(DCS FXS ERROR)",
-                   "(DCS data points ERROR)"
+                   "(DCS data points ERROR)",
+                   "(Trigger Configuration ERROR)"
   };
 
 //_______________________________________________________________
 AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
-  AliPreprocessor("GRP",shuttle), fPressure(0)
+       AliPreprocessor("GRP",shuttle),  fPressure(0)
 {
   // constructor - shuttle must be instantiated!
 
@@ -123,9 +124,8 @@ void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
   AliPreprocessor::Initialize(run, startTime, endTime);
 
   AliInfo("Initialization of the GRP preprocessor.");
-
-  TClonesArray * array = new TClonesArray("AliDCSSensor",2);
-  for(Int_t j = 0; j < 2; j++) {
+  TClonesArray * array = new TClonesArray("AliDCSSensor",kNumSensors); 
+  for(Int_t j = 0; j < kNumSensors; j++) {
     AliDCSSensor * sens = new ((*array)[j])AliDCSSensor;
     sens->SetStringID(fgkDCSDataPoints[j+kSensors]);
   }
@@ -177,11 +177,66 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap)
   // DCS data points //
   //=================//
   Int_t entries = ProcessDcsDPs( valueMap, grpmap );
-  if( entries < fgknDCSDP-5 ) { // FIXME (!= ) LHCState and pressure map are not working yet...
+  if( entries < fgknDCSDP-3 ) { // FIXME (!= ) LHState and pressure map are not working yet...
     Log(Form("Problem with the DCS data points!!!"));
     error |= 8;
   } else  Log(Form("DCS data points, successful!"));
 
+  //=======================//
+  // Trigger Configuration //
+  //=======================//
+  // either from DAQ logbook.....
+  const char * triggerConf = GetTriggerConfiguration();
+  if (triggerConf!= NULL) {
+    Log("Found trigger configuration in DAQ logbook");
+    AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConf);         
+    if (!runcfg) {
+      Log("Bad CTP run configuration file from DAQ logbook! The corresponding CDB entry will not be filled!");
+      error |= 16;
+    }
+    else {
+      TString titleCTPcfg = Form("CTP cfg for run %i from DAQ",fRun);
+      runcfg->SetTitle(titleCTPcfg);
+      AliCDBMetaData metaData;
+      metaData.SetBeamPeriod(0);
+      metaData.SetResponsible("Roman Lietava");
+      metaData.SetComment("CTP run configuration from DAQ logbook");
+      if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
+        Log("Unable to store the CTP run configuration object to OCDB!");
+       error |= 16;
+      }
+    }
+  }
+  // ...or from DCS FXS
+  else{
+     Log("No trigger configuration found in the DAQ logbook!! Trying reading from DCS FXS...");
+     TString runcfgfile = GetFile(kDCS, "CTP_runconfig", "");
+     if (runcfgfile.IsNull()) {
+       Log("No CTP runconfig files has been found in DCS FXS!");
+       error |= 16;
+     }
+     else {
+       Log(Form("File with Id CTP_runconfig found! Copied to %s",runcfgfile.Data()));
+       AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
+       if (!runcfg) {
+         Log("Bad CTP run configuration file from DCS FXS! The corresponding CDB entry will not be filled!");
+         error |= 16;;
+       }
+       else {
+        TString titleCTPcfg = Form("CTP cfg for run %i from DCS",fRun);
+         runcfg->SetTitle(titleCTPcfg);
+         AliCDBMetaData metaData;
+         metaData.SetBeamPeriod(0);
+         metaData.SetResponsible("Roman Lietava");
+         metaData.SetComment("CTP run configuration from DCS FXS");
+         if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
+           Log("Unable to store the CTP run configuration object to OCDB!");
+           error |= 16;
+         }
+       }
+     }
+  }
+
   grpmap->SetOwner(1);
   AliInfo(Form("Final list entries: %d",grpmap->GetEntries()));
   
@@ -197,11 +252,12 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap)
     Log("GRP Preprocessor Success");
     return 0;
   } else {
-    Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s",
+    Log( Form("GRP Preprocessor FAILS!!! %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&8)?4:0],
+                                 kppError[(error&16)?5:0]
                                   ));
     return error;
   }
@@ -212,8 +268,8 @@ TMap *AliGRPPreprocessor::ProcessDaqLB()
 {
   //Getting the DAQ lb information
   
-  const char* timeStart         = GetRunParameter("time_start");
-  const char* timeEnd           = GetRunParameter("time_end");
+  const char* timeStart         = GetRunParameter("DAQ_time_start");
+  const char* timeEnd           = GetRunParameter("DAQ_time_end");
   const char* beamEnergy        = GetRunParameter("beamEnergy");
   const char* beamType          = GetRunParameter("beamType");
   const char* numberOfDetectors = GetRunParameter("numberOfDetectors");
@@ -365,7 +421,9 @@ UInt_t AliGRPPreprocessor::ProcessDcsFxs()
   // Get the CTP run configuration
   // and scalers from DCS FXS
 
+/*
   {
+
     // Get the CTP run configuration
     TList* list = GetFileSources(kDCS,"CTP_runconfig");  
     if (!list) {
@@ -406,7 +464,7 @@ UInt_t AliGRPPreprocessor::ProcessDcsFxs()
     }
     delete list;
   }
-
+*/
   {
     // Get the CTP counters information
     TList* list = GetFileSources(kDCS,"CTP_xcounters");  
@@ -616,20 +674,23 @@ Int_t AliGRPPreprocessor::ProcessDcsDPs(TMap* valueMap, TMap* mapDCS)
 
 
    // NEEDS TO BE REVISED, CONFIRMED
-   AliInfo(Form("==========GenevaPressureMaps==========="));
-   AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap,fPressure);
+   AliInfo(Form("==========P2PressureMap==========="));
+   AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap);
    if( fPressure->NumFits()==0 ) {
      Log("Problem with the pressure sensor values!!!");
-   } else {
-      AliDCSSensor* sensorCr5 = dcsSensorArray->GetSensor(fgkDCSDataPoints[9]);
-      if( sensorCr5->GetFit() ) {
-        Log(Form("<GvaCr5Pressure> for run %d: Sensor Fit found",fRun));
-        mapDCS->Add( new TObjString("fCr5Pressure"), sensorCr5 );
+   } 
+   else {
+      AliDCSSensor* sensorP2 = dcsSensorArray->GetSensor(fgkDCSDataPoints[9]);
+      if( sensorP2->GetFit() ) {
+        Log(Form("<P2Pressure> for run %d: Sensor Fit found",fRun));
+        mapDCS->Add( new TObjString("fP2Pressure"), sensorP2 );
         ++entries;
-      } else {
+      } 
+      else {
         Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[9] ));
       }
       
+      /*
       AliDCSSensor* sensorMeyrin = dcsSensorArray->GetSensor(fgkDCSDataPoints[10]);
       if( sensorMeyrin->GetFit() ) {
         Log(Form("<MeyrinPressure> for run %d: Sensor Fit found",fRun));
@@ -638,14 +699,14 @@ Int_t AliGRPPreprocessor::ProcessDcsDPs(TMap* valueMap, TMap* mapDCS)
       } else {
         Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[10] ));
       }
-
+      */
    }
 
   return entries;
 }
 
 //_______________________________________________________________
-AliDCSSensorArray *AliGRPPreprocessor::GetPressureMap(TMap* dcsAliasMap, AliDCSSensorArray *fPressure)
+AliDCSSensorArray *AliGRPPreprocessor::GetPressureMap(TMap* dcsAliasMap)
 {
   // extract DCS pressure maps. Perform fits to save space