]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updating GRP preprocessor:
authorzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Apr 2010 16:42:42 +0000 (16:42 +0000)
committerzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Apr 2010 16:42:42 +0000 (16:42 +0000)
- Beam type retrieved
- Processing LHC data only in case the run type is PHYSICS

Updating test files.

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

index cd9675b852e49dd68958db6b48ce4514cc5a3077..8753b2ca54c0aef5fa1e944da24ca8a06bd45766 100644 (file)
@@ -4,9 +4,9 @@ LHC_ENTRIES     64
 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      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
+5      LHC_MachineMode s:1     0                       \r
+6      LHC_BeamMode    s:1     2       STABLE BEAMS    1020.702        CICCIO  30000\r
+7      LHC_Beams_Particle_Type s:1     2       PROTON  1030.700                Boh     1040\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
 10     dip/acc/LHC/Machine/CollimatorPositions/TCLIA.4R2.lvdt_gap_upstream     f:1     4       39.839512       1020.429        39.839831       1021.429        39.839972       1022.429        39.839581       1023.429\r
index 1b95e767dd7aa24dfde0ee8559f0effb1a4a6bcd..0523cab525f7d729ad9f838a3f8ae9120a035c07 100644 (file)
@@ -6,7 +6,7 @@ LHC_ENTRIES     64
 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      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   
+7      LHC_Beams_Particle_Type s:1     2       PROTON  1268214810.706          Boh     1268214910.703  
 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
 10     lhcMon_LHCCollimatorPos_TCLIA_4R2.lvdt_gap_upstream     f:1     4       39.839512       1268214810.429  39.839831       1268214811.429  39.839972       1268214812.429  39.839581       1268214813.429
index 5040cad6c92c9a8e44d34ad12aa0be94458efb70..f3ad733c7d0a6d6c20d042cabc04e193d7b8b275 100644 (file)
@@ -74,7 +74,7 @@ ClassImp(AliGRPPreprocessor)
   const Int_t AliGRPPreprocessor::fgknDAQLbPar = 6; // num parameters in the logbook used to fill the GRP object
   const Int_t AliGRPPreprocessor::fgknDCSDP = 48;   // number of dcs dps
   const Int_t AliGRPPreprocessor::fgknDCSDPHallProbes = 40;   // number of dcs dps
-  const Int_t AliGRPPreprocessor::fgknLHCDP = 5;   // number of dcs dps from LHC data
+  const Int_t AliGRPPreprocessor::fgknLHCDP = 4;   // number of dcs dps from LHC data
   const Int_t AliGRPPreprocessor::fgkDCSDPHallTopShift = 4;   // shift from the top to get tp the Hall Probes names in the list of DCS DPs
   const Int_t AliGRPPreprocessor::fgkDCSDPNonWorking = 5; // number of non working DCS DPs
   const char* AliGRPPreprocessor::fgkDCSDataPoints[AliGRPPreprocessor::fgknDCSDP] = {
@@ -179,9 +179,9 @@ ClassImp(AliGRPPreprocessor)
          "LHC_Beam_Energy",
          "LHC_MachineMode",
          "LHC_BeamMode",
-          "dip/acc/LHC/RunControl/BeamType/Beam1.payload",
-          "dip/acc/LHC/RunControl/BeamType/Beam2.payload"
+          "LHC_Beams_Particle_Type"
   };
+
   const char* kppError[] = {
                    "",
                    "(DAQ logbook ERROR)",
@@ -519,24 +519,27 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap)
        // LHC Data        //
        //=================//
 
-       Log("*************** Processing LHC Data");
-
-       UInt_t iLHCData = ProcessLHCData(grpobj);
+       if (runType == "PHYSICS"){  // processing the LHC file only in PHYSICS runs
+               Log("*************** Processing LHC Data");
 
-       if( iLHCData == 0 ) {
-               Log(Form("LHC Data from DCS FXS, successful!"));
-       } else  if (iLHCData == 1) {
-               Log(Form("LHC Data, problems with DCS FXS!"));
-               error |= 256;
-       } else if (iLHCData ==3){
-               Log(Form("Problems in storing LHC Data - but not going into Error"));
-       } else if (iLHCData ==4){
-               Log(Form("Problems with LHC Data to be put in /GRP/GRP/LHCData - but not going into Error"));
-       } else{
-               Log(Form("LHC Data problems"));
-               error |= 512;
-       }
+               UInt_t iLHCData = ProcessLHCData(grpobj);
+               
+               if( iLHCData == 0 ) {
+                       Log(Form("LHC Data from DCS FXS, successful!"));
+               } else  if (iLHCData == 1) {
+                       Log(Form("LHC Data, problems with DCS FXS!"));
+                       error |= 256;
+               } else if (iLHCData ==3){
+                       Log(Form("Problems in storing LHC Data - but not going into Error"));
+               } else if (iLHCData ==4){
+                       Log(Form("Problems with LHC Data to be put in /GRP/GRP/LHCData - but not going into Error"));
+               } else{
+                       Log(Form("LHC Data problems"));
+                       error |= 512;
+               }
        
+       }
+
        //==================//
        // SPD Mean Vertex  //
        //==================//
