}
if (run > 0) {
- TString gdcList;
- if (grp(run) > 0) {
+ TString gdc;
+ if (grp(run,gdc) > 0) {
// "t" stores the token on this disk, otherwise the alien connection is not thread/process-safe
TGrid::Connect("alien://", 0, 0, "t");
- TObjArray *gdcs = gdcList.Tokenize(" ");
- Int_t ngdcs = tokens->GetEntriesFast();
- if (ngdcs > 0) {
+ if (!gdc.IsNull()) {
- TString dataSource = ((TObjString*)gdcs->At(0))->String();
+ TString dataSource = gdc;
dataSource.Prepend("mem://@");
- datasource.Append(":");
+ dataSource.Append(":");
// Setting CDB
AliCDBManager * man = AliCDBManager::Instance();
- man->SetDefaultStorage("raw://");
+ // man->SetDefaultStorage("raw://");
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
man->SetSpecificStorage("GRP/GRP/Data",
Form("local://%s",gSystem->pwd()));
man->SetSpecificStorage("GRP/CTP/Config",
Form("local://%s",gSystem->pwd()));
- man->Lock();
+ man->SetLock(kTRUE);
gSystem->mkdir(Form("run%d",run));
gSystem->cd(Form("run%d",run));
}
-Int_t grp(UInt_t run, TString &gdcList) {
+Int_t grp(UInt_t run, TString &gdc) {
Int_t ret=AliGRPPreprocessor::ReceivePromptRecoParameters(run, "aldaqdb", 0, "LOGBOOK", "logbook", "alice",
Form("local://%s",gSystem->pwd()),
- gdcList);
+ gdc);
if(ret>0) cout << "Last run of the same type is: " << ret << endl;
else if(ret==0) cout << "No previous run of the same type found" << endl;
else if(ret<0) cout << "Error code while retrieving GRP parameters returned: " << ret << endl;
//_______________________________________________________________
-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)
+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, TString &gdc)
{
//
// Retrieves logbook and trigger information from the online logbook
UInt_t detectorMask = (UInt_t)(detectorMaskString.Atoi());
Float_t l3Current = (Float_t)(TMath::Abs(l3CurrentString.Atof()));
Float_t dipoleCurrent = (Float_t)(TMath::Abs(dipoleCurrentString.Atof()));
+ Char_t l3Polarity = (l3CurrentString.Atof() < 0) ? 1 : 0;
+ Char_t dipolePolarity = (dipoleCurrentString.Atof() < 0) ? 1 : 0;
AliGRPObject * grpObj = new AliGRPObject();
grpObj->SetTimeStart(timeStart);
grpObj->SetDetectorMask(detectorMask);
grpObj->SetL3Current(l3Current,(AliGRPObject::Stats)0);
grpObj->SetDipoleCurrent(dipoleCurrent,(AliGRPObject::Stats)0);
+ grpObj->SetL3Polarity(l3Polarity);
+ grpObj->SetDipolePolarity(dipolePolarity);
delete row;
row = 0;
return -15;
}
+
+ // Receive list of GDCs for this run
+ sqlQuery.Form("SELECT GDC FROM logbook_stats_GDC WHERE run = %d", run);
+ result = server->Query(sqlQuery);
+ if (!result)
+ {
+ Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
+ return -24;
+ }
+
+ if (result->GetRowCount() == 0)
+ {
+ Printf("ERROR: Run %d not found in logbook_stats_GDC", run);
+ delete result;
+ return -25;
+ }
+
+ row = result->Next();
+ if (!row)
+ {
+ Printf("ERROR: Could not receive logbook_stats_GDC data from run %d", run);
+ delete result;
+ return -26;
+ }
+
+ // For the moment take the first GDC in the list
+ gdc = row->GetField(0);
+
+ delete row;
+ row = 0;
+
+ delete result;
+ result = 0;
+
+ Printf("Found GDC: %s", gdc.Data());
+
// get last run with same run type that was already processed by the SHUTTLE
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());