********** Following discussion at Offline Week, 19 March 2010
authorzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 Mar 2010 16:34:31 +0000 (16:34 +0000)
committerzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 Mar 2010 16:34:31 +0000 (16:34 +0000)
- Implementing aliases:
energy -> LHC_Beam_Energy
machine mode -> LHC_MachineMode
beam mode -> LHC_BeamMode
beam types 1/2 -> not yet defined
- Implementing check on the time stamps for machine mode and beam mode
- Updating test files (local + nightly shuttle tests)

GRP/ShuttleInput/testRun_GRP_run_number_testRun_data.txt
GRP/ShuttleInput/testShuttle_GRP_run_number_testShuttle_data.txt
STEER/AliGRPPreprocessor.cxx

index 604b932..cd9675b 100644 (file)
@@ -1,11 +1,11 @@
 LHC_ENTRIES    64\r
-0      lhcMon_LHCBeam.Energy   i:1     10      3752    1020.680        3751    1021.940        3752    1022.200        3751    1023.460        3752    1024.980        3751    1005.240        3752    1006.500        3751    1007.760        3752    1008.280        3751    1009.540\r
+0      LHC_Beam_Energy i:1     10      3752    1020.680        3751    1021.940        3752    1022.200        3751    1023.460        3752    1024.980        3751    1005.240        3752    1006.500        3751    1007.760        3752    1008.280        3751    1009.540\r
 1      lhcMon_LHCIntensityBeam1.totalIntensity f:1     5       56037552334.431664      1020.0  56392545816.963661      1021.0  55815681407.849152      1022.0  56870307878.871315      1023.0  57936471638.075775      1024.0  \r
 2      lhcMon_LHCIntensityBeam2.totalIntensity f:1     5       71143942900.913422      1020.0  71092334378.715363      1021.0  70901421649.982712      1022.0  72992148850.006042      1023.0  72566669567.373245      1024.0\r
 3      lhcMon_LHCLumAverageBRANB.4L2.meanLuminosity    f:1     4       0.069952        1020.1  0.069253        1021.1  0.068560        1022.1  0.067874        1023.1  \r
 4      lhcMon_LHCLumAverageBRANB.4R2.meanLuminosity    f:1     4       0.253554        1020.1  0.251018        1021.1  0.248508        1022.1  0.246023        1023.1  \r
-5      lhcMon_LHCMachineMode.value     s:1     2       BEAM SETUP      1260525283.679  CICCIO          126055300.000   \r
-6      lhcMon_LHCBeamMode.value        s:1     1       STABLE BEAMS    1020.703        \r
+5      LHC_MachineMode s:1     2       BEAM SETUP      1020    CICCIO          1030    \r
+6      LHC_BeamMode    s:1     1       STABLE BEAMS    1020.702        \r
 7      dip/acc/LHC/RunControl/BeamType/Beam1.payload   i:1     1       0       1020.78 \r
 8      dip/acc/LHC/RunControl/BeamType/Beam2.payload   i:1     1       0       1020.78 \r
 9      dip/acc/LHC/Machine/CollimatorPositions/TCLIA.4R2.lvdt_gap_downstream   f:1     4       39.938952       1020.429        39.938831       1021.429        39.938908       1022.429        39.938830       1023.429\r
index a1b245b..1b95e76 100644 (file)
@@ -1,11 +1,11 @@
 LHC_ENTRIES    64
-0      lhcMon_LHCBeam.Energy   i:1     5       3752    1268214810.680  3751    1268214811.940  3752    1268214812.200  3751    1268214813.460  3752    1268214814.980  
+0      LHC_Beam_Energy i:1     5       3752    1268214810.680  3751    1268214811.940  3752    1268214812.200  3751    1268214813.460  3752    1268214814.980  
 1      lhcMon_LHCIntensityBeam1.totalIntensity f:1     5       56037552334.431664      1268214810.0    56392545816.963661      1268214811.0    55815681407.849152      1268214812.0    56870307878.871315      1268214813.0    57936471638.075775      1268214814.0    
 2      lhcMon_LHCIntensityBeam2.totalIntensity f:1     5       71143942900.913422      1268214810.0    71092334378.715363      1268214811.0    70901421649.982712      1268214812.0    72992148850.006042      1268214813.0    72566669567.373245      1268214814.0
 3      lhcMon_LHCLumAverageBRANB_4L2.meanLuminosity    f:1     4       0.069952        1268214810.1    0.069253        1268214811.1    0.068560        1268214812.1    0.067874        1268214813.1    
 4      lhcMon_LHCLumAverageBRANB_4R2.meanLuminosity    f:1     4       0.253554        1268214810.1    0.251018        1268214811.1    0.248508        1268214812.1    0.246023        1268214813.1    