@@ -634,16 +637,18 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                        }       
                        Double_t timeBeamMode = 0;
                        Double_t timeMachineMode = 0;
+                       Double_t timeBeam = 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
+                       Bool_t flagBeam = kFALSE;  //flag set true if at least one Beam Type measurement is found within DAQ_time_start and DAQ_time_end
+
                        // BeamMode
                        TObjArray* beamModeArray = (TObjArray*)lhcMap->GetValue(fgkLHCDataPoints[2]);
                        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");
+                                       AliInfo("Found zero entries for  the Beam Mode, leaving it empty");
                                }
                                else{
                                        if (nBeamMode==1){
@@ -654,8 +659,7 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                                                        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");
+                                                       AliInfo("No Beam Mode found within DAQ_time_start and DAQ_time_end, leaving it empty");
                                                }
                                        }
                                        else {
@@ -675,8 +679,7 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                                                        }
                                                }
                                                if (!flagBeamMode){
-                                                       AliError("Found values for BeamMode, but none within DAQ_time_start and DAQ_time_end, setting BeamMode to UNKNOWN");
-                                                       grpobj->SetLHCState("UNKONWN");
+                                                       AliError("Found values for BeamMode, but none within DAQ_time_start and DAQ_time_end, leaving it empty");
                                                }
                                        }
                                }
