2 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
6 * for The ALICE HLT Project. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 /** @file AliHLTHOMERBlockDesc.cxx
18 @author Jochen Thaeder
20 @brief Container for HOMER Blocks
23 // see header file for class documentation
25 // refer to README to build package
27 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
29 #include "AliHLTHOMERBlockDesc.h"
31 #include "AliHLTMessage.h"
36 ClassImp(AliHLTHOMERBlockDesc)
39 * ---------------------------------------------------------------------------------
40 * Constructor / Destructor
41 * ---------------------------------------------------------------------------------
44 //##################################################################################
45 AliHLTHOMERBlockDesc::AliHLTHOMERBlockDesc() :
59 fHasSubDetectorRange(kFALSE),
60 fHasSubSubDetectorRange(kFALSE) {
61 // see header file for class documentation
63 // refer to README to build package
65 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
68 //##################################################################################
69 AliHLTHOMERBlockDesc::~AliHLTHOMERBlockDesc() {
70 // see header file for class documentation
72 if ( fMessage != NULL )
86 * ---------------------------------------------------------------------------------
87 * Data Handling - Setter - public
88 * ---------------------------------------------------------------------------------
91 //##################################################################################
92 void AliHLTHOMERBlockDesc::SetBlock( void * data, ULong_t size, TString origin,
93 TString dataType, ULong_t specification ) {
94 // see header file for class documentation
96 fData = new Char_t[size];
97 memcpy( fData, data, size);
101 fDataType = dataType;
102 fSpecification = specification;
104 fBlockName.Form("%s_%s_0x%08lX", fDetector.Data(), fDataType.Data(), fSpecification );
106 // -- Set block parameters
107 SetBlockParameters();
113 * ---------------------------------------------------------------------------------
114 * Data Handling - private
115 * ---------------------------------------------------------------------------------
118 //##################################################################################
119 void AliHLTHOMERBlockDesc::SetBlockParameters() {
120 // see header file for class documentation
124 // ---- SET SPECIFICATIONS ----
125 // ----------------------------
127 // **** TPC **** ( has special treatment )
128 if ( ! fDetector.CompareTo("TPC") ) {
130 Int_t minPatch = (fSpecification & 0x000000FF);
131 Int_t maxPatch = (fSpecification & 0x0000FF00) >> 8;
132 Int_t minSector = (fSpecification & 0x00FF0000) >> 16 ;
133 Int_t maxSector = (fSpecification & 0xFF000000) >> 24;
135 fSubDetector = minSector;
136 fSubSubDetector = minPatch;
138 // -- check for ranges
139 if ( minSector != maxSector )
140 fHasSubDetectorRange = kTRUE;
142 if ( minPatch != maxPatch )
143 fHasSubSubDetectorRange = kTRUE;
146 // **** OTHER DETECTORS ****
149 if ( fSpecification ) {
150 // find the max bin which is set to 1
151 fSubDetector = TMath::FloorNint( TMath::Log2(fSpecification) );
153 // -- check for ranges
154 if ( TMath::Log2(fSpecification) !=
155 static_cast<Double_t>(TMath::FloorNint(TMath::Log2(fSpecification))) )
156 fHasSubDetectorRange = kTRUE;
160 // ---- SET CLASS NAME, DATA CONTENTS ----
161 // ---------------------------------------
163 // -- Check if block contains raw data
164 if ( CheckIfRawData() )
167 // -- Check if block contains TObject
168 if ( CheckIfTObject() )
171 // -- Contains arbitrary data type
174 if ( ! fDetector.CompareTo("TPC") ) {
176 if ( ! fDataType.CompareTo("CLUSTERS") )
177 fClassName = "AliHLTTPCSpacePoints";
183 else if ( ! fDetector.CompareTo("TRD") ) {
188 else if ( ! fDetector.CompareTo("PHOS") ) {
193 else if ( ! fDetector.CompareTo("MUON") ) {
203 // -- Check if classname has been defined
204 // if ( iResult < 0 ) {
205 // AliWarning( Form("The classname for data type %s for the detector %s has not been defined yet.",
206 // fDataType.Data(), fDetector.Data()) );
211 //##################################################################################
212 Bool_t AliHLTHOMERBlockDesc::CheckIfTObject() {
213 // see header file for class documentation
215 // -- Check Length - First 32 bit word of payload contains the length
216 UInt_t len = *( (UInt_t*) fData );
218 if ( len != ( fSize - sizeof(UInt_t) ) )
221 // -- set AliHLTMessage
226 fMessage = new AliHLTMessage( fData, fSize );
228 // -- Check if TMessage payload is TObject
229 if ( fMessage->What() == kMESS_OBJECT and fMessage->GetClass() != NULL and fMessage->GetClass() != (TClass*)-1)
231 fClassName = fMessage->GetClass()->GetName();
234 fTObject = fMessage->ReadObject( fMessage->GetClass() );
242 //##################################################################################
243 Bool_t AliHLTHOMERBlockDesc::CheckIfRawData() {
244 // see header file for class documentation
246 if ( ! fDataType.CompareTo("DDL_RAW") )