1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include <TTimeStamp.h>
7 #include <TObjString.h>
10 #include <AliDCSValue.h>
13 //////////////////////////////////////////////////////////////////////////////////////
14 // Generator of testing data for AliITSDCSPreprocessorSDD and AliITSAnalyzerrSDD //
15 // Origin: F.Prino, Torino, prino@to.infn.it //
16 // V.Pospisil, CTU Prague, gdermog@seznam.cz //
17 //////////////////////////////////////////////////////////////////////////////////////
19 TMap* CreateRealisticMap( TTimeStamp startTime, TTimeStamp stopTime );
20 TMap* CreateRandomMap( Int_t maxRecords = 1000, Int_t randomTimeStamps = 0 );
21 void GenerateOutputFiles( TMap *map, char *dir );
23 Int_t sizeOfMapContent = 0;
25 void CreateSDDDCSMap( void )
28 TTimeStamp startT( 2008, 2, 7, 15, 0, 0 );
29 TTimeStamp stopT( 2008, 2, 7, 18, 0, 0 );
30 // The beginning and the end of the simulated run
33 // gRandom = new TRandom2;
36 /* Macro can generate random purely random data or simulate DCS. Choose
37 one of the methods - CreateRandomMap() or CreateRealisticMap() */
39 // TMap *outMap = CreateRandomMap( 1000 );
40 TMap *outMap = CreateRealisticMap( startT, stopT );
42 GenerateOutputFiles( outMap, "./maps_3h_SIM" );
44 TFile newfile( "DCSAliasMap_3h_SIM.root", "RECREATE" );
46 printf( "Writting map into the file ...\n");
48 outMap->Write( "DCSAliasMap", TObject::kSingleKey );
50 printf( "DCSAliasMap created, it size is %i byte ...\n", sizeOfMapContent );
55 /***************************************************************/
56 /* DCS simulation setup - used in CreateRealisticMap() */
57 /* Choose simulation setup by changing following variables */
58 /***************************************************************/
60 // --- Temperature (left side) - behavior of SDD chip -----------
62 Float_t mvalTL = 20.0; // Mean value of temperature
63 Float_t fluctTL = 0.5; // Fluctuation (gaussian sigma)
65 // --- Temperature readout (left side) - behavior of DCS --------
67 Int_t freqROTL = 300; // Frequency of fixed readout
68 Float_t fluctROTL = 5.0;
69 // Allowed fluctuation (%)
71 // Temperature readout status (left side) - behavior of SDD chip
73 Int_t freqROStTL = 300;// Frequency of fixed readout
74 Float_t failureTL = 0.01;
75 // Probability of thermometer
76 // failure (in one hour)
78 // --- Temperature (right side) - behavior of SDD chip ----------
80 Float_t mvalTR = 20.0; // Mean value of temperature
81 Float_t fluctTR = 0.5;// Fluctuation (gaussian sigma)
83 // --- Temperature readout (right side) - behavior of DCS -------
85 Int_t freqROTR = 300; // Frequency of fixed readout
86 Float_t fluctROTR = 5.0;
87 // Allowed fluctuation (%)
89 // Temperature readout status (right side) - behavior of SDD
91 Int_t freqROStTR = 300;// Frequency of fixed readout
92 Float_t failureTR = 0.01;
93 // Probability of thermometer
94 // failure (in one hour)
96 // --- High voltage - behavior of SDD voltage source -----------
98 Float_t mvalHV = 1791.0;
100 Float_t fluctHV = 0.03;// Fluctuation (gaussian sigma)
102 // --- High voltage readout - behavior of DCS -------------------
104 Int_t freqROHV = 300; // Frequency of fixed readout
105 Float_t fluctROHV = 0.01;
106 // Allowed fluctuation (%)
108 // --- High voltage readout status - behavior of SDD voltage ----
110 Int_t freqROOK = 300; // Frequency of fixed readout
111 Float_t failureHV = 0.005;
112 // Probability of HV source
113 // failure (in one hour)
115 // --- Medium voltage - behavior of SDD voltage source --------
117 Float_t mvalMV = 45.0; // Mean value of MV
118 Float_t fluctMV = 0.005;
119 // Fluctuation (gaussian sigma)
121 // --- Medium voltage readout - behavior of DCS -----------------
123 Int_t freqROMV = 300; // Frequency of fixed readout
124 Float_t fluctROMV = 0.1;
125 // Allowed fluctuation (%)
127 // --- Medium voltage readout status - behavior of SDD voltage --
129 Float_t failureMV = 0.005;
130 // Probability of MV source
131 // failure (in one hour)
133 /***************************************************************/
134 /* ITS geometry setup */
135 /***************************************************************/
142 /***************************************************************/
144 //----------------------------------------------------------------------------------------
146 TMap* CreateRealisticMap( TTimeStamp startTime, TTimeStamp stopTime )
148 // Creates a DCS structure
149 // The structure is the following:
150 // TMap (key --> value)
151 // <DCSAlias> --> <valueList>
152 // <DCSAlias> is a string
153 // <valueList> is a TObjArray of AliDCSValue
154 // An AliDCSValue consists of timestamp and a value in form of a AliSimpleValue
156 TMap* aliasMap = new TMap;
157 aliasMap->SetOwner(1);
158 // Empty map is created
160 sizeOfMapContent += sizeof( TMap );
165 Int_t created1 = 0; // DCS records counter
167 Double_t failureTLpersec;
168 Double_t failureTRpersec;
169 Double_t failureHVpersec;
170 Double_t failureMVpersec;
171 // Probabilities of failure per one second
173 lambda = ( TMath::Log( 1.0 - failureTL ) ) / -3600.0;
174 failureTLpersec = 1.0 - TMath::Exp(-lambda );
175 lambda = ( TMath::Log( 1.0 - failureTR ) ) / -3600.0;
176 failureTRpersec = 1.0 - TMath::Exp(-lambda );
177 lambda = ( TMath::Log( 1.0 - failureHV ) ) / -3600.0;
178 failureHVpersec = 1.0 - TMath::Exp(-lambda );
179 lambda = ( TMath::Log( 1.0 - failureMV ) ) / -3600.0;
180 failureMVpersec = 1.0 - TMath::Exp(-lambda );
181 // Probabilities of failure per one second are counted
186 fluctROMV /= 100.0; // Percents to fractions
188 Double_t failureOK = ( failureHV + failureMV ) / 2.0;
189 // This value is used only for noise in timing
191 for( Int_t iLay = 3; iLay < 5; iLay++ )
194 Int_t maxLad = ( iLay == 3) ? kNladders3 : kNladders4;
195 Int_t maxMod = ( iLay == 3) ? kNmodLad3 : kNmodLad4;
197 for(Int_t iLad=0; iLad<maxLad; iLad++)
199 for(Int_t iMod=0; iMod<maxMod; iMod++)
202 fprintf( stderr, "Simulating data taking for layer %i, ladder %i, module %i ... \n", iLay, iLad, iMod );
204 TObjArray* valueSetOK = new TObjArray;
205 TObjArray* valueSetHV = new TObjArray;
206 TObjArray* valueSetMV = new TObjArray;
207 TObjArray* valueSetTL = new TObjArray;
208 TObjArray* valueSetTR = new TObjArray;
209 TObjArray* valueSetStTL = new TObjArray;
210 TObjArray* valueSetStTR = new TObjArray;
212 sizeOfMapContent += 7 * sizeof( TObjArray );
214 valueSetOK->SetOwner(1);
215 valueSetHV->SetOwner(1);
216 valueSetMV->SetOwner(1);
217 valueSetTL->SetOwner(1);
218 valueSetTR->SetOwner(1);
219 valueSetStTL->SetOwner(1);
220 valueSetStTR->SetOwner(1);
222 Float_t actualTL, actualTR;
223 Float_t actualHV, actualMV;
224 Int_t actualStTL = 1;
225 Int_t actualStTR = 1;
226 Int_t actualStHV = 1;
227 Int_t actualStMV = 1;
228 // Readout devices are alive/dead
230 Float_t lastTL = mvalTL;
231 Float_t lastTR = mvalTR;
232 Float_t lastHV = mvalHV;
233 Float_t lastMV = mvalMV;
234 // Last written values - udes for threshold readout
240 Int_t counterStTL = 0;
241 Int_t counterStTR = 0;
243 // Periodic readout counters
245 Int_t endingTimeStamp = /*1197477000;*/ stopTime.GetSec();
247 for( Int_t timeLoop = /*1197470000 */ startTime.GetSec(); timeLoop < endingTimeStamp; timeLoop ++ )
248 { // Loop goes through period of run second per second and determines
249 // all values according to rules of DCS
251 actualTL = gRandom->Gaus( mvalTL, fluctTL );
252 actualTR = gRandom->Gaus( mvalTR, fluctTR );
253 actualHV = gRandom->Gaus( mvalHV, fluctHV );
254 actualMV = gRandom->Gaus( mvalMV, fluctMV );
255 // Generates random values of temperatures and voltages
258 if( gRandom->Rndm() < failureTLpersec )
259 if( actualStTL ) actualStTL = 0; else if( gRandom->Rndm() < 0.1 ) actualStTL = 1;
260 if( gRandom->Rndm() < failureTRpersec )
261 if( actualStTR ) actualStTR = 0; else if( gRandom->Rndm() < 0.1 ) actualStTR = 1;
262 if( gRandom->Rndm() < failureHVpersec )
263 if( actualStHV ) actualStHV = 0; else if( gRandom->Rndm() < 0.1 ) actualStHV = 1;
264 if( gRandom->Rndm() < failureMVpersec )
265 if( actualStMV ) actualStMV = 0; else if( gRandom->Rndm() < 0.1 ) actualStMV = 1;
266 // Decides if any thermometer or voltage source becomes
267 // dead (or alive again, but this have much 10x les probability )
269 if( gRandom->Rndm() < failureTL ) counterTL++;
270 if( gRandom->Rndm() < failureTL ) counterTL--;
271 if( gRandom->Rndm() < failureTR ) counterTR++;
272 if( gRandom->Rndm() < failureTR ) counterTR--;
273 if( gRandom->Rndm() < failureHV ) counterHV++;
274 if( gRandom->Rndm() < failureHV ) counterHV--;
275 if( gRandom->Rndm() < failureMV ) counterMV++;
276 if( gRandom->Rndm() < failureMV ) counterMV--;
277 if( gRandom->Rndm() < failureTL ) counterStTL++;
278 if( gRandom->Rndm() < failureTL ) counterStTL--;
279 if( gRandom->Rndm() < failureTR ) counterStTR++;
280 if( gRandom->Rndm() < failureTR ) counterStTR--;
281 if( gRandom->Rndm() < failureOK ) counterOK++;
282 if( gRandom->Rndm() < failureOK ) counterOK--;
283 // Simulating noise in the clock frequency
285 if( counterTL >= freqROTL )
286 { valueSetTL->Add( new AliDCSValue( actualTL, timeLoop ) ); lastTL = actualTL; counterTL = 0; created++; }
287 if( counterTR >= freqROTR )
288 { valueSetTR->Add( new AliDCSValue( actualTR, timeLoop ) ); lastTR = actualTR; counterTR = 0; created++; }
289 if( counterHV >= freqROHV )
290 { valueSetHV->Add( new AliDCSValue( actualHV, timeLoop ) ); lastHV = actualHV; counterHV = 0; created++; }
291 if( counterMV >= freqROMV )
292 { valueSetMV->Add( new AliDCSValue( actualMV, timeLoop ) ); lastMV = actualMV; counterMV = 0; created++; }
293 if( counterStTL >= freqROStTL )
294 { valueSetStTL->Add( new AliDCSValue( actualStTL, timeLoop ) ); counterStTL = 0; created++; }
295 if( counterStTR >= freqROStTR )
296 { valueSetStTR->Add( new AliDCSValue( actualStTR, timeLoop ) ); counterStTR = 0; created++; }
297 if( counterOK >= freqROOK )
298 { valueSetOK->Add( new AliDCSValue( (Bool_t)(actualStHV & actualStMV), timeLoop ) ); counterOK = 0; created++; }
301 if( TMath::Abs( (lastTL - actualTL) / lastTL ) > fluctROTL )
302 { valueSetTL->Add( new AliDCSValue( actualTL, timeLoop ) ); lastTL = actualTL; counterTL = 0; created1++; }
303 if( TMath::Abs( (lastTR - actualTR) / lastTR ) > fluctROTR )
304 { valueSetTR->Add( new AliDCSValue( actualTR, timeLoop ) ); lastTR = actualTR; counterTR = 0; created1++; }
305 if( TMath::Abs( (lastHV - actualHV) / lastHV ) > fluctROHV )
306 { valueSetHV->Add( new AliDCSValue( actualHV, timeLoop ) ); lastHV = actualHV; counterHV = 0; created1++; }
307 if( TMath::Abs( (lastMV - actualMV) / lastMV ) > fluctROMV )
308 { valueSetMV->Add( new AliDCSValue( actualMV, timeLoop ) ); lastMV = actualMV; counterMV = 0; created1++; }
319 } /*for( timeLoop )*/
321 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_OK", iLay, iLad, iMod );
323 aliasMap->Add( new TObjString(aliasName), valueSetOK );
325 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_HV", iLay, iLad, iMod );
327 aliasMap->Add( new TObjString(aliasName), valueSetHV );
329 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_MV", iLay, iLad, iMod );
331 aliasMap->Add( new TObjString(aliasName), valueSetMV );
333 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_L", iLay, iLad, iMod );
335 aliasMap->Add( new TObjString(aliasName), valueSetTL );
337 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_R", iLay, iLad, iMod );
339 aliasMap->Add( new TObjString(aliasName), valueSetTR );
341 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_L_STATE", iLay, iLad, iMod );
343 aliasMap->Add( new TObjString(aliasName), valueSetStTL );
345 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_R_STATE", iLay, iLad, iMod );
347 aliasMap->Add( new TObjString(aliasName), valueSetStTR );
353 fprintf( stderr, "\nCreated %i objects of type AliDCSValue (%i periodic + %i treshold)... \n",
354 created + created1, created, created1 );
356 sizeOfMapContent += (created + created1 ) * ( sizeof( AliDCSValue ) + sizeof( AliDCSValue * ) );
360 } /*CreateRealisticMap*/
362 //----------------------------------------------------------------------------------------
365 TMap* CreateRandomMap( Int_t maxRecords , Int_t randomTimeStamps )
367 // Creates a DCS structure
368 // The structure is the following:
369 // TMap (key --> value)
370 // <DCSAlias> --> <valueList>
371 // <DCSAlias> is a string
372 // <valueList> is a TObjArray of AliDCSValue
373 // An AliDCSValue consists of timestamp and a value in form of a AliSimpleValue
376 TMap* aliasMap = new TMap;
377 aliasMap->SetOwner(1);
379 sizeOfMapContent += sizeof( TMap );
385 for( Int_t iLay = 3; iLay < 5; iLay++ )
388 Int_t maxLad = ( iLay == 3) ? kNladders3 : kNladders4;
389 Int_t maxMod = ( iLay == 3) ? kNmodLad3 : kNmodLad4;
391 for(Int_t iLad = 0; iLad < maxLad; iLad++)
393 for(Int_t iMod =0 ; iMod < maxMod;iMod++)
396 fprintf( stderr, "Generating data for layer %i, ladder %i, module %i ... \n", iLay, iLad, iMod );
398 TObjArray* valueSetOK = new TObjArray;
399 TObjArray* valueSetH = new TObjArray;
400 TObjArray* valueSetM = new TObjArray;
401 TObjArray* valueSetTL = new TObjArray;
402 TObjArray* valueSetTR = new TObjArray;
403 TObjArray* valueSetStTL = new TObjArray;
404 TObjArray* valueSetStTR = new TObjArray;
406 sizeOfMapContent += 7 * sizeof( TObjArray );
408 valueSetOK->SetOwner(1);
409 valueSetH->SetOwner(1);
410 valueSetM->SetOwner(1);
411 valueSetTL->SetOwner(1);
412 valueSetTR->SetOwner(1);
413 valueSetStTL->SetOwner(1);
414 valueSetStTR->SetOwner(1);
420 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_OK", iLay,iLad,iMod);
422 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ) );
423 timeStamp = 1000000000;
424 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
426 if( randomTimeStamps )
427 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
429 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
430 if( 1000*(gRandom->Rndm()) > 50 )
431 dcsVal = new AliDCSValue((Bool_t)1, timeStamp);
433 dcsVal = new AliDCSValue((Bool_t)0, timeStamp);
434 valueSetOK->Add(dcsVal);
436 aliasMap->Add(new TObjString(aliasName), valueSetOK);
437 created += nrOfRecords;
439 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_HV", iLay, iLad,iMod);
441 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ));
442 timeStamp = 1000000000;
443 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
445 if( randomTimeStamps )
446 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
448 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
449 dcsVal = new AliDCSValue( (Float_t)( 1600 + 200*(gRandom->Rndm()) ), timeStamp );
450 valueSetH->Add(dcsVal);
452 aliasMap->Add(new TObjString(aliasName), valueSetH);
453 created += nrOfRecords;
455 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_MV", iLay, iLad,iMod);
457 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ));
458 timeStamp = 1000000000;
459 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
461 if( randomTimeStamps )
462 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
464 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
465 dcsVal = new AliDCSValue( (Float_t)( 30 + 20*(gRandom->Rndm()) ), timeStamp );
466 valueSetM->Add(dcsVal);
468 aliasMap->Add(new TObjString(aliasName), valueSetM);
469 created += nrOfRecords;
471 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_L", iLay, iLad,iMod);
473 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ));
474 timeStamp = 1000000000;
475 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
477 if( randomTimeStamps )
478 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
480 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
481 dcsVal = new AliDCSValue( (Float_t)( 50 + 50*(gRandom->Rndm()) ), timeStamp );
482 valueSetTL->Add(dcsVal);
484 aliasMap->Add(new TObjString(aliasName), valueSetTL);
485 created += nrOfRecords;
487 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_R", iLay, iLad,iMod);
489 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ));
490 timeStamp = 1000000000;
491 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
493 if( randomTimeStamps )
494 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
496 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
497 dcsVal = new AliDCSValue( (Float_t)( 50 + 50*(gRandom->Rndm()) ), timeStamp );
498 valueSetTR->Add(dcsVal);
500 aliasMap->Add(new TObjString(aliasName), valueSetTR);
501 created += nrOfRecords;
503 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_L_STATE", iLay, iLad,iMod);
505 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ));
506 timeStamp = 1000000000;
507 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
509 if( randomTimeStamps )
510 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
512 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
513 if( 1000*(gRandom->Rndm()) > 50 )
514 dcsVal = new AliDCSValue((Int_t)1, timeStamp);
516 dcsVal = new AliDCSValue((Int_t)0, timeStamp);
517 valueSetStTL->Add(dcsVal);
519 aliasMap->Add(new TObjString(aliasName), valueSetStTL);
520 created += nrOfRecords;
522 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_R_STATE", iLay, iLad,iMod);
524 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ));
525 timeStamp = 1000000000;
526 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
528 if( randomTimeStamps )
529 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
531 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
532 if( 1000*(gRandom->Rndm()) > 50 )
533 dcsVal = new AliDCSValue((Int_t)1, timeStamp);
535 dcsVal = new AliDCSValue((Int_t)0, timeStamp);
536 valueSetStTR->Add(dcsVal);
539 aliasMap->Add(new TObjString(aliasName), valueSetStTR);
540 created += nrOfRecords;
547 fprintf( stderr, "\nCreated %i objects of type AliDCSValue ... \n", created);
549 sizeOfMapContent += created * ( sizeof( AliDCSValue ) + sizeof( AliDCSValue * ) );
554 // -----------------------------------------------------------------------------
556 void GenerateOutputFiles( TMap *map, char *dir )
560 char buffer[100],cmd[100];
561 Int_t nHVEntries, nMVEntries, nTLEntries, nTREntries;
562 Int_t nOKEntries, nStTLEntries, nStTREntries;
564 sprintf(cmd,"ls -l %s >/dev/null 2>&1",dir);
565 if(gSystem->Exec(cmd)!=0){
566 printf("%s --- NOT EXISTS -- create it\n",dir);
567 sprintf(cmd,"mkdir %s",dir);
571 for( Int_t iLay = 3; iLay < 5; iLay++ )
574 Int_t maxLad = ( iLay == 3) ? kNladders3 : kNladders4;
575 Int_t maxMod = ( iLay == 3) ? kNmodLad3 : kNmodLad4;
577 for(Int_t iLad = 0; iLad < maxLad; iLad++)
581 for(Int_t iMod = 0; iMod < maxMod; iMod++)
584 sprintf( buffer, "%s/DCSMapContent_SDD_LAYER%i_LADDER%02d_MODULE%d.txt", dir, iLay, iLad, iMod );
586 fprintf( stderr, "Creating file %s ... ", buffer );
587 outputFile = fopen( buffer, "w" );
588 if( outputFile == NULL )
590 fprintf( stderr, "failed!\n" );
594 fprintf( stderr, "\n" );
597 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_HV", iLay, iLad, iMod );
598 TObjArray* arrHV = (TObjArray*) map->GetValue( buffer );
601 fprintf( stderr, "Map record %s does not exist!\n", buffer );
605 nHVEntries = arrHV->GetEntries();
607 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_MV", iLay, iLad, iMod );
608 TObjArray* arrMV = (TObjArray*) map->GetValue( buffer );
611 fprintf( stderr, "Map record %s does not exist!\n", buffer );
615 nMVEntries = arrMV->GetEntries();
617 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_L", iLay, iLad, iMod );
618 TObjArray* arrTL = (TObjArray*) map->GetValue( buffer );
621 fprintf( stderr, "Map record %s does not exist!\n", buffer );
625 nTLEntries = arrTL->GetEntries();
627 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_R", iLay, iLad, iMod );
628 TObjArray* arrTR = (TObjArray*) map->GetValue( buffer );
631 fprintf( stderr, "Map record %s does not exist!\n", buffer );
635 nTREntries = arrTR->GetEntries();
637 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_L_STATE", iLay, iLad, iMod );
638 TObjArray* arrStTL = (TObjArray*) map->GetValue( buffer );
639 if( arrStTL == NULL )
641 fprintf( stderr, "Map record %s does not exist!\n", buffer );
645 nStTLEntries = arrStTL->GetEntries();
647 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_R_STATE", iLay, iLad, iMod );
648 TObjArray* arrStTR = (TObjArray*) map->GetValue( buffer );
649 if( arrStTR == NULL )
651 fprintf( stderr, "Map record %s does not exist!\n", buffer );
655 nStTREntries = arrStTR->GetEntries();
657 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_OK", iLay, iLad, iMod );
658 TObjArray* arrOK = (TObjArray*) map->GetValue( buffer );
661 fprintf( stderr, "Map record %s does not exist!\n", buffer );
665 nOKEntries = arrOK->GetEntries();
667 fprintf( outputFile, "+-----------------------------------------------------------------------");
668 fprintf( outputFile, "------------------------------------------------------------------------+\n" );
669 fprintf( outputFile, "| DCS Map content for SDD_LAYER%i_LADDER%02d_MODULE%d" , iLay, iLad, iMod);
670 fprintf( outputFile, " |\n" );
671 fprintf( outputFile, "+----------------------+----------------------+---------------------+----------------------+");
672 fprintf( outputFile, "-----------------+-----------------+----------------+\n" );
673 fprintf( outputFile, "| %05i records | %05i records | %05i records | %05i records | %05i records |",
674 nHVEntries, nMVEntries, nTLEntries, nTREntries, nStTLEntries );
675 fprintf( outputFile, " %05i records | %05i records |\n", nStTREntries, nOKEntries );
677 fprintf( outputFile, "| time (s) HV | time (s) MV | time (s) TL | time (s) TR | time (s) StTL |" );
678 fprintf( outputFile, " time (s) StTR | time (s) OK |\n" );
679 fprintf( outputFile, "+----------------------+----------------------+---------------------+---------------------+");
680 fprintf( outputFile, "-----------------+-----------------+-----------------+\n" );
684 Int_t a = (nHVEntries > nMVEntries ) ? nHVEntries : nMVEntries;
685 Int_t b = (nTLEntries > nTREntries ) ? nTLEntries : nTREntries;
686 Int_t c = (nStTLEntries > nStTREntries ) ? nStTLEntries : nStTREntries;
687 if( a < b ) a = b; if( c < nOKEntries ) c = nOKEntries;
688 Int_t loopMax = ( a > c ) ? a : c ;
689 // Finds maximal entry number
693 for( Int_t entryLoop = 0; entryLoop < loopMax; entryLoop++ )
696 if( entryLoop < nHVEntries )
697 fprintf( outputFile, "| %12i %4.2f | ", ((AliDCSValue*)arrHV->At(entryLoop))->GetTimeStamp(),
698 ((AliDCSValue*)arrHV->At(entryLoop))->GetFloat() );
700 fprintf( outputFile, "| | ");
702 if( entryLoop < nMVEntries )
703 fprintf( outputFile, " %12i %2.3f | ", ((AliDCSValue*)arrMV->At(entryLoop))->GetTimeStamp(),
704 ((AliDCSValue*)arrMV->At(entryLoop))->GetFloat() );
706 fprintf( outputFile, " | ");
708 if( entryLoop < nTLEntries )
709 fprintf( outputFile, "%12i %2.2f | ", ((AliDCSValue*)arrTL->At(entryLoop))->GetTimeStamp(),
710 ((AliDCSValue*)arrTL->At(entryLoop))->GetFloat() );
712 fprintf( outputFile, " | ");
714 if( entryLoop < nTREntries )
715 fprintf( outputFile, "%12i %2.2f | ", ((AliDCSValue*)arrTR->At(entryLoop))->GetTimeStamp(),
716 ((AliDCSValue*)arrTR->At(entryLoop))->GetFloat() );
718 fprintf( outputFile, " | ");
720 if( entryLoop < nStTLEntries )
721 fprintf( outputFile, "%12i %i | ", ((AliDCSValue*)arrStTL->At(entryLoop))->GetTimeStamp(),
722 ((AliDCSValue*)arrStTL->At(entryLoop))->GetInt() );
724 fprintf( outputFile, " | ");
726 if( entryLoop < nStTREntries )
727 fprintf( outputFile, "%12i %i | ", ((AliDCSValue*)arrStTR->At(entryLoop))->GetTimeStamp(),
728 ((AliDCSValue*)arrStTR->At(entryLoop))->GetInt() );
730 fprintf( outputFile, " | ");
732 if( entryLoop < nOKEntries )
733 fprintf( outputFile, "%12i %i |\n", ((AliDCSValue*)arrOK->At(entryLoop))->GetTimeStamp(),
734 ((AliDCSValue*)arrOK->At(entryLoop))->GetBool() );
736 fprintf( outputFile, " |\n");
738 } /*for( entryLoop )*/
740 fclose( outputFile );
750 } /*GenerateOutputFiles*/