]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
hot cell file added to the shuttle
authorbasanta <basanta@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 9 Jun 2009 16:17:12 +0000 (16:17 +0000)
committerbasanta <basanta@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 9 Jun 2009 16:17:12 +0000 (16:17 +0000)
PMD/AliPMDPreprocessor.cxx
PMD/TestPreprocessor.C

index 2d5594097dcd9376d2a7436e24587a71d06253f4..12ea0ff231750bd8d5ff21569c98dcda7ae1e1d1 100644 (file)
@@ -29,6 +29,7 @@
 #include "AliShuttleInterface.h"
 #include "AliCDBMetaData.h"
 #include "AliPMDCalibData.h"
+#include "AliPMDHotData.h"
 #include "AliPMDPedestal.h"
 #include "AliPMDPreprocessor.h"
 
@@ -56,214 +57,284 @@ void AliPMDPreprocessor::Initialize(Int_t run, UInt_t startTime,
 {
   // Creates AliPMDDataDAQ object
 
-    AliPreprocessor::Initialize(run, startTime, endTime);
-
-    AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
-                TTimeStamp(startTime).AsString(),
-                TTimeStamp(endTime).AsString()));
+  AliPreprocessor::Initialize(run, startTime, endTime);
+  
+  AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
+              TTimeStamp(startTime).AsString(),
+              TTimeStamp(endTime).AsString()));
 
-    fRun = run;
-    fStartTime = startTime;
-    fEndTime = endTime;
+  fRun = run;
+  fStartTime = startTime;
+  fEndTime = endTime;
 
 }
 
 //-----------------------------------------
 Bool_t AliPMDPreprocessor::ProcessDAQ()
 {
-    TString RunType = GetRunType();
-    Log(Form("RunType %s",RunType.Data()));
-    if (RunType !="PHYSICS" || RunType != "PEDESTAL") {
-        return kFALSE;
-    }
+  TString RunType = GetRunType();
+  Log(Form("RunType %s",RunType.Data()));
+  if (RunType !="PHYSICS" || RunType != "PEDESTAL") {
+    return kFALSE;
+  }
 
-    return kTRUE;
+  return kTRUE;
 }
 
 
