1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include <TTimeStamp.h>
7 #include <TObjString.h>
10 #include <AliDCSValue.h>
14 //////////////////////////////////////////////////////////////////////////////////////
15 // Generator of testing data for AliITSDCSPreprocessorSDD and AliITSAnalyzerrSDD //
16 // Origin: F.Prino, Torino, prino@to.infn.it //
17 // V.Pospisil, CTU Prague, gdermog@seznam.cz //
18 //////////////////////////////////////////////////////////////////////////////////////
21 TMap* CreateRealisticMap( TTimeStamp startTime, TTimeStamp stopTime );
22 TMap* CreateRandomMap( Int_t maxRecords = 1000, Int_t randomTimeStamps = 0 );
23 void GenerateOutputFiles( TMap *map, char *dir );
26 void CreateSDDDCSMap( void )
29 TTimeStamp startT( 2008, 2, 7, 15, 0, 0 );
30 TTimeStamp stopT( 2008, 2, 7, 18, 0, 0 );
31 // The beginning and the end of the simulated run
34 // gRandom = new TRandom2;
37 /* Macro can generate random purely random data or simulate DCS. Choose
38 one of the methods - CreateRandomMap() or CreateRealisticMap() */
40 // TMap *outMap = CreateRandomMap( 1000 );
41 TMap *outMap = CreateRealisticMap( startT, stopT );
43 GenerateOutputFiles( outMap, "./maps_3h_SIM" );
45 TFile newfile( "DCSAliasMap_3h_SIM.root", "RECREATE" );
47 printf( "Writting map into the file ...\n");
49 outMap->Write( "DCSAliasMap", TObject::kSingleKey );
51 printf( "DCSAliasMap created...\n");
56 /***************************************************************/
57 /* DCS simulation setup - used in CreateRealisticMap() */
58 /* Choose simulation setup by changing following variables */
59 /***************************************************************/
61 // --- Temperature (left side) - behavior of SDD chip -----------
63 Float_t mvalTL = 20.0; // Mean value of temperature
64 Float_t fluctTL = 0.5; // Fluctuation (gaussian sigma)
66 // --- Temperature readout (left side) - behavior of DCS --------
68 Int_t freqROTL = 60; // Frequency of fixed readout
69 Float_t fluctROTL = 5.0;
70 // Allowed fluctuation (%)
72 // Temperature readout status (left side) - behavior of SDD chip
74 Int_t freqROStTL = 60;// Frequency of fixed readout
75 Float_t failureTL = 0.01;
76 // Probability of thermometer
77 // failure (in one hour)
79 // --- Temperature (right side) - behavior of SDD chip ----------
81 Float_t mvalTR = 20.0; // Mean value of temperature
82 Float_t fluctTR = 0.5;// Fluctuation (gaussian sigma)
84 // --- Temperature readout (right side) - behavior of DCS -------
86 Int_t freqROTR = 60; // Frequency of fixed readout
87 Float_t fluctROTR = 5.0;
88 // Allowed fluctuation (%)
90 // Temperature readout status (right side) - behavior of SDD
92 Int_t freqROStTR = 60;// Frequency of fixed readout
93 Float_t failureTR = 0.01;
94 // Probability of thermometer
95 // failure (in one hour)
97 // --- High voltage - behavior of SDD voltage source -----------
99 Float_t mvalHV = 1791.0;
101 Float_t fluctHV = 0.5; // Fluctuation (gaussian sigma)
103 // --- High voltage readout - behavior of DCS -------------------
105 Int_t freqROHV = 60; // Frequency of fixed readout
106 Float_t fluctROHV = 0.01;
107 // Allowed fluctuation (%)
109 // --- High voltage readout status - behavior of SDD voltage ----
111 Int_t freqROOK = 60; // Frequency of fixed readout
112 Float_t failureHV = 0.005;
113 // Probability of HV source
114 // failure (in one hour)
116 // --- Medium voltage - behavior of SDD voltage source --------
118 Float_t mvalMV = 45.0; // Mean value of MV
119 Float_t fluctMV = 0.25;// Fluctuation (gaussian sigma)
121 // --- Medium voltage readout - behavior of DCS -----------------
123 Int_t freqROMV = 60; // 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
163 Int_t created1 = 0; // DCS records counter
165 Double_t failureTLpersec;
166 Double_t failureTRpersec;
167 Double_t failureHVpersec;
168 Double_t failureMVpersec;
169 // Probabilities of failure per one second
171 lambda = ( TMath::Log( 1.0 - failureTL ) ) / -3600.0;
172 failureTLpersec = 1.0 - TMath::Exp(-lambda );
173 lambda = ( TMath::Log( 1.0 - failureTR ) ) / -3600.0;
174 failureTRpersec = 1.0 - TMath::Exp(-lambda );
175 lambda = ( TMath::Log( 1.0 - failureHV ) ) / -3600.0;
176 failureHVpersec = 1.0 - TMath::Exp(-lambda );
177 lambda = ( TMath::Log( 1.0 - failureMV ) ) / -3600.0;
178 failureMVpersec = 1.0 - TMath::Exp(-lambda );
179 // Probabilities of failure per one second are counted
184 fluctROMV /= 100.0; // Percents to fractions
186 Double_t failureOK = ( failureHV + failureMV ) / 2.0;
187 // This value is used only for noise in timing
189 for( Int_t iLay = 3; iLay < 5; iLay++ )
192 Int_t maxLad = ( iLay == 3) ? kNladders3 : kNladders4;
193 Int_t maxMod = ( iLay == 3) ? kNmodLad3 : kNmodLad4;
195 for(Int_t iLad=0; iLad<maxLad; iLad++)
197 for(Int_t iMod=0; iMod<maxMod; iMod++)
200 fprintf( stderr, "Simulating data taking for layer %i, ladder %i, module %i ... \n", iLay, iLad, iMod );
202 TObjArray* valueSetOK = new TObjArray;
203 TObjArray* valueSetHV = new TObjArray;
204 TObjArray* valueSetMV = new TObjArray;
205 TObjArray* valueSetTL = new TObjArray;
206 TObjArray* valueSetTR = new TObjArray;
207 TObjArray* valueSetStTL = new TObjArray;
208 TObjArray* valueSetStTR = new TObjArray;
210 valueSetOK->SetOwner(1);
211 valueSetHV->SetOwner(1);
212 valueSetMV->SetOwner(1);
213 valueSetTL->SetOwner(1);
214 valueSetTR->SetOwner(1);
215 valueSetStTL->SetOwner(1);
216 valueSetStTR->SetOwner(1);
218 Float_t actualTL, actualTR;
219 Float_t actualHV, actualMV;
220 Int_t actualStTL = 1;
221 Int_t actualStTR = 1;
222 Int_t actualStHV = 1;
223 Int_t actualStMV = 1;
224 // Readout devices are alive/dead
226 Float_t lastTL = mvalTL;
227 Float_t lastTR = mvalTR;
228 Float_t lastHV = mvalHV;
229 Float_t lastMV = mvalMV;
230 // Last written values - udes for threshold readout
236 Int_t counterStTL = 0;
237 Int_t counterStTR = 0;
239 // Periodic readout counters
241 Int_t endingTimeStamp = stopTime.GetSec();
243 for( Int_t timeLoop = startTime.GetSec(); timeLoop < endingTimeStamp; timeLoop ++ )
244 { // Loop goes through period of run second per second and determines
245 // all values according to rules of DCS
247 actualTL = gRandom->Gaus( mvalTL, fluctTL );
248 actualTR = gRandom->Gaus( mvalTR, fluctTR );
249 actualHV = gRandom->Gaus( mvalHV, fluctHV );
250 actualMV = gRandom->Gaus( mvalMV, fluctMV );
251 // Generates random values of temperatures and voltages
254 if( gRandom->Rndm() < failureTLpersec )
255 if( actualStTL ) actualStTL = 0; else if( gRandom->Rndm() < 0.1 ) actualStTL = 1;
256 if( gRandom->Rndm() < failureTRpersec )
257 if( actualStTR ) actualStTR = 0; else if( gRandom->Rndm() < 0.1 ) actualStTR = 1;
258 if( gRandom->Rndm() < failureHVpersec )
259 if( actualStHV ) actualStHV = 0; else if( gRandom->Rndm() < 0.1 ) actualStHV = 1;
260 if( gRandom->Rndm() < failureMVpersec )
261 if( actualStMV ) actualStMV = 0; else if( gRandom->Rndm() < 0.1 ) actualStMV = 1;
262 // Decides if any thermometer or voltage source becomes
263 // dead (or alive again, but this have much 10x les probability )
265 if( gRandom->Rndm() < failureTL ) counterTL++;
266 if( gRandom->Rndm() < failureTL ) counterTL--;
267 if( gRandom->Rndm() < failureTR ) counterTR++;
268 if( gRandom->Rndm() < failureTR ) counterTR--;
269 if( gRandom->Rndm() < failureHV ) counterHV++;
270 if( gRandom->Rndm() < failureHV ) counterHV--;
271 if( gRandom->Rndm() < failureMV ) counterMV++;
272 if( gRandom->Rndm() < failureMV ) counterMV--;
273 if( gRandom->Rndm() < failureTL ) counterStTL++;
274 if( gRandom->Rndm() < failureTL ) counterStTL--;
275 if( gRandom->Rndm() < failureTR ) counterStTR++;
276 if( gRandom->Rndm() < failureTR ) counterStTR--;
277 if( gRandom->Rndm() < failureOK ) counterOK++;
278 if( gRandom->Rndm() < failureOK ) counterOK--;
279 // Simulating noise in the clock frequency
281 if( counterTL >= freqROTL )
282 { valueSetTL->Add( new AliDCSValue( actualTL, timeLoop ) ); lastTL = actualTL; counterTL = 0; created++; }
283 if( counterTR >= freqROTR )
284 { valueSetTR->Add( new AliDCSValue( actualTR, timeLoop ) ); lastTR = actualTR; counterTR = 0; created++; }
285 if( counterHV >= freqROHV )
286 { valueSetHV->Add( new AliDCSValue( actualHV, timeLoop ) ); lastHV = actualHV; counterHV = 0; created++; }
287 if( counterMV >= freqROMV )
288 { valueSetMV->Add( new AliDCSValue( actualMV, timeLoop ) ); lastMV = actualMV; counterMV = 0; created++; }
289 if( counterStTL >= freqROStTL )
290 { valueSetStTL->Add( new AliDCSValue( actualStTL, timeLoop ) ); counterStTL = 0; created++; }
291 if( counterStTR >= freqROStTR )
292 { valueSetStTR->Add( new AliDCSValue( actualStTR, timeLoop ) ); counterStTR = 0; created++; }
293 if( counterOK >= freqROOK )
294 { valueSetOK->Add( new AliDCSValue( (Bool_t)(actualStHV & actualStMV), timeLoop ) ); counterOK = 0; created++; }
297 if( TMath::Abs( (lastTL - actualTL) / lastTL ) > fluctROTL )
298 { valueSetTL->Add( new AliDCSValue( actualTL, timeLoop ) ); lastTL = actualTL; counterTL = 0; created1++; }
299 if( TMath::Abs( (lastTR - actualTR) / lastTR ) > fluctROTR )
300 { valueSetTR->Add( new AliDCSValue( actualTR, timeLoop ) ); lastTR = actualTR; counterTR = 0; created1++; }
301 if( TMath::Abs( (lastHV - actualHV) / lastHV ) > fluctROHV )
302 { valueSetHV->Add( new AliDCSValue( actualHV, timeLoop ) ); lastHV = actualHV; counterHV = 0; created1++; }
303 if( TMath::Abs( (lastMV - actualMV) / lastMV ) > fluctROMV )
304 { valueSetMV->Add( new AliDCSValue( actualMV, timeLoop ) ); lastMV = actualMV; counterMV = 0; created1++; }
315 } /*for( timeLoop )*/
317 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_OK", iLay, iLad, iMod );
319 aliasMap->Add( new TObjString(aliasName), valueSetOK );
321 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_HV", iLay, iLad, iMod );
323 aliasMap->Add( new TObjString(aliasName), valueSetHV );
325 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_MV", iLay, iLad, iMod );
327 aliasMap->Add( new TObjString(aliasName), valueSetMV );
329 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_L", iLay, iLad, iMod );
331 aliasMap->Add( new TObjString(aliasName), valueSetTL );
333 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_R", iLay, iLad, iMod );
335 aliasMap->Add( new TObjString(aliasName), valueSetTR );
337 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_L_STATE", iLay, iLad, iMod );
339 aliasMap->Add( new TObjString(aliasName), valueSetStTL );
341 sprintf( dpName, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_R_STATE", iLay, iLad, iMod );
343 aliasMap->Add( new TObjString(aliasName), valueSetStTR );
349 fprintf( stderr, "\nCreated %i objects of type AliDCSValue (%i periodic + %i treshold)... \n",
350 created + created1, created, created1 );
354 } /*CreateRealisticMap*/
356 //----------------------------------------------------------------------------------------
359 TMap* CreateRandomMap( Int_t maxRecords , Int_t randomTimeStamps )
361 // Creates a DCS structure
362 // The structure is the following:
363 // TMap (key --> value)
364 // <DCSAlias> --> <valueList>
365 // <DCSAlias> is a string
366 // <valueList> is a TObjArray of AliDCSValue
367 // An AliDCSValue consists of timestamp and a value in form of a AliSimpleValue
370 TMap* aliasMap = new TMap;
371 aliasMap->SetOwner(1);
378 for( Int_t iLay = 3; iLay < 5; iLay++ )
381 Int_t maxLad = ( iLay == 3) ? kNladders3 : kNladders4;
382 Int_t maxMod = ( iLay == 3) ? kNmodLad3 : kNmodLad4;
384 for(Int_t iLad = 0; iLad < maxLad; iLad++)
386 for(Int_t iMod =0 ; iMod < maxMod;iMod++)
389 fprintf( stderr, "Generating data for layer %i, ladder %i, module %i ... \n", iLay, iLad, iMod );
391 TObjArray* valueSetOK = new TObjArray;
392 TObjArray* valueSetH = new TObjArray;
393 TObjArray* valueSetM = new TObjArray;
394 TObjArray* valueSetTL = new TObjArray;
395 TObjArray* valueSetTR = new TObjArray;
396 TObjArray* valueSetStTL = new TObjArray;
397 TObjArray* valueSetStTR = new TObjArray;
399 valueSetOK->SetOwner(1);
400 valueSetH->SetOwner(1);
401 valueSetM->SetOwner(1);
402 valueSetTL->SetOwner(1);
403 valueSetTR->SetOwner(1);
404 valueSetStTL->SetOwner(1);
405 valueSetStTR->SetOwner(1);
411 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_OK", iLay,iLad,iMod);
413 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ) );
414 timeStamp = 1000000000;
415 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
417 if( randomTimeStamps )
418 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
420 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
421 if( 1000*(gRandom->Rndm()) > 50 )
422 dcsVal = new AliDCSValue((Bool_t)1, timeStamp);
424 dcsVal = new AliDCSValue((Bool_t)0, timeStamp);
425 valueSetOK->Add(dcsVal);
428 aliasMap->Add(new TObjString(aliasName), valueSetOK);
429 created += nrOfRecords;
431 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_HV", iLay, iLad,iMod);
433 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ));
434 timeStamp = 1000000000;
435 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
437 if( randomTimeStamps )
438 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
440 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
441 dcsVal = new AliDCSValue( (Float_t)( 1600 + 200*(gRandom->Rndm()) ), timeStamp );
442 valueSetH->Add(dcsVal);
445 aliasMap->Add(new TObjString(aliasName), valueSetH);
446 created += nrOfRecords;
448 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_MV", iLay, iLad,iMod);
450 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ));
451 timeStamp = 1000000000;
452 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
454 if( randomTimeStamps )
455 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
457 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
458 dcsVal = new AliDCSValue( (Float_t)( 30 + 20*(gRandom->Rndm()) ), timeStamp );
459 valueSetM->Add(dcsVal);
461 aliasMap->Add(new TObjString(aliasName), valueSetM);
462 created += nrOfRecords;
464 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_L", iLay, iLad,iMod);
466 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ));
467 timeStamp = 1000000000;
468 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
470 if( randomTimeStamps )
471 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
473 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
474 dcsVal = new AliDCSValue( (Float_t)( 50 + 50*(gRandom->Rndm()) ), timeStamp );
475 valueSetTL->Add(dcsVal);
477 aliasMap->Add(new TObjString(aliasName), valueSetTL);
478 created += nrOfRecords;
480 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_R", iLay, iLad,iMod);
482 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ));
483 timeStamp = 1000000000;
484 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
486 if( randomTimeStamps )
487 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
489 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
490 dcsVal = new AliDCSValue( (Float_t)( 50 + 50*(gRandom->Rndm()) ), timeStamp );
491 valueSetTR->Add(dcsVal);
493 aliasMap->Add(new TObjString(aliasName), valueSetTR);
494 created += nrOfRecords;
496 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_L_STATE", iLay, iLad,iMod);
498 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ));
499 timeStamp = 1000000000;
500 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
502 if( randomTimeStamps )
503 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
505 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
506 if( 1000*(gRandom->Rndm()) > 50 )
507 dcsVal = new AliDCSValue((Int_t)1, timeStamp);
509 dcsVal = new AliDCSValue((Int_t)0, timeStamp);
510 valueSetStTL->Add(dcsVal);
512 aliasMap->Add(new TObjString(aliasName), valueSetStTL);
513 created += nrOfRecords;
515 sprintf(dpName,"SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_R_STATE", iLay, iLad,iMod);
517 nrOfRecords = (Int_t)(maxRecords * ( gRandom->Rndm() ));
518 timeStamp = 1000000000;
519 for( Int_t recLoop = 0; recLoop < nrOfRecords; recLoop ++ )
521 if( randomTimeStamps )
522 timeStamp = (Int_t)(1200000000*(gRandom->Rndm()));
524 timeStamp += (Int_t)(50*(gRandom->Rndm()) );
525 if( 1000*(gRandom->Rndm()) > 50 )
526 dcsVal = new AliDCSValue((Int_t)1, timeStamp);
528 dcsVal = new AliDCSValue((Int_t)0, timeStamp);
529 valueSetStTR->Add(dcsVal);
532 aliasMap->Add(new TObjString(aliasName), valueSetStTR);
533 created += nrOfRecords;
540 fprintf( stderr, "\nCreated %i objects of type AliDCSValue ... \n", created);
545 // -----------------------------------------------------------------------------
547 void GenerateOutputFiles( TMap *map, char *dir )
551 char buffer[100],cmd[100];
552 Int_t nHVEntries, nMVEntries, nTLEntries, nTREntries;
553 Int_t nOKEntries, nStTLEntries, nStTREntries;
555 sprintf(cmd,"ls -l %s >/dev/null 2>&1",dir);
556 if(gSystem->Exec(cmd)!=0){
557 printf("%s --- NOT EXISTS -- create it\n",dir);
558 sprintf(cmd,"mkdir %s",dir);
562 for( Int_t iLay = 3; iLay < 5; iLay++ )
565 Int_t maxLad = ( iLay == 3) ? kNladders3 : kNladders4;
566 Int_t maxMod = ( iLay == 3) ? kNmodLad3 : kNmodLad4;
568 for(Int_t iLad = 0; iLad < maxLad; iLad++)
572 for(Int_t iMod = 0; iMod < maxMod; iMod++)
575 sprintf( buffer, "%s/DCSMapContent_SDD_LAYER%i_LADDER%02d_MODULE%d.txt", dir, iLay, iLad, iMod );
577 fprintf( stderr, "Creating file %s ... ", buffer );
578 outputFile = fopen( buffer, "w" );
579 if( outputFile == NULL )
581 fprintf( stderr, "failed!\n" );
585 fprintf( stderr, "\n" );
588 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_HV", iLay, iLad, iMod );
589 TObjArray* arrHV = (TObjArray*) map->GetValue( buffer );
592 fprintf( stderr, "Map record %s does not exist!\n", buffer );
596 nHVEntries = arrHV->GetEntries();
598 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_MV", iLay, iLad, iMod );
599 TObjArray* arrMV = (TObjArray*) map->GetValue( buffer );
602 fprintf( stderr, "Map record %s does not exist!\n", buffer );
606 nMVEntries = arrMV->GetEntries();
608 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_L", iLay, iLad, iMod );
609 TObjArray* arrTL = (TObjArray*) map->GetValue( buffer );
612 fprintf( stderr, "Map record %s does not exist!\n", buffer );
616 nTLEntries = arrTL->GetEntries();
618 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_R", iLay, iLad, iMod );
619 TObjArray* arrTR = (TObjArray*) map->GetValue( buffer );
622 fprintf( stderr, "Map record %s does not exist!\n", buffer );
626 nTREntries = arrTR->GetEntries();
628 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_L_STATE", iLay, iLad, iMod );
629 TObjArray* arrStTL = (TObjArray*) map->GetValue( buffer );
630 if( arrStTL == NULL )
632 fprintf( stderr, "Map record %s does not exist!\n", buffer );
636 nStTLEntries = arrStTL->GetEntries();
638 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_TEMP_R_STATE", iLay, iLad, iMod );
639 TObjArray* arrStTR = (TObjArray*) map->GetValue( buffer );
640 if( arrStTR == NULL )
642 fprintf( stderr, "Map record %s does not exist!\n", buffer );
646 nStTREntries = arrStTR->GetEntries();
648 sprintf( buffer, "SDD_LAYER%i_LADDER%02d_MODULE%d_OK", iLay, iLad, iMod );
649 TObjArray* arrOK = (TObjArray*) map->GetValue( buffer );
652 fprintf( stderr, "Map record %s does not exist!\n", buffer );
656 nOKEntries = arrOK->GetEntries();
658 fprintf( outputFile, "+-----------------------------------------------------------------------");
659 fprintf( outputFile, "------------------------------------------------------------------------+\n" );
660 fprintf( outputFile, "| DCS Map content for SDD_LAYER%i_LADDER%02d_MODULE%d" , iLay, iLad, iMod);
661 fprintf( outputFile, " |\n" );
662 fprintf( outputFile, "+----------------------+----------------------+---------------------+----------------------+");
663 fprintf( outputFile, "-----------------+-----------------+----------------+\n" );
664 fprintf( outputFile, "| %05i records | %05i records | %05i records | %05i records | %05i records |",
665 nHVEntries, nMVEntries, nTLEntries, nTREntries, nStTLEntries );
666 fprintf( outputFile, " %05i records | %05i records |\n", nStTREntries, nOKEntries );
668 fprintf( outputFile, "| time (s) HV | time (s) MV | time (s) TL | time (s) TR | time (s) StTL |" );
669 fprintf( outputFile, " time (s) StTR | time (s) OK |\n" );
670 fprintf( outputFile, "+----------------------+----------------------+---------------------+---------------------+");
671 fprintf( outputFile, "-----------------+-----------------+-----------------+\n" );
675 Int_t a = (nHVEntries > nMVEntries ) ? nHVEntries : nMVEntries;
676 Int_t b = (nTLEntries > nTREntries ) ? nTLEntries : nTREntries;
677 Int_t c = (nStTLEntries > nStTREntries ) ? nStTLEntries : nStTREntries;
678 if( a < b ) a = b; if( c < nOKEntries ) c = nOKEntries;
679 Int_t loopMax = ( a > c ) ? a : c ;
680 // Finds maximal entry number
684 for( Int_t entryLoop = 0; entryLoop < loopMax; entryLoop++ )
687 if( entryLoop < nHVEntries )
688 fprintf( outputFile, "| %12i %4.2f | ", ((AliDCSValue*)arrHV->At(entryLoop))->GetTimeStamp(),
689 ((AliDCSValue*)arrHV->At(entryLoop))->GetFloat() );
691 fprintf( outputFile, "| | ");
693 if( entryLoop < nMVEntries )
694 fprintf( outputFile, " %12i %2.2f | ", ((AliDCSValue*)arrMV->At(entryLoop))->GetTimeStamp(),
695 ((AliDCSValue*)arrMV->At(entryLoop))->GetFloat() );
697 fprintf( outputFile, " | ");
699 if( entryLoop < nTLEntries )
700 fprintf( outputFile, "%12i %2.2f | ", ((AliDCSValue*)arrTL->At(entryLoop))->GetTimeStamp(),
701 ((AliDCSValue*)arrTL->At(entryLoop))->GetFloat() );
703 fprintf( outputFile, " | ");
705 if( entryLoop < nTREntries )
706 fprintf( outputFile, "%12i %2.2f | ", ((AliDCSValue*)arrTR->At(entryLoop))->GetTimeStamp(),
707 ((AliDCSValue*)arrTR->At(entryLoop))->GetFloat() );
709 fprintf( outputFile, " | ");
711 if( entryLoop < nStTLEntries )
712 fprintf( outputFile, "%12i %i | ", ((AliDCSValue*)arrStTL->At(entryLoop))->GetTimeStamp(),
713 ((AliDCSValue*)arrStTL->At(entryLoop))->GetInt() );
715 fprintf( outputFile, " | ");
717 if( entryLoop < nStTREntries )
718 fprintf( outputFile, "%12i %i | ", ((AliDCSValue*)arrStTR->At(entryLoop))->GetTimeStamp(),
719 ((AliDCSValue*)arrStTR->At(entryLoop))->GetInt() );
721 fprintf( outputFile, " | ");
723 if( entryLoop < nOKEntries )
724 fprintf( outputFile, "%12i %i |\n", ((AliDCSValue*)arrOK->At(entryLoop))->GetTimeStamp(),
725 ((AliDCSValue*)arrOK->At(entryLoop))->GetBool() );
727 fprintf( outputFile, " |\n");
729 } /*for( entryLoop )*/
731 fclose( outputFile );
741 } /*GenerateOutputFiles*/