From Jochen - EveHLT development accumulated since the end of March.
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHOMERManager.cxx
CommitLineData
d810d0de 1// $Id$
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
fd31e9de 3// Author: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
4// for The ALICE HLT Project. *
059c30e4 5
7279ee15 6//-*- Mode: C++ -*-
7
d810d0de 8/** @file AliEveHOMERManager.cxx
059c30e4 9 @author Jochen Thaeder
51346b82 10 @date
059c30e4 11 @brief Manger for HOMER in offline
12*/
13
14#if __GNUC__>= 3
15 using namespace std;
16#endif
17
d810d0de 18#include "AliEveHOMERManager.h"
059c30e4 19
20#define use_aliroot
21#define use_root
22#define ROWHOUGHPARAMS
23#define use_reconstruction
24#define use_newio
25#define ROOTVERSION "unchecked"
26#define ALIROOTVERSION "unchecked"
27#define __ROOT__
28#define USE_ALILOG
29#define LINUX
7279ee15 30
31#define EVE_DEBUG 1
46eadbb4 32// -- -- -- -- -- -- --
059c30e4 33#include "AliHLTHOMERLibManager.h"
059c30e4 34#include "AliHLTHOMERSourceDesc.h"
35#include "AliHLTHOMERBlockDesc.h"
46eadbb4 36// -- -- -- -- -- -- --
d810d0de 37#include "AliEveHOMERSource.h"
46eadbb4 38// -- -- -- -- -- -- --
059c30e4 39#include "TString.h"
40#include <TApplication.h>
41#include "Riostream.h"
42#include "TXMLAttr.h"
43#include "TCollection.h"
44#include "TList.h"
45#include "TObjString.h"
46#include "TObjArray.h"
46eadbb4 47// -- -- -- -- -- -- --
48#include "AliLog.h"
6612c5b3 49#include "AliTPCCalibPedestal.h"
50#include "AliTPCCalibPulser.h"
51#include "AliTPCCalibCE.h"
52#include "AliTPCPreprocessorOnline.h"
53#include "AliTPCCalROC.h"
a15e6d7d 54
55//______________________________________________________________________________
56//
57// Manage connections to HLT data-sources.
58
d810d0de 59ClassImp(AliEveHOMERManager)
059c30e4 60
61/*
62 * ---------------------------------------------------------------------------------
51346b82 63 * Constructor / Destructor
64 * ---------------------------------------------------------------------------------
059c30e4 65 */
66
67//##################################################################################
d810d0de 68AliEveHOMERManager::AliEveHOMERManager( TString xmlFile ) :
69 TEveElementList("AliEveHOMERManager"),
059c30e4 70 fLibManager(new AliHLTHOMERLibManager),
7279ee15 71 fXMLHandler( new AliEveHOMERXMLHandler( xmlFile ) ),
059c30e4 72 fSourceList(NULL),
73 fReader(NULL),
74 fBlockList(NULL),
75 fNBlks(0),
76 fEventID(0),
77 fCurrentBlk(0),
78 fConnected(kFALSE),
6612c5b3 79 fStateHasChanged(kTRUE),
46eadbb4 80 fSrcList(NULL),
6612c5b3 81 fTPCPre(NULL) {
46eadbb4 82 // This Class should handle the communication
83 // from the HLT to AliEVE. The HLT sends data via
84 // the HOMER interface on several TCP ports of nodes
85 // in the CERN GPN and DCS network.
86 // All this communication is hidden from the user.
87 //
88 // Right now, a xml file ( SCC1 ) is used to get the
89 // configuration, this will/ has to change to a proxy
90 // running on dedicated nodes.
7279ee15 91
059c30e4 92}
93
94//##################################################################################
d810d0de 95AliEveHOMERManager::~AliEveHOMERManager() {
46eadbb4 96 // The destructor
059c30e4 97
98 if ( fLibManager ) {
99 if ( fReader )
100 fLibManager->DeleteReader(fReader);
101 delete fLibManager;
102 fLibManager = NULL;
103 fReader = NULL;
104 }
105
7279ee15 106 if ( fXMLHandler != NULL )
107 delete fXMLHandler;
108 fXMLHandler = NULL;
059c30e4 109
110 if ( fSourceList != NULL )
111 delete fSourceList;
112 fSourceList = NULL;
113
114 if ( fBlockList != NULL )
115 delete fBlockList;
116 fBlockList = NULL;
6612c5b3 117
46eadbb4 118 if ( fSrcList != NULL )
119 delete fSrcList;
120 fSrcList = NULL;
121
6612c5b3 122 if ( fTPCPre != NULL )
123 delete fTPCPre;
124 fTPCPre = NULL;
7279ee15 125
059c30e4 126}
127
128/*
129 * ---------------------------------------------------------------------------------
7279ee15 130 * Source Handling
51346b82 131 * ---------------------------------------------------------------------------------
059c30e4 132 */
133
134//##################################################################################
d810d0de 135Int_t AliEveHOMERManager::CreateHOMERSourcesList() {
46eadbb4 136 // Create Sources List from HOMER-Proxy
059c30e4 137
7279ee15 138 Int_t iResult = 0;
059c30e4 139
140 // -- Initialize sources list
141 DestroyElements();
142 if ( fSourceList != NULL )
143 delete fSourceList;
144 fSourceList = NULL;
51346b82 145
059c30e4 146 fSourceList = new TList();
147 fSourceList->SetOwner( kTRUE );
148
7279ee15 149 iResult = fXMLHandler->FillSourceList( fSourceList );
059c30e4 150
059c30e4 151 if ( iResult ) {
152 AliWarning( Form("There have been errors, while creating the sources list.") );
153 }
154 else {
155 AliInfo( Form("New sources list created.") );
7279ee15 156
157 // -- New SourceList has been created --> All Sources are new --> State has changed
158 fStateHasChanged = kTRUE;
46eadbb4 159
160 if ( fSrcList )
161 delete fSrcList;
162
163 // -- Create new AliEVE sources list
7279ee15 164 fSrcList = new AliEveHOMERSourceList("HLT Sources");
46eadbb4 165 fSrcList->SetManager(this);
166
167 AddElement(fSrcList);
168 fSrcList->CreateByType();
059c30e4 169 }
170
171 return iResult;
172}
173
174//##################################################################################
d810d0de 175void AliEveHOMERManager::SetSourceState( AliHLTHOMERSourceDesc * source, Bool_t state ) {
46eadbb4 176 // Set state of a source
177 // * param source Pointer to AliHLTHOMERSourceDesc object.
178 // * param state New (selected/not selected) state.
179
059c30e4 180 if ( source->IsSelected() != state ) {
181 source->SetState( state );
182 fStateHasChanged = kTRUE;
183 }
184
185 return;
186}
187
059c30e4 188/*
189 * ---------------------------------------------------------------------------------
190 * Connection Handling
51346b82 191 * ---------------------------------------------------------------------------------
059c30e4 192 */
193
194//##################################################################################
d810d0de 195Int_t AliEveHOMERManager::ConnectHOMER(){
46eadbb4 196 // Connect to HOMER sources, out of Readout List, which gets created when state has changed
197 // * return 0 on sucess, "HOMER" errors on error
198
51346b82 199 Int_t iResult = 0;
059c30e4 200
46eadbb4 201 fStateHasChanged = fSrcList->GetSelectedSources();
202
059c30e4 203 // -- Check if already connected and state has not changed
204 if ( fStateHasChanged == kFALSE && IsConnected() ) {
205 AliInfo( Form("No need for reconnection.") );
206 return iResult;
207 }
51346b82 208
059c30e4 209 // -- If already connected, disconnect before connect
51346b82 210 if ( IsConnected() )
059c30e4 211 DisconnectHOMER();
212
213 // *** Create the Readoutlist
214
215 UShort_t* sourcePorts = new UShort_t [fSourceList->GetEntries()];
216 const char ** sourceHostnames = new const char* [fSourceList->GetEntries()];
217 UInt_t sourceCount = 0;
218
219 CreateReadoutList( sourceHostnames, sourcePorts, sourceCount );
51346b82 220
059c30e4 221 if ( sourceCount == 0 ) {
222 AliError(Form("No sources selected, aborting.") );
223 return iResult;
224 }
225
226 // *** Connect to data sources
51346b82 227
059c30e4 228 if ( !fReader ) {
51346b82 229 if ( fLibManager )
059c30e4 230 fReader = fLibManager->OpenReader( sourceCount, sourceHostnames, sourcePorts );
231 }
51346b82 232
059c30e4 233 iResult = fReader->GetConnectionStatus();
51346b82 234
235 if ( iResult ) {
236 // -- Connection failed
237
059c30e4 238 UInt_t ndx = fReader->GetErrorConnectionNdx();
51346b82 239
059c30e4 240 if ( ndx < sourceCount ) {
51346b82 241 AliError( Form("Error : Error establishing connection to TCP source %s:%hu: %s (%d)",
059c30e4 242 sourceHostnames[ndx], sourcePorts[ndx], strerror(iResult), iResult) );
243 }
244 else {
245 AliError( Form("Error : Error establishing connection to unknown source with index %d: %s (%d)",
246 ndx, strerror(iResult), iResult) );
247 }
248
249 if ( fReader )
250 fLibManager->DeleteReader( fReader );
251 fReader = NULL;
252
51346b82 253 }
059c30e4 254 else {
255 // -- Connection ok - set reader
51346b82 256 fConnected = kTRUE;
257
059c30e4 258 AliInfo( Form("Connection established") );
259 }
51346b82 260
059c30e4 261 delete[] sourceHostnames;
262 delete[] sourcePorts;
51346b82 263
059c30e4 264 return iResult;
265}
266
267//##################################################################################
d810d0de 268void AliEveHOMERManager::DisconnectHOMER(){
46eadbb4 269 // Disconnect from HOMER sources
059c30e4 270
271 if ( ! IsConnected() )
272 return;
273
274 if ( fReader )
275 fLibManager->DeleteReader( fReader );
276 fReader = NULL;
277
278 fStateHasChanged = kTRUE;
279 fConnected = kFALSE;
51346b82 280
059c30e4 281 AliInfo( Form("Connection closed") );
282
283 return;
284}
285
286//##################################################################################
d810d0de 287Int_t AliEveHOMERManager::ReconnectHOMER(){
46eadbb4 288 // Reconnect from HOMER sources
289 // * return 0 on sucess, "ConnectHOMER()" errors on error
059c30e4 290
291 Int_t iResult = 0;
292
293 if ( IsConnected() )
294 DisconnectHOMER();
295
296 iResult = ConnectHOMER();
297 if ( iResult ) {
298 AliError( Form("Error connecting.") );
299 }
300
301 return iResult;
302}
303
059c30e4 304//##################################################################################
d810d0de 305void AliEveHOMERManager::CreateReadoutList( const char** sourceHostnames, UShort_t *sourcePorts, UInt_t &sourceCount ){
46eadbb4 306 // Create a readout list for Hostname and ports
307 // * param socurceHostnames Array of selected hostnames
308 // * param socurcePorts Array of selected ports
309 // * param socurceCount Number of selected hostname:port
059c30e4 310
311 AliHLTHOMERSourceDesc * source= NULL;
312
313 // -- Read all sources and check if they should be read out
314 TIter next( fSourceList );
315 while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) {
316
51346b82 317 if ( ! source->IsSelected() )
059c30e4 318 continue;
51346b82 319
059c30e4 320 Bool_t exists = kFALSE;
321
322 // -- Loop over existing entries and check if entry is already in readout list
323 for ( UInt_t ii = 0; ii < sourceCount; ii++ ){
324 if ( !strcmp( sourceHostnames[ii], source->GetHostname().Data() ) && sourcePorts[ii] == source->GetPort() ) {
325 exists = kTRUE;
326 break;
327 }
328 }
51346b82 329
059c30e4 330 // -- Add new entires to readout list
331 if ( ! exists ) {
332 sourcePorts[sourceCount] = source->GetPort();
333 sourceHostnames[sourceCount] = source->GetHostname().Data();
334 sourceCount++;
335 }
336
337 } // while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) {
338
339 fStateHasChanged = kFALSE;
340
341 return;
342}
343
344/*
345 * ---------------------------------------------------------------------------------
16718cdc 346 * Event Handling
51346b82 347 * ---------------------------------------------------------------------------------
059c30e4 348 */
349
350//##################################################################################
d810d0de 351Int_t AliEveHOMERManager::NextEvent(){
46eadbb4 352 // Loads the next Event, after being connected
353 // * return 0 on sucess, "HOMER" errors on error
51346b82 354
059c30e4 355 Int_t iResult = 0;
7279ee15 356 Int_t iRetryCount = 0;
51346b82 357
059c30e4 358 if ( !fReader || ! IsConnected() ) {
359 AliWarning( Form( "Not connected yet." ) );
360 return 1;
361 }
51346b82 362
7279ee15 363 // fReader->SetEventRequestAdvanceTime( 20000000 /*timeout in us*/ );
364
059c30e4 365 // -- Read next event data and error handling for HOMER (error codes and empty blocks)
366 while( 1 ) {
7279ee15 367
368 iResult = fReader->ReadNextEvent( 40000000 /*timeout in us*/);
51346b82 369
059c30e4 370 if ( iResult == 111 || iResult == 32 || iResult == 6 ) {
371 Int_t ndx = fReader->GetErrorConnectionNdx();
46eadbb4 372 AliError( Form("Error, No Connection to source %d: %s (%d)",
373 ndx, strerror(iResult), iResult) );
46eadbb4 374 return 2;
059c30e4 375 }
376 else if ( iResult == 110 ) {
377 Int_t ndx = fReader->GetErrorConnectionNdx();
46eadbb4 378 AliError( Form("Timout occured, reading event from source %d: %s (%d)",
379 ndx, strerror(iResult), iResult) );
51346b82 380 return 3;
059c30e4 381 }
382 else if ( iResult == 56) {
383 Int_t ndx = fReader->GetErrorConnectionNdx();
7279ee15 384
385 ++iRetryCount;
386
387 if ( iRetryCount >= 20 ) {
388 AliError( Form("Retry Failed: Error reading event from source %d: %s (%d)",
389 ndx, strerror(iResult), iResult) );
390 return 4;
391 }
392 else {
393 AliError( Form("Retry: Error reading event from source %d: %s (%d)",
394 ndx, strerror(iResult), iResult) );
395 continue;
396 }
059c30e4 397 }
398 else if ( iResult ) {
399 Int_t ndx = fReader->GetErrorConnectionNdx();
46eadbb4 400 AliError( Form("General Error reading event from source %d: %s (%d)",
401 ndx, strerror(iResult), iResult) );
402 fConnected = kFALSE;
059c30e4 403 return 2;
404 }
405 else {
406 break;
407 }
408 } // while( 1 ) {
409
51346b82 410 if ( iResult )
059c30e4 411 return iResult;
46eadbb4 412
059c30e4 413 // -- Get blockCnt and eventID
414 fNBlks = (ULong_t) fReader->GetBlockCnt();
415 fEventID = (ULong64_t) fReader->GetEventID();
416 fCurrentBlk = 0;
417
16718cdc 418 AliInfo( Form("Event 0x%016LX (%Lu) with %lu blocks", fEventID, fEventID, fNBlks) );
059c30e4 419
7279ee15 420#if EVE_DEBUG
059c30e4 421 // Loop for Debug only
422 for ( ULong_t i = 0; i < fNBlks; i++ ) {
423 Char_t tmp1[9], tmp2[5];
424 memset( tmp1, 0, 9 );
425 memset( tmp2, 0, 5 );
426 void *tmp11 = tmp1;
427 ULong64_t* tmp12 = (ULong64_t*)tmp11;
428 *tmp12 = fReader->GetBlockDataType( i );
429 void *tmp21 = tmp2;
430 ULong_t* tmp22 = (ULong_t*)tmp21;
431 *tmp22 = fReader->GetBlockDataOrigin( i );
46eadbb4 432 AliInfo( Form("Block %lu length: %lu - type: %s - origin: %s",
433 i, fReader->GetBlockDataLength( i ), tmp1, tmp2) );
059c30e4 434 } // end for ( ULong_t i = 0; i < fNBlks; i++ ) {
059c30e4 435#endif
436
437 // -- Create BlockList
46eadbb4 438 AliInfo( Form("Create Block List") );
439 iResult = CreateBlockList();
059c30e4 440
a15e6d7d 441 return iResult;
059c30e4 442}
443
444//##################################################################################
d810d0de 445Int_t AliEveHOMERManager::CreateBlockList() {
46eadbb4 446 // Create a TList of blocks, which have been readout
059c30e4 447
448 Int_t iResult = 0;
449
450 // -- Initialize block list
451 if ( fBlockList != NULL )
452 delete fBlockList;
453 fBlockList = NULL;
454
455 fBlockList = new TList();
456 fBlockList->SetOwner( kTRUE );
457
458 void* iter = GetFirstBlk();
459
460 // -- Fill block list
461 while ( iter != NULL ){
51346b82 462
059c30e4 463 // -- Create new block
51346b82 464 AliHLTHOMERBlockDesc * block = new AliHLTHOMERBlockDesc( GetBlk(), GetBlkSize(), GetBlkOrigin(),
059c30e4 465 GetBlkType(), GetBlkSpecification() );
51346b82 466
059c30e4 467 // -- Check sources list if block is requested
468 if ( CheckIfRequested( block ) )
51346b82 469 fBlockList->Add( block );
46eadbb4 470 else {
7279ee15 471 //The Following 2 line commented out and the previous is added.
472 // delete block;
473 // block = NULL;
474 fBlockList->Add( block );
46eadbb4 475 }
059c30e4 476 iter = GetNextBlk();
51346b82 477
059c30e4 478 } // while ( iter != NULL ){
51346b82 479
059c30e4 480 return iResult;
481}
482
483/*
484 * ---------------------------------------------------------------------------------
485 * BlockHandling
51346b82 486 * ---------------------------------------------------------------------------------
059c30e4 487 */
488
489//##################################################################################
d810d0de 490void* AliEveHOMERManager::GetBlk( Int_t ndx ) {
46eadbb4 491 // Get pointer to current block in current event
492 // * param ndx Block index
493 // * return returns pointer to blk, NULL if no block present
494
059c30e4 495 void* data = NULL;
51346b82 496
059c30e4 497 if ( !fReader || ! IsConnected() ) {
51346b82 498 AliError( Form("Not connected yet.") );
059c30e4 499 }
500 else {
51346b82 501 if ( ( ndx ) < (Int_t) fNBlks )
059c30e4 502 data = (void*) fReader->GetBlockData( ndx );
503 }
504
505 return data;
506}
507
508//##################################################################################
d810d0de 509ULong_t AliEveHOMERManager::GetBlkSize( Int_t ndx ) {
46eadbb4 510 // Get size of block ndx
511 // * param ndx Block index
512 // * return returns pointer to blk, 0 if no block present
513
059c30e4 514 ULong_t length = 0;
515
516 if ( !fReader || ! IsConnected() ) {
51346b82 517 AliError( Form("Not connected yet.") );
059c30e4 518 }
519 else {
51346b82 520 if ( ( ndx ) < (Int_t) fNBlks )
059c30e4 521 length = (ULong_t) fReader->GetBlockDataLength( ndx );
522 }
523
524 return length;
525}
526
527//##################################################################################
d810d0de 528TString AliEveHOMERManager::GetBlkOrigin( Int_t ndx ) {
46eadbb4 529 // Get origin of block ndx
530 // * param ndx Block index
531 // * return origin of block
059c30e4 532
533 TString origin = "";
534
535 // -- Check for Connection
536 if ( !fReader || ! IsConnected() ) {
51346b82 537 AliError( Form("Not connected yet.") );
059c30e4 538 return origin;
539 }
540
541 // -- Check block index
542 if ( ( ndx ) >= (Int_t) fNBlks ) {
51346b82 543 AliError( Form("Block index %d out of range.", ndx ) );
544 return origin;
059c30e4 545 }
546
547 // -- Get origin
548 union{
549 UInt_t data;
550 Char_t array[4];
551 } reverseOrigin;
552
553 reverseOrigin.data = (UInt_t) fReader->GetBlockDataOrigin( ndx );
554
555 // -- Reverse the order
556 for (Int_t ii = 3; ii >= 0; ii-- )
557 if ( reverseOrigin.array[ii] != ' ')
558 origin.Append( reverseOrigin.array[ii] );
559
560 return origin;
561}
562
563//##################################################################################
7279ee15 564TString AliEveHOMERManager::GetBlkType( Int_t ndx ) {
46eadbb4 565 // Get type of block ndx
566 // * param ndx Block index
567 // * return type of block
059c30e4 568
569 TString type = "";
570
571 // -- Check for Connection
572 if ( !fReader || ! IsConnected() ) {
51346b82 573 AliError( Form("Not connected yet.") );
059c30e4 574 return type;
575 }
576
577 // -- Check blockk index
578 if ( ( ndx ) >= (Int_t) fNBlks ) {
51346b82 579 AliError( Form("Block index %d out of range.", ndx ) );
580 return type;
059c30e4 581 }
582
583 // -- Get type
584 union{
585 ULong64_t data;
586 Char_t array[8];
587 } reverseType;
588
589 reverseType.data = (ULong64_t) fReader->GetBlockDataType( ndx );
590
591 // -- Reverse the order
592 for (Int_t ii = 7; ii >= 0; ii-- )
593 if ( reverseType.array[ii] != ' ')
594 type.Append( reverseType.array[ii] );
595
596 return type;
597}
598
059c30e4 599//##################################################################################
7279ee15 600ULong_t AliEveHOMERManager::GetBlkSpecification( Int_t ndx ) {
46eadbb4 601 // Get specification of block ndx
602 // * param ndx Block index
603 // * return specification of block
059c30e4 604
605 ULong_t spec = 0;
606
059c30e4 607 // -- Check for Connection
608 if ( !fReader || ! IsConnected() ) {
51346b82 609 AliError( Form("Not connected yet.") );
059c30e4 610 return spec;
611 }
612
613 // -- Check blockk index
614 if ( ( ndx ) >= (Int_t) fNBlks ) {
51346b82 615 AliError( Form("Block index %d out of range.", ndx ) );
616 return spec;
059c30e4 617 }
51346b82 618
059c30e4 619 spec = (ULong_t) fReader->GetBlockDataSpec( ndx );
620
621 return spec;
622}
623
624//##################################################################################
d810d0de 625Bool_t AliEveHOMERManager::CheckIfRequested( AliHLTHOMERBlockDesc * block ) {
46eadbb4 626 // Checks if current Block should was requested
627 // * return returns kTRUE, if block should was requested
059c30e4 628
629 Bool_t requested = kFALSE;
51346b82 630
059c30e4 631 AliHLTHOMERSourceDesc * source= NULL;
51346b82 632
059c30e4 633 // -- Read all sources and check if they should be read out
634 TIter next( fSourceList );
635 while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) {
7279ee15 636
51346b82 637 if ( ! source->IsSelected() )
059c30e4 638 continue;
639
7279ee15 640 if ( !( block->GetDetector().CompareTo( "*** " ) && block->GetDetector().CompareTo( "***" ) ) ) {
641 // if not any detector
642 if ( source->GetDetector().CompareTo( block->GetDetector() ) )
643 continue;
644 }
059c30e4 645
7279ee15 646 if ( ! ( block->GetDataType().CompareTo( "******* " ) && block->GetDataType().CompareTo( "******* " ) ) ) {
647 if ( source->GetDataType().CompareTo( block->GetDataType() ) )
648 continue;
649 }
059c30e4 650
651 if ( ! block->HasSubDetectorRange() ) {
6612c5b3 652 if ( source->GetSubDetector().Atoi() != block->GetSubDetector().Atoi() )
059c30e4 653 continue;
51346b82 654
059c30e4 655 if ( ! block->HasSubSubDetectorRange() ) {
51346b82 656
46eadbb4 657 if ( source->GetSubSubDetector().Atoi() != block->GetSubSubDetector().Atoi() )
658 continue;
51346b82 659
059c30e4 660 } // if ( ! block->HasSubSubDetectorRange ) {
661 } // if ( ! block->HasSubDetectorRange ) {
51346b82 662
059c30e4 663 requested = kTRUE;
7279ee15 664 break;
51346b82 665
059c30e4 666 } // while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) {
7279ee15 667
668#if EVE_DEBUG
51346b82 669
7279ee15 670 if ( block->GetDataType().CompareTo("CLUSTERS") ) {
671 if ( requested ) {
672 AliError( Form("Block requested : %s - %s : %s/%s -> %s ", block->GetDetector().Data(), block->GetDataType().Data(),
673 block->GetSubDetector().Data(), block->GetSubSubDetector().Data(), block->GetClassName().Data() ) );
059c30e4 674 }
7279ee15 675 else {
676 AliError( Form("Block NOT requested : %s - %s : %s/%s -> %s ", block->GetDetector().Data(), block->GetDataType().Data(),
677 block->GetSubDetector().Data(), block->GetSubSubDetector().Data(), block->GetClassName().Data() ) );
678 }
679
680 }
681#endif
059c30e4 682
683 return requested;
684}
685
46eadbb4 686/*
687 * ---------------------------------------------------------------------------------
688 * Test Realm ....
689 * ---------------------------------------------------------------------------------
690 */
51346b82 691
6612c5b3 692//##################################################################################
d810d0de 693void AliEveHOMERManager::DumpTPCCalib(TString objectName, Bool_t dumpToFile) {
46eadbb4 694 // Still under testing ...
6612c5b3 695
696 if ( fTPCPre != NULL )
697 delete fTPCPre;
698
699 fTPCPre = new AliTPCPreprocessorOnline();
700
701 TList* blockList = GetBlockList();
702
703 AliHLTHOMERBlockDesc *desc = 0;
704
705 TIter next(blockList);
51346b82 706
6612c5b3 707 while ( ( desc = (AliHLTHOMERBlockDesc*)next() ) ) {
708 if ( ! desc->IsTObject() )
709 continue;
51346b82 710
6612c5b3 711 Int_t sectorTPC = 0;
712
713 if ( desc->GetSubSubDetector().Atoi() <= 1 ) {
714 sectorTPC = desc->GetSubDetector().Atoi();
715 }
716 else {
717 sectorTPC = 36 + desc->GetSubDetector().Atoi();
718 }
51346b82 719
6612c5b3 720 if ( ! objectName.CompareTo( desc->GetClassName() ) ){
721
722 //
723 // AliTPCCalibPedestal
724 //
725
726 if ( ! objectName.CompareTo( "AliTPCCalibPedestal" ) ) {
727 AliTPCCalROC* calROC = NULL;
51346b82 728
6612c5b3 729 AliTPCCalibPedestal * cal = (AliTPCCalibPedestal*) desc->GetTObject();
730 if ( cal == NULL ) {
731 cout << "error 1" << endl;
732 continue;
733 }
51346b82 734
6612c5b3 735 cal->Analyse();
736
737 calROC = cal->GetCalRocRMS(sectorTPC);
738 if ( calROC == NULL ) {
739 cout << "error 2" << endl;
740 continue;
741 }
51346b82 742
6612c5b3 743 calROC->SetName(Form("RMS_ROC%d", sectorTPC));
744 fTPCPre->AddComponent((TObject*) calROC );
059c30e4 745
6612c5b3 746 calROC = cal->GetCalRocPedestal(sectorTPC);
747 if ( calROC == NULL ) {
748 cout << "error 3" << endl;
749 continue;
750 }
51346b82 751
6612c5b3 752
753 calROC->SetName(Form("Pedestal_ROC%d", sectorTPC));
754 cout << "added" << endl;
755 fTPCPre->AddComponent((TObject*) calROC );
756 }
757
758 //
759 // AliTPCCalibPulser
760 //
761 /*
762 else if ( ! objectName.CompareTo( "AliTPCCalibPulser" ) ) {
763 AliTPCCalROC* calROC = NULL;
764
765 AliTPCCalibPulser * cal = (AliTPCCalibPulser*) desc->GetTObject();
766
767 cal->Analyse();
51346b82 768
6612c5b3 769 calROC = cal->GetCalRocT0(sectorTPC);
770 calROC->SetName(Form("T0_ROC%d", sectorTPC));
771 fTPCPre->AddComponent((TObject*) calROC );
772
773 calROC = cal->GetCalRocQ(sectorTPC);
774 calROC->SetName(Form("Q_ROC%d", sectorTPC));
775 fTPCPre->AddComponent((TObject*) calROC );
776
777 calROC = cal->GetCalRocRMS(sectorTPC);
778 calROC->SetName(Form("RMS_ROC%d", sectorTPC));
779 fTPCPre->AddComponent((TObject*) calROC );
780
781 calROC = cal->GetCalRocOutliers(sectorTPC);
782 calROC->SetName(Form("Outliers_ROC%d", sectorTPC));
783 fTPCPre->AddComponent((TObject*) calROC );
784 }
51346b82 785
6612c5b3 786*/
787 //
788 // AliTPCCalibCE
789 //
790 /*
791 else if ( ! objectName.CompareTo( "AliTPCCalibCE" ) ) {
792 AliTPCCalROC* calROC = NULL;
793
794 AliTPCCalibPulser * cal = (AliTPCCalibPulser*) desc->GetTObject();
795
796 cal->Analyse();
51346b82 797
6612c5b3 798 calROC = cal->GetCalRocT0(sectorTPC);
799 calROC->SetName(Form("T0_ROC%d", sectorTPC));
800 fTPCPre->AddComponent((TObject*) calROC );
801
802 calROC = cal->GetCalRocQ(sectorTPC);
803 calROC->SetName(Form("Q_ROC%d", sectorTPC));
804 fTPCPre->AddComponent((TObject*) calROC );
805
806 calROC = cal->GetCalRocRMS(sectorTPC);
807 calROC->SetName(Form("RMS_ROC%d", sectorTPC));
808 fTPCPre->AddComponent((TObject*) calROC );
809
810 calROC = cal->GetCalRocOutliers(sectorTPC);
811 calROC->SetName(Form("Outliers_ROC%d", sectorTPC));
812 fTPCPre->AddComponent((TObject*) calROC );
813 }
814 */
815 } // if ( ! objectName.CompareTo( desc->GetClassName() ) ) {
51346b82 816
6612c5b3 817 } // while ( ( desc = (AliHLTHOMERBlockDesc*)next() ) ) {
818
819 if ( dumpToFile ) {
820
821 fTPCPre->DumpToFile("pedestals.root");
822 cout << "DUMP" << endl;
823 }
824
825
826}