]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/PHOSda.cxx
Fixes to the example configuration file provided by CTP
[u/mrichter/AliRoot.git] / PHOS / PHOSda.cxx
index 0991b3ef607cdbed0625eeb5975bf5468f7707b8..b90ad2ef081eba28e1d4f062c821c970a9dd8451 100644 (file)
@@ -18,13 +18,20 @@ contact: alice-datesupport@cern.ch
 
 #include "event.h"
 #include "monitor.h"
+extern "C" {
 #include "daqDA.h"
+}
 
 #include <stdio.h>
 #include <stdlib.h>
 
-// #include "AliRawReader.h"
-// #include "AliRawReaderDate.h"
+#include <TSystem.h>
+
+#include "AliRawReader.h"
+#include "AliRawReaderDate.h"
+#include "AliPHOSCalibHistoProducer.h"
+#include "AliPHOSRawDecoder.h"
+#include "AliCaloAltroMapping.h"
 
 
 /* Main routine
@@ -40,7 +47,6 @@ int main(int argc, char **argv) {
     return -1;
   }
 
-//   AliRawReader* rawReader = new AliRawReaderDate(argv[1]);
 
   /* open result file */
   FILE *fp=NULL;
@@ -49,6 +55,18 @@ int main(int argc, char **argv) {
     printf("Failed to open file\n");
     return -1;
   }
+
+  /* Open mapping files */
+  AliAltroMapping *mapping[4];
+  TString path = gSystem->Getenv("ALICE_ROOT");
+  path += "/PHOS/mapping/RCU";
+  TString path2;
+  for(Int_t i = 0; i < 4; i++) {
+    path2 = path;
+    path2 += i;
+    path2 += ".data";
+    mapping[i] = new AliCaloAltroMapping(path2.Data());
+  }
   
 
   /* define data source : this is argument 1 */  
@@ -80,6 +98,11 @@ int main(int argc, char **argv) {
   int nevents_physics=0;
   int nevents_total=0;
 
+  AliRawReader *rawReader = NULL;
+
+  AliPHOSCalibHistoProducer hp(200,0.,200.);
+  hp.SetOldRCUFormat(kTRUE);
+  hp.SetUpdatingRate(200000);
   
   /* main loop (infinite) */
   for(;;) {
@@ -118,11 +141,19 @@ int main(int argc, char **argv) {
         EVENT_ID_GET_ORBIT(event->eventId),
         EVENT_ID_GET_PERIOD(event->eventId)
       );
+      
+      rawReader = new AliRawReaderDate((void*)event);
+      AliPHOSRawDecoder dc(rawReader,mapping);
+      dc.SubtractPedestals(kTRUE);
+      hp.SetRawDecoder(&dc);
+      hp.Run();
+
+      delete rawReader;
+      
       nevents_physics++;
     }
     nevents_total++;
 
-
     /* free resources */
     free(event);
     
@@ -133,6 +164,7 @@ int main(int argc, char **argv) {
     }
   }
 
+  for(Int_t i = 0; i < 4; i++) delete mapping[i];  
 
   /* write report */
   fprintf(fp,"Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total);