First version of kdtree (Alexander, Marian)
[u/mrichter/AliRoot.git] / MONITOR / root2date.cxx
CommitLineData
36470d8d 1// Author: Filimon Roukoutakis 02/08/2006
2// Cvetan Cheshkov
3
4/******************************************************************************
5 MOOD - Monitor Of On-line Data and Detector Debugger for ALICE Experiment
6******************************************************************************/
7
8#include "root2date.h"
9
10int Root2Date(AliRawEvent *gdcRootEvent, unsigned char *gdcDateEvent) {
11
12 unsigned char *p=gdcDateEvent;
13 int ldcCounter, equipmentCounter, chunkSize;
14 AliRawEquipment *aliEquipment=NULL;
15 AliRawEquipmentHeader *aliEquipmentHeader=NULL;
16 AliRawEventHeaderBase *aliHeader=NULL;
17 AliRawEvent *ldcRootEvent=NULL;
18
19 aliHeader=gdcRootEvent->GetHeader();
20 memcpy(p, aliHeader->HeaderBaseBegin(), chunkSize=aliHeader->HeaderBaseSize());
21 p+=chunkSize;
22 memcpy(p, aliHeader->HeaderBegin(), chunkSize=aliHeader->HeaderSize()); // Write DATE GDC header
23 p+=chunkSize;
24 for(ldcCounter=0; ldcCounter<gdcRootEvent->GetNSubEvents(); ldcCounter++) {
25 ldcRootEvent=gdcRootEvent->GetSubEvent(ldcCounter);
26 aliHeader=ldcRootEvent->GetHeader();
27 memcpy(p, aliHeader->HeaderBaseBegin(), chunkSize=aliHeader->HeaderBaseSize());
28 p+=chunkSize;
29 memcpy(p, aliHeader->HeaderBegin(), chunkSize=aliHeader->HeaderSize()); // Write DATE LDC header
30 p+=chunkSize;
31 for(equipmentCounter=0; equipmentCounter<ldcRootEvent->GetNEquipments(); equipmentCounter++) {
32 aliEquipment=ldcRootEvent->GetEquipment(equipmentCounter);
33 aliEquipmentHeader=aliEquipment->GetEquipmentHeader();
34 if(aliEquipmentHeader->GetEquipmentSize()) {
35 memcpy(p, aliEquipmentHeader->HeaderBegin(), chunkSize=aliEquipmentHeader->HeaderSize()); // Write DATE Equipment header
36 p+=chunkSize;
37 }
38 memcpy(p, aliEquipment->GetRawData()->GetBuffer(), chunkSize=aliEquipment->GetRawData()->GetSize()); // Write Equipment payload (including CDH)
39 p+=chunkSize;
40 }
41 }
42
43 return(p-gdcDateEvent);
44
45}