New version of the PMD DA avoiding the creation of huge amount of histograms. Now...
[u/mrichter/AliRoot.git] / PMD / PMDda.cxx
index 1ecfe9dd96cb25778b69e8a262dd86d148e0b7c5..f1c488c1dc036bccf86dea777d2a8075dd9c0f4b 100644 (file)
@@ -29,11 +29,16 @@ extern "C" {
 //AliRoot
 #include "AliRawReaderDate.h"
 #include "AliPMDCalibPedestal.h"
+#include "AliPMDCalibGain.h"
 
 //ROOT
 #include "TFile.h"
 #include "TH1F.h"
 #include "TBenchmark.h"
+#include "TTree.h"
+#include "TROOT.h"
+#include "TPluginManager.h"
+
 
 
 /* Main routine
@@ -42,7 +47,19 @@ extern "C" {
 */
 int main(int argc, char **argv) {
   
-  AliPMDCalibPedestal calibped;
+    /* magic line from Rene */
+    gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
+                                         "*",
+                                         "TStreamerInfo",
+                                         "RIO",
+                                         "TStreamerInfo()");
+
+    
+    AliPMDCalibPedestal calibped;
+    AliPMDCalibGain calibgain;
+
+  TTree *ped  = new TTree("ped","PMD Pedestal tree");
+  TTree *gain = new TTree("gain","PMD Gain tree");
 
   TH1F::AddDirectory(0);
   
@@ -135,7 +152,9 @@ int main(int argc, char **argv) {
       printf(" event number = %i \n",iev);
       AliRawReader *rawReader = new AliRawReaderDate((void*)event);
       calibped.ProcessEvent(rawReader);
-      
+
+      calibgain.ProcessEvent(rawReader);
+
       delete rawReader;
       rawReader = 0x0;
 
@@ -147,9 +166,8 @@ int main(int argc, char **argv) {
     /* exit when last event received, no need to wait for TERM signal */
     if (eventT==END_OF_RUN) {
       printf("EOR event detected\n");
-      calibped.Analyse();
-
-
+      calibped.Analyse(ped);
+      calibgain.Analyse(gain);
 
       break;
     }
@@ -166,6 +184,17 @@ int main(int argc, char **argv) {
   /* write report */
   fprintf(fp,"Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total);
 
+
+  TFile * pedRun = new TFile ("pmd_ped.root","RECREATE"); 
+  ped->Write();
+  pedRun->Close();
+
+  TFile * gainRun = new TFile ("pmd_calib.root","RECREATE"); 
+  gain->Write();
+  gainRun->Close();
+
+
+
   /* close result file */
   fclose(fp);