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 //-------------------------------------------------------------------------
27 #include <TObjString.h>
28 #include <TTimeStamp.h>
32 #include "AliGRPPreprocessor.h"
33 #include "AliGRPDCS.h"
34 #include "AliDCSSensorArray.h"
36 #include "AliTriggerConfiguration.h"
37 #include "AliTriggerRunScalers.h"
39 #include "AliCDBMetaData.h"
43 class AliShuttleInterface;
47 // needed for ReceivePromptRecoParameters
48 #include <TSQLServer.h>
49 #include <TSQLResult.h>
51 #include <AliCDBManager.h>
52 #include <AliCDBMetaData.h>
54 #include <AliTriggerConfiguration.h>
56 const Double_t kFitFraction = 0.7; // Fraction of DCS sensor fits required
58 ClassImp(AliGRPPreprocessor)
60 //_______________________________________________________________
61 const char* AliGRPPreprocessor::fgkDCSDataPoints[12] = {"LHCState","LHCPeriod","LHCLuminosity","BeamIntensity","L3Current","L3Polarity","DipoleCurrent","DipolePolarity","CavernTemperature","CavernAtmosPressure","gva_cr5AtmosphericPressure","gva_meyrinAtmosphericPressure"};
63 //_______________________________________________________________
64 AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
65 AliPreprocessor("GRP",shuttle), fPressure(0) {
66 // constructor - shuttle must be instantiated!
68 AddRunType("PHYSICS");
71 //_______________________________________________________________
72 AliGRPPreprocessor::~AliGRPPreprocessor() {
77 //_______________________________________________________________
78 void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) {
79 // Initialize preprocessor
81 AliPreprocessor::Initialize(run, startTime, endTime);
83 AliInfo("Initialization of the GRP preprocessor.");
85 TClonesArray * array = new TClonesArray("AliDCSSensor",2);
86 for(Int_t j = 0; j < 2; j++) {
87 AliDCSSensor * sens = new ((*array)[j])AliDCSSensor;
88 sens->SetStringID(fgkDCSDataPoints[j+10]);
90 AliInfo(Form("Pressure Entries: %d",array->GetEntries()));
92 fPressure = new AliDCSSensorArray(fStartTime, fEndTime, array);
95 //_______________________________________________________________
96 UInt_t AliGRPPreprocessor::Process(TMap* valueMap) {
97 // process data retrieved by the Shuttle
101 //=================//
103 TList *daqlblist = ProcessDaqLB();
105 Log(Form("Problem with the DAQ logbook parameters!!!"));
109 //=================//
111 //=================//
112 UInt_t iDaqFxs = ProcessDaqFxs();
114 Log(Form("ProcessDaqFxs successful!"));
116 Log(Form("Could not store run raw tag file!"));
120 //=================//
122 //=================//
123 UInt_t iDcsFxs = ProcessDcsFxs();
125 Log(Form("ProcessDcsFxs successful!"));
127 Log(Form("Could not store CTP run configuration and scalers!"));
131 //=================//
132 // DCS data points //
133 //=================//
134 TList *dcsdplist = ProcessDcsDPs(valueMap);
136 Log(Form("Problem with the DCS data points!!!"));
139 if(dcsdplist->GetEntries() != 10) {
140 Log(Form("Problem with the DCS data points!!!"));
141 // return 1; // TODO:COMMENTED FOR TESTING PURPOSES!
143 //NEEDS TO BE REVISED - BREAKS!!!
144 // AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap,fPressure);
145 // if(!dcsSensorArray) {
146 // Log(Form("Problem with the pressure sensor values!!!"));
150 daqlblist->AddAll(dcsdplist);
151 daqlblist->SetOwner(1);
152 AliInfo(Form("Final list entries: %d",daqlblist->GetEntries()));
155 md.SetResponsible("Panos Christakoglou");
156 md.SetComment("Output parameters from the GRP preprocessor.");
158 Bool_t result = Store("GRP", "Data", daqlblist, &md);
168 //_______________________________________________________________
169 TList *AliGRPPreprocessor::ProcessDaqLB() {
170 //Getting the DAQ lb informnation
171 const char* timeStart = GetRunParameter("time_start");
172 const char* timeEnd = GetRunParameter("time_end");
173 const char* beamEnergy = GetRunParameter("beamEnergy");
174 const char* beamType = GetRunParameter("beamType");
175 const char* numberOfDetectors = GetRunParameter("numberOfDetectors");
176 const char* detectorMask = GetRunParameter("detectorMask");
177 const char* lhcPeriod = GetRunParameter("LHCperiod");
180 Log(Form("Start time for run %d: %s",fRun, timeStart));
182 Log(Form("Start time not put in logbook!"));
184 TMap *mapDAQ1 = new TMap();
185 mapDAQ1->Add(new TObjString("fAliceStartTime"),new TObjString(timeStart));
188 Log(Form("End time for run %d: %s",fRun, timeEnd));
190 Log(Form("End time not put in logbook!"));
192 TMap *mapDAQ2 = new TMap();
193 mapDAQ2->Add(new TObjString("fAliceStopTime"),new TObjString(timeEnd));
196 Log(Form("Beam energy for run %d: %s",fRun, beamEnergy));
198 Log(Form("Beam energy not put in logbook!"));
200 TMap *mapDAQ3 = new TMap();
201 mapDAQ3->Add(new TObjString("fAliceBeamEnergy"),new TObjString(beamEnergy));
204 Log(Form("Beam type for run %d: %s",fRun, beamType));
206 Log(Form("Beam type not put in logbook!"));
208 TMap *mapDAQ4 = new TMap();
209 mapDAQ4->Add(new TObjString("fAliceBeamType"),new TObjString(beamType));
211 if (numberOfDetectors) {
212 Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors));
214 Log(Form("Number of active detectors not put in logbook!"));
216 TMap *mapDAQ5 = new TMap();
217 mapDAQ5->Add(new TObjString("fNumberOfDetectors"),new TObjString(numberOfDetectors));
220 Log(Form("Detector mask for run %d: %s",fRun, detectorMask));
222 Log(Form("Detector mask not put in logbook!"));
224 TMap *mapDAQ6 = new TMap();
225 mapDAQ6->Add(new TObjString("fDetectorMask"),new TObjString(detectorMask));
228 Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod));
230 Log(Form("LHCperiod not put in logbook!"));
232 TMap *mapDAQ7 = new TMap();
233 mapDAQ7->Add(new TObjString("fLHCPeriod"),new TObjString(lhcPeriod));
235 TList *list = new TList();
236 list->Add(mapDAQ1); list->Add(mapDAQ2);
237 list->Add(mapDAQ3); list->Add(mapDAQ4);
238 list->Add(mapDAQ5); list->Add(mapDAQ6);
241 TMap* mapDAQ8 = new TMap;
242 mapDAQ8->Add(new TObjString("fRunType"), new TObjString(GetRunType()));
248 //_______________________________________________________________
249 UInt_t AliGRPPreprocessor::ProcessDaqFxs() {
250 //======DAQ FXS======//
252 TList* list = GetFileSources(kDAQ);
254 Log("No raw data tag list: connection problems with DAQ FXS logbook!");
258 if (list->GetEntries() == 0)
260 Log("no raw data tags in this run: nothing to merge!");
265 TChain *fRawTagChain = new TChain("T");
267 TIterator* iter = list->MakeIterator();
269 while ((obj = iter->Next())) {
270 TObjString* objStr = dynamic_cast<TObjString*> (obj);
272 Log(Form("Found source %s", objStr->String().Data()));
273 TList* list2 = GetFileIDs(kDAQ, objStr->String());
275 Log("No list with ids from DAQ was found: connection problems with DAQ FXS logbook!");
276 delete fRawTagChain; fRawTagChain=0;
279 Log(Form("Number of ids: %d",list2->GetEntries()));
280 for(Int_t i = 0; i < list2->GetEntries(); i++) {
281 TObjString *idStr = (TObjString *)list2->At(i);
282 TString fileName = GetFile(kDAQ,idStr->String().Data(),objStr->String().Data());
283 if (fileName.Length() > 0)
285 Log(Form("Adding file in the chain: %s",fileName.Data()));
286 fRawTagChain->Add(fileName.Data());
289 Log(Form("Could not retrieve file with id %s from source %s: "
290 "connection problems with DAQ FXS!",
291 idStr->String().Data(),objStr->String().Data()));
293 delete list2; list2=0;
294 delete fRawTagChain; fRawTagChain=0;
302 TString fRawDataFileName = "GRP_Merged.tag.root";
303 Log(Form("Merging %d raw data tags into file: %s", nFiles, fRawDataFileName.Data()));
304 fRawTagChain->Merge(fRawDataFileName);
306 TString outputfile = Form("Run%d.Merged.RAW.tag.root", fRun);
307 Bool_t result = StoreRunMetadataFile(fRawDataFileName.Data(),outputfile.Data());
311 Log("Problem storing raw data tags in local file!!");
313 Log("Raw data tags merged successfully!!");
318 delete fRawTagChain; fRawTagChain=0;
320 if (result == kFALSE)
329 //_______________________________________________________________
330 UInt_t AliGRPPreprocessor::ProcessDcsFxs() {
331 //======DCS FXS======//
332 // Get the CTP run configuration
333 // and scalers from DCS FXS
336 // Get the CTP run configuration
337 TList* list = GetFileSources(kDCS,"CTP_runconfig");
339 Log("No CTP runconfig file: connection problems with DCS FXS logbook!");
343 if (list->GetEntries() == 0) {
344 Log("No CTP runconfig file to be processed!");
349 while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
350 TString runcfgfile = GetFile(kDCS, "CTP_runconfig", source->GetName());
351 if (runcfgfile.IsNull()) {
352 Log("No CTP runconfig files has been found: empty source!");
355 Log(Form("File with Id CTP_runconfig found in source %s! Copied to %s",source->GetName(),runcfgfile.Data()));
356 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
358 Log("Bad CTP run configuration file! The corresponding CDB entry will not be filled!");
361 AliCDBMetaData metaData;
362 metaData.SetBeamPeriod(0);
363 metaData.SetResponsible("Roman Lietava");
364 metaData.SetComment("CTP run configuration");
365 if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
366 Log("Unable to store the CTP run configuration object to OCDB!");
376 // Get the CTP counters information
377 TList* list = GetFileSources(kDCS,"CTP_xcounters");
379 Log("No CTP counters file: connection problems with DAQ FXS logbook!");
383 if (list->GetEntries() == 0) {
384 Log("No CTP counters file to be processed!");
389 while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
390 TString countersfile = GetFile(kDCS, "CTP_xcounters", source->GetName());
391 if (countersfile.IsNull()) {
392 Log("No CTP counters files has been found: empty source!");
395 Log(Form("File with Id CTP_xcounters found in source %s! Copied to %s",source->GetName(),countersfile.Data()));
396 AliTriggerRunScalers *scalers = AliTriggerRunScalers::ReadScalers(countersfile);
398 Log("Bad CTP counters file! The corresponding CDB entry will not be filled!");
401 AliCDBMetaData metaData;
402 metaData.SetBeamPeriod(0);
403 metaData.SetResponsible("Roman Lietava");
404 metaData.SetComment("CTP scalers");
405 if (!Store("CTP","Scalers", scalers, &metaData, 0, 0)) {
406 Log("Unable to store the CTP scalers object to OCDB!");
418 //_______________________________________________________________
419 TList *AliGRPPreprocessor::ProcessDcsDPs(TMap* valueMap) {
420 //Getting the DCS dps
423 TList *list = new TList();
427 AliInfo(Form("==========LHCState==========="));
428 TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[0]);
430 Log(Form("LHCState not found!!!"));
433 AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState,fStartTime,fEndTime);
434 TString sLHCState = dcs1->ProcessDCS(3);
436 Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data()));
438 Log(Form("LHCState not put in TMap!"));
440 TMap *mapDCS1 = new TMap();
441 mapDCS1->Add(new TObjString("fLHCState"),new TObjString(sLHCState));
444 AliInfo(Form("==========LHCPeriod==========="));
445 TObjArray *aliasLHCPeriod = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[1]);
446 if(!aliasLHCPeriod) {
447 Log(Form("LHCPeriod not found!!!"));
450 AliGRPDCS *dcs2 = new AliGRPDCS(aliasLHCPeriod,fStartTime,fEndTime);
451 TString sLHCPeriod = dcs2->ProcessDCS(3);
453 Log(Form("<LHCPeriod> for run %d: %s",fRun, sLHCPeriod.Data()));
455 Log(Form("LHCPeriod not put in TMap!"));
457 TMap *mapDCS2 = new TMap();
458 mapDCS2->Add(new TObjString("fLHCCondition"),new TObjString(sLHCPeriod));
461 AliInfo(Form("==========LHCLuminosity==========="));
462 TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[2]);
463 if(!aliasLHCLuminosity) {
464 Log(Form("LHCLuminosity not found!!!"));
467 AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity,fStartTime,fEndTime);
468 TString sMeanLHCLuminosity = dcs3->ProcessDCS(2);
469 if (sMeanLHCLuminosity) {
470 Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data()));
472 Log(Form("LHCLuminosity not put in TMap!"));
474 TMap *mapDCS3 = new TMap();
475 mapDCS3->Add(new TObjString("fLHCLuminosity"),new TObjString(sMeanLHCLuminosity));
478 AliInfo(Form("==========BeamIntensity==========="));
479 TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[3]);
480 if(!aliasBeamIntensity) {
481 Log(Form("BeamIntensity not found!!!"));
484 AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity,fStartTime,fEndTime);
485 TString sMeanBeamIntensity = dcs4->ProcessDCS(2);
486 if (sMeanBeamIntensity) {
487 Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data()));
489 Log(Form("BeamIntensity not put in TMap!"));
491 TMap *mapDCS4 = new TMap();
492 mapDCS4->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity));
495 AliInfo(Form("==========L3Current==========="));
496 TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[4]);
497 if(!aliasL3Current) {
498 Log(Form("L3Current not found!!!"));
501 AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current,fStartTime,fEndTime);
502 TString sMeanL3Current = dcs5->ProcessDCS(2);
503 if (sMeanL3Current) {
504 Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data()));
506 Log(Form("L3Current not put in TMap!"));
508 TMap *mapDCS5 = new TMap();
509 mapDCS5->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current));
512 AliInfo(Form("==========L3Polarity==========="));
513 TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[5]);
514 if(!aliasL3Polarity) {
515 Log(Form("L3Polarity not found!!!"));
518 AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity,fStartTime,fEndTime);
519 TString sL3Polarity = dcs6->ProcessDCS(4);
521 Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data()));
523 Log(Form("L3Polarity not put in TMap!"));
525 TMap *mapDCS6 = new TMap();
526 mapDCS6->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity));
529 AliInfo(Form("==========DipoleCurrent==========="));
530 TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[6]);
531 if(!aliasDipoleCurrent) {
532 Log(Form("DipoleCurrent not found!!!"));
535 AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent,fStartTime,fEndTime);
536 TString sMeanDipoleCurrent = dcs7->ProcessDCS(2);
537 if (sMeanDipoleCurrent) {
538 Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data()));
540 Log(Form("DipoleCurrent not put in TMap!"));
542 TMap *mapDCS7 = new TMap();
543 mapDCS7->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent));
546 AliInfo(Form("==========DipolePolarity==========="));
547 TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[7]);
548 if(!aliasDipolePolarity) {
549 Log(Form("DipolePolarity not found!!!"));
552 AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity,fStartTime,fEndTime);
553 TString sDipolePolarity = dcs8->ProcessDCS(4);
554 if (sDipolePolarity) {
555 Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data()));
557 Log(Form("DipolePolarity not put in TMap!"));
559 TMap *mapDCS8 = new TMap();
560 mapDCS8->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity));
563 AliInfo(Form("==========CavernTemperature==========="));
564 TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[8]);
565 if(!aliasCavernTemperature) {
566 Log(Form("CavernTemperature not found!!!"));
569 AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature,fStartTime,fEndTime);
570 TString sMeanCavernTemperature = dcs9->ProcessDCS(2);
571 if (sMeanCavernTemperature) {
572 Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data()));
574 Log(Form("CavernTemperature not put in TMap!"));
576 TMap *mapDCS9 = new TMap();
577 mapDCS9->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature));
580 AliInfo(Form("==========CavernPressure==========="));
581 TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[9]);
582 if(!aliasCavernPressure) {
583 Log(Form("CavernPressure not found!!!"));
586 AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure,fStartTime,fEndTime);
587 TString sMeanCavernPressure = dcs10->ProcessDCS(2);
588 if (sMeanCavernPressure) {
589 Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data()));
591 Log(Form("CavernPressure not put in TMap!"));
593 TMap *mapDCS10 = new TMap();
594 mapDCS10->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure));
600 //_______________________________________________________________
601 AliDCSSensorArray *AliGRPPreprocessor::GetPressureMap(TMap* dcsAliasMap, AliDCSSensorArray *fPressure) {
602 // extract DCS pressure maps. Perform fits to save space
604 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
606 fPressure->MakeSplineFit(map);
607 Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors();
608 if (fitFraction > kFitFraction ) {
609 AliInfo(Form("Pressure values extracted, fits performed.\n"));
611 AliInfo("Too few pressure maps fitted. \n");
614 AliInfo("AliGRPDCS: no atmospheric pressure map extracted. \n");
621 //_______________________________________________________________
622 /*UInt_t AliGRPPreprocessor::MapPressure(TMap* dcsAliasMap) {
623 // extract DCS pressure maps. Perform fits to save space
626 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
628 fPressure->MakeSplineFit(map);
629 Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors();
630 if (fitFraction > kFitFraction ) {
631 AliInfo(Form("Pressure values extracted, fits performed.\n"));
633 Log ("Too few pressure maps fitted. \n");
637 Log("AliTPCPreprocsessor: no atmospheric pressure map extracted. \n");
641 // Now store the final CDB file
644 AliCDBMetaData metaData;
645 metaData.SetBeamPeriod(0);
646 metaData.SetResponsible("Panos Christakoglou");
647 metaData.SetComment("Preprocessor AliGRP data base pressure entries.");
649 Bool_t storeOK = Store("Calib", "Pressure", fPressure, &metaData, 0, 0);
650 if ( !storeOK ) result=1;
657 //_______________________________________________________________
658 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)
661 // Retrieves logbook and trigger information from the online logbook
662 // This information is needed for prompt reconstruction
666 // DAQ params: dbHost, dbPort, dbName, user, password, logbookTable, triggerTable
670 // positive on success: the return code is the run number of last run processed of the same run type already processed by the SHUTTLE
671 // 0 on success and no run was found
674 // This function is NOT called during the preprocessor run in the Shuttle!
682 AliCDBManager* cdb = AliCDBManager::Instance();
683 cdb->SetDefaultStorage(cdbRoot);
686 TSQLServer* server = TSQLServer::Connect(Form("mysql://%s:%d/%s", dbHost, dbPort, dbName), user, password);
690 Printf("ERROR: Could not connect to DAQ LB");
696 sqlQuery.Form("SELECT DAQ_time_start, run_type, detectorMask FROM logbook WHERE run = %d", run);
697 TSQLResult* result = server->Query(sqlQuery);
700 Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
704 if (result->GetRowCount() == 0)
706 Printf("ERROR: Run %d not found", run);
711 TSQLRow* row = result->Next();
714 Printf("ERROR: Could not receive data from run %d", run);
719 TString runType(row->GetField(1));
722 grpData.Add(new TObjString("DAQ_time_start"), new TObjString(row->GetField(0)));
723 grpData.Add(new TObjString("run_type"), new TObjString(runType));
724 grpData.Add(new TObjString("detectorMask"), new TObjString(row->GetField(2)));
732 Printf("Storing GRP/GRP/Data object with the following content");
735 AliCDBMetaData metadata;
736 metadata.SetResponsible("Jan Fiete Grosse-Oetringhaus");
737 metadata.SetComment("GRP Output parameters received during online running");
739 AliCDBId id("GRP/GRP/Data", run, run);
740 Bool_t success = cdb->Put(&grpData, id, &metadata);
746 Printf("ERROR: Could not store GRP/GRP/Data into OCDB");
750 // Receive trigger information
751 sqlQuery.Form("SELECT configFile FROM logbook_trigger_config WHERE run = %d", run);
752 result = server->Query(sqlQuery);
755 Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
759 if (result->GetRowCount() == 0)
761 Printf("ERROR: Run %d not found in logbook_trigger_config", run);
766 row = result->Next();
769 Printf("ERROR: Could not receive logbook_trigger_config data from run %d", run);
774 TString triggerConfig(row->GetField(0));
782 Printf("Found trigger configuration: %s", triggerConfig.Data());
784 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConfig);
787 Printf("ERROR: Could not create CTP configuration object");
791 metadata.SetComment("CTP run configuration received during online running");
793 AliCDBId id2("GRP/CTP/Config", run, run);
794 success = cdb->Put(runcfg, id2, &metadata);
801 Printf("ERROR: Could not store GRP/CTP/Config into OCDB");
805 // get last run with same run type that was already processed by the SHUTTLE
807 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());
808 result = server->Query(sqlQuery);
811 Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
815 if (result->GetRowCount() == 0)
817 Printf("ERROR: No result with query <%s>", sqlQuery.Data());
822 row = result->Next();
825 Printf("ERROR: Could not receive data for query <%s>", sqlQuery.Data());
830 TString lastRunStr(row->GetField(0));
831 Int_t lastRun = lastRunStr.Atoi();
833 Printf("Last run with same run type %s is %d", runType.Data(), lastRun);