-//______________________________________________________________________________________________
+//_____________________________________________________________________
 UInt_t AliPMDPreprocessor::Process(TMap* pdaqAliasMap)
 {
+  
+  if(!pdaqAliasMap) return 1;
+  TString runType = GetRunType();
+  if(runType == "PEDESTAL"){
+    AliPMDPedestal *pedestal = new AliPMDPedestal();
     
-    if(!pdaqAliasMap) return 1;
-    TString runType = GetRunType();
-    if(runType == "PEDESTAL"){
-       AliPMDPedestal *pedestal = new AliPMDPedestal();
-       
-        TList* filesources = GetFileSources(kDAQ, "PMD_PED.root");
-       
-        if(!filesources) {
-           Log(Form("No sources found for PMD_PED.root!"));
-           return 1;
-       }
-       
-        AliInfo("Here's the list of sources for PMD_PED.root");
-        filesources->Print();
-       
-        TIter iter(filesources);
-        TObjString* source;
-        UInt_t result = 0;
-       TString filename;
-        while((source=dynamic_cast<TObjString*> (iter.Next()))){
-           filename = GetFile(kDAQ, "PMD_PED.root", source->GetName());
-           if(filename.Length() == 0) {
-               Log(Form("Error retrieving file from source %s failed!", source->GetName()));
-               delete filesources;
-               return 1;
-           }
-           
-           Log(Form("File with id PMD_PED.root got from %s", source->GetName()));
-
-           Int_t det, sm, row, col;
-           Float_t mean, rms;
-
-           TFile *f= new TFile(filename.Data());
-           if(!f || !f->IsOpen()) 
-           {
-               Log(Form("Error opening file with Id PMD_PED.root from source %s!", source->GetName()));
-               return 1;
-           } 
-           TTree *tree = dynamic_cast<TTree *> (f->Get("ped"));
-           if (!tree) 
-           {
-               Log("Could not find object \"ped\" in PED file!");
-               return 1;
-           }
-           
-           tree->SetBranchAddress("det",  &det);
-           tree->SetBranchAddress("sm",   &sm);
-           tree->SetBranchAddress("row",  &row);
-           tree->SetBranchAddress("col",  &col);
-           tree->SetBranchAddress("mean", &mean);
-           tree->SetBranchAddress("rms",  &rms);
-
-           Int_t nEntries = (Int_t) tree->GetEntries();
-           for(Int_t i = 0; i < nEntries; i++)
-           {
-               tree->GetEntry(i);
-               pedestal->SetPedMeanRms(det,sm,row,col,mean,rms);
-           }
-           f->Close();
-           delete f;
-       }
-       AliCDBMetaData metaData;
-       metaData.SetBeamPeriod(0);
-       metaData.SetComment("test PMD preprocessor");
-       
-       result = Store("Calib","Ped", pedestal, &metaData,0,kTRUE);
-       delete pedestal;
-       if(result==0)
+    TList* filesources = GetFileSources(kDAQ, "PMD_PED.root");
+    
+    if(!filesources) {
+      Log(Form("No sources found for PMD_PED.root!"));
+      return 1;
+    }
+    
+    AliInfo("Here's the list of sources for PMD_PED.root");
+    filesources->Print();
+    
+    TIter iter(filesources);
+    TObjString* source;
+    UInt_t result = 0;
+    TString filename;
+    while((source=dynamic_cast<TObjString*> (iter.Next()))){
+      filename = GetFile(kDAQ, "PMD_PED.root", source->GetName());
+      if(filename.Length() == 0) {
+       Log(Form("Error retrieving file from source %s failed!", source->GetName()));
+       delete filesources;
+       return 1;
+      }
+      
+      Log(Form("File with id PMD_PED.root got from %s", source->GetName()));
+      
+      Int_t det, sm, row, col;
+      Float_t mean, rms;
+      
+      TFile *f= new TFile(filename.Data());
+      if(!f || !f->IsOpen()) 
        {
-           Log("Error storing");                        
-           return 1;
-       }
-       else
+         Log(Form("Error opening file with Id PMD_PED.root from source %s!", source->GetName()));
+         return 1;
+       } 
+      TTree *tree = dynamic_cast<TTree *> (f->Get("ped"));
+      if (!tree) 
        {
-           return 0;
+         Log("Could not find object \"ped\" in PED file!");
+         return 1;
        }
-       
-    }else if (runType == "PHYSICS"){
-       
-       AliPMDCalibData *calibda = new AliPMDCalibData();
-       
-        TList* filesources = GetFileSources(kDAQ, "PMDGAINS.root");
-       
-        if(!filesources) {
-           Log(Form("No sources found for PMDGAINS.root!"));
-           return 1;
-       }
-       
-        AliInfo("Here's the list of sources for PMDGAINS.root");
-        filesources->Print();
-       
-        TIter iter(filesources);
-        TObjString* source;
-        UInt_t result = 0;
-       TString filename;
-        while((source=dynamic_cast<TObjString*> (iter.Next()))){
-           filename = GetFile(kDAQ, "PMDGAINS.root", source->GetName());
-           if(filename.Length() == 0) {
-               Log(Form("Error retrieving file from source %s failed!", source->GetName()));
-               delete filesources;
-               return 1;
-           }
            
-           Log(Form("File with id PMDGAINS.root got from %s", source->GetName()));
-
-           Int_t det, sm, row, col;
-           Float_t gain;
-
-           TFile *f1= new TFile(filename.Data());
-           if(!f1 || !f1->IsOpen()) 
-           {
-               Log(Form("Error opening file with Id PMDGAINS.root from source %s!", source->GetName()));
-               return 1;
-           } 
-           TTree *tree = dynamic_cast<TTree *> (f1->Get("ic"));
-           if (!tree) 
-           {
-               Log("Could not find object \"ic\" in DAQ file!");
-               return 1;
-           }
-           
-           tree->SetBranchAddress("det",  &det);
-           tree->SetBranchAddress("sm",   &sm);
-           tree->SetBranchAddress("row",  &row);
-           tree->SetBranchAddress("col",  &col);
-           tree->SetBranchAddress("gain", &gain);
-
-
-
-           Int_t nEntries = (Int_t) tree->GetEntries();
-           for(Int_t i = 0; i < nEntries; i++)
-           {
-               tree->GetEntry(i);
-
-               //if(DET>1 || SM>23 || ROW>95 || COL>95) {
-               //  printf("Error! gain[%d,%d,%d,%d] = %f\n",
-               //   DET,SM,ROW,COL,GAIN);
-               //  continue;
-               //}
-
-               calibda->SetGainFact(det,sm,row,col,gain);
-           }
-           f1->Close();
-           delete f1;
+      tree->SetBranchAddress("det",  &det);
+      tree->SetBranchAddress("sm",   &sm);
+      tree->SetBranchAddress("row",  &row);
+      tree->SetBranchAddress("col",  &col);
+      tree->SetBranchAddress("mean", &mean);
+      tree->SetBranchAddress("rms",  &rms);
+      
+      Int_t nEntries = (Int_t) tree->GetEntries();
+      for(Int_t i = 0; i < nEntries; i++)
+       {
+         tree->GetEntry(i);
+         pedestal->SetPedMeanRms(det,sm,row,col,mean,rms);
        }
+      f->Close();
+      delete f;
+    }
+    AliCDBMetaData metaData;
+    metaData.SetBeamPeriod(0);
+    metaData.SetComment("test PMD preprocessor");
+    
+    result = Store("Calib","Ped", pedestal, &metaData,0,kTRUE);
+    delete pedestal;
+    if(result==0)
+      {
+       Log("Error storing");                        
+       return 1;
+      }
+    else
+      {
+       return 0;
+      }
+    
+  }else if (runType == "PHYSICS"){
+    
+    AliPMDCalibData *calibda = new AliPMDCalibData();
+    
+    TList* filesources = GetFileSources(kDAQ, "PMDGAINS.root");
+    
+    if(!filesources) {
+      Log(Form("No sources found for PMDGAINS.root!"));
+      return 1;
+    }
+    
+    AliInfo("Here's the list of sources for PMDGAINS.root");
+    filesources->Print();
+    
+    TIter iter(filesources);
+    TObjString* source;
+    UInt_t result = 0;
+    TString filename;
+    while((source=dynamic_cast<TObjString*> (iter.Next()))){
+      filename = GetFile(kDAQ, "PMDGAINS.root", source->GetName());
+      if(filename.Length() == 0) {
+       Log(Form("Error retrieving file from source %s failed!", source->GetName()));
+       delete filesources;
+       return 1;
+      }
+      
+      Log(Form("File with id PMDGAINS.root got from %s", source->GetName()));
+      
+      Int_t det, sm, row, col;
+      Float_t gain;
 
-       AliCDBMetaData metaData;
-       metaData.SetBeamPeriod(0);
-       metaData.SetComment("test PMD preprocessor");
-       result = Store("Calib","Gain", calibda, &metaData);
-       delete calibda;
-       if(result==0)
+      TFile *f1= new TFile(filename.Data());
+      if(!f1 || !f1->IsOpen()) 
+       {
+         Log(Form("Error opening file with Id PMDGAINS.root from source %s!", source->GetName()));
+         return 1;
+       } 
+      TTree *tree = dynamic_cast<TTree *> (f1->Get("ic"));
+      if (!tree) 
        {
-           Log("Error storing");                        
-           return 1;
+         Log("Could not find object \"ic\" in DAQ file!");
+         return 1;
        }
-       else
+      
+      tree->SetBranchAddress("det",  &det);
+      tree->SetBranchAddress("sm",   &sm);
+      tree->SetBranchAddress("row",  &row);
+      tree->SetBranchAddress("col",  &col);
+      tree->SetBranchAddress("gain", &gain);
+      
+
+      
+      Int_t nEntries = (Int_t) tree->GetEntries();
+      for(Int_t i = 0; i < nEntries; i++)
        {
-           return 0;
+         tree->GetEntry(i);
+         
+         //if(DET>1 || SM>23 || ROW>95 || COL>95) {
+         //  printf("Error! gain[%d,%d,%d,%d] = %f\n",
+         //   DET,SM,ROW,COL,GAIN);
+         //  continue;
+         //}
+         
+         calibda->SetGainFact(det,sm,row,col,gain);
        }
+      f1->Close();
+      delete f1;
+    }
+    AliCDBMetaData metaData;
+    metaData.SetBeamPeriod(0);
+    metaData.SetComment("test PMD preprocessor");
+    result = Store("Calib","Gain", calibda, &metaData);
+    delete calibda;
+    if(result==0)
+      {
+       Log("Error storing");                        
+       return 1;
+      }
+    //----------------------------------------------------
+    AliPMDHotData *hotda = new AliPMDHotData();
+    TList* filesource = GetFileSources(kDAQ, "PMD_HOT.root");
        
-  // Store DCS data for reference
-  AliCDBMetaData metadata;
-  metadata.SetComment("DCS data for PMD");
-  Bool_t resStore = kFALSE;
-  resStore = StoreReferenceData("DCS","Data",pdaqAliasMap,&metadata);
-       if(resStore==0)
+    if(!filesource) {
+      Log(Form("No sources found for PMD_HOT.root!"));
+      return 1;
+    }
+    
+    AliInfo("Here's the list of sources for PMD_HOT.root");
+    filesource->Print();
+    
+    TIter iter2(filesource);
+    TObjString* sources;
+    UInt_t hotresult = 0;
+    TString filenames;
+    while((sources=dynamic_cast<TObjString*> (iter2.Next()))){
+      filenames = GetFile(kDAQ, "PMD_HOT.root", sources->GetName());
+      if(filenames.Length() == 0) {
+       Log(Form("Error retrieving file from source %s failed!", sources->GetName()));
+       delete filesource;
+       return 1;
+      }
+      
+      Log(Form("File with id PMD_HOT.root got from %s", sources->GetName()));
+      
+      Int_t det, sm, row, col;
+      Float_t flag;
+      
+      TFile *f2= new TFile(filenames.Data());
+      if(!f2 || !f2->IsOpen()) 
        {
-           Log("Error storing");                        
-           return 1;
+         Log(Form("Error opening file with Id PMD_HOT.root from source %s!", sources->GetName()));
+         return 1;
+       } 
+      TTree *tree1 = dynamic_cast<TTree *> (f2->Get("hot"));
+      if (!tree1) 
+       {
+         Log("Could not find object \"hot\" in DAQ file!");
+         return 1;
        }
-       else
+      
+      tree1->SetBranchAddress("det",  &det);
+      tree1->SetBranchAddress("sm",   &sm);
+      tree1->SetBranchAddress("row",  &row);
+      tree1->SetBranchAddress("col",  &col);
+      tree1->SetBranchAddress("flag", &flag);
+      
+      
+      
+      Int_t nEntries = (Int_t) tree1->GetEntries();
+      for(Int_t j = 0; j < nEntries; j++)
        {
-           return 0;
+         tree1->GetEntry(j);
+         
+         //if(det>1 || sm>23 || row>95 || col>95) {
+         // printf("Error! gain[%d,%d,%d,%d] = %f\n",
+         // det,sm,row,col,flag);
+         //continue;
+         //}
+         
+         hotda->SetHotChannel(det,sm,row,col,flag);
        }
-
+      f2->Close();
+      delete f2;
     }
+    hotresult = Store("Calib","Hot", hotda, &metaData);
+    delete hotda;
+    if(hotresult==0)
+      {
+       Log("Error storing");                        
+       return 1;
+      }
+    //-------------------------------------------------------------------  
+
+       
+    // Store DCS data for reference
+    AliCDBMetaData metadata;
+    metadata.SetComment("DCS data for PMD");
+    Bool_t resStore = kFALSE;
+    resStore = StoreReferenceData("DCS","Data",pdaqAliasMap,&metadata);
+    if(resStore==0)
+      {
+       Log("Error storing");                        
+       return 1;
+      }
+    else
+      {
+       return 0;
+      }
+    
+  }
     
-    return 2;
+  return 2;
 }
 
 
index e9f30e3743c5859584b6419896dec1d32f24f167..9cc4531221c0460e670827abf405b0be4718a82b 100644 (file)
@@ -16,10 +16,10 @@ void TestPreprocessor()
 
     // create AliTestShuttle instance
     // The parameters are run, startTime, endTime
-    AliTestShuttle* shuttle = new AliTestShuttle(7, 0, 1);
+    AliTestShuttle* shuttle = new AliTestShuttle(0, 0, 1);
 
 
-    printf("Test Shuttle temp dir: %s\n", AliShuttleInterface::GetShuttleTempDir());
+//    printf("Test Shuttle temp dir: %s\n", AliShuttleInterface::GetShuttleTempDir());
 
     // TODO if needed, change location of OCDB and Reference test folders
     // by default they are set to $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB
@@ -74,6 +74,7 @@ void TestPreprocessor()
     
     shuttle->AddInputFile(AliShuttleInterface::kDAQ, "PMD", "PMD_PED.root", "GDC0", "PMD_PED.root");
     shuttle->AddInputFile(AliShuttleInterface::kDAQ, "PMD", "PMDGAINS.root", "GDC0", "xy.root");
+    shuttle->AddInputFile(AliShuttleInterface::kDAQ, "PMD", "PMD_HOT.root", "GDC0", "hot.root");
     
     // TODO(3)
     //
@@ -81,7 +82,7 @@ void TestPreprocessor()
     // To test it, we must provide the run type manually. They will be retrieved in the preprocessor
     // using GetRunType function.
 
-    shuttle->SetInputRunType("PEDESTAL_RUN");
+    shuttle->SetInputRunType("PHYSICS");
 
     // TODO(4)
     //
@@ -99,7 +100,7 @@ void TestPreprocessor()
     // using GetFromOCDB function.
     
     TObjString obj("This is a condition parameter stored in OCDB");
-    AliCDBId id("TPC/Calib/Data", 0, AliCDBRunRange::Infinity());
+    AliCDBId id("PMD/Calib/Hot", 0, AliCDBRunRange::Infinity());
     AliCDBMetaData md;
     AliCDBEntry entry(&obj, id, &md);
 
@@ -122,14 +123,14 @@ void TestPreprocessor()
     //
     // Check the file which should have been created
     AliCDBEntry* chkEntry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
-       ->Get("PMD/Calib/Ped", 7);
+       ->Get("PMD/Calib/Hot", 7);
     if (!chkEntry)
     {
        printf("The file is not there. Something went wrong.\n");
        return;
     }
     
-    AliPMDPedestal* output = dynamic_cast<AliPMDPedestal*> (chkEntry->GetObject());
+    AliPMDHotData* output = dynamic_cast<AliPMDHotData*> (chkEntry->GetObject());
     // If everything went fine, draw the result
     if (output)
        output->Print();