]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliGRPPreprocessor.cxx
Increase class version (forgotten in the previous commit)
[u/mrichter/AliRoot.git] / STEER / AliGRPPreprocessor.cxx
index 5acf24fcd61949a269e0e440f3a77f9b1ffcb283..a98dffbe8581cee57a3db5503d17a5cffb1e6ea4 100644 (file)
@@ -27,7 +27,9 @@
 #include <TList.h>
 #include <TMap.h>
 #include <TObjString.h>
+#include <TObjArray.h>
 #include <TGraph.h>
+#include <TString.h>
 
 #include <float.h>
 
@@ -119,7 +121,7 @@ ClassImp(AliGRPPreprocessor)
                    "CavernTemperature",
                    "CavernAtmosPressure",
                    "SurfaceAtmosPressure",
-                   "CavernAtmosPressure2",
+                   "CavernAtmosPressure2"
                  };
 
   const char* AliGRPPreprocessor::fgkDCSDataPointsHallProbes[AliGRPPreprocessor::fgknDCSDPHallProbes] = {
@@ -162,7 +164,7 @@ ClassImp(AliGRPPreprocessor)
                   "Dipole_Outside_H1",
                   "Dipole_Outside_H2",
                   "Dipole_Outside_H3",
-                  "Dipole_Outside_Temperature",
+                  "Dipole_Outside_Temperature"
                  };
                  
   const Short_t kSensors = 48; // start index position of sensor in DCS DPs
@@ -196,7 +198,7 @@ ClassImp(AliGRPPreprocessor)
 //_______________________________________________________________
 
 AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
-       AliPreprocessor("GRP",shuttle),  fPressure(0), fmaxFloat(0), fminFloat(0),fmaxDouble(0), fminDouble(0), fmaxInt(0), fminInt(0), fmaxUInt(0), fminUInt(0),fdaqStartEndTimeOk(kTRUE)
+       AliPreprocessor("GRP",shuttle),  fPressure(0), fmaxFloat(0), fminFloat(0),fmaxDouble(0), fminDouble(0), fmaxInt(0), fminInt(0), fmaxUInt(0), fminUInt(0),fdaqStartEndTimeOk(kTRUE),ffailedDPs(new TObjArray(fgknDCSDP))
 {
        // constructor - shuttle must be instantiated!
 
@@ -234,6 +236,7 @@ AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
        AliInfo(Form("Max allowed unsigned integer = %u",(Int_t)fmaxUInt));
        AliInfo(Form("Min allowed unsigned integer = %u",(Int_t)fminUInt));
 
+       ffailedDPs->SetOwner(kTRUE);
 }
 
 //_______________________________________________________________
@@ -243,6 +246,8 @@ AliGRPPreprocessor::~AliGRPPreprocessor()
        //destructor
        
        delete fPressure;
+       delete ffailedDPs;
+
 }
 
 //_______________________________________________________________
@@ -264,6 +269,12 @@ void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
        AliInfo(Form("Pressure Entries: %d",array->GetEntries()));
        
        fPressure = new AliDCSSensorArray(GetStartTimeDCSQuery(), GetEndTimeDCSQuery(), array);
+
+       for (Int_t iDP=0; iDP < fgknDCSDP; iDP++){
+               TObjString* dp = new TObjString(fgkDCSDataPoints[iDP]);
+               ffailedDPs->AddAt(dp,iDP);
+       }
+
 }
 
 //_______________________________________________________________