-5      lhcMon_LHCMachineMode.value     s:1     2       BEAM SETUP      1260525283.679  CICCIO          126055300.000   
-6      lhcMon_LHCBeamMode.value        s:1     1       STABLE BEAMS    1268214810.703  
+5      LHC_MachineMode s:1     2       BEAM SETUP      1260525283.679  CICCIO          126055300.000   
+6      LHC_BeamMode    s:1     1       STABLE BEAMS    1268214810.703  
 7      dip_acc_LHC_RunControl_BeamType_Beam1.payload   i:1     1       0       1268214810.78   
 8      dip_acc_LHC_RunControl_BeamType_Beam2.payload   i:1     1       0       1268214810.78   
 9      lhcMon_LHCCollimatorPos_TCLIA_4R2.lvdt_gap_downstream   f:1     4       39.938952       1268214810.429  39.938831       1268214811.429  39.938908       1268214812.429  39.938830       1268214813.429
index bd45636..9035388 100644 (file)
@@ -177,9 +177,9 @@ ClassImp(AliGRPPreprocessor)
 
 
   const char* AliGRPPreprocessor::fgkLHCDataPoints[AliGRPPreprocessor::fgknLHCDP] = {
-         "lhcMon_LHCBeam.Energy",
-         "lhcMon_LHCMachineMode.value",
-         "lhcMon_LHCBeamMode.value",
+         "LHC_Beam_Energy",
+         "LHC_MachineMode",
+         "LHC_BeamMode",
           "dip/acc/LHC/RunControl/BeamType/Beam1.payload",
           "dip/acc/LHC/RunControl/BeamType/Beam2.payload"
   };
@@ -616,51 +616,107 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                        }       
                        Double_t timeBeamMode = 0;
                        Double_t timeMachineMode = 0;
+                       Bool_t flagBeamMode = kFALSE;  //flag set true if at least one BeamMode measurement is found within DAQ_time_start and DAQ_time_end
+                       Bool_t flagMachineMode = kFALSE;  //flag set true if at least one MachineMode measurement is found within DAQ_time_start and DAQ_time_end
                        // BeamMode
                        TObjArray* beamModeArray = (TObjArray*)lhcMap->GetValue(fgkLHCDataPoints[2]);
