]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Bug fixed.
authorzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Apr 2010 07:30:49 +0000 (07:30 +0000)
committerzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Apr 2010 07:30:49 +0000 (07:30 +0000)
Extra controls added.

STEER/AliGRPPreprocessor.cxx

index 8bc128b09a710a5a162c93e4f1b6236c1e05dbe3..435239cc8eb18511cb166d316b8344e7a5e75822 100644 (file)
@@ -622,6 +622,7 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                // Processing data to be put in AliGRPObject
 
                // Energy
+               Log("*************Energy ");
                TObjArray* energyArray = lhcReader.ReadSingleLHCDP(fileName.Data(),fgkLHCDataPoints[0]);
                if (energyArray){                       
                        Float_t energy = ProcessEnergy(energyArray,timeStart,timeEnd);
@@ -643,39 +644,57 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                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
+               Log("*************BeamMode (LHCState) ");
                TObjArray* beamModeArray = lhcReader.ReadSingleLHCDP(fileName.Data(),fgkLHCDataPoints[2]);
                Int_t nBeamMode = -1;
                if (beamModeArray){     
                        nBeamMode = beamModeArray->GetEntries();        
                        if (nBeamMode==0){
-                               AliInfo("Found zero entries for  the Beam Mode, leaving it empty");
+                               AliInfo("Found zero entries for the Beam Mode, leaving it empty");
                        }
                        else{
                                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());
+                                       if (beamMode) {
+                                               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, leaving it empty");
+                                               }
                                        }
-                                       else{
-                                               AliInfo("No Beam Mode found within DAQ_time_start and DAQ_time_end, leaving it empty");
+                                       else {
+                                               AliInfo("Invalid pointer for Beam Mode, leaving it empty");
                                        }
                                }
                                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));
+                                               if (beamMode){
+                                                       if (beamMode->GetTimeStamp()>=timeStart && beamMode->GetTimeStamp()<=timeEnd){
+                                                               if (iBeamMode < nBeamMode-1){
+                                                                       AliDCSArray* beamMode1 = (AliDCSArray*)beamModeArray->At(iBeamMode+1);
+                                                                       if (beamMode1){
+                                                                               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));
+                                                                               }
+                                                                       }
+                                                                       else {
+                                                                               AliInfo("Invalid pointer for the first entry for Beam Mode after the first valid one, not considering anything after what has already been found");
+                                                                       }
+                                                               }
+                                                               TObjString* beamModeString = beamMode->GetStringArray(0);
+                                                               AliInfo(Form("LHC State (corresponding to BeamMode) = %s",(beamModeString->String()).Data()));
+                                                               grpobj->SetLHCState(beamModeString->String());
+                                                               flagBeamMode = kTRUE;
+                                                               break;
                                                        }
-                                                       TObjString* beamModeString = beamMode->GetStringArray(0);
-                                                       AliInfo(Form("LHC State (corresponding to BeamMode) = %s",(beamModeString->String()).Data()));
-                                                       grpobj->SetLHCState(beamModeString->String());
-                                                       flagBeamMode = kTRUE;
-                                                       break;
+                                               }
+                                               else {
+                                                       AliInfo("Invalid pointer for first entry for Beam Mode, no check can be done, leaving Beam Mode empty");
                                                }
                                        }
                                        if (!flagBeamMode){
@@ -690,6 +709,7 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                }
                
                // MachineMode
+               Log("*************MachineMode ");
                TObjArray* machineModeArray = lhcReader.ReadSingleLHCDP(fileName.Data(),fgkLHCDataPoints[1]);
                Int_t nMachineMode = -1;
                if (machineModeArray){
@@ -700,34 +720,50 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                        else{
                                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());
+                                       if (machineMode){
+                                               if (machineMode && 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, leaving it empty");
+                                               }
                                        }
                                        else{
-                                               AliInfo("No Machine Mode found within DAQ_time_start and DAQ_time_end, leaving it empty");
+                                               AliInfo("Invalid pointer for Machine Mode, leaving it empty");
                                        }
                                }
                                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));
