]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDPreprocessor.cxx
Initial version of the Alice Prompt Reconstruction Online (AliPRO) program
[u/mrichter/AliRoot.git] / PMD / AliPMDPreprocessor.cxx
index bf27c92d3f41c0a6ffd85e14968868a21b8d66cb..c61717197199272c5c0a42aa60666c82569e7869 100644 (file)
@@ -1,17 +1,36 @@
+/***************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+//-----------------------------------------------------//
+//                                                     //
+//  Source File : AliPMDPreprocessor.cxx               //
+//                                                     //
+//                                                     //
+//-----------------------------------------------------//
+
 // --- ROOT system
 #include <TFile.h>
 #include <TTimeStamp.h>
+#include <TObjString.h>
+#include <TTree.h>
 
-#include "AliPMDPreprocessor.h"
-#include "AliPMDPedestal.h"
-#include "AliPMDCalibData.h"
 #include "AliLog.h"
 #include "AliShuttleInterface.h"
 #include "AliCDBMetaData.h"
-#include <TTimeStamp.h>
-#include <TObjString.h>
-#include <TTree.h>
-#include <TSystem.h>
+#include "AliPMDCalibData.h"
+#include "AliPMDPedestal.h"
+#include "AliPMDPreprocessor.h"
 
 
 ClassImp(AliPMDPreprocessor)
@@ -79,8 +98,10 @@ UInt_t AliPMDPreprocessor::Process(TMap* pdaqAliasMap)
            }
            
            Log(Form("File with id PMD_PED got from %s", source->GetName()));
-           Int_t DET,SM,ROW,COL;
-           Float_t MEAN,RMS;
+
+           Int_t det, sm, row, col;
+           Float_t mean, rms;
+
            TFile *f= new TFile(filename.Data());
            if(!f || !f->IsOpen()) 
            {
@@ -94,17 +115,18 @@ UInt_t AliPMDPreprocessor::Process(TMap* pdaqAliasMap)
                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);
+           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);
+               pedestal->SetPedMeanRms(det,sm,row,col,mean,rms);
            }
            f->Close();
            delete f;
@@ -113,7 +135,7 @@ UInt_t AliPMDPreprocessor::Process(TMap* pdaqAliasMap)
        metaData.SetBeamPeriod(0);
        metaData.SetComment("test PMD preprocessor");
        
-       result = Store("Calib","Ped", pedestal, &metaData);
+       result = Store("Calib","Ped", pedestal, &metaData,0,kTRUE);
        delete pedestal;
        if(result==0)
        {
@@ -152,8 +174,10 @@ UInt_t AliPMDPreprocessor::Process(TMap* pdaqAliasMap)
            }
            
            Log(Form("File with id PMDGAINS got from %s", source->GetName()));
-           Int_t DET,SM,ROW,COL;
-           Float_t GAIN;
+
+           Int_t det, sm, row, col;
+           Float_t gain;
+
            TFile *f1= new TFile(filename.Data());
            if(!f1 || !f1->IsOpen()) 
            {
@@ -167,20 +191,26 @@ UInt_t AliPMDPreprocessor::Process(TMap* pdaqAliasMap)
                return 1;
            }
            
-           tree->SetBranchAddress("DET",  &DET);
-           tree->SetBranchAddress("SM",   &SM);
-           tree->SetBranchAddress("ROW",  &ROW);
-           tree->SetBranchAddress("COL",  &COL);
-           tree->SetBranchAddress("GAIN", &GAIN);
+           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);
+
+               //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;
@@ -201,8 +231,24 @@ UInt_t AliPMDPreprocessor::Process(TMap* pdaqAliasMap)
            return 0;
        }
        
+  // 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;
 }
 
+