-                       if (beamModeArray){             
-                               if (beamModeArray->GetEntries()==0){
-                                       AliInfo("No Beam Mode found, setting it to UNKNOWN");
+                       Int_t nBeamMode = -1;
+                       if (beamModeArray){     
+                               nBeamMode = beamModeArray->GetEntries();        
+                               if (nBeamMode==0){
+                                       AliInfo("Found zero entries for  the Beam Mode, setting it to UNKNOWN");
                                        grpobj->SetLHCState("UNKNOWN");
                                }
                                else{
-                                       AliDCSArray* beamMode = (AliDCSArray*)beamModeArray->At(0);
-                                       TObjString* beamModeString = beamMode->GetStringArray(0);
-                                       if (beamModeArray->GetEntries()>1){
-                                               AliDCSArray* beamMode1 = (AliDCSArray*)beamModeArray->At(1);
-                                               timeBeamMode = beamMode1->GetTimeStamp();
-                                               AliWarning(Form("The beam mode changed at timestamp %f! Setting it to the first value found and setting MaxTimeLHCValidity",timeBeamMode));
+                                       if (nBeamMode==1){
+                                               AliDCSArray* beamMode = (AliDCSArray*)beamModeArray->At(0);
+                                               if (beamMode->GetTimeStamp()>=timeStart && beamMode->GetTimeStamp()<=timeEnd){
+                                                       TObjString* beamModeString = beamMode->GetStringArray(0);
+                                                       AliInfo(Form("LHC State (corresponding to BeamMode) = %s",(beamModeString->String()).Data()));
+                                                       grpobj->SetLHCState(beamModeString->String());
+                                               }
+                                               else{
+                                                       AliInfo("No Beam Mode found within DAQ_time_start and DAQ_time_end, setting it to UNKNOWN");
+                                                       grpobj->SetLHCState("UNKNOWN");
+                                               }
+                                       }
+                                       else {
+                                               for (Int_t iBeamMode = 0; iBeamMode<nBeamMode; iBeamMode++){
+                                                       AliDCSArray* beamMode = (AliDCSArray*)beamModeArray->At(iBeamMode);
+                                                       if (beamMode->GetTimeStamp()>=timeStart && beamMode->GetTimeStamp()<=timeEnd){
+                                                               AliDCSArray* beamMode1 = (AliDCSArray*)beamModeArray->At(iBeamMode+1);
+                                                               if (beamMode1->GetTimeStamp()>=timeStart && beamMode1->GetTimeStamp()<=timeEnd){
+                                                                       timeBeamMode = beamMode1->GetTimeStamp();
+                                                                       AliWarning(Form("The beam mode changed at timestamp %f! Setting it to the first value found and keeping track of the time of the change to set MaxTimeLHCValidity afterward",timeBeamMode));
+                                                               }
+                                                               TObjString* beamModeString = beamMode->GetStringArray(0);
+                                                               AliInfo(Form("LHC State (corresponding to BeamMode) = %s",(beamModeString->String()).Data()));
+                                                               grpobj->SetLHCState(beamModeString->String());
+                                                               flagBeamMode = kTRUE;
+                                                               break;
+                                                       }
+                                               }
+                                               if (!flagBeamMode){
+                                                       AliError("Found values for BeamMode, but none within DAQ_time_start and DAQ_time_end, setting BeamMode to UNKNOWN");
+                                                       grpobj->SetLHCState("UNKONWN");
+                                               }
                                        }
-                                       AliInfo(Form("LHC State (corresponding to BeamMode) = %s",(beamModeString->String()).Data()));
-                                       grpobj->SetLHCState(beamModeString->String());
                                }
-                               
                        }
                        else{
                                AliError("Beam mode array not found in LHC Data file!!!");
                        }
+
                        // MachineMode
                        TObjArray* machineModeArray = (TObjArray*)lhcMap->GetValue(fgkLHCDataPoints[1]);
+                       Int_t nMachineMode = -1;
                        if (machineModeArray){
-                               if (machineModeArray->GetEntries()==0){
+                               nMachineMode = machineModeArray->GetEntries();
+                               if (nMachineMode==0){
                                        AliInfo("No Machine Mode found, setting it to UNKNOWN");
                                        grpobj->SetMachineMode("UNKNOWN");
                                }
                                else{
-                                       AliDCSArray* machineMode = (AliDCSArray*)machineModeArray->At(0);
-                                       TObjString* machineModeString = machineMode->GetStringArray(0);
-                                       if (machineModeArray->GetEntries()>1){
-                                               AliDCSArray* machineMode1 = (AliDCSArray*)machineModeArray->At(1);
-                                               timeMachineMode = machineMode1->GetTimeStamp();
-                                               AliWarning(Form("The Machine Mode changed at timestamp %f! Setting it to the first value found and setting MaxTimeLHCValidity",timeMachineMode));
+                                       if (nMachineMode ==1) {
+                                               AliDCSArray* machineMode = (AliDCSArray*)machineModeArray->At(0);
+                                               if (machineMode->GetTimeStamp()>=timeStart && machineMode->GetTimeStamp()<=timeEnd){
+                                                       TObjString* machineModeString = machineMode->GetStringArray(0);
+                                                       AliInfo(Form("Machine Mode = %s",(machineModeString->String()).Data()));
+                                                       grpobj->SetMachineMode(machineModeString->String());
+                                               }
+                                               else{
+                                                       AliInfo("No Machine Mode found within DAQ_time_start and DAQ_time_end, setting it to UNKNOWN");
+                                                       grpobj->SetMachineMode("UNKNOWN");
+                                               }
+                                       }
+                                       else {
+                                               for (Int_t iMachineMode = 0; iMachineMode<nMachineMode; iMachineMode++){
+                                                       AliDCSArray* machineMode = (AliDCSArray*)machineModeArray->At(iMachineMode);
+                                                       if (machineMode->GetTimeStamp()>=timeStart && machineMode->GetTimeStamp()<=timeEnd){
+                                                               AliDCSArray* machineMode1 = (AliDCSArray*)machineModeArray->At(iMachineMode+1);
+                                                               if (machineMode1->GetTimeStamp()>=timeStart && machineMode1->GetTimeStamp()<=timeEnd){
+                                                                       timeMachineMode = machineMode1->GetTimeStamp();
+                                                                       AliWarning(Form("The machine mode changed at timestamp %f! Setting it to the first value found and keeping track of the time of the change to set MaxTimeLHCValidity afterwards",timeMachineMode));
+                                                               }
+                                                               TObjString* machineModeString = machineMode->GetStringArray(0);
+                                                               AliInfo(Form("Machine mode = %s",(machineModeString->String()).Data()));
+                                                               grpobj->SetMachineMode(machineModeString->String());
+                                                               flagMachineMode = kTRUE;
+                                                               break;
+                                                       }
+                                               }
+                                               if (!flagMachineMode){
+                                                       AliError("Found values for MachineMode, but none within DAQ_time_start and DAQ_time_end, setting MachineMode to UNKNOWN");
+                                                       grpobj->SetMachineMode("UNKONWN");
+                                               }
                                        }
-                                       AliInfo(Form("Machine Mode = %s",(machineModeString->String()).Data()));
-                                       grpobj->SetMachineMode(machineModeString->String());
                                }
                        }
                        else {
                                AliError("Machine mode array not found in LHC Data file!!!");
                        }       
+
+                       // Setting minTimeLHCValidity
                        if (timeBeamMode!=0 || timeMachineMode!=0){
                                Double_t minTimeLHCValidity;
                                if (timeBeamMode == 0){