00001
00002
00003
00004
00005
00006
00007
00008 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaRun.h"
00009
00010 R__EXTERN TEcnaRootFile *gCnaRootFile;
00011
00012 ClassImp(TEcnaRun)
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
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316 TEcnaRun::TEcnaRun()
00317 {
00318
00319
00320
00321 }
00322
00323 TEcnaRun::TEcnaRun(const TString SubDet)
00324 {
00325
00326
00327
00328
00329 Init();
00330 SetEcalSubDetector(SubDet.Data());
00331 fNbSampForFic = fEcal->MaxSampADC();
00332 }
00333
00334 TEcnaRun::TEcnaRun(const TString SubDet, const Int_t& NbOfSamples)
00335 {
00336
00337
00338
00339
00340
00341 Init();
00342 SetEcalSubDetector(SubDet.Data());
00343 if( NbOfSamples>0 && NbOfSamples<=fEcal->MaxSampADC() )
00344 {
00345 fNbSampForFic = NbOfSamples;
00346 }
00347 else
00348 {
00349 cout << "TEcnaRun/CONSTRUCTOR> Number of required samples = " << NbOfSamples
00350 << ": OUT OF RANGE. Set to the default value (= " << fEcal->MaxSampADC() << ")."
00351 << fTTBELL << endl;
00352 fNbSampForFic = fEcal->MaxSampADC();
00353 }
00354 }
00355
00356 void TEcnaRun::Init()
00357 {
00358
00359
00360 fCnew = 0;
00361 fCdelete = 0;
00362 fCnaCommand = 0;
00363 fCnaError = 0;
00364
00365 fTTBELL = '\007';
00366
00367
00368 fgMaxCar = (Int_t)512;
00369
00370
00371 fMaxMsgIndexForMiscDiag = (Int_t)10;
00372 fNbOfMiscDiagCounters = (Int_t)50;
00373 fMiscDiag = 0;
00374
00375 fNumberOfEvents = 0;
00376
00377 fT3d_distribs = 0;
00378 fT3d2_distribs = 0;
00379 fT3d1_distribs = 0;
00380
00381 fT1d_StexStinFromIndex = 0;
00382
00383 fT2d_NbOfEvts = 0;
00384 fT1d_NbOfEvts = 0;
00385
00386 fT2d_ev = 0;
00387 fT1d_ev = 0;
00388 fT2d_sig = 0;
00389 fT1d_sig = 0;
00390
00391 fT3d_cov_ss = 0;
00392 fT3d2_cov_ss = 0;
00393 fT3d1_cov_ss = 0;
00394
00395 fT3d_cor_ss = 0;
00396 fT3d2_cor_ss = 0;
00397 fT3d1_cor_ss = 0;
00398
00399 fT2d_lf_cov = 0;
00400 fT2d1_lf_cov = 0;
00401
00402 fT2d_lf_cor = 0;
00403 fT2d1_lf_cor = 0;
00404
00405 fT2d_hf_cov = 0;
00406 fT2d1_hf_cov = 0;
00407
00408 fT2d_hf_cor = 0;
00409 fT2d1_hf_cor = 0;
00410
00411 fT2d_lfcc_mostins = 0;
00412 fT2d1_lfcc_mostins = 0;
00413
00414 fT2d_hfcc_mostins = 0;
00415 fT2d1_hfcc_mostins = 0;
00416
00417 fT1d_ev_ev = 0;
00418 fT1d_evsamp_of_sigevt = 0;
00419 fT1d_ev_cor_ss = 0;
00420 fT1d_av_mped = 0;
00421 fT1d_av_totn = 0;
00422 fT1d_av_lofn = 0;
00423 fT1d_av_hifn = 0;
00424 fT1d_av_ev_corss = 0;
00425 fT1d_av_sig_corss = 0;
00426
00427 fT1d_sigevt_of_evsamp = 0;
00428 fT1d_evevt_of_sigsamp = 0;
00429 fT1d_sig_cor_ss = 0;
00430
00431 fT2dCrysNumbersTable = 0;
00432 fT1dCrysNumbersTable = 0;
00433
00434
00435 fTagStinNumbers = 0;
00436
00437 fTagNbOfEvts = 0;
00438
00439 fTagAdcEvt = 0;
00440
00441 fTagMSp = 0;
00442 fTagSSp = 0;
00443
00444 fTagCovCss = 0;
00445 fTagCorCss = 0;
00446
00447 fTagHfCov = 0;
00448 fTagHfCor = 0;
00449 fTagLfCov = 0;
00450 fTagLfCor = 0;
00451
00452 fTagLFccMoStins = 0;
00453 fTagHFccMoStins = 0;
00454
00455 fTagPed = 0;
00456 fTagTno = 0;
00457 fTagMeanCorss = 0;
00458
00459 fTagLfn = 0;
00460 fTagHfn = 0;
00461 fTagSigCorss = 0;
00462
00463 fTagAvPed = 0;
00464 fTagAvTno = 0;
00465 fTagAvLfn = 0;
00466 fTagAvHfn = 0;
00467
00468 fTagAvMeanCorss = 0;
00469 fTagAvSigCorss = 0;
00470
00471
00472 fFlagPrint = fCodePrintWarnings;
00473 fCnaParCout = 0; fCnaParCout = new TEcnaParCout();
00474 fCodePrintNoComment = fCnaParCout->GetCodePrint("NoComment");
00475 fCodePrintWarnings = fCnaParCout->GetCodePrint("Warnings ");
00476 fCodePrintComments = fCnaParCout->GetCodePrint("Comments");
00477 fCodePrintAllComments = fCnaParCout->GetCodePrint("AllComments");
00478
00479
00480 fCnaParPaths = 0; fCnaParPaths = new TEcnaParPaths();
00481 fOpenRootFile = kFALSE;
00482
00483 fReadyToReadData = 0;
00484
00485
00486 fFileHeader = 0;
00487 const Text_t *h_name = "CnaHeader";
00488 const Text_t *h_title = "CnaHeader";
00489 fFileHeader = new TEcnaHeader(h_name, h_title);
00490
00491 fSpecialStexStinNotIndexed = -1;
00492
00493 fStinIndexBuilt = 0;
00494 fBuildEvtNotSkipped = 0;
00495 }
00496
00497
00498 void TEcnaRun::SetEcalSubDetector(const TString SubDet)
00499 {
00500
00501
00502 Int_t MaxCar = fgMaxCar;
00503 fFlagSubDet.Resize(MaxCar);
00504 fFlagSubDet = SubDet.Data();
00505
00506 fEcal = 0; fEcal = new TEcnaParEcal(fFlagSubDet.Data());
00507 fEcalNumbering = 0; fEcalNumbering = new TEcnaNumbering(fFlagSubDet.Data(), fEcal);
00508 fCnaWrite = 0;
00509 fCnaWrite =
00510 new TEcnaWrite(fFlagSubDet.Data(), fCnaParPaths, fCnaParCout, fEcal, fEcalNumbering);
00511
00512 if( fFlagSubDet == "EB" ){fStexName = "SM "; fStinName = "tower";}
00513 if( fFlagSubDet == "EE" ){fStexName = "Dee"; fStinName = " SC ";}
00514 }
00515
00516
00517
00518
00519
00520
00521 TEcnaRun::TEcnaRun(const TEcnaRun& dcop)
00522 {
00523 cout << "*TEcnaRun::TEcnaRun(const TEcnaRun& dcop)> "
00524 << " Now is the time to write a copy constructor"
00525 << endl;
00526
00527
00528
00529 }
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550 TEcnaRun::~TEcnaRun()
00551 {
00552
00553
00554 if(fFlagPrint == fCodePrintAllComments)
00555 {
00556 cout << "*TEcnaRun::~TEcnaRun()> Entering destructor." << endl;
00557 }
00558
00559 if(fFlagPrint != fCodePrintNoComment || fFlagPrint == fCodePrintWarnings )
00560 {
00561 if( fBuildEvtNotSkipped > 0 )
00562 {
00563 cout << "************************************************************************************* "
00564 << endl;
00565 cout << "*TEcnaRun::~TEcnaRun()> Nb of calls to BuildEventsDistributions by cmsRun: "
00566 << fBuildEvtNotSkipped << endl;
00567 cout << "************************************************************************************* "
00568 << endl;
00569 }
00570 }
00571
00572 if(fFlagPrint == fCodePrintAllComments)
00573 {
00574 Int_t misc_czero = 0;
00575 for(Int_t i = 0; i < fNbOfMiscDiagCounters; i++)
00576 {
00577 if( fMiscDiag[i] != 0 )
00578 {
00579 cout << " fMiscDiag Counter "
00580 << setw(3) << i << " = " << setw(9) << fMiscDiag[i]
00581 << " (INFO: alloc on non zero freed zone) " << endl;
00582 }
00583 else
00584 {
00585 misc_czero++;
00586 }
00587 }
00588 cout << " Nb of fMiscDiag counters at zero: "
00589 << misc_czero << " (total nb of counters: "
00590 << fNbOfMiscDiagCounters << ")" << endl;
00591 }
00592
00593 if (fMiscDiag != 0){delete [] fMiscDiag; fCdelete++;}
00594
00595
00596
00597
00598
00599
00600
00601
00602 if (fT1d_StexStinFromIndex != 0){delete [] fT1d_StexStinFromIndex; fCdelete++;}
00603
00604 if (fT2d_NbOfEvts != 0){delete [] fT2d_NbOfEvts; fCdelete++;}
00605 if (fT1d_NbOfEvts != 0){delete [] fT1d_NbOfEvts; fCdelete++;}
00606
00607 if (fT3d_distribs != 0){delete [] fT3d_distribs; fCdelete++;}
00608 if (fT3d2_distribs != 0){delete [] fT3d2_distribs; fCdelete++;}
00609 if (fT3d1_distribs != 0){delete [] fT3d1_distribs; fCdelete++;}
00610
00611 if (fT2d_ev != 0){delete [] fT2d_ev; fCdelete++;}
00612 if (fT1d_ev != 0){delete [] fT1d_ev; fCdelete++;}
00613
00614 if (fT2d_sig != 0){delete [] fT2d_sig; fCdelete++;}
00615 if (fT1d_sig != 0){delete [] fT1d_sig; fCdelete++;}
00616
00617 if (fT3d_cov_ss != 0){delete [] fT3d_cov_ss; fCdelete++;}
00618 if (fT3d2_cov_ss != 0){delete [] fT3d2_cov_ss; fCdelete++;}
00619 if (fT3d1_cov_ss != 0){delete [] fT3d1_cov_ss; fCdelete++;}
00620
00621 if (fT3d_cor_ss != 0){delete [] fT3d_cor_ss; fCdelete++;}
00622 if (fT3d2_cor_ss != 0){delete [] fT3d2_cor_ss; fCdelete++;}
00623 if (fT3d1_cor_ss != 0){delete [] fT3d1_cor_ss; fCdelete++;}
00624
00625 if (fT2d_lf_cov != 0){delete [] fT2d_lf_cov; fCdelete++;}
00626 if (fT2d1_lf_cov != 0){delete [] fT2d1_lf_cov; fCdelete++;}
00627
00628 if (fT2d_lf_cor != 0){delete [] fT2d_lf_cor; fCdelete++;}
00629 if (fT2d1_lf_cor != 0){delete [] fT2d1_lf_cor; fCdelete++;}
00630
00631 if (fT2d_hf_cov != 0){delete [] fT2d_hf_cov; fCdelete++;}
00632 if (fT2d1_hf_cov != 0){delete [] fT2d1_hf_cov; fCdelete++;}
00633
00634 if (fT2d_hf_cor != 0){delete [] fT2d_hf_cor; fCdelete++;}
00635 if (fT2d1_hf_cor != 0){delete [] fT2d1_hf_cor; fCdelete++;}
00636
00637 if (fT2d_lfcc_mostins != 0){delete [] fT2d_lfcc_mostins; fCdelete++;}
00638 if (fT2d1_lfcc_mostins != 0){delete [] fT2d1_lfcc_mostins ; fCdelete++;}
00639
00640 if (fT2d_hfcc_mostins != 0){delete [] fT2d_hfcc_mostins ; fCdelete++;}
00641 if (fT2d1_hfcc_mostins != 0){delete [] fT2d1_hfcc_mostins; fCdelete++;}
00642
00643 if (fT1d_ev_ev != 0){delete [] fT1d_ev_ev; fCdelete++;}
00644 if (fT1d_evsamp_of_sigevt != 0){delete [] fT1d_evsamp_of_sigevt; fCdelete++;}
00645 if (fT1d_ev_cor_ss != 0){delete [] fT1d_ev_cor_ss; fCdelete++;}
00646 if (fT1d_av_mped != 0){delete [] fT1d_av_mped; fCdelete++;}
00647 if (fT1d_av_totn != 0){delete [] fT1d_av_totn; fCdelete++;}
00648 if (fT1d_av_lofn != 0){delete [] fT1d_av_lofn; fCdelete++;}
00649 if (fT1d_av_hifn != 0){delete [] fT1d_av_hifn; fCdelete++;}
00650 if (fT1d_av_ev_corss != 0){delete [] fT1d_av_ev_corss; fCdelete++;}
00651 if (fT1d_av_sig_corss != 0){delete [] fT1d_av_sig_corss; fCdelete++;}
00652
00653 if (fT1d_sigevt_of_evsamp != 0){delete [] fT1d_sigevt_of_evsamp; fCdelete++;}
00654 if (fT1d_evevt_of_sigsamp != 0){delete [] fT1d_evevt_of_sigsamp; fCdelete++;}
00655 if (fT1d_sig_cor_ss != 0){delete [] fT1d_sig_cor_ss; fCdelete++;}
00656
00657 if (fT2dCrysNumbersTable != 0){delete [] fT2dCrysNumbersTable; fCdelete++;}
00658 if (fT1dCrysNumbersTable != 0){delete [] fT1dCrysNumbersTable; fCdelete++;}
00659
00660 if (fTagStinNumbers != 0){delete [] fTagStinNumbers; fCdelete++;}
00661 if (fTagNbOfEvts != 0){delete [] fTagNbOfEvts; fCdelete++;}
00662 if (fTagAdcEvt != 0){delete [] fTagAdcEvt; fCdelete++;}
00663 if (fTagMSp != 0){delete [] fTagMSp; fCdelete++;}
00664 if (fTagSSp != 0){delete [] fTagSSp; fCdelete++;}
00665
00666 if (fTagCovCss != 0){delete [] fTagCovCss; fCdelete++;}
00667 if (fTagCorCss != 0){delete [] fTagCorCss; fCdelete++;}
00668
00669 if (fTagHfCov != 0){delete [] fTagHfCov; fCdelete++;}
00670 if (fTagHfCor != 0){delete [] fTagHfCor; fCdelete++;}
00671 if (fTagLfCov != 0){delete [] fTagLfCov; fCdelete++;}
00672 if (fTagLfCor != 0){delete [] fTagLfCor; fCdelete++;}
00673
00674 if (fTagLFccMoStins != 0){delete [] fTagLFccMoStins; fCdelete++;}
00675 if (fTagHFccMoStins != 0){delete [] fTagHFccMoStins; fCdelete++;}
00676
00677 if (fTagPed != 0){delete [] fTagPed; fCdelete++;}
00678 if (fTagTno != 0){delete [] fTagTno; fCdelete++;}
00679 if (fTagMeanCorss != 0){delete [] fTagMeanCorss; fCdelete++;}
00680
00681 if (fTagLfn != 0){delete [] fTagLfn; fCdelete++;}
00682 if (fTagHfn != 0){delete [] fTagHfn; fCdelete++;}
00683 if (fTagSigCorss != 0){delete [] fTagSigCorss; fCdelete++;}
00684
00685 if (fTagAvPed != 0){delete [] fTagAvPed; fCdelete++;}
00686 if (fTagAvTno != 0){delete [] fTagAvTno; fCdelete++;}
00687 if (fTagAvLfn != 0){delete [] fTagAvLfn; fCdelete++;}
00688 if (fTagAvHfn != 0){delete [] fTagAvHfn; fCdelete++;}
00689 if (fTagAvMeanCorss != 0){delete [] fTagAvMeanCorss; fCdelete++;}
00690 if (fTagAvSigCorss != 0){delete [] fTagAvSigCorss; fCdelete++;}
00691
00692 if ( fCnew != fCdelete )
00693 {
00694 cout << "!TEcnaRun::~TEcnaRun()> WRONG MANAGEMENT OF MEMORY ALLOCATIONS: fCnew = "
00695 << fCnew << ", fCdelete = " << fCdelete << fTTBELL << endl;
00696 }
00697 else
00698 {
00699
00700
00701 }
00702
00703 if(fFlagPrint == fCodePrintAllComments)
00704 {
00705 cout << "*TEcnaRun::~TEcnaRun()> Exiting destructor (this = " << this << ")." << endl
00706 << "~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#"
00707 << endl;
00708 }
00709
00710
00711 }
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728 void TEcnaRun::GetReadyToReadData(TString typ_ana, const Int_t& run_number,
00729 const Int_t& nfirst, const Int_t& nlast, const Int_t& nbevts,
00730 const Int_t& Stex)
00731 {
00732
00733
00734
00735 Int_t RunType = 99999999;
00736 GetReadyToReadData(typ_ana, run_number, nfirst, nlast, nbevts, Stex, RunType);
00737 }
00738
00739 void TEcnaRun::GetReadyToReadData( TString typ_ana, const Int_t& run_number,
00740 const Int_t& nfirst, const Int_t& nlast, const Int_t& nbevts,
00741 const Int_t& Stex, const Int_t& run_type)
00742 {
00743
00744
00745
00746
00747 Int_t nrangeevts = nlast - nfirst + 1;
00748
00749 if( nrangeevts < nbevts )
00750 {
00751 if( nlast >= nfirst )
00752 {
00753 cout << "*TEcnaRun::GetReadyToReadData(...)> --- WARNING ---> number of events = " << nbevts
00754 << ", out of range (range = " << nfirst << "," << nlast << ")" << endl
00755 << " The number of found events will be less " << endl
00756 << " than the number of requested events." << endl;
00757 }
00758 if( nlast < nfirst )
00759 {
00760 cout << "*TEcnaRun::GetReadyToReadData(...)> --- INFO ---> last requested event number = " << nlast
00761 << ", less than first requested event number (= " << nfirst << ")" << endl
00762 << " File will be read until EOF if the number of found events" << endl
00763 << " remains less than the number of requested events." << endl;
00764 }
00765
00766 }
00767
00768 Int_t ifirst = nfirst - 1;
00769
00770
00771 fMiscDiag = new Int_t[fNbOfMiscDiagCounters]; fCnew++;
00772 for (Int_t iz=0; iz<fNbOfMiscDiagCounters; iz++){fMiscDiag[iz] = (Int_t)0;}
00773
00774
00775 Int_t nentries = 99999999;
00776 if ( nfirst <= nentries )
00777 {
00778
00779 if ( nfirst > 0 )
00780 {
00781
00782
00783 if( nlast <= nentries )
00784 {
00785 const Text_t *h_name = "CnaHeader";
00786 const Text_t *h_title = "CnaHeader";
00787
00788
00789
00790
00791
00792 if ( fEcal->MaxStinEcnaInStex() > 0 && fEcal->MaxCrysInStin() > 0 && fNbSampForFic > 0 )
00793 {
00794 if( fFileHeader == 0 ){fFileHeader = new TEcnaHeader(h_name, h_title);}
00795
00796 fFileHeader->HeaderParameters(typ_ana, fNbSampForFic,
00797 run_number, nfirst, nlast, nbevts,
00798 Stex, run_type);
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819 fTagStinNumbers = new Int_t[1]; fCnew++; fTagStinNumbers[0] = (Int_t)0;
00820 fTagNbOfEvts = new Int_t[1]; fCnew++; fTagNbOfEvts[0] = (Int_t)0;
00821
00822 fTagAdcEvt = new Int_t[fEcal->MaxCrysEcnaInStex()]; fCnew++;
00823 for (Int_t iz=0; iz<fEcal->MaxCrysEcnaInStex(); iz++){fTagAdcEvt[iz] = (Int_t)0;}
00824
00825 fTagMSp = new Int_t[1]; fCnew++; fTagMSp[0] = (Int_t)0;
00826 fTagSSp = new Int_t[1]; fCnew++; fTagSSp[0] = (Int_t)0;
00827
00828 fTagCovCss = new Int_t[fEcal->MaxCrysEcnaInStex()]; fCnew++;
00829 for (Int_t iz=0; iz<fEcal->MaxCrysEcnaInStex(); iz++){fTagCovCss[iz] = (Int_t)0;}
00830
00831 fTagCorCss = new Int_t[fEcal->MaxCrysEcnaInStex()]; fCnew++;
00832 for (Int_t iz=0; iz<fEcal->MaxCrysEcnaInStex(); iz++){fTagCorCss[iz] = (Int_t)0;}
00833
00834 fTagLfCov = new Int_t[1]; fCnew++; fTagLfCov[0] = (Int_t)0;
00835 fTagLfCor = new Int_t[1]; fCnew++; fTagLfCor[0] = (Int_t)0;
00836
00837 fTagHfCov = new Int_t[1]; fCnew++; fTagHfCov[0] = (Int_t)0;
00838 fTagHfCor = new Int_t[1]; fCnew++; fTagHfCor[0] = (Int_t)0;
00839
00840 fTagLFccMoStins = new Int_t[1]; fCnew++; fTagLFccMoStins[0] = (Int_t)0;
00841 fTagHFccMoStins = new Int_t[1]; fCnew++; fTagHFccMoStins[0] = (Int_t)0;
00842
00843 fTagPed = new Int_t[1]; fCnew++; fTagPed[0] = (Int_t)0;
00844 fTagTno = new Int_t[1]; fCnew++; fTagTno[0] = (Int_t)0;
00845 fTagMeanCorss = new Int_t[1]; fCnew++; fTagMeanCorss[0] = (Int_t)0;
00846
00847 fTagLfn = new Int_t[1]; fCnew++; fTagLfn[0] = (Int_t)0;
00848 fTagHfn = new Int_t[1]; fCnew++; fTagHfn[0] = (Int_t)0;
00849 fTagSigCorss = new Int_t[1]; fCnew++; fTagSigCorss[0] = (Int_t)0;
00850
00851 fTagAvPed = new Int_t[1]; fCnew++; fTagAvPed[0] = (Int_t)0;
00852 fTagAvTno = new Int_t[1]; fCnew++; fTagAvTno[0] = (Int_t)0;
00853 fTagAvLfn = new Int_t[1]; fCnew++; fTagAvLfn[0] = (Int_t)0;
00854 fTagAvHfn = new Int_t[1]; fCnew++; fTagAvHfn[0] = (Int_t)0;
00855 fTagAvMeanCorss = new Int_t[1]; fCnew++; fTagAvMeanCorss[0] = (Int_t)0;
00856 fTagAvSigCorss = new Int_t[1]; fCnew++; fTagAvSigCorss[0] = (Int_t)0;
00857
00858
00859
00860
00861
00862
00863
00864 if(fT1d_StexStinFromIndex == 0)
00865 {
00866 fT1d_StexStinFromIndex = new Int_t[fEcal->MaxStinEcnaInStex()]; fCnew++;
00867 }
00868 for ( Int_t i0_Stin = 0; i0_Stin < fEcal->MaxStinEcnaInStex(); i0_Stin++ )
00869 {
00870 fT1d_StexStinFromIndex[i0_Stin] = fSpecialStexStinNotIndexed;
00871 }
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883 if(fT3d_distribs == 0)
00884 {
00885
00886 cout << "*TEcnaRun::GetReadyToReadData(...)> Allocation of 3D array for ADC distributions."
00887 << " Nb of requested evts = " << fFileHeader->fReqNbOfEvts << endl
00888 << " This number must not be too large"
00889 << " (no failure after this message means alloc OK)." << endl;
00890
00891 fT3d_distribs = new Double_t**[fEcal->MaxCrysEcnaInStex()]; fCnew++;
00892
00893 fT3d2_distribs =
00894 new Double_t*[fEcal->MaxCrysEcnaInStex()*
00895 fNbSampForFic]; fCnew++;
00896
00897 fT3d1_distribs =
00898 new Double_t[fEcal->MaxCrysEcnaInStex()*
00899 fNbSampForFic*
00900 fFileHeader->fReqNbOfEvts]; fCnew++;
00901
00902 for(Int_t i0StexEcha=0; i0StexEcha<fEcal->MaxCrysEcnaInStex(); i0StexEcha++){
00903 fT3d_distribs[i0StexEcha] = &fT3d2_distribs[0] + i0StexEcha*fNbSampForFic;
00904 for(Int_t j0Sample=0; j0Sample<fNbSampForFic; j0Sample++){
00905 fT3d2_distribs[fNbSampForFic*i0StexEcha + j0Sample] = &fT3d1_distribs[0]+
00906 fFileHeader->fReqNbOfEvts*(fNbSampForFic*i0StexEcha+j0Sample);}}
00907 }
00908
00909
00910 for (Int_t iza=0; iza<fEcal->MaxCrysEcnaInStex(); iza++)
00911 {
00912 for (Int_t izb=0; izb<fNbSampForFic; izb++)
00913 {
00914 for (Int_t izc=0; izc<fFileHeader->fReqNbOfEvts; izc++)
00915 {
00916 if( fT3d_distribs[iza][izb][izc] != (Double_t)0 )
00917 {
00918 fMiscDiag[0]++;
00919 fT3d_distribs[iza][izb][izc] = (Double_t)0;
00920 }
00921 }
00922 }
00923 }
00924
00925
00926
00927
00928
00929
00930
00931
00932 if (fT2d_NbOfEvts == 0)
00933 {
00934 fT2d_NbOfEvts = new Int_t*[fEcal->MaxCrysEcnaInStex()]; fCnew++;
00935 fT1d_NbOfEvts = new Int_t[fEcal->MaxCrysEcnaInStex()*
00936 fNbSampForFic]; fCnew++;
00937
00938 for(Int_t i0StexEcha = 0 ; i0StexEcha < fEcal->MaxCrysEcnaInStex() ; i0StexEcha++)
00939 {
00940 fT2d_NbOfEvts[i0StexEcha] =
00941 &fT1d_NbOfEvts[0] + i0StexEcha*fNbSampForFic;
00942 }
00943
00944
00945 for(Int_t i0StexEcha=0; i0StexEcha<fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
00946 {
00947 for(Int_t i0Sample=0; i0Sample<fNbSampForFic; i0Sample++)
00948 {
00949 fT2d_NbOfEvts[i0StexEcha][i0Sample] = 0;
00950 }
00951 }
00952 }
00953 else
00954 {
00955 cerr << "!TEcnaRun::GetReadyToReadData(...)> *** ERROR *** No allocation for fT2d_NbOfEvts!"
00956 << " Pointer already not NULL " << fTTBELL << endl;
00957
00958
00959 }
00960 }
00961 else
00962 {
00963 cerr << endl
00964 << "!TEcnaRun::GetReadyToReadData(...)> "
00965 << " *** ERROR *** " << endl
00966 << " --------------------------------------------------"
00967 << endl
00968 << " NULL or NEGATIVE values for arguments" << endl
00969 << " with expected positive values:" << endl
00970 << " Number of Stins in Stex = " << fEcal->MaxStinEcnaInStex() << endl
00971 << " Number of crystals in Stin = " << fEcal->MaxCrysInStin() << endl
00972 << " Number of samples by channel = " << fNbSampForFic << endl
00973 << endl
00974 << endl
00975 << " hence, no memory allocation for array member has been performed." << endl;
00976
00977 cout << "Enter: 0 and RETURN to continue or: CTRL C to exit";
00978 Int_t toto;
00979 cin >> toto;
00980 }
00981
00982 if(fFlagPrint == fCodePrintAllComments ){
00983 cout << endl;
00984 cout << "*TEcnaRun::GetReadyToReadData(...)>" << endl
00985 << " The method has been called with the following argument values:" << endl
00986 << " Analysis name = "
00987 << fFileHeader->fTypAna << endl
00988 << " Run number = "
00989 << fFileHeader->fRunNumber << endl
00990 << " Run type = "
00991 << fFileHeader->fRunType << endl
00992 << " First requested event number = "
00993 << fFileHeader->fFirstReqEvtNumber << endl
00994 << " Last requested event number = "
00995 << fFileHeader->fLastReqEvtNumber << endl
00996 << " " << fStexName.Data() << " number = "
00997 << fFileHeader->fStex << endl
00998 << " Number of " << fStinName.Data()
00999 << " in " << fStexName.Data() << " = "
01000 << fEcal->MaxStinEcnaInStex() << endl
01001 << " Number of crystals in " << fStinName.Data() << " = "
01002 << fEcal->MaxCrysInStin() << endl
01003 << " Number of samples by channel = "
01004 << fNbSampForFic << endl
01005 << endl;}
01006
01007 fReadyToReadData = 1;
01008 }
01009 else
01010 {
01011 if (fFlagPrint != fCodePrintNoComment){
01012 cout << "!TEcnaRun::GetReadyToReadData(...) > WARNING/CORRECTION:" << endl
01013 << "! The fisrt requested event number is not positive (nfirst = " << nfirst << ") "
01014 << fTTBELL << endl;}
01015 ifirst = 0;
01016 }
01017 }
01018 else
01019 {
01020 if (fFlagPrint != fCodePrintNoComment){
01021 cout << endl << "!TEcnaRun::GetReadyToReadData(...)> WARNING/CORRECTION:" << endl
01022 << "! The number of requested events (nbevts = " << nbevts << ") is too large." << endl
01023 << "! Last event number = " << nlast << " > number of entries = " << nentries << ". "
01024 << fTTBELL << endl << endl;}
01025 }
01026 }
01027 else
01028 {
01029 cout << "!TEcnaRun::GetReadyToReadData(...) *** ERROR ***> "
01030 << " The first requested event number is greater than the number of entries."
01031 << fTTBELL << endl;
01032 }
01033 if(fFlagPrint == fCodePrintAllComments){
01034 cout << "*TEcnaRun::GetReadyToReadData(...)> Leaving the method. fReadyToReadData = "
01035 << fReadyToReadData << endl; }
01036
01037 }
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063 Bool_t TEcnaRun::BuildEventDistributions(const Int_t& n1EventNumber, const Int_t& n1StexStin,
01064 const Int_t& i0StinEcha, const Int_t& i0Sample,
01065 const Double_t& adcvalue)
01066 {
01067
01068
01069 fBuildEvtNotSkipped++;
01070
01071 Bool_t ret_code = kFALSE;
01072
01073 Int_t i0EventIndex = n1EventNumber - 1;
01074 Int_t i0StexStinEcna = n1StexStin - 1;
01075
01076 Int_t i_trouve = 0;
01077
01078 if(fReadyToReadData == 1)
01079 {
01080 if( n1StexStin>= 1 && n1StexStin <= fEcal->MaxStinEcnaInStex() )
01081 {
01082 if( i0StinEcha >= 0 && i0StinEcha < fEcal->MaxCrysInStin() )
01083 {
01084 if( i0Sample >= 0 && i0Sample < fNbSampForFic )
01085 {
01086
01087 if( fT1d_StexStinFromIndex != 0 )
01088 {
01089 ret_code = kTRUE;
01090
01091
01092 if( n1StexStin == fT1d_StexStinFromIndex[i0StexStinEcna] ){i_trouve = 1;}
01093
01094
01095 if (i_trouve != 1 )
01096 {
01097 if( fT1d_StexStinFromIndex[i0StexStinEcna] == fSpecialStexStinNotIndexed )
01098 {
01099 fT1d_StexStinFromIndex[i0StexStinEcna] = n1StexStin;
01100 fFileHeader->fStinNumbersCalc = 1;
01101 fTagStinNumbers[0] = 1;
01102 fStinIndexBuilt++;
01103
01104 if(fFlagPrint == fCodePrintAllComments)
01105 {
01106 if( fStinIndexBuilt == 1 )
01107 {
01108 cout << endl << "*TEcnaRun::BuildEventDistributions(...)> event " << n1EventNumber
01109 << " : first event for " << fStexName.Data() << " " << fFileHeader->fStex
01110 << "; " << fStinName.Data() << "s : ";
01111 }
01112 if( fFlagSubDet == "EB" )
01113 {cout << fT1d_StexStinFromIndex[i0StexStinEcna] << ", ";}
01114 if( fFlagSubDet == "EE" )
01115 {cout << fEcalNumbering->
01116 GetDeeSCConsFrom1DeeSCEcna(fFileHeader->fStex, fT1d_StexStinFromIndex[i0StexStinEcna])
01117 << ", ";}
01118 }
01119
01120 if(fFlagPrint == fCodePrintAllComments)
01121 {
01122 cout << " (" << fStinIndexBuilt << " " << fStinName.Data()
01123 << " found), channel " << i0StinEcha << ", i0Sample " << i0Sample << endl;
01124 }
01125 ret_code = kTRUE;
01126 }
01127 else
01128 {
01129 cout << "!TEcnaRun::BuildEventDistributions(...)> *** ERROR ***> NOT ALLOWED if RESULT. "
01130 << " n1StexStin = " << n1StexStin << ", fT1d_StexStinFromIndex["
01131 << i0StexStinEcna << "] = "
01132 << fT1d_StexStinFromIndex[i0StexStinEcna]
01133 << ", fStinIndexBuilt = " << fStinIndexBuilt
01134 << fTTBELL << endl;
01135 ret_code = kFALSE;
01136 }
01137 }
01138 }
01139 else
01140 {
01141 cout << "!TEcnaRun, BuildEventDistributions *** ERROR ***> "
01142 << " fT1d_StexStinFromIndex = " << fT1d_StexStinFromIndex
01143 << " fT1d_StexStinFromIndex[] ALLOCATION NOT DONE" << fTTBELL << endl;
01144 ret_code = kFALSE;
01145 }
01146 }
01147 else
01148 {
01149
01150
01151 if( i0Sample >= fEcal->MaxSampADC() )
01152 {
01153 cout << "!TEcnaRun::BuildEventDistributions(...) *** ERROR ***> "
01154 << " sample number = " << i0Sample << ". OUT OF BOUNDS"
01155 << " (max = " << fEcal->MaxSampADC() << ")"
01156 << fTTBELL << endl;
01157 ret_code = kFALSE;
01158 }
01159 else
01160 {
01161 ret_code = kTRUE;
01162 }
01163 }
01164 }
01165 else
01166 {
01167 cout << "!TEcnaRun::BuildEventDistributions(...) *** ERROR ***> "
01168 << " channel number in " << fStinName.Data() << " = " << i0StinEcha << ". OUT OF BOUNDS"
01169 << " (max = " << fEcal->MaxCrysInStin() << ")"
01170 << fTTBELL << endl;
01171 ret_code = kFALSE;
01172 }
01173 }
01174 else
01175 {
01176 cout << "!TEcnaRun::BuildEventDistributions(...) *** ERROR ***> "
01177 << fStinName.Data() << " number in " << fStexName.Data() << " = " << n1StexStin << ". OUT OF BOUNDS"
01178 << " (max = " << fEcal->MaxStinEcnaInStex() << ")"
01179 << fTTBELL << endl;
01180 ret_code = kFALSE;
01181 }
01182
01183
01184
01185
01186 if( ret_code == kTRUE )
01187 {
01188 if( i0Sample < fNbSampForFic )
01189 {
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200
01201
01202 Int_t i0StexEcha = i0StexStinEcna*fEcal->MaxCrysInStin() + i0StinEcha;
01203
01204
01205 if( i0StexEcha >= 0 && i0StexEcha < fEcal->MaxCrysEcnaInStex() )
01206 {
01207
01208 (fT2d_NbOfEvts[i0StexEcha][i0Sample])++;
01209 fTagNbOfEvts[0] = 1;
01210 fFileHeader->fNbOfEvtsCalc = 1;
01211
01212
01213 if ( i0EventIndex >= 0 && i0EventIndex < fFileHeader->fReqNbOfEvts )
01214 {
01215 fT3d_distribs[i0StexEcha][i0Sample][i0EventIndex] = adcvalue;
01216 }
01217 else
01218 {
01219 cout << "!TEcnaRun::BuildEventDistributions(...) *** ERROR ***> "
01220 << " event number = " << n1EventNumber << ". OUT OF BOUNDS"
01221 << " (max = " << fFileHeader->fReqNbOfEvts << ")"
01222 << fTTBELL << endl;
01223 ret_code = kFALSE;
01224 }
01225 }
01226 else
01227 {
01228 cout << "!TEcnaRun::BuildEventDistributions(...) *** ERROR ***> "
01229 << " CHANNEL NUMBER OUT OF BOUNDS" << endl
01230 << " i0StexEcha number = " << i0StexEcha
01231 << " , n1StexStin = " << n1StexStin
01232 << " , i0StinEcha = " << i0StinEcha
01233 << " , fEcal->MaxCrysEcnaInStex() = " << fEcal->MaxCrysEcnaInStex()
01234 << fTTBELL << endl;
01235 ret_code = kFALSE;
01236
01237 }
01238 }
01239 else
01240 {
01241 cout << "!TEcnaRun::BuildEventDistributions(...) *** ERROR ***> Nb of required samples = "
01242 << i0Sample << " (Max = " << fNbSampForFic << ")" << fTTBELL << endl;
01243 }
01244 }
01245 else
01246 {
01247 cout << "!TEcnaRun::BuildEventDistributions(...) *** ERROR ***> ret_code = kFALSE "
01248 << fTTBELL << endl;
01249 }
01250 }
01251 else
01252 {
01253 cout << "!TEcnaRun::BuildEventDistributions(...) *** ERROR ***> GetReadyToReadData(...) not called."
01254 << fTTBELL << endl;
01255 ret_code = kFALSE;
01256 }
01257
01258 if (ret_code == kFALSE)
01259 {
01260 cout << "!TEcnaRun::BuildEventDistributions(...) > ret_code = " << ret_code << ". event: " << n1EventNumber
01261 << ", n1StexStin: " << n1StexStin
01262 << ", i0StinEcha: " << i0StinEcha
01263 << ", i0Sample: " << i0Sample
01264 << ", adcvalue: " << adcvalue << endl;
01265 }
01266 return ret_code;
01267 }
01268
01269
01270
01271
01272
01273
01274
01275 Bool_t TEcnaRun::ReadEventDistributions()
01276 {
01277 return ReadEventDistributions(fEcal->MaxSampADC());
01278 }
01279
01280 Bool_t TEcnaRun::ReadEventDistributions(const Int_t& nb_samp_for_calc)
01281 {
01282
01283
01284
01285
01286
01287
01288 fNbSampForCalc = nb_samp_for_calc;
01289
01290 TEcnaRead* MyRootFile = new TEcnaRead(fFlagSubDet.Data(), fCnaParPaths, fCnaParCout,
01291 fFileHeader, fEcalNumbering, fCnaWrite);
01292
01293 MyRootFile->PrintNoComment();
01294
01295 MyRootFile->GetReadyToReadRootFile(fFileHeader->fTypAna, fFileHeader->fNbOfSamples, fFileHeader->fRunNumber,
01296 fFileHeader->fFirstReqEvtNumber, fFileHeader->fLastReqEvtNumber,
01297 fFileHeader->fReqNbOfEvts, fFileHeader->fStex,
01298 fCnaParPaths->ResultsRootFilePath().Data());
01299
01300 Bool_t ok_read = MyRootFile->LookAtRootFile();
01301
01302 fFileHeader->fStartTime = MyRootFile->GetStartTime();
01303 fFileHeader->fStopTime = MyRootFile->GetStopTime();
01304 fFileHeader->fStartDate = MyRootFile->GetStartDate();
01305 fFileHeader->fStopDate = MyRootFile->GetStopDate();
01306
01307 if ( ok_read == kTRUE )
01308 {
01309 fRootFileName = MyRootFile->GetRootFileName();
01310 fRootFileNameShort = MyRootFile->GetRootFileNameShort();
01311 cout << "*TEcnaRun::ReadEventDistributions> Reading sample ADC values from file: " << endl
01312 << " " << fRootFileName << endl;
01313
01314 Int_t i_no_data = 0;
01315
01316
01317 TVectorD vec(fEcal->MaxStinEcnaInStex());
01318 for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
01319 vec = MyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
01320 if( MyRootFile->DataExist() == kTRUE )
01321 {
01322 fTagStinNumbers[0] = 1;
01323 fFileHeader->fStinNumbersCalc = 1;
01324 for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
01325 {fT1d_StexStinFromIndex[i0StexStinEcna] = (Int_t)vec(i0StexStinEcna);}
01326 }
01327 else
01328 {
01329 i_no_data++;
01330 }
01331
01332 TMatrixD partial_matrix(fEcal->MaxCrysInStin(), fFileHeader->fNbOfSamples);
01333 for(Int_t i=0; i<fEcal->MaxCrysInStin(); i++)
01334 {for(Int_t j=0; j<fFileHeader->fNbOfSamples; j++){partial_matrix(i,j)=(Double_t)0.;}}
01335
01336 for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
01337 {
01338 Int_t n1StexStin = MyRootFile->GetStexStinFromIndex(i0StexStinEcna);
01339 if(n1StexStin != -1)
01340 {
01341 partial_matrix =
01342 MyRootFile->ReadNumberOfEventsForSamples
01343 (n1StexStin, fEcal->MaxCrysInStin(), fFileHeader->fNbOfSamples);
01344
01345 if( MyRootFile->DataExist() == kTRUE )
01346 {
01347 fTagNbOfEvts[0] = 1;
01348 fFileHeader->fNbOfEvtsCalc = 1;
01349 for(Int_t i0StinCrys=0; i0StinCrys<fEcal->MaxCrysInStin(); i0StinCrys++)
01350 {
01351 Int_t i0StexEcha = (n1StexStin-1)*fEcal->MaxCrysInStin() + i0StinCrys;
01352 for(Int_t i0Sample=0; i0Sample<fFileHeader->fNbOfSamples; i0Sample++)
01353 {fT2d_NbOfEvts[i0StexEcha][i0Sample] = (Int_t)partial_matrix(i0StinCrys,i0Sample);}
01354 }
01355 }
01356 else
01357 {
01358 i_no_data++;
01359 }
01360 }
01361 }
01362
01363
01364 Double_t*** fT3d_read_distribs =
01365 MyRootFile->ReadSampleValuesSameFile
01366 (fEcal->MaxCrysEcnaInStex(), fFileHeader->fNbOfSamples, fFileHeader->fReqNbOfEvts);
01367
01368 if( MyRootFile->DataExist() == kTRUE )
01369 {
01370 for(Int_t i0StexEcha=0; i0StexEcha<fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
01371 {
01372 for(Int_t i0Sample=0; i0Sample<fFileHeader->fNbOfSamples;i0Sample++)
01373 {
01374 for(Int_t i_event=0; i_event<fFileHeader->fReqNbOfEvts; i_event++)
01375 {fT3d_distribs[i0StexEcha][i0Sample][i_event] =
01376 fT3d_read_distribs[i0StexEcha][i0Sample][i_event];}
01377 }
01378 }
01379 }
01380 else
01381 {
01382 i_no_data++;
01383 }
01384 if( i_no_data != 0 )
01385 {
01386 cout << "!TEcnaRun::ReadEventDistributions(...)> *ERROR* =====> "
01387 << " Read failure. i_no_data = " << i_no_data << fTTBELL << endl;
01388 }
01389 }
01390 else
01391 {
01392 cout << "!TEcnaRun::ReadEventDistributions(...)> *ERROR* =====> "
01393 << " ROOT file not found" << fTTBELL << endl;
01394 }
01395 delete MyRootFile;
01396 return ok_read;
01397 }
01398
01399
01400
01401
01402
01403
01404 TString TEcnaRun::GetRootFileName(){return fRootFileName;}
01405 TString TEcnaRun::GetRootFileNameShort(){return fRootFileNameShort;}
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419 void TEcnaRun::StartStopTime(time_t t_startime, time_t t_stoptime)
01420 {
01421
01422
01423 fFileHeader->fStartTime = t_startime;
01424 fFileHeader->fStopTime = t_stoptime;
01425 }
01426
01427 void TEcnaRun::StartStopDate(TString c_startdate, TString c_stopdate)
01428 {
01429
01430
01431 fFileHeader->fStartDate = c_startdate;
01432 fFileHeader->fStopDate = c_stopdate;
01433 }
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448 void TEcnaRun::SampleValues()
01449 {
01450
01451
01452 if(fFlagPrint == fCodePrintAllComments){
01453 cout << "*TEcnaRun::SampleValues()>"
01454 << " Sample ADC values 3D histo"
01455 << " (channel, sample, event number):" << endl
01456 << " registration for writing in results .root file."
01457 << endl;}
01458
01459
01460
01461
01462 for (Int_t i0StexEcha = 0 ; i0StexEcha < fEcal->MaxCrysEcnaInStex() ; i0StexEcha++)
01463 {fTagAdcEvt[i0StexEcha] = 1; fFileHeader->fAdcEvtCalc++;}
01464 }
01465
01466
01467
01468
01469
01470
01471 void TEcnaRun::GetReadyToCompute()
01472 {
01473
01474
01475
01476
01477
01478
01479 if( fT2d_NbOfEvts != 0 )
01480 {
01481 fNumberOfEvents = fCnaWrite->NumberOfEvents(fT2d_NbOfEvts, fEcal->MaxCrysEcnaInStex(),
01482 fNbSampForFic, fFileHeader->fReqNbOfEvts);
01483 }
01484 else
01485 {
01486 cout << "*TEcnaRun::GetReadyToCompute()> no data? fT2d_NbOfEvts = " << fT2d_NbOfEvts << endl;
01487 }
01488
01489 }
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513 void TEcnaRun::SampleMeans()
01514 {
01515
01516
01517
01518 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::SampleMeans() " << endl;}
01519 if(fFlagPrint == fCodePrintAllComments){
01520 cout << " Calculation: sample expectation values over the events"
01521 << " for each channel." << endl;}
01522
01523
01524 if ( fT2d_ev == 0 ){
01525 Int_t n_samp = fNbSampForCalc;
01526 Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
01527 fT2d_ev = new Double_t*[n_StexEcha]; fCnew++;
01528 fT1d_ev = new Double_t[n_StexEcha*n_samp]; fCnew++;
01529 for(Int_t i = 0 ; i < n_StexEcha ; i++){
01530 fT2d_ev[i] = &fT1d_ev[0] + i*n_samp;}
01531 }
01532
01533 for(Int_t i0StexEcha=0; i0StexEcha<fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
01534 {
01535 for(Int_t i0Sample=0; i0Sample<fNbSampForCalc; i0Sample++)
01536 {
01537 if( fT2d_ev[i0StexEcha][i0Sample] != (Double_t)0 )
01538 {fMiscDiag[1]++; fT2d_ev[i0StexEcha][i0Sample] = (Double_t)0;}
01539 }
01540 }
01541
01542
01543 for (Int_t i0StexEcha = 0 ; i0StexEcha < fEcal->MaxCrysEcnaInStex() ; i0StexEcha++)
01544 {
01545 for (Int_t i0Sample = 0 ; i0Sample < fNbSampForCalc ; i0Sample++)
01546 {
01547 for( Int_t i_event = 0; i_event < fNumberOfEvents; i_event++ )
01548 {
01549 fT2d_ev[i0StexEcha][i0Sample] += fT3d_distribs[i0StexEcha][i0Sample][i_event];
01550 }
01551 fT2d_ev[i0StexEcha][i0Sample] /= fNumberOfEvents;
01552 }
01553 }
01554 fTagMSp[0] = 1; fFileHeader->fMSpCalc++;
01555 }
01556
01557
01558
01559
01560
01561
01562
01563 void TEcnaRun::SampleSigmas()
01564 {
01565
01566
01567 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::SampleSigmas()" << endl;}
01568 if(fFlagPrint == fCodePrintAllComments){
01569 cout << " Calculation: sample ADC sigmas over the events "
01570 << " for each channel." << endl;}
01571
01572
01573
01574
01575
01576 if(fTagMSp[0] != 1){SampleMeans(); fTagMSp[0] = 0;}
01577
01578
01579 if( fT2d_sig == 0){
01580 Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
01581 Int_t n_samp = fNbSampForCalc;
01582 fT2d_sig = new Double_t*[n_StexEcha]; fCnew++;
01583 fT1d_sig = new Double_t[n_StexEcha*n_samp]; fCnew++;
01584 for(Int_t i0StexEcha = 0 ; i0StexEcha < n_StexEcha ; i0StexEcha++){
01585 fT2d_sig[i0StexEcha] = &fT1d_sig[0] + i0StexEcha*n_samp;}
01586 }
01587
01588 for(Int_t i0StexEcha=0; i0StexEcha<fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
01589 {
01590 for(Int_t i0Sample=0; i0Sample<fNbSampForCalc; i0Sample++)
01591 {
01592 if( fT2d_sig[i0StexEcha][i0Sample] != (Double_t)0 )
01593 {fMiscDiag[2]++; fT2d_sig[i0StexEcha][i0Sample] = (Double_t)0;}
01594 }
01595 }
01596
01597
01598 for (Int_t i0StexEcha = 0 ; i0StexEcha < fEcal->MaxCrysEcnaInStex() ; i0StexEcha++)
01599 {
01600 for (Int_t i0Sample = 0 ; i0Sample < fNbSampForCalc ; i0Sample++)
01601 {
01602 Double_t variance = (Double_t)0.;
01603 for( Int_t i_event = 0; i_event < fNumberOfEvents; i_event++ )
01604 {
01605 Double_t ecart = fT3d_distribs[i0StexEcha][i0Sample][i_event] - fT2d_ev[i0StexEcha][i0Sample];
01606 variance += ecart*ecart;
01607 }
01608 variance /= fNumberOfEvents;
01609 fT2d_sig[i0StexEcha][i0Sample] = sqrt(variance);
01610 }
01611 }
01612 fTagSSp[0] = 1; fFileHeader->fSSpCalc++;
01613 }
01614
01615
01616
01617
01618
01619
01620
01621
01622
01623
01624
01625
01626
01627
01628 void TEcnaRun::CovariancesBetweenSamples()
01629 {
01630
01631
01632 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::CovariancesBetweenSamples()" << endl;}
01633 if(fFlagPrint == fCodePrintAllComments){
01634 cout << " Calculation: covariances between samples"
01635 << " for each channel." << endl;}
01636
01637
01638 if( fT3d_cov_ss == 0 ){
01639 const Int_t n_samp = fNbSampForCalc;
01640 const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
01641 fT3d_cov_ss = new Double_t**[n_StexEcha]; fCnew++;
01642 fT3d2_cov_ss = new Double_t*[n_StexEcha*n_samp]; fCnew++;
01643 fT3d1_cov_ss = new Double_t[n_StexEcha*n_samp*n_samp]; fCnew++;
01644 for(Int_t i = 0 ; i < n_StexEcha ; i++){
01645 fT3d_cov_ss[i] = &fT3d2_cov_ss[0] + i*n_samp;
01646 for(Int_t j = 0 ; j < n_samp ; j++){
01647 fT3d2_cov_ss[n_samp*i+j] = &fT3d1_cov_ss[0]+n_samp*(n_samp*i+j);}}
01648 }
01649
01650
01651
01652
01653
01654
01655
01656
01657
01658 if(fTagMSp[0] != 1){SampleMeans(); fTagMSp[0] = 0;}
01659
01660
01661 for (Int_t j0StexEcha = 0 ; j0StexEcha < fEcal->MaxCrysEcnaInStex() ; j0StexEcha++)
01662 {
01663 for (Int_t i0Sample = 0 ; i0Sample < fNbSampForCalc ; i0Sample++)
01664 {
01665 for (Int_t j0Sample = 0 ; j0Sample <= i0Sample; j0Sample++)
01666 {
01667 fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample] = (Double_t)0;
01668 for( Int_t i_event = 0; i_event < fNumberOfEvents; i_event++ )
01669 {
01670 fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample] +=
01671 (fT3d_distribs[j0StexEcha][i0Sample][i_event] - fT2d_ev[j0StexEcha][i0Sample])
01672 *(fT3d_distribs[j0StexEcha][j0Sample][i_event] - fT2d_ev[j0StexEcha][j0Sample]);
01673 }
01674 fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample] /= (Double_t)fNumberOfEvents;
01675 fT3d_cov_ss[j0StexEcha][j0Sample][i0Sample] = fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample];
01676 }
01677 }
01678 fTagCovCss[j0StexEcha] = 1; fFileHeader->fCovCssCalc++;
01679 }
01680 }
01681
01682
01683
01684
01685
01686
01687
01688 void TEcnaRun::CorrelationsBetweenSamples()
01689 {
01690
01691
01692
01693
01694
01695
01696 if ( fTagCovCss[0] != 1 ){CovariancesBetweenSamples();
01697 for (Int_t j0StexEcha = 0 ; j0StexEcha < fEcal->MaxCrysEcnaInStex() ; j0StexEcha++)
01698 {fTagCovCss[j0StexEcha] = 0;}}
01699
01700 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::CorrelationsBetweenSamples()" << endl;}
01701 if(fFlagPrint == fCodePrintAllComments){
01702 cout << " Calculation: correlations between samples"
01703 << " for each channel." << endl;}
01704
01705
01706 if( fT3d_cor_ss == 0){
01707 const Int_t n_samp = fNbSampForCalc;
01708 const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
01709 fT3d_cor_ss = new Double_t**[n_StexEcha]; fCnew++;
01710 fT3d2_cor_ss = new Double_t*[n_StexEcha*n_samp]; fCnew++;
01711 fT3d1_cor_ss = new Double_t[n_StexEcha*n_samp*n_samp]; fCnew++;
01712 for(Int_t i = 0 ; i < n_StexEcha ; i++){
01713 fT3d_cor_ss[i] = &fT3d2_cor_ss[0] + i*n_samp;
01714 for(Int_t j = 0 ; j < n_samp ; j++){
01715 fT3d2_cor_ss[n_samp*i+j] = &fT3d1_cor_ss[0]+n_samp*(n_samp*i+j);}}
01716 }
01717
01718
01719
01720
01721 for (Int_t j0StexEcha = 0 ; j0StexEcha < fEcal->MaxCrysEcnaInStex() ; j0StexEcha++)
01722 {
01723 for (Int_t i0Sample = 0 ; i0Sample < fNbSampForCalc ; i0Sample++)
01724 {
01725 for (Int_t j0Sample = 0 ; j0Sample <= i0Sample ; j0Sample++)
01726 {
01727 if( (fT3d_cov_ss[j0StexEcha][i0Sample][i0Sample] > 0) &&
01728 (fT3d_cov_ss[j0StexEcha][j0Sample][j0Sample] > 0) )
01729 {
01730 fT3d_cor_ss[j0StexEcha][i0Sample][j0Sample] = fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample]/
01731 ( sqrt(fT3d_cov_ss[j0StexEcha][i0Sample][i0Sample])*sqrt(fT3d_cov_ss[j0StexEcha][j0Sample][j0Sample]) );
01732 }
01733 else
01734 {
01735 (fT3d_cor_ss)[j0StexEcha][i0Sample][j0Sample] = (Double_t)0;
01736 }
01737 fT3d_cor_ss[j0StexEcha][j0Sample][i0Sample] = fT3d_cor_ss[j0StexEcha][i0Sample][j0Sample];
01738 }
01739 }
01740 fTagCorCss[j0StexEcha] = 1; fFileHeader->fCorCssCalc++;
01741 }
01742 }
01743
01744
01745
01746
01747
01748
01749
01750
01751
01752
01753
01754
01755
01756
01757
01758 void TEcnaRun::Pedestals()
01759 {
01760
01761
01762
01763
01764
01765 if ( fTagMSp[0] != 1 ){SampleMeans(); fTagMSp[0]=0;}
01766
01767
01768 if( fT1d_ev_ev == 0 ){fT1d_ev_ev = new Double_t[fEcal->MaxCrysEcnaInStex()]; fCnew++;}
01769 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
01770 {if( fT1d_ev_ev[i0StexEcha] != (Double_t)0 )
01771 {fMiscDiag[11]++; fT1d_ev_ev[i0StexEcha] = (Double_t)0;}}
01772
01773
01774 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::Pedestals()" << endl;}
01775 if(fFlagPrint == fCodePrintAllComments){
01776 cout << " Calculation, for all the channels, of the expectation values (over the samples 1 to "
01777 << fNbSampForCalc << ")" << endl
01778 << " of the ADC expectation values (over the events)." << endl;}
01779
01780 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
01781 {
01782 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++)
01783 {
01784 fT1d_ev_ev[i0StexEcha] += fT2d_ev[i0StexEcha][i0Sample];
01785 }
01786 fT1d_ev_ev[i0StexEcha] /= fNbSampForCalc;
01787 }
01788 fTagPed[0] = 1; fFileHeader->fPedCalc++;
01789 }
01790
01791
01792
01793
01794
01795
01796
01797
01798 void TEcnaRun::TotalNoise()
01799 {
01800
01801
01802
01803
01804
01805 if ( fTagSSp[0] != 1 ){SampleSigmas(); fTagSSp[0]=0;}
01806
01807
01808 if( fT1d_evsamp_of_sigevt == 0 ){fT1d_evsamp_of_sigevt = new Double_t[fEcal->MaxCrysEcnaInStex()]; fCnew++;}
01809 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
01810 {if( fT1d_evsamp_of_sigevt[i0StexEcha] != (Double_t)0 )
01811 {fMiscDiag[12]++; fT1d_evsamp_of_sigevt[i0StexEcha] = (Double_t)0;}}
01812
01813
01814 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::TotalNoise()" << endl;}
01815 if(fFlagPrint == fCodePrintAllComments){
01816 cout << " Calculation, for all the channels, of the expectation values (over the samples 1 to "
01817 << fNbSampForCalc << ")" << endl
01818 << " of the ADC expectation values (over the events)." << endl;}
01819
01820 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
01821 {
01822 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++)
01823 {
01824 if( fT2d_sig[i0StexEcha][i0Sample] < 0)
01825 {
01826 cout << "!TEcnaRun::TotalNoise() *** ERROR ***> Negative sigma!"
01827 << fTTBELL << endl;
01828 }
01829 else
01830 {
01831 fT1d_evsamp_of_sigevt[i0StexEcha] += fT2d_sig[i0StexEcha][i0Sample];
01832 }
01833 }
01834 fT1d_evsamp_of_sigevt[i0StexEcha] /= fNbSampForCalc;
01835 }
01836 fTagTno[0] = 1; fFileHeader->fTnoCalc++;
01837 }
01838
01839
01840
01841
01842
01843
01844
01845
01846 void TEcnaRun::LowFrequencyNoise()
01847 {
01848
01849
01850
01851
01852 if( fT1d_sigevt_of_evsamp == 0 ){
01853 fT1d_sigevt_of_evsamp = new Double_t[fEcal->MaxCrysEcnaInStex()]; fCnew++;
01854 }
01855 for(Int_t i0StexEcha=0; i0StexEcha<fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
01856 {
01857 if( fT1d_sigevt_of_evsamp[i0StexEcha] != (Double_t)0 )
01858 {fMiscDiag[13]++; fT1d_sigevt_of_evsamp[i0StexEcha] = (Double_t)0;}
01859 }
01860
01861
01862 TVectorD mean_over_samples(fNumberOfEvents);
01863 for(Int_t i=0; i<fNumberOfEvents; i++){mean_over_samples(i)=(Double_t)0.;}
01864
01865
01866 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::LowFrequencyNoise()" << endl;}
01867 if(fFlagPrint == fCodePrintAllComments){
01868 cout << " Calculation, for each channel, of the sigma (over the events)" << endl
01869 << " of the ADC expectation values (over the samples 1 to "
01870 << fNbSampForCalc << ")." << endl;}
01871
01872 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
01873 {
01874
01875 Double_t mean_over_events = (Double_t)0;
01876 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++)
01877 {
01878
01879 mean_over_samples(n_event) = (Double_t)0.;
01880 for(Int_t i0Sample=0; i0Sample<fNbSampForCalc; i0Sample++)
01881 {
01882 mean_over_samples(n_event) += fT3d_distribs[i0StexEcha][i0Sample][n_event];
01883 }
01884 mean_over_samples(n_event) /= (Double_t)fNbSampForCalc;
01885
01886 mean_over_events += mean_over_samples(n_event);
01887 }
01888 mean_over_events /= (Double_t)fNumberOfEvents;
01889
01890
01891 Double_t var = (Double_t)0;
01892 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++)
01893 {
01894 Double_t ecart = mean_over_samples(n_event) - mean_over_events;
01895 var += ecart*ecart;
01896 }
01897 var /= (Double_t)fNumberOfEvents;
01898
01899 fT1d_sigevt_of_evsamp[i0StexEcha] = sqrt(var);
01900 }
01901 fTagLfn[0] = 1; fFileHeader->fLfnCalc++;
01902 }
01903
01904
01905
01906
01907
01908
01909
01910
01911 void TEcnaRun::HighFrequencyNoise()
01912 {
01913
01914
01915
01916
01917 if( fT1d_evevt_of_sigsamp == 0 ){
01918 fT1d_evevt_of_sigsamp = new Double_t[fEcal->MaxCrysEcnaInStex()]; fCnew++;
01919 }
01920 for(Int_t i0StexEcha=0; i0StexEcha<fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
01921 {
01922 if( fT1d_evevt_of_sigsamp[i0StexEcha] != (Double_t)0 )
01923 {fMiscDiag[14]++; fT1d_evevt_of_sigsamp[i0StexEcha] = (Double_t)0;}
01924 }
01925
01926
01927 TVectorD mean_over_samples(fNumberOfEvents);
01928 for(Int_t i=0; i<fNumberOfEvents; i++){mean_over_samples(i)=(Double_t)0.;}
01929 TVectorD sigma_over_samples(fNumberOfEvents);
01930 for(Int_t i=0; i<fNumberOfEvents; i++){sigma_over_samples(i)=(Double_t)0.;}
01931
01932
01933 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::HighFrequencyNoise()" << endl;}
01934 if(fFlagPrint == fCodePrintAllComments){
01935 cout << " Calculation, for each channel, of the sigma (over the events)" << endl
01936 << " of the ADC expectation values (over the samples 1 to "
01937 << fNbSampForCalc << ")." << endl;}
01938
01939 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
01940 {
01941
01942 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++)
01943 {
01944
01945 mean_over_samples(n_event) = (Double_t)0.;
01946 for(Int_t i0Sample=0; i0Sample<fNbSampForCalc; i0Sample++)
01947 {mean_over_samples(n_event) += fT3d_distribs[i0StexEcha][i0Sample][n_event];}
01948 mean_over_samples(n_event) /= (Double_t)fNbSampForCalc;
01949
01950
01951 Double_t var_over_samples = (Double_t)0;
01952 for(Int_t i0Sample=0; i0Sample<fNbSampForCalc; i0Sample++)
01953 {Double_t deviation = fT3d_distribs[i0StexEcha][i0Sample][n_event] - mean_over_samples(n_event);
01954 var_over_samples += deviation*deviation;}
01955 var_over_samples /= (Double_t)fNbSampForCalc;
01956
01957 if( var_over_samples < 0)
01958 {cout << "!TEcnaRun::HighFrequencyNoise() *** ERROR ***> Negative variance! " << fTTBELL << endl;}
01959 else
01960 {sigma_over_samples(n_event) = sqrt(var_over_samples);}
01961 }
01962
01963
01964 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++)
01965 {fT1d_evevt_of_sigsamp[i0StexEcha] += sigma_over_samples(n_event);}
01966
01967 fT1d_evevt_of_sigsamp[i0StexEcha] /= (Double_t)fNumberOfEvents;
01968 }
01969 fTagHfn[0] = 1; fFileHeader->fHfnCalc++;
01970 }
01971
01972
01973
01974
01975
01976
01977
01978
01979
01980 void TEcnaRun::MeanOfCorrelationsBetweenSamples()
01981 {
01982
01983
01984
01985
01986
01987 if ( fTagCorCss[0] != 1 ){CorrelationsBetweenSamples(); fTagCorCss[0]=0;}
01988
01989
01990 if( fT1d_ev_cor_ss == 0 ){
01991 Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
01992 fT1d_ev_cor_ss = new Double_t[n_StexEcha]; fCnew++;
01993 }
01994 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
01995 {
01996 if( fT1d_ev_cor_ss[i0StexEcha] != (Double_t)0 )
01997 {fMiscDiag[15]++; fT1d_ev_cor_ss[i0StexEcha] = (Double_t)0;}
01998 }
01999
02000
02001
02002 Int_t ndim = (Int_t)(fNbSampForCalc*(fNbSampForCalc - 1)/2);
02003
02004 TVectorD half_cor_ss(ndim); for(Int_t i=0; i<ndim; i++){half_cor_ss(i)=(Double_t)0.;}
02005
02006
02007 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::MeanOfCorrelationsBetweenSamples()" << endl;}
02008 if(fFlagPrint == fCodePrintAllComments){
02009 cout << " Calculation, for all the channels, of the expectation values of the" << endl
02010 << " correlations between the first " << fNbSampForCalc << " samples." << endl;}
02011
02012 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
02013 {
02014
02015 Int_t i_count = 0;
02016 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++)
02017 {
02018 for (Int_t j0Sample = 0; j0Sample < i0Sample; j0Sample++)
02019 {
02020 half_cor_ss(i_count) = fT3d_cor_ss[i0StexEcha][i0Sample][j0Sample];
02021 i_count++;
02022 }
02023 }
02024
02025 fT1d_ev_cor_ss[i0StexEcha] = (Double_t)0;
02026 for(Int_t i_rcor = 0; i_rcor < ndim; i_rcor++)
02027 {
02028 fT1d_ev_cor_ss[i0StexEcha] += half_cor_ss(i_rcor);
02029 }
02030 fT1d_ev_cor_ss[i0StexEcha] /= (Double_t)ndim;
02031 }
02032 fTagMeanCorss[0] = 1; fFileHeader->fMeanCorssCalc++;
02033 }
02034
02035
02036
02037
02038
02039
02040
02041
02042
02043 void TEcnaRun::SigmaOfCorrelationsBetweenSamples()
02044 {
02045
02046
02047
02048
02049
02050 if ( fTagMeanCorss[0] != 1 ){MeanOfCorrelationsBetweenSamples(); fTagMeanCorss[0]=0;}
02051
02052
02053 if( fT1d_sig_cor_ss == 0 ){
02054 Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
02055 fT1d_sig_cor_ss = new Double_t[n_StexEcha]; fCnew++;
02056 }
02057 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
02058 {
02059 if( fT1d_sig_cor_ss[i0StexEcha] != (Double_t)0 )
02060 {fMiscDiag[16]++; fT1d_sig_cor_ss[i0StexEcha] = (Double_t)0;}
02061 }
02062
02063 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::SigmasOfCorrelationsBetweenSamples()" << endl;}
02064 if(fFlagPrint == fCodePrintAllComments){
02065 cout << " Calculation of the sigmas of the (sample,sample)" << endl
02066 << " correlations for all the channels." << endl;}
02067
02068
02069
02070 Int_t ndim = (Int_t)(fNbSampForCalc*(fNbSampForCalc - 1)/2);
02071
02072 TVectorD half_cor_ss(ndim); for(Int_t i=0; i<ndim; i++){half_cor_ss(i)=(Double_t)0.;}
02073
02074
02075 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
02076 {
02077
02078 Int_t i_count = 0;
02079 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++)
02080 {
02081 for (Int_t j0Sample = 0; j0Sample < i0Sample; j0Sample++)
02082 {
02083 half_cor_ss(i_count) = fT3d_cor_ss[i0StexEcha][i0Sample][j0Sample];
02084 i_count++;
02085 }
02086 }
02087
02088
02089 Double_t var = (Double_t)0;
02090 for(Int_t i_rcor = 0; i_rcor < ndim; i_rcor++)
02091 {
02092 Double_t ecart = half_cor_ss(i_rcor) - fT1d_ev_cor_ss[i0StexEcha];
02093 var += ecart*ecart;
02094 }
02095 var /= (Double_t)ndim;
02096 fT1d_sig_cor_ss[i0StexEcha] = sqrt(var);
02097 }
02098 fTagSigCorss[0] = 1; fFileHeader->fSigCorssCalc++;
02099 }
02100
02101
02102
02103
02104
02105
02106
02107
02108 void TEcnaRun::AveragedPedestals()
02109 {
02110
02111
02112
02113
02114 if ( fTagPed[0] != 1 ){Pedestals(); fTagPed[0]=0;}
02115
02116 if( fT1d_av_mped == 0 ){fT1d_av_mped = new Double_t[fEcal->MaxStinEcnaInStex()]; fCnew++;}
02117 for(Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02118 {if( fT1d_av_mped[i0StexStinEcna] != (Double_t)0 )
02119 {fMiscDiag[41]++; fT1d_av_mped[i0StexStinEcna] = (Double_t)0;}}
02120
02121 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::AveragedPedestals()" << endl;}
02122 if(fFlagPrint == fCodePrintAllComments){
02123 cout << " Calculation, for all the "
02124 << fStinName.Data() << "s, of the average of the Pedestals" << endl;}
02125
02126
02127 for(Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02128 {
02129 Int_t n1StexStinEcna = i0StexStinEcna+1;
02130 fT1d_av_mped[i0StexStinEcna] = (Double_t)0;
02131 for(Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++)
02132 {
02133 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
02134
02135 if( fStexName == "SM " )
02136 {fT1d_av_mped[i0StexStinEcna] += fT1d_ev_ev[i0StexEcha];}
02137
02138 if( fStexName == "Dee" )
02139 {
02140
02141
02142
02143 Int_t n1StinEcha = i0StinEcha+1;
02144 if( n1StexStinEcna == 10 && n1StinEcha == 11 )
02145 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);}
02146 if( n1StexStinEcna == 11 && n1StinEcha == 11 )
02147 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);}
02148 if( !( (n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11 ) )
02149 {fT1d_av_mped[i0StexStinEcna] += fT1d_ev_ev[i0StexEcha];}
02150 }
02151 }
02152 Double_t xdivis = (Double_t)0.;
02153 if( fStexName == "SM " )
02154 {xdivis = (Double_t)fEcal->MaxCrysInStin();}
02155 if( fStexName == "Dee" )
02156 {xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");}
02157
02158 fT1d_av_mped[i0StexStinEcna] = fT1d_av_mped[i0StexStinEcna]/xdivis;
02159 }
02160
02161 fTagAvPed[0] = 1; fFileHeader->fAvPedCalc++;
02162 }
02163
02164
02165
02166
02167
02168
02169 void TEcnaRun::AveragedTotalNoise()
02170 {
02171
02172
02173
02174
02175 if ( fTagTno[0] != 1 ){TotalNoise(); fTagTno[0]=0;}
02176
02177 if( fT1d_av_totn == 0 ){fT1d_av_totn = new Double_t[fEcal->MaxStinEcnaInStex()]; fCnew++;}
02178 for(Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02179 {if( fT1d_av_totn[i0StexStinEcna] != (Double_t)0 )
02180 {fMiscDiag[42]++; fT1d_av_totn[i0StexStinEcna] = (Double_t)0;}}
02181
02182 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::AveragedTotalNoise()" << endl;}
02183 if(fFlagPrint == fCodePrintAllComments){
02184 cout << " Calculation, for all the "
02185 << fStinName.Data() << "s, of the average of the Total Noise" << endl;}
02186
02187
02188 for(Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02189 {
02190 Int_t n1StexStinEcna = i0StexStinEcna+1;
02191 fT1d_av_totn[i0StexStinEcna] = (Double_t)0;
02192 for(Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++)
02193 {
02194 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
02195
02196 if( fStexName == "SM " )
02197 {fT1d_av_totn[i0StexStinEcna] += fT1d_evsamp_of_sigevt[i0StexEcha];}
02198
02199 if( fStexName == "Dee" )
02200 {
02201
02202
02203
02204 Int_t n1StinEcha = i0StinEcha+1;
02205 if( n1StexStinEcna == 10 && n1StinEcha == 11 )
02206 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);}
02207 if( n1StexStinEcna == 11 && n1StinEcha == 11 )
02208 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);}
02209 if( !( (n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11 ) )
02210 {fT1d_av_totn[i0StexStinEcna] += fT1d_evsamp_of_sigevt[i0StexEcha];}
02211 }
02212 }
02213 Double_t xdivis = (Double_t)0.;
02214 if( fStexName == "SM " )
02215 {xdivis = (Double_t)fEcal->MaxCrysInStin();}
02216 if( fStexName == "Dee" )
02217 {xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");}
02218
02219 fT1d_av_totn[i0StexStinEcna] = fT1d_av_totn[i0StexStinEcna]/xdivis;
02220 }
02221 fTagAvTno[0] = 1; fFileHeader->fAvTnoCalc++;
02222 }
02223
02224
02225
02226
02227
02228
02229 void TEcnaRun::AveragedLowFrequencyNoise()
02230 {
02231
02232
02233
02234
02235 if ( fTagLfn[0] != 1 ){LowFrequencyNoise(); fTagLfn[0]=0;}
02236
02237 if( fT1d_av_lofn == 0 ){fT1d_av_lofn = new Double_t[fEcal->MaxStinEcnaInStex()]; fCnew++;}
02238 for(Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02239 {if( fT1d_av_lofn[i0StexStinEcna] != (Double_t)0 )
02240 {fMiscDiag[43]++; fT1d_av_lofn[i0StexStinEcna] = (Double_t)0;}}
02241
02242 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::AveragedLowFrequencyNoise()" << endl;}
02243 if(fFlagPrint == fCodePrintAllComments){
02244 cout << " Calculation, for all the "
02245 << fStinName.Data() << "s, of the average of the Low Frequency Noise" << endl;}
02246
02247
02248 for(Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02249 {
02250 Int_t n1StexStinEcna = i0StexStinEcna+1;
02251 fT1d_av_lofn[i0StexStinEcna] = (Double_t)0;
02252 for(Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++)
02253 {
02254 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
02255
02256 if( fStexName == "SM " )
02257 {fT1d_av_lofn[i0StexStinEcna] += fT1d_sigevt_of_evsamp[i0StexEcha];}
02258
02259 if( fStexName == "Dee" )
02260 {
02261
02262
02263
02264 Int_t n1StinEcha = i0StinEcha+1;
02265 if( n1StexStinEcna == 10 && n1StinEcha == 11 )
02266 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);}
02267 if( n1StexStinEcna == 11 && n1StinEcha == 11 )
02268 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);}
02269 if( !( (n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11 ) )
02270 {fT1d_av_lofn[i0StexStinEcna] += fT1d_sigevt_of_evsamp[i0StexEcha];}
02271 }
02272 }
02273 Double_t xdivis = (Double_t)0.;
02274 if( fStexName == "SM " )
02275 {xdivis = (Double_t)fEcal->MaxCrysInStin();}
02276 if( fStexName == "Dee" )
02277 {xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");}
02278
02279 fT1d_av_lofn[i0StexStinEcna] = fT1d_av_lofn[i0StexStinEcna]/xdivis;
02280 }
02281 fTagAvLfn[0] = 1; fFileHeader->fAvLfnCalc++;
02282 }
02283
02284
02285
02286
02287
02288
02289 void TEcnaRun::AveragedHighFrequencyNoise()
02290 {
02291
02292
02293
02294
02295 if ( fTagHfn[0] != 1 ){HighFrequencyNoise(); fTagHfn[0]=0;}
02296
02297 if( fT1d_av_hifn == 0 ){fT1d_av_hifn = new Double_t[fEcal->MaxStinEcnaInStex()]; fCnew++;}
02298 for(Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02299 {if( fT1d_av_hifn[i0StexStinEcna] != (Double_t)0 )
02300 {fMiscDiag[44]++; fT1d_av_hifn[i0StexStinEcna] = (Double_t)0;}}
02301
02302 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::AveragedHighFrequencyNoise()" << endl;}
02303 if(fFlagPrint == fCodePrintAllComments){
02304 cout << " Calculation, for all the "
02305 << fStinName.Data() << "s, of the average of the High Frequency Noise" << endl;}
02306
02307
02308 for(Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02309 {
02310 Int_t n1StexStinEcna = i0StexStinEcna+1;
02311 fT1d_av_hifn[i0StexStinEcna] = (Double_t)0;
02312 for(Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++)
02313 {
02314 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
02315
02316 if( fStexName == "SM " )
02317 {fT1d_av_hifn[i0StexStinEcna] += fT1d_evevt_of_sigsamp[i0StexEcha];}
02318
02319 if( fStexName == "Dee" )
02320 {
02321
02322
02323
02324 Int_t n1StinEcha = i0StinEcha+1;
02325 if( n1StexStinEcna == 10 && n1StinEcha == 11 )
02326 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);}
02327 if( n1StexStinEcna == 11 && n1StinEcha == 11 )
02328 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);}
02329 if( !( (n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11 ) )
02330 {fT1d_av_hifn[i0StexStinEcna] += fT1d_evevt_of_sigsamp[i0StexEcha];}
02331 }
02332 }
02333 Double_t xdivis = (Double_t)0.;
02334 if( fStexName == "SM " )
02335 {xdivis = (Double_t)fEcal->MaxCrysInStin();}
02336 if( fStexName == "Dee" )
02337 {xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");}
02338
02339 fT1d_av_hifn[i0StexStinEcna] = fT1d_av_hifn[i0StexStinEcna]/xdivis;
02340 }
02341 fTagAvHfn[0] = 1; fFileHeader->fAvHfnCalc++;
02342 }
02343
02344
02345
02346
02347
02348
02349 void TEcnaRun::AveragedMeanOfCorrelationsBetweenSamples()
02350 {
02351
02352
02353
02354
02355 if ( fTagMeanCorss[0] != 1 ){MeanOfCorrelationsBetweenSamples(); fTagMeanCorss[0]=0;}
02356
02357 if( fT1d_av_ev_corss == 0 ){fT1d_av_ev_corss = new Double_t[fEcal->MaxStinEcnaInStex()]; fCnew++;}
02358 for(Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02359 {if( fT1d_av_ev_corss[i0StexStinEcna] != (Double_t)0 )
02360 {fMiscDiag[45]++; fT1d_av_ev_corss[i0StexStinEcna] = (Double_t)0;}}
02361
02362 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::AveragedMeanOfCorrelationsBetweenSamples()" << endl;}
02363 if(fFlagPrint == fCodePrintAllComments){
02364 cout << " Calculation, for all the "
02365 << fStinName.Data() << "s, of the average of the mean of cor(s,s)" << endl;}
02366
02367
02368 for(Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02369 {
02370 Int_t n1StexStinEcna = i0StexStinEcna+1;
02371 fT1d_av_ev_corss[i0StexStinEcna] = (Double_t)0;
02372 for(Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++)
02373 {
02374 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
02375
02376 if( fStexName == "SM " )
02377 {fT1d_av_ev_corss[i0StexStinEcna] += fT1d_ev_cor_ss[i0StexEcha];}
02378
02379 if( fStexName == "Dee" )
02380 {
02381
02382
02383
02384 Int_t n1StinEcha = i0StinEcha+1;
02385 if( n1StexStinEcna == 10 && n1StinEcha == 11 )
02386 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);}
02387 if( n1StexStinEcna == 11 && n1StinEcha == 11 )
02388 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);}
02389 if( !( (n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11 ) )
02390 {fT1d_av_ev_corss[i0StexStinEcna] += fT1d_ev_cor_ss[i0StexEcha];}
02391 }
02392 }
02393 Double_t xdivis = (Double_t)0.;
02394 if( fStexName == "SM " )
02395 {xdivis = (Double_t)fEcal->MaxCrysInStin();}
02396 if( fStexName == "Dee" )
02397 {xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");}
02398
02399 fT1d_av_ev_corss[i0StexStinEcna] = fT1d_av_ev_corss[i0StexStinEcna]/xdivis;
02400 }
02401 fTagAvMeanCorss[0] = 1; fFileHeader->fAvMeanCorssCalc++;
02402 }
02403
02404
02405
02406
02407
02408
02409 void TEcnaRun::AveragedSigmaOfCorrelationsBetweenSamples()
02410 {
02411
02412
02413
02414
02415 if ( fTagSigCorss[0] != 1 ){SigmaOfCorrelationsBetweenSamples(); fTagSigCorss[0]=0;}
02416
02417 if( fT1d_av_sig_corss == 0 ){fT1d_av_sig_corss = new Double_t[fEcal->MaxStinEcnaInStex()]; fCnew++;}
02418 for(Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02419 {if( fT1d_av_sig_corss[i0StexStinEcna] != (Double_t)0 )
02420 {fMiscDiag[46]++; fT1d_av_sig_corss[i0StexStinEcna] = (Double_t)0;}}
02421
02422 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::AveragedSigmaOfCorrelationsBetweenSamples()" << endl;}
02423 if(fFlagPrint == fCodePrintAllComments){
02424 cout << " Calculation, for all the "
02425 << fStinName.Data() << "s, of the average of the sigma of cor(s,s)" << endl;}
02426
02427
02428 for(Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02429 {
02430 Int_t n1StexStinEcna = i0StexStinEcna+1;
02431 fT1d_av_sig_corss[i0StexStinEcna] = (Double_t)0;
02432 for(Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++)
02433 {
02434 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
02435
02436 if( fStexName == "SM " )
02437 {fT1d_av_sig_corss[i0StexStinEcna] += fT1d_sig_cor_ss[i0StexEcha];}
02438
02439 if( fStexName == "Dee" )
02440 {
02441
02442
02443
02444 Int_t n1StinEcha = i0StinEcha+1;
02445 if( n1StexStinEcna == 10 && n1StinEcha == 11 )
02446 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);}
02447 if( n1StexStinEcna == 11 && n1StinEcha == 11 )
02448 {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);}
02449 if( !( (n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11 ) )
02450 {fT1d_av_sig_corss[i0StexStinEcna] += fT1d_sig_cor_ss[i0StexEcha];}
02451 }
02452 }
02453 Double_t xdivis = (Double_t)0.;
02454 if( fStexName == "SM " )
02455 {xdivis = (Double_t)fEcal->MaxCrysInStin();}
02456 if( fStexName == "Dee" )
02457 {xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");}
02458
02459 fT1d_av_sig_corss[i0StexStinEcna] = fT1d_av_sig_corss[i0StexStinEcna]/xdivis;
02460 }
02461 fTagAvSigCorss[0] = 1; fFileHeader->fAvSigCorssCalc++;
02462 }
02463
02464
02465
02466
02467
02468
02469
02470
02471
02472
02473
02474
02475
02476 void TEcnaRun::LowFrequencyCovariancesBetweenChannels()
02477 {
02478
02479
02480 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::LowFrequencyCovariancesBetweenChannels()" << endl;}
02481 if(fFlagPrint == fCodePrintAllComments){
02482 cout << " Calculation of the Low Frequency Covariances between channels" << endl;}
02483
02484
02485 if( fT2d_lf_cov == 0 ){
02486 const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
02487 fT2d_lf_cov = new Double_t*[n_StexEcha]; fCnew++;
02488 fT2d1_lf_cov = new Double_t[n_StexEcha*n_StexEcha]; fCnew++;
02489 for(Int_t i0StexEcha = 0 ; i0StexEcha < n_StexEcha ; i0StexEcha++){
02490 fT2d_lf_cov[i0StexEcha] = &fT2d1_lf_cov[0] + i0StexEcha*n_StexEcha;}}
02491
02492 for (Int_t i0StexEcha = 0 ; i0StexEcha < fEcal->MaxCrysEcnaInStex() ; i0StexEcha++)
02493 {
02494 for (Int_t j0StexEcha = 0 ; j0StexEcha < fEcal->MaxCrysEcnaInStex() ; j0StexEcha++)
02495 {
02496 if( fT2d_lf_cov[i0StexEcha][j0StexEcha] != (Double_t)0 )
02497 {fMiscDiag[21]++; fT2d_lf_cov[i0StexEcha][j0StexEcha] = (Double_t)0;}
02498 }
02499 }
02500
02501
02502 TMatrixD mean_over_samples(fEcal->MaxCrysEcnaInStex(), fNumberOfEvents);
02503 for(Int_t i0StexEcha=0; i0StexEcha<fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
02504 {for(Int_t n_event=0; n_event<fNumberOfEvents; n_event++)
02505 {mean_over_samples(i0StexEcha, n_event)=(Double_t)0.;}}
02506
02507 TVectorD MoeOfMos(fEcal->MaxCrysEcnaInStex());
02508 for(Int_t i0StexEcha=0; i0StexEcha<fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
02509 { MoeOfMos(i0StexEcha)=(Double_t)0.;}
02510
02511
02512 if(fFlagPrint != fCodePrintNoComment){
02513 cout << " Calculation, for each pair of channels, of the covariance (over the events)" << endl
02514 << " between the ADC expectation values (over the samples 1 to "
02515 << fNbSampForCalc << ")." << endl;}
02516
02517 cout << " Please, wait (end at i= " << fEcal->MaxCrysEcnaInStex() << "): " << endl;
02518
02519 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
02520 {
02521 MoeOfMos(i0StexEcha) = (Double_t)0;
02522
02523 if( (fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0)
02524 || ( fFlagSubDet == "EB") )
02525 {
02526 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++)
02527 {
02528
02529 mean_over_samples(i0StexEcha, n_event) = (Double_t)0.;
02530 for(Int_t i0Sample=0; i0Sample<fNbSampForCalc; i0Sample++)
02531 {
02532 mean_over_samples(i0StexEcha, n_event) += fT3d_distribs[i0StexEcha][i0Sample][n_event];
02533 }
02534 mean_over_samples(i0StexEcha, n_event) /= (Double_t)fNbSampForCalc;
02535 }
02536
02537 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++)
02538 {MoeOfMos(i0StexEcha) += mean_over_samples(i0StexEcha, n_event);}
02539 MoeOfMos(i0StexEcha) /= (Double_t)fNumberOfEvents;
02540 }
02541 }
02542
02543
02544 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
02545 {
02546 if( (fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0)
02547 || ( fFlagSubDet == "EB") )
02548 {
02549 for(Int_t j0StexEcha = 0; j0StexEcha <= i0StexEcha; j0StexEcha++)
02550 {
02551 if( (fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, j0StexEcha) > 0)
02552 || ( fFlagSubDet == "EB") )
02553 {
02554 fT2d_lf_cov[i0StexEcha][j0StexEcha] = (Double_t)0;
02555 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++)
02556 {
02557 fT2d_lf_cov[i0StexEcha][j0StexEcha] +=
02558 ( mean_over_samples(i0StexEcha, n_event) - MoeOfMos(i0StexEcha) )
02559 *( mean_over_samples(j0StexEcha, n_event) - MoeOfMos(j0StexEcha) );
02560 }
02561 fT2d_lf_cov[i0StexEcha][j0StexEcha] /= (Double_t)fNumberOfEvents;
02562
02563 fT2d_lf_cov[j0StexEcha][i0StexEcha] = fT2d_lf_cov[i0StexEcha][j0StexEcha];
02564 }
02565 }
02566 if( i0StexEcha%100 == 0 ){cout << i0StexEcha << "[LFN Cov], ";}
02567 }
02568 }
02569 cout << endl;
02570 fTagLfCov[0] = 1; fFileHeader->fLfCovCalc++;
02571 }
02572
02573
02574
02575
02576
02577
02578
02579 void TEcnaRun::LowFrequencyCorrelationsBetweenChannels()
02580 {
02581
02582
02583
02584 if ( fTagLfCov[0] != 1 )
02585 {LowFrequencyCovariancesBetweenChannels(); fTagLfCov[0] = 0;}
02586
02587 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::LowFrequencyCorrelationsBetweenChannels()" << endl;}
02588 if(fFlagPrint == fCodePrintAllComments){
02589 cout << " Calculation of the Low Frequency Correlations between channels" << endl
02590 << " Starting allocation. "
02591 << endl;}
02592
02593
02594 if( fT2d_lf_cor == 0 ){
02595 const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
02596 fT2d_lf_cor = new Double_t*[n_StexEcha]; fCnew++;
02597 fT2d1_lf_cor = new Double_t[n_StexEcha*n_StexEcha]; fCnew++;
02598 for(Int_t i0StexEcha = 0 ; i0StexEcha < n_StexEcha ; i0StexEcha++){
02599 fT2d_lf_cor[i0StexEcha] = &fT2d1_lf_cor[0] + i0StexEcha*n_StexEcha;}
02600 }
02601
02602 for (Int_t i0StexEcha = 0 ; i0StexEcha < fEcal->MaxCrysEcnaInStex() ; i0StexEcha++)
02603 {
02604 for (Int_t j0StexEcha = 0 ; j0StexEcha < fEcal->MaxCrysEcnaInStex() ; j0StexEcha++)
02605 {
02606 if( fT2d_lf_cor[i0StexEcha][j0StexEcha] != (Double_t)0 )
02607 {fMiscDiag[22]++; fT2d_lf_cor[i0StexEcha][j0StexEcha] = (Double_t)0;}
02608 }
02609 }
02610
02611
02612
02613 for (Int_t i0StexEcha = 0 ; i0StexEcha < fEcal->MaxCrysEcnaInStex() ; i0StexEcha++)
02614 {
02615 if( (fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0)
02616 || ( fFlagSubDet == "EB") )
02617 {
02618 for (Int_t j0StexEcha = 0 ; j0StexEcha <= i0StexEcha ; j0StexEcha++)
02619 {
02620 if( (fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, j0StexEcha) > 0)
02621 || ( fFlagSubDet == "EB") )
02622 {
02623 if( fT2d_lf_cov[i0StexEcha][i0StexEcha] > 0
02624 && fT2d_lf_cov[j0StexEcha][j0StexEcha] > 0 )
02625 {
02626 fT2d_lf_cor[i0StexEcha][j0StexEcha] =
02627 fT2d_lf_cov[i0StexEcha][j0StexEcha]/
02628 ( (Double_t)sqrt( fT2d_lf_cov[i0StexEcha][i0StexEcha]*
02629 fT2d_lf_cov[j0StexEcha][j0StexEcha] ) );
02630 }
02631 else
02632 {
02633 fT2d_lf_cor[i0StexEcha][j0StexEcha] = (Double_t)0.;
02634 }
02635 fT2d_lf_cor[j0StexEcha][i0StexEcha] = fT2d_lf_cor[i0StexEcha][j0StexEcha];
02636 }
02637 }
02638 }
02639 if( i0StexEcha%100 == 0 ){cout << i0StexEcha << "[LFN Cor], ";}
02640 }
02641 cout << endl;
02642
02643 fTagLfCor[0] = 1; fFileHeader->fLfCorCalc++;
02644 }
02645
02646
02647
02648
02649
02650
02651
02652 void TEcnaRun::HighFrequencyCovariancesBetweenChannels()
02653 {
02654
02655
02656 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::HighFrequencyCovariancesBetweenChannels()" << endl;}
02657 if(fFlagPrint == fCodePrintAllComments){
02658 cout << " Calculation of the High Frequency Covariances between channels" << endl;}
02659
02660
02661 if( fT2d_hf_cov == 0 ){
02662 const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
02663 fT2d_hf_cov = new Double_t*[n_StexEcha]; fCnew++;
02664 fT2d1_hf_cov = new Double_t[n_StexEcha*n_StexEcha]; fCnew++;
02665 for(Int_t i0StexEcha = 0 ; i0StexEcha < n_StexEcha ; i0StexEcha++){
02666 fT2d_hf_cov[i0StexEcha] = &fT2d1_hf_cov[0] + i0StexEcha*n_StexEcha;}
02667 }
02668
02669 for (Int_t i0StexEcha = 0 ; i0StexEcha < fEcal->MaxCrysEcnaInStex() ; i0StexEcha++)
02670 {
02671 for (Int_t j0StexEcha = 0 ; j0StexEcha < fEcal->MaxCrysEcnaInStex() ; j0StexEcha++)
02672 {
02673 if( fT2d_hf_cov[i0StexEcha][j0StexEcha] != (Double_t)0 )
02674 {fMiscDiag[23]++; fT2d_hf_cov[i0StexEcha][j0StexEcha] = (Double_t)0;}
02675 }
02676 }
02677
02678
02679 TMatrixD mean_over_samples(fEcal->MaxCrysEcnaInStex(), fNumberOfEvents);
02680 for(Int_t i0StexEcha=0; i0StexEcha<fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
02681 {for(Int_t n_event=0; n_event<fNumberOfEvents; n_event++)
02682 {mean_over_samples(i0StexEcha, n_event)=(Double_t)0.;}}
02683
02684 TMatrixD cov_over_samp(fEcal->MaxCrysEcnaInStex(), fEcal->MaxCrysEcnaInStex());
02685 for(Int_t i0StexEcha=0; i0StexEcha<fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
02686 {for(Int_t j0StexEcha=0; j0StexEcha<fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
02687 {cov_over_samp(i0StexEcha, j0StexEcha)=(Double_t)0.;}}
02688
02689
02690 if(fFlagPrint != fCodePrintNoComment){
02691 cout << " Calculation of the mean (over the events)" << endl
02692 << " of the covariances between the channels (over the samples 1 to "
02693 << fNbSampForCalc << ")." << endl;}
02694
02695 cout << " Please, wait (end at i= " << fEcal->MaxCrysEcnaInStex() << "): " << endl;
02696
02697 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
02698 {
02699 if( (fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0)
02700 || ( fFlagSubDet == "EB") )
02701 {
02702 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++)
02703 {
02704
02705 mean_over_samples(i0StexEcha, n_event) = (Double_t)0.;
02706 for(Int_t i0Sample=0; i0Sample<fNbSampForCalc; i0Sample++)
02707 {mean_over_samples(i0StexEcha, n_event) += fT3d_distribs[i0StexEcha][i0Sample][n_event];}
02708 mean_over_samples(i0StexEcha, n_event) /= (Double_t)fNbSampForCalc;
02709 }
02710 }
02711 if( i0StexEcha%100 == 0 ){cout << i0StexEcha << "[HFNa Cov], ";}
02712 }
02713 cout << endl;
02714
02715 cout << " Please, wait (end at i= " << fEcal->MaxCrysEcnaInStex() << "): " << endl;
02716
02717
02718 for(Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
02719 {
02720 if( (fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0)
02721 || ( fFlagSubDet == "EB") )
02722 {
02723 for(Int_t j0StexEcha = 0; j0StexEcha <= i0StexEcha; j0StexEcha++)
02724 {
02725 if( (fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, j0StexEcha) > 0)
02726 || ( fFlagSubDet == "EB") )
02727 {
02728 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++)
02729 {
02730
02731 cov_over_samp(i0StexEcha,j0StexEcha) = (Double_t)0;
02732 for(Int_t i0Sample=0; i0Sample<fNbSampForCalc; i0Sample++)
02733 {
02734 cov_over_samp(i0StexEcha,j0StexEcha) +=
02735 ( fT3d_distribs[i0StexEcha][i0Sample][n_event] - mean_over_samples(i0StexEcha, n_event) )*
02736 ( fT3d_distribs[j0StexEcha][i0Sample][n_event] - mean_over_samples(j0StexEcha, n_event) );
02737 }
02738 cov_over_samp(i0StexEcha,j0StexEcha) /= (Double_t)fNbSampForCalc;
02739
02740 }
02741
02742
02743 fT2d_hf_cov[i0StexEcha][j0StexEcha] = (Double_t)0;
02744 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++)
02745 {
02746 fT2d_hf_cov[i0StexEcha][j0StexEcha] += cov_over_samp(i0StexEcha,j0StexEcha);
02747 }
02748 fT2d_hf_cov[i0StexEcha][j0StexEcha] /= (Double_t)fNumberOfEvents;
02749
02750 fT2d_hf_cov[j0StexEcha][i0StexEcha] = fT2d_hf_cov[i0StexEcha][j0StexEcha];
02751 }
02752 }
02753 }
02754 if( i0StexEcha%100 == 0 ){cout << i0StexEcha << "[HFNb Cov], ";}
02755 }
02756 cout << endl;
02757
02758 fTagHfCov[0] = 1; fFileHeader->fHfCovCalc++;
02759 }
02760
02761
02762
02763
02764
02765
02766
02767 void TEcnaRun::HighFrequencyCorrelationsBetweenChannels()
02768 {
02769
02770
02771
02772 if ( fTagHfCov[0] != 1 )
02773 {HighFrequencyCovariancesBetweenChannels(); fTagHfCov[0] = 0;}
02774
02775 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::HighFrequencyCorrelationsBetweenChannels()" << endl;}
02776 if(fFlagPrint == fCodePrintAllComments){
02777 cout << " Calculation of the High Frequency Correlations between channels" << endl
02778 << " Starting allocation. "
02779 << endl;}
02780
02781
02782 if( fT2d_hf_cor == 0 ){
02783 const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
02784 fT2d_hf_cor = new Double_t*[n_StexEcha]; fCnew++;
02785 fT2d1_hf_cor = new Double_t[n_StexEcha*n_StexEcha]; fCnew++;
02786 for(Int_t i0StexEcha = 0 ; i0StexEcha < n_StexEcha ; i0StexEcha++){
02787 fT2d_hf_cor[i0StexEcha] = &fT2d1_hf_cor[0] + i0StexEcha*n_StexEcha;}
02788 }
02789
02790 for (Int_t i0StexEcha = 0 ; i0StexEcha < fEcal->MaxCrysEcnaInStex() ; i0StexEcha++)
02791 {
02792 for (Int_t j0StexEcha = 0 ; j0StexEcha < fEcal->MaxCrysEcnaInStex() ; j0StexEcha++)
02793 {
02794 if( fT2d_hf_cor[i0StexEcha][j0StexEcha] != (Double_t)0 )
02795 {fMiscDiag[24]++; fT2d_hf_cor[i0StexEcha][j0StexEcha] = (Double_t)0;}
02796 }
02797 }
02798
02799
02800
02801
02802 for (Int_t i0StexEcha = 0 ; i0StexEcha < fEcal->MaxCrysEcnaInStex() ; i0StexEcha++)
02803 {
02804 if( (fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0)
02805 || ( fFlagSubDet == "EB") )
02806 {
02807 for (Int_t j0StexEcha = 0 ; j0StexEcha <= i0StexEcha ; j0StexEcha++)
02808 {
02809 if( (fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, j0StexEcha) > 0)
02810 || ( fFlagSubDet == "EB") )
02811 {
02812 if( fT2d_hf_cov[i0StexEcha][i0StexEcha] > 0
02813 && fT2d_hf_cov[j0StexEcha][j0StexEcha] > 0 )
02814 {
02815 fT2d_hf_cor[i0StexEcha][j0StexEcha] =
02816 fT2d_hf_cov[i0StexEcha][j0StexEcha]/
02817 ( (Double_t)sqrt(fT2d_hf_cov[i0StexEcha][i0StexEcha]) *
02818 (Double_t)sqrt(fT2d_hf_cov[j0StexEcha][j0StexEcha]) );
02819 }
02820 else
02821 {
02822 fT2d_hf_cor[i0StexEcha][j0StexEcha] = (Double_t)0.;
02823 }
02824
02825 fT2d_hf_cor[j0StexEcha][i0StexEcha] = fT2d_hf_cor[i0StexEcha][j0StexEcha];
02826 }
02827 }
02828 }
02829 if( i0StexEcha%100 == 0 ){cout << i0StexEcha << "[HFN Cor], ";}
02830 }
02831 cout << endl;
02832
02833 fTagHfCor[0] = 1; fFileHeader->fHfCorCalc++;
02834 }
02835
02836
02837
02838
02839
02840
02841
02842
02843
02844
02845
02846
02847
02848 void TEcnaRun::LowFrequencyMeanCorrelationsBetweenTowers()
02849 {LowFrequencyMeanCorrelationsBetweenStins();}
02850 void TEcnaRun::LowFrequencyMeanCorrelationsBetweenSCs()
02851 {LowFrequencyMeanCorrelationsBetweenStins();}
02852
02853 void TEcnaRun::LowFrequencyMeanCorrelationsBetweenStins()
02854 {
02855
02856
02857
02858
02859
02860 if(fTagLfCor[0] != 1){LowFrequencyCorrelationsBetweenChannels(); fTagLfCor[0]=0;}
02861
02862
02863 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::LowFrequencyMeanCorrelationsBetweenStins()" << endl;}
02864 if(fFlagPrint == fCodePrintAllComments){
02865 cout << " Calculation of the mean, for each "
02866 << fStinName.Data() << ", of the" << endl
02867 << " Low Frequency Correlations between channels." << endl;}
02868
02869
02870 if( fT2d_lfcc_mostins == 0 ){
02871 const Int_t n_Stin = fEcal->MaxStinEcnaInStex();
02872 fT2d_lfcc_mostins = new Double_t*[n_Stin]; fCnew++;
02873 fT2d1_lfcc_mostins = new Double_t[n_Stin*n_Stin]; fCnew++;
02874 for(Int_t i0StexStinEcna = 0 ; i0StexStinEcna < n_Stin ; i0StexStinEcna++){
02875 fT2d_lfcc_mostins[i0StexStinEcna] = &fT2d1_lfcc_mostins[0] + i0StexStinEcna*n_Stin;}
02876 }
02877
02878 for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02879 {
02880 for(Int_t j0StexStinEcna=0; j0StexStinEcna<fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
02881 {
02882 if( fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] != (Double_t)0 )
02883 {fMiscDiag[31]++; fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] = (Double_t)0;}
02884 }
02885 }
02886
02887
02888
02889
02890
02891
02892
02893
02894
02895
02896 Int_t ndim = (Int_t)(fEcal->MaxCrysInStin()*fEcal->MaxCrysInStin());
02897
02898 TVectorD half_LFccMos(ndim); for(Int_t i=0; i<ndim; i++){half_LFccMos(i)=(Double_t)0.;}
02899
02900
02901 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::LowFrequencyMeanCorrelationsBetweenStins()" << endl;}
02902 if(fFlagPrint == fCodePrintAllComments){
02903 cout << " Calculation, for each "
02904 << fStinName.Data() << ", of the mean of the" << endl
02905 << " Low Frequency cor(c,c)." << endl;}
02906
02907 for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02908 {
02909 for(Int_t j0StexStinEcna=0; j0StexStinEcna<fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
02910 {
02911
02912 Int_t i_count = 0;
02913 for(Int_t i0StinCrys=0; i0StinCrys<fEcal->MaxCrysInStin(); i0StinCrys++)
02914 {
02915 Int_t i0StexEcha = i0StexStinEcna*fEcal->MaxCrysInStin() + i0StinCrys;
02916 for(Int_t j0StinCrys=0; j0StinCrys<fEcal->MaxCrysInStin(); j0StinCrys++)
02917 {
02918 Int_t j0StexEcha = j0StexStinEcna*fEcal->MaxCrysInStin() + j0StinCrys;
02919 if( (i0StexEcha>= 0 && i0StexEcha < fEcal->MaxCrysEcnaInStex()) &&
02920 (j0StexEcha>= 0 && j0StexEcha < fEcal->MaxCrysEcnaInStex()) )
02921 {half_LFccMos(i_count) = fT2d_lf_cor[i0StexEcha][j0StexEcha]; i_count++;}
02922 else
02923 {cout << "!TEcnaRun::LowFrequencyMeanCorrelationsBetweenStins()> Channel number out of range."
02924 << "i0StexEcha = " << i0StexEcha <<", j0StexEcha = " << j0StexEcha << fTTBELL << endl; }
02925 }
02926 }
02927
02928 fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] = (Double_t)0;
02929 for(Int_t i_rcor = 0; i_rcor < ndim; i_rcor++)
02930 {
02931 fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] += fabs(half_LFccMos(i_rcor));
02932 }
02933 fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] /= (Double_t)ndim;
02934 }
02935 if( i0StexStinEcna%10 == 0 ){cout << i0StexStinEcna << "[LFN MCtt], ";}
02936 }
02937 cout << endl;
02938
02939 fTagLFccMoStins[0] = 1; fFileHeader->fLFccMoStinsCalc++;
02940 }
02941
02942
02943
02944
02945
02946 void TEcnaRun::HighFrequencyMeanCorrelationsBetweenTowers()
02947 {HighFrequencyMeanCorrelationsBetweenStins();}
02948 void TEcnaRun::HighFrequencyMeanCorrelationsBetweenSCs()
02949 {HighFrequencyMeanCorrelationsBetweenStins();}
02950
02951 void TEcnaRun::HighFrequencyMeanCorrelationsBetweenStins()
02952 {
02953
02954
02955
02956
02957
02958 if(fTagHfCor[0] != 1){HighFrequencyCorrelationsBetweenChannels();fTagHfCor[0]=0;}
02959
02960
02961 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::HighFrequencyMeanCorrelationsBetweenStins()" << endl;}
02962 if(fFlagPrint == fCodePrintAllComments){
02963 cout << " Calculation of the mean, for each "
02964 << fFlagSubDet.Data() << ", of the" << endl
02965 << " High Frequency Correlations between channels." << endl;}
02966
02967
02968 if( fT2d_hfcc_mostins == 0 ){
02969 const Int_t n_Stin = fEcal->MaxStinEcnaInStex();
02970 fT2d_hfcc_mostins = new Double_t*[n_Stin]; fCnew++;
02971 fT2d1_hfcc_mostins = new Double_t[n_Stin*n_Stin]; fCnew++;
02972 for(Int_t i0StexStinEcna = 0 ; i0StexStinEcna < n_Stin ; i0StexStinEcna++){
02973 fT2d_hfcc_mostins[i0StexStinEcna] = &fT2d1_hfcc_mostins[0] + i0StexStinEcna*n_Stin;}
02974 }
02975
02976 for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02977 {
02978 for(Int_t j0StexStinEcna=0; j0StexStinEcna<fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
02979 {
02980 if( fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] != (Double_t)0 )
02981 {fMiscDiag[32]++; fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] = (Double_t)0;}
02982 }
02983 }
02984
02985
02986
02987
02988
02989
02990
02991
02992
02993
02994 Int_t ndim = (Int_t)(fEcal->MaxCrysInStin()*fEcal->MaxCrysInStin());
02995
02996 TVectorD half_HFccMos(ndim); for(Int_t i=0; i<ndim; i++){half_HFccMos(i)=(Double_t)0.;}
02997
02998 if(fFlagPrint != fCodePrintNoComment){cout << "*TEcnaRun::HighFrequencyMeanCorrelationsBetweenStins()" << endl;}
02999 if(fFlagPrint == fCodePrintAllComments){
03000 cout << " Calculation, for each "
03001 << fFlagSubDet.Data() << ", of the mean of the" << endl
03002 << " High Frequency cor(c,c)." << endl;}
03003
03004
03005 for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
03006 {
03007 for(Int_t j0StexStinEcna=0; j0StexStinEcna<fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
03008 {
03009
03010 Int_t i_count = 0;
03011 for(Int_t i0StinCrys=0; i0StinCrys<fEcal->MaxCrysInStin(); i0StinCrys++)
03012 {
03013 Int_t i0StexEcha = i0StexStinEcna*fEcal->MaxCrysInStin() + i0StinCrys;
03014 for(Int_t j0StinCrys=0; j0StinCrys<fEcal->MaxCrysInStin(); j0StinCrys++)
03015 {
03016 Int_t j0StexEcha = j0StexStinEcna*fEcal->MaxCrysInStin() + j0StinCrys;
03017 if( (i0StexEcha>= 0 && i0StexEcha < fEcal->MaxCrysEcnaInStex()) &&
03018 (j0StexEcha>= 0 && j0StexEcha < fEcal->MaxCrysEcnaInStex()) )
03019 {half_HFccMos(i_count) = fT2d_hf_cor[i0StexEcha][j0StexEcha]; i_count++;}
03020 else
03021 {cout << "!TEcnaRun::HighFrequencyMeanCorrelationsBetweenStins()> Channel number out of range."
03022 << "i0StexEcha = " << i0StexEcha <<", j0StexEcha = " << j0StexEcha << fTTBELL << endl; }
03023 }
03024 }
03025
03026 fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] = (Double_t)0;
03027 for(Int_t i_rcor = 0; i_rcor < ndim; i_rcor++)
03028 {
03029 fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] += fabs(half_HFccMos(i_rcor));
03030 }
03031 fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] /= (Double_t)ndim;
03032 }
03033 if( i0StexStinEcna%10 == 0 ){cout << i0StexStinEcna << "[HFN MCtt], ";}
03034 }
03035 cout << endl;
03036
03037 fTagHFccMoStins[0] = 1; fFileHeader->fHFccMoStinsCalc++;
03038 }
03039
03040
03041
03042
03043
03044
03045
03046
03047
03048
03049
03050
03051
03052
03053
03054
03055
03056 Bool_t TEcnaRun::OpenRootFile(const Text_t *name, TString status) {
03057
03058
03059 TString s_path;
03060 s_path = fCnaParPaths->ResultsRootFilePath();
03061 s_path.Append('/');
03062 s_path.Append(name);
03063
03064 gCnaRootFile = new TEcnaRootFile(s_path.Data(), status); fCnew++;
03065 Bool_t ok_open = kFALSE;
03066
03067 if ( gCnaRootFile->fRootFileStatus == "RECREATE" ){ok_open = gCnaRootFile->OpenW();}
03068 if ( gCnaRootFile->fRootFileStatus == "READ" ){ok_open = gCnaRootFile->OpenR();}
03069
03070 if (!ok_open)
03071 {
03072 cout << "TEcnaRun::OpenRootFile> Cannot open file " << s_path.Data() << endl;
03073 }
03074 else
03075 {
03076 if(fFlagPrint == fCodePrintAllComments)
03077 {cout << "*TEcnaRun::OpenRootFile> Open ROOT file OK for file " << s_path.Data() << endl;}
03078 fOpenRootFile = kTRUE;
03079 }
03080 return ok_open;
03081 }
03082
03083
03084
03085
03086
03087 Bool_t TEcnaRun::CloseRootFile(const Text_t *name) {
03088
03089
03090 Bool_t ok_close = kFALSE;
03091
03092 if (fOpenRootFile == kTRUE )
03093 {
03094 gCnaRootFile->CloseFile();
03095
03096 if(fFlagPrint == fCodePrintAllComments){
03097 cout << "*TEcnaRun::CloseRootFile> Close ROOT file." << endl;}
03098
03099 delete gCnaRootFile; fCdelete++;
03100 fOpenRootFile = kFALSE;
03101 ok_close = kTRUE;
03102 }
03103 else
03104 {
03105 cout << "*TEcnaRun::CloseRootFile(...)> No close since no file is open."
03106 << fTTBELL << endl;
03107 }
03108 return ok_close;
03109 }
03110
03111
03112
03113
03114
03115
03116
03117
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127 Bool_t TEcnaRun::WriteRootFile(){
03128
03129 Bool_t ok_write = kFALSE;
03130
03131 fCnaWrite->RegisterFileParameters(fFileHeader->fTypAna.Data(), fFileHeader->fNbOfSamples,
03132 fFileHeader->fRunNumber,
03133 fFileHeader->fFirstReqEvtNumber, fFileHeader->fLastReqEvtNumber,
03134 fFileHeader->fReqNbOfEvts, fFileHeader->fStex);
03135
03136 fCnaWrite->fMakeResultsFileName();
03137
03138 const Text_t *FileShortName = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
03139
03140
03141 Int_t nCountEvts = 0;
03142
03143 for(Int_t i0StexEcha=0; i0StexEcha<fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
03144 {for(Int_t i0Sample=0; i0Sample<fFileHeader->fNbOfSamples; i0Sample++)
03145 {nCountEvts += fT2d_NbOfEvts[i0StexEcha][i0Sample];}}
03146
03147 if ( nCountEvts <= 0 )
03148 {
03149
03150 cout << "!TEcnaRun::WriteRootFile()> No event found for file " << fCnaWrite->fRootFileNameShort.Data()
03151 << ". File will not be written." << endl;
03152 ok_write = kTRUE;
03153 }
03154 else
03155 {
03156 if(fFlagPrint == fCodePrintAllComments){
03157 cout << "*TEcnaRun::WriteRootFile()> Results are going to be written in the ROOT file: " << endl
03158 << " " << fCnaWrite->fRootFileName.Data() << endl;}
03159
03160 ok_write = WriteRootFile(FileShortName, fFileHeader->fNbOfSamples);
03161
03162 if( ok_write == kTRUE )
03163 {
03164 if(fFlagPrint != fCodePrintNoComment)
03165 {cout << "*TEcnaRun::WriteRootFile()> Writing OK for file " << fCnaWrite->fRootFileNameShort.Data()
03166 << endl;}
03167 }
03168 else
03169 {
03170 cout << "!TEcnaRun::WriteRootFile()> Writing FAILLED for file " << fCnaWrite->fRootFileNameShort.Data()
03171 << fTTBELL << endl;
03172 }
03173 }
03174 return ok_write;
03175 }
03176
03177
03178
03179
03180
03181
03182
03183
03184 Bool_t TEcnaRun::WriteNewRootFile(const TString TypAna){
03185
03186 Bool_t ok_write = kFALSE;
03187
03188 fCnaWrite->RegisterFileParameters(TypAna.Data(), fNbSampForCalc, fFileHeader->fRunNumber,
03189 fFileHeader->fFirstReqEvtNumber, fFileHeader->fLastReqEvtNumber,
03190 fFileHeader->fReqNbOfEvts, fFileHeader->fStex,
03191 fFileHeader->fStartDate, fFileHeader->fStopDate,
03192 fFileHeader->fStartTime, fFileHeader->fStopTime);
03193
03194 fCnaWrite->fMakeResultsFileName();
03195 fNewRootFileName = fCnaWrite->GetRootFileName();
03196 fNewRootFileNameShort = fCnaWrite->GetRootFileNameShort();
03197
03198
03199 const Text_t *FileShortName = (const Text_t *)fNewRootFileNameShort.Data();
03200
03201 if(fFlagPrint == fCodePrintAllComments){
03202 cout << "*TEcnaRun::WriteNewRootFile()> Results are going to be written in the ROOT file: " << endl
03203 << " " << fNewRootFileNameShort.Data() << endl;}
03204
03205 ok_write = WriteRootFile(FileShortName, fNbSampForCalc);
03206
03207 return ok_write;
03208 }
03209
03210
03211
03212
03213
03214
03215
03216 TString TEcnaRun::GetNewRootFileName(){return fNewRootFileName;}
03217 TString TEcnaRun::GetNewRootFileNameShort(){return fNewRootFileNameShort;}
03218
03219
03220
03221
03222
03223
03224 Bool_t TEcnaRun::WriteRootFile(const Text_t* name, Int_t& argNbSampWrite)
03225 {
03226
03227
03228 const Text_t* file_name = name;
03229
03230 Bool_t ok_open = kFALSE;
03231 Bool_t ok_write = kFALSE;
03232
03233 if ( fOpenRootFile )
03234 {
03235 cout << "!TEcnaRun::WriteRootFile(...) *** ERROR ***> Writing on file already open."
03236 << fTTBELL << endl;
03237 }
03238 else
03239 {
03240
03241
03242
03243
03244
03245
03246
03247
03248
03249
03250
03251
03252
03253
03254
03255
03256
03257
03258
03259
03260
03261
03262
03263
03264
03265
03266
03267
03268
03269
03270
03271
03272
03273
03274
03275
03276
03277
03278
03279
03280
03281
03282
03283
03284
03285 ok_open = OpenRootFile(file_name, "RECREATE");
03286
03287 TString typ_name = "?";
03288 Int_t v_nb_times = 0;
03289 Int_t v_dim_one = 0;
03290 Int_t v_dim_two = 0;
03291 Int_t v_size = 0;
03292 Int_t v_tot = 0;
03293 Int_t v_tot_writ = 0;
03294
03295
03296
03297
03298
03299
03300
03301
03302
03303
03304
03305
03306 Int_t MaxCar = fgMaxCar;
03307 typ_name.Resize(MaxCar);
03308 typ_name = "StinNumbers";
03309 v_nb_times = fFileHeader->fStinNumbersCalc;
03310 v_dim_one = 1;
03311 v_dim_two = fEcal->MaxStinEcnaInStex();
03312 v_size = v_nb_times*v_dim_one*v_dim_two;
03313 v_tot += v_size;
03314
03315 if(fFlagPrint == fCodePrintAllComments){
03316 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03317 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03318 << setw(9) << v_size;}
03319
03320 for (Int_t i = 0; i < v_nb_times; i++)
03321 {
03322 if ( fTagStinNumbers[0] == 1 )
03323 {
03324 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypNumbers;
03325 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03326 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03327 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03328 TRootStinNumbers();
03329 gCnaRootFile->fCnaResultsTree->Fill();
03330 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03331 }
03332 }
03333 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03334
03335
03336
03337
03338 MaxCar = fgMaxCar;
03339 typ_name.Resize(MaxCar);
03340 typ_name = "AvPed";
03341 v_nb_times = fFileHeader->fAvPedCalc;
03342 v_dim_one = 1;
03343 v_dim_two = fEcal->MaxStinEcnaInStex();
03344 v_size = v_nb_times*v_dim_one*v_dim_two;
03345 v_tot += v_size;
03346
03347 if(fFlagPrint == fCodePrintAllComments){
03348 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03349 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03350 << setw(9) << v_size;}
03351
03352 for (Int_t i = 0; i < v_nb_times; i++)
03353 {
03354 if ( fTagAvPed[0] == 1 )
03355 {
03356 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAvPed;
03357 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03358 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03359 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03360 TRootAvPed();
03361 gCnaRootFile->fCnaResultsTree->Fill();
03362 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03363 }
03364 }
03365 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03366
03367
03368
03369
03370 MaxCar = fgMaxCar;
03371 typ_name.Resize(MaxCar);
03372 typ_name = "AvTno";
03373 v_nb_times = fFileHeader->fAvTnoCalc;
03374 v_dim_one = 1;
03375 v_dim_two = fEcal->MaxStinEcnaInStex();
03376 v_size = v_nb_times*v_dim_one*v_dim_two;
03377 v_tot += v_size;
03378
03379 if(fFlagPrint == fCodePrintAllComments){
03380 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03381 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03382 << setw(9) << v_size;}
03383
03384 for (Int_t i = 0; i < v_nb_times; i++)
03385 {
03386 if ( fTagAvTno[0] == 1 )
03387 {
03388 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAvTno;
03389 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03390 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03391 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03392 TRootAvTno();
03393 gCnaRootFile->fCnaResultsTree->Fill();
03394 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03395 }
03396 }
03397 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03398
03399
03400
03401
03402 MaxCar = fgMaxCar;
03403 typ_name.Resize(MaxCar);
03404 typ_name = "AvLfn";
03405 v_nb_times = fFileHeader->fAvLfnCalc;
03406 v_dim_one = 1;
03407 v_dim_two = fEcal->MaxStinEcnaInStex();
03408 v_size = v_nb_times*v_dim_one*v_dim_two;
03409 v_tot += v_size;
03410
03411 if(fFlagPrint == fCodePrintAllComments){
03412 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03413 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03414 << setw(9) << v_size;}
03415
03416 for (Int_t i = 0; i < v_nb_times; i++)
03417 {
03418 if ( fTagAvLfn[0] == 1 )
03419 {
03420 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAvLfn;
03421 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03422 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03423 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03424 TRootAvLfn();
03425 gCnaRootFile->fCnaResultsTree->Fill();
03426 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03427 }
03428 }
03429 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03430
03431
03432
03433
03434 MaxCar = fgMaxCar;
03435 typ_name.Resize(MaxCar);
03436 typ_name = "AvHfn";
03437 v_nb_times = fFileHeader->fAvHfnCalc;
03438 v_dim_one = 1;
03439 v_dim_two = fEcal->MaxStinEcnaInStex();
03440 v_size = v_nb_times*v_dim_one*v_dim_two;
03441 v_tot += v_size;
03442
03443 if(fFlagPrint == fCodePrintAllComments){
03444 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03445 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03446 << setw(9) << v_size;}
03447
03448 for (Int_t i = 0; i < v_nb_times; i++)
03449 {
03450 if ( fTagAvHfn[0] == 1 )
03451 {
03452 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAvHfn;
03453 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03454 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03455 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03456 TRootAvHfn();
03457 gCnaRootFile->fCnaResultsTree->Fill();
03458 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03459 }
03460 }
03461 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03462
03463
03464
03465
03466 MaxCar = fgMaxCar;
03467 typ_name.Resize(MaxCar);
03468 typ_name = "AvMeanCorss";
03469 v_nb_times = fFileHeader->fAvMeanCorssCalc;
03470 v_dim_one = 1;
03471 v_dim_two = fEcal->MaxStinEcnaInStex();
03472 v_size = v_nb_times*v_dim_one*v_dim_two;
03473 v_tot += v_size;
03474
03475 if(fFlagPrint == fCodePrintAllComments){
03476 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03477 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03478 << setw(9) << v_size;}
03479
03480 for (Int_t i = 0; i < v_nb_times; i++)
03481 {
03482 if ( fTagAvMeanCorss[0] == 1 )
03483 {
03484 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAvMeanCorss;
03485 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03486 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03487 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03488 TRootAvEvCorss();
03489 gCnaRootFile->fCnaResultsTree->Fill();
03490 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03491 }
03492 }
03493 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03494
03495
03496
03497
03498 MaxCar = fgMaxCar;
03499 typ_name.Resize(MaxCar);
03500 typ_name = "AvSigCorss";
03501 v_nb_times = fFileHeader->fAvSigCorssCalc;
03502 v_dim_one = 1;
03503 v_dim_two = fEcal->MaxStinEcnaInStex();
03504 v_size = v_nb_times*v_dim_one*v_dim_two;
03505 v_tot += v_size;
03506
03507 if(fFlagPrint == fCodePrintAllComments){
03508 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03509 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03510 << setw(9) << v_size;}
03511
03512 for (Int_t i = 0; i < v_nb_times; i++)
03513 {
03514 if ( fTagAvSigCorss[0] == 1 )
03515 {
03516 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAvSigCorss;
03517 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03518 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03519 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03520 TRootAvSigCorss();
03521 gCnaRootFile->fCnaResultsTree->Fill();
03522 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03523 }
03524 }
03525 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03526
03527
03528
03529
03530 MaxCar = fgMaxCar;
03531 typ_name.Resize(MaxCar);
03532 typ_name = "Ped";
03533 v_nb_times = fFileHeader->fPedCalc;
03534 v_dim_one = 1;
03535 v_dim_two = fEcal->MaxCrysEcnaInStex();
03536 v_size = v_nb_times*v_dim_one*v_dim_two;
03537 v_tot += v_size;
03538
03539 if(fFlagPrint == fCodePrintAllComments){
03540 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03541 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03542 << setw(9) << v_size;}
03543
03544 for (Int_t i = 0; i < v_nb_times; i++)
03545 {
03546 if ( fTagPed[0] == 1 )
03547 {
03548 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypPed;
03549 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03550 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03551 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03552 TRootPed();
03553 gCnaRootFile->fCnaResultsTree->Fill();
03554 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03555 }
03556 }
03557 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03558
03559
03560
03561
03562 MaxCar = fgMaxCar;
03563 typ_name.Resize(MaxCar);
03564 typ_name = "Tno";
03565 v_nb_times = fFileHeader->fTnoCalc;
03566 v_dim_one = 1;
03567 v_dim_two = fEcal->MaxCrysEcnaInStex();
03568 v_size = v_nb_times*v_dim_one*v_dim_two;
03569 v_tot += v_size;
03570
03571 if(fFlagPrint == fCodePrintAllComments){
03572 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03573 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03574 << setw(9) << v_size;}
03575
03576 for (Int_t i = 0; i < v_nb_times; i++)
03577 {
03578 if ( fTagTno[0] == 1 )
03579 {
03580 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypTno;
03581 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03582 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03583 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03584 TRootTno();
03585 gCnaRootFile->fCnaResultsTree->Fill();
03586 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03587 }
03588 }
03589 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03590
03591
03592
03593
03594 MaxCar = fgMaxCar;
03595 typ_name.Resize(MaxCar);
03596 typ_name = "MeanCorss";
03597 v_nb_times = fFileHeader->fMeanCorssCalc;
03598 v_dim_one = 1;
03599 v_dim_two = fEcal->MaxCrysEcnaInStex();
03600 v_size = v_nb_times*v_dim_one*v_dim_two;
03601 v_tot += v_size;
03602
03603 if(fFlagPrint == fCodePrintAllComments){
03604 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03605 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03606 << setw(9) << v_size;}
03607
03608 for (Int_t i = 0; i < v_nb_times; i++)
03609 {
03610 if ( fTagMeanCorss[0] == 1 )
03611 {
03612 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypMeanCorss;
03613 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03614 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03615 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03616 TRootMeanCorss();
03617 gCnaRootFile->fCnaResultsTree->Fill();
03618 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03619 }
03620 }
03621 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03622
03623
03624
03625
03626 MaxCar = fgMaxCar;
03627 typ_name.Resize(MaxCar);
03628 typ_name = "Lfn";
03629 v_nb_times = fFileHeader->fLfnCalc;
03630 v_dim_one = 1;
03631 v_dim_two = fEcal->MaxCrysEcnaInStex();
03632 v_size = v_nb_times*v_dim_one*v_dim_two;
03633 v_tot += v_size;
03634
03635 if(fFlagPrint == fCodePrintAllComments){
03636 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03637 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03638 << setw(9) << v_size;}
03639
03640 for (Int_t i = 0; i < v_nb_times; i++)
03641 {
03642 if ( fTagLfn[0] == 1 )
03643 {
03644 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypLfn;
03645 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03646 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03647 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03648 TRootLfn();
03649 gCnaRootFile->fCnaResultsTree->Fill();
03650 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03651 }
03652 }
03653 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03654
03655
03656
03657
03658 MaxCar = fgMaxCar;
03659 typ_name.Resize(MaxCar);
03660 typ_name = "Hfn";
03661 v_nb_times = fFileHeader->fHfnCalc;
03662 v_dim_one = 1;
03663 v_dim_two = fEcal->MaxCrysEcnaInStex();
03664 v_size = v_nb_times*v_dim_one*v_dim_two;
03665 v_tot += v_size;
03666
03667 if(fFlagPrint == fCodePrintAllComments){
03668 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03669 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03670 << setw(9) << v_size;}
03671
03672 for (Int_t i = 0; i < v_nb_times; i++)
03673 {
03674 if ( fTagHfn[0] == 1 )
03675 {
03676 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypHfn;
03677 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03678 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03679 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03680 TRootHfn();
03681 gCnaRootFile->fCnaResultsTree->Fill();
03682 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03683 }
03684 }
03685 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03686
03687
03688
03689
03690 MaxCar = fgMaxCar;
03691 typ_name.Resize(MaxCar);
03692 typ_name = "SigCorss";
03693 v_nb_times = fFileHeader->fSigCorssCalc;
03694 v_dim_one = 1;
03695 v_dim_two = fEcal->MaxCrysEcnaInStex();
03696 v_size = v_nb_times*v_dim_one*v_dim_two;
03697 v_tot += v_size;
03698
03699 if(fFlagPrint == fCodePrintAllComments){
03700 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03701 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03702 << setw(9) << v_size;}
03703
03704 for (Int_t i = 0; i < v_nb_times; i++)
03705 {
03706 if ( fTagSigCorss[0] == 1 )
03707 {
03708 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypSigCorss;
03709 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03710 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03711 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03712 TRootSigCorss();
03713 gCnaRootFile->fCnaResultsTree->Fill();
03714 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03715 }
03716 }
03717 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03718
03719
03720
03721
03722 MaxCar = fgMaxCar;
03723 typ_name.Resize(MaxCar);
03724 typ_name = "LFccMoStins";
03725 v_nb_times = fFileHeader->fLFccMoStinsCalc;
03726 v_dim_one = fEcal->MaxStinEcnaInStex();
03727 v_dim_two = fEcal->MaxStinEcnaInStex();
03728 v_size = v_nb_times*v_dim_one*v_dim_two;
03729 v_tot += v_size;
03730
03731 if(fFlagPrint == fCodePrintAllComments){
03732 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03733 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03734 << setw(9) << v_size;}
03735
03736 for (Int_t i = 0; i < v_nb_times; i++)
03737 {
03738 if ( fTagLFccMoStins[0] == 1 )
03739 {
03740 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypLFccMoStins;
03741 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03742 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one,v_dim_two);
03743 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1,1);
03744 TRootLFccMoStins();
03745 gCnaRootFile->fCnaResultsTree->Fill();
03746 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03747 }
03748 }
03749 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03750
03751
03752
03753
03754 MaxCar = fgMaxCar;
03755 typ_name.Resize(MaxCar);
03756 typ_name = "HFccMoStins";
03757 v_nb_times = fFileHeader->fHFccMoStinsCalc;
03758 v_dim_one = fEcal->MaxStinEcnaInStex();
03759 v_dim_two = fEcal->MaxStinEcnaInStex();
03760 v_size = v_nb_times*v_dim_one*v_dim_two;
03761 v_tot += v_size;
03762
03763 if(fFlagPrint == fCodePrintAllComments){
03764 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03765 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03766 << setw(9) << v_size;}
03767
03768 for (Int_t i = 0; i < v_nb_times; i++)
03769 {
03770 if ( fTagHFccMoStins[0] == 1 )
03771 {
03772 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypHFccMoStins;
03773 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03774 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one,v_dim_two);
03775 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1,1);
03776 TRootHFccMoStins();
03777 gCnaRootFile->fCnaResultsTree->Fill();
03778 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03779 }
03780 }
03781 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03782
03783
03784
03785
03786 MaxCar = fgMaxCar;
03787 typ_name.Resize(MaxCar);
03788 typ_name = "NbOfEvts";
03789 v_nb_times = fFileHeader->fNbOfEvtsCalc;
03790 v_dim_one = fEcal->MaxCrysEcnaInStex();
03791 v_dim_two = argNbSampWrite;
03792 v_size = v_nb_times*v_dim_one*v_dim_two;
03793 v_tot += v_size;
03794
03795 if(fFlagPrint == fCodePrintAllComments){
03796 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03797 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03798 << setw(9) << v_size;}
03799
03800 for (Int_t i = 0; i < v_nb_times; i++)
03801 {
03802 if ( fTagNbOfEvts[0] == 1 )
03803 {
03804 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypNbOfEvts;
03805 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03806 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03807 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03808 TRootNbOfEvts(argNbSampWrite);
03809 gCnaRootFile->fCnaResultsTree->Fill();
03810 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03811 }
03812 }
03813 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03814
03815
03816
03817
03818 MaxCar = fgMaxCar;
03819 typ_name.Resize(MaxCar);
03820 typ_name = "MSp";
03821 v_nb_times = fFileHeader->fMSpCalc;
03822 v_dim_one = fEcal->MaxCrysEcnaInStex();
03823 v_dim_two = argNbSampWrite;
03824 v_size = v_nb_times*v_dim_one*v_dim_two;
03825 v_tot += v_size;
03826
03827 if(fFlagPrint == fCodePrintAllComments){
03828 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03829 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03830 << setw(9) << v_size;}
03831
03832 for (Int_t i = 0; i < v_nb_times; i++)
03833 {
03834 if ( fTagMSp[0] == 1 )
03835 {
03836 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypMSp;
03837 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03838 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03839 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03840 TRootMSp(argNbSampWrite);
03841 gCnaRootFile->fCnaResultsTree->Fill();
03842 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03843 }
03844 }
03845 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03846
03847
03848
03849
03850 MaxCar = fgMaxCar;
03851 typ_name.Resize(MaxCar);
03852 typ_name = "SSp";
03853 v_nb_times = fFileHeader->fSSpCalc;
03854 v_dim_one = fEcal->MaxCrysEcnaInStex();
03855 v_dim_two = argNbSampWrite;
03856 v_size = v_nb_times*v_dim_one*v_dim_two;
03857 v_tot += v_size;
03858
03859 if(fFlagPrint == fCodePrintAllComments){
03860 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03861 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03862 << setw(9) << v_size;}
03863
03864 for (Int_t i = 0; i < v_nb_times; i++)
03865 {
03866 if ( fTagSSp[0] == 1 )
03867 {
03868 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypSSp;
03869 gCnaRootFile->fCnaIndivResult->fIthElement = i;
03870 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03871 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03872 TRootSSp(argNbSampWrite);
03873 gCnaRootFile->fCnaResultsTree->Fill();
03874 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03875 }
03876 }
03877 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03878
03879
03880
03881
03882
03883 MaxCar = fgMaxCar;
03884 typ_name.Resize(MaxCar);
03885 typ_name = "CovCss";
03886 v_nb_times = fFileHeader->fCovCssCalc;
03887 v_dim_one = argNbSampWrite;
03888 v_dim_two = argNbSampWrite;
03889 v_size = v_nb_times*v_dim_one*v_dim_two;
03890 v_tot += v_size;
03891
03892 if(fFlagPrint == fCodePrintAllComments){
03893 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03894 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03895 << setw(9) << v_size;}
03896
03897 for (Int_t i0StexEcha = 0; i0StexEcha < v_nb_times; i0StexEcha++)
03898 {
03899 if ( fTagCovCss[i0StexEcha] == 1 )
03900 {
03901 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypCovCss;
03902 gCnaRootFile->fCnaIndivResult->fIthElement = i0StexEcha;
03903 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one,v_dim_two);
03904 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1,1);
03905 TRootCovCss(i0StexEcha, argNbSampWrite);
03906 gCnaRootFile->fCnaResultsTree->Fill();
03907 if( i0StexEcha == 0 && fFlagPrint == fCodePrintAllComments)
03908 {cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03909 }
03910 }
03911 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03912
03913
03914
03915
03916 MaxCar = fgMaxCar;
03917 typ_name.Resize(MaxCar);
03918 typ_name = "CorCss";
03919 v_nb_times = fFileHeader->fCorCssCalc;
03920 v_dim_one = argNbSampWrite;
03921 v_dim_two = argNbSampWrite;
03922 v_size = v_nb_times*v_dim_one*v_dim_two;
03923 v_tot += v_size;
03924
03925 if(fFlagPrint == fCodePrintAllComments){
03926 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03927 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03928 << setw(9) << v_size;}
03929
03930 for (Int_t i0StexEcha = 0; i0StexEcha < v_nb_times; i0StexEcha++)
03931 {
03932 if ( fTagCorCss[i0StexEcha] == 1 )
03933 {
03934 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypCorCss;
03935 gCnaRootFile->fCnaIndivResult->fIthElement = i0StexEcha;
03936 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one,v_dim_two);
03937 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1,1);
03938 TRootCorCss(i0StexEcha, argNbSampWrite);
03939 gCnaRootFile->fCnaResultsTree->Fill();
03940 if( i0StexEcha == 0 && fFlagPrint == fCodePrintAllComments)
03941 {cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03942 }
03943 }
03944 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03945
03946
03947
03948
03949 MaxCar = fgMaxCar;
03950 typ_name.Resize(MaxCar);
03951 typ_name = "AdcEvt";
03952 v_nb_times = fFileHeader->fAdcEvtCalc;
03953 v_dim_one = argNbSampWrite;
03954 v_dim_two = fFileHeader->fReqNbOfEvts;
03955 v_size = v_nb_times*v_dim_one*v_dim_two;
03956 v_tot += v_size;
03957
03958 if(fFlagPrint == fCodePrintAllComments){
03959 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03960 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03961 << setw(9) << v_size;}
03962
03963 for (Int_t i0StexEcha = 0; i0StexEcha < v_nb_times; i0StexEcha++)
03964 {
03965 if ( fTagAdcEvt[i0StexEcha] == 1 )
03966 {
03967 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAdcEvt;
03968 gCnaRootFile->fCnaIndivResult->fIthElement = i0StexEcha;
03969 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one,v_dim_two);
03970 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1,1);
03971 TRootAdcEvt(i0StexEcha, argNbSampWrite);
03972 gCnaRootFile->fCnaResultsTree->Fill();
03973 if( i0StexEcha == 0 && fFlagPrint == fCodePrintAllComments)
03974 {cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
03975 }
03976 }
03977 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
03978
03979
03980
03981
03982 MaxCar = fgMaxCar;
03983 typ_name.Resize(MaxCar);
03984 typ_name = "LfCov";
03985 v_nb_times = fFileHeader->fLfCovCalc;
03986 v_dim_one = fEcal->MaxCrysEcnaInStex();
03987 v_dim_two = fEcal->MaxCrysEcnaInStex();
03988 v_size = v_nb_times*v_dim_one*v_dim_two;
03989 v_tot += v_size;
03990
03991 if(fFlagPrint == fCodePrintAllComments){
03992 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
03993 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
03994 << setw(9) << v_size;}
03995
03996 for (Int_t i = 0; i < v_nb_times; i++)
03997 {
03998 if ( fTagLfCov[0] == 1 )
03999 {
04000 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypLfCov;
04001 gCnaRootFile->fCnaIndivResult->fIthElement = i;
04002 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one,v_dim_two);
04003 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1,1);
04004 TRootLfCov();
04005 gCnaRootFile->fCnaResultsTree->Fill();
04006 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
04007 }
04008 }
04009 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
04010
04011
04012
04013
04014 MaxCar = fgMaxCar;
04015 typ_name.Resize(MaxCar);
04016 typ_name = "LfCor";
04017 v_nb_times = fFileHeader->fLfCorCalc;
04018 v_dim_one = fEcal->MaxCrysEcnaInStex();
04019 v_dim_two = fEcal->MaxCrysEcnaInStex();
04020 v_size = v_nb_times*v_dim_one*v_dim_two;
04021 v_tot += v_size;
04022
04023 if(fFlagPrint == fCodePrintAllComments){
04024 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
04025 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
04026 << setw(9) << v_size;}
04027
04028 for (Int_t i = 0; i < v_nb_times; i++)
04029 {
04030 if ( fTagLfCor[0] == 1 )
04031 {
04032 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypLfCor;
04033 gCnaRootFile->fCnaIndivResult->fIthElement = i;
04034 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one,v_dim_two);
04035 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1,1);
04036 TRootLfCor();
04037 gCnaRootFile->fCnaResultsTree->Fill();
04038 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
04039 }
04040 }
04041 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
04042
04043
04044
04045
04046 MaxCar = fgMaxCar;
04047 typ_name.Resize(MaxCar);
04048 typ_name = "HfCov";
04049 v_nb_times = fFileHeader->fHfCovCalc;
04050 v_dim_one = fEcal->MaxCrysEcnaInStex();
04051 v_dim_two = fEcal->MaxCrysEcnaInStex();
04052 v_size = v_nb_times*v_dim_one*v_dim_two;
04053 v_tot += v_size;
04054
04055 if(fFlagPrint == fCodePrintAllComments){
04056 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
04057 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
04058 << setw(9) << v_size;}
04059
04060 for (Int_t i = 0; i < v_nb_times; i++)
04061 {
04062 if ( fTagHfCov[0] == 1 )
04063 {
04064 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypHfCov;
04065 gCnaRootFile->fCnaIndivResult->fIthElement = i;
04066 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one,v_dim_two);
04067 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1,1);
04068 TRootHfCov();
04069 gCnaRootFile->fCnaResultsTree->Fill();
04070 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
04071 }
04072 }
04073 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
04074
04075
04076
04077
04078 MaxCar = fgMaxCar;
04079 typ_name.Resize(MaxCar);
04080 typ_name = "HfCor";
04081 v_nb_times = fFileHeader->fHfCorCalc;
04082 v_dim_one = fEcal->MaxCrysEcnaInStex();
04083 v_dim_two = fEcal->MaxCrysEcnaInStex();
04084 v_size = v_nb_times*v_dim_one*v_dim_two;
04085 v_tot += v_size;
04086
04087 if(fFlagPrint == fCodePrintAllComments){
04088 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(18) << typ_name << ": " << setw(4) << v_nb_times
04089 << " * (" << setw(4) << v_dim_one << "," << setw(4) << v_dim_two << ") = "
04090 << setw(9) << v_size;}
04091
04092 for (Int_t i = 0; i < v_nb_times; i++)
04093 {
04094 if ( fTagHfCor[0] == 1 )
04095 {
04096 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypHfCor;
04097 gCnaRootFile->fCnaIndivResult->fIthElement = i;
04098 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one,v_dim_two);
04099 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1,1);
04100 TRootHfCor();
04101 gCnaRootFile->fCnaResultsTree->Fill();
04102 if( i == 0 && fFlagPrint == fCodePrintAllComments ){cout << " => WRITTEN ON FILE "; v_tot_writ += v_size;}
04103 }
04104 }
04105 if(fFlagPrint == fCodePrintAllComments){cout << endl;}
04106
04107
04108
04109 gCnaRootFile->fRootFile->Write();
04110
04111 fFileHeader->Write();
04112
04113
04114 if(fFlagPrint == fCodePrintAllComments){
04115 cout << "*TEcnaRun::WriteRootFile(...)> " << setw(20) << "TOTAL: "
04116 << setw(21) << "CALCULATED = " << setw(9) << v_tot
04117 << " => WRITTEN ON FILE = " << setw(9) << v_tot_writ << endl;}
04118
04119 if(fFlagPrint == fCodePrintAllComments){
04120 cout << "*TEcnaRun::WriteRootFile(...)> Write OK in file " << file_name << " in directory:" << endl
04121 << " " << fCnaParPaths->ResultsRootFilePath().Data()
04122 << endl;}
04123
04124 ok_write = kTRUE;
04125
04126
04127 CloseRootFile(file_name);
04128 }
04129 return ok_write;
04130 }
04131
04132
04133
04134
04135
04136
04137
04138
04139
04140 void TEcnaRun::TRootStinNumbers()
04141 {
04142 if (fTagStinNumbers[0] == 1 )
04143 {
04144 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
04145 {
04146 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) =
04147 fT1d_StexStinFromIndex[j0StexStinEcna];
04148 }
04149 }
04150 }
04151
04152
04153
04154
04155
04156
04157
04158 void TEcnaRun::TRootNbOfEvts(const Int_t& argNbSampWrite)
04159 {
04160 if (fTagNbOfEvts[0] == 1 )
04161 {
04162 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04163 {
04164 for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++)
04165 {
04166 gCnaRootFile->fCnaIndivResult->fMatHis(j0StexEcha, i0Sample) =
04167 fT2d_NbOfEvts[j0StexEcha][i0Sample];
04168 }
04169 }
04170 }
04171 }
04172
04173
04174
04175
04176
04177
04178
04179 void TEcnaRun::TRootAdcEvt(const Int_t& user_StexEcha, const Int_t& argNbSampWrite)
04180 {
04181 if (fTagAdcEvt[user_StexEcha] == 1 )
04182 {
04183 for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++)
04184 {
04185
04186 for (Int_t j_bin = 0; j_bin < fFileHeader->fReqNbOfEvts; j_bin++)
04187 {
04188 gCnaRootFile->fCnaIndivResult->fMatHis(i0Sample, j_bin) = (Double_t)0.;
04189 }
04190
04191 for (Int_t j_bin = 0; j_bin < fFileHeader->fReqNbOfEvts; j_bin++)
04192 {
04193 gCnaRootFile->fCnaIndivResult->fMatHis(i0Sample, j_bin) =
04194 fT3d_distribs[user_StexEcha][i0Sample][j_bin];
04195 }
04196 }
04197 }
04198 }
04199
04200
04201
04202
04203
04204
04205
04206 void TEcnaRun::TRootMSp(const Int_t& argNbSampWrite)
04207 {
04208 if (fTagMSp[0] == 1 )
04209 {
04210 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04211 {
04212 for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++)
04213 {
04214 gCnaRootFile->fCnaIndivResult->fMatHis( j0StexEcha, i0Sample) =
04215 fT2d_ev[j0StexEcha][i0Sample];
04216 }
04217 }
04218 }
04219 }
04220
04221
04222
04223
04224
04225
04226
04227 void TEcnaRun::TRootSSp(const Int_t& argNbSampWrite)
04228 {
04229 if (fTagSSp[0] == 1 )
04230 {
04231 for (Int_t j0StexEcha=0; j0StexEcha<fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04232 {
04233 for (Int_t i0Sample=0; i0Sample<argNbSampWrite; i0Sample++)
04234 {
04235 gCnaRootFile->fCnaIndivResult->fMatHis(j0StexEcha, i0Sample) =
04236 fT2d_sig[j0StexEcha][i0Sample];
04237 }
04238 }
04239 }
04240 }
04241
04242
04243
04244
04245
04246
04247
04248
04249 void TEcnaRun::TRootLFccMoStins()
04250 {
04251 if (fTagLFccMoStins[0] == 1 )
04252 {
04253 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
04254 {
04255 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
04256 {
04257 gCnaRootFile->fCnaIndivResult->fMatMat(i0StexStinEcna, j0StexStinEcna) =
04258 fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna];
04259 }
04260 }
04261 }
04262 }
04263
04264
04265
04266
04267
04268
04269
04270
04271 void TEcnaRun::TRootHFccMoStins()
04272 {
04273 if (fTagHFccMoStins[0] == 1 )
04274 {
04275 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
04276 {
04277 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
04278 {
04279 gCnaRootFile->fCnaIndivResult->fMatMat(i0StexStinEcna, j0StexStinEcna) =
04280 fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna];
04281 }
04282 }
04283 }
04284 }
04285
04286
04287
04288
04289
04290
04291
04292 void TEcnaRun::TRootAvTno()
04293 {
04294 if (fTagAvTno[0] == 1 )
04295 {
04296 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
04297 {
04298 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) =
04299 fT1d_av_totn[j0StexStinEcna];
04300 }
04301 }
04302 }
04303
04304
04305
04306
04307
04308
04309 void TEcnaRun::TRootAvLfn()
04310 {
04311 if (fTagAvLfn[0] == 1 )
04312 {
04313 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
04314 {
04315 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) =
04316 fT1d_av_lofn[j0StexStinEcna];
04317 }
04318 }
04319 }
04320
04321
04322
04323
04324
04325
04326
04327 void TEcnaRun::TRootAvHfn()
04328 {
04329 if (fTagAvHfn[0] == 1 )
04330 {
04331 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
04332 {
04333 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) =
04334 fT1d_av_hifn[j0StexStinEcna];
04335 }
04336 }
04337 }
04338
04339
04340
04341
04342
04343
04344
04345 void TEcnaRun::TRootLfCov()
04346 {
04347 if (fTagLfCov[0] == 1 )
04348 {
04349 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
04350 {
04351 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04352 {
04353 gCnaRootFile->fCnaIndivResult->fMatMat(i0StexEcha, j0StexEcha) =
04354 fT2d_lf_cov[i0StexEcha][j0StexEcha];
04355 }
04356 }
04357 }
04358 }
04359
04360
04361
04362
04363
04364
04365
04366 void TEcnaRun::TRootLfCor()
04367 {
04368 if (fTagLfCor[0] == 1 )
04369 {
04370 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
04371 {
04372 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04373 {
04374 gCnaRootFile->fCnaIndivResult->fMatMat(i0StexEcha, j0StexEcha) =
04375 fT2d_lf_cor[i0StexEcha][j0StexEcha];
04376 }
04377 }
04378 }
04379 }
04380
04381
04382
04383
04384
04385
04386
04387 void TEcnaRun::TRootHfCov()
04388 {
04389 if (fTagHfCov[0] == 1 )
04390 {
04391 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
04392 {
04393 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04394 {
04395 gCnaRootFile->fCnaIndivResult->fMatMat(i0StexEcha, j0StexEcha) =
04396 fT2d_hf_cov[i0StexEcha][j0StexEcha];
04397 }
04398 }
04399 }
04400 }
04401
04402
04403
04404
04405
04406
04407
04408 void TEcnaRun::TRootHfCor()
04409 {
04410 if (fTagHfCor[0] == 1 )
04411 {
04412 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++)
04413 {
04414 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04415 {
04416 gCnaRootFile->fCnaIndivResult->fMatMat(i0StexEcha, j0StexEcha) =
04417 fT2d_hf_cor[i0StexEcha][j0StexEcha];
04418 }
04419 }
04420 }
04421 }
04422
04423
04424
04425
04426
04427
04428
04429
04430 void TEcnaRun::TRootCovCss(const Int_t& user_StexEcha, const Int_t& argNbSampWrite)
04431 {
04432 if (fTagCovCss[user_StexEcha] == 1 )
04433 {
04434 for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++)
04435 {
04436 for (Int_t j0Sample = 0; j0Sample < argNbSampWrite; j0Sample++)
04437 {
04438 gCnaRootFile->fCnaIndivResult->fMatMat(i0Sample, j0Sample) =
04439 fT3d_cov_ss[user_StexEcha][i0Sample][j0Sample];
04440 }
04441 }
04442 }
04443 }
04444
04445
04446
04447
04448
04449
04450
04451 void TEcnaRun::TRootCorCss(const Int_t& user_StexEcha, const Int_t& argNbSampWrite)
04452 {
04453 if (fTagCorCss[user_StexEcha] == 1 )
04454 {
04455 for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++)
04456 {
04457 for (Int_t j0Sample = 0; j0Sample < argNbSampWrite; j0Sample++)
04458 {
04459 gCnaRootFile->fCnaIndivResult->fMatMat(i0Sample, j0Sample) =
04460 fT3d_cor_ss[user_StexEcha][i0Sample][j0Sample];
04461 }
04462 }
04463 }
04464 }
04465
04466
04467
04468
04469
04470
04471
04472
04473 void TEcnaRun::TRootPed()
04474 {
04475 if (fTagPed[0] == 1 )
04476 {
04477 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04478 {
04479 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) =
04480 fT1d_ev_ev[j0StexEcha];
04481 }
04482 }
04483 }
04484
04485
04486
04487
04488
04489
04490
04491 void TEcnaRun::TRootTno()
04492 {
04493 if (fTagTno[0] == 1 )
04494 {
04495 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04496 {
04497 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) =
04498 fT1d_evsamp_of_sigevt[j0StexEcha];
04499 }
04500 }
04501 }
04502
04503
04504
04505
04506
04507
04508
04509
04510 void TEcnaRun::TRootMeanCorss()
04511 {
04512 if (fTagMeanCorss[0] == 1 )
04513 {
04514 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04515 {
04516 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) =
04517 fT1d_ev_cor_ss[j0StexEcha];
04518 }
04519 }
04520 }
04521
04522
04523
04524
04525
04526
04527
04528
04529 void TEcnaRun::TRootLfn()
04530 {
04531 if (fTagLfn[0] == 1 )
04532 {
04533 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04534 {
04535 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) =
04536 fT1d_sigevt_of_evsamp[j0StexEcha];
04537 }
04538 }
04539 }
04540
04541
04542
04543
04544
04545
04546
04547
04548 void TEcnaRun::TRootHfn()
04549 {
04550 if (fTagHfn[0] == 1 )
04551 {
04552 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04553 {
04554 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) =
04555 fT1d_evevt_of_sigsamp[j0StexEcha];
04556 }
04557 }
04558 }
04559
04560
04561
04562
04563
04564
04565
04566
04567 void TEcnaRun::TRootSigCorss()
04568 {
04569 if (fTagSigCorss[0] == 1 )
04570 {
04571 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++)
04572 {
04573 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) =
04574 fT1d_sig_cor_ss[j0StexEcha];
04575 }
04576 }
04577 }
04578
04579
04580
04581
04582
04583
04584
04585
04586 void TEcnaRun::TRootAvPed()
04587 {
04588 if (fTagAvPed[0] == 1 )
04589 {
04590 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
04591 {
04592 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) =
04593 fT1d_av_mped[j0StexStinEcna];
04594 }
04595 }
04596 }
04597
04598
04599
04600
04601
04602
04603
04604
04605 void TEcnaRun::TRootAvEvCorss()
04606 {
04607 if (fTagAvMeanCorss[0] == 1 )
04608 {
04609 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
04610 {
04611 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) =
04612 fT1d_av_ev_corss[j0StexStinEcna];
04613 }
04614 }
04615 }
04616
04617
04618
04619
04620
04621
04622
04623
04624 void TEcnaRun::TRootAvSigCorss()
04625 {
04626 if (fTagAvSigCorss[0] == 1 )
04627 {
04628 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++)
04629 {
04630 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) =
04631 fT1d_av_sig_corss[j0StexStinEcna];
04632 }
04633 }
04634 }
04635
04636
04637
04638
04639
04640
04641
04642 void TEcnaRun::PrintComments()
04643 {
04644
04645
04646 fFlagPrint = fCodePrintComments;
04647 cout << "*TEcnaRun::PrintComments()> Warnings and some comments on init will be printed" << endl;
04648 }
04649
04650 void TEcnaRun::PrintWarnings()
04651 {
04652
04653
04654 fFlagPrint = fCodePrintWarnings;
04655 cout << "*TEcnaRun::PrintWarnings()> Warnings will be printed" << endl;
04656 }
04657
04658 void TEcnaRun::PrintAllComments()
04659 {
04660
04661
04662 fFlagPrint = fCodePrintAllComments;
04663 cout << "*TEcnaRun::PrintAllComments()> All the comments will be printed" << endl;
04664 }
04665
04666 void TEcnaRun::PrintNoComment()
04667 {
04668
04669
04670 fFlagPrint = fCodePrintNoComment;
04671 }
04672