@@ -691,8 +694,7 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                        if (machineModeArray){
                                nMachineMode = machineModeArray->GetEntries();
                                if (nMachineMode==0){
-                                       AliInfo("No Machine Mode found, setting it to UNKNOWN");
-                                       grpobj->SetMachineMode("UNKNOWN");
+                                       AliInfo("No Machine Mode found, leaving it empty");
                                }
                                else{
                                        if (nMachineMode ==1) {
@@ -703,8 +705,7 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                                                        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");
+                                                       AliInfo("No Machine Mode found within DAQ_time_start and DAQ_time_end, leaving it empty");
                                                }
                                        }
                                        else {
@@ -734,41 +735,101 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                                AliError("Machine mode array not found in LHC Data file!!!");
                        }       
 
+                       // BeamType1 and BeamType2 - both put in the same string
+                       TObjArray* beamArray = (TObjArray*)lhcMap->GetValue(fgkLHCDataPoints[3]);
+                       if (beamArray){                 
+                               Int_t nBeam = beamArray->GetEntries();
+                               if (nBeam==0){
+                                       AliInfo("No Beam Type found, leaving it empty");
+                               }
+                               else{
+                                       if (nBeam == 1){
+                                               AliDCSArray* beam = (AliDCSArray*)beamArray->At(0);
+                                               if (beam->GetTimeStamp()>=timeStart && beam->GetTimeStamp()<=timeEnd){
+                                                       TObjString* beamString = beam->GetStringArray(0);
+                                                       TString beamType = beamString->String();
+                                                       AliInfo(Form("Beam Type = %s",beamType.Data()));        
+                                                       if (beamType.CompareTo("PROTON",TString::kIgnoreCase)){
+                                                               grpobj->SetBeamType("p-p");
+                                                       }
+                                                       else if (beamType.CompareTo("LEAD82",TString::kIgnoreCase)){
+                                                               grpobj->SetBeamType("Pb-Pb");
+                                                       }
+                                                       else{
+                                                               AliError("Beam Type not known, leaving it empty");
+                                                       }
+                                               }
+                                               else {
+                                                       AliInfo("No Beam Type found within DAQ_time_start and DAQ_time_end, leaving it empty");
+                                               }
+                                       }
+                                       else{
+                                               for (Int_t iBeam=0; iBeam<nBeam; iBeam++){
+                                                       AliDCSArray* beam = (AliDCSArray*)beamArray->At(iBeam);
+                                                       if (beam->GetTimeStamp()>=timeStart && beam->GetTimeStamp()<=timeEnd){
+                                                               AliDCSArray* beam1 = (AliDCSArray*)beamArray->At(iBeam+1);
+                                                               if (beam1->GetTimeStamp()>=timeStart && beam1->GetTimeStamp()<=timeEnd){
+                                                                       timeBeam = beam1->GetTimeStamp();
+                                                                       AliWarning(Form("The Beam Type changed at timestamp %f! Setting it to the first value found and keeping track of the time of the change to set MaxTimeLHCValidity afterwards",timeBeam));
+                                                               }
+                                                               TObjString* beamString = beam->GetStringArray(0);
+                                                               TString beamType = beamString->String();
+                                                               AliInfo(Form("Beam Type = %s",beamType.Data()));        
+                                                               if (beamType.CompareTo("PROTON",TString::kIgnoreCase)){
+                                                                       grpobj->SetBeamType("p-p");
+                                                               }
+                                                               else if (beamType.CompareTo("LEAD82",TString::kIgnoreCase)){
+                                                                       grpobj->SetBeamType("Pb-Pb");
+                                                               }
+                                                               else{
+                                                                       AliError("Beam Type not known, leaving it empty");
+                                                               }
+                                                               flagBeam = kTRUE;
+                                                               break;
+                                                       }
+                                               }
+                                               if (!flagBeam){
+                                                       AliError("Found values for Beam Type, but none within DAQ_time_start and DAQ_time_end, leaving it empty");
+                                               }
+                                       }
+                               }
+                       }
+                       else{
+                               AliError("BeamType array not found in LHC data file!!!");
+                       }                       
+                       
                        // Setting minTimeLHCValidity
-                       if (timeBeamMode!=0 || timeMachineMode!=0){
+                       if (timeBeamMode!=0 || timeMachineMode!=0 || timeBeam !=0){
                                Double_t minTimeLHCValidity;
-                               if (timeBeamMode == 0){
+                               if (timeBeamMode == 0 && timeMachineMode == 0 && timeBeam != 0){ // timeBeam only != 0
+                                       minTimeLHCValidity = timeBeam;
+                               }
+                               else if (timeBeamMode == 0 && timeMachineMode != 0 && timeBeam == 0){ // timeMachineMode only != 0
                                        minTimeLHCValidity = timeMachineMode;
                                }
-                               else if (timeMachineMode == 0){
+                               else if (timeBeamMode != 0 && timeMachineMode == 0 && timeBeam == 0){ // timeBeamMode only != 0
                                        minTimeLHCValidity = timeBeamMode;
                                }
+                               else if (timeBeamMode == 0 && timeMachineMode != 0 && timeBeam != 0){ // timeBeam and timeMachineMode only != 0
+                                       minTimeLHCValidity= TMath::Min(timeBeam,timeMachineMode);
+                               }
+                               else if (timeBeamMode != 0 && timeMachineMode == 0 && timeBeam != 0){ // timeBeam and timeBeamMode only != 0
+                                       minTimeLHCValidity= TMath::Min(timeBeam,timeBeamMode);
+                               }
+                               else if (timeBeamMode != 0 && timeMachineMode != 0 && timeBeam == 0){ // timeMachineMode and timeBeamMode only != 0
+                                       minTimeLHCValidity= TMath::Min(timeMachineMode,timeBeamMode);
+                               }
                                else {
-                                       minTimeLHCValidity= TMath::Min(timeBeamMode,timeMachineMode);
+                                       Double_t arrayTimes[3] = {timeBeamMode,timeMachineMode,timeBeam};
+                                       minTimeLHCValidity= TMath::MinElement(3,arrayTimes);
                                }
                                AliWarning(Form("Setting MaxTimeLHCValidity to %f",minTimeLHCValidity));
                                grpobj->SetMaxTimeLHCValidity(minTimeLHCValidity);
                        }
                        
-                       // BeamType1 and BeamType2 
-                       TObjArray* beam1Array = (TObjArray*)lhcMap->GetValue(fgkLHCDataPoints[3]);
-                       if (beam1Array){                        
-                               AliInfo(Form("%d entries for Beam1",beam1Array->GetEntries()));
-                       }
-                       else{
-                               AliError("Beam1 array not found in LHC data file!!!");
-                       }                       
-                       TObjArray* beam2Array = 
-                               (TObjArray*)lhcMap->GetValue(fgkLHCDataPoints[4]);
-                       if (beam2Array){
-                               AliInfo(Form("%d entries for Beam2",beam2Array->GetEntries()));
-                       }
-                       else{
-                               AliError("Beam2 array not found in LHC data file!!!");
-                       }       
                        // Processing data to go to AliLHCData object
                        AliLHCData* dt = new AliLHCData(lhcMap,timeStart,timeEnd);
-                                                       
+                       
                        // storing AliLHCData in OCDB
                        if (dt){                        
                                AliCDBMetaData md;