00001
00002
00003
00004
00005 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TCnaReadEB.h"
00006
00007 #include <math.h>
00008
00009 R__EXTERN TCnaRootFile *gCnaRootFile;
00010
00011 ClassImp(TCnaReadEB)
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 TCnaReadEB::TCnaReadEB()
00235 {
00236
00237
00238
00239 fTTBELL = '\007';
00240
00241 fgMaxCar = (Int_t)512;
00242 fDim_name = fgMaxCar;
00243
00244
00245
00246 fCodeHeader = 0;
00247 fCodeRoot = 1;
00248 fCodeCorresp = 2;
00249
00250 TCnaParameters* MyParameters = new TCnaParameters(); fCnew++;
00251
00252 fCodePrintNoComment = MyParameters->GetCodePrint("NoComment");
00253 fCodePrintWarnings = MyParameters->GetCodePrint("Warnings ");
00254 fCodePrintComments = MyParameters->GetCodePrint("Comments");
00255 fCodePrintAllComments = MyParameters->GetCodePrint("AllComments");
00256
00257 delete MyParameters; fCdelete++;
00258
00259
00260 fFlagPrint = fCodePrintWarnings;
00261
00262 Init();
00263 }
00264
00265 void TCnaReadEB::Init()
00266 {
00267
00268
00269 fCnew = 0;
00270 fCdelete = 0;
00271
00272 fFileHeader = new TCnaHeaderEB();
00273 fOpenRootFile = kFALSE;
00274
00275 fReadyToReadRootFile = 0;
00276 fLookAtRootFile = 0;
00277
00278 fUserSamp = -1;
00279 fUserChan = -1;
00280
00281 fSectChanSizeX = 0;
00282 fSectChanSizeY = 0;
00283 fSectSampSizeX = 0;
00284 fSectSampSizeY = 0;
00285
00286 fT1d_SMtowFromIndex = 0;
00287
00288 fSpecialSMTowerNotIndexed = -1;
00289
00290
00291 fMemoTowerNumbers = 0;
00292 fTagTowerNumbers = 0;
00293
00294
00295 fDataExist = kFALSE;
00296
00297
00298 Int_t MaxCar = fgMaxCar;
00299 fPathAscii.Resize(MaxCar);
00300 fPathAscii = "fPathAscii> not defined";
00301
00302 MaxCar = fgMaxCar;
00303 fPathRoot.Resize(MaxCar);
00304 fPathRoot = "fPathRoot> not defined";
00305
00306 MaxCar = fgMaxCar;
00307 fRootFileName.Resize(MaxCar);
00308 fRootFileName = "fRootFileName> not defined";
00309
00310 MaxCar = fgMaxCar;
00311 fRootFileNameShort.Resize(MaxCar);
00312 fRootFileNameShort = "fRootFileNameShort> not defined";
00313
00314 MaxCar = fgMaxCar;
00315 fAsciiFileName.Resize(MaxCar);
00316 fAsciiFileName = "fAsciiFileName> not defined";
00317
00318 MaxCar = fgMaxCar;
00319 fAsciiFileNameShort.Resize(MaxCar);
00320 fAsciiFileNameShort = "fAsciiFileNameShort> not defined";
00321
00322 fUserSamp = 0;
00323 fUserChan = 0;
00324 }
00325
00326
00327 void TCnaReadEB::fCopy(const TCnaReadEB& rund)
00328 {
00329
00330
00331 fFileHeader = rund.fFileHeader;
00332 fOpenRootFile = rund.fOpenRootFile;
00333
00334 fUserSamp = rund.fUserSamp;
00335 fUserChan = rund.fUserChan;
00336
00337 fSectChanSizeX = rund.fSectChanSizeX;
00338 fSectChanSizeY = rund.fSectChanSizeY;
00339 fSectSampSizeX = rund.fSectSampSizeX;
00340 fSectSampSizeY = rund.fSectSampSizeY;
00341
00342
00343
00344
00345
00346 fCodeHeader = rund.fCodeHeader;
00347 fCodeRoot = rund.fCodeRoot;
00348
00349 fCodePrintComments = rund.fCodePrintComments;
00350 fCodePrintWarnings = rund.fCodePrintWarnings;
00351 fCodePrintAllComments = rund.fCodePrintAllComments;
00352 fCodePrintNoComment = rund.fCodePrintNoComment;
00353
00354
00355 fTagTowerNumbers = rund.fTagTowerNumbers;
00356
00357 fFlagPrint = rund.fFlagPrint;
00358
00359 fRootFileName = rund.fRootFileName;
00360 fRootFileNameShort = rund.fRootFileNameShort;
00361 fAsciiFileName = rund.fAsciiFileName;
00362 fAsciiFileNameShort = rund.fAsciiFileNameShort;
00363
00364 fDim_name = rund.fDim_name;
00365 fPathRoot = rund.fPathRoot;
00366 fPathAscii = rund.fPathAscii;
00367
00368 fCnew = rund.fCnew;
00369 fCdelete = rund.fCdelete;
00370 }
00371
00372
00373
00374
00375
00376
00377
00378 TCnaReadEB::TCnaReadEB(const TCnaReadEB& dcop)
00379 {
00380 cout << "*TCnaReadEB::TCnaReadEB(const TCnaReadEB& dcop)> "
00381 << " It is time to write a copy constructor" << endl
00382 << " type an integer value and then RETURN to continue"
00383 << endl;
00384
00385 { Int_t cintoto; cin >> cintoto; }
00386
00387 }
00388
00389
00390
00391
00392
00393
00394
00395 TCnaReadEB& TCnaReadEB::operator=(const TCnaReadEB& dcop)
00396 {
00397
00398
00399 fCopy(dcop);
00400 return *this;
00401 }
00402
00403
00404
00405
00406
00407
00408
00409 void TCnaReadEB::GetReadyToReadRootFile(TString typ_ana,
00410 const Int_t& run_number, const Int_t& nfirst,
00411 const Int_t& nevents, const Int_t& super_module,
00412 TString path_root)
00413 {
00414
00415
00416 Init();
00417
00418 Text_t *h_name = "CnaHeader";
00419 Text_t *h_title = "CnaHeader";
00420
00421 fFileHeader = new TCnaHeaderEB(h_name, h_title ,
00422 typ_ana, run_number, nfirst, nevents, super_module);
00423
00424
00425
00426
00427
00428
00429
00430
00431 fPathRoot = path_root;
00432
00433
00434 DefineResultsRootFilePath(path_root);
00435
00436 if( fFlagPrint == fCodePrintAllComments || fFlagPrint == fCodePrintComments ){
00437 cout << endl;
00438 cout << "*TCnaReadEB::GetReadyToReadRootFile(...)>" << endl
00439 << " The method has been called with the following argument values:" << endl
00440 << " Analysis name = "
00441 << fFileHeader->fTypAna << endl
00442 << " Run number = "
00443 << fFileHeader->fRunNumber << endl
00444 << " First taken event = "
00445 << fFileHeader->fFirstEvt << endl
00446 << " Number of taken events = "
00447 << fFileHeader->fNbOfTakenEvts << endl
00448 << " Super-module number = "
00449 << fFileHeader->fSuperModule << endl
00450 << " Path for the ROOT file = "
00451 << fPathRoot << endl
00452 << endl;}
00453
00454 fReadyToReadRootFile = 1;
00455
00456 if(fFlagPrint == fCodePrintAllComments){
00457 cout << "*TCnaReadEB::GetReadyToReadRootFile(...)> Leaving the method."
00458 << endl;}
00459 }
00460
00461
00462
00463
00464
00465
00466
00467 TCnaReadEB::~TCnaReadEB()
00468 {
00469
00470
00471 if(fFlagPrint == fCodePrintAllComments || fFlagPrint == fCodePrintComments){
00472 cout << "*TCnaReadEB::~TCnaReadEB()> Entering destructor" << endl;}
00473
00474 if (fT1d_SMtowFromIndex != 0){delete [] fT1d_SMtowFromIndex; fCdelete++;}
00475 if (fTagTowerNumbers != 0){delete [] fTagTowerNumbers; fCdelete++;}
00476
00477 if ( fCnew != fCdelete )
00478 {
00479 cout << "!TCnaReadEB/destructor> WRONG MANAGEMENT OF ALLOCATIONS: fCnew = "
00480 << fCnew << ", fCdelete = " << fCdelete << fTTBELL << endl;
00481 }
00482 else
00483 {
00484
00485
00486 }
00487
00488 if(fFlagPrint == fCodePrintAllComments || fFlagPrint == fCodePrintComments){
00489 cout << "*TCnaReadEB::~TCnaReadEB()> End of destructor " << endl;}
00490 }
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503 void TCnaReadEB::DefineResultsRootFilePath(TString path_name)
00504 {
00505
00506
00507 fPathRoot = path_name;
00508 Int_t i_code = fCodeRoot;
00509 fMakeResultsFileName(i_code);
00510 }
00511
00512
00513
00514
00515
00516
00517
00518 time_t TCnaReadEB::GetStartTime()
00519 {
00520 return fFileHeader->fStartTime;
00521 }
00522
00523 time_t TCnaReadEB::GetStopTime()
00524 {
00525 return fFileHeader->fStopTime;
00526 }
00527
00528 TString TCnaReadEB::GetStartDate()
00529 {
00530 return fFileHeader->fStartDate;
00531 }
00532
00533 TString TCnaReadEB::GetStopDate()
00534 {
00535 return fFileHeader->fStopDate;
00536 }
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552 Bool_t TCnaReadEB::LookAtRootFile()
00553 {
00554
00555
00556 fLookAtRootFile = 0;
00557
00558 Bool_t ok_read = kFALSE;
00559
00560 if (fReadyToReadRootFile == 1)
00561 {
00562 if ( ReadRootFileHeader(0) == kTRUE )
00563 {
00564
00565 if ( fTagTowerNumbers == 0 ){fTagTowerNumbers = new Int_t[1]; fCnew++;}
00566
00567
00568
00569 if (fT1d_SMtowFromIndex == 0)
00570 {
00571 fT1d_SMtowFromIndex = new Int_t[fFileHeader->fMaxTowInSM]; fCnew++;
00572 }
00573
00574
00575 TVectorD vec(fFileHeader->fMaxTowInSM);
00576 vec = ReadTowerNumbers();
00577
00578 for (Int_t i = 0; i < fFileHeader->fMaxTowInSM; i++ ){
00579 fT1d_SMtowFromIndex[i] = (Int_t)vec(i);}
00580
00581 fTagTowerNumbers[0] = 1; fFileHeader->fTowerNumbersCalc++;
00582 ok_read = kTRUE;
00583
00584 fLookAtRootFile = 1;
00585 }
00586 else
00587 {
00588 cout << "!TCnaReadEB::LookAtRootFile()> *** ERROR ***>"
00589 << " ROOT file not found " << fTTBELL << endl;
00590 ok_read = kFALSE;
00591 }
00592 }
00593 else
00594 {
00595 cout << "!TCnaReadEB::LookAtRootFile()> *** ERROR ***>"
00596 << " GetReadyToReadRootFile not called " << fTTBELL << endl;
00597 ok_read = kFALSE;
00598 }
00599 return ok_read;
00600 }
00601
00602
00603
00604
00605
00606
00607 Bool_t TCnaReadEB::ReadRootFileHeader(const Int_t& i_print)
00608 {
00609
00610
00611 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
00612
00613 if( i_print == 1){cout << "*TCnaReadEB::ReadRootFileHeader> file_name = "
00614 << file_name << endl;}
00615
00616 Bool_t ok_open = kFALSE;
00617 Bool_t ok_read = kFALSE;
00618
00619 if ( fOpenRootFile )
00620 {
00621 cout << "!TCnaReadEB::ReadRootFileHeader(...)*** ERROR ***> "
00622 << "Reading header on file already open."
00623 << endl;
00624 }
00625 else
00626 {
00627 ok_open = OpenRootFile(file_name, "READ");
00628
00629 if(ok_open)
00630 {
00631 TCnaHeaderEB *h;
00632 h =(TCnaHeaderEB *)gCnaRootFile->fRootFile->Get("CnaHeader");
00633
00634
00635
00636
00637 fFileHeader->fStartTime = h->fStartTime;
00638 fFileHeader->fStopTime = h->fStopTime;
00639 fFileHeader->fStartDate = h->fStartDate;
00640 fFileHeader->fStopDate = h->fStopDate;
00641
00642 fFileHeader->fNentries = h->fNentries;
00643
00644
00645 fFileHeader->fMaxTowInSM = h->fMaxTowInSM;
00646 fFileHeader->fMaxCrysInTow = h->fMaxCrysInTow;
00647 fFileHeader->fMaxSampADC = h->fMaxSampADC;
00648 fFileHeader->fNbBinsADC = h->fNbBinsADC;
00649
00650 fFileHeader->fNbBinsSampTime = h->fNbBinsSampTime;
00651
00652 fFileHeader->fMaxCrysInSM = h->fMaxCrysInSM;
00653
00654
00655 fFileHeader->fTowerNumbersCalc = h->fTowerNumbersCalc;
00656 fFileHeader->fSampTimeCalc = h->fSampTimeCalc;
00657 fFileHeader->fEvCalc = h->fEvCalc;
00658 fFileHeader->fVarCalc = h->fVarCalc;
00659 fFileHeader->fEvtsCalc = h->fEvtsCalc;
00660 fFileHeader->fCovCssCalc = h->fCovCssCalc;
00661 fFileHeader->fCorCssCalc = h->fCorCssCalc;
00662 fFileHeader->fCovSccCalc = h->fCovSccCalc;
00663 fFileHeader->fCorSccCalc = h->fCorSccCalc;
00664 fFileHeader->fCovSccMosCalc = h->fCovSccMosCalc;
00665 fFileHeader->fCorSccMosCalc = h->fCorSccMosCalc;
00666 fFileHeader->fCovMosccMotCalc = h->fCovMosccMotCalc;
00667 fFileHeader->fCorMosccMotCalc = h->fCorMosccMotCalc;
00668 fFileHeader->fEvCorCssCalc = h->fEvCorCssCalc;
00669 fFileHeader->fSigCorCssCalc = h->fSigCorCssCalc;
00670 fFileHeader->fSvCorrecCovCssCalc = h->fSvCorrecCovCssCalc;
00671 fFileHeader->fCovCorrecCovCssCalc = h->fCovCorrecCovCssCalc;
00672 fFileHeader->fCorCorrecCovCssCalc = h->fCorCorrecCovCssCalc;
00673
00674 if(i_print == 1){fFileHeader->Print();}
00675 CloseRootFile(file_name);
00676 ok_read = kTRUE;
00677 }
00678 else
00679 {
00680 cout << "!TCnaReadEB::ReadRootFileHeader(...) *** ERROR ***> Open ROOT file failed for file: "
00681 << file_name << fTTBELL << endl;
00682 ok_read = kFALSE;
00683 }
00684 }
00685 return ok_read;
00686 }
00687
00688
00689
00690
00691
00692
00693 Bool_t TCnaReadEB::OpenRootFile(Text_t *name, TString status) {
00694
00695
00696 TString s_path;
00697 s_path = fPathRoot;
00698 s_path.Append('/');
00699 s_path.Append(name);
00700
00701 gCnaRootFile = new TCnaRootFile(s_path.Data(), status); fCnew++;
00702
00703 Bool_t ok_open = kFALSE;
00704
00705 if ( gCnaRootFile->fRootFileStatus == "RECREATE" )
00706 {
00707 ok_open = gCnaRootFile->OpenW();
00708 }
00709 if ( gCnaRootFile->fRootFileStatus == "READ" )
00710 {
00711 ok_open = gCnaRootFile->OpenR();
00712 }
00713
00714 if (!ok_open)
00715 {
00716 cout << "TCnaReadEB::OpenRootFile> " << s_path.Data() << ": file not found." << endl;
00717 delete gCnaRootFile; fCdelete++;
00718 }
00719 else
00720 {
00721 if(fFlagPrint == fCodePrintAllComments){
00722 cout << "*TCnaReadEB::OpenRootFile> Open ROOT file OK " << endl;}
00723 fOpenRootFile = kTRUE;
00724 }
00725 return ok_open;
00726 }
00727
00728
00729
00730
00731
00732
00733 Bool_t TCnaReadEB::CloseRootFile(Text_t *name) {
00734
00735
00736 Bool_t ok_close = kFALSE;
00737
00738 if (fOpenRootFile == kTRUE )
00739 {
00740 gCnaRootFile->CloseFile();
00741
00742 if(fFlagPrint == fCodePrintAllComments){
00743 cout << "*TCnaReadEB::CloseRootFile> Close ROOT file OK " << endl;}
00744
00745 delete gCnaRootFile; fCdelete++;
00746 fOpenRootFile = kFALSE;
00747 ok_close = kTRUE;
00748 }
00749 else
00750 {
00751 cout << "*TCnaReadEB::CloseRootFile(...)> no close since no file is open"
00752 << fTTBELL << endl;
00753 }
00754
00755 return ok_close;
00756 }
00757
00758
00759
00760
00761
00762
00763
00764 Bool_t TCnaReadEB::DataExist()
00765 {
00766
00767
00768
00769 return fDataExist;
00770 }
00771
00772
00773
00774
00775
00776 TVectorD TCnaReadEB::ReadTowerNumbers()
00777 {
00778
00779
00780
00781
00782 TVectorD vec(fFileHeader->fMaxTowInSM);
00783
00784 if (fMemoTowerNumbers == 0)
00785 {
00786 CnaResultTyp typ = cTypTowerNumbers;
00787 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
00788
00789
00790
00791
00792 Bool_t ok_open = kFALSE;
00793 Bool_t ok_read = kFALSE;
00794
00795 if ( fOpenRootFile )
00796 {
00797 cout << "!TCnaReadEB::ReadTowerNumbers(...) *** ERROR ***> Reading on file already open."
00798 << fTTBELL << endl;
00799 }
00800 else
00801 {
00802 ok_open = OpenRootFile(file_name, "READ");
00803
00804 Int_t i_zero = 0;
00805 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
00806
00807 if ( ok_read == kTRUE )
00808 {
00809 fDataExist = kTRUE;
00810
00811 for ( Int_t i_tow = 0; i_tow < fFileHeader->fMaxTowInSM; i_tow++)
00812 {
00813 vec(i_tow) = gCnaRootFile->fCnaIndivResult->fMatHis(0,i_tow);
00814 fT1d_SMtowFromIndex[i_tow] = (Int_t)vec(i_tow);
00815 fMemoTowerNumbers = 1;
00816 }
00817 }
00818 else
00819 {
00820 fDataExist = kFALSE;
00821 cout << "!TCnaReadEB::ReadTowerNumbers(...) *** ERROR ***> "
00822 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
00823 << " File = " << fRootFileNameShort.Data()
00824 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
00825 << fTTBELL << endl;
00826 }
00827 }
00828
00829 CloseRootFile(file_name);
00830
00831 if( ok_read == kTRUE )
00832 {
00833
00834
00835 if(fFlagPrint != fCodePrintNoComment)
00836 {
00837 for(Int_t i=0; i < fFileHeader->fMaxTowInSM; i++)
00838 {
00839 cout << "*TCnaReadEB::ReadTowerNumbers(...)> TowerNumber[" << i << "] = "
00840 << vec[i] << endl;
00841 }
00842 }
00843 }
00844 }
00845 else
00846 {
00847 for ( Int_t i_tow = 0; i_tow < fFileHeader->fMaxTowInSM; i_tow++)
00848 {
00849 vec(i_tow) = fT1d_SMtowFromIndex[i_tow];
00850 }
00851 }
00852 return vec;
00853 }
00854
00855
00856
00857
00858
00859
00860 TMatrixD TCnaReadEB::ReadNumbersOfFoundEventsForSamples(const Int_t& SMTow)
00861 {
00862
00863
00864
00865
00866 Int_t tow_index = GetTowerIndex(SMTow);
00867
00868 TMatrixD mat(fFileHeader->fMaxCrysInTow, fFileHeader->fMaxSampADC);
00869
00870 if( tow_index >= 0 )
00871 {
00872 if(fLookAtRootFile == 1)
00873 {
00874 CnaResultTyp typ = cTypLastEvtNumber;
00875 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
00876
00877 Bool_t ok_open = kFALSE;
00878 Bool_t ok_read = kFALSE;
00879
00880 if ( fOpenRootFile )
00881 {
00882 cout << "!TCnaReadEB::ReadNumbersOfFoundEventsForSamples(...) *** ERROR ***> "
00883 << " Reading on file already open." << fTTBELL << endl;
00884 }
00885 else
00886 {
00887 ok_open = OpenRootFile(file_name, "READ");
00888
00889 Int_t i_zero = 0;
00890 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
00891
00892 if ( ok_read == kTRUE )
00893 {
00894 fDataExist = kTRUE;
00895 for (Int_t i_crys = 0; i_crys < fFileHeader->fMaxCrysInTow; i_crys++)
00896 {
00897 Int_t j_cna_chan = tow_index*fFileHeader->fMaxCrysInTow + i_crys;
00898 for ( Int_t i_samp = 0; i_samp < fFileHeader->fMaxSampADC; i_samp++)
00899 {
00900 mat(i_crys, i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(j_cna_chan, i_samp);
00901 }
00902 }
00903 }
00904 else
00905 {
00906 fDataExist = kFALSE;
00907 cout << "!TCnaReadEB::ReadNumbersOfFoundEventsForSamples(...) *** ERROR ***> "
00908 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
00909 << " File = " << fRootFileNameShort.Data()
00910 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
00911 << fTTBELL << endl;
00912 }
00913 }
00914 CloseRootFile(file_name);
00915 }
00916 else
00917 {
00918 cout << "!TCnaReadEB::ReadNumbersOfFoundEventsForSamples(...) *** ERROR ***> "
00919 << "It is not possible to access the number of found events: the ROOT file has not been read."
00920 << fTTBELL << endl;
00921 }
00922 }
00923 return mat;
00924 }
00925
00926
00927
00928
00929
00930
00931
00932 TVectorD TCnaReadEB::ReadSampleAsFunctionOfTime(const Int_t& SMTow,
00933 const Int_t& TowEcha,
00934 const Int_t& sample)
00935 {
00936
00937
00938
00939
00940 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
00941
00942 TVectorD vec(fFileHeader->fNbBinsSampTime);
00943
00944 CnaResultTyp typ = cTypSampTime;
00945
00946 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
00947
00948 Bool_t ok_open = kFALSE;
00949 Bool_t ok_read = kFALSE;
00950
00951 if ( fOpenRootFile )
00952 {
00953 cout << "!TCnaReadEB::ReadSampleAsFunctionOfTime(...) *** ERROR ***> "
00954 << "Reading on file already open." << fTTBELL << endl;
00955 }
00956 else
00957 {
00958 ok_open = OpenRootFile(file_name, "READ");
00959 ok_read = gCnaRootFile->ReadElement(typ, user_cna_chan);
00960
00961 if ( ok_read == kTRUE )
00962 {
00963 fDataExist = kTRUE;
00964 for ( Int_t i_bin = 0; i_bin < fFileHeader->fNbBinsSampTime; i_bin++)
00965 {
00966 vec(i_bin) = gCnaRootFile->fCnaIndivResult->fMatHis(sample, i_bin);
00967 }
00968 }
00969 else
00970 {
00971 fDataExist = kFALSE;
00972 cout << "!TCnaReadEB::ReadSampleAsFunctionOfTime(...) *** ERROR ***> "
00973 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
00974 << ", user_cna_chan = " << user_cna_chan
00975 << " File = " << fRootFileNameShort.Data()
00976 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
00977 << fTTBELL << endl;
00978 }
00979 }
00980
00981 CloseRootFile(file_name);
00982
00983 return vec;
00984 }
00985
00986
00987
00988
00989
00990
00991 TVectorD TCnaReadEB::ReadExpectationValuesOfSamples(const Int_t & SMTow,
00992 const Int_t & TowEcha)
00993 {
00994
00995
00996
00997
00998 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
00999
01000 TVectorD vec(fFileHeader->fMaxSampADC);
01001
01002 CnaResultTyp typ = cTypEv;
01003
01004 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01005
01006 Bool_t ok_open = kFALSE;
01007 Bool_t ok_read = kFALSE;
01008
01009 if ( fOpenRootFile )
01010 {
01011 cout << "!TCnaReadEB::ReadExpectationValuesOfSamples(...) *** ERROR ***> "
01012 << " Reading on file already open." << fTTBELL << endl;
01013 }
01014 else
01015 {
01016 ok_open = OpenRootFile(file_name, "READ");
01017
01018 Int_t i_zero = 0;
01019 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01020
01021 if ( ok_read == kTRUE )
01022 {
01023 fDataExist = kTRUE;
01024 for ( Int_t i_samp = 0; i_samp < fFileHeader->fMaxSampADC; i_samp++)
01025 {
01026 vec(i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(user_cna_chan, i_samp);
01027 }
01028 }
01029 else
01030 {
01031 fDataExist = kFALSE;
01032 cout << "!TCnaReadEB::ReadExpectationValuesOfSamples(...) *** ERROR ***> "
01033 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01034 << " File = " << fRootFileNameShort.Data()
01035 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01036 << fTTBELL << endl;
01037 }
01038 }
01039 CloseRootFile(file_name);
01040 return vec;
01041 }
01042
01043
01044
01045
01046
01047
01048 TVectorD TCnaReadEB::ReadVariancesOfSamples(const Int_t & SMTow,
01049 const Int_t & TowEcha)
01050 {
01051
01052
01053
01054
01055 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
01056
01057 TVectorD vec(fFileHeader->fMaxSampADC);
01058
01059 CnaResultTyp typ = cTypVar;
01060
01061 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01062
01063 Bool_t ok_open = kFALSE;
01064 Bool_t ok_read = kFALSE;
01065
01066 if ( fOpenRootFile )
01067 {
01068 cout << "!TCnaReadEB::ReadVariancesOfSamples(...) *** ERROR ***> "
01069 << "Reading on file already open." << fTTBELL << endl;
01070 }
01071 else
01072 {
01073 ok_open = OpenRootFile(file_name, "READ");
01074
01075 Int_t i_zero = 0;
01076 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01077
01078 if ( ok_read == kTRUE )
01079 {
01080 fDataExist = kTRUE;
01081 for ( Int_t i_samp = 0; i_samp < fFileHeader->fMaxSampADC; i_samp++)
01082 {
01083 vec(i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(user_cna_chan,i_samp);
01084 }
01085 }
01086 else
01087 {
01088 fDataExist = kFALSE;
01089 cout << "!TCnaReadEB::ReadVariancesOfSamples(...) *** ERROR ***> "
01090 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01091 << " File = " << fRootFileNameShort.Data()
01092 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01093 << fTTBELL << endl;
01094 }
01095 }
01096 CloseRootFile(file_name);
01097 return vec;
01098 }
01099
01100
01101
01102
01103
01104 TVectorD TCnaReadEB::ReadSigmasOfSamples(const Int_t & SMTow,
01105 const Int_t & TowEcha)
01106 {
01107
01108
01109
01110
01111 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
01112
01113 TVectorD vec(fFileHeader->fMaxSampADC);
01114
01115 CnaResultTyp typ = cTypVar;
01116
01117 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01118
01119 Bool_t ok_open = kFALSE;
01120 Bool_t ok_read = kFALSE;
01121
01122 if ( fOpenRootFile )
01123 {
01124 cout << "!TCnaReadEB::ReadSigmasOfSamples(...) *** ERROR ***> "
01125 << "Reading on file already open." << fTTBELL << endl;
01126 }
01127 else
01128 {
01129 ok_open = OpenRootFile(file_name, "READ");
01130
01131 Int_t i_zero = 0;
01132 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01133
01134 if ( ok_read == kTRUE )
01135 {
01136 fDataExist = kTRUE;
01137 for ( Int_t i_samp = 0; i_samp < fFileHeader->fMaxSampADC; i_samp++)
01138 {
01139 vec(i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(user_cna_chan,i_samp);
01140 if( vec(i_samp) >= (Double_t)0. )
01141 {
01142 vec(i_samp) = (Double_t)sqrt((Double_t)vec(i_samp));
01143 }
01144 else
01145 {
01146 vec(i_samp) = (Double_t)(-1.);
01147 cout << cout << "!TCnaReadEB::ReadSigmasOfSamples(...) *** ERROR ***> "
01148 << "Negative variance! Sigma forced to -1" << fTTBELL << endl;
01149 }
01150 }
01151 }
01152 else
01153 {
01154 fDataExist = kFALSE;
01155 cout << "!TCnaReadEB::ReadSigmasOfSamples(...) *** ERROR ***> "
01156 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01157 << " File = " << fRootFileNameShort.Data()
01158 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01159 << fTTBELL << endl;
01160 }
01161 }
01162 CloseRootFile(file_name);
01163 return vec;
01164 }
01165
01166
01167
01168
01169
01170
01171
01172 TVectorD TCnaReadEB::ReadEventDistribution(const Int_t& SMTow,
01173 const Int_t& TowEcha,
01174 const Int_t& sample)
01175 {
01176
01177
01178
01179
01180 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
01181
01182 TVectorD vec(fFileHeader->fNbBinsADC);
01183
01184 CnaResultTyp typ = cTypEvts;
01185
01186 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01187
01188 Bool_t ok_open = kFALSE;
01189 Bool_t ok_read = kFALSE;
01190
01191 if ( fOpenRootFile )
01192 {
01193 cout << "!TCnaReadEB::ReadEventDistribution(...) *** ERROR ***> "
01194 << "Reading on file already open." << fTTBELL << endl;
01195 }
01196 else
01197 {
01198 ok_open = OpenRootFile(file_name, "READ");
01199
01200 ok_read = gCnaRootFile->ReadElement(typ, user_cna_chan);
01201
01202 if ( ok_read == kTRUE )
01203 {
01204 fDataExist = kTRUE;
01205 for ( Int_t i_bin = 0; i_bin < fFileHeader->fNbBinsADC; i_bin++)
01206 {
01207 vec(i_bin) = gCnaRootFile->fCnaIndivResult->fMatHis(sample, i_bin);
01208 }
01209 }
01210 else
01211 {
01212 fDataExist = kFALSE;
01213 cout << "!TCnaReadEB::ReadEventDistribution(...) *** ERROR ***> "
01214 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01215 << " File = " << fRootFileNameShort.Data()
01216 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01217 << fTTBELL << endl;
01218 }
01219 }
01220
01221 CloseRootFile(file_name);
01222
01223 return vec;
01224 }
01225
01226
01227
01228
01229
01230
01231
01232 Double_t TCnaReadEB::ReadEventDistributionXmin(const Int_t& SMTow,
01233 const Int_t& TowEcha,
01234 const Int_t& sample)
01235 {
01236
01237
01238
01239
01240 Double_t value = 0.;
01241 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
01242
01243 CnaResultTyp typ = cTypEvtsXmin;
01244
01245 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01246
01247 Bool_t ok_open = kFALSE;
01248 Bool_t ok_read = kFALSE;
01249
01250 if ( fOpenRootFile )
01251 {
01252 cout << "!TCnaReadEB::ReadEventDistributionXmin(...) *** ERROR ***> "
01253 << "Reading on file already open." << fTTBELL << endl;
01254 }
01255 else
01256 {
01257 ok_open = OpenRootFile(file_name, "READ");
01258
01259 ok_read = gCnaRootFile->ReadElement(typ, user_cna_chan);
01260
01261 if ( ok_read == kTRUE )
01262 {
01263 fDataExist = kTRUE;
01264 value = gCnaRootFile->fCnaIndivResult->fMatHis(0, sample);
01265 }
01266 else
01267 {
01268 fDataExist = kFALSE;
01269 cout << "!TCnaReadEB::ReadEventDistributionXmin(...) *** ERROR ***> "
01270 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01271 << " File = " << fRootFileNameShort.Data()
01272 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01273 << fTTBELL << endl;
01274 }
01275 }
01276 CloseRootFile(file_name);
01277
01278 return value;
01279 }
01280
01281
01282
01283
01284
01285
01286 Double_t TCnaReadEB::ReadEventDistributionXmax(const Int_t& SMTow,
01287 const Int_t& TowEcha,
01288 const Int_t& sample)
01289 {
01290
01291
01292
01293
01294 Double_t value = 0.;
01295 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
01296
01297 CnaResultTyp typ = cTypEvtsXmax;
01298
01299 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01300
01301 Bool_t ok_open = kFALSE;
01302 Bool_t ok_read = kFALSE;
01303
01304 if ( fOpenRootFile )
01305 {
01306 cout << "!TCnaReadEB::ReadEventDistributionXmax(...) *** ERROR ***> "
01307 << "Reading on file already open." << fTTBELL << endl;
01308 }
01309 else
01310 {
01311 ok_open = OpenRootFile(file_name, "READ");
01312
01313 ok_read = gCnaRootFile->ReadElement(typ, user_cna_chan);
01314
01315 if ( ok_read == kTRUE )
01316 {
01317 fDataExist = kTRUE;
01318 value = gCnaRootFile->fCnaIndivResult->fMatHis(0, sample);
01319 }
01320 else
01321 {
01322 fDataExist = kFALSE;
01323 cout << "!TCnaReadEB::ReadEventDistributionXmax(...) *** ERROR ***> "
01324 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01325 << " File = " << fRootFileNameShort.Data()
01326 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01327 << fTTBELL << endl;
01328 }
01329 }
01330
01331 CloseRootFile(file_name);
01332
01333 return value;
01334 }
01335
01336
01337
01338
01339
01340
01341 TMatrixD TCnaReadEB::ReadCovariancesBetweenSamples(const Int_t & SMTow,
01342 const Int_t & TowEcha)
01343 {
01344
01345
01346
01347 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
01348
01349 TMatrixD mat(fFileHeader->fMaxSampADC, fFileHeader->fMaxSampADC);
01350
01351 CnaResultTyp typ = cTypCovCss;
01352
01353 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01354
01355 Bool_t ok_open = kFALSE;
01356 Bool_t ok_read = kFALSE;
01357
01358 if ( fOpenRootFile )
01359 {
01360 cout << "!TCnaReadEB::ReadCovariancesBetweenSamples(...) *** ERROR ***> "
01361 << "Reading on file already open." << fTTBELL << endl;
01362 }
01363 else
01364 {
01365 ok_open = OpenRootFile(file_name, "READ");
01366
01367 ok_read = gCnaRootFile->ReadElement(typ, user_cna_chan);
01368
01369 if ( ok_read == kTRUE )
01370 {
01371 fDataExist = kTRUE;
01372 for ( Int_t i_samp = 0; i_samp < fFileHeader->fMaxSampADC; i_samp++)
01373 {
01374 for ( Int_t j_samp = 0; j_samp < fFileHeader->fMaxSampADC; j_samp++)
01375 {
01376 mat(i_samp, j_samp) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp,j_samp);
01377 }
01378 }
01379 }
01380 else
01381 {
01382 fDataExist = kFALSE;
01383 cout << "!TCnaReadEB::ReadCovariancesBetweenSamples() *** ERROR ***> "
01384 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01385 << " File = " << fRootFileNameShort.Data()
01386 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01387 << fTTBELL << endl;
01388 }
01389 }
01390
01391 CloseRootFile(file_name);
01392
01393 return mat;
01394 }
01395
01396
01397
01398
01399
01400
01401 TMatrixD TCnaReadEB::ReadCorrelationsBetweenSamples(const Int_t & SMTow,
01402 const Int_t & TowEcha)
01403 {
01404
01405
01406
01407 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
01408 TMatrixD mat(fFileHeader->fMaxSampADC, fFileHeader->fMaxSampADC);
01409 CnaResultTyp typ = cTypCorCss;
01410 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01411
01412 Bool_t ok_open = kFALSE;
01413 Bool_t ok_read = kFALSE;
01414
01415 if ( fOpenRootFile )
01416 {
01417 cout << "!TCnaReadEB::ReadCorrelationsBetweenSamples(...) *** ERROR ***> "
01418 << "Reading on file already open." << fTTBELL << endl;
01419 }
01420 else
01421 {
01422 ok_open = OpenRootFile(file_name, "READ");
01423 ok_read = gCnaRootFile->ReadElement(typ, user_cna_chan);
01424
01425 if ( ok_read == kTRUE )
01426 {
01427 fDataExist = kTRUE;
01428 for ( Int_t i_samp = 0; i_samp < fFileHeader->fMaxSampADC; i_samp++){
01429 for ( Int_t j_samp = 0; j_samp < fFileHeader->fMaxSampADC; j_samp++){
01430 mat(i_samp, j_samp) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp,j_samp);}}
01431 }
01432 else
01433 {
01434 fDataExist = kFALSE;
01435 cout << "!TCnaReadEB::ReadCorrelationsBetweenSamples() *** ERROR ***> "
01436 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01437 << " File = " << fRootFileNameShort.Data()
01438 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01439 << fTTBELL << endl;
01440 }
01441 }
01442 CloseRootFile(file_name);
01443 return mat;
01444 }
01445
01446
01447
01448
01449
01450 TVectorD TCnaReadEB::ReadRelevantCorrelationsBetweenSamples(const Int_t & SMTow,
01451 const Int_t & TowEcha)
01452 {
01453
01454
01455
01456 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
01457 Int_t nb_of_relevant = fFileHeader->fMaxSampADC*(fFileHeader->fMaxSampADC-1)/2;
01458 TVectorD vec_rel(nb_of_relevant);
01459 CnaResultTyp typ = cTypCorCss;
01460 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01461
01462 Bool_t ok_open = kFALSE;
01463 Bool_t ok_read = kFALSE;
01464
01465 if ( fOpenRootFile )
01466 {
01467 cout << "!TCnaReadEB::ReadRelevantCorrelationsBetweenSamples(...) *** ERROR ***> "
01468 << "Reading on file already open." << fTTBELL << endl;
01469 }
01470 else
01471 {
01472 ok_open = OpenRootFile(file_name, "READ");
01473 ok_read = gCnaRootFile->ReadElement(typ, user_cna_chan);
01474
01475 if ( ok_read == kTRUE )
01476 {
01477 fDataExist = kTRUE;
01478 Int_t k_cor = 0;
01479 for ( Int_t i_samp = 0; i_samp < fFileHeader->fMaxSampADC; i_samp++){
01480 for ( Int_t j_samp = 0; j_samp < i_samp; j_samp++){
01481 vec_rel(k_cor) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp,j_samp);
01482 k_cor++;}}
01483 }
01484 else
01485 {
01486 fDataExist = kFALSE;
01487 cout << "!TCnaReadEB::ReadRelevantCorrelationsBetweenSamples() *** ERROR ***> "
01488 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01489 << " File = " << fRootFileNameShort.Data()
01490 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01491 << fTTBELL << endl;
01492 }
01493 }
01494 CloseRootFile(file_name);
01495 return vec_rel;
01496 }
01497
01498
01499
01500
01501
01502
01503 TMatrixD TCnaReadEB::ReadCovariancesBetweenCrystalsMeanOverSamples(const Int_t & SMTow_a,
01504 const Int_t & SMTow_b)
01505 {
01506
01507
01508
01509 Int_t index_tow_a = GetTowerIndex(SMTow_a);
01510 Int_t index_tow_b = GetTowerIndex(SMTow_b);
01511
01512 TMatrixD mat(fFileHeader->fMaxCrysInTow, fFileHeader->fMaxCrysInTow);
01513
01514 CnaResultTyp typ = cTypCovSccMos;
01515
01516 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01517
01518 Bool_t ok_open = kFALSE;
01519 Bool_t ok_read = kFALSE;
01520
01521 if ( fOpenRootFile )
01522 {
01523 cout << "!TCnaReadEB::ReadCovariancesBetweenCrystalsMeanOverSamples(...) *** ERROR ***>"
01524 << " Reading on file already open." << fTTBELL << endl;
01525 }
01526 else
01527 {
01528 ok_open = OpenRootFile(file_name, "READ");
01529
01530 Int_t i_zero = 0;
01531 ok_read = gCnaRootFile->ReadElement(typ,i_zero);
01532
01533 if ( ok_read == kTRUE )
01534 {
01535 fDataExist = kTRUE;
01536 for ( Int_t i_crys = 0; i_crys < fFileHeader->fMaxCrysInTow; i_crys++)
01537 {
01538 Int_t i_cna_chan = index_tow_a*fFileHeader->fMaxCrysInTow + i_crys;
01539 for ( Int_t j_crys = 0; j_crys < fFileHeader->fMaxCrysInTow; j_crys++)
01540 {
01541 Int_t j_cna_chan = index_tow_b*fFileHeader->fMaxCrysInTow + j_crys;
01542 mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
01543 }
01544 }
01545 }
01546 else
01547 {
01548 fDataExist = kFALSE;
01549 cout << "!TCnaReadEB::ReadCovariancesBetweenCrystalsMeanOverSamples(...) *** ERROR ***> "
01550 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01551 << " File = " << fRootFileNameShort.Data()
01552 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01553 << fTTBELL << endl;
01554 }
01555 }
01556
01557 CloseRootFile(file_name);
01558
01559 return mat;
01560 }
01561
01562
01563
01564
01565
01566
01567 TMatrixD TCnaReadEB::ReadCorrelationsBetweenCrystalsMeanOverSamples(const Int_t & SMTow_a,
01568 const Int_t & SMTow_b)
01569 {
01570
01571
01572
01573 Int_t index_tow_a = GetTowerIndex(SMTow_a);
01574 Int_t index_tow_b = GetTowerIndex(SMTow_b);
01575
01576 TMatrixD mat(fFileHeader->fMaxCrysInTow, fFileHeader->fMaxCrysInTow);
01577
01578 CnaResultTyp typ = cTypCorSccMos;
01579
01580 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01581
01582 Bool_t ok_open = kFALSE;
01583 Bool_t ok_read = kFALSE;
01584
01585 if ( fOpenRootFile )
01586 {
01587 cout << "!TCnaReadEB::ReadCorrelationsBetweenCrystalsMeanOverSamples(...) *** ERROR ***>"
01588 << " Reading on file already open." << fTTBELL << endl;
01589 }
01590 else
01591 {
01592 ok_open = OpenRootFile(file_name, "READ");
01593
01594 Int_t i_zero = 0;
01595
01596 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01597
01598 if ( ok_read == kTRUE )
01599 {
01600 fDataExist = kTRUE;
01601 for ( Int_t i_crys = 0; i_crys < fFileHeader->fMaxCrysInTow; i_crys++)
01602 {
01603 Int_t i_cna_chan = index_tow_a*fFileHeader->fMaxCrysInTow + i_crys;
01604 for ( Int_t j_crys = 0; j_crys < fFileHeader->fMaxCrysInTow; j_crys++)
01605 {
01606 Int_t j_cna_chan = index_tow_b*fFileHeader->fMaxCrysInTow + j_crys;
01607 mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
01608 }
01609 }
01610 }
01611 else
01612 {
01613 fDataExist = kFALSE;
01614 cout << "!TCnaReadEB::ReadCorrelationsBetweenCrystalsMeanOverSamples(...) *** ERROR ***> "
01615 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01616 << " File = " << fRootFileNameShort.Data()
01617 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01618 << fTTBELL << endl;
01619 }
01620 }
01621
01622 CloseRootFile(file_name);
01623
01624 return mat;
01625 }
01626
01627
01628
01629
01630
01631
01632 TMatrixD TCnaReadEB::ReadCovariancesBetweenCrystalsMeanOverSamples()
01633 {
01634
01635
01636
01637 Int_t MaxChannels = fFileHeader->fMaxTowInSM*fFileHeader->fMaxCrysInTow;
01638
01639
01640 TMatrixD mat(MaxChannels, MaxChannels);
01641 TVectorD vec(fFileHeader->fMaxTowInSM);
01642 vec = ReadTowerNumbers();
01643
01644 CnaResultTyp typ = cTypCovSccMos;
01645
01646 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01647
01648 Bool_t ok_open = kFALSE;
01649 Bool_t ok_read = kFALSE;
01650
01651 if ( fOpenRootFile )
01652 {
01653 cout << "!TCnaReadEB::ReadCovariancesBetweenCrystalsMeanOverSamples() *** ERROR ***>"
01654 << " Reading on file already open." << fTTBELL << endl;
01655 }
01656 else
01657 {
01658 ok_open = OpenRootFile(file_name, "READ");
01659
01660 Int_t i_zero = 0;
01661 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01662
01663 if ( ok_read == kTRUE )
01664 {
01665 fDataExist = kTRUE;
01666 for (Int_t index_tow_a = 0; index_tow_a < fFileHeader->fMaxTowInSM; index_tow_a++)
01667 {
01668 if ( vec(index_tow_a) > 0 && vec(index_tow_a) <= fFileHeader->fMaxTowInSM)
01669 {
01670 for (Int_t index_tow_b = 0; index_tow_b < fFileHeader->fMaxTowInSM; index_tow_b++)
01671 {
01672 if ( vec(index_tow_b) > 0 && vec(index_tow_b) <= fFileHeader->fMaxTowInSM)
01673 {
01674 for ( Int_t i_crys = 0; i_crys < fFileHeader->fMaxCrysInTow; i_crys++)
01675 {
01676 Int_t i_cna_chan = index_tow_a*fFileHeader->fMaxCrysInTow + i_crys;
01677 Int_t i_chan_sm = (Int_t)(vec(index_tow_a)-1)*fFileHeader->fMaxCrysInTow +i_crys;
01678 for ( Int_t j_crys = 0; j_crys < fFileHeader->fMaxCrysInTow; j_crys++)
01679 {
01680 Int_t j_cna_chan = index_tow_b*fFileHeader->fMaxCrysInTow + j_crys;
01681 Int_t j_chan_sm = (Int_t)(vec(index_tow_b)-1)*fFileHeader->fMaxCrysInTow +j_crys;
01682 mat(i_chan_sm, j_chan_sm) =
01683 gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
01684 }
01685 }
01686 }
01687 }
01688 }
01689 }
01690 }
01691 else
01692 {
01693 fDataExist = kFALSE;
01694 cout << "!TCnaReadEB::ReadCovariancesBetweenCrystalsMeanOverSamples() *** ERROR ***> "
01695 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01696 << " File = " << fRootFileNameShort.Data()
01697 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01698 << fTTBELL << endl;
01699 }
01700 }
01701
01702 CloseRootFile(file_name);
01703
01704 return mat;
01705 }
01706
01707
01708
01709
01710
01711
01712
01713 TMatrixD TCnaReadEB::ReadCorrelationsBetweenCrystalsMeanOverSamples()
01714 {
01715
01716
01717
01718 Int_t MaxChannels = fFileHeader->fMaxTowInSM*fFileHeader->fMaxCrysInTow;
01719
01720
01721 TMatrixD mat(MaxChannels, MaxChannels);
01722 TVectorD vec(fFileHeader->fMaxTowInSM);
01723 vec = ReadTowerNumbers();
01724
01725 CnaResultTyp typ = cTypCorSccMos;
01726
01727 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01728
01729 Bool_t ok_open = kFALSE;
01730 Bool_t ok_read = kFALSE;
01731
01732 if ( fOpenRootFile )
01733 {
01734 cout << "!TCnaReadEB::ReadCorrelationsBetweenCrystalsMeanOverSamples() *** ERROR ***>"
01735 << " Reading on file already open." << fTTBELL << endl;
01736 }
01737 else
01738 {
01739 ok_open = OpenRootFile(file_name, "READ");
01740
01741 Int_t i_zero = 0;
01742 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01743
01744 if ( ok_read == kTRUE )
01745 {
01746 fDataExist = kTRUE;
01747 for (Int_t index_tow_a = 0; index_tow_a < fFileHeader->fMaxTowInSM; index_tow_a++)
01748 {
01749 if ( vec(index_tow_a) > 0 && vec(index_tow_a) <= fFileHeader->fMaxTowInSM)
01750 {
01751 for (Int_t index_tow_b = 0; index_tow_b < fFileHeader->fMaxTowInSM; index_tow_b++)
01752 {
01753 if ( vec(index_tow_b) > 0 && vec(index_tow_b) <= fFileHeader->fMaxTowInSM)
01754 {
01755 for ( Int_t i_crys = 0; i_crys < fFileHeader->fMaxCrysInTow; i_crys++)
01756 {
01757 Int_t i_cna_chan = index_tow_a*fFileHeader->fMaxCrysInTow + i_crys;
01758 Int_t i_chan_sm = (Int_t)(vec(index_tow_a)-1)*fFileHeader->fMaxCrysInTow + i_crys;
01759 for ( Int_t j_crys = 0; j_crys < fFileHeader->fMaxCrysInTow; j_crys++)
01760 {
01761 Int_t j_cna_chan = index_tow_b*fFileHeader->fMaxCrysInTow + j_crys;
01762 Int_t j_chan_sm = (Int_t)(vec(index_tow_b)-1)*fFileHeader->fMaxCrysInTow + j_crys;
01763 mat(i_chan_sm, j_chan_sm) =
01764 gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
01765 }
01766 }
01767 }
01768 }
01769 }
01770 }
01771 }
01772 else
01773 {
01774 fDataExist = kFALSE;
01775 cout << "!TCnaReadEB::ReadCorrelationsBetweenCrystalsMeanOverSamples() *** ERROR ***> "
01776 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01777 << " File = " << fRootFileNameShort.Data()
01778 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01779 << fTTBELL << endl;
01780 }
01781 }
01782
01783 CloseRootFile(file_name);
01784
01785 return mat;
01786 }
01787
01788
01789
01790
01791
01792
01793 TMatrixD TCnaReadEB::ReadCovariancesBetweenTowersMeanOverSamplesAndChannels()
01794 {
01795
01796
01797
01798
01799 TMatrixD mat(fFileHeader->fMaxTowInSM, fFileHeader->fMaxTowInSM);
01800
01801 TVectorD vec(fFileHeader->fMaxTowInSM);
01802 vec = ReadTowerNumbers();
01803
01804 CnaResultTyp typ = cTypCovMosccMot;
01805
01806 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01807
01808 Bool_t ok_open = kFALSE;
01809 Bool_t ok_read = kFALSE;
01810
01811 if ( fOpenRootFile )
01812 {
01813 cout << "!TCnaReadEB::ReadCovariancesBetweenTowersMeanOverSamplesAndChannels() *** ERROR ***>"
01814 << " Reading on file already open." << fTTBELL << endl;
01815 }
01816 else
01817 {
01818 ok_open = OpenRootFile(file_name, "READ");
01819
01820 Int_t i_zero = 0;
01821 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01822
01823 if( ok_read == kTRUE )
01824 {
01825 fDataExist = kTRUE;
01826 for(Int_t index_tow_a = 0; index_tow_a < fFileHeader->fMaxTowInSM; index_tow_a++)
01827 {
01828 for(Int_t index_tow_b = 0; index_tow_b < fFileHeader->fMaxTowInSM; index_tow_b++)
01829 {
01830 if( vec(index_tow_a) > 0 && vec(index_tow_a) <= fFileHeader->fMaxTowInSM)
01831 {
01832 if( vec(index_tow_b) > 0 && vec(index_tow_b) <= fFileHeader->fMaxTowInSM)
01833 {
01834 mat((Int_t)vec(index_tow_a)-1, (Int_t)vec(index_tow_b)-1) =
01835 gCnaRootFile->fCnaIndivResult->fMatMat(index_tow_a,index_tow_b);
01836 }
01837 }
01838 }
01839 }
01840 }
01841 else
01842 {
01843 fDataExist = kFALSE;
01844 cout << "!TCnaReadEB::ReadCovariancesBetweenTowersMeanOverSamplesAndChannels() *** ERROR ***> "
01845 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01846 << " File = " << fRootFileNameShort.Data()
01847 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01848 << fTTBELL << endl;
01849 }
01850
01851 CloseRootFile(file_name);
01852 }
01853
01854 return mat;
01855 }
01856
01857
01858
01859
01860
01861
01862
01863 TMatrixD TCnaReadEB::ReadCorrelationsBetweenTowersMeanOverSamplesAndChannels()
01864 {
01865
01866
01867
01868
01869 TMatrixD mat(fFileHeader->fMaxTowInSM, fFileHeader->fMaxTowInSM);
01870
01871 TVectorD vec(fFileHeader->fMaxTowInSM);
01872 vec = ReadTowerNumbers();
01873
01874 CnaResultTyp typ = cTypCorMosccMot;
01875
01876 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01877
01878 Bool_t ok_open = kFALSE;
01879 Bool_t ok_read = kFALSE;
01880
01881 if ( fOpenRootFile )
01882 {
01883 cout << "!TCnaReadEB::ReadCorrelationsBetweenTowersMeanOverSamplesAndChannels() *** ERROR ***>"
01884 << " Reading on file already open." << fTTBELL << endl;
01885 }
01886 else
01887 {
01888 ok_open = OpenRootFile(file_name, "READ");
01889
01890 Int_t i_zero = 0;
01891 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01892
01893 if( ok_read == kTRUE )
01894 {
01895 fDataExist = kTRUE;
01896 for(Int_t index_tow_a = 0; index_tow_a < fFileHeader->fMaxTowInSM; index_tow_a++)
01897 {
01898 for(Int_t index_tow_b = 0; index_tow_b < fFileHeader->fMaxTowInSM; index_tow_b++)
01899 {
01900 if( vec(index_tow_a) > 0 && vec(index_tow_a) <= fFileHeader->fMaxTowInSM)
01901 {
01902 if( vec(index_tow_b) > 0 && vec(index_tow_b) <= fFileHeader->fMaxTowInSM)
01903 {
01904 mat((Int_t)vec(index_tow_a)-1, (Int_t)vec(index_tow_b)-1) =
01905 gCnaRootFile->fCnaIndivResult->fMatMat(index_tow_a,index_tow_b);
01906 }
01907 }
01908 }
01909 }
01910 }
01911 else
01912 {
01913 fDataExist = kFALSE;
01914 cout << "!TCnaReadEB::ReadCorrelationsBetweenTowersMeanOverSamplesAndChannels() *** ERROR ***> "
01915 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01916 << " File = " << fRootFileNameShort.Data()
01917 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01918 << fTTBELL << endl;
01919 }
01920
01921 CloseRootFile(file_name);
01922 }
01923
01924 return mat;
01925 }
01926
01927
01928
01929
01930
01931
01932 TVectorD TCnaReadEB::ReadExpectationValuesOfExpectationValuesOfSamples()
01933 {
01934
01935
01936
01937
01938 TVectorD vec(fFileHeader->fMaxCrysInSM);
01939
01940 CnaResultTyp typ = cTypEvEv;
01941 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01942
01943 Bool_t ok_open = kFALSE;
01944 Bool_t ok_read = kFALSE;
01945
01946 if ( fOpenRootFile )
01947 {
01948 cout << "!TCnaReadEB::ReadExpectationValuesOfExpectationValuesOfSamples() *** ERROR ***> "
01949 << "Reading on file already open." << fTTBELL << endl;
01950 }
01951 else
01952 {
01953 ok_open = OpenRootFile(file_name, "READ");
01954
01955 Int_t i_zero = 0;
01956 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
01957
01958 if ( ok_read == kTRUE )
01959 {
01960 fDataExist = kTRUE;
01961 for ( Int_t i_SMCrys = 0; i_SMCrys < fFileHeader->fMaxCrysInSM; i_SMCrys++)
01962 {
01963 vec(i_SMCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i_SMCrys);
01964 }
01965 }
01966 else
01967 {
01968 fDataExist = kFALSE;
01969 cout << "!TCnaReadEB::ReadExpectationValuesOfExpectationValuesOfSamples() *** ERROR ***> "
01970 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
01971 << " File = " << fRootFileNameShort.Data()
01972 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
01973 << fTTBELL << endl;
01974 }
01975 }
01976 CloseRootFile(file_name);
01977 return vec;
01978 }
01979
01980
01981
01982
01983
01984
01985 TVectorD TCnaReadEB::ReadExpectationValuesOfSigmasOfSamples()
01986 {
01987
01988
01989
01990
01991 TVectorD vec(fFileHeader->fMaxCrysInSM);
01992 CnaResultTyp typ = cTypEvSig;
01993 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
01994
01995 Bool_t ok_open = kFALSE;
01996 Bool_t ok_read = kFALSE;
01997
01998 if ( fOpenRootFile )
01999 {
02000 cout << "!TCnaReadEB::ReadExpectationValuesOfSigmasOfSamples() *** ERROR ***> "
02001 << "Reading on file already open." << fTTBELL << endl;
02002 }
02003 else
02004 {
02005 ok_open = OpenRootFile(file_name, "READ");
02006
02007 Int_t i_zero = 0;
02008 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02009
02010 if ( ok_read == kTRUE )
02011 {
02012 fDataExist = kTRUE;
02013 for ( Int_t i_SMCrys = 0; i_SMCrys < fFileHeader->fMaxCrysInSM; i_SMCrys++)
02014 {
02015 vec(i_SMCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_SMCrys);
02016 }
02017 }
02018 else
02019 {
02020 fDataExist = kFALSE;
02021 cout << "!TCnaReadEB::ReadExpectationValuesOfSigmasOfSamples() *** ERROR ***> "
02022 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
02023 << " File = " << fRootFileNameShort.Data()
02024 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
02025 << fTTBELL << endl;
02026 }
02027 }
02028 CloseRootFile(file_name);
02029 return vec;
02030
02031 }
02032
02033
02034
02035
02036
02037
02038 TVectorD TCnaReadEB::ReadExpectationValuesOfCorrelationsBetweenSamples()
02039 {
02040
02041
02042
02043
02044 TVectorD vec(fFileHeader->fMaxCrysInSM);
02045 CnaResultTyp typ = cTypEvCorCss;
02046 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
02047
02048 Bool_t ok_open = kFALSE;
02049 Bool_t ok_read = kFALSE;
02050
02051 if ( fOpenRootFile )
02052 {
02053 cout << "!TCnaReadEB::ReadExpectationValuesOfCorrelationsBetweenSamples() *** ERROR ***> "
02054 << "Reading on file already open." << fTTBELL << endl;
02055 }
02056 else
02057 {
02058 ok_open = OpenRootFile(file_name, "READ");
02059
02060 Int_t i_zero = 0;
02061 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02062
02063 if ( ok_read == kTRUE )
02064 {
02065 fDataExist = kTRUE;
02066 for ( Int_t i_SMCrys = 0; i_SMCrys < fFileHeader->fMaxCrysInSM; i_SMCrys++)
02067 {
02068 vec(i_SMCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_SMCrys);
02069 }
02070 }
02071 else
02072 {
02073 fDataExist = kFALSE;
02074 cout << "!TCnaReadEB::ReadExpectationValuesOfCorrelationsBetweenSamples() *** ERROR ***> "
02075 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
02076 << " File = " << fRootFileNameShort.Data()
02077 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
02078 << fTTBELL << endl;
02079 }
02080 }
02081
02082 CloseRootFile(file_name);
02083 return vec;
02084 }
02085
02086
02087
02088
02089
02090
02091 TVectorD TCnaReadEB::ReadSigmasOfExpectationValuesOfSamples()
02092 {
02093
02094
02095
02096
02097 TVectorD vec(fFileHeader->fMaxCrysInSM);
02098 CnaResultTyp typ = cTypSigEv;
02099 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
02100
02101 Bool_t ok_open = kFALSE;
02102 Bool_t ok_read = kFALSE;
02103
02104 if ( fOpenRootFile )
02105 {
02106 cout << "!TCnaReadEB::ReadSigmasOfExpectationValuesOfSamples() *** ERROR ***> "
02107 << "Reading on file already open." << fTTBELL << endl;
02108 }
02109 else
02110 {
02111 ok_open = OpenRootFile(file_name, "READ");
02112
02113 Int_t i_zero = 0;
02114 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02115
02116 if ( ok_read == kTRUE )
02117 {
02118 fDataExist = kTRUE;
02119 for ( Int_t i_SMCrys = 0; i_SMCrys < fFileHeader->fMaxCrysInSM; i_SMCrys++)
02120 {
02121 vec(i_SMCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_SMCrys);
02122 }
02123 }
02124 else
02125 {
02126 fDataExist = kFALSE;
02127 cout << "!TCnaReadEB::ReadSigmasOfExpectationValuesOfSamples() *** ERROR ***> "
02128 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
02129 << " File = " << fRootFileNameShort.Data()
02130 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
02131 << fTTBELL << endl;
02132 }
02133 }
02134
02135 CloseRootFile(file_name);
02136 return vec;
02137 }
02138
02139
02140
02141
02142
02143
02144 TVectorD TCnaReadEB::ReadSigmasOfSigmasOfSamples()
02145 {
02146
02147
02148
02149
02150 TVectorD vec(fFileHeader->fMaxCrysInSM);
02151 CnaResultTyp typ = cTypSigSig;
02152 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
02153
02154 Bool_t ok_open = kFALSE;
02155 Bool_t ok_read = kFALSE;
02156
02157 if ( fOpenRootFile )
02158 {
02159 cout << "!TCnaReadEB::ReadSigmasOfSigmasOfSamples() *** ERROR ***> "
02160 << "Reading on file already open." << fTTBELL << endl;
02161 }
02162 else
02163 {
02164 ok_open = OpenRootFile(file_name, "READ");
02165
02166 Int_t i_zero = 0;
02167 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02168
02169 if ( ok_read == kTRUE )
02170 {
02171 fDataExist = kTRUE;
02172 for ( Int_t i_SMCrys = 0; i_SMCrys < fFileHeader->fMaxCrysInSM; i_SMCrys++)
02173 {
02174 vec(i_SMCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_SMCrys);
02175 }
02176 }
02177 else
02178 {
02179 fDataExist = kFALSE;
02180 cout << "!TCnaReadEB::ReadSigmasOfSigmasOfSamples() *** ERROR ***> "
02181 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
02182 << " File = " << fRootFileNameShort.Data()
02183 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
02184 << fTTBELL << endl;
02185 }
02186 }
02187
02188 CloseRootFile(file_name);
02189 return vec;
02190 }
02191
02192
02193
02194
02195
02196
02197 TVectorD TCnaReadEB::ReadSigmasOfCorrelationsBetweenSamples()
02198 {
02199
02200
02201
02202
02203 TVectorD vec(fFileHeader->fMaxCrysInSM);
02204 CnaResultTyp typ = cTypSigCorCss;
02205 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
02206
02207 Bool_t ok_open = kFALSE;
02208 Bool_t ok_read = kFALSE;
02209
02210 if ( fOpenRootFile )
02211 {
02212 cout << "!TCnaReadEB::ReadSigmasOfCorrelationsBetweenSamples() *** ERROR ***> "
02213 << "Reading on file already open." << fTTBELL << endl;
02214 }
02215 else
02216 {
02217 ok_open = OpenRootFile(file_name, "READ");
02218
02219 Int_t i_zero = 0;
02220 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02221
02222 if ( ok_read == kTRUE )
02223 {
02224 fDataExist = kTRUE;
02225 for ( Int_t i_SMCrys = 0; i_SMCrys < fFileHeader->fMaxCrysInSM; i_SMCrys++)
02226 {
02227 vec(i_SMCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_SMCrys);
02228 }
02229 }
02230 else
02231 {
02232 fDataExist = kFALSE;
02233 cout << "!TCnaReadEB::ReadSigmasOfCorrelationsBetweenSamples() *** ERROR ***> "
02234 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
02235 << " File = " << fRootFileNameShort.Data()
02236 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
02237 << fTTBELL << endl;
02238 }
02239 }
02240
02241 CloseRootFile(file_name);
02242 return vec;
02243 }
02244
02245
02246
02247
02248
02249
02250 TMatrixD TCnaReadEB::ReadCorrectionsToSamplesFromCovss(const Int_t& SMTow)
02251 {
02252
02253
02254
02255
02256 TMatrixD mat(fFileHeader->fMaxCrysInTow, fFileHeader->fMaxSampADC);
02257
02258 Int_t index_tow = GetTowerIndex(SMTow);
02259 CnaResultTyp typ = cTypSvCorrecCovCss;
02260 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
02261
02262 Bool_t ok_open = kFALSE;
02263 Bool_t ok_read = kFALSE;
02264
02265 if ( fOpenRootFile )
02266 {
02267 cout << "!TCnaReadEB::ReadCorrectionsToSamplesFromCovss(smtower) *** ERROR ***>"
02268 << " Reading on file already open." << fTTBELL << endl;
02269 }
02270 else
02271 {
02272 ok_open = OpenRootFile(file_name, "READ");
02273
02274 Int_t i_zero = (Int_t)0;
02275 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02276
02277 if ( ok_read == kTRUE )
02278 {
02279 fDataExist = kTRUE;
02280 for ( Int_t i_crys = 0; i_crys < fFileHeader->fMaxCrysInTow; i_crys++)
02281 {
02282 Int_t i_cna_chan = index_tow*fFileHeader->fMaxCrysInTow + i_crys;
02283 for ( Int_t j_samp = 0; j_samp < fFileHeader->fMaxSampADC; j_samp++)
02284 {
02285 mat(i_crys, j_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(i_cna_chan,j_samp);
02286 }
02287 }
02288 }
02289 else
02290 {
02291 fDataExist = kFALSE;
02292 cout << "!TCnaReadEB::ReadCorrectionsToSamplesFromCovss(smtower) *** ERROR ***> "
02293 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
02294 << " File = " << fRootFileNameShort.Data()
02295 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
02296 << fTTBELL << endl;
02297 }
02298 }
02299 CloseRootFile(file_name);
02300
02301 return mat;
02302 }
02303
02304
02305
02306
02307
02308
02309 TVectorD TCnaReadEB::ReadCorrectionsToSamplesFromCovss(const Int_t& SMTow,
02310 const Int_t& TowEcha)
02311 {
02312
02313
02314
02315
02316 TVectorD vec(fFileHeader->fMaxSampADC);
02317
02318 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
02319
02320 CnaResultTyp typ = cTypSvCorrecCovCss;
02321 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
02322
02323 Bool_t ok_open = kFALSE;
02324 Bool_t ok_read = kFALSE;
02325
02326 if ( fOpenRootFile )
02327 {
02328 cout << "!TCnaReadEB::ReadCorrectionsToSamplesFromCovss(smtower,TowEcha) *** ERROR ***>"
02329 << " Reading on file already open." << fTTBELL << endl;
02330 }
02331 else
02332 {
02333 ok_open = OpenRootFile(file_name, "READ");
02334
02335 Int_t i_zero = (Int_t)0;
02336 ok_read = gCnaRootFile->ReadElement(typ, i_zero);
02337
02338 if ( ok_read == kTRUE )
02339 {
02340 fDataExist = kTRUE;
02341 for ( Int_t j_samp = 0; j_samp < fFileHeader->fMaxSampADC; j_samp++)
02342 {
02343 vec(j_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(user_cna_chan,j_samp);
02344 }
02345 }
02346 else
02347 {
02348 fDataExist = kFALSE;
02349 cout << "!TCnaReadEB::ReadCorrectionsToSamplesFromCovss(smtower,TowEcha) *** ERROR ***> "
02350 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
02351 << " File = " << fRootFileNameShort.Data()
02352 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
02353 << fTTBELL << endl;
02354 }
02355 }
02356 CloseRootFile(file_name);
02357
02358 return vec;
02359 }
02360
02361
02362
02363
02364
02365
02366 TMatrixD TCnaReadEB::ReadCorrectionFactorsToCovss(const Int_t& SMTow,
02367 const Int_t & TowEcha)
02368 {
02369
02370
02371
02372
02373 TMatrixD mat(fFileHeader->fMaxSampADC, fFileHeader->fMaxSampADC);
02374
02375 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
02376 CnaResultTyp typ = cTypCovCorrecCovCss;
02377 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
02378
02379 Bool_t ok_open = kFALSE;
02380 Bool_t ok_read = kFALSE;
02381
02382 if ( fOpenRootFile )
02383 {
02384 cout << "!TCnaReadEB::ReadCorrectionFactorsToCovss(...) *** ERROR ***>"
02385 << " Reading on file already open." << fTTBELL << endl;
02386 }
02387 else
02388 {
02389 ok_open = OpenRootFile(file_name, "READ");
02390 ok_read = gCnaRootFile->ReadElement(typ, user_cna_chan);
02391
02392 if ( ok_read == kTRUE )
02393 {
02394 fDataExist = kTRUE;
02395 for ( Int_t i_samp = 0; i_samp < fFileHeader->fMaxCrysInTow; i_samp++)
02396 {
02397 for ( Int_t j_samp = 0; j_samp < fFileHeader->fMaxSampADC; j_samp++)
02398 {
02399 mat(i_samp, j_samp) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp,j_samp);
02400 }
02401 }
02402 }
02403 else
02404 {
02405 fDataExist = kFALSE;
02406 cout << "!TCnaReadEB::ReadCorrectionFactorsToCovss(...) *** ERROR ***> "
02407 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
02408 << " File = " << fRootFileNameShort.Data()
02409 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
02410 << fTTBELL << endl;
02411 }
02412 }
02413 CloseRootFile(file_name);
02414
02415 return mat;
02416 }
02417
02418
02419
02420
02421
02422
02423 TMatrixD TCnaReadEB::ReadCorrectionFactorsToCorss(const Int_t& SMTow,
02424 const Int_t & TowEcha)
02425 {
02426
02427
02428
02429
02430 TMatrixD mat(fFileHeader->fMaxSampADC, fFileHeader->fMaxSampADC);
02431
02432 Int_t user_cna_chan = GetSMEcha(SMTow, TowEcha);
02433 CnaResultTyp typ = cTypCorCorrecCovCss;
02434 Text_t *file_name = (Text_t *)fRootFileNameShort.Data();
02435
02436 Bool_t ok_open = kFALSE;
02437 Bool_t ok_read = kFALSE;
02438
02439 if ( fOpenRootFile )
02440 {
02441 cout << "!TCnaReadEB::ReadCorrectionFactorsToCorss(...) *** ERROR ***>"
02442 << " Reading on file already open." << fTTBELL << endl;
02443 }
02444 else
02445 {
02446 ok_open = OpenRootFile(file_name, "READ");
02447 ok_read = gCnaRootFile->ReadElement(typ, user_cna_chan);
02448
02449 if ( ok_read == kTRUE )
02450 {
02451 fDataExist = kTRUE;
02452 for ( Int_t i_samp = 0; i_samp < fFileHeader->fMaxCrysInTow; i_samp++)
02453 {
02454 for ( Int_t j_samp = 0; j_samp < fFileHeader->fMaxSampADC; j_samp++)
02455 {
02456 mat(i_samp, j_samp) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp,j_samp);
02457 }
02458 }
02459 }
02460 else
02461 {
02462 fDataExist = kFALSE;
02463 cout << "!TCnaReadEB::ReadCorrectionFactorsToCorss(...) *** ERROR ***> "
02464 << "Read ROOT file failed. Quantity type = " << GetTypeOfQuantity(typ) << endl
02465 << " File = " << fRootFileNameShort.Data()
02466 << ". QUANTITY NOT PRESENT IN THE ROOT FILE."
02467 << fTTBELL << endl;
02468 }
02469 }
02470 CloseRootFile(file_name);
02471
02472 return mat;
02473 }
02474
02475
02476
02477
02478
02479
02480
02481
02482
02483
02484
02485
02486 TString TCnaReadEB::GetTypeOfQuantity(const CnaResultTyp arg_typ)
02487 {
02488 TString quantity_name = "?";
02489
02490 if( arg_typ == cTypTowerNumbers ){quantity_name = "Tower numbers";}
02491 if( arg_typ == cTypEv ){quantity_name = "Expectation values";}
02492 if( arg_typ == cTypVar ){quantity_name = "Variances";}
02493 if( arg_typ == cTypEvts ){quantity_name = "Event distributions";}
02494
02495 if( arg_typ == cTypCovScc ){quantity_name = "Covariances between channels";}
02496 if( arg_typ == cTypCorScc ){quantity_name = "Correlations between channels";}
02497 if( arg_typ == cTypCovCss ){quantity_name = "Covariances between samples";}
02498 if( arg_typ == cTypCorCss ){quantity_name = "Correlations between samples";}
02499 if( arg_typ == cTypEvCorCss ){quantity_name = "Mean of Correlations between samples";}
02500 if( arg_typ == cTypSigCorCss ){quantity_name = "Sigma of Correlations between samples";}
02501 if( arg_typ == cTypLastEvtNumber ){quantity_name = "Number of events";}
02502 if( arg_typ == cTypEvEv ){quantity_name = "Mean pedestals";}
02503 if( arg_typ == cTypEvSig ){quantity_name = "Mean of sample sigmas";}
02504 if( arg_typ == cTypSigEv ){quantity_name = "Sigma of sample means";}
02505 if( arg_typ == cTypSigSig ){quantity_name = "Sigma of sample sigmas";}
02506 if( arg_typ == cTypSampTime ){quantity_name = "Pedestal a.f.o event number";}
02507 if( arg_typ == cTypCovSccMos ){quantity_name = "Covariances between channels (mean over samples)";}
02508 if( arg_typ == cTypCorSccMos ){quantity_name = "Correlations between channels (mean over samples)";}
02509 if( arg_typ == cTypCovMosccMot){quantity_name = "Covariances between towers (mean samp. & chan.)";}
02510 if( arg_typ == cTypCorMosccMot){quantity_name = "Correlations between towers (mean samp. & chan.)";}
02511
02512 return quantity_name;
02513 }
02514
02515
02516
02517
02518
02519
02520 TString TCnaReadEB::GetRootFileNameShort()
02521 {
02522 return fRootFileNameShort;
02523 }
02524
02525
02526
02527
02528
02529
02530 Int_t TCnaReadEB::MaxCrysEtaInTow()
02531 {
02532
02533
02534 Int_t size = (Int_t)sqrt((Double_t)fFileHeader->fMaxCrysInTow);
02535 return size;
02536 }
02537
02538
02539
02540
02541
02542 Int_t TCnaReadEB::MaxCrysPhiInTow()
02543 {
02544
02545
02546 Int_t size = (Int_t)sqrt((Double_t)fFileHeader->fMaxCrysInTow);
02547 return size;
02548 }
02549
02550
02551
02552
02553
02554
02555
02556 Int_t TCnaReadEB::GetSMTowFromIndex(const Int_t& i_tower)
02557 {
02558
02559
02560 Int_t number = -1;
02561 TVectorD vec(fFileHeader->fMaxTowInSM);
02562 vec = ReadTowerNumbers();
02563 number = (Int_t)vec(i_tower);
02564 return number;
02565 }
02566
02567
02568
02569
02570
02571
02572
02573
02574 Int_t TCnaReadEB::MaxTowEtaInSM()
02575 {
02576 Int_t number = -1;
02577 if (fFileHeader != 0){number = fFileHeader->fMaxTowEtaInSM;}
02578 else {cout << "!TCnaReadEB::MaxTowEtaInSM()> *** ERROR *** fFileHeader pointer = "
02579 << fFileHeader << fTTBELL <<endl;}
02580 return number;
02581 }
02582
02583 Int_t TCnaReadEB::MaxTowPhiInSM()
02584 {
02585 Int_t number = -1;
02586 if (fFileHeader != 0){number = fFileHeader->fMaxTowPhiInSM;}
02587 else {cout << "!TCnaReadEB::MaxTowPhiInSM()> *** ERROR *** fFileHeader pointer = "
02588 << fFileHeader << fTTBELL <<endl;}
02589 return number;
02590 }
02591 Int_t TCnaReadEB::MaxTowInSM()
02592 {
02593 Int_t number = -1;
02594 if (fFileHeader != 0){number = fFileHeader->fMaxTowInSM;}
02595 else {cout << "!TCnaReadEB::MaxTowInSM()> *** ERROR *** fFileHeader pointer = "
02596 << fFileHeader << fTTBELL <<endl;}
02597 return number;
02598 }
02599
02600 Int_t TCnaReadEB::MaxCrysInTow()
02601 {
02602 Int_t number = -1;
02603 if (fFileHeader != 0){number = fFileHeader->fMaxCrysInTow;}
02604 else {cout << "!TCnaReadEB::MaxCrysInTow()> fFileHeader pointer = "
02605 << fFileHeader << endl;}
02606 return number;
02607 }
02608
02609 Int_t TCnaReadEB::MaxCrysInSM()
02610 {
02611 Int_t number = -1;
02612 if (fFileHeader != 0){number = fFileHeader->fMaxCrysInSM;}
02613 else {cout << "!TCnaReadEB::MaxCrysInSM()> fFileHeader pointer = "
02614 << fFileHeader << endl;}
02615 return number;
02616 }
02617
02618 Int_t TCnaReadEB::MaxSampADC()
02619 {
02620 Int_t number = -1;
02621 if (fFileHeader != 0){number = fFileHeader->fMaxSampADC;}
02622 else {cout << "!TCnaReadEB::MaxSampADC()> fFileHeader pointer = "
02623 << fFileHeader << endl;}
02624 return number;
02625 }
02626
02627 TString TCnaReadEB::GetAnalysisName()
02628 {
02629 TString astring = "?";
02630 if (fFileHeader != 0){astring = fFileHeader->fTypAna;}
02631 else {cout << "!TCnaReadEB::GetAnalysisName()> fFileHeader pointer = "
02632 << fFileHeader << endl;}
02633 return astring;
02634 }
02635
02636 Int_t TCnaReadEB::GetFirstTakenEventNumber()
02637 {
02638 Int_t number = -1;
02639 if (fFileHeader != 0){number = fFileHeader->fFirstEvt;}
02640 else {cout << "!TCnaReadEB::GetFirstTakenEventNumber()> fFileHeader pointer = "
02641 << fFileHeader << endl;}
02642 return number;
02643 }
02644
02645 Int_t TCnaReadEB::GetNumberOfTakenEvents()
02646 {
02647 Int_t number = -1;
02648 if (fFileHeader != 0){number = fFileHeader->fNbOfTakenEvts;}
02649 else {cout << "!TCnaReadEB::GetNumberOfTakenEvents()> fFileHeader pointer = "
02650 << fFileHeader << endl;}
02651 return number;
02652 }
02653
02654
02655 Int_t TCnaReadEB::GetNumberOfBinsEventDistributions()
02656 {
02657 return fFileHeader->fNbBinsADC;
02658 }
02659
02660
02661 Int_t TCnaReadEB::GetNumberOfBinsSampleAsFunctionOfTime()
02662 {
02663 return fFileHeader->fNbBinsSampTime;
02664 }
02665
02666
02667
02668
02669
02670
02671
02672
02673
02674
02675
02676
02677 Int_t TCnaReadEB::GetSMEcha(const Int_t & SMTow, const Int_t & TowEcha)
02678 {
02679 Int_t j_cna_chan = -1;
02680 Int_t tow_index = GetTowerIndex(SMTow);
02681
02682 if ( tow_index >= 0 )
02683 {
02684 j_cna_chan = tow_index*fFileHeader->fMaxCrysInTow + TowEcha;
02685
02686 if(fFlagPrint == fCodePrintAllComments){
02687 cout << "~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-" << endl;
02688 cout << "*TCnaReadEB::GetSMEcha> SMtow : " << SMTow << endl
02689 << " TowEcha : " << TowEcha << endl
02690 << " => SMECha = " << j_cna_chan << endl;
02691 cout << "~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-" << endl;}
02692 }
02693 else
02694 {
02695 if(fFlagPrint == fCodePrintAllComments){
02696 cout << "!TCnaReadEB::GetSMEcha *** ERROR ***> channel number not found."
02697 << " Forced to -1. Argument values: SMTow = " << SMTow
02698 << ", TowEcha = " << TowEcha
02699 << fTTBELL << endl;}
02700 }
02701 return j_cna_chan;
02702 }
02703
02704
02705
02706
02707
02708
02709 Int_t TCnaReadEB::GetTowerIndex(const Int_t & SMTow)
02710 {
02711
02712
02713 if(fFlagPrint == fCodePrintAllComments){
02714 cout << "*TCnaReadEB::GetTowerIndex(...)> fFileHeader->fMaxTowInSM = "
02715 << fFileHeader->fMaxTowInSM << endl
02716 << " SMTow = " << SMTow
02717 << endl << endl;}
02718
02719 Int_t tower_index = SMTow-1;
02720
02721 #define NOGT
02722 #ifndef NOGT
02723 Int_t tower_index = -1;
02724 TVectorD vec(fFileHeader->fMaxTowInSM);
02725 vec = ReadTowerNumbers();
02726
02727
02728
02729 for(Int_t i=0; i < fFileHeader->fMaxTowInSM; i++)
02730 {
02731 if(fFlagPrint == fCodePrintAllComments){
02732 cout << "*TCnaReadEB::GetTowerIndex(...)> TowerNumber[" << i << "] = "
02733 << vec[i] << endl;}
02734 if ( vec[i] == SMTow ){tower_index = i;}
02735 }
02736
02737 if(fFlagPrint == fCodePrintAllComments){
02738 cout << "~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-" << endl;
02739 cout << "*TCnaReadEB::GetTowerIndex> Tower number: " << SMTow << endl
02740 << " Tower index : " << tower_index << endl;
02741 cout << "~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-" << endl;}
02742
02743 if ( tower_index < 0 )
02744 {
02745 if(fFlagPrint == fCodePrintAllComments){
02746 cout << "!TCnaReadEB::GetTowerIndex *** WARNING ***> SMTow" << SMTow << " : "
02747 << "index tower not found"
02748 << fTTBELL << endl;}
02749 }
02750 #endif // NOGT
02751
02752 return tower_index;
02753 }
02754
02755
02756
02757
02758
02759
02760
02761 void TCnaReadEB::PrintComments()
02762 {
02763
02764
02765 fFlagPrint = fCodePrintComments;
02766 cout << "*TCnaReadEB::PrintComments()> Warnings and some comments on init will be printed" << endl;
02767 }
02768
02769 void TCnaReadEB::PrintWarnings()
02770 {
02771
02772
02773 fFlagPrint = fCodePrintWarnings;
02774 cout << "*TCnaReadEB::PrintWarnings()> Warnings will be printed" << endl;
02775 }
02776
02777 void TCnaReadEB::PrintAllComments()
02778 {
02779
02780
02781 fFlagPrint = fCodePrintAllComments;
02782 cout << "*TCnaReadEB::PrintAllComments()> All the comments will be printed" << endl;
02783 }
02784
02785 void TCnaReadEB::PrintNoComment()
02786 {
02787
02788
02789 fFlagPrint = fCodePrintNoComment;
02790 }
02791
02792
02793
02794
02795
02796
02797
02798
02799
02800
02801
02802
02803
02804
02805
02806
02807 void TCnaReadEB::fMakeResultsFileName(const Int_t& i_code)
02808 {
02809
02810
02811
02812
02813
02814
02815
02816
02817
02818
02819
02820
02821
02822
02823
02824
02825
02826 char* f_in = new char[fDim_name]; fCnew++;
02827 char* f_in_short = new char[fDim_name]; fCnew++;
02828
02829
02830
02831
02832 if (i_code == fCodeRoot)
02833 {
02834 sprintf(f_in, "%s/%s_%d_%d_%d_SM%d",
02835 fPathRoot.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02836 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02837 sprintf(f_in_short, "%s_%d_%d_%d_SM%d",
02838 fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02839 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02840 }
02841
02842
02843 if (i_code == fCodeHeader)
02844 {
02845 sprintf(f_in, "%s/%s_%d_header_%d_%d_SM%d",
02846 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02847 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02848 sprintf(f_in_short, "%s_%d_header_%d_%d_SM%d",
02849 fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02850 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02851 }
02852
02853 if (i_code == fCodeCorresp)
02854 {
02855 sprintf(f_in, "%s/%s_%d_%d_%d_SM%d_cna",
02856 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02857 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02858 sprintf(f_in_short, "%s_%d_%d_%d_SM%d_cna",
02859 fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02860 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02861 }
02862
02863 #define FCEV
02864 #ifndef FCEV
02865 if (i_code == fCodeEv)
02866 {
02867 sprintf(f_in, "%s/%s_%d_ev_%d_%d_SM%d",
02868 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02869 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02870 }
02871
02872 if (i_code == fCodeVar)
02873 {
02874 sprintf(f_in, "%s/%s_%d_var_%d_%d_SM%d",
02875 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02876 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02877 }
02878
02879 if( i_code == fCodeEvts)
02880 {
02881 sprintf(f_in, "%s/%s_%d_evts_s_c%d_%d_%d_SM%d",
02882 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber, fUserChan,
02883 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02884 }
02885
02886 if( i_code == fCodeCovSccMos)
02887 {
02888 sprintf(f_in, "%s/%s_%d_cov_cc_mos_%d_%d_SM%d",
02889 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02890 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02891 }
02892
02893 if ( i_code == fCodeCorSccMos)
02894 {
02895 sprintf(f_in, "%s/%s_%d_cor_cc_mos_%d_%d_SM%d",
02896 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02897 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02898 }
02899
02900 if (i_code == fCodeCovCss)
02901 {
02902 sprintf(f_in, "%s/%s_%d_cov_ss_c%d_%d_%d_SM%d",
02903 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber, fUserChan,
02904 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02905 }
02906
02907 if (i_code == fCodeCorCss)
02908 {
02909 sprintf(f_in, "%s/%s_%d_cor_ss_c%d_%d_%d_SM%d",
02910 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02911 fUserChan, fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02912 }
02913
02914 if (i_code == fCodeEvCorCss)
02915 {
02916 sprintf(f_in, "%s/%s_%d_ev_cor_ss_%d_%d_SM%d",
02917 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02918 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02919 }
02920
02921 if (i_code == fCodeSigCorCss)
02922 {
02923 sprintf(f_in, "%s/%s_%d_sig_cor_ss_%d_%d_SM%d",
02924 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02925 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02926 }
02927
02928 if (i_code == fCodeSvCorrecCovCss)
02929 {
02930 sprintf(f_in, "%s/%s_%d_sv_correc_covss_%d_%d_SM%d",
02931 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02932 fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02933 }
02934
02935 if (i_code == fCodeCovCorrecCovCss)
02936 {
02937 sprintf(f_in, "%s/%s_%d_cov_correc_covss_c%d_%d_%d_SM%d",
02938 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02939 fUserChan, fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02940 }
02941
02942 if (i_code == fCodeCorCorrecCovCss)
02943 {
02944 sprintf(f_in, "%s/%s_%d_cor_correc_covss_c%d_%d_%d_SM%d",
02945 fPathAscii.Data(), fFileHeader->fTypAna.Data(), fFileHeader->fRunNumber,
02946 fUserChan, fFileHeader->fFirstEvt, fFileHeader->fNbOfTakenEvts, fFileHeader->fSuperModule);
02947 }
02948 #endif // FCEV
02949
02950
02951
02952
02953
02954
02955
02956
02957
02958 char* f_name = new char[fDim_name]; fCnew++;
02959
02960 for (Int_t i = 0 ; i < fDim_name ; i++)
02961 {
02962 f_name[i] = '\0';
02963 }
02964
02965 Int_t ii = 0;
02966 for (Int_t i = 0 ; i < fDim_name ; i++)
02967 {
02968 if ( f_in[i] != '\0' ){f_name[i] = f_in[i]; ii++;}
02969 else {break;}
02970 }
02971
02972
02973
02974
02975 if ( i_code != fCodeRoot || i_code == fCodeCorresp )
02976 {
02977 f_name[ii] = '.'; f_name[ii+1] = 'a';
02978 f_name[ii+2] = 's'; f_name[ii+3] = 'c';
02979 f_name[ii+4] = 'i'; f_name[ii+5] = 'i';
02980
02981 fAsciiFileName = f_name;
02982 }
02983
02984 if ( i_code == fCodeRoot )
02985 {
02986 f_name[ii] = '.'; f_name[ii+1] = 'r';
02987 f_name[ii+2] = 'o'; f_name[ii+3] = 'o'; f_name[ii+4] = 't';
02988
02989 fRootFileName = f_name;
02990 }
02991
02992
02993
02994 char* f_name_short = new char[fDim_name]; fCnew++;
02995
02996 for (Int_t i = 0 ; i < fDim_name ; i++)
02997 {
02998 f_name_short[i] = '\0';
02999 }
03000
03001 ii = 0;
03002 for (Int_t i = 0 ; i < fDim_name ; i++)
03003 {
03004 if ( f_in_short[i] != '\0' ){f_name_short[i] = f_in_short[i]; ii++;}
03005 else {break;}
03006 }
03007
03008
03009
03010
03011 if ( i_code != fCodeRoot || i_code == fCodeCorresp )
03012 {
03013 f_name_short[ii] = '.'; f_name_short[ii+1] = 'a';
03014 f_name_short[ii+2] = 's'; f_name_short[ii+3] = 'c';
03015 f_name_short[ii+4] = 'i'; f_name_short[ii+5] = 'i';
03016
03017 fAsciiFileNameShort = f_name_short;
03018 }
03019
03020
03021 if ( i_code == fCodeRoot )
03022 {
03023 f_name_short[ii] = '.'; f_name_short[ii+1] = 'r';
03024 f_name_short[ii+2] = 'o'; f_name_short[ii+3] = 'o';
03025 f_name_short[ii+4] = 't';
03026
03027 fRootFileNameShort = f_name_short;
03028 }
03029
03030 delete [] f_name; fCdelete++;
03031 delete [] f_name_short; fCdelete++;
03032
03033 delete [] f_in; fCdelete++;
03034 delete [] f_in_short; fCdelete++;
03035 }