+                                               if (machineMode){
+                                                       if (machineMode->GetTimeStamp()>=timeStart && machineMode->GetTimeStamp()<=timeEnd){
+                                                               if (iMachineMode < nMachineMode-1){
+                                                                       AliDCSArray* machineMode1 = (AliDCSArray*)machineModeArray->At(iMachineMode+1);
+                                                                       if (machineMode1){
+                                                                               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));
+                                                                               }
+                                                                       }
+                                                                       else{
+                                                                               AliInfo("Invalid pointer for the first entry for Machine Mode after the first valid one, not considering anything after what has already been found");
+                                                                       }
+                                                               }
+                                                               TObjString* machineModeString = machineMode->GetStringArray(0);
+                                                               AliInfo(Form("Machine mode = %s",(machineModeString->String()).Data()));
+                                                               grpobj->SetMachineMode(machineModeString->String());
+                                                               flagMachineMode = kTRUE;
+                                                               break;
                                                        }
-                                                       TObjString* machineModeString = machineMode->GetStringArray(0);
-                                                       AliInfo(Form("Machine mode = %s",(machineModeString->String()).Data()));
-                                                       grpobj->SetMachineMode(machineModeString->String());
-                                                       flagMachineMode = kTRUE;
-                                                       break;
+                                               }
+                                               else{
+                                                       AliInfo("Invalid pointer for first entry for Machine Mode, no check can be done, leaving Machine Mode empty");
                                                }
                                        }
                                        if (!flagMachineMode){
-                                               AliError("Found values for MachineMode, but none within DAQ_time_start and DAQ_time_end, setting MachineMode to UNKNOWN");
-                                               grpobj->SetMachineMode("UNKONWN");
+                                               AliError("Found values for MachineMode, but none within DAQ_time_start and DAQ_time_end, leaving it empty");
                                        }
                                }
                        }
@@ -738,6 +774,7 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                }       
                
                // BeamType1 and BeamType2 - both put in the same string
+               Log("*************BeamType ");
                TObjArray* beamArray = lhcReader.ReadSingleLHCDP(fileName.Data(),fgkLHCDataPoints[3]);
                if (beamArray){                 
                        Int_t nBeam = beamArray->GetEntries();
@@ -747,33 +784,8 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                        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){
                                                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()));        
@@ -786,8 +798,50 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                                                        else{
                                                                AliError("Beam Type not known, leaving it empty");
                                                        }
-                                                       flagBeam = kTRUE;
-                                                       break;
+                                               }
+                                               else {
+                                                       AliInfo("No Beam Type found within DAQ_time_start and DAQ_time_end, leaving it empty");
+                                               }
+                                       }
+                                       else{
+                                               AliInfo("Invalid pointer for Beam Type, leaving it empty");
+                                       }
+                               }
+                               else{
+                                       for (Int_t iBeam=0; iBeam<nBeam; iBeam++){
+                                               AliDCSArray* beam = (AliDCSArray*)beamArray->At(iBeam);
+                                               if (beam){
+                                                       if (beam->GetTimeStamp()>=timeStart && beam->GetTimeStamp()<=timeEnd){
+                                                               if (iBeam < nBeam-1){
+                                                                       AliDCSArray* beam1 = (AliDCSArray*)beamArray->At(iBeam+1);
+                                                                       if (beam1){
+                                                                               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));
+                                                                               }
+                                                                       }
+                                                                       else {
+                                                                               AliInfo("Invalid pointer for the first entry for Beam Type after the first valid one, not considering anything after what has already been found");
+                                                                       }
+                                                               }
+                                                               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;
+                                                       }
+                                               }
+                                               else{
+                                                       AliInfo("Invalid pointer for first entry for Beam Type, no check can be done, leaving Beam Type empty");
                                                }
                                        }
                                        if (!flagBeam){
@@ -850,7 +904,8 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj)
                AliError("No LHCData file found in DCS FXS");
                return 1;
        }
-       
+
+       return 0;
 }
 
 //_______________________________________________________________