New executable which can be used for derootification of raw data. One has to have...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 Apr 2007 09:35:05 +0000 (09:35 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 Apr 2007 09:35:05 +0000 (09:35 +0000)
MONITOR/binderoot.pkg [new file with mode: 0644]
MONITOR/deroot.cxx [new file with mode: 0644]
MONITOR/deroot.h [new file with mode: 0644]
MONITOR/root2date.cxx [new file with mode: 0644]
MONITOR/root2date.h [new file with mode: 0644]
build/module.dep

diff --git a/MONITOR/binderoot.pkg b/MONITOR/binderoot.pkg
new file mode 100644 (file)
index 0000000..3514d0b
--- /dev/null
@@ -0,0 +1,28 @@
+#-*- Mode: Makefile -*-
+
+include HLT/hlt.conf
+
+EDEFINE      := ${HLTDEFS}
+PACKCXXFLAGS := ${HLTCXXFLAGS}
+PACKCFLAGS   := ${HLTCLFAGS}
+PACKDCXXFLAGS:= ${HLTDCXXFLAGS}
+
+SRCS:=deroot.cxx
+
+EINCLUDE+= TPC ITS RAW HLT/src HLT/hough HLT/comp HLT/ITS
+
+PACKBLIBS := $(ROOTCLIBS) $(SYSLIBS)
+
+ifdef DATE_ROOT
+
+SRCS += root2date.cxx
+PACKBLIBS += $(shell date-config --monitorlibs)
+ELIBSDIR:=
+ELIBS:=ESD AOD CDB STEER RAWDatabase RAWDatarec RAWDatasim TPCbase TPCsim TPCrec HLTbase AliHLTSrc AliHLTMisc AliHLTHough AliHLTComp AliHLTITS AliHLTMUON ITSbase ITSsim ITSrec MUONsim MUONrec MUONbase MUONgeometry MUONraw MUONcalib MUONmapping
+EINCLUDE+= ${DATE_COMMON_DEFS} ${DATE_MONITOR_DIR}
+
+endif
+
+ifneq (,$(findstring macosx,$(ALICE_TARGET)))
+PACKLDFLAGS:=$(LDFLAGS) $(ELIBS:%=-Wl,-u,_G__cpp_setupG__%)
+endif
diff --git a/MONITOR/deroot.cxx b/MONITOR/deroot.cxx
new file mode 100644 (file)
index 0000000..e18a961
--- /dev/null
@@ -0,0 +1,77 @@
+// Author: Filimon Roukoutakis 02/08/2006
+
+/******************************************************************************
+  MOOD - Monitor Of On-line Data and Detector Debugger for ALICE Experiment
+******************************************************************************/
+
+#include <TError.h>
+#include <TSysEvtHandler.h>
+#ifdef ALI_DATE
+#include "deroot.h"
+
+int deroot(const char *rootFileName, const char *dateFileName);
+
+int deroot(const char *rootFileName, const char *dateFileName) {
+
+ unsigned char *dateEvent=new unsigned char [100000000];
+
+ FILE *dateFile;
+ size_t gdcCounter, gdcSize;
+ TFile rootFile(rootFileName);
+ TTree *t=(TTree *)rootFile.Get("RAW");
+ if(!t) {
+  cerr << "Error getting RAW tree" << endl;
+  return(1);
+ }
+ AliRawEvent *rootEvent=NULL;
+ t->SetBranchAddress("rawevent", &rootEvent);
+
+ if(!(dateFile=fopen(dateFileName, "wb"))) {
+  cerr << "Error opening DATE file" << endl;
+  return(1);
+ }
+ for(gdcCounter=0; gdcCounter<t->GetEntries(); gdcCounter++) {
+  rootEvent=new AliRawEvent;
+  t->GetEntry(gdcCounter);
+  gdcSize=Root2Date(rootEvent, dateEvent);
+  delete rootEvent;
+  cerr << "\r     \r" << setprecision(3) << 100*(float)(gdcCounter+1)/t->GetEntries() << "% ";
+  fwrite(dateEvent, gdcSize, 1, dateFile);
+ }
+
+ // Cleanup resources
+ cerr << "\r     \r";
+ cerr.flush();
+ delete t;
+ rootFile.Close();
+ fclose(dateFile);
+ delete [] dateEvent;
+ return(0);
+
+}
+
+int main(int argc, char **argv) {
+
+  if (argc != 3) {
+    cerr << "Usage: deroot <input_root_file> <output_date_file>" << endl;
+    return 1;
+  }
+
+ deroot(argv[1], argv[2]);
+
+ return(0);
+
+}
+
+#else
+int main(int /*argc*/, char** /*argv*/)
+{
+  ::Fatal("main", "this program was compiled without DATE");
+
+  return 1;
+}
+#endif
diff --git a/MONITOR/deroot.h b/MONITOR/deroot.h
new file mode 100644 (file)
index 0000000..72bd0fd
--- /dev/null
@@ -0,0 +1,14 @@
+// Author: Filimon Roukoutakis 02/08/2006
+
+/******************************************************************************
+  MOOD - Monitor Of On-line Data and Detector Debugger for ALICE Experiment
+******************************************************************************/
+
+#ifndef DEROOT_H
+#define DEROOT_H
+
+#include "root2date.h"
+#include "TFile.h"
+#include "TTree.h"
+
+#endif
diff --git a/MONITOR/root2date.cxx b/MONITOR/root2date.cxx
new file mode 100644 (file)
index 0000000..093c0be
--- /dev/null
@@ -0,0 +1,45 @@
+// Author: Filimon Roukoutakis 02/08/2006
+//         Cvetan Cheshkov
+
+/******************************************************************************
+  MOOD - Monitor Of On-line Data and Detector Debugger for ALICE Experiment
+******************************************************************************/
+
+#include "root2date.h"
+
+int Root2Date(AliRawEvent *gdcRootEvent, unsigned char *gdcDateEvent) {
+
+ unsigned char *p=gdcDateEvent;
+ int ldcCounter, equipmentCounter, chunkSize;
+ AliRawEquipment *aliEquipment=NULL;
+ AliRawEquipmentHeader *aliEquipmentHeader=NULL;
+ AliRawEventHeaderBase *aliHeader=NULL;
+ AliRawEvent *ldcRootEvent=NULL;
+ aliHeader=gdcRootEvent->GetHeader();
+ memcpy(p, aliHeader->HeaderBaseBegin(), chunkSize=aliHeader->HeaderBaseSize());
+ p+=chunkSize;
+ memcpy(p, aliHeader->HeaderBegin(), chunkSize=aliHeader->HeaderSize()); // Write DATE GDC header
+ p+=chunkSize;
+ for(ldcCounter=0; ldcCounter<gdcRootEvent->GetNSubEvents(); ldcCounter++) {
+  ldcRootEvent=gdcRootEvent->GetSubEvent(ldcCounter);
+  aliHeader=ldcRootEvent->GetHeader();
+  memcpy(p, aliHeader->HeaderBaseBegin(), chunkSize=aliHeader->HeaderBaseSize());
+  p+=chunkSize;
+  memcpy(p, aliHeader->HeaderBegin(), chunkSize=aliHeader->HeaderSize()); // Write DATE LDC header
+  p+=chunkSize;
+  for(equipmentCounter=0; equipmentCounter<ldcRootEvent->GetNEquipments(); equipmentCounter++) {
+   aliEquipment=ldcRootEvent->GetEquipment(equipmentCounter);
+   aliEquipmentHeader=aliEquipment->GetEquipmentHeader();
+   if(aliEquipmentHeader->GetEquipmentSize()) {
+    memcpy(p, aliEquipmentHeader->HeaderBegin(), chunkSize=aliEquipmentHeader->HeaderSize()); // Write DATE Equipment header
+    p+=chunkSize;
+   }
+   memcpy(p, aliEquipment->GetRawData()->GetBuffer(), chunkSize=aliEquipment->GetRawData()->GetSize()); // Write Equipment payload (including CDH)
+   p+=chunkSize;
+  }
+ }
+ return(p-gdcDateEvent);
+}
diff --git a/MONITOR/root2date.h b/MONITOR/root2date.h
new file mode 100644 (file)
index 0000000..1fe6e87
--- /dev/null
@@ -0,0 +1,22 @@
+// Author: Filimon Roukoutakis 02/08/2006
+
+/******************************************************************************
+  MOOD - Monitor Of On-line Data and Detector Debugger for ALICE Experiment
+******************************************************************************/
+
+#ifndef ROOT2DATE_H
+#define ROOT2DATE_H
+
+#include "AliRawData.h"
+#include "AliRawEvent.h"
+#include "AliRawEventHeaderBase.h"
+#include "AliRawEquipment.h"
+#include "AliRawEquipmentHeader.h"
+#include "AliRawReaderRoot.h"
+#include "event.h"
+
+#include <Riostream.h>
+
+int Root2Date(AliRawEvent *gdcRootEvent, unsigned char *gdcDateEvent);
+
+#endif
index 47409bf..b3b7d00 100644 (file)
@@ -16,7 +16,7 @@ ITS/module.mk:                 ITS/libITSbase.pkg ITS/libITSsim.pkg ITS/libITSrec.pkg
 JETAN/module.mk:        JETAN/libJETAN.pkg
 MEVSIM/module.mk:       MEVSIM/libmevsim.pkg
 MICROCERN/module.mk:    MICROCERN/libmicrocern.pkg
-MONITOR/module.mk:       MONITOR/libMONITOR.pkg MONITOR/binmonitorGDC.pkg MONITOR/binmonitorCheck.pkg
+MONITOR/module.mk:       MONITOR/libMONITOR.pkg MONITOR/binmonitorGDC.pkg MONITOR/binmonitorCheck.pkg MONITOR/binderoot.pkg
 MUON/module.mk:                 MUON/libMUONrec.pkg MUON/libMUONsim.pkg MUON/libMUONbase.pkg MUON/libMUONraw.pkg MUON/libMUONmapping.pkg MUON/libMUONshuttle.pkg
 LHC/module.mk:          LHC/libLHC.pkg
 LHAPDF/module.mk:       LHAPDF/liblhapdf.pkg