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 = 10; // 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 "SurfaceAtmosPressure"
77 const Short_t kSensors = 9; // start index position of sensor in DCS DPs
78 const Short_t kNumSensors = 1; // Number of sensors 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.");
127 TClonesArray * array = new TClonesArray("AliDCSSensor",kNumSensors);
128 for(Int_t j = 0; j < kNumSensors; 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!"));
185 //=======================//
186 // Trigger Configuration //
187 //=======================//
188 // either from DAQ logbook.....
189 const char * triggerConf = GetTriggerConfiguration();
190 if (triggerConf!= NULL) {
191 Log("Found trigger configuration in DAQ logbook");
192 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConf);
194 Log("Bad CTP run configuration file from DAQ logbook! The corresponding CDB entry will not be filled!");
198 TString titleCTPcfg = Form("CTP cfg for run %i from DAQ",fRun);
199 runcfg->SetTitle(titleCTPcfg);
200 AliCDBMetaData metaData;
201 metaData.SetBeamPeriod(0);
202 metaData.SetResponsible("Roman Lietava");
203 metaData.SetComment("CTP run configuration from DAQ logbook");
204 if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
205 Log("Unable to store the CTP run configuration object to OCDB!");
210 // ...or from DCS FXS
212 Log("No trigger configuration found in the DAQ logbook!! Trying reading from DCS FXS...");
213 TString runcfgfile = GetFile(kDCS, "CTP_runconfig", "");
214 if (runcfgfile.IsNull()) {
215 Log("No CTP runconfig files has been found in DCS FXS!");
219 Log(Form("File with Id CTP_runconfig found! Copied to %s",runcfgfile.Data()));
220 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
222 Log("Bad CTP run configuration file from DCS FXS! The corresponding CDB entry will not be filled!");
226 TString titleCTPcfg = Form("CTP cfg for run %i from DCS",fRun);
227 runcfg->SetTitle(titleCTPcfg);
228 AliCDBMetaData metaData;
229 metaData.SetBeamPeriod(0);
230 metaData.SetResponsible("Roman Lietava");
231 metaData.SetComment("CTP run configuration from DCS FXS");
232 if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
233 Log("Unable to store the CTP run configuration object to OCDB!");
241 AliInfo(Form("Final list entries: %d",grpmap->GetEntries()));
244 md.SetResponsible("Ernesto Lopez Torres");
245 md.SetComment("Output parameters from the GRP preprocessor.");
247 Bool_t result = Store("GRP", "Data", grpmap, &md);
251 if (result && !error ) {
252 Log("GRP Preprocessor Success");
255 Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s%s",
256 kppError[(error&1)?1:0],
257 kppError[(error&2)?2:0],
258 kppError[(error&4)?3:0],
259 kppError[(error&8)?4:0],
260 kppError[(error&16)?5:0]
266 //_______________________________________________________________
267 TMap *AliGRPPreprocessor::ProcessDaqLB()
269 //Getting the DAQ lb information
271 const char* timeStart = GetRunParameter("DAQ_time_start");
272 const char* timeEnd = GetRunParameter("DAQ_time_end");
273 const char* beamEnergy = GetRunParameter("beamEnergy");
274 const char* beamType = GetRunParameter("beamType");
275 const char* numberOfDetectors = GetRunParameter("numberOfDetectors");
276 const char* detectorMask = GetRunParameter("detectorMask");
277 const char* lhcPeriod = GetRunParameter("LHCperiod");
279 TMap *mapDAQ = new TMap();
282 Log(Form("Start time for run %d: %s",fRun, timeStart));
284 Log(Form("Start time not put in logbook!"));
286 mapDAQ->Add(new TObjString("fAliceStartTime"), new TObjString(timeStart));
289 Log(Form("End time for run %d: %s",fRun, timeEnd));
291 Log(Form("End time not put in logbook!"));
293 mapDAQ->Add(new TObjString("fAliceStopTime"), new TObjString(timeEnd));
296 Log(Form("Beam energy for run %d: %s",fRun, beamEnergy));
298 Log(Form("Beam energy not put in logbook!"));
300 mapDAQ->Add(new TObjString("fAliceBeamEnergy"), new TObjString(beamEnergy));
303 Log(Form("Beam type for run %d: %s",fRun, beamType));
305 Log(Form("Beam type not put in logbook!"));
307 mapDAQ->Add(new TObjString("fAliceBeamType"), new TObjString(beamType));
309 if (numberOfDetectors) {
310 Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors));
312 Log(Form("Number of active detectors not put in logbook!"));
314 mapDAQ->Add(new TObjString("fNumberOfDetectors"), new TObjString(numberOfDetectors));
317 Log(Form("Detector mask for run %d: %s",fRun, detectorMask));
319 Log(Form("Detector mask not put in logbook!"));
321 mapDAQ->Add(new TObjString("fDetectorMask"), new TObjString(detectorMask));
324 Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod));
326 Log(Form("LHCperiod not put in logbook!"));
328 mapDAQ->Add(new TObjString("fLHCPeriod"), new TObjString(lhcPeriod));
330 mapDAQ->Add(new TObjString("fRunType"), new TObjString(GetRunType()));
331 Log( Form("Retrived %d parameters from logbook", mapDAQ->GetEntries() ) );
336 //_______________________________________________________________
337 UInt_t AliGRPPreprocessor::ProcessDaqFxs()
339 //======DAQ FXS======//
341 TList* list = GetFileSources(kDAQ);
343 Log("No raw data tag list: connection problems with DAQ FXS logbook!");
347 if (list->GetEntries() == 0) {
348 Log("no raw data tags in this run: nothing to merge!");
353 TChain *fRawTagChain = new TChain("T");
355 TIterator* iter = list->MakeIterator();
357 while ((obj = iter->Next())) {
358 TObjString* objStr = dynamic_cast<TObjString*> (obj);
360 Log(Form("Found source %s", objStr->String().Data()));
361 TList* list2 = GetFileIDs(kDAQ, objStr->String());
363 Log("No list with ids from DAQ was found: connection problems with DAQ FXS logbook!");
364 delete fRawTagChain; fRawTagChain=0;
367 Log(Form("Number of ids: %d",list2->GetEntries()));
368 for(Int_t i = 0; i < list2->GetEntries(); i++) {
369 TObjString *idStr = (TObjString *)list2->At(i);
370 TString fileName = GetFile(kDAQ,idStr->String().Data(),objStr->String().Data());
371 if (fileName.Length() > 0) {
372 Log(Form("Adding file in the chain: %s",fileName.Data()));
373 fRawTagChain->Add(fileName.Data());
376 Log(Form("Could not retrieve file with id %s from source %s: "
377 "connection problems with DAQ FXS!",
378 idStr->String().Data(), objStr->String().Data()));
380 delete list2; list2=0;
381 delete fRawTagChain; fRawTagChain=0;
389 TString fRawDataFileName = "GRP_Merged.tag.root";
390 Log(Form("Merging %d raw data tags into file: %s", nFiles, fRawDataFileName.Data()));
391 if( fRawTagChain->Merge(fRawDataFileName) < 1 ) {
392 Log("Error merging raw data files!!!");
396 TString outputfile = Form("Run%d.Merged.RAW.tag.root", fRun);
397 Bool_t result = StoreRunMetadataFile(fRawDataFileName.Data(),outputfile.Data());
400 Log("Problem storing raw data tags in local file!!!");
402 Log("Raw data tags merged successfully!!");
407 delete fRawTagChain; fRawTagChain=0;
409 if (result == kFALSE) {
417 //_______________________________________________________________
418 UInt_t AliGRPPreprocessor::ProcessDcsFxs()
420 //======DCS FXS======//
421 // Get the CTP run configuration
422 // and scalers from DCS FXS
427 // Get the CTP run configuration
428 TList* list = GetFileSources(kDCS,"CTP_runconfig");
430 Log("No CTP runconfig file: connection problems with DCS FXS logbook!");
434 if (list->GetEntries() == 0) {
435 Log("No CTP runconfig file to be processed!");
441 while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
442 TString runcfgfile = GetFile(kDCS, "CTP_runconfig", source->GetName());
443 if (runcfgfile.IsNull()) {
444 Log("No CTP runconfig files has been found: empty source!");
447 Log(Form("File with Id CTP_runconfig found in source %s! Copied to %s",source->GetName(),runcfgfile.Data()));
448 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
450 Log("Bad CTP run configuration file! The corresponding CDB entry will not be filled!");
454 AliCDBMetaData metaData;
455 metaData.SetBeamPeriod(0);
456 metaData.SetResponsible("Roman Lietava");
457 metaData.SetComment("CTP run configuration");
458 if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
459 Log("Unable to store the CTP run configuration object to OCDB!");
469 // Get the CTP counters information
470 TList* list = GetFileSources(kDCS,"CTP_xcounters");
472 Log("No CTP counters file: connection problems with DAQ FXS logbook!");
476 if (list->GetEntries() == 0) {
477 Log("No CTP counters file to be processed!");
483 while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
484 TString countersfile = GetFile(kDCS, "CTP_xcounters", source->GetName());
485 if (countersfile.IsNull()) {
486 Log("No CTP counters files has been found: empty source!");
489 Log(Form("File with Id CTP_xcounters found in source %s! Copied to %s",source->GetName(),countersfile.Data()));
490 AliTriggerRunScalers *scalers = AliTriggerRunScalers::ReadScalers(countersfile);
492 Log("Bad CTP counters file! The corresponding CDB entry will not be filled!");
496 AliCDBMetaData metaData;
497 metaData.SetBeamPeriod(0);
498 metaData.SetResponsible("Roman Lietava");
499 metaData.SetComment("CTP scalers");
500 if (!Store("CTP","Scalers", scalers, &metaData, 0, 0)) {
501 Log("Unable to store the CTP scalers object to OCDB!");
513 //_______________________________________________________________
514 Int_t AliGRPPreprocessor::ProcessDcsDPs(TMap* valueMap, TMap* mapDCS)
516 //Getting the DCS dps
524 AliInfo(Form("==========LHCState==========="));
525 TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[0]);
527 Log(Form("LHCState not found!!!"));
529 AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState,fStartTime,fEndTime);
530 TString sLHCState = dcs1->ProcessDCS(2);
532 for( Int_t i=0; i<20; i+=2 ) {
533 if( sLHCState.CompareTo(fgkLHCState[i]) == 0 ) {
534 sLHCState = fgkLHCState[i+1];
538 Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data()));
540 Log("LHCState not put in TMap!");
542 mapDCS->Add(new TObjString("fLHCState"),new TObjString(sLHCState));
546 AliInfo(Form("==========L3Polarity==========="));
547 TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[1]);
548 if(!aliasL3Polarity) {
549 Log(Form("L3Polarity not found!!!"));
551 AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity,fStartTime,fEndTime);
552 TString sL3Polarity = dcs6->ProcessDCS(1);
554 Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data()));
556 Log("L3Polarity not put in TMap!");
558 mapDCS->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity));
562 AliInfo(Form("==========DipolePolarity==========="));
563 TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[2]);
564 if(!aliasDipolePolarity) {
565 Log(Form("DipolePolarity not found!!!"));
567 AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity,fStartTime,fEndTime);
568 TString sDipolePolarity = dcs8->ProcessDCS(1);
569 if (sDipolePolarity) {
570 Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data()));
572 Log("DipolePolarity not put in TMap!");
574 mapDCS->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity));
578 AliInfo(Form("==========LHCLuminosity==========="));
579 TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[3]);
580 if(!aliasLHCLuminosity) {
581 Log(Form("LHCLuminosity not found!!!"));
583 AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity,fStartTime,fEndTime);
584 TString sMeanLHCLuminosity = dcs3->ProcessDCS(5);
585 if (sMeanLHCLuminosity) {
586 Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data()));
588 Log("LHCLuminosity not put in TMap!");
590 mapDCS->Add(new TObjString("fLHCLuminosity"), new TObjString(sMeanLHCLuminosity));
594 AliInfo(Form("==========BeamIntensity==========="));
595 TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[4]);
596 if(!aliasBeamIntensity) {
597 Log(Form("BeamIntensity not found!!!"));
599 AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity,fStartTime,fEndTime);
600 TString sMeanBeamIntensity = dcs4->ProcessDCS(5);
601 if (sMeanBeamIntensity) {
602 Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data()));
604 Log("BeamIntensity not put in TMap!");
606 mapDCS->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity));
610 AliInfo(Form("==========L3Current==========="));
611 TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[5]);
612 if(!aliasL3Current) {
613 Log(Form("L3Current not found!!!"));
615 AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current,fStartTime,fEndTime);
616 TString sMeanL3Current = dcs5->ProcessDCS(5);
617 if (sMeanL3Current) {
618 Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data()));
620 Log("L3Current not put in TMap!");
622 mapDCS->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current));
627 AliInfo(Form("==========DipoleCurrent==========="));
628 TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[6]);
629 if(!aliasDipoleCurrent) {
630 Log(Form("DipoleCurrent not found!!!"));
632 AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent,fStartTime,fEndTime);
633 TString sMeanDipoleCurrent = dcs7->ProcessDCS(5);
634 if (sMeanDipoleCurrent) {
635 Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data()));
637 Log("DipoleCurrent not put in TMap!");
639 mapDCS->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent));
643 AliInfo(Form("==========CavernTemperature==========="));
644 TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[7]);
645 if(!aliasCavernTemperature) {
646 Log(Form("CavernTemperature not found!!!"));
648 AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature,fStartTime,fEndTime);
649 TString sMeanCavernTemperature = dcs9->ProcessDCS(5);
650 if (sMeanCavernTemperature) {
651 Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data()));
653 Log("CavernTemperature not put in TMap!");
655 mapDCS->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature));
659 AliInfo(Form("==========CavernPressure==========="));
660 TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[8]);
661 if(!aliasCavernPressure) {
662 Log("CavernPressure not found!!!");
664 AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure,fStartTime,fEndTime);
665 TString sMeanCavernPressure = dcs10->ProcessDCS(5);
666 if (sMeanCavernPressure) {
667 Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data()));
669 Log("CavernPressure not put in TMap!");
671 mapDCS->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure));
676 // NEEDS TO BE REVISED, CONFIRMED
677 AliInfo(Form("==========P2PressureMap==========="));
678 AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap);
679 if( fPressure->NumFits()==0 ) {
680 Log("Problem with the pressure sensor values!!!");
683 AliDCSSensor* sensorP2 = dcsSensorArray->GetSensor(fgkDCSDataPoints[9]);
684 if( sensorP2->GetFit() ) {
685 Log(Form("<P2Pressure> for run %d: Sensor Fit found",fRun));
686 mapDCS->Add( new TObjString("fP2Pressure"), sensorP2 );
690 Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[9] ));
694 AliDCSSensor* sensorMeyrin = dcsSensorArray->GetSensor(fgkDCSDataPoints[10]);
695 if( sensorMeyrin->GetFit() ) {
696 Log(Form("<MeyrinPressure> for run %d: Sensor Fit found",fRun));
697 mapDCS->Add( new TObjString("fMeyrinPressure"), sensorMeyrin );
700 Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[10] ));
708 //_______________________________________________________________
709 AliDCSSensorArray *AliGRPPreprocessor::GetPressureMap(TMap* dcsAliasMap)
711 // extract DCS pressure maps. Perform fits to save space
713 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
715 fPressure->MakeSplineFit(map);
716 Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors();
717 if (fitFraction > kFitFraction ) {
718 AliInfo(Form("Pressure values extracted, %d fits performed.", fPressure->NumFits()));
720 AliInfo("Too few pressure maps fitted!!!");
723 AliInfo("no atmospheric pressure map extracted!!!");
730 //_______________________________________________________________
731 /*UInt_t AliGRPPreprocessor::MapPressure(TMap* dcsAliasMap) {
732 // extract DCS pressure maps. Perform fits to save space
735 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
737 fPressure->MakeSplineFit(map);
738 Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors();
739 if (fitFraction > kFitFraction ) {
740 AliInfo(Form("Pressure values extracted, fits performed.\n"));
742 Log ("Too few pressure maps fitted. \n");
746 Log("AliTPCPreprocsessor: no atmospheric pressure map extracted. \n");
750 // Now store the final CDB file
753 AliCDBMetaData metaData;
754 metaData.SetBeamPeriod(0);
755 metaData.SetResponsible("Panos Christakoglou");
756 metaData.SetComment("Preprocessor AliGRP data base pressure entries.");
758 Bool_t storeOK = Store("Calib", "Pressure", fPressure, &metaData, 0, 0);
759 if ( !storeOK ) result=1;
766 //_______________________________________________________________
767 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)
770 // Retrieves logbook and trigger information from the online logbook
771 // This information is needed for prompt reconstruction
775 // DAQ params: dbHost, dbPort, dbName, user, password, logbookTable, triggerTable
779 // positive on success: the return code is the run number of last run processed of the same run type already processed by the SHUTTLE
780 // 0 on success and no run was found
783 // This function is NOT called during the preprocessor run in the Shuttle!
791 AliCDBManager* cdb = AliCDBManager::Instance();
792 cdb->SetDefaultStorage(cdbRoot);
795 TSQLServer* server = TSQLServer::Connect(Form("mysql://%s:%d/%s", dbHost, dbPort, dbName), user, password);
799 Printf("ERROR: Could not connect to DAQ LB");
805 sqlQuery.Form("SELECT DAQ_time_start, run_type, detectorMask FROM logbook WHERE run = %d", run);
806 TSQLResult* result = server->Query(sqlQuery);
809 Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
813 if (result->GetRowCount() == 0)
815 Printf("ERROR: Run %d not found", run);
820 TSQLRow* row = result->Next();
823 Printf("ERROR: Could not receive data from run %d", run);
828 TString runType(row->GetField(1));
831 grpData.Add(new TObjString("DAQ_time_start"), new TObjString(row->GetField(0)));
832 grpData.Add(new TObjString("run_type"), new TObjString(runType));
833 grpData.Add(new TObjString("detectorMask"), new TObjString(row->GetField(2)));
841 Printf("Storing GRP/GRP/Data object with the following content");
844 AliCDBMetaData metadata;
845 metadata.SetResponsible("Jan Fiete Grosse-Oetringhaus");
846 metadata.SetComment("GRP Output parameters received during online running");
848 AliCDBId id("GRP/GRP/Data", run, run);
849 Bool_t success = cdb->Put(&grpData, id, &metadata);
855 Printf("ERROR: Could not store GRP/GRP/Data into OCDB");
859 // Receive trigger information
860 sqlQuery.Form("SELECT configFile FROM logbook_trigger_config WHERE run = %d", run);
861 result = server->Query(sqlQuery);
864 Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
868 if (result->GetRowCount() == 0)
870 Printf("ERROR: Run %d not found in logbook_trigger_config", run);
875 row = result->Next();
878 Printf("ERROR: Could not receive logbook_trigger_config data from run %d", run);
883 TString triggerConfig(row->GetField(0));
891 Printf("Found trigger configuration: %s", triggerConfig.Data());
893 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConfig);
896 Printf("ERROR: Could not create CTP configuration object");
900 metadata.SetComment("CTP run configuration received during online running");
902 AliCDBId id2("GRP/CTP/Config", run, run);
903 success = cdb->Put(runcfg, id2, &metadata);
910 Printf("ERROR: Could not store GRP/CTP/Config into OCDB");
914 // get last run with same run type that was already processed by the SHUTTLE
916 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());
917 result = server->Query(sqlQuery);
920 Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
924 if (result->GetRowCount() == 0)
926 Printf("ERROR: No result with query <%s>", sqlQuery.Data());
931 row = result->Next();
934 Printf("ERROR: Could not receive data for query <%s>", sqlQuery.Data());
939 TString lastRunStr(row->GetField(0));
940 Int_t lastRun = lastRunStr.Atoi();
942 Printf("Last run with same run type %s is %d", runType.Data(), lastRun);