Initial version of online reco ready and tried at P2. Modifications include correctio...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 27 Aug 2009 16:44:45 +0000 (16:44 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 27 Aug 2009 16:44:45 +0000 (16:44 +0000)
MONITOR/onlineReco.C
STEER/AliGRPPreprocessor.cxx
STEER/AliGRPPreprocessor.h

index 46da216..4d6927d 100644 (file)
@@ -21,28 +21,27 @@ UInt_t onlineReco(const char* param = "listen",const char *recMacroPath = "$ALIC
   }
 
   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));
@@ -66,11 +65,11 @@ UInt_t onlineReco(const char* param = "listen",const char *recMacroPath = "$ALIC
 
 }
 
-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;
index e2e36d1..40acbf3 100644 (file)
@@ -1524,7 +1524,7 @@ AliDCSSensorArray *AliGRPPreprocessor::GetPressureMap(TMap* dcsAliasMap)
 
   
 //_______________________________________________________________
-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
@@ -1594,6 +1594,8 @@ Int_t AliGRPPreprocessor::ReceivePromptRecoParameters(UInt_t run, const char* db
        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); 
@@ -1601,6 +1603,8 @@ Int_t AliGRPPreprocessor::ReceivePromptRecoParameters(UInt_t run, const char* db
        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;
@@ -1681,6 +1685,42 @@ Int_t AliGRPPreprocessor::ReceivePromptRecoParameters(UInt_t run, const char* db
                        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());
index 6ada26a..f133e82 100644 (file)
@@ -68,7 +68,8 @@ class AliGRPPreprocessor: public AliPreprocessor {
                                   const char* dbName,
                                   const char* user,
                                   const char* password,
-                                  const char *cdbRoot
+                                  const char *cdbRoot,
+                                 TString &gdc
                                  );
 
  protected: