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] = {
73 "CavernAtmosPressure",
74 "gva_cr5AtmosphericPressure",
75 "gva_meyrinAtmosphericPressure"
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)"
101 //_______________________________________________________________
102 AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
103 AliPreprocessor("GRP",shuttle), fPressure(0)
105 // constructor - shuttle must be instantiated!
107 AddRunType("PHYSICS");
110 //_______________________________________________________________
111 AliGRPPreprocessor::~AliGRPPreprocessor()
118 //_______________________________________________________________
119 void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
121 // Initialize preprocessor
123 AliPreprocessor::Initialize(run, startTime, endTime);
125 AliInfo("Initialization of the GRP preprocessor.");
127 TClonesArray * array = new TClonesArray("AliDCSSensor",2);
128 for(Int_t j = 0; j < 2; j++) {
129 AliDCSSensor * sens = new ((*array)[j])AliDCSSensor;
130 sens->SetStringID(fgkDCSDataPoints[j+kSensors]);
132 AliInfo(Form("Pressure Entries: %d",array->GetEntries()));
134 fPressure = new AliDCSSensorArray(fStartTime, fEndTime, array);
137 //_______________________________________________________________
138 UInt_t AliGRPPreprocessor::Process(TMap* valueMap)
140 // process data retrieved by the Shuttle
142 //=================//
144 //=================//
147 TMap *grpmap = ProcessDaqLB();
148 if( grpmap->GetEntries() == fgknDAQLbPar ) {
149 Log(Form("DAQ logbook, successful!"));
151 Log(Form("DAQ logbook, missing parameters!!!"));
154 //=================//
156 //=================//
157 UInt_t iDaqFxs = ProcessDaqFxs();
159 Log(Form("DAQ FXS, successful!"));
161 Log(Form("DAQ FXS, could not store run raw tag file!!!"));
165 //=================//
167 //=================//
168 UInt_t iDcsFxs = ProcessDcsFxs();
170 Log(Form("DCS FXS, successful!"));
172 Log(Form("DCS FXS, Could not store CTP run configuration and scalers!!!"));
176 //=================//
177 // DCS data points //
178 //=================//
179 Int_t entries = ProcessDcsDPs( valueMap, grpmap );
180 if( entries < fgknDCSDP-3 ) { // FIXME (!= ) LHState and pressure map are not working yet...???
181 Log(Form("Problem with the DCS data points!!!"));
183 } else Log(Form("DCS data points, successful!"));
186 AliInfo(Form("Final list entries: %d",grpmap->GetEntries()));
189 md.SetResponsible("Ernesto Lopez Torres");
190 md.SetComment("Output parameters from the GRP preprocessor.");
192 Bool_t result = Store("GRP", "Data", grpmap, &md);
196 if (result && !error ) {
197 Log("GRP Preprocessor Success");
200 Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s",
201 kppError[(error&1)?1:0],
202 kppError[(error&2)?2:0],
203 kppError[(error&4)?3:0],
204 kppError[(error&8)?4:0]
210 //_______________________________________________________________
211 TMap *AliGRPPreprocessor::ProcessDaqLB()
213 //Getting the DAQ lb information
215 const char* timeStart = GetRunParameter("time_start");
216 const char* timeEnd = GetRunParameter("time_end");
217 const char* beamEnergy = GetRunParameter("beamEnergy");
218 const char* beamType = GetRunParameter("beamType");
219 const char* numberOfDetectors = GetRunParameter("numberOfDetectors");
220 const char* detectorMask = GetRunParameter("detectorMask");
221 const char* lhcPeriod = GetRunParameter("LHCperiod");
223 TMap *mapDAQ = new TMap();
226 Log(Form("Start time for run %d: %s",fRun, timeStart));
228 Log(Form("Start time not put in logbook!"));
230 mapDAQ->Add(new TObjString("fAliceStartTime"), new TObjString(timeStart));
233 Log(Form("End time for run %d: %s",fRun, timeEnd));
235 Log(Form("End time not put in logbook!"));
237 mapDAQ->Add(new TObjString("fAliceStopTime"), new TObjString(timeEnd));
240 Log(Form("Beam energy for run %d: %s",fRun, beamEnergy));
242 Log(Form("Beam energy not put in logbook!"));
244 mapDAQ->Add(new TObjString("fAliceBeamEnergy"), new TObjString(beamEnergy));
247 Log(Form("Beam type for run %d: %s",fRun, beamType));
249 Log(Form("Beam type not put in logbook!"));
251 mapDAQ->Add(new TObjString("fAliceBeamType"), new TObjString(beamType));
253 if (numberOfDetectors) {
254 Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors));
256 Log(Form("Number of active detectors not put in logbook!"));
258 mapDAQ->Add(new TObjString("fNumberOfDetectors"), new TObjString(numberOfDetectors));
261 Log(Form("Detector mask for run %d: %s",fRun, detectorMask));
263 Log(Form("Detector mask not put in logbook!"));
265 mapDAQ->Add(new TObjString("fDetectorMask"), new TObjString(detectorMask));
268 Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod));
270 Log(Form("LHCperiod not put in logbook!"));
272 mapDAQ->Add(new TObjString("fLHCPeriod"), new TObjString(lhcPeriod));
274 mapDAQ->Add(new TObjString("fRunType"), new TObjString(GetRunType()));
275 Log( Form("Retrived %d parameters from logbook", mapDAQ->GetEntries() ) );
280 //_______________________________________________________________
281 UInt_t AliGRPPreprocessor::ProcessDaqFxs()
283 //======DAQ FXS======//
285 TList* list = GetFileSources(kDAQ);
287 Log("No raw data tag list: connection problems with DAQ FXS logbook!");
291 if (list->GetEntries() == 0) {
292 Log("no raw data tags in this run: nothing to merge!");
297 TChain *fRawTagChain = new TChain("T");
299 TIterator* iter = list->MakeIterator();
301 while ((obj = iter->Next())) {
302 TObjString* objStr = dynamic_cast<TObjString*> (obj);
304 Log(Form("Found source %s", objStr->String().Data()));
305 TList* list2 = GetFileIDs(kDAQ, objStr->String());
307 Log("No list with ids from DAQ was found: connection problems with DAQ FXS logbook!");
308 delete fRawTagChain; fRawTagChain=0;
311 Log(Form("Number of ids: %d",list2->GetEntries()));
312 for(Int_t i = 0; i < list2->GetEntries(); i++) {
313 TObjString *idStr = (TObjString *)list2->At(i);
314 TString fileName = GetFile(kDAQ,idStr->String().Data(),objStr->String().Data());
315 if (fileName.Length() > 0) {
316 Log(Form("Adding file in the chain: %s",fileName.Data()));
317 fRawTagChain->Add(fileName.Data());
320 Log(Form("Could not retrieve file with id %s from source %s: "
321 "connection problems with DAQ FXS!",
322 idStr->String().Data(), objStr->String().Data()));
324 delete list2; list2=0;
325 delete fRawTagChain; fRawTagChain=0;
333 TString fRawDataFileName = "GRP_Merged.tag.root";
334 Log(Form("Merging %d raw data tags into file: %s", nFiles, fRawDataFileName.Data()));
335 if( fRawTagChain->Merge(fRawDataFileName) < 1 ) {
336 Log("Error merging raw data files!!!");
340 TString outputfile = Form("Run%d.Merged.RAW.tag.root", fRun);
341 Bool_t result = StoreRunMetadataFile(fRawDataFileName.Data(),outputfile.Data());
344 Log("Problem storing raw data tags in local file!!!");
346 Log("Raw data tags merged successfully!!");
351 delete fRawTagChain; fRawTagChain=0;
353 if (result == kFALSE) {
361 //_______________________________________________________________
362 UInt_t AliGRPPreprocessor::ProcessDcsFxs()
364 //======DCS FXS======//
365 // Get the CTP run configuration
366 // and scalers from DCS FXS
369 // Get the CTP run configuration
370 TList* list = GetFileSources(kDCS,"CTP_runconfig");
372 Log("No CTP runconfig file: connection problems with DCS FXS logbook!");
376 if (list->GetEntries() == 0) {
377 Log("No CTP runconfig file to be processed!");
383 while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
384 TString runcfgfile = GetFile(kDCS, "CTP_runconfig", source->GetName());
385 if (runcfgfile.IsNull()) {
386 Log("No CTP runconfig files has been found: empty source!");
389 Log(Form("File with Id CTP_runconfig found in source %s! Copied to %s",source->GetName(),runcfgfile.Data()));
390 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
392 Log("Bad CTP run configuration file! The corresponding CDB entry will not be filled!");
396 AliCDBMetaData metaData;
397 metaData.SetBeamPeriod(0);
398 metaData.SetResponsible("Roman Lietava");
399 metaData.SetComment("CTP run configuration");
400 if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
401 Log("Unable to store the CTP run configuration object to OCDB!");
411 // Get the CTP counters information
412 TList* list = GetFileSources(kDCS,"CTP_xcounters");
414 Log("No CTP counters file: connection problems with DAQ FXS logbook!");
418 if (list->GetEntries() == 0) {
419 Log("No CTP counters file to be processed!");
425 while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
426 TString countersfile = GetFile(kDCS, "CTP_xcounters", source->GetName());
427 if (countersfile.IsNull()) {
428 Log("No CTP counters files has been found: empty source!");
431 Log(Form("File with Id CTP_xcounters found in source %s! Copied to %s",source->GetName(),countersfile.Data()));
432 AliTriggerRunScalers *scalers = AliTriggerRunScalers::ReadScalers(countersfile);
434 Log("Bad CTP counters file! The corresponding CDB entry will not be filled!");
438 AliCDBMetaData metaData;
439 metaData.SetBeamPeriod(0);
440 metaData.SetResponsible("Roman Lietava");
441 metaData.SetComment("CTP scalers");
442 if (!Store("CTP","Scalers", scalers, &metaData, 0, 0)) {
443 Log("Unable to store the CTP scalers object to OCDB!");
455 //_______________________________________________________________
456 Int_t AliGRPPreprocessor::ProcessDcsDPs(TMap* valueMap, TMap* mapDCS)
458 //Getting the DCS dps
466 AliInfo(Form("==========LHCState==========="));
467 TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[0]);
469 Log(Form("LHCState not found!!!"));
471 AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState,fStartTime,fEndTime);
472 TString sLHCState = dcs1->ProcessDCS(2);
474 for( Int_t i=0; i<20; i+=2 ) {
475 if( sLHCState.CompareTo(fgkLHCState[i]) == 0 ) {
476 sLHCState = fgkLHCState[i+1];
480 Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data()));
482 Log("LHCState not put in TMap!");
484 mapDCS->Add(new TObjString("fLHCState"),new TObjString(sLHCState));
488 AliInfo(Form("==========L3Polarity==========="));
489 TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[1]);
490 if(!aliasL3Polarity) {
491 Log(Form("L3Polarity not found!!!"));
493 AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity,fStartTime,fEndTime);
494 TString sL3Polarity = dcs6->ProcessDCS(1);
496 Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data()));
498 Log("L3Polarity not put in TMap!");
500 mapDCS->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity));
504 AliInfo(Form("==========DipolePolarity==========="));
505 TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[2]);
506 if(!aliasDipolePolarity) {
507 Log(Form("DipolePolarity not found!!!"));
509 AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity,fStartTime,fEndTime);
510 TString sDipolePolarity = dcs8->ProcessDCS(1);
511 if (sDipolePolarity) {
512 Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data()));
514 Log("DipolePolarity not put in TMap!");
516 mapDCS->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity));
520 AliInfo(Form("==========LHCLuminosity==========="));
521 TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[3]);
522 if(!aliasLHCLuminosity) {
523 Log(Form("LHCLuminosity not found!!!"));
525 AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity,fStartTime,fEndTime);
526 TString sMeanLHCLuminosity = dcs3->ProcessDCS(5);
527 if (sMeanLHCLuminosity) {
528 Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data()));
530 Log("LHCLuminosity not put in TMap!");
532 mapDCS->Add(new TObjString("fLHCLuminosity"), new TObjString(sMeanLHCLuminosity));
536 AliInfo(Form("==========BeamIntensity==========="));
537 TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[4]);
538 if(!aliasBeamIntensity) {
539 Log(Form("BeamIntensity not found!!!"));
541 AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity,fStartTime,fEndTime);
542 TString sMeanBeamIntensity = dcs4->ProcessDCS(5);
543 if (sMeanBeamIntensity) {
544 Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data()));
546 Log("BeamIntensity not put in TMap!");
548 mapDCS->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity));
552 AliInfo(Form("==========L3Current==========="));
553 TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[5]);
554 if(!aliasL3Current) {
555 Log(Form("L3Current not found!!!"));
557 AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current,fStartTime,fEndTime);
558 TString sMeanL3Current = dcs5->ProcessDCS(5);
559 if (sMeanL3Current) {
560 Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data()));
562 Log("L3Current not put in TMap!");
564 mapDCS->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current));
569 AliInfo(Form("==========DipoleCurrent==========="));
570 TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[6]);
571 if(!aliasDipoleCurrent) {
572 Log(Form("DipoleCurrent not found!!!"));
574 AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent,fStartTime,fEndTime);
575 TString sMeanDipoleCurrent = dcs7->ProcessDCS(5);
576 if (sMeanDipoleCurrent) {
577 Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data()));
579 Log("DipoleCurrent not put in TMap!");
581 mapDCS->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent));
585 AliInfo(Form("==========CavernTemperature==========="));
586 TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[7]);
587 if(!aliasCavernTemperature) {
588 Log(Form("CavernTemperature not found!!!"));
590 AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature,fStartTime,fEndTime);
591 TString sMeanCavernTemperature = dcs9->ProcessDCS(5);
592 if (sMeanCavernTemperature) {
593 Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data()));
595 Log("CavernTemperature not put in TMap!");
597 mapDCS->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature));
601 AliInfo(Form("==========CavernPressure==========="));
602 TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[8]);
603 if(!aliasCavernPressure) {
604 Log("CavernPressure not found!!!");
606 AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure,fStartTime,fEndTime);
607 TString sMeanCavernPressure = dcs10->ProcessDCS(5);
608 if (sMeanCavernPressure) {
609 Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data()));
611 Log("CavernPressure not put in TMap!");
613 mapDCS->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure));
618 // NEEDS TO BE REVISED, CONFIRMED
619 AliInfo(Form("==========GenevaPressureMaps==========="));
620 AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap,fPressure);
621 if( fPressure->NumFits()==0 ) {
622 Log("Problem with the pressure sensor values!!!");
624 AliDCSSensor* sensorCr5 = dcsSensorArray->GetSensor(fgkDCSDataPoints[9]);
625 if( sensorCr5->GetFit() ) {
626 Log(Form("<GvaCr5Pressure> for run %d: Sensor Fit found",fRun));
627 mapDCS->Add( new TObjString("fCr5Pressure"), sensorCr5 );
630 Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[9] ));
633 AliDCSSensor* sensorMeyrin = dcsSensorArray->GetSensor(fgkDCSDataPoints[10]);
634 if( sensorMeyrin->GetFit() ) {
635 Log(Form("<MeyrinPressure> for run %d: Sensor Fit found",fRun));
636 mapDCS->Add( new TObjString("fMeyrinPressure"), sensorMeyrin );
639 Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[10] ));
647 //_______________________________________________________________
648 AliDCSSensorArray *AliGRPPreprocessor::GetPressureMap(TMap* dcsAliasMap, AliDCSSensorArray *fPressure)
650 // extract DCS pressure maps. Perform fits to save space
652 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
654 fPressure->MakeSplineFit(map);
655 Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors();
656 if (fitFraction > kFitFraction ) {
657 AliInfo(Form("Pressure values extracted, %d fits performed.", fPressure->NumFits()));
659 AliInfo("Too few pressure maps fitted!!!");
662 AliInfo("no atmospheric pressure map extracted!!!");
669 //_______________________________________________________________
670 /*UInt_t AliGRPPreprocessor::MapPressure(TMap* dcsAliasMap) {
671 // extract DCS pressure maps. Perform fits to save space
674 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
676 fPressure->MakeSplineFit(map);
677 Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors();
678 if (fitFraction > kFitFraction ) {
679 AliInfo(Form("Pressure values extracted, fits performed.\n"));
681 Log ("Too few pressure maps fitted. \n");
685 Log("AliTPCPreprocsessor: no atmospheric pressure map extracted. \n");
689 // Now store the final CDB file
692 AliCDBMetaData metaData;
693 metaData.SetBeamPeriod(0);
694 metaData.SetResponsible("Panos Christakoglou");
695 metaData.SetComment("Preprocessor AliGRP data base pressure entries.");
697 Bool_t storeOK = Store("Calib", "Pressure", fPressure, &metaData, 0, 0);
698 if ( !storeOK ) result=1;
705 //_______________________________________________________________
706 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)
709 // Retrieves logbook and trigger information from the online logbook
710 // This information is needed for prompt reconstruction
714 // DAQ params: dbHost, dbPort, dbName, user, password, logbookTable, triggerTable
718 // positive on success: the return code is the run number of last run processed of the same run type already processed by the SHUTTLE
719 // 0 on success and no run was found
722 // This function is NOT called during the preprocessor run in the Shuttle!
730 AliCDBManager* cdb = AliCDBManager::Instance();
731 cdb->SetDefaultStorage(cdbRoot);
734 TSQLServer* server = TSQLServer::Connect(Form("mysql://%s:%d/%s", dbHost, dbPort, dbName), user, password);
738 Printf("ERROR: Could not connect to DAQ LB");
744 sqlQuery.Form("SELECT DAQ_time_start, run_type, detectorMask FROM logbook WHERE run = %d", run);
745 TSQLResult* result = server->Query(sqlQuery);
748 Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
752 if (result->GetRowCount() == 0)
754 Printf("ERROR: Run %d not found", run);
759 TSQLRow* row = result->Next();
762 Printf("ERROR: Could not receive data from run %d", run);
767 TString runType(row->GetField(1));
770 grpData.Add(new TObjString("DAQ_time_start"), new TObjString(row->GetField(0)));
771 grpData.Add(new TObjString("run_type"), new TObjString(runType));
772 grpData.Add(new TObjString("detectorMask"), new TObjString(row->GetField(2)));
780 Printf("Storing GRP/GRP/Data object with the following content");
783 AliCDBMetaData metadata;
784 metadata.SetResponsible("Jan Fiete Grosse-Oetringhaus");
785 metadata.SetComment("GRP Output parameters received during online running");
787 AliCDBId id("GRP/GRP/Data", run, run);
788 Bool_t success = cdb->Put(&grpData, id, &metadata);
794 Printf("ERROR: Could not store GRP/GRP/Data into OCDB");
798 // Receive trigger information
799 sqlQuery.Form("SELECT configFile FROM logbook_trigger_config WHERE run = %d", run);
800 result = server->Query(sqlQuery);
803 Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
807 if (result->GetRowCount() == 0)
809 Printf("ERROR: Run %d not found in logbook_trigger_config", run);
814 row = result->Next();
817 Printf("ERROR: Could not receive logbook_trigger_config data from run %d", run);
822 TString triggerConfig(row->GetField(0));
830 Printf("Found trigger configuration: %s", triggerConfig.Data());
832 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConfig);
835 Printf("ERROR: Could not create CTP configuration object");
839 metadata.SetComment("CTP run configuration received during online running");
841 AliCDBId id2("GRP/CTP/Config", run, run);
842 success = cdb->Put(runcfg, id2, &metadata);
849 Printf("ERROR: Could not store GRP/CTP/Config into OCDB");
853 // get last run with same run type that was already processed by the SHUTTLE
855 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());
856 result = server->Query(sqlQuery);
859 Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
863 if (result->GetRowCount() == 0)
865 Printf("ERROR: No result with query <%s>", sqlQuery.Data());
870 row = result->Next();
873 Printf("ERROR: Could not receive data for query <%s>", sqlQuery.Data());
878 TString lastRunStr(row->GetField(0));
879 Int_t lastRun = lastRunStr.Atoi();
881 Printf("Last run with same run type %s is %d", runType.Data(), lastRun);