During simulation: fill STU region w/ non null time sums
[u/mrichter/AliRoot.git] / TPC / AliTPCMonitorDateFormat.cxx
CommitLineData
48265b32 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
fb3305d1 16/*
48265b32 17$Log$
fb3305d1 18Revision 1.3 2007/10/12 13:36:27 cvetan
19Coding convention fixes from Stefan
20
ca7b8371 21Revision 1.2 2007/09/17 16:34:54 cvetan
22The package was overwriting the rootcint flags. This was fixed by applying the necessary changes in the DATE-dependent parts of the code
23
33dc3c99 24Revision 1.1 2007/09/17 10:23:31 cvetan
25New TPC monitoring package from Stefan Kniege. The monitoring package can be started by running TPCMonitor.C macro located in macros folder.
26
48265b32 27*/
28
ca7b8371 29
30////////////////////////////////////////////////////////////////////////
fb3305d1 31////
32//// AliTPCMonitorDateFormat class
33////
34//// Class for decoding raw data headers in DATE format
35////
36//// Reads event and subevent header informations form DATE files
37////
38//// Authors: Roland Bramm,
39//// Stefan Kniege, IKF, Frankfurt
40////
ca7b8371 41/////////////////////////////////////////////////////////////////////////
42
48265b32 43#include "AliTPCMonitorDateFormat.h"
33dc3c99 44#include "event.h"
48265b32 45#include <iostream>
46ClassImp(AliTPCMonitorDateFormat)
47//____________________________________________________________________________
ca7b8371 48AliTPCMonitorDateFormat::AliTPCMonitorDateFormat(Char_t* data):
49 fdataPtr(data),
50 fsubEventPtr(data),
51 fcurrentPtr(data),
fb3305d1 52 fevent((struct eventHeaderStruct*) fdataPtr),
53 fsubEvent(0),
54 fequipment(0)
ca7b8371 55{
48265b32 56 // Constructor
ca7b8371 57}
58
59
60//____________________________________________________________________________
61AliTPCMonitorDateFormat::AliTPCMonitorDateFormat(const AliTPCMonitorDateFormat &dateformat) :
62 TNamed(dateformat.GetName(),dateformat.GetTitle()),
63 fdataPtr(dateformat.fdataPtr),
64 fsubEventPtr(dateformat.fsubEventPtr),
65 fcurrentPtr(dateformat.fcurrentPtr),
fb3305d1 66 fevent((struct eventHeaderStruct*)dateformat.fdataPtr),
67 fsubEvent(dateformat.fsubEvent),
68 fequipment(dateformat.fequipment)
ca7b8371 69{
70 // copy constructor
71}
72
73//____________________________________________________________________________
74AliTPCMonitorDateFormat &AliTPCMonitorDateFormat:: operator= (const AliTPCMonitorDateFormat& dateformat)
75{
76
77 // assignment operator
78 if(this!=&dateformat)
79 {
80 fdataPtr=dateformat.fdataPtr;
81 fsubEventPtr=dateformat.fsubEventPtr;
82 fcurrentPtr=dateformat.fcurrentPtr;
fb3305d1 83 fevent=dateformat.fevent;
84 fsubEvent=dateformat.fsubEvent;
85 fequipment=dateformat.fequipment;
ca7b8371 86 }
87 return *this;
48265b32 88}
89
90//____________________________________________________________________________
91AliTPCMonitorDateFormat::~AliTPCMonitorDateFormat()
92{
93 // Destructor
94}
95
96//____________________________________________________________________________
fb3305d1 97Int_t AliTPCMonitorDateFormat::GetEventSize()const
48265b32 98{
99 // Return event size
fb3305d1 100 return (Int_t)fevent->eventSize;
48265b32 101}
102
103//____________________________________________________________________________
fb3305d1 104Int_t AliTPCMonitorDateFormat::GetEventHeaderSize()const
48265b32 105{
106 // Return event header size
fb3305d1 107 return (Int_t)fevent->eventHeadSize;
48265b32 108}
109
110//____________________________________________________________________________
fb3305d1 111Int_t AliTPCMonitorDateFormat::GetEventHeaderBaseSize()const
48265b32 112{
113 // Return event header base size
114 return (Int_t)EVENT_HEAD_BASE_SIZE;
115}
116
117//____________________________________________________________________________
fb3305d1 118Int_t AliTPCMonitorDateFormat::GetEventID()const
48265b32 119{
120 // Return event ID
fb3305d1 121 return (Int_t)EVENT_ID_GET_NB_IN_RUN(fevent->eventId);
48265b32 122}
123
124//____________________________________________________________________________
fb3305d1 125Int_t AliTPCMonitorDateFormat::GetEventLDC()const
48265b32 126{
127 // Return event LDC
fb3305d1 128 return (Int_t)fevent->eventLdcId;
48265b32 129}
130
131//____________________________________________________________________________
fb3305d1 132Int_t AliTPCMonitorDateFormat::GetEventGDC()const
48265b32 133{
134 // return event GDC
fb3305d1 135 return (Int_t)fevent->eventGdcId;
48265b32 136}
137
138//____________________________________________________________________________
fb3305d1 139Int_t AliTPCMonitorDateFormat::GetEventRunID()const
48265b32 140{
141 // Return run ID
fb3305d1 142 return (Int_t)fevent->eventRunNb;
48265b32 143}
144
145//____________________________________________________________________________
fb3305d1 146Int_t AliTPCMonitorDateFormat::GetEventVersion()const
48265b32 147{
148 // Return event version
fb3305d1 149 return (Int_t)fevent->eventVersion;
48265b32 150}
151
152//____________________________________________________________________________
fb3305d1 153Int_t AliTPCMonitorDateFormat::GetEventVersionMajor()const
48265b32 154{
155 // retrun event version (16-32 bit)
156 return (Int_t)(GetEventVersion()>>16);
157}
158
159//____________________________________________________________________________
fb3305d1 160Int_t AliTPCMonitorDateFormat::GetEventVersionMinor()const
48265b32 161{
162 // return event version (0-15 bit)
163 return (Int_t)(GetEventVersion()&0x0000ffff);
164}
165
166//____________________________________________________________________________
fb3305d1 167Bool_t AliTPCMonitorDateFormat::IsEventSuperEvent()const
48265b32 168{
169 // Check if event ist super event
170 Bool_t retval;
fb3305d1 171 if(TEST_SYSTEM_ATTRIBUTE( fevent->eventTypeAttribute, ATTR_SUPER_EVENT ) == 1)
48265b32 172 retval = true;
173 else
174 retval = false;
175 return retval;
176}
177
178//____________________________________________________________________________
fb3305d1 179Bool_t AliTPCMonitorDateFormat::IsEventStartOfRun()const
48265b32 180{
181 // Check if event ist Start of Run
182 Bool_t retval;
fb3305d1 183 if(fevent->eventType == START_OF_RUN)
48265b32 184 retval = true;
185 else
186 retval = false;
187 return retval;
188}
189
190//____________________________________________________________________________
fb3305d1 191Bool_t AliTPCMonitorDateFormat::IsEventEndOfRun()const
48265b32 192{
193 // Check if event is End of Run
194 Bool_t retval;
fb3305d1 195 if(fevent->eventType == END_OF_RUN)
48265b32 196 retval = true;
197 else
198 retval = false;
199 return retval;
200}
201
202//____________________________________________________________________________
fb3305d1 203Bool_t AliTPCMonitorDateFormat::IsEventPhysicsEvent()const
48265b32 204{
205 // Check if event is Physics event
206 Bool_t retval;
fb3305d1 207 if(fevent->eventType == PHYSICS_EVENT)
48265b32 208 retval = true;
209 else
210 retval = false;
211 return retval;
212}
213
214//____________________________________________________________________________
fb3305d1 215Bool_t AliTPCMonitorDateFormat::IsEventSwapped()const
48265b32 216{
217 // Check if event is swapped
218 Bool_t retval;
fb3305d1 219 if(TEST_SYSTEM_ATTRIBUTE( fevent->eventTypeAttribute, ATTR_EVENT_SWAPPED ) == 1)
48265b32 220 retval = true;
221 else
222 retval = false;
223 return retval;
224}
225
226//____________________________________________________________________________
fb3305d1 227Bool_t AliTPCMonitorDateFormat::IsEventWrongEndian()const
48265b32 228{
229 // Check endian
230 Bool_t retval;
fb3305d1 231 if(EVENT_MAGIC_NUMBER == fevent->eventMagic)
48265b32 232 retval = false;
233 else
234 retval = true;
235 return retval;
236}
237
238
239//____________________________________________________________________________
240void AliTPCMonitorDateFormat::GotoSubEventHeader()
241{
242 // Set subevent Pointer to sub event
243 if(IsEventSuperEvent() ==true){
244 fsubEventPtr = fdataPtr+GetEventHeaderSize();
fb3305d1 245 fsubEvent = (struct eventHeaderStruct*) (fsubEventPtr);
48265b32 246 }else{
247 fsubEventPtr = fdataPtr;
fb3305d1 248 fsubEvent = (struct eventHeaderStruct*) (fsubEventPtr);
48265b32 249 }
250}
251
252//____________________________________________________________________________
253void AliTPCMonitorDateFormat::GotoNextSubEventHeader()
254{
255 // set subevent pointer to next sub event
256 fsubEventPtr += GetSubEventSize();
fb3305d1 257 fsubEvent = (struct eventHeaderStruct*) (fsubEventPtr);
48265b32 258}
259
260//____________________________________________________________________________
fb3305d1 261Bool_t AliTPCMonitorDateFormat::IsLastSubEventHeader()const
48265b32 262{
263 // Check if sub event is last sub event
264 Bool_t retval;
265 Int_t position;
266 if(IsEventSuperEvent() ==true){
267 position = fsubEventPtr - fdataPtr;
268 if( (position+GetSubEventSize()) < GetEventSize() )
269 retval = false;
270 else
271 retval = true;
272 }else{
273 position = fsubEventPtr - fdataPtr;
274 if( (position+GetSubEventSize()) < GetEventSize() )
275 retval = false;
276 else
277 retval = true;
278 }
279 return retval;
280}
281
282//____________________________________________________________________________
fb3305d1 283Int_t AliTPCMonitorDateFormat::GetSubEventSize()const
48265b32 284{
285 // Return sub event size
fb3305d1 286 return (Int_t)fsubEvent->eventSize;
48265b32 287}
288
289//____________________________________________________________________________
fb3305d1 290Int_t AliTPCMonitorDateFormat::GetSubEventHeaderSize()const
48265b32 291{
292 // Return sub event header size
fb3305d1 293 return (Int_t)fsubEvent->eventHeadSize;
48265b32 294}
295
296//____________________________________________________________________________
fb3305d1 297Int_t AliTPCMonitorDateFormat::GetSubEventLDC()const
48265b32 298{
299 // Return sub event LDC
fb3305d1 300 return (Int_t)fsubEvent->eventLdcId;
48265b32 301}
302
303//____________________________________________________________________________
fb3305d1 304Int_t AliTPCMonitorDateFormat::GetSubEventGDC()const
48265b32 305{
306 // return sub event GDC
fb3305d1 307 return (Int_t)fsubEvent->eventGdcId;
48265b32 308}
309
310
311//____________________________________________________________________________
312Bool_t AliTPCMonitorDateFormat::IsSubEventSuperEvent()
313{
314 // Check if sub event is super event
315 Bool_t retval;
fb3305d1 316 if(TEST_SYSTEM_ATTRIBUTE( fsubEvent->eventTypeAttribute, ATTR_SUPER_EVENT ) == 1)
48265b32 317 retval = true;
318 else
319 retval = false;
320 return retval;
321}
322
323//____________________________________________________________________________
fb3305d1 324Bool_t AliTPCMonitorDateFormat::IsSubEventStartOfRun()const
325{
48265b32 326 // Check if sub event is start of run
327 Bool_t retval;
fb3305d1 328 if(fsubEvent->eventType == START_OF_RUN)
48265b32 329 retval = true;
330 else
331 retval = false;
332 return retval;
333}
334
335//____________________________________________________________________________
fb3305d1 336Bool_t AliTPCMonitorDateFormat::IsSubEventEndOfRun()const
48265b32 337{
338 // Check if sub event is end of run
339 Bool_t retval;
fb3305d1 340 if(fsubEvent->eventType == END_OF_RUN)
48265b32 341 retval = true;
342 else
343 retval = false;
344 return retval;
345}
346
347//____________________________________________________________________________
fb3305d1 348Bool_t AliTPCMonitorDateFormat::IsSubEventPhysicsEvent()const
48265b32 349{
350 // Check if sub event is physics event
351 Bool_t retval;
fb3305d1 352 if(fsubEvent->eventType == PHYSICS_EVENT)
48265b32 353 retval = true;
354 else
355 retval = false;
356 return retval;
357}
358
359//____________________________________________________________________________
360void AliTPCMonitorDateFormat::GotoFirstEquipment()
361{
362 // Set current pointer to first equipment
363 fcurrentPtr = fsubEventPtr + GetSubEventHeaderSize();
fb3305d1 364 fequipment = (struct equipmentHeaderStruct*) (fcurrentPtr);
48265b32 365}
366
367//____________________________________________________________________________
368void AliTPCMonitorDateFormat::GotoNextEquipment()
369{
370 // Set current pointer to next equipment
371 fcurrentPtr += GetEquipmentSize();
fb3305d1 372 fequipment = (struct equipmentHeaderStruct*) (fcurrentPtr);
48265b32 373}
374
375//____________________________________________________________________________
fb3305d1 376Bool_t AliTPCMonitorDateFormat::IsLastEquipment() const
48265b32 377{
378 // Check if equipment is last equipment
379 Bool_t retval;
fb3305d1 380 Int_t position;
48265b32 381 position = fcurrentPtr - fsubEventPtr;
382 if( (position+GetEquipmentSize()) < GetSubEventSize() )
383 retval = false;
384 else
385 retval = true;
386 return retval;
387}
388
389//____________________________________________________________________________
fb3305d1 390Int_t AliTPCMonitorDateFormat::GetEquipmentSize() const
48265b32 391{
392 // Return equipment size
fb3305d1 393 return (Int_t)fequipment->equipmentSize;
48265b32 394}
395
396//____________________________________________________________________________
fb3305d1 397Int_t AliTPCMonitorDateFormat::GetPayloadSize() const
48265b32 398{
399 // Return payload slze
400 Int_t retval = 0;
401 if(GetEventVersion() < 196610){
fb3305d1 402 retval = (Int_t)fequipment->equipmentSize;
48265b32 403 }else{
fb3305d1 404 retval = (Int_t)fequipment->equipmentSize - GetEquipmentHeaderSize();
48265b32 405 }
406 return retval;
407}
408
409//____________________________________________________________________________
fb3305d1 410Int_t AliTPCMonitorDateFormat::GetEquipmentType() const
48265b32 411{
412 // Return equipment type
fb3305d1 413 return (Int_t)fequipment->equipmentType;
48265b32 414}
415
416//____________________________________________________________________________
fb3305d1 417Int_t AliTPCMonitorDateFormat::GetEquipmentID() const
48265b32 418{
419 // Return equipment ID
fb3305d1 420 return (Int_t)fequipment->equipmentId;
48265b32 421}
422
423//____________________________________________________________________________
424Int_t* AliTPCMonitorDateFormat::GetEquipmentTypeAttribute()
425{
426 // Return equipment type attribute
fb3305d1 427 return (Int_t*)fequipment->equipmentTypeAttribute;
48265b32 428}
429
430//____________________________________________________________________________
fb3305d1 431Int_t AliTPCMonitorDateFormat::GetEquipmentBasicSize() const
48265b32 432{
433 // Return equipment basic size
fb3305d1 434 return (Int_t)fequipment->equipmentBasicElementSize;
48265b32 435}
436
437//____________________________________________________________________________
fb3305d1 438Int_t AliTPCMonitorDateFormat::GetEquipmentHeaderSize() const
48265b32 439{
440 // Return equipment header size
441 return sizeof(struct equipmentHeaderStruct);
442}
443
444
445//____________________________________________________________________________
fb3305d1 446Char_t *AliTPCMonitorDateFormat::GetFirstDataPointer()
48265b32 447{
448 // Return data pointer (after equipment header)
449 Char_t *datapointer;
450 if(GetEventVersion() < 196610){
451 fcurrentPtr += GetEquipmentHeaderSize();
452 datapointer = fcurrentPtr;
453 }else{
454 datapointer = fcurrentPtr + GetEquipmentHeaderSize();
455 }
456 return datapointer;
457
458}
459
460//____________________________________________________________________________
fb3305d1 461Int_t AliTPCMonitorDateFormat::GetPosition() const
48265b32 462{
463 // Return current position relative to start of event
464 Int_t retval = (Int_t) (fcurrentPtr - fdataPtr);
465 return retval;
466}
467
468//____________________________________________________________________________
fb3305d1 469Int_t AliTPCMonitorDateFormat::GetPositionSubEvent() const
48265b32 470{
471 // Return subevent position relative to start of event
472 Int_t retval = (Int_t) (fsubEventPtr - fdataPtr);
473 return retval;
474}
475