29 #include <THashList.h> 30 #include <TObjString.h> 31 #include <TObjArray.h> 45 #include "AliRawEventHeaderVersions.h" 66 #include <TSQLServer.h> 67 #include <TSQLResult.h> 99 "L3_BSF17_Temperature",
103 "L3_BSF4_Temperature",
107 "L3_BKF17_Temperature",
111 "L3_BKF4_Temperature",
115 "L3_BSF13_Temperature",
119 "L3_BSF8_Temperature",
123 "L3_BKF13_Temperature",
127 "L3_BKF8_Temperature",
131 "Dipole_Inside_Temperature",
135 "Dipole_Outside_Temperature",
138 "DipolePolarity_Redu",
140 "DipoleCurrent_Redu",
141 "CavernTemperature_Redu",
142 "CavernAtmosPressure",
143 "SurfaceAtmosPressure",
144 "CavernAtmosPressure2",
145 "CavernAtmosPressure_Redu",
146 "SurfaceAtmosPressure_Redu",
147 "CavernAtmosPressure2_Redu" 154 "L3_BSF17_Temperature",
158 "L3_BSF4_Temperature",
162 "L3_BKF17_Temperature",
166 "L3_BKF4_Temperature",
170 "L3_BSF13_Temperature",
174 "L3_BSF8_Temperature",
178 "L3_BKF13_Temperature",
182 "L3_BKF8_Temperature",
186 "Dipole_Inside_Temperature",
190 "Dipole_Outside_Temperature" 201 "LHC_Beams_Particle_Type",
202 "BPTX_Phase_Shift_B1",
203 "BPTX_Phase_Shift_B2",
204 "LHC_Particle_Type_B1",
205 "LHC_Particle_Type_B2",
206 "LHC_Data_Quality_Flag" 211 "(DAQ logbook ERROR)",
213 "(Trigger Scalers not found in FXS - ERROR)",
214 "(DCS data points ERROR)",
215 "(Trigger Configuration ERROR)",
216 "(DAQ logbook ERROR determining partition of the run)",
217 "(CTP timing ERROR)",
218 "(SPD Mean Vertex ERROR)",
219 "(FXS Error for LHC Data)",
221 "(LHC Clock Phase Error (from LHC Data))",
222 "(LTU Configuration Error)",
224 "(Trigger Aliases wrong or not found in DCS FXS - ERROR)" 230 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))
291 AliInfo(
"Initialization of the GRP preprocessor.");
299 AliInfo(Form(
"Pressure Entries: %d",array->GetEntries()));
304 for (Int_t iDP=0; iDP <
fgknDCSDP; iDP++){
331 Log(
"\n\n*************** Processing DAQ logbook");
339 Log(Form(
"DAQ Logbook, successful! Retrieved %d/%d entries",iDaqLB,
fgknDAQLbPar));
341 Log(Form(
"DAQ Logbook, could not get all expected entries!!! Retrieved only %d/%d entries",iDaqLB,
fgknDAQLbPar));
366 Log(
"\n\n*************** Processing DCS FXS");
370 Log(Form(
"DCS FXS, successful!"));
371 }
else if (iDcsFxs ==1) {
372 Log(Form(
"Could not store CTP scalers!!!"));
374 }
else if (iDcsFxs == 2) {
375 Log(Form(
"Could not store CTP aliases!!!"));
378 Log(Form(
"Incorrect field in DAQ logbook for partition = %s and detector = %s, going into error without CTP scalers...",partition.Data(),detector.Data()));
386 Log(
"\n\n*************** Processing DCS DPs");
391 Log(Form(
"\n\n--------------- Summary of DCS DPs Processing ---------------"));
398 Log(Form(
"The DPs giving problems were:"));
399 for (Int_t iDP = 0; iDP <
fgknDCSDP; iDP++){
400 TObjString *dpString = (TObjString*)
ffailedDPs->At(iDP);
402 TString name = dpString->String();
404 Log(Form(
"******** %s ******** not present, but foreseen --> causing an ERROR",name.Data()));
417 else Log(Form(
"DCS data points, successful!"));
419 else Log(Form(
"Statistical values for DCS DPs could not be computed due to missing DAQ_time_start and DAQ_time_end fields in DAQ logbook"));
425 Log(
"\n\n*************** Processing Trigger Configuration");
429 if (partition.IsNull() && !detector.IsNull()){
430 Log(
"STANDALONE partition for current run, using Trigger Configuration dummy value");
433 Log(Form(
"No dummy CTP configuration entry found, going into error..."));
439 Log(Form(
"dummy CTP config not found in OCDB entry, going into error..."));
443 TString titleCTPcfg = Form(
"CTP cfg for run %i from Dummy entry in OCDB",
fRun);
444 runcfg->SetTitle(titleCTPcfg);
447 metaData.
SetComment(
"CTP run configuration from dummy entry in OCDB");
448 if (!
Store(
"CTP",
"Config", runcfg, &metaData, 0, 0)) {
449 Log(
"Unable to store the dummy CTP run configuration object to OCDB!");
456 else if (!partition.IsNull() && detector.IsNull()){
457 Log(
"GLOBAL partition for current run, using Trigger Configuration from DAQ Logbook");
458 if (triggerConf!= NULL) {
459 Log(
"Found trigger configuration in DAQ logbook");
462 Log(
"Bad CTP run configuration file from DAQ logbook! The corresponding CDB entry will not be filled!");
466 TString titleCTPcfg = Form(
"CTP cfg for run %i from DAQ",
fRun);
467 runcfg->SetTitle(titleCTPcfg);
471 metaData.
SetComment(
"CTP run configuration from DAQ logbook");
472 if (!
Store(
"CTP",
"Config", runcfg, &metaData, 0, 0)) {
473 Log(
"Unable to store the CTP run configuration object to OCDB!");
480 Log(
"Trigger configuration NULL in DAQ logbook");
486 Log(Form(
"Incorrect field in DAQ logbook for partition = %s and detector = %s, going into error without trigger configuration...",partition.Data(),detector.Data()));
494 Log(
"\n\n*************** Processing Trigger Time Params");
498 if (partition.IsNull() && !detector.IsNull()){
499 Log(
"STANDALONE partition for current run, using CTP timing params dummy value");
502 Log(Form(
"No dummy CTP timing parameters entry found, going into error..."));
508 Log(Form(
"dummy CTP timing parameters not found in OCDB entry, going into error..."));
512 TString titleCTPtiming = Form(
"CTP timing params for run %i from Dummy entry in OCDB",
fRun);
513 runCTPtiming->SetTitle(titleCTPtiming);
516 metadata.
SetComment(
"CTP run timing parameters from dummy entry in OCDB");
517 if (!
Store(
"CTP",
"CTPtiming", runCTPtiming, &metadata, 0, 0)) {
518 Log(
"Unable to store the dummy CTP timing params object to OCDB!");
525 else if (!partition.IsNull() && detector.IsNull()){
526 Log(
"GLOBAL partition for current run, using Trigger Timing Parameters from DAQ Logbook");
527 if (triggerCTPtiming!= NULL) {
528 Log(
"Found trigger timing params in DAQ logbook");
529 AliDebug(2,Form(
"%s",triggerCTPtiming));
532 Log(
"Bad CTP trigger timing params file from DAQ logbook! The corresponding CDB entry will not be filled!");
536 TString titleCTPtiming = Form(
"CTP timing params for run %i from DAQ",
fRun);
537 runCTPtiming->SetTitle(titleCTPtiming);
541 metadata.
SetComment(
"CTP timing params from DAQ logbook");
542 if (!
Store(
"CTP",
"CTPtiming", runCTPtiming, &metadata, 0, 0)) {
543 Log(
"Unable to store the CTP timing params object to OCDB!");
550 Log(
"Trigger timing params NULL in DAQ logbook");
556 Log(Form(
"Incorrect field in DAQ logbook for partition = %s and detector = %s, going into error without trigger timing parameters...",partition.Data(),detector.Data()));
564 Log(
"\n\n*************** Processing LTU Configuration");
566 if (partition.IsNull() && !detector.IsNull()){
567 Log(
"STANDALONE partition for current run, using LTU configuration dummy value");
570 Log(Form(
"No dummy LTU Config entry found, going into error..."));
576 Log(Form(
"dummy LTU Config not found in OCDB entry, going into error..."));
582 metadata.
SetComment(
"LTU Config from dummy entry in OCDB");
583 if (!
Store(
"CTP",
"LTUConfig", ltuConfig, &metadata, 0, 0)) {
584 Log(
"Unable to store the dummy LTU Config object to OCDB!");
591 else if (!partition.IsNull() && detector.IsNull()){
593 Log(
"GLOBAL partition for current run, getting LTU Config from DAQ Logbook (logbook_detectors table)");
594 UInt_t detectorMask = (UInt_t)(((TString)
GetRunParameter(
"detectorMask")).Atoi());
595 Printf (
"detectormask = %d",detectorMask);
597 ltuarray->SetOwner(1);
598 Bool_t isLTUok = kTRUE;
600 if ((detectorMask >> i) & 0x1) {
603 if (detCTPName ==
"CTP") {
605 Printf(
"Processing CTP (CTP Detector name %s) --> SKIPPING, CTP does not have any LTU!!!!!!",detCTPName.Data());
608 Printf(
"Processing detector %s (CTP Detector name %s)",det.Data(),detCTPName.Data());
611 Log(Form(
"No LTU Configuration from DAQ logbook for detector %s (BUT it was expected)! The corresponding CDB entry will not be filled!",detCTPName.Data()));
617 Float_t ltuFineDelay1 = ltu[0].Atof();
618 Float_t ltuFineDelay2 = ltu[1].Atof();
619 Float_t ltuBCDelayAdd = ltu[2].Atof();
622 ltuarray->AddAtAndExpand(ltuConfig,i);
630 metadata.
SetComment(
"LTU Configuration for current run");
631 if (!
Store(
"CTP",
"LTUConfig", ltuarray, &metadata, 0, 0)) {
632 Log(
"Unable to store the LTU Config object to OCDB!");
640 Log(Form(
"Incorrect field in DAQ logbook for partition = %s and detector = %s, going into error without trigger timing parameters...",partition.Data(),detector.Data()));
649 if (runType ==
"PHYSICS"){
650 Log(
"\n\n*************** Processing LHC Data");
654 if( iLHCData == 0 ) {
655 Log(Form(
"LHC Data from FXS, successful!"));
656 }
else if (iLHCData == 1) {
657 Log(Form(
"LHC Data, problems with FXS!"));
659 }
else if (iLHCData == 2) {
660 Log(Form(
"LHC Data, problems with DAQ_time_start/DAQ_time_end!"));
662 }
else if (iLHCData ==3){
663 Log(Form(
"Problems in storing LHC Phase - going into Error"));
665 }
else if (iLHCData ==4){
666 Log(Form(
"Problems with LHC Phase - going into Error"));
669 Log(Form(
"LHC Data problems"));
679 Log(
"\n\n*************** Processing SPD Mean Vertex");
681 if (runType ==
"PHYSICS"){
683 if( iSPDMeanVertex == 1 ) {
684 Log(Form(
"SPD Mean Vertex, successful!"));
686 Log(Form(
"SPD Mean Vertex failed!!!"));
691 Log(
"SPD Mean Vertex not processed since runType != PHYSICS");
698 Log(
"\n\n*************** Processing DQM FXS");
702 Log(Form(
"DQM FXS, successful!"));
704 Log(Form(
"DQM FXS failed!!!"));
712 md.
SetComment(
"Output parameters from the GRP preprocessor.");
714 Bool_t result = kTRUE;
715 result =
Store(
"GRP",
"Data", grpobj, &md);
718 if (result && !error ) {
719 Log(
"GRP Preprocessor Success");
722 Log( Form(
"GRP Preprocessor FAILS!!! %s%s%s%s%s%s%s%s%s%s%s%s%s%s",
754 if (timeStartString.IsNull() || timeEndString.IsNull()){
755 if (timeStartString.IsNull()){
756 AliError(
"DAQ_time_start not set in logbook! Setting statistical values for current DP to invalid");
758 else if (timeEndString.IsNull()){
759 AliError(
"DAQ_time_end not set in logbook! Setting statistical values for current DP to invalid");
764 Double_t timeStart = timeStartString.Atof();
765 Double_t timeEnd = timeEndString.Atof();
768 if (fileName.Length()>0){
769 AliInfo(
"Got The LHC Data file");
775 Log(
"\n ************* Energy ");
786 AliError(
"Energy not found in LHC Data file!!!");
789 Double_t timeBeamModeEnd = timeEnd;
790 Double_t timeMachineModeEnd = timeEnd;
791 Double_t timeBeamEnd = timeEnd;
792 Double_t timeBeamTypeEnd[2] = {timeEnd, timeEnd};
793 Double_t timeBeamModeStart = -1;
794 Double_t timeMachineModeStart = -1;
795 Double_t timeBeamStart = -1;
796 Double_t timeBeamTypeStart[2] = {-1,-1};
797 Int_t indexBeamMode = -1;
798 Int_t indexMachineMode = -1;
799 Int_t indexBeam = -1;
800 Int_t indexBeamType[2] = {-1, -1};
801 Bool_t foundBeamModeStart = kFALSE;
802 Bool_t foundMachineModeStart = kFALSE;
803 Bool_t foundBeamStart = kFALSE;
804 Bool_t foundBeamTypeStart[2] = {kFALSE, kFALSE};
805 Bool_t flagBeamMode = kFALSE;
806 Bool_t flagMachineMode = kFALSE;
807 Bool_t flagBeam = kFALSE;
808 Bool_t flagBeamType[2] = {kFALSE, kFALSE};
810 Double_t arrayTimes[5]={2.E9, 2.E9, 2.E9, 2.E9, 2.E9};
819 Log(
"\n ************* BeamMode (LHCState) ");
820 Bool_t forceStableBeam = (Bool_t)(((TString)
GetRunParameter(
"forceLHCReco")).Atoi());
821 AliInfoF(
"Query forceLHCReco logbook flag: %s",forceStableBeam ?
"ON":
"OFF");
823 Int_t nBeamMode = -1;
825 nBeamMode = beamModeArray->GetEntries();
827 AliInfo(
"Found zero entries for the Beam Mode, leaving it empty");
830 for (Int_t iBeamMode = 0; iBeamMode<nBeamMode; iBeamMode++){
835 indexBeamMode = iBeamMode;
836 foundBeamModeStart = kTRUE;
844 if (!foundBeamModeStart){
845 AliInfo(
"No value for the Beam Mode found before start of run, the Beam Mode will remain empty");
850 TString lhcStateS = beamModeString->String();
851 AliInfo(Form(
"LHC State (corresponding to BeamMode) = %s (set at %f)",lhcStateS.Data(),beamMode->
GetTimeStamp()));
852 if (forceStableBeam) {
853 TPRegexp reStable(
"^STABLE[_ ]BEAMS$");
854 if (lhcStateS.Index(reStable)) {
855 AliInfoF(
"Overriding LHC beam state from \"%s\" to \"%s\"",lhcStateS.Data(),
"STABLE BEAMS");
856 lhcStateS =
"STABLE BEAMS";
860 if (indexBeamMode < nBeamMode-1){
864 AliError(
"you did not choose the correct value! there is still something before (or at) SOR, but later than this!");
869 TString bmString0 = beamModeString->String();
870 TString bmString1 = beamModeString1->String();
871 if (bmString0.CompareTo(bmString1.Data(),TString::kIgnoreCase) == -1){
872 AliWarning(Form(
"The beam mode changed from %s to %s during the run at timestamp %f! Setting it to %s and keeping track of the time of the change to set MaxTimeLHCValidity afterward",bmString0.Data(), bmString1.Data(), timeBeamModeEnd, bmString0.Data()));
873 flagBeamMode = kTRUE;
874 arrayTimes[1]=timeBeamModeEnd;
880 AliInfo(
"Invalid pointer for the first entry for Beam Mode after the first valid one, not considering anything after what has already been found");
885 delete beamModeArray;
888 AliError(
"Beam mode array not found in LHC Data file!!!");
892 Log(
"\n ************* MachineMode ");
894 Int_t nMachineMode = -1;
895 if (machineModeArray){
896 nMachineMode = machineModeArray->GetEntries();
897 if (nMachineMode==0){
898 AliInfo(
"No Machine Mode found, leaving it empty");
901 for (Int_t iMachineMode = 0; iMachineMode<nMachineMode; iMachineMode++){
906 indexMachineMode = iMachineMode;
907 foundMachineModeStart = kTRUE;
914 if (!foundMachineModeStart){
915 AliInfo(
"No value for the Machine Mode found before start of run, the Machine Mode will remain empty");
920 AliInfo(Form(
"MachineMode = %s (set at %f)",(machineModeString->String()).Data(),machineMode->
GetTimeStamp()));
922 if (indexMachineMode < nMachineMode-1){
928 TString mmString0 = machineModeString->String();
929 TString mmString1 = machineModeString1->String();
930 if (mmString0.CompareTo(mmString1.Data(),TString::kIgnoreCase) == -1){
931 AliWarning(Form(
"The machine mode changed from %s to %s during the run at timestamp %f! Setting it to %s and keeping track of the time of the change to set MaxTimeLHCValidity afterward",mmString0.Data(),mmString1.Data(),timeMachineModeEnd,mmString0.Data()));
932 flagMachineMode = kTRUE;
933 arrayTimes[0]=timeMachineModeEnd;
938 AliInfo(
"Invalid pointer for the first entry for Machine Mode after the first valid one, not considering anything after what has already been found");
943 delete machineModeArray;
946 AliError(
"Machine mode array not found in LHC Data file!!!");
950 Log(
"\n ************* BeamType ");
953 Int_t nBeam = beamArray->GetEntries();
955 AliInfo(
"No Beam Type found, leaving it empty");
958 for (Int_t iBeam = 0; iBeam<nBeam; iBeam++){
964 foundBeamStart = kTRUE;
971 if (!foundBeamStart){
972 AliInfo(
"No value for the Beam Type found before start of run, the (common) Beam Type will remain empty");
977 TString beamType = beamString->String();
978 AliInfo(Form(
"Beam Type = %s",beamType.Data()));
979 if (beamType.CompareTo(
"PROTON",TString::kIgnoreCase) == 0){
980 AliInfo(
"Setting beam type to p-p");
984 AliInfo(
"Setting beam type to A-A");
996 if (indexBeam < nBeam-1){
1002 TString beamType1 = beamString1->String();
1003 if (beamType.CompareTo(beamType1.Data(),TString::kIgnoreCase) == -1){
1004 AliWarning(Form(
"The Beam Type changed from %s to %s during the run at timestamp %f! Setting it to %s and keeping track of the time of the change to set MaxTimeLHCValidity afterward",beamType.Data(),(beamString1->String()).Data(),timeBeamEnd,beamType.Data()));
1006 arrayTimes[2] = timeBeamEnd;
1011 AliInfo(
"Invalid pointer for the first entry for Beam Type after the first valid one, not considering anything after what has already been found");
1019 AliError(
"Beam Type array not found in LHC Data file!!!");
1023 Log(
"\n ************* BeamType, 1 and 2 ");
1024 Int_t indexBeamTypeString = 6;
1025 TString combinedBeamType =
"-";
1026 TString combinedBeamTypeFromLHC =
"-";
1027 for (Int_t ibeamType = 0; ibeamType<2; ibeamType++){
1030 Int_t nBeam = beamArray->GetEntries();
1035 for (Int_t iBeam = 0; iBeam<nBeam; iBeam++){
1040 indexBeamType[ibeamType] = iBeam;
1041 foundBeamTypeStart[ibeamType] = kTRUE;
1048 if (!foundBeamTypeStart[ibeamType]){
1049 AliInfo(Form(
"No value for the Beam Type %s found before start of run, the Beam Type %d will remain empty",
fgkLHCDataPoints[indexBeamTypeString+ibeamType], ibeamType));
1054 TString beamType = beamString->String();
1057 AliInfo(Form(
"Single Beam Type for beam %d set to %s", ibeamType, singleBeam.Data()));
1059 if (beamType.CompareTo(
"PROTON",TString::kIgnoreCase) == 0){
1060 AliInfo(Form(
"Setting beam %d for combined beam type to p", ibeamType));
1061 if (ibeamType == 0) combinedBeamType.Prepend(
"p");
1062 else combinedBeamType.Append(
"p");
1065 AliInfo(Form(
"Setting beam %d for combined beam type to A",ibeamType));
1066 if (ibeamType == 0) combinedBeamType.Prepend(
"A");
1067 else combinedBeamType.Append(
"A");
1069 if (ibeamType == 0) combinedBeamTypeFromLHC.Prepend(beamType);
1070 else combinedBeamTypeFromLHC.Append(beamType);
1080 if (indexBeamType[ibeamType] < nBeam-1){
1086 TString beamType1 = beamString1->String();
1087 if (beamType.CompareTo(beamType1.Data(),TString::kIgnoreCase) == -1){
1088 AliWarning(Form(
"The Beam Type for %s changed from %s to %s during the run at timestamp %f! Setting it to %s and keeping track of the time of the change to set MaxTimeLHCValidity afterward",
fgkLHCDataPoints[indexBeamTypeString+ibeamType],beamType.Data(),(beamString1->String()).Data(),timeBeamEnd,beamType.Data()));
1089 flagBeamType[ibeamType] = kTRUE;
1090 arrayTimes[3+ibeamType] = timeBeamTypeEnd[ibeamType];
1095 AliInfo(Form(
"Invalid pointer for the first entry for Beam Type %s after the first valid one, not considering anything after what has already been found",
fgkLHCDataPoints[indexBeamTypeString+ibeamType]));
1103 AliError(Form(
"Beam Type %s array not found in LHC Data file!!!",
fgkLHCDataPoints[indexBeamTypeString+ibeamType]));
1106 AliInfo(Form(
"Setting combined beam type to %s",combinedBeamType.Data()));
1108 AliInfo(Form(
"Setting combined beam type form LHC to %s",combinedBeamTypeFromLHC.Data()));
1112 if (flagBeamMode == kTRUE || flagMachineMode == kTRUE || flagBeam == kTRUE || flagBeamType[0] == kTRUE || flagBeamType[1] == kTRUE){
1113 Double_t minTimeLHCValidity= TMath::MinElement(5,arrayTimes);
1114 AliWarning(Form(
"Setting MaxTimeLHCValidity to %f",minTimeLHCValidity));
1149 Log(
"\n ************* Data Quality Flag ");
1151 Int_t nDataQuality = -1;
1152 Double_t timeDataQualityStart = -1;
1153 Int_t indexDataQuality = -1;
1154 Bool_t foundDataQualityStart = kFALSE;
1156 if (dataQualityArray){
1157 nDataQuality = dataQualityArray->GetEntries();
1158 if (nDataQuality==0){
1159 AliInfo(
"No Data Quality Flag found, leaving it empty");
1162 for (Int_t iDataQuality = 0; iDataQuality<nDataQuality; iDataQuality++){
1167 indexDataQuality = iDataQuality;
1168 foundDataQualityStart = kTRUE;
1176 if (!foundDataQualityStart){
1178 AliInfo(
"No value for the Data Quality Flag found before start of run, the Data Quality Flag will remain empty");
1182 Bool_t foundEndOfFalse = kFALSE;
1184 for (Int_t iDataQuality = indexDataQuality; iDataQuality < nDataQuality; iDataQuality ++){
1186 AliDebug(4,Form(
"dataQuality->GetTimeStamp() = %f, timeDataQualityStart = %f, timeEnd = %f", dataQuality->
GetTimeStamp(), timeDataQualityStart, timeEnd ));
1188 Bool_t dataQualityFlag = dataQuality->
GetBool(0);
1189 AliDebug(3,Form(
"DataQuality = %d (set at %f)",(Int_t)dataQualityFlag,dataQuality->
GetTimeStamp()));
1190 if (dataQualityFlag != kTRUE){
1191 if (iDataQuality == indexDataQuality) {
1192 AliError(
"The first value for the Data Quality MUST be TRUE! Ignoring for now...");
1199 AliInfo(Form(
"Found %d FALSE values for the Data Quality Flag",nFalse));
1200 Double_t falses[nFalse*2];
1202 Int_t iDataQuality = indexDataQuality;
1207 while (iDataQuality < nDataQuality){
1208 AliDebug(3,Form(
"iDataQuality = %d",iDataQuality));
1211 Bool_t dataQualityFlag = dataQuality->
GetBool(0);
1212 AliDebug(3,Form(
"DataQuality = %d (set at %f)",(Int_t)dataQualityFlag,dataQuality->
GetTimeStamp()));
1213 if (dataQualityFlag == kTRUE){
1226 foundEndOfFalse = kFALSE;
1227 Int_t iDataQualityNext = iDataQuality+1;
1228 while (iDataQualityNext < nDataQuality){
1231 Bool_t dataQualityFlagNext = dataQualityNext->
GetBool(0);
1232 AliDebug(3,Form(
"DataQualityNext = %d (set at %f)",(Int_t)dataQualityFlagNext,dataQualityNext->
GetTimeStamp()));
1233 if (dataQualityFlagNext == kTRUE){
1235 foundEndOfFalse = kTRUE;
1243 if (!foundEndOfFalse) {
1244 AliInfo(
"Please, note that the last FALSE value lasted until the end of the run");
1245 falses[iFalse*2+1] = timeEnd;
1249 iDataQuality = iDataQualityNext+1;
1258 delete dataQualityArray;
1261 AliError(
"Data Quality Flag array not found in LHC Data file!!!");
1268 AliInfo(Form(
"Filled %d records to AliLHCData object",dt->
GetData().GetEntriesFast()));
1271 md.
SetComment(
"LHC data from the GRP preprocessor.");
1272 Bool_t result = kTRUE;
1273 result =
Store(
"GRP",
"LHCData", dt, &md);
1276 Log(Form(
"Problems in storing LHC Data - but not going into Error"));
1284 if (beam1phase == 0x0 || beam2phase == 0x0){
1285 Log(Form(
"Problems in retrieving LHC Clock data from LHC file"));
1292 AliInfo(Form(
"LHC Phase found"));
1296 Bool_t result = kTRUE;
1297 result =
Store(
"Calib",
"LHCClockPhase", phaseObj, &mdPhase);
1299 if (!result)
return 3;
1305 AliError(
"No LHCData file found in FXS");
1321 Bool_t storeResult = kTRUE;
1322 if (list !=0x0 && list->GetEntries()!=0)
1324 AliInfo(
"The following sources produced files with the id VertexDiamond from SPD");
1326 for (Int_t jj=0;jj<list->GetEntries();jj++){
1327 TObjString * str =
dynamic_cast<TObjString*
> (list->At(jj));
1329 AliError(Form(
"Expecting a TObjString in the list for the %d-th source, but something else was found.",jj));
1332 AliInfo(Form(
"found source %s", str->String().Data()));
1334 if (fileNameRun.Length()>0){
1335 AliInfo(Form(
"Got the file %s", fileNameRun.Data()));
1336 TFile daqFile(fileNameRun.Data(),
"READ");
1337 if (daqFile.IsOpen()) {
1345 storeResult =
Store(
"Calib",
"MeanVertexSPD", meanVtx, &md, 0, 0);
1348 AliWarning(
"No SPD Mean Vertex object found in file");
1353 storeResult = kFALSE;
1357 AliWarning(
"No file found for current source for SPD Mean Vertex");
1362 AliWarning(
"No list found for SPD Mean Vertex");
1365 if (list)
delete list;
1379 Bool_t openFileResult = kTRUE;
1380 Bool_t storeResultQAThr = kTRUE;
1381 if (list !=0x0 && list->GetEntries()!=0){
1382 AliInfo(
"The following sources produced files with the id TriggerClassesAndHistosToClone for GRP");
1384 for (Int_t jj=0;jj<list->GetEntries();jj++){
1385 TObjString * str =
dynamic_cast<TObjString*
> (list->At(jj));
1387 AliError(Form(
"Expecting a TObjString in the list for the %d-th source, but something else was found.",jj));
1390 AliInfo(Form(
"found source %s", str->String().Data()));
1391 TString fileNameRun =
GetFile(
kDQM,
"TriggerClassesAndHistosToClone", str->GetName());
1392 if (fileNameRun.Length()>0){
1393 AliInfo(Form(
"Got the file %s", fileNameRun.Data()));
1394 TFile dqmFile(fileNameRun.Data(),
"READ");
1395 if (dqmFile.IsOpen()) {
1400 openFileResult = kFALSE;
1404 AliWarning(
"No file found for current source for DQM TriggerClassesAndHistosToClone");
1409 AliWarning(
"No list found for DQM TriggerClassesAndHistosToClone");
1412 if (list)
delete list;
1418 if (detName ==
"TRI" || detName ==
"HLT" || detName ==
"TST")
continue;
1419 AliDebug(2, Form(
"Processing QAThreshold for detector %s",detName.Data()));
1421 if (listQAThr !=0x0){
1422 if (listQAThr->GetEntries() > 1){
1423 AliError(Form(
"More than one sources found for QAThresholds from detector %s, skipping",detName.Data()));
1426 else if (listQAThr->GetEntries()==1){
1427 AliInfo(Form(
"The following source produced files with the id QAThresholds for GRP, coming from detector %s:",detName.Data()));
1429 TObjString * str =
dynamic_cast<TObjString*
> (listQAThr->At(0));
1431 AliError(Form(
"Expecting a TObjString in the list for detector %s, but something else was found.",detName.Data()));
1435 AliInfo(Form(
"found source %s", str->String().Data()));
1436 TString fileNameRun =
GetForeignFile(detName.Data(),
kDQM,
"QAThresholds", str->GetName());
1437 if (fileNameRun.Length()>0){
1438 AliInfo(Form(
"Got the file %s", fileNameRun.Data()));
1439 TFile dqmFile(fileNameRun.Data(),
"READ");
1440 if (dqmFile.IsOpen()) {
1444 if (qaThrId != idet){
1445 AliError(Form(
"Expecting QA threshold for detector %s, but found that for detector %s, skipping",detName.Data(),
AliDAQ::OnlineName(qaThrId)));
1450 qaThrArray->AddAtAndExpand(qaThr, qaThrId);
1455 AliError(Form(
"No QAThresholds object found in the file for detector %s, skipping",detName.Data()));
1461 AliError(Form(
"Can't open QAThreshold file for detector %s, skipping",detName.Data()));
1467 AliWarning(Form(
"No file found for DQM QAThreshold for detector %s, skipping",detName.Data()));
1473 AliError(Form(
"No sources found for QAThresholds from detector %s, skipping",detName.Data()));
1479 AliWarning(Form(
"No list found for DQM QAThreshold for detector %s, skipping",detName.Data()));
1483 if (qaThrArray->GetEntries() > 0){
1487 storeResultQAThr =
Store(
"Calib",
"QAThresholds", qaThrArray, &md, 0, 0);
1490 Printf(
"No valid QAThresholds entries found, storing nothing in the OCDB");
1493 Printf(
"openFileResult for QAThr processing would be %d, but we return kTRUE anyway", (Int_t)openFileResult);
1494 Printf(
"storeResultQAThr for QAThr processing would be %d, but we return kTRUE anyway", (Int_t)storeResultQAThr);
1506 time_t timeStart = (time_t)(((TString)
GetRunParameter(
"DAQ_time_start")).Atoi());
1507 time_t timeEnd = (time_t)(((TString)
GetRunParameter(
"DAQ_time_end")).Atoi());
1508 Float_t beamEnergy = (Float_t)(((TString)
GetRunParameter(
"beamEnergy")).Atof());
1510 Char_t numberOfDetectors = (Char_t)(((TString)
GetRunParameter(
"numberOfDetectors")).Atoi());
1511 UInt_t detectorMask = (UInt_t)(((TString)
GetRunParameter(
"detectorMask")).Atoi());
1516 if (timeEnd >= 2.E9)
AliFatal(
"ALICE run finshed later than Wed May 18 2033, 03:33:20 GMT, maximum time allowed for LHC data --> fix the GRP preprocessor!!!");
1518 UInt_t nparameter = 0;
1519 if (timeStart != 0){
1521 Log(Form(
"Start time for run %d: %d",
fRun, (Int_t)timeStart));
1525 Log(Form(
"Start time not put in logbook, setting to invalid in GRP entry, and causing an error!"));
1530 Log(Form(
"End time for run %d: %i",
fRun, (Int_t)timeEnd));
1534 Log(Form(
"End time not put in logbook, setting to invalid in GRP entry, and causing an error!"));
1537 if (beamEnergy != 0){
1538 Log(Form(
"Beam Energy for run %d: %f (NOT USING IT TO FILL THE GRP OBJECT, taking it from the LHC file)",
fRun, beamEnergy));
1541 Log(Form(
"Beam Energy not put in logbook, but not using it anyway for the GRP object (taking it from the LHC file)"));
1545 if (beamType.Length() != 0){
1546 Log(Form(
"Beam Type for run %d: %s (NOT USING IT TO FILL THE GRP OBJECT, taking it from the LHC file)",
fRun, beamType.Data()));
1549 Log(Form(
"Beam Type not put in logbook, but not using it anyway for the GRP entry (taking it from the LHC file)"));
1552 if (numberOfDetectors != 0){
1554 Log(Form(
"Number Of Detectors for run %d: %d",
fRun, (Int_t)numberOfDetectors));
1558 Log(Form(
"Number Of Detectors not put in logbook, setting to invalid in GRP entry, and causing an error!"));
1561 if (detectorMask != 0){
1563 Log(Form(
"Detector Mask for run %d: %d",
fRun, detectorMask));
1567 Log(Form(
"Detector Mask not put in logbook, setting to invalid in GRP entry, and causing an error!"));
1570 if (lhcPeriod.Length() != 0) {
1572 Log(Form(
"LHC period (DAQ) for run %d: %s",
fRun, lhcPeriod.Data()));
1576 Log(Form(
"LHCperiod not put in logbook, setting to invalid in GRP entry, and causing an error!"));
1578 if (runType.Length() != 0) {
1580 Log(Form(
"Run Type (DAQ) for run %d: %s",
fRun, runType.Data()));
1584 Log(Form(
"Run Type not put in logbook, setting to invalid in GRP entry, and causing an error!"));
1588 if (hltModeStr.Length() != 0) {
1589 Log(Form(
"HLTmode found in logbook is %s", hltModeStr.Data()));
1591 TSubString firstChar = hltModeStr(0,1);
1592 if (firstChar ==
"A") {
1595 else if (firstChar ==
"B") {
1598 else if (firstChar ==
"C"){
1604 Log(Form(
"HLT mode not found in logbook, setting to unknown in GRP entry, and causing an error!"));
1615 AliRawEventHeaderV3_9::Class()->IgnoreTObjectStreamer();
1616 AliRawEventHeaderV3_11::Class()->IgnoreTObjectStreamer();
1617 AliRawEventHeaderV3_12::Class()->IgnoreTObjectStreamer();
1618 AliRawEventHeaderV3_13::Class()->IgnoreTObjectStreamer();
1619 AliRawEventHeaderV3_14::Class()->IgnoreTObjectStreamer();
1620 Log(
"Processing DAQ FXS");
1623 Log(
"No raw data tag list: connection problems with DAQ FXS logbook!");
1627 if (list->GetEntries() == 0) {
1628 Log(
"no raw data tags in this run: nothing to merge!");
1629 delete list; list=0;
1633 TChain *fRawTagChain =
new TChain(
"T");
1635 Int_t nCorruptedFiles=0;
1636 TIterator* iter = list->MakeIterator();
1638 while ((obj = iter->Next())) {
1639 TObjString* objStr =
dynamic_cast<TObjString*
> (obj);
1641 Log(Form(
"Found source %s", objStr->String().Data()));
1644 Log(
"No list with ids from DAQ was found: connection problems with DAQ FXS logbook!");
1645 delete fRawTagChain; fRawTagChain=0;
1648 Log(Form(
"Number of ids: %d",list2->GetEntries()));
1649 for(Int_t i = 0; i < list2->GetEntries(); i++) {
1650 TObjString *idStr = (TObjString *)list2->At(i);
1651 if (idStr->String().CompareTo(
"QAThreshold") == 0 || idStr->String().CompareTo(
"TriggerClassesAndHistosToClone") == 0) {
1652 Log(Form(
"Skipping file with Id %s",idStr->String().Data()));
1656 if (fileName.Length() > 0) {
1658 Log(Form(
"The file records for \"%s\" are corrupted! The chain is skipping it.",fileName.Data()));
1661 Log(Form(
"Adding file in the chain: %s",fileName.Data()));
1662 fRawTagChain->Add(fileName.Data());
1666 Log(Form(
"Could not retrieve file with id %s from source %s: " 1667 "connection problems with DAQ FXS!",
1668 idStr->String().Data(), objStr->String().Data()));
1669 delete list; list=0;
1670 delete list2; list2=0;
1671 delete fRawTagChain; fRawTagChain=0;
1680 Log(
"no raw data tags in this run: it could be that one or more files were found in the DAQ FXS, but they were ignored, since not interesting for the raw data tag: nothing to merge!");
1685 delete fRawTagChain;
1690 TString fRawDataFileName =
"GRP_Merged.tag.root";
1691 if(nCorruptedFiles!=0)
1692 Log(Form(
"Merging %d raw data tags into file: %s. %d corrupted files skipped", nFiles, fRawDataFileName.Data(), nCorruptedFiles));
1694 Log(Form(
"Merging %d raw data tags into file: %s", nFiles, fRawDataFileName.Data()));
1696 if (fRawTagChain->Merge(fRawDataFileName) < 1 ) {
1697 Log(Form(
"Error merging %d raw data files!!!",nFiles));
1702 delete fRawTagChain;
1707 TString outputfile = Form(
"Run%d.Merged.RAW.tag.root",
fRun);
1711 Log(
"Problem storing raw data tags in local file!!!");
1713 Log(
"Raw data tags merged successfully!!");
1720 delete fRawTagChain; fRawTagChain=0;
1722 if (result == kFALSE) {
1742 if (partition.IsNull() && !detector.IsNull()){
1743 Log(
"STANDALONE partition for current run, using Trigger Scalers and Trigger Aliases dummy values");
1746 if (!cdbEntryScalers) {
1747 Log(Form(
"No dummy CTP scalers entry found, going into error..."));
1753 Log(Form(
"CTP dummy scalers not found in OCDB entry, going into error..."));
1759 metaData.
SetComment(
"CTP scalers from dummy entry in OCDB");
1760 if (!
Store(
"CTP",
"Scalers", scalers, &metaData, 0, 0)) {
1761 Log(
"Unable to store the dummy CTP scalers object to OCDB!");
1769 if (!cdbEntryAliases) {
1770 Log(Form(
"No dummy CTP aliases entry found, going into error..."));
1774 THashList *aliases =
dynamic_cast<THashList*
>(cdbEntryAliases->
GetObject());
1776 Log(Form(
"CTP dummy aliases not found in OCDB entry, going into error..."));
1782 metaData.
SetComment(
"CTP mapping of trigger classes to trigger aliases");
1783 if (!
Store(
"CTP",
"Aliases", aliases, &metaData, 0, 0)) {
1784 Log(
"Unable to store the dummy CTP aliases object to OCDB!");
1792 else if (!partition.IsNull() && detector.IsNull()){
1793 Log(
"GLOBAL partition for current run, using CTP scalers from DCS FXS");
1794 TString countersfile =
GetFile(
kDCS,
"CTP_xcounters",
"");
1795 if (countersfile.IsNull()) {
1796 Log(
"No CTP counters files has been found: empty source!");
1800 Log(Form(
"File with Id CTP_xcounters found in DCS FXS! Copied to %s",countersfile.Data()));
1803 Log(
"Bad CTP counters file! The corresponding CDB entry will not be filled!");
1811 if (!
Store(
"CTP",
"Scalers", scalers, &metaData, 0, 0)) {
1812 Log(
"Unable to store the CTP scalers object to OCDB!");
1822 TString aliasesFile =
GetFile(
kDCS,
"CTP_aliases",
"");
1823 if (aliasesFile.IsNull()) {
1824 Log(
"No CTP aliases files has been found: empty source!");
1828 Log(Form(
"File with Id CTP_aliases found in DCS FXS! Copied to %s",aliasesFile.Data()));
1831 if (!trClasses2Aliases) {
1832 Log(
"Bad CTP aliases file! The corresponding CDB entry will not be filled!");
1839 metaData.
SetComment(
"CTP mapping of trigger classes to trigger aliases");
1840 if (!
Store(
"CTP",
"Aliases", trClasses2Aliases, &metaData, 0, 0)) {
1841 Log(
"Unable to store the CTP aliases object to OCDB!");
1842 delete trClasses2Aliases;
1846 delete trClasses2Aliases;
1852 Log(Form(
"Incorrect field in DAQ logbook for partition = %s and detector = %s, going into error...",partition.Data(),detector.Data()));
1872 if (gSystem->AccessPathName(aliasesFile)) {
1873 Printf(
"file (%s) not found", aliasesFile);
1877 ifstream *file =
new ifstream(aliasesFile);
1879 Printf(
"Error opening file (%s) !",aliasesFile);
1885 THashList *hList =
new THashList(10);
1886 hList->SetName(
"List of trigger classes to trigger aliases strings");
1889 while (strLine.ReadLine(*file)) {
1892 if (strLine.IsNull())
continue;
1893 strLine.ReplaceAll(
'\t',
' ');
1894 strLine.Remove(TString::kLeading,
' ');
1895 strLine.Remove(TString::kTrailing,
'\r');
1896 strLine.Remove(TString::kTrailing,
' ');
1899 if(arr->GetEntries() != 2){
1900 Printf(
"The line:\n%s\nunexpectedly contains %d tokens, instead of two.",strLine.Data(),arr->GetEntries());
1904 TObjString *osTC = (TObjString*) arr->At(0);
1905 TObjString *osTAlist = (TObjString*) arr->At(1);
1906 TNamed *ctoa =
new TNamed(osTC->GetName(),osTAlist->GetName());
1926 Int_t nL3Entries = 0;
1927 Int_t nDipoleEntries = 0;
1928 Int_t nEnvEntries = 0;
1929 Int_t nHallProbesEntries = 0;
1935 Log(Form(
"L3Entries = %d, nDipoleEntries =%d, nEnvEntries = %d, nHallProbesEntries = %d", nL3Entries, nDipoleEntries, nEnvEntries, nHallProbesEntries));
1936 entries = nL3Entries + nDipoleEntries + nEnvEntries + nHallProbesEntries;
1950 Int_t nL3Entries = 0;
1954 Int_t indexDP_Redu = -1;
1955 Int_t indexDP_Processed = -1;
1956 Bool_t isZero = kTRUE;
1958 Log(Form(
"\n ========== L3Current ==========="));
1959 Bool_t outOfRange = kFALSE;
1962 indexDP_Processed = indexDP;
1966 indexDP_Processed = indexDP_Redu;
1970 Log(Form(
"Also the redundant point %s is not found in the map!!!",
fgkDCSDataPoints[indexDP_Redu]));
1973 if (array->GetEntries() == 0){
1978 if (floatDCS != NULL){
1995 if (array) array = 0x0;
1997 Log(Form(
"\n ========== L3Polarity ==========="));
2000 indexDP_Processed = indexDP;
2004 indexDP_Processed = indexDP_Redu;
2008 Log(Form(
"Also the redundant point %s is not found in the map!!!",
fgkDCSDataPoints[indexDP_Redu]));
2011 if (array->GetEntries() == 0){
2015 Bool_t change = kFALSE;
2017 if (change == kFALSE){
2025 AliInfo(Form(
"%s set to invalid, but magnet was OFF (according to the current), DP not considered wrong",
fgkDCSDataPoints[indexDP]));
2031 AliError(Form(
"%s value changed within the run, while the magnet was ON (according to the current), setting it to invalid and considering the DP as wrong",
fgkDCSDataPoints[indexDP]));
2047 Int_t nDipoleEntries = 0;
2050 Int_t indexDP_Redu = -1;
2051 Int_t indexDP_Processed = -1;
2052 Bool_t isZero = kTRUE;
2054 Log(Form(
"\n ========== DipoleCurrent ==========="));
2055 Bool_t outOfRange = kFALSE;
2058 indexDP_Processed = indexDP;
2062 indexDP_Processed = indexDP_Redu;
2066 Log(Form(
"Also the redundant point %s is not found in the map!!!",
fgkDCSDataPoints[indexDP_Redu]));
2069 if (array->GetEntries() == 0){
2074 if (floatDCS != NULL){
2091 if (array) array = 0x0;
2093 Log(Form(
"\n ========== DipolePolarity ==========="));
2096 indexDP_Processed = indexDP;
2100 indexDP_Processed = indexDP_Redu;
2104 Log(Form(
"Also the redundant point %s is not found in the map!!!",
fgkDCSDataPoints[indexDP_Redu]));
2107 if (array->GetEntries() == 0){
2111 Bool_t change = kFALSE;
2121 AliInfo(Form(
"%s set to invalid, but magnet was OFF (according to the current), DP not considered wrong",
fgkDCSDataPoints[indexDP]));
2127 AliError(Form(
"%s value changed within the run while the magnet was ON (according to the current), setting it to invalid and considering the DP as wrong",
fgkDCSDataPoints[indexDP]));
2132 return nDipoleEntries;
2143 Int_t nEnvEntries = 0;
2146 Int_t indexDP_Redu = -1;
2147 Int_t indexDP_Processed = -1;
2149 Log(Form(
"\n ========== CavernTemperature ==========="));
2150 Bool_t outOfRange = kFALSE;
2153 indexDP_Processed = indexDP;
2157 indexDP_Processed = indexDP_Redu;
2161 Log(Form(
"Also the redundant point %s is not found in the map!!!",
fgkDCSDataPoints[indexDP_Redu]));
2164 if (array->GetEntries() == 0){
2169 if (floatDCS != NULL){
2185 if (array) array = 0x0;
2187 Log(Form(
"\n ========== AtmosPressures (Cavern + Surface + Cavern2) ==========="));
2191 Log(Form(
"Check the pressure sensor values! Not all the %d pressure sensors have been fit",
kNumSensors));
2195 Log(Form(
"\n ========== CavernAtmosPressure ==========="));
2200 TGraph* graph = 0x0;
2201 TGraph* graph_Redu = 0x0;
2203 if (sensorCavernP2) graph = sensorCavernP2->
GetGraph();
2204 AliDebug(3,Form(
"index = %d",indexDP));
2206 AliDebug(2,Form(
"graph = %p",graph));
2207 AliDebug(3,Form(
"sensorCavernP2 = %p", sensorCavernP2));
2209 if (sensorCavernP2_Redu) graph_Redu = sensorCavernP2_Redu->
GetGraph();
2210 AliDebug(3,Form(
"index_Redu = %d",indexDP_Redu));
2212 AliDebug(2,Form(
"graph_Redu = %p",graph_Redu));
2213 AliDebug(3,Form(
"sensorCavernP2_Redu = %p", sensorCavernP2_Redu));
2215 if(sensorCavernP2 && (sensorCavernP2->
GetFit() || graph)) {
2216 if (sensorCavernP2->
GetFit()){
2220 Log(Form(
"Fit for sensor %s not found, but the graph is there - NOT going into error",
fgkDCSDataPoints[indexDP]));
2227 else if(sensorCavernP2_Redu && (sensorCavernP2_Redu->
GetFit() || graph_Redu)) {
2228 Log(Form(
"Neither graph nor fit found for sensor %s, we are using the redundant entry now",
fgkDCSDataPoints[indexDP]));
2229 if (sensorCavernP2_Redu->
GetFit()){
2233 Log(Form(
"Fit for sensor %s not found, but the graph is there - NOT going into error",
fgkDCSDataPoints[indexDP_Redu]));
2242 Log(Form(
"ERROR!!! Neither graph nor fit found for sensor %s (we tried also the redundant copy) - this will not increase the number of found DCS DPs and will cause an error",
fgkDCSDataPoints[indexDP] ));
2245 Log(Form(
"\n ========== SurfaceAtmosPressure ==========="));
2251 if (sensorP2) graph = sensorP2->
GetGraph();
2252 AliDebug(3,Form(
"index = %d",indexDP));
2254 AliDebug(2,Form(
"graph = %p",graph));
2255 AliDebug(3,Form(
"sensorP2 = %p", sensorP2));
2257 if (sensorP2_Redu) graph_Redu = sensorP2_Redu->
GetGraph();
2258 AliDebug(3,Form(
"index_Redu = %d",indexDP_Redu));
2260 AliDebug(2,Form(
"graph_Redu = %p",graph_Redu));
2261 AliDebug(3,Form(
"sensorP2_Redu = %p", sensorP2_Redu));
2263 if(sensorP2 && (sensorP2->
GetFit() || graph)) {
2268 Log(Form(
"Fit for sensor %s not found, but the graph is there - NOT going into error",
fgkDCSDataPoints[indexDP]));
2275 else if(sensorP2_Redu && (sensorP2_Redu->
GetFit() || graph_Redu)) {
2276 Log(Form(
"Neither graph nor fit found for sensor %s, we are using the redundant entry now",
fgkDCSDataPoints[indexDP]));
2277 if (sensorP2_Redu->
GetFit()){
2281 Log(Form(
"Fit for sensor %s not found, but the graph is there - NOT going into error",
fgkDCSDataPoints[indexDP_Redu]));
2290 Log(Form(
"ERROR!!! Neither graph nor fit found for sensor %s (we tried also the redundant copy) - this will not increase the number of found DCS DPs and will cause an error",
fgkDCSDataPoints[indexDP] ));
2293 Log(Form(
"\n ========== CavernAtmosPressure2 ==========="));
2299 if (sensorCavernP22) graph = sensorCavernP22->
GetGraph();
2300 AliDebug(3,Form(
"index = %d",indexDP));
2302 AliDebug(2,Form(
"graph = %p",graph));
2303 AliDebug(3,Form(
"sensorCavernP2_2 = %p", sensorCavernP22));
2305 if (sensorCavernP22_Redu) graph_Redu = sensorCavernP22_Redu->
GetGraph();
2306 AliDebug(3,Form(
"index_Redu = %d",indexDP_Redu));
2308 AliDebug(2,Form(
"graph_Redu = %p",graph_Redu));
2309 AliDebug(3,Form(
"sensorCavernP2_2_Redu = %p", sensorCavernP22_Redu));
2311 if(sensorCavernP22 && (sensorCavernP22->
GetFit() || graph)) {
2312 if (sensorCavernP22->
GetFit()){
2316 Log(Form(
"Fit for sensor %s not found, but the graph is there - NOT going into error",
fgkDCSDataPoints[indexDP]));
2323 else if(sensorCavernP22_Redu && (sensorCavernP22_Redu->
GetFit() || graph_Redu)) {
2324 Log(Form(
"Neither graph nor fit found for sensor %s, we are using the redundant entry now",
fgkDCSDataPoints[indexDP]));
2325 if (sensorCavernP22_Redu->
GetFit()){
2329 Log(Form(
"Fit for sensor %s not found, but the graph is there - NOT going into error",
fgkDCSDataPoints[indexDP_Redu]));
2338 Log(Form(
"ERROR!!! Neither graph nor fit found for sensor %s (we tried also the redundant copy) - this will not increase the number of found DCS DPs and will cause an error",
fgkDCSDataPoints[indexDP] ));
2352 Int_t nHPEntries = 0;
2361 outOfRange = kFALSE;
2368 if (array->GetEntries() == 0){
2373 if (floatDCS != NULL){
2374 AliDebug(2,Form(
"value[0] = %f, value[1] = %f, value[2] = %f, value[3] = %f, value[4] = %f",floatDCS[0],floatDCS[1],floatDCS[2],floatDCS[3],floatDCS[4]));
2376 for (Int_t kk = 0 ; kk< 5; kk++){
2395 Log(Form(
"Hall Probes = %d ", nHPEntries));
2408 Int_t entriesarray = array->GetEntries();
2409 Float_t* value =
new Float_t[entriesarray];
2410 Float_t* time =
new Float_t[entriesarray];
2412 for (Int_t iarray = 0; iarray < entriesarray; iarray++){
2416 AliDebug(2,Form(
"iarray = %d, value = %f, time = %f",iarray,value[iarray],time[iarray]));
2418 TGraph*
gr =
new TGraph(entriesarray,value,time);
2420 AliWarning(Form(
"%s: no input graph to compute SplineFit",stringID.Data()));
2440 TString aDCSString=
"";
2443 for(Int_t iCount = 0; iCount < array->GetEntries(); iCount++) {
2446 AliError(Form(
"DCS values for the parameter outside the queried interval"));
2450 if (aDCSString != v->
GetChar())
2451 AliError(Form(
"DCS values for the parameter changed from %s to %c within the queried interval", aDCSString.Data(), (Char_t)v->
GetChar()));
2453 aDCSString = (TString)v->
GetChar();
2474 if (timeStartString.IsNull() || timeStartString.IsNull()){
2475 if (timeStartString.IsNull()){
2476 AliError(
"DAQ_time_start not set in logbook! Setting statistical values for current DP to invalid");
2478 else if (timeStartString.IsNull()){
2479 AliError(
"DAQ_time_end not set in logbook! Setting statistical values for current DP to invalid");
2485 Int_t timeStart = (Int_t)(timeStartString.Atoi());
2486 Int_t timeEnd = (Int_t)(timeEndString.Atoi());
2487 Float_t* parameters =
new Float_t[5];
2489 Int_t iCountsRun = 0;
2490 Int_t nCounts = array->GetEntries();
2491 Float_t valueBeforeSOR = 0;
2492 Float_t valueAfterEOR = 0;
2493 Int_t timestampBeforeSOR = -1;
2494 Int_t timestampAfterEOR = -1;
2495 Int_t ientrySOR = -1;
2496 Int_t ientryEOR = -1;
2497 Float_t* arrayValues = 0x0;
2498 Double_t* arrayWeights = 0x0;
2499 Bool_t truncMeanFlag = kTRUE;
2500 Bool_t sdFlag = kTRUE;
2502 for(Int_t i = 0; i < nCounts; i++) {
2505 AliError(Form(
"Error! Float value found in DCS map at %d-th entry is OUT OF RANGE: value = %6.5e",i,v->
GetFloat()));
2508 delete [] parameters;
2517 AliDebug(2,Form(
"timestamp of last value before SOR = %d, with DAQ_time_start = %d",timestampBeforeSOR,timeStart));
2523 AliDebug(2,Form(
"timestamp of first value after EOR = %d, with DAQ_time_end = %d",timestampAfterEOR,timeEnd));
2527 if (ientrySOR == -1) ientrySOR = i;
2528 if (ientryEOR < i) ientryEOR = i;
2529 AliDebug(2,Form(
"entry between SOR and EOR"));
2534 AliError(Form(
"DCS values for the parameter outside the queried interval: timestamp = %d",v->
GetTimeStamp()));
2538 if (timestampBeforeSOR == -1){
2541 if (timestampAfterEOR == -1){
2545 AliDebug(2,Form(
"Number of valid entries (within DCS query interval) = %i, from a total amount of %i entries",iCounts,nCounts));
2546 AliDebug(2,Form(
"Last value before DAQ_time_start (SOR) = %f at timestamp = %d",valueBeforeSOR,timestampBeforeSOR));
2547 AliDebug(2,Form(
"First value after DAQ_time_end (EOR) = %f at timestamp = %d",valueAfterEOR,timestampAfterEOR));
2548 AliInfo(Form(
"Found %d entries between DAQ_time_start (SOR) and DAQ_time_end (EOR)",iCountsRun));
2549 AliDebug(2,Form(
"Index of first entry after DAQ_time_start (SOR) = %d ",ientrySOR));
2550 AliDebug(2,Form(
"Index of first entry before DAQ_time_end (EOR) = %d ",ientryEOR));
2552 Int_t nentriesUsed = 0;
2553 if (iCountsRun > 1){
2554 AliInfo(
"Using entries between DAQ_time_start (SOR) and DAQ_time_end (EOR)");
2555 AliDebug(2,
"Calculating (weighted) Mean and Median");
2556 arrayValues =
new Float_t[iCountsRun];
2557 arrayWeights =
new Double_t[iCountsRun];
2558 nentriesUsed = iCountsRun;
2559 for (Int_t i = ientrySOR; i <= ientryEOR; i++){
2561 Int_t timestamp2 = 0;
2567 timestamp2 = timeEnd+1;
2569 arrayWeights[i-ientrySOR] = (Double_t)(timestamp2 - (Int_t)v->
GetTimeStamp());
2570 arrayValues[i-ientrySOR] = v->
GetFloat();
2572 parameters[0] = TMath::Mean(iCountsRun,arrayValues,arrayWeights);
2573 parameters[2] = TMath::Median(iCountsRun,arrayValues,arrayWeights);
2575 else if (iCountsRun == 1){
2578 if (timestampBeforeSOR != -1 && timestampBeforeSOR != (Int_t)v->
GetTimeStamp()){
2579 AliWarning(
"Using single entry between DAQ_time_start (SOR) and DAQ_time_end (EOR) and last entry before SOR. Truncated mean won't be calculated.");
2580 arrayValues =
new Float_t[2];
2581 arrayWeights =
new Double_t[2];
2582 arrayValues[0] = valueBeforeSOR;
2583 arrayWeights[0] = (Double_t)((Int_t)v->
GetTimeStamp()-timestampBeforeSOR);
2585 arrayWeights[1] = (Double_t)(timeEnd+1-(Int_t)v->
GetTimeStamp());
2586 AliDebug(2, Form(
"value0 = %f, with weight = %f",arrayValues[0],arrayWeights[0]));
2587 AliDebug(2, Form(
"value1 = %f, with weight = %f",arrayValues[1],arrayWeights[1]));
2588 parameters[0] = TMath::Mean(2,arrayValues,arrayWeights);
2589 parameters[2] = TMath::Median(2,arrayValues,arrayWeights);
2590 truncMeanFlag = kFALSE;
2593 AliError(
"Cannot calculate mean, truncated mean, median, SD wrt mean, SD wrt median for current DP - only one value collected during the run, but no value before with which to calculate the statistical quantities");
2603 if (timestampBeforeSOR == -1){
2604 AliError(
"Cannot set mean, truncated mean, median, SD wrt mean, SD wrt median for current DP - no points during the run collected, and point before SOR missing");
2613 AliWarning(
"Using only last entry before SOR. Truncated mean and Standard deviations (wrt mean/median) won't be calculated.");
2614 AliDebug(2,Form(
"value = %f",valueBeforeSOR));
2615 parameters[0] = valueBeforeSOR;
2616 parameters[2] = valueBeforeSOR;
2617 truncMeanFlag = kFALSE;
2622 AliDebug(2, Form(
"nentriesUsed = %d", nentriesUsed));
2625 Float_t sumweights = 0;
2626 Int_t entriesTruncMean = 0;
2627 Float_t* arrayValuesTruncMean =
new Float_t[nentriesUsed];
2628 Double_t* arrayWeightsTruncMean =
new Double_t[nentriesUsed];
2631 AliDebug(2,
"Calculating SD wrt Mean and SD wrt Median");
2633 for (Int_t i =0; i< nentriesUsed; i++){
2634 AliDebug(2,Form(
"Entry %d: value = %f, weight = %f",i,arrayValues[i],arrayWeights[i]));
2635 temp += (arrayValues[i]-parameters[2])*(arrayValues[i]-parameters[2]);
2636 temp1 += arrayWeights[i]*(arrayValues[i]-parameters[0])*(arrayValues[i]-parameters[0]);
2637 sumweights += arrayWeights[i];
2640 if (sumweights != 0 ){
2641 parameters[3] = TMath::Sqrt(temp1/sumweights);
2644 AliError(
"Sum of weights to calculate Standard Deviation (wrt mean) <= 0, setting the SD to invalid");
2648 if (nentriesUsed != 0){
2649 parameters[4] = TMath::Sqrt(temp/nentriesUsed);
2652 AliError(
"Number of entries used to calculate Standard Deviation (wrt median) <= 0, setting the SD to invalid");
2663 AliDebug(2,
"Calculating Truncated Mean");
2664 for (Int_t i =0; i< nentriesUsed; i++){
2665 AliDebug(2,Form(
"Entry %d: value = %f, weight = %f",i,arrayValues[i],arrayWeights[i]));
2666 if ((arrayValues[i]<=parameters[0]+3*parameters[3]) && (arrayValues[i]>=parameters[0]-3*parameters[3])){
2667 arrayValuesTruncMean[entriesTruncMean]=arrayValues[i];
2668 arrayWeightsTruncMean[entriesTruncMean]=arrayWeights[i];
2669 AliDebug(2,Form(
"For Truncated Mean: Entry %d: value = %f, weight = %f",entriesTruncMean,arrayValuesTruncMean[entriesTruncMean],arrayWeightsTruncMean[entriesTruncMean]));
2677 if (entriesTruncMean >1){
2678 AliDebug(2,Form(
"%d entries used for truncated mean",entriesTruncMean));
2679 parameters[1] = TMath::Mean(entriesTruncMean,arrayValuesTruncMean,arrayWeightsTruncMean);
2682 AliDebug(2,Form(
"Too few entries (%d) to calculate truncated mean",entriesTruncMean));
2691 delete [] arrayValues;
2694 delete [] arrayWeights;
2696 delete [] arrayValuesTruncMean;
2697 delete [] arrayWeightsTruncMean;
2699 AliInfo(Form(
"(weighted) mean = %f ",parameters[0]));
2700 AliInfo(Form(
"(weighted) truncated mean = %f ",parameters[1]));
2701 AliInfo(Form(
"median = %f ",parameters[2]));
2702 AliInfo(Form(
"(weighted) standard deviation with (weighted) mean = %f ",parameters[3]));
2703 AliInfo(Form(
"standard deviation with median = %f ",parameters[4]));
2726 AliInfo(Form(
"indexDP = %d",indexDP));
2728 Int_t nCounts = array->GetEntries();
2729 for(Int_t i = 0; i < nCounts; i++) {
2732 AliError(Form(
"Error! Float value found in DCS map at %d-th entry is OUT OF RANGE: value = %6.5e",i,v->
GetFloat()));
2743 AliError(Form(
"DCS values for the parameter outside the queried interval"));
2759 Bool_t aDCSBool = kTRUE;
2762 Int_t usefulCounts = 0;
2764 for(Int_t iCount = 0; iCount < array->GetEntries(); iCount++) {
2771 if (usefulCounts == 1) {
2774 else if (usefulCounts > 1) {
2775 if (aDCSBool != v->
GetBool()) {
2776 AliError(Form(
"DCS values for the parameter changed from %d to %d within the queried interval", (UInt_t)aDCSBool, (UInt_t)v->
GetBool()));
2784 Char_t caDCSBool = (Char_t) aDCSBool;
2801 if (timeStartString.IsNull() || timeStartString.IsNull()){
2802 if (timeStartString.IsNull()){
2803 AliError(
"DAQ_time_start not set in logbook! Setting statistical values for current DP to invalid");
2805 else if (timeStartString.IsNull()){
2806 AliError(
"DAQ_time_end not set in logbook! Setting statistical values for current DP to invalid");
2811 Int_t timeStart = (Int_t)(timeStartString.Atoi());
2812 Int_t timeEnd = (Int_t)(timeEndString.Atoi());
2813 Float_t aDCSArrayMean = 0.0;
2815 Float_t valueBeforeSOR = 0;
2816 Float_t valueAfterEOR = 0;
2817 Int_t timestampBeforeSOR = -1;
2818 Int_t timestampAfterEOR = -1;
2819 Int_t ientrySOR = -1;
2820 Int_t ientryEOR = -1;
2821 Float_t* arrayValues = 0x0;
2822 Double_t* arrayWeights = 0x0;
2823 Int_t iCountsRun = 0;
2824 Int_t nCounts = array->GetEntries();
2826 for(Int_t i = 0; i < nCounts; i++) {
2829 AliError(Form(
"Error! Int value found in DCS map at %d-th entry is OUT OF RANGE: value = %d",i, v->
GetInt()));
2838 AliDebug(2,Form(
"timestamp of last entry before SOR = %d, with DAQ_time_start = %d",timestampBeforeSOR,timeStart));
2839 valueBeforeSOR = (Float_t) v->
GetInt();
2843 valueAfterEOR = (Float_t) v->
GetInt();
2844 AliDebug(2,Form(
"timestamp of first entry after EOR = %d, with DAQ_time_end = %d",timestampAfterEOR,timeEnd));
2848 if (ientrySOR == -1) ientrySOR = i;
2849 if (ientryEOR < i) ientryEOR = i;
2850 AliDebug(2,Form(
"entry between SOR and EOR"));
2855 AliError(Form(
"DCS values for the parameter outside the queried interval: timestamp = %d",v->
GetTimeStamp()));
2859 if (timestampBeforeSOR == -1){
2862 if (timestampAfterEOR == -1){
2866 AliDebug(2,Form(
"Number of valid entries (within query interval) = %i, starting from %i entries",iCounts,nCounts));
2867 AliDebug(2,Form(
"Last value before DAQ_time_start (SOR) = %f at timestamp = %d",valueBeforeSOR,timestampBeforeSOR));
2868 AliDebug(2,Form(
"First value after DAQ_time_end (EOR) = %f at timestamp = %d",valueAfterEOR,timestampAfterEOR));
2869 AliInfo(Form(
"Found %d entries between DAQ_time_start (SOR) and DAQ_time_end (EOR)",iCountsRun));
2870 AliDebug(2,Form(
"Index of first entry after DAQ_time_start (SOR) = %d ",ientrySOR));
2871 AliDebug(2,Form(
"Index of first entry before DAQ_time_end (EOR) = %d ",ientryEOR));
2873 Int_t nentriesUsed = 0;
2874 if (iCountsRun > 1){
2875 AliInfo(
"Using entries between DAQ_time_start (SOR) and DAQ_time_end (EOR)");
2876 AliDebug(2,
"Calculating (weighted) Mean");
2877 arrayValues =
new Float_t[iCountsRun];
2878 arrayWeights =
new Double_t[iCountsRun];
2879 nentriesUsed = iCountsRun;
2880 for (Int_t i = ientrySOR; i <= ientryEOR; i++){
2882 Int_t timestamp2 = 0;
2888 timestamp2 = timeEnd+1;
2890 arrayWeights[i-ientrySOR] = (Double_t)(timestamp2 - (Int_t)v->
GetTimeStamp());
2891 arrayValues[i-ientrySOR] = (Float_t)v->
GetInt();
2893 aDCSArrayMean = TMath::Mean(iCountsRun,arrayValues,arrayWeights);
2894 delete [] arrayValues;
2895 delete [] arrayWeights;
2897 else if (iCountsRun == 1){
2900 if (timestampBeforeSOR != -1 && timestampBeforeSOR != (Int_t)v->
GetTimeStamp()){
2901 AliWarning(
"Using single entry between DAQ_time_start (SOR) and DAQ_time_end (EOR) and last entry before SOR.");
2902 arrayValues =
new Float_t[2];
2903 arrayWeights =
new Double_t[2];
2904 arrayValues[0] = valueBeforeSOR;
2905 arrayWeights[0] = (Double_t)((Int_t)v->
GetTimeStamp()-timestampBeforeSOR);
2906 arrayValues[1] = (Float_t)v->
GetInt();
2907 arrayWeights[1] = (Double_t)(timeEnd+1-(Int_t)v->
GetTimeStamp());
2908 AliDebug(2,Form(
"value0 = %f, with weight = %f",arrayValues[0],arrayWeights[0]));
2909 AliDebug(2,Form(
"value1 = %f, with weight = %f",arrayValues[1],arrayWeights[1]));
2910 aDCSArrayMean = TMath::Mean(2,arrayValues,arrayWeights);
2911 delete [] arrayValues;
2912 delete [] arrayWeights;
2915 AliError(
"Cannot calculate mean - only one value collected during the run, but no value before with which to calculate the statistical quantities");
2920 if (timestampBeforeSOR == -1 || timestampAfterEOR == -1){
2921 if (timestampBeforeSOR == -1){
2922 AliError(
"Cannot calculate mean - no points during the run collected, and point before SOR missing");
2924 if (timestampAfterEOR == -1){
2925 AliError(
"Cannot calculate maen - no points during the run collected, and point after EOR missing");
2930 AliWarning(
"Using last entry before SOR and first entry after EOR.");
2932 arrayValues =
new Float_t[2];
2933 arrayWeights =
new Double_t[2];
2934 arrayValues[0] = valueBeforeSOR;
2935 arrayWeights[0] = (Double_t)(timestampAfterEOR - timestampBeforeSOR);
2936 arrayValues[1] = valueAfterEOR;
2937 arrayWeights[1] = 1.;
2938 AliDebug(2,Form(
"value0 = %f, with weight = %f",arrayValues[0],arrayWeights[0]));
2939 AliDebug(2,Form(
"value1 = %f, with weight = %f",arrayValues[1],arrayWeights[1]));
2940 aDCSArrayMean = TMath::Mean(1,arrayValues,arrayWeights);
2941 delete [] arrayValues;
2942 delete [] arrayWeights;
2946 AliDebug(2, Form(
"nentriesUsed = %d", nentriesUsed));
2947 AliInfo(Form(
"mean = %f ", aDCSArrayMean));
2948 return aDCSArrayMean;
2963 if (timeStartString.IsNull() || timeStartString.IsNull()){
2964 if (timeStartString.IsNull()){
2965 AliError(
"DAQ_time_start not set in logbook! Setting statistical values for current DP to invalid");
2967 else if (timeStartString.IsNull()){
2968 AliError(
"DAQ_time_end not set in logbook! Setting statistical values for current DP to invalid");
2973 Int_t timeStart = (Int_t)(timeStartString.Atoi());
2974 Int_t timeEnd = (Int_t)(timeEndString.Atoi());
2975 Float_t aDCSArrayMean = 0.0;
2977 Float_t valueBeforeSOR = 0;
2978 Float_t valueAfterEOR = 0;
2979 Int_t timestampBeforeSOR = -1;
2980 Int_t timestampAfterEOR = -1;
2981 Int_t ientrySOR = -1;
2982 Int_t ientryEOR = -1;
2983 Float_t* arrayValues = 0x0;
2984 Double_t* arrayWeights = 0x0;
2985 Int_t iCountsRun = 0;
2986 Int_t nCounts = array->GetEntries();
2988 for(Int_t i = 0; i < nCounts; i++) {
2991 AliError(Form(
"Error! UInt value found in DCS map at %d-th entry is OUT OF RANGE: value = %u",i,v->
GetUInt()));
3000 AliDebug(2,Form(
"timestamp of last entry before SOR = %d, with DAQ_time_start = %d",timestampBeforeSOR,timeStart));
3001 valueBeforeSOR = (Float_t)v->
GetUInt();
3005 valueAfterEOR = (Float_t)v->
GetUInt();
3006 AliDebug(2,Form(
"timestamp of first entry after EOR = %d, with DAQ_time_end = %d",timestampAfterEOR,timeEnd));
3010 if (ientrySOR == -1) ientrySOR = i;
3011 if (ientryEOR < i) ientryEOR = i;
3012 AliDebug(2,Form(
"entry between SOR and EOR"));
3017 AliError(Form(
"DCS values for the parameter outside the queried interval: timestamp = %d",v->
GetTimeStamp()));
3021 if (timestampBeforeSOR == -1){
3024 if (timestampAfterEOR == -1){
3028 AliDebug(2,Form(
"Number of valid entries (within query interval) = %i, starting from %i entries",iCounts,nCounts));
3029 AliDebug(2,Form(
"Last value before DAQ_time_start (SOR) = %f at timestamp = %d",valueBeforeSOR,timestampBeforeSOR));
3030 AliDebug(2,Form(
"First value after DAQ_time_end (EOR) = %f at timestamp = %d",valueAfterEOR,timestampAfterEOR));
3031 AliInfo(Form(
"Found %d entries between DAQ_time_start (SOR) and DAQ_time_end (EOR)",iCountsRun));
3032 AliDebug(2,Form(
"Index of first entry after DAQ_time_start (SOR) = %d ",ientrySOR));
3033 AliDebug(2,Form(
"Index of first entry before DAQ_time_end (EOR) = %d ",ientryEOR));
3035 Int_t nentriesUsed = 0;
3036 if (iCountsRun > 1){
3037 AliInfo(
"Using entries between DAQ_time_start (SOR) and DAQ_time_end (EOR)");
3038 AliDebug(2,
"Calculating (weighted) Mean");
3039 arrayValues =
new Float_t[iCountsRun];
3040 arrayWeights =
new Double_t[iCountsRun];
3041 nentriesUsed = iCountsRun;
3042 for (Int_t i = ientrySOR; i <= ientryEOR; i++){
3044 Int_t timestamp2 = 0;
3050 timestamp2 = timeEnd+1;
3052 arrayWeights[i-ientrySOR] = (Double_t)(timestamp2 - (Int_t)v->
GetTimeStamp());
3053 arrayValues[i-ientrySOR] = (Float_t)v->
GetUInt();
3055 aDCSArrayMean = TMath::Mean(iCountsRun,arrayValues,arrayWeights);
3056 delete [] arrayValues;
3057 delete [] arrayWeights;
3059 else if (iCountsRun == 1){
3062 if (timestampBeforeSOR != -1 && timestampBeforeSOR != (Int_t)v->
GetTimeStamp()){
3063 AliWarning(
"Using single entry between DAQ_time_start (SOR) and DAQ_time_end (EOR) and last entry before SOR.");
3064 arrayValues =
new Float_t[2];
3065 arrayWeights =
new Double_t[2];
3066 arrayValues[0] = valueBeforeSOR;
3067 arrayWeights[0] = (Double_t)((Int_t)v->
GetTimeStamp()-timestampBeforeSOR);
3068 arrayValues[1] = (Float_t)v->
GetUInt();
3069 arrayWeights[1] = (Double_t)(timeEnd+1-(Int_t)v->
GetTimeStamp());
3070 AliDebug(2,Form(
"value0 = %f, with weight = %f",arrayValues[0],arrayWeights[0]));
3071 AliDebug(2,Form(
"value1 = %f, with weight = %f",arrayValues[1],arrayWeights[1]));
3072 aDCSArrayMean = TMath::Mean(2,arrayValues,arrayWeights);
3073 delete [] arrayValues;
3074 delete [] arrayWeights;
3077 AliError(
"Cannot calculate mean - only one value collected during the run, but no value before with which to calculate the statistical quantities");
3082 if (timestampBeforeSOR == -1 || timestampAfterEOR == -1){
3083 if (timestampBeforeSOR == -1){
3084 AliError(
"Cannot calculate mean - no points during the run collected, and point before SOR missing");
3086 if (timestampAfterEOR == -1){
3087 AliError(
"Cannot calculate maen - no points during the run collected, and point after EOR missing");
3092 AliWarning(
"Using last entry before SOR and first entry after EOR.");
3094 arrayValues =
new Float_t[2];
3095 arrayWeights =
new Double_t[2];
3096 arrayValues[0] = valueBeforeSOR;
3097 arrayWeights[0] = (Double_t)(timestampAfterEOR - timestampBeforeSOR);
3098 arrayValues[1] = valueAfterEOR;
3099 arrayWeights[1] = 1.;
3100 AliDebug(2,Form(
"value0 = %f, with weight = %f",arrayValues[0],arrayWeights[0]));
3101 AliDebug(2,Form(
"value1 = %f, with weight = %f",arrayValues[1],arrayWeights[1]));
3102 aDCSArrayMean = TMath::Mean(1,arrayValues,arrayWeights);
3103 delete [] arrayValues;
3104 delete [] arrayWeights;
3108 AliDebug(2, Form(
"nentriesUsed = %d", nentriesUsed));
3109 AliInfo(Form(
"mean = %f ",aDCSArrayMean));
3110 return aDCSArrayMean;
3123 AliDebug(2,Form(
"Map has %d entries",map->GetEntries()));
3129 AliInfo(
"Too few pressure maps fitted!!!");
3132 AliInfo(
"no atmospheric pressure map extracted!!!");
3170 TSQLServer* server = TSQLServer::Connect(Form(
"mysql://%s:%d/%s", dbHost, dbPort, dbName), user, password);
3174 Printf(
"ERROR: Could not connect to DAQ LB");
3180 sqlQuery.Form(
"SELECT DAQ_time_start, run_type, detectorMask, L3_magnetCurrent, Dipole_magnetCurrent,beamType, DAQ_time_end FROM logbook WHERE run = %d", run);
3181 TSQLResult* result = server->Query(sqlQuery);
3184 Printf(
"ERROR: Can't execute query <%s>!", sqlQuery.Data());
3188 if (result->GetRowCount() == 0)
3190 Printf(
"ERROR: Run %d not found", run);
3195 TSQLRow* row = result->Next();
3198 Printf(
"ERROR: Could not receive data from run %d", run);
3203 TString timeStartString(row->GetField(0));
3204 TString runType(row->GetField(1));
3205 TString detectorMaskString(row->GetField(2));
3206 TString l3CurrentString(row->GetField(3));
3207 TString dipoleCurrentString(row->GetField(4));
3208 TString beamTypeString(row->GetField(5));
3209 TString timeEndString(row->GetField(6));
3211 time_t timeStart = (time_t)(timeStartString.Atoi());
3212 time_t timeEnd = (time_t)(timeEndString.Atoi());
3213 UInt_t detectorMask = (UInt_t)(detectorMaskString.Atoi());
3214 Float_t l3Current = (Float_t)(TMath::Abs(l3CurrentString.Atof()));
3215 Float_t dipoleCurrent = (Float_t)(TMath::Abs(dipoleCurrentString.Atof()));
3216 Char_t l3Polarity = (l3CurrentString.Atof() < 0) ? 1 : 0;
3217 Char_t dipolePolarity = (dipoleCurrentString.Atof() < 0) ? 1 : 0;
3218 if (beamTypeString.CompareTo(
"Pb-Pb",TString::kIgnoreCase) == 0){
3219 beamTypeString=
"A-A";
3224 grpObj->
SetTimeEnd((timeEnd!=0 && timeEnd>timeStart) ? timeEnd : timeStart+24*3600 );
3225 grpObj->
SetRunType((TString)(row->GetField(1)));
3240 Printf(
"Storing GRP/GRP/Data object with the following content");
3244 metadata.
SetResponsible(
"Jan Fiete Grosse-Oetringhaus & Chiara Zampolli");
3245 metadata.
SetComment(
"GRP Output parameters received during online running");
3247 AliCDBId id(
"GRP/GRP/Data", run, run);
3248 Bool_t success = cdb->
Put(grpObj,
id, &metadata);
3254 Printf(
"ERROR: Could not store GRP/GRP/Data into OCDB");
3259 sqlQuery.Form(
"SELECT configFile FROM logbook_trigger_config WHERE run = %d", run);
3260 result = server->Query(sqlQuery);
3263 Printf(
"ERROR: Can't execute query <%s>!", sqlQuery.Data());
3267 if (result->GetRowCount() == 0)
3269 Printf(
"ERROR: Run %d not found in logbook_trigger_config", run);
3274 row = result->Next();
3277 Printf(
"ERROR: Could not receive logbook_trigger_config data from run %d", run);
3282 TString triggerConfig(row->GetField(0));
3290 Printf(
"Found trigger configuration: %s", triggerConfig.Data());
3295 Printf(
"ERROR: Could not create CTP configuration object");
3299 metadata.
SetComment(
"CTP run configuration received during online running");
3301 AliCDBId id2(
"GRP/CTP/Config", run, run);
3302 success = cdb->
Put(runcfg, id2, &metadata);
3309 Printf(
"ERROR: Could not store GRP/CTP/Config into OCDB");
3315 sqlQuery.Form(
"SELECT GDC FROM logbook_stats_GDC WHERE run = %d", run);
3316 result = server->Query(sqlQuery);
3319 Printf(
"ERROR: Can't execute query <%s>!", sqlQuery.Data());
3323 if (result->GetRowCount() == 0)
3325 Printf(
"ERROR: Run %d not found in logbook_stats_GDC", run);
3331 for (Int_t iGDC = 0; iGDC < result->GetRowCount(); iGDC++) {
3332 row = result->Next();
3335 Printf(
"ERROR: Could not receive logbook_stats_GDC data from run %d", run);
3339 gdc += row->GetField(0);
3349 Printf(
"Found GDC: %s", gdc.Data());
3353 sqlQuery.Form(
"SELECT max(logbook.run) FROM logbook LEFT JOIN logbook_shuttle ON logbook_shuttle.run = logbook.run WHERE run_type = '%s' AND shuttle_done = 1", runType.Data());
3354 result = server->Query(sqlQuery);
3357 Printf(
"ERROR: Can't execute query <%s>!", sqlQuery.Data());
3361 if (result->GetRowCount() == 0)
3363 Printf(
"ERROR: No result with query <%s>", sqlQuery.Data());
3368 row = result->Next();
3371 Printf(
"ERROR: Could not receive data for query <%s>", sqlQuery.Data());
3376 TString lastRunStr(row->GetField(0));
3377 Int_t lastRun = lastRunStr.Atoi();
3379 Printf(
"Last run with same run type %s is %d", runType.Data(), lastRun);
3401 Int_t nCounts = array->GetEntries();
3402 Float_t energy = -1;
3403 Double_t timeEnergy = -1;
3404 Int_t indexEnergy = -1;
3405 Bool_t foundEnergy = kFALSE;
3407 AliDebug(2,Form(
"Energy measurements = %d\n",nCounts));
3409 AliWarning(
"No Energy values found! Beam Energy remaining invalid!");
3412 for (Int_t i = 0; i < nCounts; i++){
3418 foundEnergy = kTRUE;
3426 AliInfo(
"No value for the Energy found before start of run, the Energy will remain invalid");
3430 energy = (Float_t)(TMath::Nint(((Double_t)(dcs->
GetInt(0)))*120/1000));
3431 AliInfo(Form(
"Energy value found = %d (at %f), converting --> sqrt(s)/2 = %f (GeV)", dcs->
GetInt(0),dcs->
GetTimeStamp(),energy));
3446 Bool_t foundBeam1Phase = kFALSE, foundBeam2Phase = kFALSE;
3447 const Float_t threshold = 0.050;
3450 Double_t timeCreated = timeCreatedStr.Atof();
3452 Int_t nCounts = beam1phase->GetEntries();
3453 AliDebug(2,Form(
"Beam1 phase measurements = %d\n",nCounts));
3455 AliWarning(
"No beam1 LHC clock phase values found!");
3460 Double_t prevPhase = 0;
3461 for (Int_t i = 0; i < nCounts; i++){
3466 if ((i == 0) || (i == (nCounts-1)) ||
3468 (TMath::Abs(dcs->
GetDouble(0)-prevPhase) > threshold)) {
3470 foundBeam1Phase = kTRUE;
3471 AliInfo(Form(
"B1 Clk Phase = %f at TS = %f",
3478 if (!foundBeam1Phase){
3479 AliError(
"No beam1 LHC clock phase values found within the run!");
3485 nCounts = beam2phase->GetEntries();
3486 AliDebug(2,Form(
"Beam2 phase measurements = %d\n",nCounts));
3488 AliWarning(
"No beam2 LHC clock phase values found!");
3493 Double_t prevPhase = 0;
3494 for (Int_t i = 0; i < nCounts; i++){
3498 if ((i == 0) || (i == (nCounts-1)) ||
3500 (TMath::Abs(dcs->
GetDouble(0)-prevPhase) > threshold)) {
3502 foundBeam2Phase = kTRUE;
3503 AliInfo(Form(
"B2 Clk Phase = %f at TS = %f",
3510 if (!foundBeam2Phase){
3511 AliError(
"No beam2 LHC clock phase values found within the run!");
3529 TString separateString(
"");
3530 Log(Form(
"Setting Beam Type for beam %d to A*1000+Z",iBeamType));
3531 if (beamType.CompareTo(
"PROTON",TString::kIgnoreCase) == 0){
3532 Log(Form(
"Beam type %d is PROTON --> The single beam type will be set to 1001 (A = 1, Z = 1)",iBeamType));
3533 separateString =
"1001";
3534 return separateString;
3537 TPRegexp regexpA(
"\\D+");
3538 TPRegexp regexpZ(
"\\d+");
3539 TObjArray* arrayA = regexpA.MatchS(beamType);
3540 TObjArray* arrayZ = regexpZ.MatchS(beamType);
3541 if (arrayA->GetEntries() != 1 || arrayZ->GetEntries() != 1){
3542 Log(Form(
"The beamType string for beam %d does not contain the necessary information! Returning the info as published by LHC (i.e. %s)",iBeamType, beamType.Data()));
3546 TString strA = ((TObjString*)(arrayA->At(0)))->String();
3547 TString strZ = ((TObjString*)(arrayZ->At(0)))->String();
3548 if (strA.CompareTo(
"LEAD",TString::kIgnoreCase) == 0 || strA.CompareTo(
"PB",TString::kIgnoreCase) == 0){
3549 Log(Form(
"Beam %d is %s --> A = 208",iBeamType, strA.Data()));
3552 else if (strA.CompareTo(
"XE",TString::kIgnoreCase) == 0){
3554 Log(Form(
"Beam %d is %s --> A = %d",iBeamType, strA.Data(),a));
3557 Log(Form(
"This beam was not foreseen so far, leaving A=0"));
3560 Log(Form(
"Beam %d has Z = %d",iBeamType, z));
3561 separateString = Form(
"%d",a*1000+z);
3562 return separateString;
3566 return separateString;
3580 Printf(
"could not open file \"%s\"",fileName);
3584 Short_t keylen,cycle;
3586 Int_t nbytes,date,time,objlen,nwheader;
3589 Long64_t seekkey,seekpdir;
3592 const Int_t kBEGIN = 100;
3593 Long64_t fBEGIN = (Long64_t)kBEGIN;
3594 Long64_t idcur = fBEGIN;
3595 Long64_t fEND = f->GetEND();
3598 Int_t nread = nwheader;
3600 char header[kBEGIN];
3601 char classname[512];
3603 while (idcur < fEND) {
3605 if (idcur+nread >= fEND) nread = fEND-idcur-1;
3606 if (f->ReadBuffer(header, nread)) {
3608 Printf(
"%s: failed to read the key data from disk at %lld.",f->GetName(),idcur);
3613 frombuf(buffer, &nbytes);
3615 Printf(
"Address = %lld\tNbytes = %d\t=====E R R O R=======", idcur, nbytes);
3620 Printf(
"Address = %lld\tNbytes = %d\t=====G A P===========", idcur, nbytes);
3626 Version_t versionkey;
3627 frombuf(buffer, &versionkey);
3628 frombuf(buffer, &objlen);
3629 frombuf(buffer, &datime);
3630 frombuf(buffer, &keylen);
3631 frombuf(buffer, &cycle);
3632 if (versionkey > 1000) {
3633 frombuf(buffer, &seekkey);
3634 frombuf(buffer, &seekpdir);
3637 frombuf(buffer, &skey); seekkey = (Long64_t)skey;
3638 frombuf(buffer, &sdir); seekpdir = (Long64_t)sdir;
3640 frombuf(buffer, &nwhc);
3641 for (
int i = 0;i < nwhc; i++) frombuf(buffer, &classname[i]);
3642 classname[(int)nwhc] =
'\0';
3643 Long64_t fSeekFree = f->GetSeekFree();
3644 Long64_t fSeekInfo = f->GetSeekInfo();
3645 Long64_t fSeekKeys = f->GetSeekKeys();
3646 if (idcur == fSeekFree) strlcpy(classname,
"FreeSegments",512);
3647 if (idcur == fSeekInfo) strlcpy(classname,
"StreamerInfo",512);
3648 if (idcur == fSeekKeys) strlcpy(classname,
"KeysList",512);
3649 TDatime::GetDateTime(datime, date, time);
3661 if(idcur > f->GetSize()){
3662 AliWarning(
"Bad file: final record position bigger than file size");
static const char * fgkLHCDataPoints[]
number of lhc dps
AliDCSSensorArray * GetPressureMap(TMap *dcsAliasMap)
Bool_t Store(const char *pathLevel2, const char *pathLevel3, TObject *object, AliCDBMetaData *metaData, Int_t validityStart=0, Bool_t validityInfinite=kFALSE)
void SetCavernTemperature(const Float_t *cavernTemperature)
const char * GetRunParameter(const char *param)
TList * GetFileSources(Int_t system, const char *id=0)
const char * GetTriggerConfiguration()
const TObjArray & GetData() const
TFile * Open(const char *filename, Long64_t &nevents)
Float_t ProcessInt(const TObjArray *array)
const char * GetForeignFile(const char *detector, Int_t system, const char *id, const char *source)
static const char * OnlineName(const char *detectorName)
void SetDipolePolarity(Char_t dipolePolarity)
static const char * OfflineModuleName(const char *detectorName)
const Short_t kNumSensors
Int_t ProcessDipoleDPs(const TMap *valueSet, AliGRPObject *grpobj)
AliSplineFit * GetFit() const
void SetDipoleCurrent(const Float_t *dipoleCurrent)
Bool_t fdaqStartEndTimeOk
Bool_t StoreRunMetadataFile(const char *localFile, const char *gridFileName)
void SetSingleBeamType(Int_t ibeamType, TString beamType)
static const Int_t fgknLHCDP
virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
AliSplineFit * GetSplineFit(const TObjArray *array, const TString &stringID)
AliCDBEntry * GetFromOCDB(const char *pathLevel2, const char *pathLevel3)
void MakeSplineFit(TMap *map, Bool_t keepMap=kFALSE)
Float_t ProcessUInt(const TObjArray *array)
TString ProcessChar(const TObjArray *array)
static Int_t GetNumberOfHP()
static const Int_t fgknDCSDP
number of DAQ lb parameters for PHYSICS runs
void Print(Option_t *option="") const
void SetTimeEnd(time_t timeEnd)
void SetLHCState(TString lhcState)
TString * GetLTUConfig(const char *det)
void SetL3Current(const Float_t *l3Current)
const char * GetCTPTimeParams()
virtual UInt_t Process(TMap *valueSet)
virtual ~AliGRPPreprocessor()
void SetStringID(const TString &stringID)
static Int_t DetectorID(const char *detectorName)
const char * GetFile(Int_t system, const char *id, const char *source)
TMap * ExtractDCS(TMap *dcsMap, Bool_t keepStart=kFALSE)
Char_t GetL3Polarity() const
AliDCSSensor * GetSensor(Int_t IdDCS)
#define AliInfoF(message,...)
void SetFalseDataQualityFlagPeriods(Double_t *falses)
Int_t ProcessEnvDPs(TMap *valueSet, AliGRPObject *grpobj)
Bool_t CheckFileRecords(const char *fileName) const
Int_t ProcessHPDPs(const TMap *valueSet, AliGRPObject *grpobj)
void SetBeamEnergyIsSqrtSHalfGeV(Bool_t v=kTRUE)
AliGRPPreprocessor(AliShuttleInterface *shuttle)
TString fileName(const char *dir, int runNumber, const char *da, int i, const char *type)
void SetTimeStart(time_t timeStart)
#define AliWarning(message)
Int_t ProcessDaqLB(AliGRPObject *grpobj)
TObjArray * GetStringArray() const
static const Int_t fgknDAQLbPar
void SetMachineMode(TString machineMode)
const Double_t kFitFraction
Char_t GetDipolePolarity() const
void SetBeamTypeFromLHC(TString beamTypeFromLHC)
void SplineFit(Int_t nder)
static AliTriggerRunScalers * ReadScalers(TString &filename)
static const char * DetectorName(Int_t detectorID)
Float_t * ProcessFloatAll(const TObjArray *array)
Int_t ProcessDcsDPs(TMap *valueSet, AliGRPObject *grpobj)
UInt_t ProcessSPDMeanVertex()
void AddPhaseB1DP(UInt_t timestamp, Float_t phase)
void AddRunType(const char *runType)
static Int_t ReceivePromptRecoParameters(UInt_t run, const char *dbHost, Int_t dbPort, const char *dbName, const char *user, const char *password, const char *cdbRoot, TString &gdc)
TTimeStamp startTime(2009, 8, 7, 0, 0, 0)
TList * GetFileIDs(Int_t system, const char *source)
void SetCavernAtmosPressure(AliDCSSensor *const cavernAtmosPressure)
TGraph * GetGraph() const
void Log(const char *message, UInt_t level=3)
static const Int_t fgknDCSDPHallProbes
names of dcs dps for Hall Probes
void AddPhaseB2DP(UInt_t timestamp, Float_t phase)
UInt_t ProcessDcsFxs(TString partition="", TString detector="")
UInt_t GetEndTimeDCSQuery()
void SetCavernAtmosPressure2(AliDCSSensor *const cavernAtmosPressure)
Double_t GetTimeStamp() const
static const char * GetHPDP(Int_t indexHP)
Bool_t Put(TObject *object, const AliCDBId &id, AliCDBMetaData *metaData, const char *mirrors="", DataType type=kPrivate)
TString ParseBeamTypeString(TString beamType, Int_t iBeamType)
void SetLHCPeriod(TString lhcPeriod)
void SetSurfaceAtmosPressure(AliDCSSensor *const surfacePressure)
static const char * fgkDCSDataPoints[]
number of dcs dps
virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
const char * GetRunType()
AliDCSSensorArray * fPressure
number of redundant dcs dps
#define AliFatal(message)
void SetDefaultStorage(const char *dbString)
void SetBeamEnergy(Float_t beamEnergy)
void SetHallProbes(DP_HallProbes hp, Float_t hall_probe, Stats stat)
#define AliDebug(logLevel, message)
Double_t * GetDouble() const
Char_t ProcessBool(const TObjArray *array, Bool_t &change)
UInt_t GetStartTimeDCSQuery()
void SetMinPoints(Int_t minPoints)
static THashList * ProcessAliases(const char *aliasesFile)
void SetMaxTimeLHCValidity(Double_t maxTimeLHCValidity)
TList * GetForeignFileSources(const char *detector, Int_t system, const char *id)
void SetNumberOfDetectors(Char_t numberOfDetectors)
void SetBeamType(TString beamType)
static Float_t GetInvalidFloat()
static const Int_t fgknDCSDP_Redu
number of Hall Probes
TObjArray * ReadSingleLHCDP(TString filename, TString alias)
UInt_t GetTimeStamp() const
void SetDetectorMask(UInt_t detectorMask)
Float_t GetHallProbes(Int_t hp) const
AliLHCClockPhase * ProcessLHCClockPhase(TObjArray *beam1phase, TObjArray *beam2phase, Double_t timeEnd)
#define AliError(message)
UInt_t ProcessLHCData(AliGRPObject *grpobj)
static const char * fgkDCSDataPointsHallProbes[]
names of dcs dps
static AliCDBManager * Instance(TMap *entryCache=NULL, Int_t run=-1)
Int_t ProcessL3DPs(const TMap *valueSet, AliGRPObject *grpobj)
Float_t ProcessEnergy(TObjArray *array, Double_t timeStart)
static const Int_t fgkDCSDPHallTopShift
names of lhc dps
void SetRunType(TString runType)
void SetNFalseDataQualityFlag(Int_t nFalses)
Float_t * ProcessFloatAllMagnet(const TObjArray *array, Int_t indexDP, Bool_t &isZero)
static AliTriggerConfiguration * LoadConfigurationFromString(const char *configuration)
static AliCTPTimeParams * LoadCTPTimeParamsFromString(const char *timeparams)
void SetPolarityConventionLHC(Bool_t v=kTRUE)
void SetL3Polarity(Char_t l3Polarity)
void InitKnots(TGraph *graph, Int_t min, Int_t iter, Double_t maxDelta)