1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //-------------------------------------------------------------------------
19 // Class AliGRPPreprocessor
20 // Global Run Parameters (GRP) preprocessor
21 // Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
22 // Modified: Ernesto.Lopez.Torres@cern.ch CEADEN-CERN
23 //-------------------------------------------------------------------------
28 #include <TObjString.h>
29 #include <TTimeStamp.h>
33 #include "AliGRPPreprocessor.h"
34 #include "AliGRPDCS.h"
35 #include "AliDCSSensorArray.h"
37 #include "AliTriggerConfiguration.h"
38 #include "AliTriggerRunScalers.h"
40 #include "AliCDBMetaData.h"
44 class AliShuttleInterface;
48 // needed for ReceivePromptRecoParameters
49 #include <TSQLServer.h>
50 #include <TSQLResult.h>
52 #include <AliCDBManager.h>
53 #include <AliCDBMetaData.h>
55 #include <AliTriggerConfiguration.h>
57 const Double_t kFitFraction = 0.7; // Fraction of DCS sensor fits required
59 ClassImp(AliGRPPreprocessor)
61 //_______________________________________________________________
62 const Int_t AliGRPPreprocessor::fgknDAQLbPar = 8; // num parameters in the logbook
63 const Int_t AliGRPPreprocessor::fgknDCSDP = 11; // number of dcs dps
64 const char* AliGRPPreprocessor::fgkDCSDataPoints[AliGRPPreprocessor::fgknDCSDP] = {
65 "LHCState", // missing in DCS
68 "LHCLuminosity", // missing in DCS
69 "BeamIntensity", // missing in DCS
73 "CavernAtmosPressure",
74 "gva_cr5AtmosphericPressure", // missing in DCS
75 "gva_meyrinAtmosphericPressure" // missing in DCS
78 const Short_t kSensors = 9; // start index position of sensor in DCS DPs
80 const char* AliGRPPreprocessor::fgkLHCState[20] = {
86 "U", "UNSTABLE BEAMS",
93 const char* kppError[] = {
95 "(DAQ logbook ERROR)",
98 "(DCS data points ERROR)",
99 "(Trigger Configuration ERROR)"
102 //_______________________________________________________________
103 AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
104 AliPreprocessor("GRP",shuttle), fPressure(0)
106 // constructor - shuttle must be instantiated!
108 AddRunType("PHYSICS");
111 //_______________________________________________________________
112 AliGRPPreprocessor::~AliGRPPreprocessor()
119 //_______________________________________________________________
120 void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
122 // Initialize preprocessor
124 AliPreprocessor::Initialize(run, startTime, endTime);
126 AliInfo("Initialization of the GRP preprocessor.");
128 TClonesArray * array = new TClonesArray("AliDCSSensor",2);
129 for(Int_t j = 0; j < 2; j++) {
130 AliDCSSensor * sens = new ((*array)[j])AliDCSSensor;
131 sens->SetStringID(fgkDCSDataPoints[j+kSensors]);
133 AliInfo(Form("Pressure Entries: %d",array->GetEntries()));
135 fPressure = new AliDCSSensorArray(fStartTime, fEndTime, array);
138 //_______________________________________________________________
139 UInt_t AliGRPPreprocessor::Process(TMap* valueMap)
141 // process data retrieved by the Shuttle
143 //=================//
145 //=================//
148 TMap *grpmap = ProcessDaqLB();
149 if( grpmap->GetEntries() == fgknDAQLbPar ) {
150 Log(Form("DAQ logbook, successful!"));
152 Log(Form("DAQ logbook, missing parameters!!!"));
155 //=================//
157 //=================//
158 UInt_t iDaqFxs = ProcessDaqFxs();
160 Log(Form("DAQ FXS, successful!"));
162 Log(Form("DAQ FXS, could not store run raw tag file!!!"));
166 //=================//
168 //=================//
169 UInt_t iDcsFxs = ProcessDcsFxs();
171 Log(Form("DCS FXS, successful!"));
173 Log(Form("DCS FXS, Could not store CTP run configuration and scalers!!!"));
177 //=================//
178 // DCS data points //
179 //=================//
180 Int_t entries = ProcessDcsDPs( valueMap, grpmap );
181 if( entries < fgknDCSDP-5 ) { // FIXME (!= ) LHState and pressure map are not working yet...
182 Log(Form("Problem with the DCS data points!!!"));
184 } else Log(Form("DCS data points, successful!"));
186 //=======================//
187 // Trigger Configuration //
188 //=======================//
189 // either from DAQ logbook.....
190 const char * triggerConf = GetTriggerConfiguration();
191 if (triggerConf!= NULL) {
192 Log("Found trigger configuration in DAQ logbook");
193 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConf);
195 Log("Bad CTP run configuration file from DAQ logbook! The corresponding CDB entry will not be filled!");
199 TString titleCTPcfg = Form("CTP cfg for run %i from DAQ",fRun);
200 runcfg->SetTitle(titleCTPcfg);
201 AliCDBMetaData metaData;
202 metaData.SetBeamPeriod(0);
203 metaData.SetResponsible("Roman Lietava");
204 metaData.SetComment("CTP run configuration from DAQ logbook");
205 if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
206 Log("Unable to store the CTP run configuration object to OCDB!");
211 // ...or from DCS FXS
213 Log("No trigger configuration found in the DAQ logbook!! Trying reading from DCS FXS...");
214 TString runcfgfile = GetFile(kDCS, "CTP_runconfig", "");
215 if (runcfgfile.IsNull()) {
216 Log("No CTP runconfig files has been found in DCS FXS!");
220 Log(Form("File with Id CTP_runconfig found! Copied to %s",runcfgfile.Data()));
221 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
223 Log("Bad CTP run configuration file from DCS FXS! The corresponding CDB entry will not be filled!");
227 TString titleCTPcfg = Form("CTP cfg for run %i from DCS",fRun);
228 runcfg->SetTitle(titleCTPcfg);
229 AliCDBMetaData metaData;
230 metaData.SetBeamPeriod(0);
231 metaData.SetResponsible("Roman Lietava");
232 metaData.SetComment("CTP run configuration from DCS FXS");
233 if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
234 Log("Unable to store the CTP run configuration object to OCDB!");
242 AliInfo(Form("Final list entries: %d",grpmap->GetEntries()));
245 md.SetResponsible("Ernesto Lopez Torres");
246 md.SetComment("Output parameters from the GRP preprocessor.");
248 Bool_t result = Store("GRP", "Data", grpmap, &md);
252 if (result && !error ) {
253 Log("GRP Preprocessor Success");
256 Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s%s",
257 kppError[(error&1)?1:0],
258 kppError[(error&2)?2:0],
259 kppError[(error&4)?3:0],
260 kppError[(error&8)?4:0],
261 kppError[(error&16)?5:0]
267 //_______________________________________________________________
268 TMap *AliGRPPreprocessor::ProcessDaqLB()
270 //Getting the DAQ lb information
272 const char* timeStart = GetRunParameter("DAQ_time_start");
273 const char* timeEnd = GetRunParameter("DAQ_time_end");
274 const char* beamEnergy = GetRunParameter("beamEnergy");
275 const char* beamType = GetRunParameter("beamType");
276 const char* numberOfDetectors = GetRunParameter("numberOfDetectors");
277 const char* detectorMask = GetRunParameter("detectorMask");
278 const char* lhcPeriod = GetRunParameter("LHCperiod");
280 TMap *mapDAQ = new TMap();
283 Log(Form("Start time for run %d: %s",fRun, timeStart));
285 Log(Form("Start time not put in logbook!"));
287 mapDAQ->Add(new TObjString("fAliceStartTime"), new TObjString(timeStart));
290 Log(Form("End time for run %d: %s",fRun, timeEnd));
292 Log(Form("End time not put in logbook!"));
294 mapDAQ->Add(new TObjString("fAliceStopTime"), new TObjString(timeEnd));
297 Log(Form("Beam energy for run %d: %s",fRun, beamEnergy));
299 Log(Form("Beam energy not put in logbook!"));
301 mapDAQ->Add(new TObjString("fAliceBeamEnergy"), new TObjString(beamEnergy));
304 Log(Form("Beam type for run %d: %s",fRun, beamType));
306 Log(Form("Beam type not put in logbook!"));
308 mapDAQ->Add(new TObjString("fAliceBeamType"), new TObjString(beamType));
310 if (numberOfDetectors) {
311 Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors));
313 Log(Form("Number of active detectors not put in logbook!"));
315 mapDAQ->Add(new TObjString("fNumberOfDetectors"), new TObjString(numberOfDetectors));
318 Log(Form("Detector mask for run %d: %s",fRun, detectorMask));
320 Log(Form("Detector mask not put in logbook!"));
322 mapDAQ->Add(new TObjString("fDetectorMask"), new TObjString(detectorMask));
325 Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod));
327 Log(Form("LHCperiod not put in logbook!"));
329 mapDAQ->Add(new TObjString("fLHCPeriod"), new TObjString(lhcPeriod));
331 mapDAQ->Add(new TObjString("fRunType"), new TObjString(GetRunType()));
332 Log( Form("Retrived %d parameters from logbook", mapDAQ->GetEntries() ) );
337 //_______________________________________________________________
338 UInt_t AliGRPPreprocessor::ProcessDaqFxs()
340 //======DAQ FXS======//
342 TList* list = GetFileSources(kDAQ);
344 Log("No raw data tag list: connection problems with DAQ FXS logbook!");
348 if (list->GetEntries() == 0) {
349 Log("no raw data tags in this run: nothing to merge!");
354 TChain *fRawTagChain = new TChain("T");
356 TIterator* iter = list->MakeIterator();
358 while ((obj = iter->Next())) {
359 TObjString* objStr = dynamic_cast<TObjString*> (obj);
361 Log(Form("Found source %s", objStr->String().Data()));
362 TList* list2 = GetFileIDs(kDAQ, objStr->String());
364 Log("No list with ids from DAQ was found: connection problems with DAQ FXS logbook!");
365 delete fRawTagChain; fRawTagChain=0;
368 Log(Form("Number of ids: %d",list2->GetEntries()));
369 for(Int_t i = 0; i < list2->GetEntries(); i++) {
370 TObjString *idStr = (TObjString *)list2->At(i);
371 TString fileName = GetFile(kDAQ,idStr->String().Data(),objStr->String().Data());
372 if (fileName.Length() > 0) {
373 Log(Form("Adding file in the chain: %s",fileName.Data()));
374 fRawTagChain->Add(fileName.Data());
377 Log(Form("Could not retrieve file with id %s from source %s: "
378 "connection problems with DAQ FXS!",
379 idStr->String().Data(), objStr->String().Data()));
381 delete list2; list2=0;
382 delete fRawTagChain; fRawTagChain=0;
390 TString fRawDataFileName = "GRP_Merged.tag.root";
391 Log(Form("Merging %d raw data tags into file: %s", nFiles, fRawDataFileName.Data()));
392 if( fRawTagChain->Merge(fRawDataFileName) < 1 ) {
393 Log("Error merging raw data files!!!");
397 TString outputfile = Form("Run%d.Merged.RAW.tag.root", fRun);
398 Bool_t result = StoreRunMetadataFile(fRawDataFileName.Data(),outputfile.Data());
401 Log("Problem storing raw data tags in local file!!!");
403 Log("Raw data tags merged successfully!!");
408 delete fRawTagChain; fRawTagChain=0;
410 if (result == kFALSE) {
418 //_______________________________________________________________
419 UInt_t AliGRPPreprocessor::ProcessDcsFxs()
421 //======DCS FXS======//
422 // Get the CTP run configuration
423 // and scalers from DCS FXS
428 // Get the CTP run configuration
429 TList* list = GetFileSources(kDCS,"CTP_runconfig");
431 Log("No CTP runconfig file: connection problems with DCS FXS logbook!");
435 if (list->GetEntries() == 0) {
436 Log("No CTP runconfig file to be processed!");
442 while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
443 TString runcfgfile = GetFile(kDCS, "CTP_runconfig", source->GetName());
444 if (runcfgfile.IsNull()) {
445 Log("No CTP runconfig files has been found: empty source!");
448 Log(Form("File with Id CTP_runconfig found in source %s! Copied to %s",source->GetName(),runcfgfile.Data()));
449 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
451 Log("Bad CTP run configuration file! The corresponding CDB entry will not be filled!");
455 AliCDBMetaData metaData;
456 metaData.SetBeamPeriod(0);
457 metaData.SetResponsible("Roman Lietava");
458 metaData.SetComment("CTP run configuration");
459 if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
460 Log("Unable to store the CTP run configuration object to OCDB!");
470 // Get the CTP counters information
471 TList* list = GetFileSources(kDCS,"CTP_xcounters");
473 Log("No CTP counters file: connection problems with DAQ FXS logbook!");
477 if (list->GetEntries() == 0) {
478 Log("No CTP counters file to be processed!");
484 while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
485 TString countersfile = GetFile(kDCS, "CTP_xcounters", source->GetName());
486 if (countersfile.IsNull()) {
487 Log("No CTP counters files has been found: empty source!");
490 Log(Form("File with Id CTP_xcounters found in source %s! Copied to %s",source->GetName(),countersfile.Data()));
491 AliTriggerRunScalers *scalers = AliTriggerRunScalers::ReadScalers(countersfile);
493 Log("Bad CTP counters file! The corresponding CDB entry will not be filled!");
497 AliCDBMetaData metaData;
498 metaData.SetBeamPeriod(0);
499 metaData.SetResponsible("Roman Lietava");
500 metaData.SetComment("CTP scalers");
501 if (!Store("CTP","Scalers", scalers, &metaData, 0, 0)) {
502 Log("Unable to store the CTP scalers object to OCDB!");
514 //_______________________________________________________________
515 Int_t AliGRPPreprocessor::ProcessDcsDPs(TMap* valueMap, TMap* mapDCS)
517 //Getting the DCS dps
525 AliInfo(Form("==========LHCState==========="));
526 TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[0]);
528 Log(Form("LHCState not found!!!"));
530 AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState,fStartTime,fEndTime);
531 TString sLHCState = dcs1->ProcessDCS(2);
533 for( Int_t i=0; i<20; i+=2 ) {
534 if( sLHCState.CompareTo(fgkLHCState[i]) == 0 ) {
535 sLHCState = fgkLHCState[i+1];
539 Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data()));
541 Log("LHCState not put in TMap!");
543 mapDCS->Add(new TObjString("fLHCState"),new TObjString(sLHCState));
547 AliInfo(Form("==========L3Polarity==========="));
548 TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[1]);
549 if(!aliasL3Polarity) {
550 Log(Form("L3Polarity not found!!!"));
552 AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity,fStartTime,fEndTime);
553 TString sL3Polarity = dcs6->ProcessDCS(1);
555 Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data()));
557 Log("L3Polarity not put in TMap!");
559 mapDCS->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity));
563 AliInfo(Form("==========DipolePolarity==========="));
564 TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[2]);
565 if(!aliasDipolePolarity) {
566 Log(Form("DipolePolarity not found!!!"));
568 AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity,fStartTime,fEndTime);
569 TString sDipolePolarity = dcs8->ProcessDCS(1);
570 if (sDipolePolarity) {
571 Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data()));
573 Log("DipolePolarity not put in TMap!");
575 mapDCS->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity));
579 AliInfo(Form("==========LHCLuminosity==========="));
580 TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[3]);
581 if(!aliasLHCLuminosity) {
582 Log(Form("LHCLuminosity not found!!!"));
584 AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity,fStartTime,fEndTime);
585 TString sMeanLHCLuminosity = dcs3->ProcessDCS(5);
586 if (sMeanLHCLuminosity) {
587 Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data()));
589 Log("LHCLuminosity not put in TMap!");
591 mapDCS->Add(new TObjString("fLHCLuminosity"), new TObjString(sMeanLHCLuminosity));
595 AliInfo(Form("==========BeamIntensity==========="));
596 TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[4]);
597 if(!aliasBeamIntensity) {
598 Log(Form("BeamIntensity not found!!!"));
600 AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity,fStartTime,fEndTime);
601 TString sMeanBeamIntensity = dcs4->ProcessDCS(5);
602 if (sMeanBeamIntensity) {
603 Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data()));
605 Log("BeamIntensity not put in TMap!");
607 mapDCS->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity));
611 AliInfo(Form("==========L3Current==========="));
612 TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[5]);
613 if(!aliasL3Current) {
614 Log(Form("L3Current not found!!!"));
616 AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current,fStartTime,fEndTime);
617 TString sMeanL3Current = dcs5->ProcessDCS(5);
618 if (sMeanL3Current) {
619 Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data()));
621 Log("L3Current not put in TMap!");
623 mapDCS->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current));
628 AliInfo(Form("==========DipoleCurrent==========="));
629 TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[6]);
630 if(!aliasDipoleCurrent) {
631 Log(Form("DipoleCurrent not found!!!"));
633 AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent,fStartTime,fEndTime);
634 TString sMeanDipoleCurrent = dcs7->ProcessDCS(5);
635 if (sMeanDipoleCurrent) {
636 Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data()));
638 Log("DipoleCurrent not put in TMap!");
640 mapDCS->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent));
644 AliInfo(Form("==========CavernTemperature==========="));
645 TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[7]);
646 if(!aliasCavernTemperature) {
647 Log(Form("CavernTemperature not found!!!"));
649 AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature,fStartTime,fEndTime);
650 TString sMeanCavernTemperature = dcs9->ProcessDCS(5);
651 if (sMeanCavernTemperature) {
652 Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data()));
654 Log("CavernTemperature not put in TMap!");
656 mapDCS->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature));
660 AliInfo(Form("==========CavernPressure==========="));
661 TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[8]);
662 if(!aliasCavernPressure) {
663 Log("CavernPressure not found!!!");
665 AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure,fStartTime,fEndTime);
666 TString sMeanCavernPressure = dcs10->ProcessDCS(5);
667 if (sMeanCavernPressure) {
668 Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data()));
670 Log("CavernPressure not put in TMap!");
672 mapDCS->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure));
677 // NEEDS TO BE REVISED, CONFIRMED
678 AliInfo(Form("==========GenevaPressureMaps==========="));
679 AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap);
680 if( fPressure->NumFits()==0 ) {
681 Log("Problem with the pressure sensor values!!!");
683 AliDCSSensor* sensorCr5 = dcsSensorArray->GetSensor(fgkDCSDataPoints[9]);
684 if( sensorCr5->GetFit() ) {
685 Log(Form("<GvaCr5Pressure> for run %d: Sensor Fit found",fRun));
686 mapDCS->Add( new TObjString("fCr5Pressure"), sensorCr5 );
689 Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[9] ));
692 AliDCSSensor* sensorMeyrin = dcsSensorArray->GetSensor(fgkDCSDataPoints[10]);
693 if( sensorMeyrin->GetFit() ) {
694 Log(Form("<MeyrinPressure> for run %d: Sensor Fit found",fRun));
695 mapDCS->Add( new TObjString("fMeyrinPressure"), sensorMeyrin );
698 Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[10] ));
706 //_______________________________________________________________
707 AliDCSSensorArray *AliGRPPreprocessor::GetPressureMap(TMap* dcsAliasMap)
709 // extract DCS pressure maps. Perform fits to save space
711 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
713 fPressure->MakeSplineFit(map);
714 Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors();
715 if (fitFraction > kFitFraction ) {
716 AliInfo(Form("Pressure values extracted, %d fits performed.", fPressure->NumFits()));
718 AliInfo("Too few pressure maps fitted!!!");
721 AliInfo("no atmospheric pressure map extracted!!!");
728 //_______________________________________________________________
729 /*UInt_t AliGRPPreprocessor::MapPressure(TMap* dcsAliasMap) {
730 // extract DCS pressure maps. Perform fits to save space
733 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
735 fPressure->MakeSplineFit(map);
736 Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors();
737 if (fitFraction > kFitFraction ) {
738 AliInfo(Form("Pressure values extracted, fits performed.\n"));
740 Log ("Too few pressure maps fitted. \n");
744 Log("AliTPCPreprocsessor: no atmospheric pressure map extracted. \n");
748 // Now store the final CDB file
751 AliCDBMetaData metaData;
752 metaData.SetBeamPeriod(0);
753 metaData.SetResponsible("Panos Christakoglou");
754 metaData.SetComment("Preprocessor AliGRP data base pressure entries.");
756 Bool_t storeOK = Store("Calib", "Pressure", fPressure, &metaData, 0, 0);
757 if ( !storeOK ) result=1;
764 //_______________________________________________________________
765 Int_t AliGRPPreprocessor::ReceivePromptRecoParameters(UInt_t run, const char* dbHost, Int_t dbPort, const char* dbName, const char* user, const char* password, const char *cdbRoot)
768 // Retrieves logbook and trigger information from the online logbook
769 // This information is needed for prompt reconstruction
773 // DAQ params: dbHost, dbPort, dbName, user, password, logbookTable, triggerTable
777 // positive on success: the return code is the run number of last run processed of the same run type already processed by the SHUTTLE
778 // 0 on success and no run was found
781 // This function is NOT called during the preprocessor run in the Shuttle!
789 AliCDBManager* cdb = AliCDBManager::Instance();
790 cdb->SetDefaultStorage(cdbRoot);
793 TSQLServer* server = TSQLServer::Connect(Form("mysql://%s:%d/%s", dbHost, dbPort, dbName), user, password);
797 Printf("ERROR: Could not connect to DAQ LB");
803 sqlQuery.Form("SELECT DAQ_time_start, run_type, detectorMask FROM logbook WHERE run = %d", run);
804 TSQLResult* result = server->Query(sqlQuery);
807 Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
811 if (result->GetRowCount() == 0)
813 Printf("ERROR: Run %d not found", run);
818 TSQLRow* row = result->Next();
821 Printf("ERROR: Could not receive data from run %d", run);
826 TString runType(row->GetField(1));
829 grpData.Add(new TObjString("DAQ_time_start"), new TObjString(row->GetField(0)));
830 grpData.Add(new TObjString("run_type"), new TObjString(runType));
831 grpData.Add(new TObjString("detectorMask"), new TObjString(row->GetField(2)));
839 Printf("Storing GRP/GRP/Data object with the following content");
842 AliCDBMetaData metadata;
843 metadata.SetResponsible("Jan Fiete Grosse-Oetringhaus");
844 metadata.SetComment("GRP Output parameters received during online running");
846 AliCDBId id("GRP/GRP/Data", run, run);
847 Bool_t success = cdb->Put(&grpData, id, &metadata);
853 Printf("ERROR: Could not store GRP/GRP/Data into OCDB");
857 // Receive trigger information
858 sqlQuery.Form("SELECT configFile FROM logbook_trigger_config WHERE run = %d", run);
859 result = server->Query(sqlQuery);
862 Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
866 if (result->GetRowCount() == 0)
868 Printf("ERROR: Run %d not found in logbook_trigger_config", run);
873 row = result->Next();
876 Printf("ERROR: Could not receive logbook_trigger_config data from run %d", run);
881 TString triggerConfig(row->GetField(0));
889 Printf("Found trigger configuration: %s", triggerConfig.Data());
891 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConfig);
894 Printf("ERROR: Could not create CTP configuration object");
898 metadata.SetComment("CTP run configuration received during online running");
900 AliCDBId id2("GRP/CTP/Config", run, run);
901 success = cdb->Put(runcfg, id2, &metadata);
908 Printf("ERROR: Could not store GRP/CTP/Config into OCDB");
912 // get last run with same run type that was already processed by the SHUTTLE
914 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());
915 result = server->Query(sqlQuery);
918 Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
922 if (result->GetRowCount() == 0)
924 Printf("ERROR: No result with query <%s>", sqlQuery.Data());
929 row = result->Next();
932 Printf("ERROR: Could not receive data for query <%s>", sqlQuery.Data());
937 TString lastRunStr(row->GetField(0));
938 Int_t lastRun = lastRunStr.Atoi();
940 Printf("Last run with same run type %s is %d", runType.Data(), lastRun);