1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.3 2007/10/12 13:36:27 cvetan
19 Coding convention fixes from Stefan
21 Revision 1.2 2007/09/17 16:34:54 cvetan
22 The package was overwriting the rootcint flags. This was fixed by applying the necessary changes in the DATE-dependent parts of the code
24 Revision 1.1 2007/09/17 10:23:31 cvetan
25 New TPC monitoring package from Stefan Kniege. The monitoring package can be started by running TPCMonitor.C macro located in macros folder.
30 ////////////////////////////////////////////////////////////////////////
32 //// AliTPCMonitorDateFormat class
34 //// Class for decoding raw data headers in DATE format
36 //// Reads event and subevent header informations form DATE files
38 //// Authors: Roland Bramm,
39 //// Stefan Kniege, IKF, Frankfurt
41 /////////////////////////////////////////////////////////////////////////
43 #include "AliTPCMonitorDateFormat.h"
46 ClassImp(AliTPCMonitorDateFormat)
47 //____________________________________________________________________________
48 AliTPCMonitorDateFormat::AliTPCMonitorDateFormat(Char_t* data):
52 fevent((struct eventHeaderStruct*) fdataPtr),
60 //____________________________________________________________________________
61 AliTPCMonitorDateFormat::AliTPCMonitorDateFormat(const AliTPCMonitorDateFormat &dateformat) :
62 TNamed(dateformat.GetName(),dateformat.GetTitle()),
63 fdataPtr(dateformat.fdataPtr),
64 fsubEventPtr(dateformat.fsubEventPtr),
65 fcurrentPtr(dateformat.fcurrentPtr),
66 fevent((struct eventHeaderStruct*)dateformat.fdataPtr),
67 fsubEvent(dateformat.fsubEvent),
68 fequipment(dateformat.fequipment)
73 //____________________________________________________________________________
74 AliTPCMonitorDateFormat &AliTPCMonitorDateFormat:: operator= (const AliTPCMonitorDateFormat& dateformat)
77 // assignment operator
80 fdataPtr=dateformat.fdataPtr;
81 fsubEventPtr=dateformat.fsubEventPtr;
82 fcurrentPtr=dateformat.fcurrentPtr;
83 fevent=dateformat.fevent;
84 fsubEvent=dateformat.fsubEvent;
85 fequipment=dateformat.fequipment;
90 //____________________________________________________________________________
91 AliTPCMonitorDateFormat::~AliTPCMonitorDateFormat()
96 //____________________________________________________________________________
97 Int_t AliTPCMonitorDateFormat::GetEventSize()const
100 return (Int_t)fevent->eventSize;
103 //____________________________________________________________________________
104 Int_t AliTPCMonitorDateFormat::GetEventHeaderSize()const
106 // Return event header size
107 return (Int_t)fevent->eventHeadSize;
110 //____________________________________________________________________________
111 Int_t AliTPCMonitorDateFormat::GetEventHeaderBaseSize()const
113 // Return event header base size
114 return (Int_t)EVENT_HEAD_BASE_SIZE;
117 //____________________________________________________________________________
118 Int_t AliTPCMonitorDateFormat::GetEventID()const
121 return (Int_t)EVENT_ID_GET_NB_IN_RUN(fevent->eventId);
124 //____________________________________________________________________________
125 Int_t AliTPCMonitorDateFormat::GetEventLDC()const
128 return (Int_t)fevent->eventLdcId;
131 //____________________________________________________________________________
132 Int_t AliTPCMonitorDateFormat::GetEventGDC()const
135 return (Int_t)fevent->eventGdcId;
138 //____________________________________________________________________________
139 Int_t AliTPCMonitorDateFormat::GetEventRunID()const
142 return (Int_t)fevent->eventRunNb;
145 //____________________________________________________________________________
146 Int_t AliTPCMonitorDateFormat::GetEventVersion()const
148 // Return event version
149 return (Int_t)fevent->eventVersion;
152 //____________________________________________________________________________
153 Int_t AliTPCMonitorDateFormat::GetEventVersionMajor()const
155 // retrun event version (16-32 bit)
156 return (Int_t)(GetEventVersion()>>16);
159 //____________________________________________________________________________
160 Int_t AliTPCMonitorDateFormat::GetEventVersionMinor()const
162 // return event version (0-15 bit)
163 return (Int_t)(GetEventVersion()&0x0000ffff);
166 //____________________________________________________________________________
167 Bool_t AliTPCMonitorDateFormat::IsEventSuperEvent()const
169 // Check if event ist super event
171 if(TEST_SYSTEM_ATTRIBUTE( fevent->eventTypeAttribute, ATTR_SUPER_EVENT ) == 1)
178 //____________________________________________________________________________
179 Bool_t AliTPCMonitorDateFormat::IsEventStartOfRun()const
181 // Check if event ist Start of Run
183 if(fevent->eventType == START_OF_RUN)
190 //____________________________________________________________________________
191 Bool_t AliTPCMonitorDateFormat::IsEventEndOfRun()const
193 // Check if event is End of Run
195 if(fevent->eventType == END_OF_RUN)
202 //____________________________________________________________________________
203 Bool_t AliTPCMonitorDateFormat::IsEventPhysicsEvent()const
205 // Check if event is Physics event
207 if(fevent->eventType == PHYSICS_EVENT)
214 //____________________________________________________________________________
215 Bool_t AliTPCMonitorDateFormat::IsEventSwapped()const
217 // Check if event is swapped
219 if(TEST_SYSTEM_ATTRIBUTE( fevent->eventTypeAttribute, ATTR_EVENT_SWAPPED ) == 1)
226 //____________________________________________________________________________
227 Bool_t AliTPCMonitorDateFormat::IsEventWrongEndian()const
231 if(EVENT_MAGIC_NUMBER == fevent->eventMagic)
239 //____________________________________________________________________________
240 void AliTPCMonitorDateFormat::GotoSubEventHeader()
242 // Set subevent Pointer to sub event
243 if(IsEventSuperEvent() ==true){
244 fsubEventPtr = fdataPtr+GetEventHeaderSize();
245 fsubEvent = (struct eventHeaderStruct*) (fsubEventPtr);
247 fsubEventPtr = fdataPtr;
248 fsubEvent = (struct eventHeaderStruct*) (fsubEventPtr);
252 //____________________________________________________________________________
253 void AliTPCMonitorDateFormat::GotoNextSubEventHeader()
255 // set subevent pointer to next sub event
256 fsubEventPtr += GetSubEventSize();
257 fsubEvent = (struct eventHeaderStruct*) (fsubEventPtr);
260 //____________________________________________________________________________
261 Bool_t AliTPCMonitorDateFormat::IsLastSubEventHeader()const
263 // Check if sub event is last sub event
266 if(IsEventSuperEvent() ==true){
267 position = fsubEventPtr - fdataPtr;
268 if( (position+GetSubEventSize()) < GetEventSize() )
273 position = fsubEventPtr - fdataPtr;
274 if( (position+GetSubEventSize()) < GetEventSize() )
282 //____________________________________________________________________________
283 Int_t AliTPCMonitorDateFormat::GetSubEventSize()const
285 // Return sub event size
286 return (Int_t)fsubEvent->eventSize;
289 //____________________________________________________________________________
290 Int_t AliTPCMonitorDateFormat::GetSubEventHeaderSize()const
292 // Return sub event header size
293 return (Int_t)fsubEvent->eventHeadSize;
296 //____________________________________________________________________________
297 Int_t AliTPCMonitorDateFormat::GetSubEventLDC()const
299 // Return sub event LDC
300 return (Int_t)fsubEvent->eventLdcId;
303 //____________________________________________________________________________
304 Int_t AliTPCMonitorDateFormat::GetSubEventGDC()const
306 // return sub event GDC
307 return (Int_t)fsubEvent->eventGdcId;
311 //____________________________________________________________________________
312 Bool_t AliTPCMonitorDateFormat::IsSubEventSuperEvent()
314 // Check if sub event is super event
316 if(TEST_SYSTEM_ATTRIBUTE( fsubEvent->eventTypeAttribute, ATTR_SUPER_EVENT ) == 1)
323 //____________________________________________________________________________
324 Bool_t AliTPCMonitorDateFormat::IsSubEventStartOfRun()const
326 // Check if sub event is start of run
328 if(fsubEvent->eventType == START_OF_RUN)
335 //____________________________________________________________________________
336 Bool_t AliTPCMonitorDateFormat::IsSubEventEndOfRun()const
338 // Check if sub event is end of run
340 if(fsubEvent->eventType == END_OF_RUN)
347 //____________________________________________________________________________
348 Bool_t AliTPCMonitorDateFormat::IsSubEventPhysicsEvent()const
350 // Check if sub event is physics event
352 if(fsubEvent->eventType == PHYSICS_EVENT)
359 //____________________________________________________________________________
360 void AliTPCMonitorDateFormat::GotoFirstEquipment()
362 // Set current pointer to first equipment
363 fcurrentPtr = fsubEventPtr + GetSubEventHeaderSize();
364 fequipment = (struct equipmentHeaderStruct*) (fcurrentPtr);
367 //____________________________________________________________________________
368 void AliTPCMonitorDateFormat::GotoNextEquipment()
370 // Set current pointer to next equipment
371 fcurrentPtr += GetEquipmentSize();
372 fequipment = (struct equipmentHeaderStruct*) (fcurrentPtr);
375 //____________________________________________________________________________
376 Bool_t AliTPCMonitorDateFormat::IsLastEquipment() const
378 // Check if equipment is last equipment
381 position = fcurrentPtr - fsubEventPtr;
382 if( (position+GetEquipmentSize()) < GetSubEventSize() )
389 //____________________________________________________________________________
390 Int_t AliTPCMonitorDateFormat::GetEquipmentSize() const
392 // Return equipment size
393 return (Int_t)fequipment->equipmentSize;
396 //____________________________________________________________________________
397 Int_t AliTPCMonitorDateFormat::GetPayloadSize() const
399 // Return payload slze
401 if(GetEventVersion() < 196610){
402 retval = (Int_t)fequipment->equipmentSize;
404 retval = (Int_t)fequipment->equipmentSize - GetEquipmentHeaderSize();
409 //____________________________________________________________________________
410 Int_t AliTPCMonitorDateFormat::GetEquipmentType() const
412 // Return equipment type
413 return (Int_t)fequipment->equipmentType;
416 //____________________________________________________________________________
417 Int_t AliTPCMonitorDateFormat::GetEquipmentID() const
419 // Return equipment ID
420 return (Int_t)fequipment->equipmentId;
423 //____________________________________________________________________________
424 Int_t* AliTPCMonitorDateFormat::GetEquipmentTypeAttribute()
426 // Return equipment type attribute
427 return (Int_t*)fequipment->equipmentTypeAttribute;
430 //____________________________________________________________________________
431 Int_t AliTPCMonitorDateFormat::GetEquipmentBasicSize() const
433 // Return equipment basic size
434 return (Int_t)fequipment->equipmentBasicElementSize;
437 //____________________________________________________________________________
438 Int_t AliTPCMonitorDateFormat::GetEquipmentHeaderSize() const
440 // Return equipment header size
441 return sizeof(struct equipmentHeaderStruct);
445 //____________________________________________________________________________
446 Char_t *AliTPCMonitorDateFormat::GetFirstDataPointer()
448 // Return data pointer (after equipment header)
450 if(GetEventVersion() < 196610){
451 fcurrentPtr += GetEquipmentHeaderSize();
452 datapointer = fcurrentPtr;
454 datapointer = fcurrentPtr + GetEquipmentHeaderSize();
460 //____________________________________________________________________________
461 Int_t AliTPCMonitorDateFormat::GetPosition() const
463 // Return current position relative to start of event
464 Int_t retval = (Int_t) (fcurrentPtr - fdataPtr);
468 //____________________________________________________________________________
469 Int_t AliTPCMonitorDateFormat::GetPositionSubEvent() const
471 // Return subevent position relative to start of event
472 Int_t retval = (Int_t) (fsubEventPtr - fdataPtr);