@@ -329,8 +340,21 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap)
        Int_t entries = ProcessDcsDPs( valueMap, grpobj );
        Log(Form("entries found = %d (should be %d)",entries, fgknDCSDP-4));
        if (fdaqStartEndTimeOk){
-               if( entries < fgknDCSDP-4 ) { // FIXME (!= ) LHState, LHCLuminosity, BeamIntensity, LH3_BSF4_H3 are not working yet...  
+               if( entries < fgknDCSDP-4 ) { // FIXME (!= ) LHState, LHCLuminosity, BeamIntensity, L3_BSF4_H3 are not working yet...  
                        Log(Form("Problem with the DCS data points!!! Only %d/%d entries found",entries,fgknDCSDP-4));
+                       Log(Form("The DPs giving problems were:"));
+                       for (Int_t iDP = 0; iDP < fgknDCSDP; iDP++){
+                               TObjString *dpString = (TObjString*)ffailedDPs->At(iDP);
+                               if (dpString){
+                                       TString name = dpString->String();
+                                       if (name != "LHCState" && name != "LHCLuminosity" && name != "BeamIntensity" && name != "L3_BSF4_H3"){
+                                               Log(Form("******** %s ******** not present, but foreseen --> causing an ERROR",name.Data()));
+                                       }
+                                       else {
+                                               Log(Form(" %s is not present, but was not generating any error since it is not ready in DCS - check the other DPs in this list!",name.Data()));
+                                       }
+                               }
+                       }
                        error |= 8;
                }
                else  Log(Form("DCS data points, successful!"));
@@ -776,6 +800,7 @@ Int_t AliGRPPreprocessor::ProcessDcsDPs(TMap* valueMap, AliGRPObject* grpObj)
        nEnvEntries = ProcessEnvDPs(valueMap, grpObj);
        nHallProbesEntries = ProcessHPDPs(valueMap, grpObj);
        grpObj->SetPolarityConventionLHC();  // after the dipole cables swap we comply with LHC convention
+       Log(Form("nLHCEntries = %d, L3Entries = %d, nDipoleEntries =%d, nEnvEntries = %d, nHallProbesEntries = %d", nLHCEntries, nL3Entries, nDipoleEntries, nEnvEntries, nHallProbesEntries));
        entries = nLHCEntries + nL3Entries + nDipoleEntries + nEnvEntries + nHallProbesEntries;
        return entries;
 
@@ -791,6 +816,7 @@ Int_t AliGRPPreprocessor::ProcessL3DPs(const TMap* valueMap, AliGRPObject* grpOb
        // L3 info
 
        Int_t nL3Entries = 0;
+
        TObjArray *array = 0x0;
        Int_t indexDP = -1;
        Bool_t isZero = kTRUE; // flag to monitor L3Current. If set to true, the magnet is OFF, and the polarity can change
@@ -819,7 +845,10 @@ Int_t AliGRPPreprocessor::ProcessL3DPs(const TMap* valueMap, AliGRPObject* grpOb
                                floatDCS = 0x0;
                        }
                }
-               if (!outOfRange) nL3Entries++;
+               if (!outOfRange) {
+                       nL3Entries++;
+                       ffailedDPs->RemoveAt(indexDP);
+               }
        }
 
        if (array) array = 0x0;
@@ -840,10 +869,12 @@ Int_t AliGRPPreprocessor::ProcessL3DPs(const TMap* valueMap, AliGRPObject* grpOb
                        if (change == kFALSE){
                                grpObj->SetL3Polarity(charDCS);
                                AliInfo(Form("%s set to %d",fgkDCSDataPoints[indexDP],(Int_t)(grpObj->GetL3Polarity())));
+                               ffailedDPs->RemoveAt(indexDP);
                                nL3Entries++;
                        }
                        else if (isZero){
                                AliInfo(Form("%s set to invalid, but magnet was OFF (according to the current), DP not considered wrong",fgkDCSDataPoints[indexDP]));
+                               ffailedDPs->RemoveAt(indexDP);
                                nL3Entries++;
                        }
                        else {
@@ -892,7 +923,10 @@ Int_t AliGRPPreprocessor::ProcessDipoleDPs(const TMap* valueMap, AliGRPObject* g
                                floatDCS = 0x0;
                        }
                }
-               if (!outOfRange) nDipoleEntries++;
+               if (!outOfRange) {
+                       nDipoleEntries++;
+                       ffailedDPs->RemoveAt(indexDP);
+               }
        }
 
        if (array) array = 0x0;
@@ -913,10 +947,12 @@ Int_t AliGRPPreprocessor::ProcessDipoleDPs(const TMap* valueMap, AliGRPObject* g
                        if (!change){
                                grpObj->SetDipolePolarity(charDCS);
                                AliInfo(Form("%s set to %d",fgkDCSDataPoints[indexDP],(Int_t)(grpObj->GetDipolePolarity())));
+                               ffailedDPs->RemoveAt(indexDP);
                                nDipoleEntries++;
                        }
                        else if (isZero){
                                AliInfo(Form("%s set to invalid, but magnet was OFF (according to the current), DP not considered wrong",fgkDCSDataPoints[indexDP]));
+                               ffailedDPs->RemoveAt(indexDP);
                                nDipoleEntries++;
                        }
                        else{
@@ -964,7 +1000,10 @@ Int_t AliGRPPreprocessor::ProcessEnvDPs(TMap* valueMap, AliGRPObject* grpObj)
                                floatDCS = 0x0;
                        }
                }
-               if (!outOfRange) nEnvEntries++;
+               if (!outOfRange) {
+                       ffailedDPs->RemoveAt(indexDP);
+                       nEnvEntries++;
+               }
        }
 
        if (array) array = 0x0;
