]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ACORDE/AliACORDEPreprocessor.cxx
Updating responsibles for nightly tests (adding Hans Beck).
[u/mrichter/AliRoot.git] / ACORDE / AliACORDEPreprocessor.cxx
index f3325f75dba2a64121f25aa4ba6dfe934ea7e7b5..d37289e0045545dd5a3ece0ff6836aa56361eeda 100644 (file)
 #include "AliCDBMetaData.h"
 #include "AliCDBEntry.h"
 #include "AliLog.h"
-#include "AliACORDECalibModule.h"
-#include "AliACORDEDataModule.h"
+#include "AliACORDECalibData.h"
+#include "AliACORDEDataDCS.h"
 
 #include <TTimeStamp.h>
 #include <TObjString.h>
 #include <TList.h>
+#include <TH1F.h>
 
-//
-// This is the first version of ACORDE Preprocessor
+//ACORDE Preprocessor
 // It takes data from DAQ and passes it to the class AliACORDECalibModule and 
 // stores reference data.
 //
@@ -43,9 +43,14 @@ ClassImp(AliACORDEPreprocessor)
 //______________________________________________________________________________________________
 AliACORDEPreprocessor::AliACORDEPreprocessor(AliShuttleInterface* shuttle) :
   AliPreprocessor("ACO", shuttle),
-  fCalData(0)
+  fCalData(0),
+  fDataDCS(0)
 {
   // constructor
+  AddRunType("STANDALONE_BC");
+  AddRunType("STANDALONE_PULSER");
+  AddRunType("PHYSICS");
+
 }
 
 //______________________________________________________________________________________________
@@ -66,46 +71,64 @@ void AliACORDEPreprocessor::Initialize(Int_t run, UInt_t startTime,
                TTimeStamp(startTime).AsString(),
                TTimeStamp(endTime).AsString()));
 
-        fCalData = new AliACORDECalibModule();
+        fCalData = new AliACORDECalibData();
+        fDataDCS = new AliACORDEDataDCS();
 }
 
 //______________________________________________________________________________________________
-UInt_t AliACORDEPreprocessor::Process(TMap* /*dcsAliasMap*/)
+UInt_t AliACORDEPreprocessor::Process(TMap* dcsAliasMap)
 {
   
-
  
-   TH1D *histoRate; //Histogram of the rates per module
+//   TH1D *fH1,*fH2,*fH3,*fH4; //Histogram of the rates per module
+   
+   TH1D *fH[4];
    TFile *daqFile=0x0;
 
 
+
    // retrieve the run type from the Shuttle,
 
-   TString runType = GetRunType();
-    
-   if(runType !="SPD_STANDALONE_CALIBRATION")
+   if(!dcsAliasMap)
    {
+   
+   Log(Form("Error there isn't dcsAliasMap"));
+   return  1;
+   
+   }
 
-   Log("RunType is not SPD_STANDALONE_CALIBRATION, nothing to do");
-   return 1;
 
-   }
+   fDataDCS->ProcessData(*dcsAliasMap);
+
+
+
+   AliCDBMetaData metaData1;
+   metaData1.SetBeamPeriod(0);
+   metaData1.SetResponsible("Pedro and Irais");
+   metaData1.SetComment("This preprocessor fills an AliACORDECalibModule object.");
+
+   Bool_t result1 = StoreReferenceData("Calib", "DataDCS",fDataDCS, &metaData1);
+
+   if(!result1)
+   return 2;
+   TString runType = GetRunType();
 
 
    Log(Form("Run type for run %d: %s", fRun, runType.Data()));
+   TString SourcesId = "CALIB";
+
 
   
 
    //retrieve the list of sources that produced the file with id RATES
  
-   TList* sourceList = GetFileSources(kDAQ, "RATES");
+    TList* sourceList = GetFileSources(kDAQ,SourcesId.Data());
 
    if (!sourceList)
    {
-       Log("Error: No sources found for id RATES!");
-       return 2;
+       Log(Form("Error: No sources found for id %s", SourcesId.Data()));
+       return 3;
    }
   
    // TODO We have the list of sources that produced the files with Id RATES 
@@ -113,7 +136,7 @@ UInt_t AliACORDEPreprocessor::Process(TMap* /*dcsAliasMap*/)
 
 
 
-   Log("The following sources produced files with the id RATES");
+   Log(Form("The following sources produced files with the id %s",SourcesId.Data()));
    sourceList->Print();
      
    TIter iter(sourceList);
@@ -124,47 +147,47 @@ UInt_t AliACORDEPreprocessor::Process(TMap* /*dcsAliasMap*/)
    while((source=dynamic_cast<TObjString*> (iter.Next())))
    {
        
-        TString fileName = GetFile(kDAQ, "RATES", source->GetName());
+        TString fileName = GetFile(kDAQ,SourcesId.Data(), source->GetName());
 
        if (fileName.Length() > 0)
                Log(Form("Got the file %s, now we can extract some values.", fileName.Data()));
 
-              daqFile = new TFile(fileName.Data(),"READ");
-              histoRate =(TH1D *) daqFile->Get("Rates"); //Get Histogram with Rates per module
-             
-
-              if(!histoRate)
+                daqFile = new TFile(fileName.Data(),"READ");
+              
+              if(!daqFile)
               {
                             
-              Log(Form("There are not histos"));
-             return 3;
+              Log(Form("There are not histos     1"));
+             return 4;
 
               }
-               
-              
-    
-              //Set Status Module   
-              //Fills data in  to AliACORDECalibModule object        
+
            
-              for(int module=0;module<kNModules;module++)
-              {
                 
-                         Float_t value = histoRate->At(module);
-                         TString name = "aco_hv_module";
-                         
-                         name+=module;
-                         
-                         //if(value>=0&&value<=2.5)
-                         fCalData->SetModule(module,value,1,name); //1 module
-                        // else
-                        // fCalData->SetModule(module,value,0,name); //0 module 
+            fH[0] = (TH1D*)daqFile->Get("fHist1");
+            fH[1] = (TH1D*)daqFile->Get("fHist2");
+            fH[2] = (TH1D*)daqFile->Get("fHist3");
+            fH[3] = (TH1D*)daqFile->Get("fHist4");
+          
 
+             
+             if(fH[0]!=NULL&&fH[1]!=NULL&&fH[2]!=NULL&&fH[3]!=NULL)  
+             {  
+             fCalData->AddHHits(fH[0]);
+             fCalData->AddHTHits(fH[1]);
+             fCalData->AddHMultiHits(fH[2]);
+             fCalData->AddHTMultiHits(fH[3]);
+             }
+            
+            else
+            {
+             Log(Form("There are not histos     2"));
+             return 4;
+            }
+    
 
-              }
-                    
-            fCalData->Create_Histo(); 
-            //fCalData->Print_Module();
-}                                                                           
+   }                   
+                                                                          
  
  
   delete sourceList;
@@ -177,14 +200,16 @@ UInt_t AliACORDEPreprocessor::Process(TMap* /*dcsAliasMap*/)
        metaData.SetResponsible("Pedro and Irais");
        metaData.SetComment("This preprocessor fills an AliACORDECalibModule object.");
 
-               Bool_t result = StoreReferenceData("Calib", "Data",fCalData, &metaData);
+               Bool_t result2 = StoreReferenceData("Calib", "Data",fCalData, &metaData);
       
        delete fCalData;
+        delete fDataDCS;
+        fDataDCS = 0;
        fCalData = 0;
   
 
-  if (!result)
-  return 4;
+  if (!result2)
+  return 5;
   
   return 0;
 }