00001
00002
00003
00004
00005 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaRead.h"
00006
00007 R__EXTERN TEcnaRootFile *gCnaRootFile;
00008
00009 ClassImp(TEcnaRead)
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263 TEcnaRead::TEcnaRead()
00264 {
00265
00266
00267
00268
00269 Init();
00270 }
00271
00272 TEcnaRead::TEcnaRead(const TString SubDet,
00273 const TEcnaParPaths* pCnaParPaths,
00274 const TEcnaParCout* pCnaParCout,
00275 const TEcnaHeader* pFileHeader,
00276 const TEcnaNumbering* pEcalNumbering,
00277 const TEcnaWrite* pCnaWrite)
00278 {
00279
00280
00281
00282
00283 fCnaParPaths = 0;
00284 if( pCnaParPaths == 0 )
00285 {fCnaParPaths = new TEcnaParPaths(); }
00286 else
00287 {fCnaParPaths = (TEcnaParPaths*)pCnaParPaths;}
00288
00289 fCnaParCout = 0;
00290 if( pCnaParCout == 0 )
00291 {fCnaParCout = new TEcnaParCout(); }
00292 else
00293 {fCnaParCout = (TEcnaParCout*)pCnaParCout;}
00294
00295 fFileHeader = 0;
00296 if( pFileHeader == 0 )
00297 {
00298 const Text_t *h_name = "CnaHeader";
00299 const Text_t *h_title = "CnaHeader";
00300 fFileHeader = new TEcnaHeader(h_name, h_title);
00301 }
00302 else
00303 {fFileHeader = (TEcnaHeader*)pFileHeader;}
00304
00305 Init();
00306 SetEcalSubDetector(SubDet.Data(), pEcalNumbering, pCnaWrite);
00307 }
00308
00309 void TEcnaRead::Init()
00310 {
00311
00312
00313 fCnew = 0;
00314 fCdelete = 0;
00315
00316 fTTBELL = '\007';
00317
00318 fgMaxCar = (Int_t)512;
00319
00320 fCodePrintNoComment = fCnaParCout->GetCodePrint("NoComment");
00321 fCodePrintWarnings = fCnaParCout->GetCodePrint("Warnings ");
00322 fCodePrintComments = fCnaParCout->GetCodePrint("Comments");
00323 fCodePrintAllComments = fCnaParCout->GetCodePrint("AllComments");
00324
00325
00326 fFlagPrint = fCodePrintWarnings;
00327
00328 fUserSamp = -1;
00329 fUserChan = -1;
00330
00331 fSectChanSizeX = 0;
00332 fSectChanSizeY = 0;
00333 fSectSampSizeX = 0;
00334 fSectSampSizeY = 0;
00335
00336
00337 fOpenRootFile = kFALSE;
00338
00339 fReadyToReadRootFile = 0;
00340 fLookAtRootFile = 0;
00341
00342 fT1d_StexStinFromIndex = 0;
00343
00344
00345 fTagStinNumbers = 0;
00346 fMemoStinNumbers = 0;
00347
00348
00349 fDataExist = kFALSE;
00350
00351
00352 fT3d_distribs = 0;
00353 fT3d2_distribs = 0;
00354 fT3d1_distribs = 0;
00355
00356
00357 Int_t MaxCar = fgMaxCar;
00358
00359 MaxCar = fgMaxCar;
00360 fPathRoot.Resize(MaxCar);
00361 fPathRoot = "fPathRoot> not defined";
00362
00363 }
00364
00365
00366 void TEcnaRead::SetEcalSubDetector(const TString SubDet,
00367 const TEcnaNumbering* pEcalNumbering,
00368 const TEcnaWrite* pCnaWrite)
00369 {
00370
00371
00372 fEcal = 0; fEcal = new TEcnaParEcal(SubDet.Data());
00373 Int_t MaxCar = fgMaxCar;
00374 fFlagSubDet.Resize(MaxCar);
00375 fFlagSubDet = fEcal->GetEcalSubDetector();
00376
00377 if( fFlagSubDet == "EB" ){fStexName = "SM"; fStinName = "tower";}
00378 if( fFlagSubDet == "EE" ){fStexName = "Dee"; fStinName = "SC";}
00379
00380 fEcalNumbering = 0;
00381 if( pEcalNumbering == 0 )
00382 {fEcalNumbering = new TEcnaNumbering(fFlagSubDet.Data(), fEcal); ;}
00383 else
00384 {fEcalNumbering = (TEcnaNumbering*)pEcalNumbering;}
00385
00386 fCnaWrite = 0;
00387 if( pCnaWrite == 0 )
00388 {fCnaWrite =
00389 new TEcnaWrite(fFlagSubDet.Data(), fCnaParPaths, fCnaParCout, fEcal, fEcalNumbering); ;}
00390 else
00391 {fCnaWrite = (TEcnaWrite*)pCnaWrite;}
00392 }
00393
00394 void TEcnaRead::Anew(const TString VarName)
00395 {
00396
00397
00398 fCnew++;
00399
00400
00401 }
00402
00403 void TEcnaRead::Adelete(const TString VarName)
00404 {
00405
00406
00407 fCdelete++;
00408
00409
00410 }
00411
00412
00413
00414 void TEcnaRead::fCopy(const TEcnaRead& rund)
00415 {
00416
00417
00418 fFileHeader = rund.fFileHeader;
00419 fOpenRootFile = rund.fOpenRootFile;
00420
00421 fUserSamp = rund.fUserSamp;
00422 fUserChan = rund.fUserChan;
00423
00424 fSectChanSizeX = rund.fSectChanSizeX;
00425 fSectChanSizeY = rund.fSectChanSizeY;
00426 fSectSampSizeX = rund.fSectSampSizeX;
00427 fSectSampSizeY = rund.fSectSampSizeY;
00428
00429
00430
00431 fCodePrintComments = rund.fCodePrintComments;
00432 fCodePrintWarnings = rund.fCodePrintWarnings;
00433 fCodePrintAllComments = rund.fCodePrintAllComments;
00434 fCodePrintNoComment = rund.fCodePrintNoComment;
00435
00436
00437 fTagStinNumbers = rund.fTagStinNumbers;
00438
00439 fFlagPrint = rund.fFlagPrint;
00440 fPathRoot = rund.fPathRoot;
00441
00442 fCnew = rund.fCnew;
00443 fCdelete = rund.fCdelete;
00444 }
00445
00446
00447
00448
00449
00450
00451
00452 TEcnaRead::TEcnaRead(const TEcnaRead& dcop)
00453 {
00454 cout << "*TEcnaRead::TEcnaRead(const TEcnaRead& dcop)> "
00455 << " It is time to write a copy constructor" << endl
00456
00457 << endl;
00458
00459
00460
00461 }
00462
00463
00464
00465
00466
00467
00468
00469 TEcnaRead& TEcnaRead::operator=(const TEcnaRead& dcop)
00470 {
00471
00472
00473 fCopy(dcop);
00474 return *this;
00475 }
00476
00477
00478
00479
00480
00481
00482
00483 TEcnaRead::~TEcnaRead()
00484 {
00485
00486
00487
00488
00489 if(fFlagPrint == fCodePrintAllComments || fFlagPrint == fCodePrintComments){
00490 cout << "*TEcnaRead::~TEcnaRead()> Entering destructor" << endl;}
00491
00492
00493
00494
00495
00496
00497
00498
00499 if (fT1d_StexStinFromIndex != 0){delete [] fT1d_StexStinFromIndex; Adelete("fT1d_StexStinFromIndex");}
00500 if (fTagStinNumbers != 0){delete [] fTagStinNumbers; Adelete("fTagStinNumbers");}
00501
00502 if (fT3d_distribs != 0){delete [] fT3d_distribs; Adelete("fT3d_distribs");}
00503 if (fT3d2_distribs != 0){delete [] fT3d2_distribs; Adelete("fT3d2_distribs");}
00504 if (fT3d1_distribs != 0){delete [] fT3d1_distribs; Adelete("fT3d1_distribs");}
00505
00506 if ( fCnew != fCdelete )
00507 {
00508 cout << "!TEcnaRead/destructor> WRONG MANAGEMENT OF ALLOCATIONS: fCnew = "
00509 << fCnew << ", fCdelete = " << fCdelete << fTTBELL << endl;
00510 }
00511 else
00512 {
00513
00514
00515 }
00516
00517 if(fFlagPrint == fCodePrintAllComments || fFlagPrint == fCodePrintComments){
00518 cout << "*TEcnaRead::~TEcnaRead()> End of destructor " << endl;}
00519 }
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532 void TEcnaRead::GetReadyToReadRootFile(TString typ_ana, const Int_t& nb_of_samples,
00533 const Int_t& run_number, const Int_t& nfirst,
00534 const Int_t& nlast, const Int_t& nreqevts, const Int_t& Stex,
00535 TString path_root)
00536 {
00537
00538
00539
00540
00541
00542 TString sTypAna = typ_ana;
00543 Int_t nNbOfSamples = nb_of_samples;
00544 Int_t nRunNumber = run_number;
00545 Int_t nFirstEvt = nfirst;
00546 Int_t nLastEvt = nlast;
00547 Int_t nReqNbOfEvts = nreqevts;
00548 Int_t nStexNumber = Stex;
00549
00550
00551 const Text_t *h_name = "CnaHeader";
00552 const Text_t *h_title = "CnaHeader";
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563 if( fFileHeader == 0 ){fFileHeader = new TEcnaHeader(h_name, h_title); ;}
00564 fFileHeader->HeaderParameters(sTypAna, nNbOfSamples, nRunNumber,
00565 nFirstEvt, nLastEvt, nReqNbOfEvts, nStexNumber);
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576 fPathRoot = path_root;
00577
00578
00579 fCnaWrite->RegisterFileParameters(typ_ana, nb_of_samples, run_number, nfirst, nlast, nreqevts, Stex);
00580 fCnaWrite->fMakeResultsFileName();
00581
00582
00583 fMemoStinNumbers = 0;
00584
00585 if( fFlagPrint == fCodePrintAllComments || fFlagPrint == fCodePrintComments )
00586 {
00587 cout << endl;
00588 cout << "*TEcnaRead::GetReadyToReadRootFile(...)>" << endl
00589 << " The method has been called with the following argument values:" << endl
00590 << " Analysis name = "
00591 << fFileHeader->fTypAna << endl
00592 << " Nb of required samples = "
00593 << fFileHeader->fNbOfSamples << endl
00594 << " Run number = "
00595 << fFileHeader->fRunNumber << endl
00596 << " First requested event number = "
00597 << fFileHeader->fFirstReqEvtNumber << endl
00598 << " Last requested event number = "
00599 << fFileHeader->fLastReqEvtNumber << endl
00600 << " Requested number of events = "
00601 << fFileHeader->fReqNbOfEvts << endl
00602 << " Stex number = "
00603 << fFileHeader->fStex << endl
00604 << " Path for the ROOT file = "
00605 << fPathRoot << endl
00606 << endl;
00607 }
00608
00609 fReadyToReadRootFile = 1;
00610
00611 if(fFlagPrint == fCodePrintAllComments){
00612 cout << "*TEcnaRead::GetReadyToReadRootFile(...)> Leaving the method."
00613 << endl;}
00614 }
00615
00616
00617
00618
00619
00620
00621 time_t TEcnaRead::GetStartTime(){return fFileHeader->fStartTime;}
00622 time_t TEcnaRead::GetStopTime() {return fFileHeader->fStopTime;}
00623 TString TEcnaRead::GetStartDate(){return fFileHeader->fStartDate;}
00624 TString TEcnaRead::GetStopDate() {return fFileHeader->fStopDate;}
00625 TString TEcnaRead::GetRunType()
00626 {
00627 TString cType = "run type not defined";
00628 Int_t numtype = fFileHeader->fRunType;
00629
00630
00631 if( numtype == 0 ){cType = "COSMICS";}
00632 if( numtype == 1 ){cType = "BEAMH4";}
00633 if( numtype == 2 ){cType = "BEAMH2";}
00634 if( numtype == 3 ){cType = "MTCC";}
00635 if( numtype == 4 ){cType = "LASER_STD";}
00636 if( numtype == 5 ){cType = "LASER_POWER_SCAN";}
00637 if( numtype == 6 ){cType = "LASER_DELAY_SCAN";}
00638 if( numtype == 7 ){cType = "TESTPULSE_SCAN_MEM";}
00639 if( numtype == 8 ){cType = "TESTPULSE_MGPA";}
00640 if( numtype == 9 ){cType = "PEDESTAL_STD";}
00641 if( numtype == 10 ){cType = "PEDESTAL_OFFSET_SCAN";}
00642 if( numtype == 11 ){cType = "PEDESTAL_25NS_SCAN";}
00643 if( numtype == 12 ){cType = "LED_STD";}
00644
00645 if( numtype == 13 ){cType = "PHYSICS_GLOBAL";}
00646 if( numtype == 14 ){cType = "COSMICS_GLOBAL";}
00647 if( numtype == 15 ){cType = "HALO_GLOBAL";}
00648
00649 if( numtype == 16 ){cType = "LASER_GAP";}
00650 if( numtype == 17 ){cType = "TESTPULSE_GAP";}
00651 if( numtype == 18 ){cType = "PEDESTAL_GAP";}
00652 if( numtype == 19 ){cType = "LED_GAP";}
00653
00654 if( numtype == 20 ){cType = "PHYSICS_LOCAL";}
00655 if( numtype == 21 ){cType = "COSMICS_LOCAL";}
00656 if( numtype == 22 ){cType = "HALO_LOCAL";}
00657 if( numtype == 23 ){cType = "CALIB_LOCAL";}
00658
00659 if( numtype == 24 ){cType = "PEDSIM";}
00660
00661 return cType;
00662 }
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675 Bool_t TEcnaRead::LookAtRootFile()
00676 {
00677
00678
00679 fLookAtRootFile = 0;
00680
00681 Bool_t ok_read = kFALSE;
00682
00683 if(fReadyToReadRootFile == 1)
00684 {
00685
00686 if( ReadRootFileHeader(0) == kTRUE )
00687 {
00688
00689 if( fTagStinNumbers == 0 ){fTagStinNumbers = new Int_t[1]; Anew("fTagStinNumbers");}
00690
00691
00692 if(fT1d_StexStinFromIndex == 0)
00693 {fT1d_StexStinFromIndex = new Int_t[fEcal->MaxStinEcnaInStex()]; Anew("fT1d_StexStinFromIndex");}
00694
00695
00696 TVectorD vec(fEcal->MaxStinEcnaInStex());
00697 for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
00698 vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
00699
00700 for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++ ){
00701 fT1d_StexStinFromIndex[i] = (Int_t)vec(i);}
00702
00703 fTagStinNumbers[0] = 1; fFileHeader->fStinNumbersCalc++;
00704 ok_read = kTRUE;
00705
00706 fLookAtRootFile = 1;
00707 }
00708 else
00709 {
00710 cout << "!TEcnaRead::LookAtRootFile()> *** ERROR ***>"
00711 << " ROOT file not found " << fTTBELL << endl;
00712 ok_read = kFALSE;
00713 }
00714 }
00715 else
00716 {
00717 cout << "!TEcnaRead::LookAtRootFile()> *** ERROR ***>"
00718 << " GetReadyToReadRootFile not called " << fTTBELL << endl;
00719 ok_read = kFALSE;
00720 }
00721 return ok_read;
00722 }
00723
00724
00725
00726
00727
00728
00729 Bool_t TEcnaRead::ReadRootFileHeader(const Int_t& i_print)
00730 {
00731
00732
00733 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
00734
00735 if( i_print == 1 ){cout << "*TEcnaRead::ReadRootFileHeader> file_name = "
00736 << fCnaWrite->fRootFileNameShort.Data() << endl;}
00737
00738 Bool_t ok_open = kFALSE;
00739 Bool_t ok_read = kFALSE;
00740
00741 if ( fOpenRootFile )
00742 {
00743 cout << "!TEcnaRead::ReadRootFileHeader(...)*** ERROR ***> "
00744 << "Reading header on file already open." << endl;
00745 }
00746 else
00747 {
00748 ok_open = OpenRootFile(file_name, "READ");
00749
00750 if(ok_open)
00751 {
00752 TEcnaHeader *h;
00753 h =(TEcnaHeader*)gCnaRootFile->fRootFile->Get("CnaHeader");
00754
00755
00756
00757
00758 fFileHeader->fStartTime = h->fStartTime;
00759 fFileHeader->fStopTime = h->fStopTime;
00760 fFileHeader->fStartDate = h->fStartDate;
00761 fFileHeader->fStopDate = h->fStopDate;
00762
00763 fFileHeader->fRunType = h->fRunType;
00764
00765
00766 fFileHeader->fStinNumbersCalc = h->fStinNumbersCalc;
00767 fFileHeader->fAdcEvtCalc = h->fAdcEvtCalc;
00768 fFileHeader->fMSpCalc = h->fMSpCalc;
00769 fFileHeader->fSSpCalc = h->fSSpCalc;
00770 fFileHeader->fAvTnoCalc = h->fAvTnoCalc;
00771 fFileHeader->fAvLfnCalc = h->fAvLfnCalc;
00772 fFileHeader->fAvHfnCalc = h->fAvHfnCalc;
00773
00774 fFileHeader->fCovCssCalc = h->fCovCssCalc;
00775 fFileHeader->fCorCssCalc = h->fCorCssCalc;
00776 fFileHeader->fHfCovCalc = h->fHfCovCalc;
00777 fFileHeader->fHfCorCalc = h->fHfCorCalc;
00778 fFileHeader->fLfCovCalc = h->fLfCovCalc;
00779 fFileHeader->fLfCorCalc = h->fLfCorCalc;
00780 fFileHeader->fLFccMoStinsCalc = h->fLFccMoStinsCalc;
00781 fFileHeader->fHFccMoStinsCalc = h->fHFccMoStinsCalc;
00782 fFileHeader->fMeanCorssCalc = h->fMeanCorssCalc;
00783 fFileHeader->fSigCorssCalc = h->fSigCorssCalc;
00784
00785 fFileHeader->fAvPedCalc = h->fAvPedCalc;
00786 fFileHeader->fAvMeanCorssCalc = h->fAvMeanCorssCalc;
00787 fFileHeader->fAvSigCorssCalc = h->fAvSigCorssCalc;
00788
00789 if(i_print == 1){fFileHeader->Print();}
00790 CloseRootFile(file_name);
00791 ok_read = kTRUE;
00792 }
00793 else
00794 {
00795 cout << "!TEcnaRead::ReadRootFileHeader(...) *** ERROR ***> Open ROOT file failed for file: "
00796 << file_name << fTTBELL << endl;
00797 ok_read = kFALSE;
00798 }
00799 }
00800 return ok_read;
00801 }
00802
00803
00804
00805
00806
00807
00808 Bool_t TEcnaRead::OpenRootFile(const Text_t *name, TString status) {
00809
00810
00811 TString s_path;
00812 s_path = fPathRoot;
00813 s_path.Append('/');
00814 s_path.Append(name);
00815
00816 gCnaRootFile = 0; gCnaRootFile = new TEcnaRootFile(s_path.Data(), status); Anew("gCnaRootFile");
00817
00818 Bool_t ok_open = kFALSE;
00819
00820 if ( gCnaRootFile->fRootFileStatus == "RECREATE" ){ok_open = gCnaRootFile->OpenW();}
00821 if ( gCnaRootFile->fRootFileStatus == "READ" ){ok_open = gCnaRootFile->OpenR();}
00822
00823 if (!ok_open)
00824 {
00825 cout << "!TEcnaRead::OpenRootFile> " << s_path.Data() << ": file not found." << endl;
00826 if( gCnaRootFile != 0 ){delete gCnaRootFile; gCnaRootFile = 0; Adelete("gCnaRootFile");}
00827 }
00828 else
00829 {
00830 if(fFlagPrint == fCodePrintAllComments){
00831 TString e_path; e_path.Append(name);
00832 cout << "*TEcnaRead::OpenRootFile> Open ROOT file " << e_path.Data() << " OK " << endl;}
00833 fOpenRootFile = kTRUE;
00834 }
00835
00836 return ok_open;
00837 }
00838
00839
00840
00841
00842
00843
00844 Bool_t TEcnaRead::CloseRootFile(const Text_t *name) {
00845
00846
00847 Bool_t ok_close = kFALSE;
00848
00849 if (fOpenRootFile == kTRUE )
00850 {
00851 gCnaRootFile->CloseFile();
00852
00853 if(fFlagPrint == fCodePrintAllComments){
00854 TString e_path; e_path.Append(name);
00855 cout << "*TEcnaRead::CloseRootFile> Close ROOT file " << e_path.Data() << " OK " << endl;}
00856
00857 if( gCnaRootFile != 0 ){delete gCnaRootFile; gCnaRootFile = 0; Adelete("gCnaRootFile");}
00858 fOpenRootFile = kFALSE;
00859 ok_close = kTRUE;
00860 }
00861 else
00862 {
00863 cout << "*TEcnaRead::CloseRootFile(...)> no close since no file is open"
00864 << fTTBELL << endl;
00865 }
00866
00867 return ok_close;
00868 }
00869
00870
00871
00872
00873
00874
00875
00876 Bool_t TEcnaRead::DataExist()
00877 {
00878
00879
00880
00881 return fDataExist;
00882 }
00883
00884
00885
00886
00887
00888 TVectorD TEcnaRead::ReadStinNumbers(const Int_t& VecDim)
00889 {
00890
00891
00892
00893
00894
00895
00896
00897 TVectorD vec(VecDim);
00898 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
00899
00900 if (fMemoStinNumbers == 0)
00901 {
00902 CnaResultTyp typ = cTypNumbers;
00903 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
00904
00905
00906
00907
00908 Bool_t ok_open = kFALSE;
00909 Bool_t ok_read = kFALSE;
00910
00911 if ( fOpenRootFile )
00912 {
00913 cout << "!TEcnaRead::ReadStinNumbers(...) *** ERROR ***> Reading on file already open."
00914 << fTTBELL << endl;
00915 }
00916 else
00917 {
00918 ok_open = OpenRootFile(file_name, "READ");
00919
00920 Int_t i_zero = 0;
00921 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
00922
00923 if ( ok_read == kTRUE )
00924 {
00925 fDataExist = kTRUE;
00926
00927 for ( Int_t i_Stin = 0; i_Stin < VecDim; i_Stin++)
00928 {
00929 vec(i_Stin) = gCnaRootFile->fCnaIndivResult->fMatHis(0,i_Stin);
00930 fT1d_StexStinFromIndex[i_Stin] = (Int_t)vec(i_Stin);
00931 }
00932 fMemoStinNumbers++;
00933 }
00934 else
00935 {
00936 fDataExist = kFALSE;
00937 cout << "!TEcnaRead::ReadStinNumbers(...) *** ERROR ***> "
00938 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
00939 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
00940 << fTTBELL << endl;
00941 }
00942 }
00943 CloseRootFile(file_name);
00944
00945 if( ok_read == kTRUE )
00946 {
00947
00948 if(fFlagPrint == fCodePrintAllComments)
00949 {
00950 for(Int_t i=0; i < VecDim; i++)
00951 {
00952 cout << "*TEcnaRead::ReadStinNumbers(...)> StinNumber[" << i << "] = "
00953 << vec[i] << endl;
00954 }
00955 }
00956 }
00957 }
00958 else
00959 {
00960 fDataExist = kTRUE;
00961 for ( Int_t i_Stin = 0; i_Stin < VecDim; i_Stin++)
00962 {vec(i_Stin) = fT1d_StexStinFromIndex[i_Stin];}
00963 }
00964
00965 return vec;
00966 }
00967
00968
00969
00970
00971
00972
00973 TMatrixD TEcnaRead::ReadNumberOfEventsForSamples(const Int_t& n1StexStin,
00974 const Int_t& MatDimX, const Int_t& MatDimY)
00975 {
00976
00977
00978
00979
00980
00981
00982
00983 TMatrixD mat(MatDimX, MatDimY);
00984 for(Int_t i=0; i<MatDimX; i++)
00985 {for(Int_t j=0; j<MatDimY; j++){mat(i,j)=(Double_t)0.;}}
00986
00987 Int_t Stin_index = GetStinIndex(n1StexStin);
00988 if( Stin_index >= 0 )
00989 {
00990 if(fLookAtRootFile == 1)
00991 {
00992 CnaResultTyp typ = cTypNbOfEvts;
00993 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
00994
00995 Bool_t ok_open = kFALSE;
00996 Bool_t ok_read = kFALSE;
00997
00998 if ( fOpenRootFile )
00999 {
01000 cout << "!TEcnaRead::ReadNumberOfEventsForSamples(...) *** ERROR ***> "
01001 << " Reading on file already open." << fTTBELL << endl;
01002 }
01003 else
01004 {
01005 ok_open = OpenRootFile(file_name, "READ");
01006
01007 Int_t i_zero = 0;
01008 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01009
01010 if ( ok_read == kTRUE )
01011 {
01012 fDataExist = kTRUE;
01013 for (Int_t i_crys=0; i_crys<MatDimX; i_crys++)
01014 {
01015 Int_t j_cna_chan = Stin_index*MatDimX + i_crys;
01016 for ( Int_t i_samp=0; i_samp<MatDimY; i_samp++)
01017 {
01018 mat(i_crys, i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(j_cna_chan, i_samp);
01019 }
01020 }
01021 }
01022 else
01023 {
01024 fDataExist = kFALSE;
01025 cout << "!TEcnaRead::ReadNumberOfEventsForSamples(...) *** ERROR ***> "
01026 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01027 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01028 << fTTBELL << endl;
01029 }
01030 }
01031 CloseRootFile(file_name);
01032 }
01033 else
01034 {
01035 cout << "!TEcnaRead::ReadNumberOfEventsForSamples(...) *** ERROR ***> "
01036 << "It is not possible to access the number of found events: the ROOT file has not been read."
01037 << fTTBELL << endl;
01038 }
01039 }
01040 return mat;
01041 }
01042
01043
01044
01045
01046
01047
01048 TVectorD TEcnaRead::ReadSampleValues(const Int_t& i0StexEcha, const Int_t& sample, const Int_t& VecDim)
01049 {
01050
01051
01052
01053
01054
01055 TVectorD vec(VecDim);
01056 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
01057
01058 CnaResultTyp typ = cTypAdcEvt;
01059
01060 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01061
01062 Bool_t ok_open = kFALSE;
01063 Bool_t ok_read = kFALSE;
01064
01065 if ( fOpenRootFile )
01066 {
01067 cout << "!TEcnaRead::ReadSampleValues(...) *** ERROR ***> "
01068 << "Reading on file already open." << fTTBELL << endl;
01069 }
01070 else
01071 {
01072 ok_open = OpenRootFile(file_name, "READ");
01073 ok_read = gCnaRootFile->ReadElement(typ, i0StexEcha);
01074
01075 if ( ok_read == kTRUE )
01076 {
01077 fDataExist = kTRUE;
01078 for ( Int_t i_bin=0; i_bin<VecDim; i_bin++)
01079 {
01080 vec(i_bin) = gCnaRootFile->fCnaIndivResult->fMatHis(sample, i_bin);
01081 }
01082 }
01083 else
01084 {
01085 fDataExist = kFALSE;
01086 cout << "!TEcnaRead::ReadSampleValues(...) *** ERROR ***> "
01087 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01088 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01089 << fTTBELL << endl;
01090 }
01091 }
01092 CloseRootFile(file_name);
01093
01094 return vec;
01095 }
01096
01097
01098
01099
01100
01101
01102
01103
01104 Double_t*** TEcnaRead::ReadSampleValuesSameFile(const Int_t& DimX, const Int_t& DimY, const Int_t& DimZ)
01105 {
01106
01107
01108
01109
01110
01111 if(fT3d_distribs == 0)
01112 {
01113
01114 fT3d_distribs = new Double_t**[DimX]; fCnew++;
01115 fT3d2_distribs = new Double_t*[DimX*DimY]; fCnew++;
01116 fT3d1_distribs = new Double_t[DimX*DimY*DimZ]; fCnew++;
01117
01118 for(Int_t i0StexEcha = 0 ; i0StexEcha < DimX ; i0StexEcha++){
01119 fT3d_distribs[i0StexEcha] = &fT3d2_distribs[0] + i0StexEcha*DimY;
01120 for(Int_t j_samp = 0 ; j_samp < DimY ; j_samp++){
01121 fT3d2_distribs[DimY*i0StexEcha + j_samp] = &fT3d1_distribs[0]+
01122 DimZ*(DimY*i0StexEcha+j_samp);}}
01123 }
01124
01125
01126 for (Int_t iza=0; iza<DimX; iza++)
01127 {
01128 for (Int_t izb=0; izb<DimY; izb++)
01129 {
01130 for (Int_t izc=0; izc<DimZ; izc++)
01131 {
01132 if( fT3d_distribs[iza][izb][izc] != (Double_t)0 )
01133 {
01134 fT3d_distribs[iza][izb][izc] = (Double_t)0;
01135 }
01136 }
01137 }
01138 }
01139
01140
01141 CnaResultTyp typ = cTypAdcEvt;
01142
01143 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01144
01145 Bool_t ok_open = kFALSE;
01146 Bool_t ok_read = kFALSE;
01147
01148 Int_t i_entry = 0;
01149 Int_t i_entry_fail = 0;
01150
01151 ok_open = OpenRootFile(file_name, "READ");
01152
01153 if( ok_open == kTRUE )
01154 {
01155 for(Int_t i0StexEcha=0; i0StexEcha<DimX; i0StexEcha++)
01156 {
01157 if( i0StexEcha == 0 )
01158 {
01159 i_entry = gCnaRootFile->ReadElementNextEntryNumber(typ, i0StexEcha);
01160 if( i_entry >= 0 ){ok_read = kTRUE;}
01161 }
01162 if( i_entry >= 0 )
01163 {
01164 if( i0StexEcha > 0 ){ok_read = gCnaRootFile->ReadElement(i_entry); i_entry++;}
01165
01166 if ( ok_read == kTRUE )
01167 {
01168 fDataExist = kTRUE;
01169 for(Int_t sample=0; sample<DimY; sample++)
01170 {
01171 for ( Int_t i_bin=0; i_bin<DimZ; i_bin++)
01172 {
01173 fT3d_distribs[i0StexEcha][sample][i_bin]
01174 = gCnaRootFile->fCnaIndivResult->fMatHis(sample, i_bin);
01175 }
01176 }
01177 }
01178 else
01179 {
01180 fDataExist = kFALSE;
01181 cout << "!TEcnaRead::ReadSampleValuesSameFile(...) *** ERROR ***> "
01182 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01183 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01184 << fTTBELL << endl;
01185 }
01186 }
01187 else
01188 {
01189 i_entry_fail++;
01190 }
01191 }
01192 CloseRootFile(file_name);
01193 }
01194 else
01195 {
01196 cout << "*TEcnaRead::ReadSampleValuesSameFile(...)> *ERROR* =====> "
01197 << " ROOT file not found" << fTTBELL << endl;
01198 }
01199
01200 if(i_entry_fail > 0 )
01201 {
01202 cout << "*TEcnaRead::ReadSampleValuesSameFile(...)> *ERROR* =====> "
01203 << " Entry reading failure(s). i_entry_fail = "
01204 << i_entry_fail << fTTBELL << endl;
01205 }
01206 return fT3d_distribs;
01207 }
01208
01209
01210
01211
01212
01213
01214
01215 TVectorD TEcnaRead::ReadSampleMeans(const Int_t & n1StexStin,
01216 const Int_t & i0StinEcha, const Int_t & VecDim)
01217 {
01218
01219
01220
01221
01222
01223
01224 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
01225
01226 TVectorD vec(VecDim);
01227 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
01228
01229 CnaResultTyp typ = cTypMSp;
01230
01231 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01232
01233 Bool_t ok_open = kFALSE;
01234 Bool_t ok_read = kFALSE;
01235
01236 if ( fOpenRootFile )
01237 {
01238 cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> "
01239 << " Reading on file already open." << fTTBELL << endl;
01240 }
01241 else
01242 {
01243 ok_open = OpenRootFile(file_name, "READ");
01244
01245 Int_t i_zero = 0;
01246 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01247
01248 if ( ok_read == kTRUE )
01249 {
01250 fDataExist = kTRUE;
01251 for ( Int_t i_samp = 0; i_samp < VecDim; i_samp++)
01252 {
01253 vec(i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(i0StexEcha, i_samp);
01254 }
01255 }
01256 else
01257 {
01258 fDataExist = kFALSE;
01259 cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> "
01260 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01261 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01262 << fTTBELL << endl;
01263 }
01264 }
01265 CloseRootFile(file_name);
01266 return vec;
01267 }
01268
01269
01270
01271
01272
01273
01274 TVectorD TEcnaRead::ReadSampleSigmas(const Int_t & n1StexStin,
01275 const Int_t & i0StinEcha, const Int_t & VecDim)
01276 {
01277
01278
01279
01280
01281
01282
01283 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
01284
01285 TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
01286
01287 CnaResultTyp typ = cTypSSp;
01288
01289 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01290
01291 Bool_t ok_open = kFALSE;
01292 Bool_t ok_read = kFALSE;
01293
01294 if ( fOpenRootFile )
01295 {
01296 cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> "
01297 << "Reading on file already open." << fTTBELL << endl;
01298 }
01299 else
01300 {
01301 ok_open = OpenRootFile(file_name, "READ");
01302
01303 Int_t i_zero = 0;
01304 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01305
01306 if ( ok_read == kTRUE )
01307 {
01308 fDataExist = kTRUE;
01309 for ( Int_t i_samp = 0; i_samp < VecDim; i_samp++)
01310 {
01311 vec(i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(i0StexEcha,i_samp);
01312 }
01313 }
01314 else
01315 {
01316 fDataExist = kFALSE;
01317 cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> "
01318 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01319 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01320 << fTTBELL << endl;
01321 }
01322 }
01323 CloseRootFile(file_name);
01324 return vec;
01325 }
01326
01327 #define RSOS
01328 #ifndef RSOS
01329
01330
01331
01332
01333
01334 TVectorD TEcnaRead::ReadSigmasOfSamples(const Int_t & n1StexStin,
01335 const Int_t & i0StinEcha, const Int_t & VecDim)
01336 {
01337
01338
01339
01340
01341
01342
01343 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
01344
01345 TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
01346
01347 CnaResultTyp typ = cTypSSp;
01348
01349 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01350
01351 Bool_t ok_open = kFALSE;
01352 Bool_t ok_read = kFALSE;
01353
01354 if ( fOpenRootFile )
01355 {
01356 cout << "!TEcnaRead::ReadSigmasOfSamples(...) *** ERROR ***> "
01357 << "Reading on file already open." << fTTBELL << endl;
01358 }
01359 else
01360 {
01361 ok_open = OpenRootFile(file_name, "READ");
01362
01363 Int_t i_zero = 0;
01364 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01365
01366 if ( ok_read == kTRUE )
01367 {
01368 fDataExist = kTRUE;
01369 for ( Int_t i_samp = 0; i_samp < VecDim; i_samp++)
01370 {
01371 vec(i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(i0StexEcha,i_samp);
01372 if( vec(i_samp) >= (Double_t)0. )
01373 {
01374 vec(i_samp) = (Double_t)sqrt((Double_t)vec(i_samp));
01375 }
01376 else
01377 {
01378 vec(i_samp) = (Double_t)(-1.);
01379 cout << cout << "!TEcnaRead::ReadSigmasOfSamples(...) *** ERROR ***> "
01380 << "Negative variance! Sigma forced to -1" << fTTBELL << endl;
01381 }
01382 }
01383 }
01384 else
01385 {
01386 fDataExist = kFALSE;
01387 cout << "!TEcnaRead::ReadSigmasOfSamples(...) *** ERROR ***> "
01388 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01389 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01390 << fTTBELL << endl;
01391 }
01392 }
01393 CloseRootFile(file_name);
01394 return vec;
01395 }
01396 #endif // RSOS
01397
01398
01399
01400
01401
01402
01403 TMatrixD TEcnaRead::ReadCovariancesBetweenSamples(const Int_t & n1StexStin, const Int_t & i0StinEcha,
01404 const Int_t& MatDim)
01405 {
01406
01407
01408
01409
01410
01411 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
01412
01413 TMatrixD mat(MatDim, MatDim);
01414 for(Int_t i=0; i<MatDim; i++)
01415 {for(Int_t j=0; j<MatDim; j++){mat(i,j)=(Double_t)0.;}}
01416
01417 CnaResultTyp typ = cTypCovCss;
01418
01419 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01420
01421 Bool_t ok_open = kFALSE;
01422 Bool_t ok_read = kFALSE;
01423
01424 if ( fOpenRootFile )
01425 {
01426 cout << "!TEcnaRead::ReadCovariancesBetweenSamples(...) *** ERROR ***> "
01427 << "Reading on file already open." << fTTBELL << endl;
01428 }
01429 else
01430 {
01431 ok_open = OpenRootFile(file_name, "READ");
01432
01433 ok_read = gCnaRootFile->ReadElement(typ, i0StexEcha);
01434
01435 if ( ok_read == kTRUE )
01436 {
01437 fDataExist = kTRUE;
01438 for( Int_t i_samp = 0; i_samp < MatDim; i_samp++ )
01439 {
01440 for ( Int_t j_samp = 0; j_samp < MatDim; j_samp++)
01441 {
01442 mat(i_samp, j_samp) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp,j_samp);
01443 }
01444 }
01445 }
01446 else
01447 {
01448 fDataExist = kFALSE;
01449 cout << "!TEcnaRead::ReadCovariancesBetweenSamples() *** ERROR ***> "
01450 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01451 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01452 << fTTBELL << endl;
01453 }
01454 }
01455
01456 CloseRootFile(file_name);
01457
01458 return mat;
01459 }
01460
01461
01462
01463
01464
01465
01466 TMatrixD TEcnaRead::ReadCorrelationsBetweenSamples(const Int_t & n1StexStin, const Int_t & i0StinEcha,
01467 const Int_t& MatDim)
01468 {
01469
01470
01471
01472
01473
01474 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
01475 TMatrixD mat(MatDim, MatDim);
01476 for(Int_t i=0; i<MatDim; i++)
01477 {for(Int_t j=0; j<MatDim; j++){mat(i,j)=(Double_t)0.;}}
01478
01479 CnaResultTyp typ = cTypCorCss;
01480 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01481
01482 Bool_t ok_open = kFALSE;
01483 Bool_t ok_read = kFALSE;
01484
01485 if ( fOpenRootFile )
01486 {
01487 cout << "!TEcnaRead::ReadCorrelationsBetweenSamples(...) *** ERROR ***> "
01488 << "Reading on file already open." << fTTBELL << endl;
01489 }
01490 else
01491 {
01492 ok_open = OpenRootFile(file_name, "READ");
01493 ok_read = gCnaRootFile->ReadElement(typ, i0StexEcha);
01494
01495 if ( ok_read == kTRUE )
01496 {
01497 fDataExist = kTRUE;
01498 for ( Int_t i_samp = 0; i_samp < MatDim; i_samp++){
01499 for ( Int_t j_samp = 0; j_samp < MatDim; j_samp++){
01500 mat(i_samp, j_samp) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp,j_samp);}}
01501 }
01502 else
01503 {
01504 fDataExist = kFALSE;
01505 cout << "!TEcnaRead::ReadCorrelationsBetweenSamples() *** ERROR ***> "
01506 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01507 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01508 << fTTBELL << endl;
01509 }
01510 }
01511 CloseRootFile(file_name);
01512 return mat;
01513 }
01514
01515
01516
01517
01518
01519 TVectorD TEcnaRead::ReadRelevantCorrelationsBetweenSamples(const Int_t & n1StexStin, const Int_t & i0StinEcha,
01520 const Int_t & InPutMatDim )
01521 {
01522
01523
01524
01525
01526
01527
01528
01529 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
01530 Int_t nb_of_relevant = InPutMatDim*(InPutMatDim-1)/2;
01531 TVectorD vec_rel(nb_of_relevant); for(Int_t i=0; i<nb_of_relevant; i++){vec_rel(i)=(Double_t)0.;}
01532 CnaResultTyp typ = cTypCorCss;
01533 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01534
01535 Bool_t ok_open = kFALSE;
01536 Bool_t ok_read = kFALSE;
01537
01538 if ( fOpenRootFile )
01539 {
01540 cout << "!TEcnaRead::ReadRelevantCorrelationsBetweenSamples(...) *** ERROR ***> "
01541 << "Reading on file already open." << fTTBELL << endl;
01542 }
01543 else
01544 {
01545 ok_open = OpenRootFile(file_name, "READ");
01546 ok_read = gCnaRootFile->ReadElement(typ, i0StexEcha);
01547
01548 if ( ok_read == kTRUE )
01549 {
01550 fDataExist = kTRUE;
01551 Int_t k_cor = 0;
01552 for ( Int_t i_samp = 0; i_samp < InPutMatDim; i_samp++){
01553 for ( Int_t j_samp = 0; j_samp < i_samp; j_samp++){
01554 vec_rel(k_cor) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp,j_samp);
01555 k_cor++;}}
01556 }
01557 else
01558 {
01559 fDataExist = kFALSE;
01560 cout << "!TEcnaRead::ReadRelevantCorrelationsBetweenSamples() *** ERROR ***> "
01561 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01562 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01563 << fTTBELL << endl;
01564 }
01565 }
01566 CloseRootFile(file_name);
01567 return vec_rel;
01568 }
01569
01570
01571
01572
01573
01574
01575
01576 TMatrixD TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(const Int_t& n1StexStin_a,
01577 const Int_t& n1StexStin_b,
01578 const Int_t& MatDim)
01579 {
01580
01581
01582
01583
01584
01585 Int_t index_Stin_a = GetStinIndex(n1StexStin_a);
01586 Int_t index_Stin_b = GetStinIndex(n1StexStin_b);
01587
01588 TMatrixD mat(MatDim, MatDim);
01589 for(Int_t i=0; i<MatDim; i++)
01590 {for(Int_t j=0; j<MatDim; j++){mat(i,j)=(Double_t)0.;}}
01591
01592 CnaResultTyp typ = cTypLfCov;
01593
01594 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01595
01596 Bool_t ok_open = kFALSE;
01597 Bool_t ok_read = kFALSE;
01598
01599 if ( fOpenRootFile )
01600 {
01601 cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(...) *** ERROR ***>"
01602 << " Reading on file already open." << fTTBELL << endl;
01603 }
01604 else
01605 {
01606 ok_open = OpenRootFile(file_name, "READ");
01607
01608 Int_t i_zero = 0;
01609 ok_read = gCnaRootFile->ReadElement(typ,i_zero);
01610
01611 if ( ok_read == kTRUE )
01612 {
01613 fDataExist = kTRUE;
01614 for ( Int_t i_crys = 0; i_crys < MatDim; i_crys++)
01615 {
01616 Int_t i_cna_chan = index_Stin_a*MatDim + i_crys;
01617 for ( Int_t j_crys = 0; j_crys < MatDim; j_crys++)
01618 {
01619 Int_t j_cna_chan = index_Stin_b*MatDim + j_crys;
01620 mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
01621 }
01622 }
01623 }
01624 else
01625 {
01626 fDataExist = kFALSE;
01627 cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(...) *** ERROR ***> "
01628 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01629 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01630 << fTTBELL << endl;
01631 }
01632 }
01633
01634 CloseRootFile(file_name);
01635
01636 return mat;
01637 }
01638
01639
01640
01641
01642
01643
01644
01645 TMatrixD TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(const Int_t & n1StexStin_a,
01646 const Int_t & n1StexStin_b,
01647 const Int_t& MatDim)
01648 {
01649
01650
01651
01652
01653
01654 Int_t index_Stin_a = GetStinIndex(n1StexStin_a);
01655 Int_t index_Stin_b = GetStinIndex(n1StexStin_b);
01656
01657 TMatrixD mat(MatDim, MatDim);
01658 for(Int_t i=0; i<MatDim; i++)
01659 {for(Int_t j=0; j<MatDim; j++){mat(i,j)=(Double_t)0.;}}
01660
01661 CnaResultTyp typ = cTypLfCor;
01662
01663 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01664
01665 Bool_t ok_open = kFALSE;
01666 Bool_t ok_read = kFALSE;
01667
01668 if ( fOpenRootFile )
01669 {
01670 cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(...) *** ERROR ***>"
01671 << " Reading on file already open." << fTTBELL << endl;
01672 }
01673 else
01674 {
01675 ok_open = OpenRootFile(file_name, "READ");
01676
01677 Int_t i_zero = 0;
01678
01679 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01680
01681 if ( ok_read == kTRUE )
01682 {
01683 fDataExist = kTRUE;
01684 for ( Int_t i_crys = 0; i_crys < MatDim; i_crys++)
01685 {
01686 Int_t i_cna_chan = index_Stin_a*MatDim + i_crys;
01687 for ( Int_t j_crys = 0; j_crys < MatDim; j_crys++)
01688 {
01689 Int_t j_cna_chan = index_Stin_b*MatDim + j_crys;
01690 mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
01691 }
01692 }
01693 }
01694 else
01695 {
01696 fDataExist = kFALSE;
01697 cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> "
01698 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01699 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01700 << fTTBELL << endl;
01701 }
01702 }
01703
01704 CloseRootFile(file_name);
01705
01706 return mat;
01707 }
01708
01709
01710
01711
01712
01713
01714
01715 TMatrixD TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(const Int_t & n1StexStin_a,
01716 const Int_t & n1StexStin_b,
01717 const Int_t& MatDim)
01718 {
01719
01720
01721
01722
01723
01724 Int_t index_Stin_a = GetStinIndex(n1StexStin_a);
01725 Int_t index_Stin_b = GetStinIndex(n1StexStin_b);
01726
01727 TMatrixD mat(MatDim, MatDim);
01728 for(Int_t i=0; i<MatDim; i++)
01729 {for(Int_t j=0; j<MatDim; j++){mat(i,j)=(Double_t)0.;}}
01730
01731 CnaResultTyp typ = cTypHfCov;
01732
01733 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01734
01735 Bool_t ok_open = kFALSE;
01736 Bool_t ok_read = kFALSE;
01737
01738 if ( fOpenRootFile )
01739 {
01740 cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(...) *** ERROR ***>"
01741 << " Reading on file already open." << fTTBELL << endl;
01742 }
01743 else
01744 {
01745 ok_open = OpenRootFile(file_name, "READ");
01746
01747 Int_t i_zero = 0;
01748 ok_read = gCnaRootFile->ReadElement(typ,i_zero);
01749
01750 if ( ok_read == kTRUE )
01751 {
01752 fDataExist = kTRUE;
01753 for ( Int_t i_crys = 0; i_crys < MatDim; i_crys++)
01754 {
01755 Int_t i_cna_chan = index_Stin_a*MatDim + i_crys;
01756 for ( Int_t j_crys = 0; j_crys < MatDim; j_crys++)
01757 {
01758 Int_t j_cna_chan = index_Stin_b*MatDim + j_crys;
01759 mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
01760 }
01761 }
01762 }
01763 else
01764 {
01765 fDataExist = kFALSE;
01766 cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(...) *** ERROR ***> "
01767 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01768 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01769 << fTTBELL << endl;
01770 }
01771 }
01772
01773 CloseRootFile(file_name);
01774
01775 return mat;
01776 }
01777
01778
01779
01780
01781
01782
01783
01784 TMatrixD TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(const Int_t & n1StexStin_a,
01785 const Int_t & n1StexStin_b,
01786 const Int_t& MatDim)
01787 {
01788
01789
01790
01791
01792
01793 Int_t index_Stin_a = GetStinIndex(n1StexStin_a);
01794 Int_t index_Stin_b = GetStinIndex(n1StexStin_b);
01795
01796 TMatrixD mat(MatDim, MatDim);
01797 for(Int_t i=0; i<MatDim; i++)
01798 {for(Int_t j=0; j<MatDim; j++){mat(i,j)=(Double_t)0.;}}
01799
01800 CnaResultTyp typ = cTypHfCor;
01801
01802 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01803
01804 Bool_t ok_open = kFALSE;
01805 Bool_t ok_read = kFALSE;
01806
01807 if ( fOpenRootFile )
01808 {
01809 cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(...) *** ERROR ***>"
01810 << " Reading on file already open." << fTTBELL << endl;
01811 }
01812 else
01813 {
01814 ok_open = OpenRootFile(file_name, "READ");
01815
01816 Int_t i_zero = 0;
01817
01818 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01819
01820 if ( ok_read == kTRUE )
01821 {
01822 fDataExist = kTRUE;
01823 for ( Int_t i_crys = 0; i_crys < MatDim; i_crys++)
01824 {
01825 Int_t i_cna_chan = index_Stin_a*MatDim + i_crys;
01826 for ( Int_t j_crys = 0; j_crys < MatDim; j_crys++)
01827 {
01828 Int_t j_cna_chan = index_Stin_b*MatDim + j_crys;
01829 mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
01830 }
01831 }
01832 }
01833 else
01834 {
01835 fDataExist = kFALSE;
01836 cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> "
01837 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01838 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01839 << fTTBELL << endl;
01840 }
01841 }
01842
01843 CloseRootFile(file_name);
01844
01845 return mat;
01846 }
01847
01848
01849
01850
01851
01852
01853
01854 TMatrixD TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(const Int_t& MatDim)
01855 {
01856
01857
01858
01859
01860
01861
01862 TMatrixD mat(MatDim, MatDim);
01863 for(Int_t i=0; i<MatDim; i++){for(Int_t j=0; j<MatDim; j++){mat(i,j)=(Double_t)0.;}}
01864
01865 TVectorD vec(fEcal->MaxStinEcnaInStex());
01866 for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
01867 vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
01868
01869 CnaResultTyp typ = cTypLfCov;
01870
01871 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01872
01873 Bool_t ok_open = kFALSE;
01874 Bool_t ok_read = kFALSE;
01875
01876 if ( fOpenRootFile )
01877 {
01878 cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels() *** ERROR ***>"
01879 << " Reading on file already open." << fTTBELL << endl;
01880 }
01881 else
01882 {
01883 ok_open = OpenRootFile(file_name, "READ");
01884
01885 Int_t i_zero = 0;
01886 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01887
01888 if ( ok_read == kTRUE )
01889 {
01890 fDataExist = kTRUE;
01891 for (Int_t index_Stin_a = 0; index_Stin_a < fEcal->MaxStinEcnaInStex(); index_Stin_a++)
01892 {
01893 if ( vec(index_Stin_a) > 0 && vec(index_Stin_a) <= fEcal->MaxStinEcnaInStex())
01894 {
01895 for (Int_t index_Stin_b = 0; index_Stin_b < fEcal->MaxStinEcnaInStex(); index_Stin_b++)
01896 {
01897 if ( vec(index_Stin_b) > 0 && vec(index_Stin_b) <= fEcal->MaxStinEcnaInStex())
01898 {
01899 for ( Int_t i_crys = 0; i_crys < fEcal->MaxCrysInStin(); i_crys++)
01900 {
01901 Int_t i_cna_chan = index_Stin_a*fEcal->MaxCrysInStin() + i_crys;
01902 Int_t i_chan_sm = (Int_t)(vec(index_Stin_a)-1)*fEcal->MaxCrysInStin() +i_crys;
01903 for ( Int_t j_crys = 0; j_crys < fEcal->MaxCrysInStin(); j_crys++)
01904 {
01905 Int_t j_cna_chan = index_Stin_b*fEcal->MaxCrysInStin() + j_crys;
01906 Int_t j_chan_sm = (Int_t)(vec(index_Stin_b)-1)*fEcal->MaxCrysInStin() +j_crys;
01907 mat(i_chan_sm, j_chan_sm) =
01908 gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
01909 }
01910 }
01911 }
01912 }
01913 }
01914 }
01915 }
01916 else
01917 {
01918 fDataExist = kFALSE;
01919 cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels() *** ERROR ***> "
01920 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
01921 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
01922 << fTTBELL << endl;
01923 }
01924 }
01925
01926 CloseRootFile(file_name);
01927
01928 return mat;
01929 }
01930
01931
01932
01933
01934
01935
01936
01937 TMatrixD TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(const Int_t& MatDim)
01938 {
01939
01940
01941
01942
01943
01944
01945 TMatrixD mat(MatDim, MatDim);
01946 for(Int_t i=0; i<MatDim; i++){for(Int_t j=0; j<MatDim; j++){mat(i,j)=(Double_t)0.;}}
01947
01948 TVectorD vec(fEcal->MaxStinEcnaInStex());
01949 for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
01950 vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
01951
01952 CnaResultTyp typ = cTypLfCor;
01953
01954 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
01955
01956 Bool_t ok_open = kFALSE;
01957 Bool_t ok_read = kFALSE;
01958
01959 if ( fOpenRootFile )
01960 {
01961 cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels() *** ERROR ***>"
01962 << " Reading on file already open." << fTTBELL << endl;
01963 }
01964 else
01965 {
01966 ok_open = OpenRootFile(file_name, "READ");
01967
01968 Int_t i_zero = 0;
01969 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01970
01971 if ( ok_read == kTRUE )
01972 {
01973 fDataExist = kTRUE;
01974 for (Int_t index_Stin_a = 0; index_Stin_a < fEcal->MaxStinEcnaInStex(); index_Stin_a++)
01975 {
01976 if ( vec(index_Stin_a) > 0 && vec(index_Stin_a) <= fEcal->MaxStinEcnaInStex())
01977 {
01978 for (Int_t index_Stin_b = 0; index_Stin_b < fEcal->MaxStinEcnaInStex(); index_Stin_b++)
01979 {
01980 if ( vec(index_Stin_b) > 0 && vec(index_Stin_b) <= fEcal->MaxStinEcnaInStex())
01981 {
01982 for ( Int_t i_crys = 0; i_crys < fEcal->MaxCrysInStin(); i_crys++)
01983 {
01984 Int_t i_cna_chan = index_Stin_a*fEcal->MaxCrysInStin() + i_crys;
01985 Int_t i_chan_sm = (Int_t)(vec(index_Stin_a)-1)*fEcal->MaxCrysInStin() + i_crys;
01986 for ( Int_t j_crys = 0; j_crys < fEcal->MaxCrysInStin(); j_crys++)
01987 {
01988 Int_t j_cna_chan = index_Stin_b*fEcal->MaxCrysInStin() + j_crys;
01989 Int_t j_chan_sm = (Int_t)(vec(index_Stin_b)-1)*fEcal->MaxCrysInStin() + j_crys;
01990 mat(i_chan_sm, j_chan_sm) =
01991 gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
01992 }
01993 }
01994 }
01995 }
01996 }
01997 }
01998 }
01999 else
02000 {
02001 fDataExist = kFALSE;
02002 cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels() *** ERROR ***> "
02003 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02004 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02005 << fTTBELL << endl;
02006 }
02007 }
02008
02009 CloseRootFile(file_name);
02010
02011 return mat;
02012 }
02013
02014
02015
02016
02017
02018
02019
02020 TMatrixD TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(const Int_t& MatDim)
02021 {
02022
02023
02024
02025
02026
02027
02028 TMatrixD mat(MatDim, MatDim);
02029 for(Int_t i=0; i<MatDim; i++){for(Int_t j=0; j<MatDim; j++){mat(i,j)=(Double_t)0.;}}
02030
02031 TVectorD vec(fEcal->MaxStinEcnaInStex());
02032 for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
02033 vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
02034
02035 CnaResultTyp typ = cTypHfCov;
02036
02037 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02038
02039 Bool_t ok_open = kFALSE;
02040 Bool_t ok_read = kFALSE;
02041
02042 if ( fOpenRootFile )
02043 {
02044 cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels() *** ERROR ***>"
02045 << " Reading on file already open." << fTTBELL << endl;
02046 }
02047 else
02048 {
02049 ok_open = OpenRootFile(file_name, "READ");
02050
02051 Int_t i_zero = 0;
02052 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02053
02054 if ( ok_read == kTRUE )
02055 {
02056 fDataExist = kTRUE;
02057 for (Int_t index_Stin_a = 0; index_Stin_a < fEcal->MaxStinEcnaInStex(); index_Stin_a++)
02058 {
02059 if ( vec(index_Stin_a) > 0 && vec(index_Stin_a) <= fEcal->MaxStinEcnaInStex())
02060 {
02061 for (Int_t index_Stin_b = 0; index_Stin_b < fEcal->MaxStinEcnaInStex(); index_Stin_b++)
02062 {
02063 if ( vec(index_Stin_b) > 0 && vec(index_Stin_b) <= fEcal->MaxStinEcnaInStex())
02064 {
02065 for ( Int_t i_crys = 0; i_crys < fEcal->MaxCrysInStin(); i_crys++)
02066 {
02067 Int_t i_cna_chan = index_Stin_a*fEcal->MaxCrysInStin() + i_crys;
02068 Int_t i_chan_sm = (Int_t)(vec(index_Stin_a)-1)*fEcal->MaxCrysInStin() +i_crys;
02069 for ( Int_t j_crys = 0; j_crys < fEcal->MaxCrysInStin(); j_crys++)
02070 {
02071 Int_t j_cna_chan = index_Stin_b*fEcal->MaxCrysInStin() + j_crys;
02072 Int_t j_chan_sm = (Int_t)(vec(index_Stin_b)-1)*fEcal->MaxCrysInStin() +j_crys;
02073 mat(i_chan_sm, j_chan_sm) =
02074 gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
02075 }
02076 }
02077 }
02078 }
02079 }
02080 }
02081 }
02082 else
02083 {
02084 fDataExist = kFALSE;
02085 cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels() *** ERROR ***> "
02086 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02087 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02088 << fTTBELL << endl;
02089 }
02090 }
02091
02092 CloseRootFile(file_name);
02093
02094 return mat;
02095 }
02096
02097
02098
02099
02100
02101
02102
02103 TMatrixD TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(const Int_t& MatDim)
02104 {
02105
02106
02107
02108
02109
02110
02111 TMatrixD mat(MatDim, MatDim);
02112 for(Int_t i=0; i<MatDim; i++){for(Int_t j=0; j<MatDim; j++){mat(i,j)=(Double_t)0.;}}
02113
02114 TVectorD vec(fEcal->MaxStinEcnaInStex());
02115 for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
02116 vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
02117
02118 CnaResultTyp typ = cTypHfCor;
02119
02120 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02121
02122 Bool_t ok_open = kFALSE;
02123 Bool_t ok_read = kFALSE;
02124
02125 if ( fOpenRootFile )
02126 {
02127 cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels() *** ERROR ***>"
02128 << " Reading on file already open." << fTTBELL << endl;
02129 }
02130 else
02131 {
02132 ok_open = OpenRootFile(file_name, "READ");
02133
02134 Int_t i_zero = 0;
02135 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02136
02137 if ( ok_read == kTRUE )
02138 {
02139 fDataExist = kTRUE;
02140 for (Int_t index_Stin_a = 0; index_Stin_a < fEcal->MaxStinEcnaInStex(); index_Stin_a++)
02141 {
02142 if ( vec(index_Stin_a) > 0 && vec(index_Stin_a) <= fEcal->MaxStinEcnaInStex())
02143 {
02144 for (Int_t index_Stin_b = 0; index_Stin_b < fEcal->MaxStinEcnaInStex(); index_Stin_b++)
02145 {
02146 if ( vec(index_Stin_b) > 0 && vec(index_Stin_b) <= fEcal->MaxStinEcnaInStex())
02147 {
02148 for ( Int_t i_crys = 0; i_crys < fEcal->MaxCrysInStin(); i_crys++)
02149 {
02150 Int_t i_cna_chan = index_Stin_a*fEcal->MaxCrysInStin() + i_crys;
02151 Int_t i_chan_sm = (Int_t)(vec(index_Stin_a)-1)*fEcal->MaxCrysInStin() + i_crys;
02152 for ( Int_t j_crys = 0; j_crys < fEcal->MaxCrysInStin(); j_crys++)
02153 {
02154 Int_t j_cna_chan = index_Stin_b*fEcal->MaxCrysInStin() + j_crys;
02155 Int_t j_chan_sm = (Int_t)(vec(index_Stin_b)-1)*fEcal->MaxCrysInStin() + j_crys;
02156 mat(i_chan_sm, j_chan_sm) =
02157 gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
02158 }
02159 }
02160 }
02161 }
02162 }
02163 }
02164 }
02165 else
02166 {
02167 fDataExist = kFALSE;
02168 cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels() *** ERROR ***> "
02169 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02170 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02171 << fTTBELL << endl;
02172 }
02173 }
02174
02175 CloseRootFile(file_name);
02176
02177 return mat;
02178 }
02179
02180
02181
02182
02183
02184
02185
02186
02187 TMatrixD TEcnaRead::ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t& MatDim)
02188 {
02189
02190
02191
02192
02193
02194 TMatrixD mat(MatDim, MatDim);
02195 for(Int_t i=0; i<MatDim; i++)
02196 {for(Int_t j=0; j<MatDim; j++){mat(i,j)=(Double_t)0.;}}
02197
02198 TVectorD vec(fEcal->MaxStinEcnaInStex());
02199 for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
02200 vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
02201
02202 CnaResultTyp typ = cTypLFccMoStins;
02203
02204 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02205
02206 Bool_t ok_open = kFALSE;
02207 Bool_t ok_read = kFALSE;
02208
02209 if ( fOpenRootFile )
02210 {
02211 cout << "!TEcnaRead::ReadLowFrequencyMeanCorrelationsBetweenStins() *** ERROR ***>"
02212 << " Reading on file already open." << fTTBELL << endl;
02213 }
02214 else
02215 {
02216 ok_open = OpenRootFile(file_name, "READ");
02217
02218 Int_t i_zero = 0;
02219 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02220
02221 if( ok_read == kTRUE )
02222 {
02223 fDataExist = kTRUE;
02224 for(Int_t index_Stin_a = 0; index_Stin_a < MatDim; index_Stin_a++)
02225 {
02226 for(Int_t index_Stin_b = 0; index_Stin_b < MatDim; index_Stin_b++)
02227 {
02228 if( vec(index_Stin_a) > 0 && vec(index_Stin_a) <= MatDim)
02229 {
02230 if( vec(index_Stin_b) > 0 && vec(index_Stin_b) <= MatDim)
02231 {
02232 mat((Int_t)vec(index_Stin_a)-1, (Int_t)vec(index_Stin_b)-1) =
02233 gCnaRootFile->fCnaIndivResult->fMatMat(index_Stin_a,index_Stin_b);
02234 }
02235 }
02236 }
02237 }
02238 }
02239 else
02240 {
02241 fDataExist = kFALSE;
02242 cout << "!TEcnaRead::ReadLowFrequencyMeanCorrelationsBetweenStins() *** ERROR ***> "
02243 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02244 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02245 << fTTBELL << endl;
02246 }
02247
02248 CloseRootFile(file_name);
02249 }
02250
02251 return mat;
02252 }
02253
02254
02255
02256
02257
02258
02259
02260 TMatrixD TEcnaRead::ReadHighFrequencyMeanCorrelationsBetweenStins(const Int_t& MatDim)
02261 {
02262
02263
02264
02265
02266
02267 TMatrixD mat(MatDim, MatDim);
02268 for(Int_t i=0; i<MatDim; i++)
02269 {for(Int_t j=0; j<MatDim; j++){mat(i,j)=(Double_t)0.;}}
02270
02271 TVectorD vec(fEcal->MaxStinEcnaInStex());
02272 for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
02273 vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
02274
02275 CnaResultTyp typ = cTypHFccMoStins;
02276
02277 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02278
02279 Bool_t ok_open = kFALSE;
02280 Bool_t ok_read = kFALSE;
02281
02282 if ( fOpenRootFile )
02283 {
02284 cout << "!TEcnaRead::ReadHighFrequencyMeanCorrelationsBetweenStins() *** ERROR ***>"
02285 << " Reading on file already open." << fTTBELL << endl;
02286 }
02287 else
02288 {
02289 ok_open = OpenRootFile(file_name, "READ");
02290
02291 Int_t i_zero = 0;
02292 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02293
02294 if( ok_read == kTRUE )
02295 {
02296 fDataExist = kTRUE;
02297 for(Int_t index_Stin_a = 0; index_Stin_a < MatDim; index_Stin_a++)
02298 {
02299 for(Int_t index_Stin_b = 0; index_Stin_b < MatDim; index_Stin_b++)
02300 {
02301 if( vec(index_Stin_a) > 0 && vec(index_Stin_a) <= MatDim)
02302 {
02303 if( vec(index_Stin_b) > 0 && vec(index_Stin_b) <= MatDim)
02304 {
02305 mat((Int_t)vec(index_Stin_a)-1, (Int_t)vec(index_Stin_b)-1) =
02306 gCnaRootFile->fCnaIndivResult->fMatMat(index_Stin_a,index_Stin_b);
02307 }
02308 }
02309 }
02310 }
02311 }
02312 else
02313 {
02314 fDataExist = kFALSE;
02315 cout << "!TEcnaRead::ReadHighFrequencyMeanCorrelationsBetweenStins() *** ERROR ***> "
02316 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02317 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02318 << fTTBELL << endl;
02319 }
02320
02321 CloseRootFile(file_name);
02322 }
02323
02324 return mat;
02325 }
02326
02327
02328
02329
02330
02331
02332
02333
02334
02335
02336
02337
02338 TVectorD TEcnaRead::ReadNumberOfEvents(const Int_t& VecDim)
02339 {
02340
02341
02342
02343
02344
02345
02346
02347 TVectorD vec(VecDim);
02348 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
02349
02350 TMatrixD mat(fEcal->MaxCrysInStin(), fFileHeader->fNbOfSamples);
02351
02352 for(Int_t iStexStin=0; iStexStin<fEcal->MaxStinEcnaInStex(); iStexStin++)
02353 {
02354
02355 for(Int_t i=0; i<fEcal->MaxCrysInStin(); i++)
02356 {for(Int_t j=0; j<fFileHeader->fNbOfSamples; j++){mat(i,j)=(Double_t)0.;}}
02357
02358 mat = ReadNumberOfEventsForSamples(iStexStin+1, fEcal->MaxCrysInStin(), fFileHeader->fNbOfSamples);
02359
02360 for(Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++)
02361 {
02362 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(iStexStin+1, i0StinEcha);
02363 vec(i0StexEcha) = 0;
02364
02365 for(Int_t i_samp=0; i_samp<fFileHeader->fNbOfSamples; i_samp++)
02366 {vec(i0StexEcha) += mat(i0StinEcha, i_samp);}
02367 vec(i0StexEcha) = vec(i0StexEcha)/fFileHeader->fNbOfSamples;
02368 }
02369 }
02370 return vec;
02371 }
02372
02373
02374
02375
02376
02377
02378 TVectorD TEcnaRead::ReadPedestals(const Int_t& VecDim)
02379 {
02380
02381
02382
02383
02384
02385
02386 TVectorD vec(VecDim);
02387 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
02388
02389 CnaResultTyp typ = cTypPed;
02390 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02391
02392 Bool_t ok_open = kFALSE;
02393 Bool_t ok_read = kFALSE;
02394
02395 if ( fOpenRootFile )
02396 {
02397 cout << "!TEcnaRead::ReadPedestals(...) *** ERROR ***> "
02398 << "Reading on file already open." << fTTBELL << endl;
02399 }
02400 else
02401 {
02402 ok_open = OpenRootFile(file_name, "READ");
02403
02404 Int_t i_zero = 0;
02405 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02406
02407 if ( ok_read == kTRUE )
02408 {
02409 fDataExist = kTRUE;
02410 for ( Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++)
02411 {
02412 vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i_StexCrys);
02413 }
02414 }
02415 else
02416 {
02417 fDataExist = kFALSE;
02418 cout << "!TEcnaRead::ReadPedestals(...) *** ERROR ***> "
02419 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02420 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02421 << fTTBELL << endl;
02422 }
02423 }
02424 CloseRootFile(file_name);
02425 return vec;
02426 }
02427
02428
02429
02430
02431
02432
02433 TVectorD TEcnaRead::ReadTotalNoise(const Int_t& VecDim)
02434 {
02435
02436
02437
02438
02439
02440
02441 TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
02442 CnaResultTyp typ = cTypTno;
02443 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02444
02445 Bool_t ok_open = kFALSE;
02446 Bool_t ok_read = kFALSE;
02447
02448 if ( fOpenRootFile )
02449 {
02450 cout << "!TEcnaRead::ReadTotalNoise(...) *** ERROR ***> "
02451 << "Reading on file already open." << fTTBELL << endl;
02452 }
02453 else
02454 {
02455 ok_open = OpenRootFile(file_name, "READ");
02456
02457 Int_t i_zero = 0;
02458 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02459
02460 if ( ok_read == kTRUE )
02461 {
02462 fDataExist = kTRUE;
02463 for ( Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++)
02464 {
02465 vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_StexCrys);
02466 }
02467 }
02468 else
02469 {
02470 fDataExist = kFALSE;
02471 cout << "!TEcnaRead::ReadTotalNoise(...) *** ERROR ***> "
02472 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02473 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02474 << fTTBELL << endl;
02475 }
02476 }
02477 CloseRootFile(file_name);
02478 return vec;
02479 }
02480
02481
02482
02483
02484
02485 TVectorD TEcnaRead::ReadMeanOfCorrelationsBetweenSamples(const Int_t& VecDim)
02486 {
02487
02488
02489
02490
02491
02492
02493 TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
02494 CnaResultTyp typ = cTypMeanCorss;
02495 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02496
02497 Bool_t ok_open = kFALSE;
02498 Bool_t ok_read = kFALSE;
02499
02500 if ( fOpenRootFile )
02501 {
02502 cout << "!TEcnaRead::ReadMeanOfCorrelationsBetweenSamples(...) *** ERROR ***> "
02503 << "Reading on file already open." << fTTBELL << endl;
02504 }
02505 else
02506 {
02507 ok_open = OpenRootFile(file_name, "READ");
02508
02509 Int_t i_zero = 0;
02510 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02511
02512 if ( ok_read == kTRUE )
02513 {
02514 fDataExist = kTRUE;
02515 for ( Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++)
02516 {
02517 vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_StexCrys);
02518 }
02519 }
02520 else
02521 {
02522 fDataExist = kFALSE;
02523 cout << "!TEcnaRead::ReadMeanOfCorrelationsBetweenSamples(...) *** ERROR ***> "
02524 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02525 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02526 << fTTBELL << endl;
02527 }
02528 }
02529
02530 CloseRootFile(file_name);
02531 return vec;
02532 }
02533
02534
02535
02536
02537
02538
02539 TVectorD TEcnaRead::ReadLowFrequencyNoise(const Int_t& VecDim)
02540 {
02541
02542
02543
02544
02545
02546
02547 TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
02548 CnaResultTyp typ = cTypLfn;
02549 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02550
02551 Bool_t ok_open = kFALSE;
02552 Bool_t ok_read = kFALSE;
02553
02554 if ( fOpenRootFile )
02555 {
02556 cout << "!TEcnaRead::ReadLowFrequencyNoise(...) *** ERROR ***> "
02557 << "Reading on file already open." << fTTBELL << endl;
02558 }
02559 else
02560 {
02561 ok_open = OpenRootFile(file_name, "READ");
02562
02563 Int_t i_zero = 0;
02564 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02565
02566 if ( ok_read == kTRUE )
02567 {
02568 fDataExist = kTRUE;
02569 for ( Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++)
02570 {
02571 vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_StexCrys);
02572 }
02573 }
02574 else
02575 {
02576 fDataExist = kFALSE;
02577 cout << "!TEcnaRead::ReadLowFrequencyNoise(...) *** ERROR ***> "
02578 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02579 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02580 << fTTBELL << endl;
02581 }
02582 }
02583
02584 CloseRootFile(file_name);
02585 return vec;
02586 }
02587
02588
02589
02590
02591
02592
02593 TVectorD TEcnaRead::ReadHighFrequencyNoise(const Int_t& VecDim)
02594 {
02595
02596
02597
02598
02599
02600
02601 TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
02602 CnaResultTyp typ = cTypHfn;
02603 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02604
02605 Bool_t ok_open = kFALSE;
02606 Bool_t ok_read = kFALSE;
02607
02608 if ( fOpenRootFile )
02609 {
02610 cout << "!TEcnaRead::ReadHighFrequencyNoise(...) *** ERROR ***> "
02611 << "Reading on file already open." << fTTBELL << endl;
02612 }
02613 else
02614 {
02615 ok_open = OpenRootFile(file_name, "READ");
02616
02617 Int_t i_zero = 0;
02618 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02619
02620 if ( ok_read == kTRUE )
02621 {
02622 fDataExist = kTRUE;
02623 for ( Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++)
02624 {
02625 vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_StexCrys);
02626 }
02627 }
02628 else
02629 {
02630 fDataExist = kFALSE;
02631 cout << "!TEcnaRead::ReadHighFrequencyNoise(...) *** ERROR ***> "
02632 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02633 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02634 << fTTBELL << endl;
02635 }
02636 }
02637
02638 CloseRootFile(file_name);
02639 return vec;
02640 }
02641
02642
02643
02644
02645
02646
02647 TVectorD TEcnaRead::ReadSigmaOfCorrelationsBetweenSamples(const Int_t& VecDim)
02648 {
02649
02650
02651
02652
02653
02654
02655 TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
02656 CnaResultTyp typ = cTypSigCorss;
02657 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02658
02659 Bool_t ok_open = kFALSE;
02660 Bool_t ok_read = kFALSE;
02661
02662 if ( fOpenRootFile )
02663 {
02664 cout << "!TEcnaRead::ReadSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> "
02665 << "Reading on file already open." << fTTBELL << endl;
02666 }
02667 else
02668 {
02669 ok_open = OpenRootFile(file_name, "READ");
02670
02671 Int_t i_zero = 0;
02672 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02673
02674 if ( ok_read == kTRUE )
02675 {
02676 fDataExist = kTRUE;
02677 for ( Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++)
02678 {
02679 vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_StexCrys);
02680 }
02681 }
02682 else
02683 {
02684 fDataExist = kFALSE;
02685 cout << "!TEcnaRead::ReadSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> "
02686 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02687 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02688 << fTTBELL << endl;
02689 }
02690 }
02691
02692 CloseRootFile(file_name);
02693 return vec;
02694 }
02695
02696
02697
02698
02699
02700
02701
02702
02703
02704
02705
02706
02707
02708 TVectorD TEcnaRead::ReadAveragedNumberOfEvents(const Int_t& VecDim)
02709 {
02710
02711
02712
02713
02714
02715
02716
02717 TVectorD vecAveraged(VecDim);
02718 for(Int_t i=0; i<VecDim; i++){vecAveraged(i)=(Double_t)0.;}
02719
02720 TVectorD vecMean(fEcal->MaxCrysEcnaInStex());
02721 for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){vecMean(i)=(Double_t)0.;}
02722
02723 vecMean = ReadNumberOfEvents(fEcal->MaxCrysEcnaInStex());
02724
02725 for(Int_t i0StexStin=0; i0StexStin<VecDim; i0StexStin++)
02726 {
02727 Int_t n1StexStin = i0StexStin+1;
02728 vecAveraged(i0StexStin) = 0;
02729
02730 for(Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++)
02731 {
02732 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(i0StexStin+1, i0StinEcha);
02733
02734 if( fStexName == "SM" )
02735 {vecAveraged(i0StexStin) += vecMean(i0StexEcha);}
02736
02737 if( fStexName == "Dee" )
02738 {
02739
02740
02741
02742 Int_t n1StinEcha = i0StinEcha+1;
02743 if( n1StexStin == 10 && n1StinEcha == 11 )
02744 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);}
02745 if( n1StexStin == 11 && n1StinEcha == 11 )
02746 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);}
02747 if( !( (n1StexStin == 29 || n1StexStin == 32) && n1StinEcha == 11 ) )
02748 {vecAveraged(i0StexStin) += vecMean(i0StexEcha);}
02749 }
02750 }
02751
02752 Double_t xdivis = (Double_t)0.;
02753 if( fStexName == "SM" )
02754 {xdivis = (Double_t)fEcal->MaxCrysInStin();}
02755 if( fStexName == "Dee" )
02756 {xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, i0StexStin+1, "TEcnaRead");}
02757
02758 vecAveraged(i0StexStin) = vecAveraged(i0StexStin)/xdivis;
02759 }
02760 return vecAveraged;
02761 }
02762
02763
02764
02765
02766
02767
02768 TVectorD TEcnaRead::ReadAveragedPedestals(const Int_t& VecDim)
02769 {
02770
02771
02772
02773
02774
02775
02776 TVectorD vec(VecDim);
02777 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
02778
02779 CnaResultTyp typ = cTypAvPed;
02780 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02781
02782 Bool_t ok_open = kFALSE;
02783 Bool_t ok_read = kFALSE;
02784
02785 if ( fOpenRootFile )
02786 {
02787 cout << "!TEcnaRead::ReadAveragedPedestals(...) *** ERROR ***> "
02788 << "Reading on file already open." << fTTBELL << endl;
02789 }
02790 else
02791 {
02792 ok_open = OpenRootFile(file_name, "READ");
02793
02794 Int_t i_zero = 0;
02795 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02796
02797 if ( ok_read == kTRUE )
02798 {
02799 fDataExist = kTRUE;
02800 for ( Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++)
02801 {
02802 vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
02803 }
02804 }
02805 else
02806 {
02807 fDataExist = kFALSE;
02808 cout << "!TEcnaRead::ReadAveragedPedestals(...) *** ERROR ***> "
02809 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02810 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02811 << fTTBELL << endl;
02812 }
02813 }
02814 CloseRootFile(file_name);
02815 return vec;
02816 }
02817
02818
02819
02820
02821
02822
02823 TVectorD TEcnaRead::ReadAveragedTotalNoise(const Int_t& VecDim)
02824 {
02825
02826
02827
02828
02829
02830
02831 TVectorD vec(VecDim);
02832 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
02833
02834 CnaResultTyp typ = cTypAvTno;
02835 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02836
02837 Bool_t ok_open = kFALSE;
02838 Bool_t ok_read = kFALSE;
02839
02840 if ( fOpenRootFile )
02841 {
02842 cout << "!TEcnaRead::ReadAveragedTotalNoise(...) *** ERROR ***> "
02843 << "Reading on file already open." << fTTBELL << endl;
02844 }
02845 else
02846 {
02847 ok_open = OpenRootFile(file_name, "READ");
02848
02849 Int_t i_zero = 0;
02850 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02851
02852 if ( ok_read == kTRUE )
02853 {
02854 fDataExist = kTRUE;
02855 for ( Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++)
02856 {
02857 vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
02858 }
02859 }
02860 else
02861 {
02862 fDataExist = kFALSE;
02863 cout << "!TEcnaRead::ReadAveragedTotalNoise(...) *** ERROR ***> "
02864 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02865 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02866 << fTTBELL << endl;
02867 }
02868 }
02869 CloseRootFile(file_name);
02870 return vec;
02871 }
02872
02873
02874
02875
02876
02877
02878 TVectorD TEcnaRead::ReadAveragedLowFrequencyNoise(const Int_t& VecDim)
02879 {
02880
02881
02882
02883
02884
02885
02886 TVectorD vec(VecDim);
02887 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
02888
02889 CnaResultTyp typ = cTypAvLfn;
02890 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02891
02892 Bool_t ok_open = kFALSE;
02893 Bool_t ok_read = kFALSE;
02894
02895 if ( fOpenRootFile )
02896 {
02897 cout << "!TEcnaRead::ReadAveragedLowFrequencyNoise(...) *** ERROR ***> "
02898 << "Reading on file already open." << fTTBELL << endl;
02899 }
02900 else
02901 {
02902 ok_open = OpenRootFile(file_name, "READ");
02903
02904 Int_t i_zero = 0;
02905 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02906
02907 if ( ok_read == kTRUE )
02908 {
02909 fDataExist = kTRUE;
02910 for ( Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++)
02911 {
02912 vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
02913 }
02914 }
02915 else
02916 {
02917 fDataExist = kFALSE;
02918 cout << "!TEcnaRead::ReadAveragedLowFrequencyNoise(...) *** ERROR ***> "
02919 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02920 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02921 << fTTBELL << endl;
02922 }
02923 }
02924 CloseRootFile(file_name);
02925 return vec;
02926 }
02927
02928
02929
02930
02931
02932
02933 TVectorD TEcnaRead::ReadAveragedHighFrequencyNoise(const Int_t& VecDim)
02934 {
02935
02936
02937
02938
02939
02940
02941 TVectorD vec(VecDim);
02942 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
02943
02944 CnaResultTyp typ = cTypAvHfn;
02945 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
02946
02947 Bool_t ok_open = kFALSE;
02948 Bool_t ok_read = kFALSE;
02949
02950 if ( fOpenRootFile )
02951 {
02952 cout << "!TEcnaRead::ReadAveragedHighFrequencyNoise(...) *** ERROR ***> "
02953 << "Reading on file already open." << fTTBELL << endl;
02954 }
02955 else
02956 {
02957 ok_open = OpenRootFile(file_name, "READ");
02958
02959 Int_t i_zero = 0;
02960 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02961
02962 if ( ok_read == kTRUE )
02963 {
02964 fDataExist = kTRUE;
02965 for ( Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++)
02966 {
02967 vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
02968 }
02969 }
02970 else
02971 {
02972 fDataExist = kFALSE;
02973 cout << "!TEcnaRead::ReadAveragedHighFrequencyNoise(...) *** ERROR ***> "
02974 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
02975 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
02976 << fTTBELL << endl;
02977 }
02978 }
02979 CloseRootFile(file_name);
02980 return vec;
02981 }
02982
02983
02984
02985
02986
02987
02988 TVectorD TEcnaRead::ReadAveragedMeanOfCorrelationsBetweenSamples(const Int_t& VecDim)
02989 {
02990
02991
02992
02993
02994
02995
02996 TVectorD vec(VecDim);
02997 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
02998
02999 CnaResultTyp typ = cTypAvMeanCorss;
03000 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
03001
03002 Bool_t ok_open = kFALSE;
03003 Bool_t ok_read = kFALSE;
03004
03005 if ( fOpenRootFile )
03006 {
03007 cout << "!TEcnaRead::ReadAveragedMeanOfCorrelationsBetweenSamples(...) *** ERROR ***> "
03008 << "Reading on file already open." << fTTBELL << endl;
03009 }
03010 else
03011 {
03012 ok_open = OpenRootFile(file_name, "READ");
03013
03014 Int_t i_zero = 0;
03015 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
03016
03017 if ( ok_read == kTRUE )
03018 {
03019 fDataExist = kTRUE;
03020 for ( Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++)
03021 {
03022 vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
03023 }
03024 }
03025 else
03026 {
03027 fDataExist = kFALSE;
03028 cout << "!TEcnaRead::ReadAveragedMeanOfCorrelationsBetweenSamples(...) *** ERROR ***> "
03029 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
03030 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
03031 << fTTBELL << endl;
03032 }
03033 }
03034 CloseRootFile(file_name);
03035 return vec;
03036 }
03037
03038
03039
03040
03041
03042
03043 TVectorD TEcnaRead::ReadAveragedSigmaOfCorrelationsBetweenSamples(const Int_t& VecDim)
03044 {
03045
03046
03047
03048
03049
03050
03051 TVectorD vec(VecDim);
03052 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
03053
03054 CnaResultTyp typ = cTypAvSigCorss;
03055 const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
03056
03057 Bool_t ok_open = kFALSE;
03058 Bool_t ok_read = kFALSE;
03059
03060 if ( fOpenRootFile )
03061 {
03062 cout << "!TEcnaRead::ReadAveragedSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> "
03063 << "Reading on file already open." << fTTBELL << endl;
03064 }
03065 else
03066 {
03067 ok_open = OpenRootFile(file_name, "READ");
03068
03069 Int_t i_zero = 0;
03070 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
03071
03072 if ( ok_read == kTRUE )
03073 {
03074 fDataExist = kTRUE;
03075 for ( Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++)
03076 {
03077 vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
03078 }
03079 }
03080 else
03081 {
03082 fDataExist = kFALSE;
03083 cout << "!TEcnaRead::ReadAveragedSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> "
03084 << fCnaWrite->fRootFileNameShort.Data() << ": ROOT file failed ->"
03085 << " quantity: <" << GetTypeOfQuantity(typ) << "> not available in file."
03086 << fTTBELL << endl;
03087 }
03088 }
03089 CloseRootFile(file_name);
03090 return vec;
03091 }
03092
03093
03094
03095
03096
03097
03098
03099
03100
03101
03102
03103
03104
03105
03106
03107
03108
03109
03110
03111
03112
03113 TString TEcnaRead::GetTypeOfQuantity(const CnaResultTyp arg_typ)
03114 {
03115 TString quantity_name = "?";
03116
03117 if( arg_typ == cTypNumbers)
03118 {
03119 if( fFlagSubDet == "EB" ){quantity_name = "SM numbers";}
03120 if( fFlagSubDet == "EE" ){quantity_name = "Dee numbers";}
03121 }
03122 if( arg_typ == cTypMSp ){quantity_name = "Mean of samples";}
03123 if( arg_typ == cTypSSp ){quantity_name = "Sigma of samples";}
03124
03125 if( arg_typ == cTypNbOfEvts ){quantity_name = "Number of events";}
03126 if( arg_typ == cTypPed ){quantity_name = "Pedestals";}
03127 if( arg_typ == cTypTno ){quantity_name = "Total noise";}
03128 if( arg_typ == cTypLfn ){quantity_name = "LF noise";}
03129 if( arg_typ == cTypHfn ){quantity_name = "HF noise";}
03130 if( arg_typ == cTypMeanCorss){quantity_name = "Mean of cor(s,s')";}
03131 if( arg_typ == cTypSigCorss ){quantity_name = "Sigma of cor(s,s')";}
03132
03133 if( arg_typ == cTypAvPed ){quantity_name = "Averaged pedestals";}
03134 if( arg_typ == cTypAvTno ){quantity_name = "Averaged total noise";}
03135 if( arg_typ == cTypAvLfn ){quantity_name = "Averaged LF noise";}
03136 if( arg_typ == cTypAvHfn ){quantity_name = "Averaged HF noise";}
03137 if( arg_typ == cTypAvMeanCorss){quantity_name = "Averaged mean of cor(s,s')";}
03138 if( arg_typ == cTypAvSigCorss ){quantity_name = "Averaged sigma of cor(s,s')";}
03139
03140 if( arg_typ == cTypAdcEvt ){quantity_name = "Sample ADC a.f.o event number";}
03141
03142 if( arg_typ == cTypCovCss ){quantity_name = "Cov(s,s')";}
03143 if( arg_typ == cTypCorCss ){quantity_name = "Cor(s,s')";}
03144 if( arg_typ == cTypLfCov ){quantity_name = "LF Cov(c,c')";}
03145 if( arg_typ == cTypLfCor ){quantity_name = "LF Cor(c,c')";}
03146 if( arg_typ == cTypHfCov ){quantity_name = "HF Cov(c,c')";}
03147 if( arg_typ == cTypHfCor ){quantity_name = "HF Cor(c,c')";}
03148
03149 if( fFlagSubDet == "EB" )
03150 {
03151 if( arg_typ == cTypLFccMoStins){quantity_name = "Mean LF |Cor(c,c')| in (tow,tow')";}
03152 if( arg_typ == cTypHFccMoStins){quantity_name = "Mean HF |Cor(c,c')| in (tow,tow')";}
03153 }
03154 if( fFlagSubDet == "EE" )
03155 {
03156 if( arg_typ == cTypLFccMoStins){quantity_name = "Mean LF |Cor(c,c')| in (SC,SC')";}
03157 if( arg_typ == cTypHFccMoStins){quantity_name = "Mean HF |Cor(c,c')| in (SC,SC')";}
03158 }
03159 return quantity_name;
03160 }
03161
03162
03163
03164
03165
03166
03167 TString TEcnaRead::GetRootFileName(){return fCnaWrite->GetRootFileName();}
03168 TString TEcnaRead::GetRootFileNameShort(){return fCnaWrite->GetRootFileNameShort();}
03169
03170
03171
03172
03173
03174
03175
03176 Int_t TEcnaRead::GetStexStinFromIndex(const Int_t& i0StexStinEcna)
03177 {
03178
03179
03180 Int_t number = -1;
03181 TVectorD vec(fEcal->MaxStinEcnaInStex());
03182 for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
03183 vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
03184 number = (Int_t)vec(i0StexStinEcna);
03185 return number;
03186 }
03187
03188 TString TEcnaRead::GetAnalysisName()
03189 {
03190 TString astring = "?";
03191 if (fFileHeader != 0){astring = fFileHeader->fTypAna;}
03192 else {cout << "!TEcnaRead::GetAnalysisName()> fFileHeader pointer = "
03193 << fFileHeader << endl;}
03194 return astring;
03195 }
03196
03197 Int_t TEcnaRead::GetFirstReqEvtNumber()
03198 {
03199 Int_t number = -1;
03200 if (fFileHeader != 0){number = fFileHeader->fFirstReqEvtNumber;}
03201 else {cout << "!TEcnaRead::GetFirstReqEvtNumber()> fFileHeader pointer = "
03202 << fFileHeader << endl;}
03203 return number;
03204 }
03205
03206 Int_t TEcnaRead::GetReqNbOfEvts()
03207 {
03208 Int_t number = -1;
03209 if (fFileHeader != 0){number = fFileHeader->fReqNbOfEvts;}
03210 else {cout << "!TEcnaRead::GetReqNbOfEvts()> fFileHeader pointer = "
03211 << fFileHeader << endl;}
03212 return number;
03213 }
03214
03215
03216 Int_t TEcnaRead::GetNumberOfBinsSampleAsFunctionOfTime(){return GetReqNbOfEvts();}
03217
03218
03219
03220
03221
03222 Int_t TEcnaRead::GetStinIndex(const Int_t & n1StexStin)
03223 {
03224
03225
03226 if(fFlagPrint == fCodePrintAllComments){
03227 cout << "*TEcnaRead::GetStinIndex(...)> fEcal->MaxStinEcnaInStex() = "
03228 << fEcal->MaxStinEcnaInStex() << endl
03229 << " n1StexStin = " << n1StexStin
03230 << endl << endl;}
03231
03232 Int_t Stin_index = n1StexStin-1;
03233
03234 #define NOGT
03235 #ifndef NOGT
03236 Int_t Stin_index = -1;
03237 TVectorD vec(fEcal->MaxStinEcnaInStex());
03238 for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
03239 vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
03240
03241
03242
03243 for(Int_t i=0; i < fEcal->MaxStinEcnaInStex(); i++)
03244 {
03245 if(fFlagPrint == fCodePrintAllComments){
03246 cout << "*TEcnaRead::GetStinIndex(...)> StinNumber[" << i << "] = "
03247 << vec[i] << endl;}
03248 if ( vec[i] == n1StexStin ){Stin_index = i;}
03249 }
03250
03251 if(fFlagPrint == fCodePrintAllComments){
03252 cout << "~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-" << endl;
03253 cout << "*TEcnaRead::GetStinIndex> Stin number: " << n1StexStin << endl
03254 << " Stin index : " << Stin_index << endl;
03255 cout << "~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-" << endl;}
03256
03257 if ( Stin_index < 0 )
03258 {
03259 if(fFlagPrint == fCodePrintAllComments){
03260 cout << "!TEcnaRead::GetStinIndex *** WARNING ***> n1StexStin" << n1StexStin << " : "
03261 << "index Stin not found"
03262 << fTTBELL << endl;}
03263 }
03264 #endif // NOGT
03265
03266 return Stin_index;
03267 }
03268
03269
03270
03271
03272
03273
03274
03275 void TEcnaRead::PrintComments()
03276 {
03277
03278
03279 fFlagPrint = fCodePrintComments;
03280 cout << "*TEcnaRead::PrintComments()> Warnings and some comments on init will be printed" << endl;
03281 }
03282
03283 void TEcnaRead::PrintWarnings()
03284 {
03285
03286
03287 fFlagPrint = fCodePrintWarnings;
03288 cout << "*TEcnaRead::PrintWarnings()> Warnings will be printed" << endl;
03289 }
03290
03291 void TEcnaRead::PrintAllComments()
03292 {
03293
03294
03295 fFlagPrint = fCodePrintAllComments;
03296 cout << "*TEcnaRead::PrintAllComments()> All the comments will be printed" << endl;
03297 }
03298
03299 void TEcnaRead::PrintNoComment()
03300 {
03301
03302
03303 fFlagPrint = fCodePrintNoComment;
03304 }