@@ -981,78 +1020,72 @@ Int_t AliGRPPreprocessor::ProcessEnvDPs(TMap* valueMap, AliGRPObject* grpObj)
        indexDP = kCavernAtmosPressure;
        AliDCSSensor* sensorCavernP2 = dcsSensorArray->GetSensor(fgkDCSDataPoints[indexDP]);
        TGraph* graph = sensorCavernP2->GetGraph();
+       AliDebug(3,Form("index = %d",indexDP));
+       AliDebug(3,Form("name = %s",fgkDCSDataPoints[indexDP]));
        AliDebug(2,Form("graph = %p",graph));
        AliDebug(3,Form("sensorCavernP2 = %p", sensorCavernP2));
-       if(((sensorCavernP2->GetFit()) || (GetEndTimeDCSQuery() - GetStartTimeDCSQuery() < 60)) && graph) {
+       if(sensorCavernP2->GetFit() || graph) {
                if (sensorCavernP2->GetFit()){
-                       Log(Form("Fit for Sensor %s found",fgkDCSDataPoints[indexDP]));
+                       Log(Form("Fit for sensor %s found",fgkDCSDataPoints[indexDP]));
                }
                else {
-                       Log(Form("Fit for sensor %s not found, but the query to the DCS archive lasted less than 60s and we have entries for the sensor - NOT going into error",fgkDCSDataPoints[indexDP]));
+                       Log(Form("Fit for sensor %s not found, but the graph is there - NOT going into error",fgkDCSDataPoints[indexDP]));
                }
                grpObj->SetCavernAtmosPressure(sensorCavernP2);
+               ffailedDPs->RemoveAt(indexDP);
                nEnvEntries++;
        } 
        //if (sensorP2) delete sensorP2;
        else {
-               if (!graph){
-                       Log(Form("ERROR!!! No graph found for Sensor %s - this will not increase the number of found DCS DPs and will cause an error", fgkDCSDataPoints[indexDP] ));
-               }
-               else{
-                       Log(Form("ERROR!!! Fit for %s not found for a run lasting more than 60s - this will not increase the number of found DCS DPs and will cause an error", fgkDCSDataPoints[indexDP] ));
-               }
+               Log(Form("ERROR!!! Neither graph nor fit found for sensor %s - this will not increase the number of found DCS DPs and will cause an error", fgkDCSDataPoints[indexDP] ));
        }
-
+       
        AliInfo(Form("==========SurfaceAtmosPressure==========="));
        indexDP = kSurfaceAtmosPressure;
        AliDCSSensor* sensorP2 = dcsSensorArray->GetSensor(fgkDCSDataPoints[indexDP]);
        graph = sensorP2->GetGraph();
+       AliDebug(3,Form("index = %d",indexDP));
+       AliDebug(3,Form("name = %s",fgkDCSDataPoints[indexDP]));
        AliDebug(2,Form("graph = %p",graph));   
        AliDebug(3,Form("sensorP2 = %p", sensorP2));
-       if(((sensorP2->GetFit()) || (GetEndTimeDCSQuery() - GetStartTimeDCSQuery() < 60)) && graph) {
+       if(sensorP2->GetFit() || graph) {
                if (sensorP2->GetFit()){
-                       Log(Form("Fit for Sendor %s found",fgkDCSDataPoints[indexDP]));
+                       Log(Form("Fit for sensor %s found",fgkDCSDataPoints[indexDP]));
                }
                else {
-                       Log(Form("Fit for sensor %s not found, but the query to the DCS archive lasted less than 60s and we have entries for the sensor - NOT going into error",fgkDCSDataPoints[indexDP]));
+                       Log(Form("Fit for sensor %s not found, but the graph is there - NOT going into error",fgkDCSDataPoints[indexDP]));
                }
                grpObj->SetSurfaceAtmosPressure(sensorP2);
+               ffailedDPs->RemoveAt(indexDP);
                nEnvEntries++;
        } 
        //if (sensorP2) delete sensorP2;
        else {
-               if (!graph){
-                       Log(Form("ERROR!!! No graph found for Sensor %s - this will not increase the number of found DCS DPs and will cause an error", fgkDCSDataPoints[indexDP] ));
-               }
-               else {
-                       Log(Form("ERROR!!! Fit for %s not found for a run lasting more than 60s - this will not increase the number of found DCS DPs and will cause an error", fgkDCSDataPoints[indexDP] ));
-               }
+               Log(Form("ERROR!!! Neither graph nor fit found for sensor %s - this will not increase the number of found DCS DPs and will cause an error", fgkDCSDataPoints[indexDP] ));
        }
 
        AliInfo(Form("==========CavernAtmosPressure2==========="));
        indexDP = kCavernAtmosPressure2;
        AliDCSSensor* sensorCavernP22 = dcsSensorArray->GetSensor(fgkDCSDataPoints[indexDP]);
-       graph = sensorP2->GetGraph();
+       graph = sensorCavernP22->GetGraph();
+       AliDebug(3,Form("index = %d",indexDP));
+       AliDebug(3,Form("name = %s",fgkDCSDataPoints[indexDP]));
        AliDebug(2,Form("graph = %p",graph));   
        AliDebug(3,Form("sensorCavernP2_2 = %p", sensorCavernP22));
-       if(((sensorCavernP22->GetFit()) || (GetEndTimeDCSQuery() - GetStartTimeDCSQuery() < 60)) && graph) {
+       if(sensorCavernP22->GetFit() || graph) {
                if (sensorCavernP22->GetFit()){
-                       Log(Form("Fit for Sensor %s found",fgkDCSDataPoints[indexDP]));
+                       Log(Form("Fit for sensor %s found",fgkDCSDataPoints[indexDP]));
                }
                else {
-                       Log(Form("Fit for sensor %s not found, but the query to the DCS archive lasted less than 60s and we have entries for the sensor - NOT going into error",fgkDCSDataPoints[indexDP]));
+                       Log(Form("Fit for sensor %s not found, but the graph is there - NOT going into error",fgkDCSDataPoints[indexDP]));
                }
                grpObj->SetCavernAtmosPressure2(sensorCavernP22);
+               ffailedDPs->RemoveAt(indexDP);
                nEnvEntries++;
        } 
        //if (sensorP2) delete sensorP2;
        else {
-               if (!graph){
-                       Log(Form("ERROR!!! No graph found for Sensor %s - this will not increase the number of found DCS DPs and will cause an error", fgkDCSDataPoints[indexDP] ));
-               }
-               else {
-                       Log(Form("ERROR!!! Fit for %s not found for a run lasting more than 60s - this will not increase the number of found DCS DPs and will cause an error", fgkDCSDataPoints[indexDP] ));
-               }
+               Log(Form("ERROR!!! Neither graph nor fit found for sensor %s - this will not increase the number of found DCS DPs and will cause an error", fgkDCSDataPoints[indexDP] ));
        }
        
        
@@ -1102,7 +1135,10 @@ Int_t AliGRPPreprocessor::ProcessHPDPs(const TMap* valueMap, AliGRPObject* grpOb
                                        floatDCS = 0x0;
                                }
                        }
-                       if (!outOfRange) nHPEntries++;
+                       if (!outOfRange) {
+                               ffailedDPs->RemoveAt(indexDP + 7);  // 7 = shift in the complete list of DPs to get to the Hall Probes
+                               nHPEntries++;
+                       }
                }
        }
                
@@ -1161,6 +1197,7 @@ Int_t AliGRPPreprocessor::ProcessLHCDPs(const TMap* valueMap, AliGRPObject* grpO
                                grpObj->SetLHCState(AliGRPObject::GetInvalidString());
                        }         
                }
+               ffailedDPs->RemoveAt(indexDP);
                nLHCEntries++;
        }
        
@@ -1193,7 +1230,10 @@ Int_t AliGRPPreprocessor::ProcessLHCDPs(const TMap* valueMap, AliGRPObject* grpO
                                floatDCS = 0x0;
                        }
                }
-               if (!outOfRange) nLHCEntries++;
+               if (!outOfRange) {
+                       ffailedDPs->RemoveAt(indexDP);
+                       nLHCEntries++;
+               }
        }
 
        if (array) array = 0x0;
@@ -1225,7 +1265,10 @@ Int_t AliGRPPreprocessor::ProcessLHCDPs(const TMap* valueMap, AliGRPObject* grpO
                                floatDCS = 0x0;
                        }
                }
-               if (!outOfRange) nLHCEntries++;
+               if (!outOfRange) {
+                       nLHCEntries++;
+                       ffailedDPs->RemoveAt(indexDP);
+               }
        }
 
        return nLHCEntries;