File indexing completed on 2024-10-12 04:20:17
0001
0002
0003
0004
0005 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaRun.h"
0006
0007
0008
0009
0010
0011
0012
0013 R__EXTERN TEcnaRootFile* gCnaRootFile;
0014
0015 ClassImp(TEcnaRun);
0016
0017
0018
0019 TEcnaRun::TEcnaRun() {
0020
0021
0022
0023 }
0024
0025 TEcnaRun::TEcnaRun(TEcnaObject* pObjectManager, const TString& SubDet) {
0026
0027
0028
0029
0030 Init(pObjectManager);
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 const Text_t* h_name = "CnaHeader";
0042 const Text_t* h_title = "CnaHeader";
0043
0044 fFileHeader = nullptr;
0045
0046 Long_t iFileHeader = 0;
0047 if (iFileHeader == 0) {
0048 fFileHeader = new TEcnaHeader(pObjectManager, h_name, h_title);
0049 } else {
0050 fFileHeader = (TEcnaHeader*)iFileHeader;
0051 }
0052
0053 SetEcalSubDetector(SubDet.Data());
0054 fNbSampForFic = fEcal->MaxSampADC();
0055 }
0056
0057 TEcnaRun::TEcnaRun(TEcnaObject* pObjectManager, const TString& SubDet, const Int_t& NbOfSamples) {
0058 Init(pObjectManager);
0059
0060
0061
0062
0063
0064 const Text_t* h_name = "CnaHeader";
0065 const Text_t* h_title = "CnaHeader";
0066
0067 fFileHeader = nullptr;
0068
0069 Long_t iFileHeader = 0;
0070 if (iFileHeader == 0) {
0071 fFileHeader = new TEcnaHeader(pObjectManager, h_name, h_title);
0072 } else {
0073 fFileHeader = (TEcnaHeader*)iFileHeader;
0074 }
0075
0076 SetEcalSubDetector(SubDet.Data());
0077 if (NbOfSamples > 0 && NbOfSamples <= fEcal->MaxSampADC()) {
0078 fNbSampForFic = NbOfSamples;
0079 } else {
0080 std::cout << "TEcnaRun/CONSTRUCTOR> Number of required samples = " << NbOfSamples
0081 << ": OUT OF RANGE. Set to the default value (= " << fEcal->MaxSampADC() << ")." << fTTBELL << std::endl;
0082 fNbSampForFic = fEcal->MaxSampADC();
0083 }
0084 }
0085
0086
0087 Bool_t TEcnaRun::GetPathForResults() { return fCnaParPaths->GetPathForResultsRootFiles(); }
0088
0089 void TEcnaRun::Init(TEcnaObject* pObjectManager) {
0090
0091
0092 fCnew = 0;
0093 fCdelete = 0;
0094 fCnaCommand = 0;
0095 fCnaError = 0;
0096
0097 fTTBELL = '\007';
0098
0099
0100 fgMaxCar = (Int_t)512;
0101
0102
0103 fMaxMsgIndexForMiscDiag = (Int_t)10;
0104 fNbOfMiscDiagCounters = (Int_t)50;
0105 fMiscDiag = nullptr;
0106
0107 fNumberOfEvents = 0;
0108
0109 fT3d_AdcValues = nullptr;
0110 fT3d2_AdcValues = nullptr;
0111 fT3d1_AdcValues = nullptr;
0112
0113 fT1d_StexStinFromIndex = nullptr;
0114
0115 fT2d_NbOfEvts = nullptr;
0116 fT1d_NbOfEvts = nullptr;
0117
0118 fT2d_ev = nullptr;
0119 fT1d_ev = nullptr;
0120 fT2d_sig = nullptr;
0121 fT1d_sig = nullptr;
0122
0123 fT3d_cov_ss = nullptr;
0124 fT3d2_cov_ss = nullptr;
0125 fT3d1_cov_ss = nullptr;
0126
0127 fT3d_cor_ss = nullptr;
0128 fT3d2_cor_ss = nullptr;
0129 fT3d1_cor_ss = nullptr;
0130
0131 fT2d_lf_cov = nullptr;
0132 fT2d1_lf_cov = nullptr;
0133
0134 fT2d_lf_cor = nullptr;
0135 fT2d1_lf_cor = nullptr;
0136
0137 fT2d_hf_cov = nullptr;
0138 fT2d1_hf_cov = nullptr;
0139
0140 fT2d_hf_cor = nullptr;
0141 fT2d1_hf_cor = nullptr;
0142
0143 fT2d_lfcc_mostins = nullptr;
0144 fT2d1_lfcc_mostins = nullptr;
0145
0146 fT2d_hfcc_mostins = nullptr;
0147 fT2d1_hfcc_mostins = nullptr;
0148
0149 fT1d_ev_ev = nullptr;
0150 fT1d_evsamp_of_sigevt = nullptr;
0151 fT1d_ev_cor_ss = nullptr;
0152 fT1d_av_mped = nullptr;
0153 fT1d_av_totn = nullptr;
0154 fT1d_av_lofn = nullptr;
0155 fT1d_av_hifn = nullptr;
0156 fT1d_av_ev_corss = nullptr;
0157 fT1d_av_sig_corss = nullptr;
0158
0159 fT1d_sigevt_of_evsamp = nullptr;
0160 fT1d_evevt_of_sigsamp = nullptr;
0161 fT1d_sig_cor_ss = nullptr;
0162
0163 fT2dCrysNumbersTable = nullptr;
0164 fT1dCrysNumbersTable = nullptr;
0165
0166
0167 fTagStinNumbers = nullptr;
0168
0169 fTagNbOfEvts = nullptr;
0170
0171 fTagAdcEvt = nullptr;
0172
0173 fTagMSp = nullptr;
0174 fTagSSp = nullptr;
0175
0176 fTagCovCss = nullptr;
0177 fTagCorCss = nullptr;
0178
0179 fTagHfCov = nullptr;
0180 fTagHfCor = nullptr;
0181 fTagLfCov = nullptr;
0182 fTagLfCor = nullptr;
0183
0184 fTagLFccMoStins = nullptr;
0185 fTagHFccMoStins = nullptr;
0186
0187 fTagPed = nullptr;
0188 fTagTno = nullptr;
0189 fTagMeanCorss = nullptr;
0190
0191 fTagLfn = nullptr;
0192 fTagHfn = nullptr;
0193 fTagSigCorss = nullptr;
0194
0195 fTagAvPed = nullptr;
0196 fTagAvTno = nullptr;
0197 fTagAvLfn = nullptr;
0198 fTagAvHfn = nullptr;
0199
0200 fTagAvMeanCorss = nullptr;
0201 fTagAvSigCorss = nullptr;
0202
0203 fObjectManager = (TEcnaObject*)pObjectManager;
0204 pObjectManager->RegisterPointer("TEcnaRun", (Long_t)this);
0205
0206
0207 Long_t iCnaParCout = pObjectManager->GetPointerValue("TEcnaParCout");
0208 if (iCnaParCout == 0) {
0209 fCnaParCout = new TEcnaParCout(pObjectManager);
0210 } else {
0211 fCnaParCout = (TEcnaParCout*)iCnaParCout;
0212 }
0213
0214
0215 Long_t iCnaParPaths = pObjectManager->GetPointerValue("TEcnaParPaths");
0216 if (iCnaParPaths == 0) {
0217 fCnaParPaths = new TEcnaParPaths(pObjectManager);
0218 } else {
0219 fCnaParPaths = (TEcnaParPaths*)iCnaParPaths;
0220 }
0221
0222
0223 fCodePrintNoComment = fCnaParCout->GetCodePrint("NoComment");
0224 fCodePrintWarnings = fCnaParCout->GetCodePrint("Warnings ");
0225 fCodePrintComments = fCnaParCout->GetCodePrint("Comments");
0226 fCodePrintAllComments = fCnaParCout->GetCodePrint("AllComments");
0227
0228 fFlagPrint = fCodePrintWarnings;
0229
0230
0231 gCnaRootFile = nullptr;
0232 fOpenRootFile = kFALSE;
0233 fReadyToReadData = 0;
0234
0235
0236 fSpecialStexStinNotIndexed = -1;
0237
0238 fStinIndexBuilt = 0;
0239 fBuildEvtNotSkipped = 0;
0240
0241 fMemoReadNumberOfEventsforSamples = 0;
0242
0243 }
0244
0245
0246 void TEcnaRun::SetEcalSubDetector(const TString& SubDet) {
0247
0248
0249 Int_t MaxCar = fgMaxCar;
0250 fFlagSubDet.Resize(MaxCar);
0251 fFlagSubDet = SubDet.Data();
0252
0253 fEcal = nullptr;
0254 fEcal = new TEcnaParEcal(fFlagSubDet.Data());
0255 fEcalNumbering = nullptr;
0256 fEcalNumbering = new TEcnaNumbering(fFlagSubDet.Data(), fEcal);
0257 fCnaWrite = nullptr;
0258
0259 fCnaWrite = new TEcnaWrite(fFlagSubDet.Data(), fCnaParPaths, fCnaParCout, fEcal, fEcalNumbering);
0260
0261 if (fFlagSubDet == "EB") {
0262 fStexName = "SM ";
0263 fStinName = "tower";
0264 }
0265 if (fFlagSubDet == "EE") {
0266 fStexName = "Dee";
0267 fStinName = " SC ";
0268 }
0269 }
0270
0271
0272
0273
0274
0275
0276 TEcnaRun::TEcnaRun(const TEcnaRun& dcop) : TObject::TObject(dcop) {
0277 std::cout << "*TEcnaRun::TEcnaRun(const TEcnaRun& dcop)> "
0278 << " Now is the time to write a copy constructor" << std::endl;
0279
0280
0281 }
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302 TEcnaRun::~TEcnaRun() {
0303
0304
0305 if (fFlagPrint == fCodePrintAllComments) {
0306 std::cout << "*TEcnaRun::~TEcnaRun()> Entering destructor." << std::endl;
0307 }
0308
0309 if (fFlagPrint != fCodePrintNoComment || fFlagPrint == fCodePrintWarnings) {
0310 if (fBuildEvtNotSkipped > 0) {
0311 std::cout << "************************************************************************************* "
0312 << std::endl;
0313 std::cout << "*TEcnaRun::~TEcnaRun()> Nb of calls to GetSampleAdcValues by cmsRun: " << fBuildEvtNotSkipped
0314 << std::endl;
0315 std::cout << "************************************************************************************* "
0316 << std::endl;
0317 }
0318 }
0319
0320 if (fFlagPrint == fCodePrintAllComments) {
0321 Int_t misc_czero = 0;
0322 for (Int_t i = 0; i < fNbOfMiscDiagCounters; i++) {
0323 if (fMiscDiag[i] != 0) {
0324 std::cout << " fMiscDiag Counter " << std::setw(3) << i << " = " << std::setw(9)
0325 << fMiscDiag[i] << " (INFO: alloc on non zero freed zone) " << std::endl;
0326 } else {
0327 misc_czero++;
0328 }
0329 }
0330 std::cout << " Nb of fMiscDiag counters at zero: " << misc_czero
0331 << " (total nb of counters: " << fNbOfMiscDiagCounters << ")" << std::endl;
0332 }
0333
0334 if (fMiscDiag != nullptr) {
0335 delete[] fMiscDiag;
0336 fCdelete++;
0337 }
0338
0339
0340
0341
0342
0343
0344
0345
0346 if (fT1d_StexStinFromIndex != nullptr) {
0347 delete[] fT1d_StexStinFromIndex;
0348 fCdelete++;
0349 }
0350
0351 if (fT2d_NbOfEvts != nullptr) {
0352 delete[] fT2d_NbOfEvts;
0353 fCdelete++;
0354 }
0355 if (fT1d_NbOfEvts != nullptr) {
0356 delete[] fT1d_NbOfEvts;
0357 fCdelete++;
0358 }
0359
0360 if (fT3d_AdcValues != nullptr) {
0361 delete[] fT3d_AdcValues;
0362 fCdelete++;
0363 }
0364 if (fT3d2_AdcValues != nullptr) {
0365 delete[] fT3d2_AdcValues;
0366 fCdelete++;
0367 }
0368 if (fT3d1_AdcValues != nullptr) {
0369 delete[] fT3d1_AdcValues;
0370 fCdelete++;
0371 }
0372
0373 if (fT2d_ev != nullptr) {
0374 delete[] fT2d_ev;
0375 fCdelete++;
0376 }
0377 if (fT1d_ev != nullptr) {
0378 delete[] fT1d_ev;
0379 fCdelete++;
0380 }
0381
0382 if (fT2d_sig != nullptr) {
0383 delete[] fT2d_sig;
0384 fCdelete++;
0385 }
0386 if (fT1d_sig != nullptr) {
0387 delete[] fT1d_sig;
0388 fCdelete++;
0389 }
0390
0391 if (fT3d_cov_ss != nullptr) {
0392 delete[] fT3d_cov_ss;
0393 fCdelete++;
0394 }
0395 if (fT3d2_cov_ss != nullptr) {
0396 delete[] fT3d2_cov_ss;
0397 fCdelete++;
0398 }
0399 if (fT3d1_cov_ss != nullptr) {
0400 delete[] fT3d1_cov_ss;
0401 fCdelete++;
0402 }
0403
0404 if (fT3d_cor_ss != nullptr) {
0405 delete[] fT3d_cor_ss;
0406 fCdelete++;
0407 }
0408 if (fT3d2_cor_ss != nullptr) {
0409 delete[] fT3d2_cor_ss;
0410 fCdelete++;
0411 }
0412 if (fT3d1_cor_ss != nullptr) {
0413 delete[] fT3d1_cor_ss;
0414 fCdelete++;
0415 }
0416
0417 if (fT2d_lf_cov != nullptr) {
0418 delete[] fT2d_lf_cov;
0419 fCdelete++;
0420 }
0421 if (fT2d1_lf_cov != nullptr) {
0422 delete[] fT2d1_lf_cov;
0423 fCdelete++;
0424 }
0425
0426 if (fT2d_lf_cor != nullptr) {
0427 delete[] fT2d_lf_cor;
0428 fCdelete++;
0429 }
0430 if (fT2d1_lf_cor != nullptr) {
0431 delete[] fT2d1_lf_cor;
0432 fCdelete++;
0433 }
0434
0435 if (fT2d_hf_cov != nullptr) {
0436 delete[] fT2d_hf_cov;
0437 fCdelete++;
0438 }
0439 if (fT2d1_hf_cov != nullptr) {
0440 delete[] fT2d1_hf_cov;
0441 fCdelete++;
0442 }
0443
0444 if (fT2d_hf_cor != nullptr) {
0445 delete[] fT2d_hf_cor;
0446 fCdelete++;
0447 }
0448 if (fT2d1_hf_cor != nullptr) {
0449 delete[] fT2d1_hf_cor;
0450 fCdelete++;
0451 }
0452
0453 if (fT2d_lfcc_mostins != nullptr) {
0454 delete[] fT2d_lfcc_mostins;
0455 fCdelete++;
0456 }
0457 if (fT2d1_lfcc_mostins != nullptr) {
0458 delete[] fT2d1_lfcc_mostins;
0459 fCdelete++;
0460 }
0461
0462 if (fT2d_hfcc_mostins != nullptr) {
0463 delete[] fT2d_hfcc_mostins;
0464 fCdelete++;
0465 }
0466 if (fT2d1_hfcc_mostins != nullptr) {
0467 delete[] fT2d1_hfcc_mostins;
0468 fCdelete++;
0469 }
0470
0471 if (fT1d_ev_ev != nullptr) {
0472 delete[] fT1d_ev_ev;
0473 fCdelete++;
0474 }
0475 if (fT1d_evsamp_of_sigevt != nullptr) {
0476 delete[] fT1d_evsamp_of_sigevt;
0477 fCdelete++;
0478 }
0479 if (fT1d_ev_cor_ss != nullptr) {
0480 delete[] fT1d_ev_cor_ss;
0481 fCdelete++;
0482 }
0483 if (fT1d_av_mped != nullptr) {
0484 delete[] fT1d_av_mped;
0485 fCdelete++;
0486 }
0487 if (fT1d_av_totn != nullptr) {
0488 delete[] fT1d_av_totn;
0489 fCdelete++;
0490 }
0491 if (fT1d_av_lofn != nullptr) {
0492 delete[] fT1d_av_lofn;
0493 fCdelete++;
0494 }
0495 if (fT1d_av_hifn != nullptr) {
0496 delete[] fT1d_av_hifn;
0497 fCdelete++;
0498 }
0499 if (fT1d_av_ev_corss != nullptr) {
0500 delete[] fT1d_av_ev_corss;
0501 fCdelete++;
0502 }
0503 if (fT1d_av_sig_corss != nullptr) {
0504 delete[] fT1d_av_sig_corss;
0505 fCdelete++;
0506 }
0507
0508 if (fT1d_sigevt_of_evsamp != nullptr) {
0509 delete[] fT1d_sigevt_of_evsamp;
0510 fCdelete++;
0511 }
0512 if (fT1d_evevt_of_sigsamp != nullptr) {
0513 delete[] fT1d_evevt_of_sigsamp;
0514 fCdelete++;
0515 }
0516 if (fT1d_sig_cor_ss != nullptr) {
0517 delete[] fT1d_sig_cor_ss;
0518 fCdelete++;
0519 }
0520
0521 if (fT2dCrysNumbersTable != nullptr) {
0522 delete[] fT2dCrysNumbersTable;
0523 fCdelete++;
0524 }
0525 if (fT1dCrysNumbersTable != nullptr) {
0526 delete[] fT1dCrysNumbersTable;
0527 fCdelete++;
0528 }
0529
0530 if (fTagStinNumbers != nullptr) {
0531 delete[] fTagStinNumbers;
0532 fCdelete++;
0533 }
0534 if (fTagNbOfEvts != nullptr) {
0535 delete[] fTagNbOfEvts;
0536 fCdelete++;
0537 }
0538 if (fTagAdcEvt != nullptr) {
0539 delete[] fTagAdcEvt;
0540 fCdelete++;
0541 }
0542 if (fTagMSp != nullptr) {
0543 delete[] fTagMSp;
0544 fCdelete++;
0545 }
0546 if (fTagSSp != nullptr) {
0547 delete[] fTagSSp;
0548 fCdelete++;
0549 }
0550
0551 if (fTagCovCss != nullptr) {
0552 delete[] fTagCovCss;
0553 fCdelete++;
0554 }
0555 if (fTagCorCss != nullptr) {
0556 delete[] fTagCorCss;
0557 fCdelete++;
0558 }
0559
0560 if (fTagHfCov != nullptr) {
0561 delete[] fTagHfCov;
0562 fCdelete++;
0563 }
0564 if (fTagHfCor != nullptr) {
0565 delete[] fTagHfCor;
0566 fCdelete++;
0567 }
0568 if (fTagLfCov != nullptr) {
0569 delete[] fTagLfCov;
0570 fCdelete++;
0571 }
0572 if (fTagLfCor != nullptr) {
0573 delete[] fTagLfCor;
0574 fCdelete++;
0575 }
0576
0577 if (fTagLFccMoStins != nullptr) {
0578 delete[] fTagLFccMoStins;
0579 fCdelete++;
0580 }
0581 if (fTagHFccMoStins != nullptr) {
0582 delete[] fTagHFccMoStins;
0583 fCdelete++;
0584 }
0585
0586 if (fTagPed != nullptr) {
0587 delete[] fTagPed;
0588 fCdelete++;
0589 }
0590 if (fTagTno != nullptr) {
0591 delete[] fTagTno;
0592 fCdelete++;
0593 }
0594 if (fTagMeanCorss != nullptr) {
0595 delete[] fTagMeanCorss;
0596 fCdelete++;
0597 }
0598
0599 if (fTagLfn != nullptr) {
0600 delete[] fTagLfn;
0601 fCdelete++;
0602 }
0603 if (fTagHfn != nullptr) {
0604 delete[] fTagHfn;
0605 fCdelete++;
0606 }
0607 if (fTagSigCorss != nullptr) {
0608 delete[] fTagSigCorss;
0609 fCdelete++;
0610 }
0611
0612 if (fTagAvPed != nullptr) {
0613 delete[] fTagAvPed;
0614 fCdelete++;
0615 }
0616 if (fTagAvTno != nullptr) {
0617 delete[] fTagAvTno;
0618 fCdelete++;
0619 }
0620 if (fTagAvLfn != nullptr) {
0621 delete[] fTagAvLfn;
0622 fCdelete++;
0623 }
0624 if (fTagAvHfn != nullptr) {
0625 delete[] fTagAvHfn;
0626 fCdelete++;
0627 }
0628 if (fTagAvMeanCorss != nullptr) {
0629 delete[] fTagAvMeanCorss;
0630 fCdelete++;
0631 }
0632 if (fTagAvSigCorss != nullptr) {
0633 delete[] fTagAvSigCorss;
0634 fCdelete++;
0635 }
0636
0637 if (fCnew != fCdelete) {
0638 std::cout << "!TEcnaRun::~TEcnaRun()> WRONG MANAGEMENT OF MEMORY ALLOCATIONS: fCnew = " << fCnew
0639 << ", fCdelete = " << fCdelete << fTTBELL << std::endl;
0640 } else {
0641
0642
0643 }
0644
0645 if (fFlagPrint == fCodePrintAllComments) {
0646 std::cout << "*TEcnaRun::~TEcnaRun()> Exiting destructor (this = " << this << ")." << std::endl
0647 << "~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#"
0648 << std::endl;
0649 }
0650
0651
0652 }
0653
0654
0655
0656
0657
0658
0659
0660
0661
0662
0663
0664
0665
0666
0667
0668
0669 void TEcnaRun::GetReadyToReadData(const TString& typ_ana,
0670 const Int_t& run_number,
0671 const Int_t& nfirst,
0672 const Int_t& nlast,
0673 const Int_t& nbevts,
0674 const Int_t& Stex) {
0675
0676
0677
0678 Int_t RunType = 99999999;
0679 GetReadyToReadData(typ_ana, run_number, nfirst, nlast, nbevts, Stex, RunType);
0680 }
0681
0682 void TEcnaRun::GetReadyToReadData(const TString& typ_ana,
0683 const Int_t& run_number,
0684 const Int_t& nfirst,
0685 const Int_t& nlast,
0686 const Int_t& nbevts,
0687 const Int_t& Stex,
0688 const Int_t& run_type) {
0689
0690
0691
0692
0693 Int_t nrangeevts = nlast - nfirst + 1;
0694
0695 if (nrangeevts < nbevts) {
0696 if (nlast >= nfirst) {
0697 std::cout << "*TEcnaRun::GetReadyToReadData(...)> --- WARNING ---> number of events = " << nbevts
0698 << ", out of range (range = " << nfirst << "," << nlast << ")" << std::endl
0699 << " The number of found events will be less " << std::endl
0700 << " than the number of requested events." << std::endl;
0701 }
0702 if (nlast < nfirst) {
0703 std::cout << "*TEcnaRun::GetReadyToReadData(...)> --- INFO ---> last requested event number = " << nlast
0704 << ", less than first requested event number (= " << nfirst << ")" << std::endl
0705 << " File will be read until EOF if the number of found events"
0706 << std::endl
0707 << " remains less than the number of requested events." << std::endl;
0708 }
0709 }
0710
0711
0712 fMiscDiag = new Int_t[fNbOfMiscDiagCounters];
0713 fCnew++;
0714 for (Int_t iz = 0; iz < fNbOfMiscDiagCounters; iz++) {
0715 fMiscDiag[iz] = (Int_t)0;
0716 }
0717
0718
0719 Int_t nentries = 99999999;
0720 if (nfirst <= nentries) {
0721
0722 if (nfirst > 0) {
0723
0724
0725 if (nlast <= nentries) {
0726 const Text_t* h_name = "CnaHeader";
0727 const Text_t* h_title = "CnaHeader";
0728
0729
0730
0731
0732
0733 if (fEcal->MaxStinEcnaInStex() > 0 && fEcal->MaxCrysInStin() > 0 && fNbSampForFic > 0) {
0734 if (fFileHeader == nullptr) {
0735 fFileHeader = new TEcnaHeader(fObjectManager, h_name, h_title);
0736 }
0737
0738 fFileHeader->HeaderParameters(typ_ana, fNbSampForFic, run_number, nfirst, nlast, nbevts, Stex, run_type);
0739
0740
0741
0742
0743
0744
0745
0746
0747
0748
0749
0750
0751
0752
0753
0754
0755
0756
0757
0758
0759 fTagStinNumbers = new Int_t[1];
0760 fCnew++;
0761 fTagStinNumbers[0] = (Int_t)0;
0762 fTagNbOfEvts = new Int_t[1];
0763 fCnew++;
0764 fTagNbOfEvts[0] = (Int_t)0;
0765
0766 fTagAdcEvt = new Int_t[fEcal->MaxCrysEcnaInStex()];
0767 fCnew++;
0768 for (Int_t iz = 0; iz < fEcal->MaxCrysEcnaInStex(); iz++) {
0769 fTagAdcEvt[iz] = (Int_t)0;
0770 }
0771
0772 fTagMSp = new Int_t[1];
0773 fCnew++;
0774 fTagMSp[0] = (Int_t)0;
0775 fTagSSp = new Int_t[1];
0776 fCnew++;
0777 fTagSSp[0] = (Int_t)0;
0778
0779 fTagCovCss = new Int_t[fEcal->MaxCrysEcnaInStex()];
0780 fCnew++;
0781 for (Int_t iz = 0; iz < fEcal->MaxCrysEcnaInStex(); iz++) {
0782 fTagCovCss[iz] = (Int_t)0;
0783 }
0784
0785 fTagCorCss = new Int_t[fEcal->MaxCrysEcnaInStex()];
0786 fCnew++;
0787 for (Int_t iz = 0; iz < fEcal->MaxCrysEcnaInStex(); iz++) {
0788 fTagCorCss[iz] = (Int_t)0;
0789 }
0790
0791 fTagLfCov = new Int_t[1];
0792 fCnew++;
0793 fTagLfCov[0] = (Int_t)0;
0794 fTagLfCor = new Int_t[1];
0795 fCnew++;
0796 fTagLfCor[0] = (Int_t)0;
0797
0798 fTagHfCov = new Int_t[1];
0799 fCnew++;
0800 fTagHfCov[0] = (Int_t)0;
0801 fTagHfCor = new Int_t[1];
0802 fCnew++;
0803 fTagHfCor[0] = (Int_t)0;
0804
0805 fTagLFccMoStins = new Int_t[1];
0806 fCnew++;
0807 fTagLFccMoStins[0] = (Int_t)0;
0808 fTagHFccMoStins = new Int_t[1];
0809 fCnew++;
0810 fTagHFccMoStins[0] = (Int_t)0;
0811
0812 fTagPed = new Int_t[1];
0813 fCnew++;
0814 fTagPed[0] = (Int_t)0;
0815 fTagTno = new Int_t[1];
0816 fCnew++;
0817 fTagTno[0] = (Int_t)0;
0818 fTagMeanCorss = new Int_t[1];
0819 fCnew++;
0820 fTagMeanCorss[0] = (Int_t)0;
0821
0822 fTagLfn = new Int_t[1];
0823 fCnew++;
0824 fTagLfn[0] = (Int_t)0;
0825 fTagHfn = new Int_t[1];
0826 fCnew++;
0827 fTagHfn[0] = (Int_t)0;
0828 fTagSigCorss = new Int_t[1];
0829 fCnew++;
0830 fTagSigCorss[0] = (Int_t)0;
0831
0832 fTagAvPed = new Int_t[1];
0833 fCnew++;
0834 fTagAvPed[0] = (Int_t)0;
0835 fTagAvTno = new Int_t[1];
0836 fCnew++;
0837 fTagAvTno[0] = (Int_t)0;
0838 fTagAvLfn = new Int_t[1];
0839 fCnew++;
0840 fTagAvLfn[0] = (Int_t)0;
0841 fTagAvHfn = new Int_t[1];
0842 fCnew++;
0843 fTagAvHfn[0] = (Int_t)0;
0844 fTagAvMeanCorss = new Int_t[1];
0845 fCnew++;
0846 fTagAvMeanCorss[0] = (Int_t)0;
0847 fTagAvSigCorss = new Int_t[1];
0848 fCnew++;
0849 fTagAvSigCorss[0] = (Int_t)0;
0850
0851
0852
0853
0854
0855
0856
0857 if (fT1d_StexStinFromIndex == nullptr) {
0858 fT1d_StexStinFromIndex = new Int_t[fEcal->MaxStinEcnaInStex()];
0859 fCnew++;
0860 }
0861 for (Int_t i0_Stin = 0; i0_Stin < fEcal->MaxStinEcnaInStex(); i0_Stin++) {
0862 fT1d_StexStinFromIndex[i0_Stin] = fSpecialStexStinNotIndexed;
0863 }
0864
0865
0866
0867
0868
0869
0870
0871
0872
0873
0874
0875 if (fT3d_AdcValues == nullptr) {
0876
0877 std::cout << "*TEcnaRun::GetReadyToReadData(...)> Allocation of 3D array for ADC distributions."
0878 << " Nb of requested evts = " << fFileHeader->fReqNbOfEvts << std::endl
0879 << " This number must not be too large"
0880 << " (no failure after this message means alloc OK)." << std::endl;
0881
0882 fT3d_AdcValues = new Double_t**[fEcal->MaxCrysEcnaInStex()];
0883 fCnew++;
0884
0885 fT3d2_AdcValues = new Double_t*[fEcal->MaxCrysEcnaInStex() * fNbSampForFic];
0886 fCnew++;
0887
0888 fT3d1_AdcValues = new Double_t[fEcal->MaxCrysEcnaInStex() * fNbSampForFic * fFileHeader->fReqNbOfEvts];
0889 fCnew++;
0890
0891 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
0892 fT3d_AdcValues[i0StexEcha] = &fT3d2_AdcValues[0] + i0StexEcha * fNbSampForFic;
0893 for (Int_t j0Sample = 0; j0Sample < fNbSampForFic; j0Sample++) {
0894 fT3d2_AdcValues[fNbSampForFic * i0StexEcha + j0Sample] =
0895 &fT3d1_AdcValues[0] + fFileHeader->fReqNbOfEvts * (fNbSampForFic * i0StexEcha + j0Sample);
0896 }
0897 }
0898 }
0899
0900 for (Int_t iza = 0; iza < fEcal->MaxCrysEcnaInStex(); iza++) {
0901 for (Int_t izb = 0; izb < fNbSampForFic; izb++) {
0902 for (Int_t izc = 0; izc < fFileHeader->fReqNbOfEvts; izc++) {
0903 if (fT3d_AdcValues[iza][izb][izc] != (Double_t)0) {
0904 fMiscDiag[0]++;
0905 fT3d_AdcValues[iza][izb][izc] = (Double_t)0;
0906 }
0907 }
0908 }
0909 }
0910
0911
0912
0913
0914
0915
0916
0917
0918 if (fT2d_NbOfEvts == nullptr) {
0919 fT2d_NbOfEvts = new Int_t*[fEcal->MaxCrysEcnaInStex()];
0920 fCnew++;
0921 fT1d_NbOfEvts = new Int_t[fEcal->MaxCrysEcnaInStex() * fNbSampForFic];
0922 fCnew++;
0923
0924 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
0925 fT2d_NbOfEvts[i0StexEcha] = &fT1d_NbOfEvts[0] + i0StexEcha * fNbSampForFic;
0926 }
0927
0928
0929 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
0930 for (Int_t i0Sample = 0; i0Sample < fNbSampForFic; i0Sample++) {
0931 [[clang::suppress]] fT2d_NbOfEvts[i0StexEcha][i0Sample] = 0;
0932 }
0933 }
0934 } else {
0935 std::cerr << "!TEcnaRun::GetReadyToReadData(...)> *** ERROR *** No allocation for fT2d_NbOfEvts!"
0936 << " Pointer already not NULL " << fTTBELL << std::endl;
0937
0938
0939 }
0940 } else {
0941 std::cerr << std::endl
0942 << "!TEcnaRun::GetReadyToReadData(...)> "
0943 << " *** ERROR *** " << std::endl
0944 << " --------------------------------------------------" << std::endl
0945 << " NULL or NEGATIVE values for arguments" << std::endl
0946 << " with expected positive values:" << std::endl
0947 << " Number of Stins in Stex = " << fEcal->MaxStinEcnaInStex() << std::endl
0948 << " Number of crystals in Stin = " << fEcal->MaxCrysInStin() << std::endl
0949 << " Number of samples by channel = " << fNbSampForFic << std::endl
0950 << std::endl
0951 << std::endl
0952 << " hence, no memory allocation for array member has been performed." << std::endl;
0953
0954 std::cout << "Enter: 0 and RETURN to continue or: CTRL C to exit";
0955 Int_t toto;
0956 std::cin >> toto;
0957 }
0958
0959 if (fFlagPrint == fCodePrintAllComments) {
0960 std::cout << std::endl;
0961 std::cout << "*TEcnaRun::GetReadyToReadData(...)>" << std::endl
0962 << " The method has been called with the following argument values:" << std::endl
0963 << " Analysis name = " << fFileHeader->fTypAna << std::endl
0964 << " Run number = " << fFileHeader->fRunNumber << std::endl
0965 << " Run type = " << fFileHeader->fRunType << std::endl
0966 << " First requested event number = " << fFileHeader->fFirstReqEvtNumber << std::endl
0967 << " Last requested event number = " << fFileHeader->fLastReqEvtNumber << std::endl
0968 << " " << fStexName.Data() << " number = " << fFileHeader->fStex
0969 << std::endl
0970 << " Number of " << fStinName.Data() << " in " << fStexName.Data() << " = "
0971 << fEcal->MaxStinEcnaInStex() << std::endl
0972 << " Number of crystals in " << fStinName.Data() << " = " << fEcal->MaxCrysInStin()
0973 << std::endl
0974 << " Number of samples by channel = " << fNbSampForFic << std::endl
0975 << std::endl;
0976 }
0977
0978 fReadyToReadData = 1;
0979 } else {
0980 if (fFlagPrint != fCodePrintNoComment) {
0981 std::cout << "!TEcnaRun::GetReadyToReadData(...) > WARNING/CORRECTION:" << std::endl
0982 << "! The fisrt requested event number is not positive (nfirst = " << nfirst << ") " << fTTBELL
0983 << std::endl;
0984 }
0985 }
0986 } else {
0987 if (fFlagPrint != fCodePrintNoComment) {
0988 std::cout << std::endl
0989 << "!TEcnaRun::GetReadyToReadData(...)> WARNING/CORRECTION:" << std::endl
0990 << "! The number of requested events (nbevts = " << nbevts << ") is too large." << std::endl
0991 << "! Last event number = " << nlast << " > number of entries = " << nentries << ". " << fTTBELL
0992 << std::endl
0993 << std::endl;
0994 }
0995 }
0996 } else {
0997 std::cout << "!TEcnaRun::GetReadyToReadData(...) *** ERROR ***> "
0998 << " The first requested event number is greater than the number of entries." << fTTBELL << std::endl;
0999 }
1000 if (fFlagPrint == fCodePrintAllComments) {
1001 std::cout << "*TEcnaRun::GetReadyToReadData(...)> Leaving the method. fReadyToReadData = " << fReadyToReadData
1002 << std::endl;
1003 }
1004
1005 }
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031 Bool_t TEcnaRun::GetSampleAdcValues(const Int_t& n1EventNumber,
1032 const Int_t& n1StexStin,
1033 const Int_t& i0StinEcha,
1034 const Int_t& i0Sample,
1035 const Double_t& adcvalue) {
1036
1037
1038 fBuildEvtNotSkipped++;
1039
1040 Bool_t ret_code = kFALSE;
1041
1042 Int_t i0EventIndex = n1EventNumber - 1;
1043 Int_t i0StexStinEcna = n1StexStin - 1;
1044
1045 Int_t i_trouve = 0;
1046
1047 if (fReadyToReadData == 1) {
1048 if (n1StexStin >= 1 && n1StexStin <= fEcal->MaxStinEcnaInStex()) {
1049 if (i0StinEcha >= 0 && i0StinEcha < fEcal->MaxCrysInStin()) {
1050 if (i0Sample >= 0 && i0Sample < fEcal->MaxSampADC()) {
1051
1052 if (fT1d_StexStinFromIndex != nullptr)
1053 {
1054 ret_code = kTRUE;
1055
1056
1057 if (n1StexStin == fT1d_StexStinFromIndex[i0StexStinEcna]) {
1058 i_trouve = 1;
1059 }
1060
1061
1062 if (i_trouve != 1) {
1063 if (fT1d_StexStinFromIndex[i0StexStinEcna] == fSpecialStexStinNotIndexed) {
1064 fT1d_StexStinFromIndex[i0StexStinEcna] = n1StexStin;
1065 fFileHeader->fStinNumbersCalc = 1;
1066 fTagStinNumbers[0] = 1;
1067 fStinIndexBuilt++;
1068
1069 if (fFlagPrint == fCodePrintAllComments) {
1070 if (fStinIndexBuilt == 1) {
1071 std::cout << std::endl
1072 << "*TEcnaRun::GetSampleAdcValues(...)> event " << n1EventNumber << " : first event for "
1073 << fStexName.Data() << " " << fFileHeader->fStex << "; " << fStinName.Data() << "s : ";
1074 }
1075 if (fFlagSubDet == "EB") {
1076 std::cout << fT1d_StexStinFromIndex[i0StexStinEcna] << ", ";
1077 }
1078 if (fFlagSubDet == "EE") {
1079 std::cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFileHeader->fStex,
1080 fT1d_StexStinFromIndex[i0StexStinEcna])
1081 << ", ";
1082 }
1083 }
1084
1085 if (fFlagPrint == fCodePrintAllComments) {
1086 std::cout << " (" << fStinIndexBuilt << " " << fStinName.Data() << " found), channel " << i0StinEcha
1087 << ", i0Sample " << i0Sample << std::endl;
1088 }
1089 ret_code = kTRUE;
1090 }
1091 else {
1092 std::cout << "!TEcnaRun::GetSampleAdcValues(...)> *** ERROR ***> NOT ALLOWED if RESULT. "
1093 << " n1StexStin = " << n1StexStin << ", fT1d_StexStinFromIndex[" << i0StexStinEcna
1094 << "] = " << fT1d_StexStinFromIndex[i0StexStinEcna]
1095 << ", fStinIndexBuilt = " << fStinIndexBuilt << fTTBELL << std::endl;
1096 ret_code = kFALSE;
1097 }
1098 }
1099
1100 }
1101 else {
1102 std::cout << "!TEcnaRun, GetSampleAdcValues *** ERROR ***> "
1103 << " fT1d_StexStinFromIndex = " << fT1d_StexStinFromIndex
1104 << " fT1d_StexStinFromIndex[] ALLOCATION NOT DONE" << fTTBELL << std::endl;
1105 ret_code = kFALSE;
1106 }
1107 }
1108 else {
1109
1110
1111 if (i0Sample >= fEcal->MaxSampADC()) {
1112 std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> "
1113 << " sample number = " << i0Sample << ". OUT OF BOUNDS"
1114 << " (max = " << fNbSampForFic << ")" << fTTBELL << std::endl;
1115 ret_code = kFALSE;
1116 } else {
1117 ret_code = kTRUE;
1118 }
1119 }
1120 }
1121 else {
1122 std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> "
1123 << " channel number in " << fStinName.Data() << " = " << i0StinEcha << ". OUT OF BOUNDS"
1124 << " (max = " << fEcal->MaxCrysInStin() << ")" << fTTBELL << std::endl;
1125 ret_code = kFALSE;
1126 }
1127 } else {
1128 std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> " << fStinName.Data() << " number in "
1129 << fStexName.Data() << " = " << n1StexStin << ". OUT OF BOUNDS"
1130 << " (max = " << fEcal->MaxStinEcnaInStex() << ")" << fTTBELL << std::endl;
1131 ret_code = kFALSE;
1132 }
1133
1134
1135
1136
1137
1138
1139
1140 if (ret_code == kTRUE) {
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153 Int_t i0StexEcha = i0StexStinEcna * fEcal->MaxCrysInStin() + i0StinEcha;
1154
1155
1156 if (i0StexEcha >= 0 && i0StexEcha < fEcal->MaxCrysEcnaInStex()) {
1157
1158 (fT2d_NbOfEvts[i0StexEcha][i0Sample])++;
1159 fTagNbOfEvts[0] = 1;
1160 fFileHeader->fNbOfEvtsCalc = 1;
1161
1162
1163 if (i0EventIndex >= 0 && i0EventIndex < fFileHeader->fReqNbOfEvts) {
1164 if (i0Sample >= 0 && i0Sample < fNbSampForFic) {
1165 fT3d_AdcValues[i0StexEcha][i0Sample][i0EventIndex] = adcvalue;
1166 } else {
1167 std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> "
1168 << " sample index = " << i0Sample << ". OUT OF BOUNDS"
1169 << " (max = " << fNbSampForFic << ")" << fTTBELL << std::endl;
1170 }
1171 } else {
1172 std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> "
1173 << " event number = " << n1EventNumber << ". OUT OF BOUNDS"
1174 << " (max = " << fFileHeader->fReqNbOfEvts << ")" << fTTBELL << std::endl;
1175 ret_code = kFALSE;
1176 }
1177 } else {
1178 std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> "
1179 << " CHANNEL NUMBER OUT OF BOUNDS" << std::endl
1180 << " i0StexEcha number = " << i0StexEcha << " , n1StexStin = " << n1StexStin
1181 << " , i0StinEcha = " << i0StinEcha
1182 << " , fEcal->MaxCrysEcnaInStex() = " << fEcal->MaxCrysEcnaInStex() << fTTBELL << std::endl;
1183 ret_code = kFALSE;
1184
1185 }
1186 }
1187 else {
1188 std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> ret_code = kFALSE " << fTTBELL << std::endl;
1189 }
1190 }
1191 else {
1192 std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> GetReadyToReadData(...) not called." << fTTBELL
1193 << std::endl;
1194 ret_code = kFALSE;
1195 }
1196
1197 if (ret_code == kFALSE) {
1198 std::cout << "!TEcnaRun::GetSampleAdcValues(...)> *** ERROR ***> ret_code = " << ret_code
1199 << " (FALSE). Event: " << n1EventNumber << ", " << fStexName.Data() << ": " << fFileHeader->fStex << ", "
1200 << fStinName.Data() << ": " << n1StexStin << ", channel: " << i0StinEcha << ", Sample: " << i0Sample
1201 << ", ADC value: " << adcvalue << std::endl;
1202 }
1203 return ret_code;
1204 }
1205
1206
1207
1208
1209
1210
1211 Bool_t TEcnaRun::ReadSampleAdcValues() { return ReadSampleAdcValues(fEcal->MaxSampADC()); }
1212
1213 Bool_t TEcnaRun::ReadSampleAdcValues(const Int_t& nb_samp_for_calc) {
1214
1215
1216
1217
1218
1219
1220 fNbSampForCalc = nb_samp_for_calc;
1221
1222
1223
1224
1225 TEcnaRead* MyRootFile = new TEcnaRead(fObjectManager, fFlagSubDet.Data());
1226
1227 MyRootFile->PrintNoComment();
1228
1229 MyRootFile->FileParameters(fFileHeader->fTypAna,
1230 fFileHeader->fNbOfSamples,
1231 fFileHeader->fRunNumber,
1232 fFileHeader->fFirstReqEvtNumber,
1233 fFileHeader->fLastReqEvtNumber,
1234 fFileHeader->fReqNbOfEvts,
1235 fFileHeader->fStex,
1236 fCnaParPaths->ResultsRootFilePath().Data());
1237
1238 Bool_t ok_read = MyRootFile->LookAtRootFile();
1239
1240 fFileHeader->fStartTime = MyRootFile->GetStartTime();
1241 fFileHeader->fStopTime = MyRootFile->GetStopTime();
1242 fFileHeader->fStartDate = MyRootFile->GetStartDate();
1243 fFileHeader->fStopDate = MyRootFile->GetStopDate();
1244
1245 if (ok_read == kTRUE) {
1246 fRootFileName = MyRootFile->GetRootFileName();
1247 fRootFileNameShort = MyRootFile->GetRootFileNameShort();
1248 std::cout << "*TEcnaRun::ReadSampleAdcValues> Reading sample ADC values from file: " << std::endl
1249 << " " << fRootFileName << std::endl;
1250
1251 size_t i_no_data = 0;
1252
1253
1254 TVectorD vec(fEcal->MaxStinEcnaInStex());
1255 for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
1256 vec(i) = (Double_t)0.;
1257 }
1258 vec = MyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
1259 if (MyRootFile->DataExist() == kTRUE) {
1260 fTagStinNumbers[0] = 1;
1261 fFileHeader->fStinNumbersCalc = 1;
1262 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
1263 fT1d_StexStinFromIndex[i0StexStinEcna] = (Int_t)vec(i0StexStinEcna);
1264 }
1265 } else {
1266 i_no_data++;
1267 }
1268
1269 TMatrixD partial_matrix(fEcal->MaxCrysInStin(), fFileHeader->fNbOfSamples);
1270 for (Int_t i = 0; i < fEcal->MaxCrysInStin(); i++) {
1271 for (Int_t j = 0; j < fFileHeader->fNbOfSamples; j++) {
1272 partial_matrix(i, j) = (Double_t)0.;
1273 }
1274 }
1275
1276 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
1277 Int_t n1StexStin = MyRootFile->GetStexStinFromIndex(i0StexStinEcna);
1278 if (n1StexStin != -1) {
1279 partial_matrix =
1280 MyRootFile->ReadNumberOfEventsForSamples(n1StexStin, fEcal->MaxCrysInStin(), fFileHeader->fNbOfSamples);
1281
1282 if (MyRootFile->DataExist() == kTRUE) {
1283 fTagNbOfEvts[0] = 1;
1284 fFileHeader->fNbOfEvtsCalc = 1;
1285 for (Int_t i0StinCrys = 0; i0StinCrys < fEcal->MaxCrysInStin(); i0StinCrys++) {
1286 Int_t i0StexEcha = (n1StexStin - 1) * fEcal->MaxCrysInStin() + i0StinCrys;
1287 for (Int_t i0Sample = 0; i0Sample < fFileHeader->fNbOfSamples; i0Sample++) {
1288 fT2d_NbOfEvts[i0StexEcha][i0Sample] = (Int_t)partial_matrix(i0StinCrys, i0Sample);
1289 }
1290 }
1291 } else {
1292 i_no_data++;
1293 }
1294 }
1295 }
1296
1297
1298 Double_t*** fT3d_read_AdcValues = MyRootFile->ReadSampleAdcValuesSameFile(
1299 fEcal->MaxCrysEcnaInStex(), fFileHeader->fNbOfSamples, fFileHeader->fReqNbOfEvts);
1300
1301 if (MyRootFile->DataExist() == kTRUE) {
1302 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1303 for (Int_t i0Sample = 0; i0Sample < fFileHeader->fNbOfSamples; i0Sample++) {
1304 for (Int_t i_event = 0; i_event < fFileHeader->fReqNbOfEvts; i_event++) {
1305 fT3d_AdcValues[i0StexEcha][i0Sample][i_event] = fT3d_read_AdcValues[i0StexEcha][i0Sample][i_event];
1306 }
1307 }
1308 }
1309 } else {
1310 i_no_data++;
1311 }
1312 if (i_no_data) {
1313 std::cout << "!TEcnaRun::ReadSampleAdcValues(...)> *ERROR* =====> "
1314 << " Read failure. i_no_data = " << i_no_data << fTTBELL << std::endl;
1315 }
1316 } else {
1317 std::cout << "!TEcnaRun::ReadSampleAdcValues(...)> *ERROR* =====> "
1318 << " ROOT file not found" << fTTBELL << std::endl;
1319 }
1320 delete MyRootFile;
1321 return ok_read;
1322 }
1323
1324
1325
1326
1327
1328
1329 const TString& TEcnaRun::GetRootFileName() const { return fRootFileName; }
1330 const TString& TEcnaRun::GetRootFileNameShort() const { return fRootFileNameShort; }
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342 void TEcnaRun::StartStopTime(time_t t_startime, time_t t_stoptime) {
1343
1344
1345 fFileHeader->fStartTime = t_startime;
1346 fFileHeader->fStopTime = t_stoptime;
1347 }
1348
1349 void TEcnaRun::StartStopDate(const TString& c_startdate, const TString& c_stopdate) {
1350
1351
1352 fFileHeader->fStartDate = c_startdate;
1353 fFileHeader->fStopDate = c_stopdate;
1354 }
1355
1356
1357
1358
1359
1360
1361 void TEcnaRun::GetReadyToCompute() {
1362
1363
1364
1365
1366
1367
1368
1369
1370 fCnaWrite->RegisterFileParameters(fFileHeader->fTypAna.Data(),
1371 fFileHeader->fNbOfSamples,
1372 fFileHeader->fRunNumber,
1373 fFileHeader->fFirstReqEvtNumber,
1374 fFileHeader->fLastReqEvtNumber,
1375 fFileHeader->fReqNbOfEvts,
1376 fFileHeader->fStex);
1377
1378 fCnaWrite->fMakeResultsFileName();
1379
1380
1381 if (fT2d_NbOfEvts != nullptr) {
1382 fNumberOfEvents = fCnaWrite->NumberOfEventsAnalysis(
1383 fT2d_NbOfEvts, fEcal->MaxCrysEcnaInStex(), fNbSampForFic, fFileHeader->fReqNbOfEvts);
1384 } else {
1385 std::cout << "*TEcnaRun::GetReadyToCompute()> no data? fT2d_NbOfEvts = " << fT2d_NbOfEvts << std::endl;
1386 }
1387 }
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398 void TEcnaRun::SampleValues() {
1399
1400
1401
1402
1403
1404
1405 if (fFileHeader->fAdcEvtCalc > 0) {
1406 fFileHeader->fAdcEvtCalc = 0;
1407 }
1408 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1409 fTagAdcEvt[i0StexEcha] = 1;
1410 fFileHeader->fAdcEvtCalc++;
1411 }
1412 }
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422 void TEcnaRun::StandardCalculations() {
1423 SampleMeans();
1424 SampleSigmas();
1425 CorrelationsBetweenSamples();
1426
1427 Pedestals();
1428 TotalNoise();
1429 LowFrequencyNoise();
1430 HighFrequencyNoise();
1431 MeanCorrelationsBetweenSamples();
1432 SigmaOfCorrelationsBetweenSamples();
1433
1434 AveragePedestals();
1435 AverageTotalNoise();
1436 AverageLowFrequencyNoise();
1437 AverageHighFrequencyNoise();
1438 AverageMeanCorrelationsBetweenSamples();
1439 AverageSigmaOfCorrelationsBetweenSamples();
1440 }
1441
1442 void TEcnaRun::Expert1Calculations() {
1443
1444
1445 LowFrequencyCorrelationsBetweenChannels();
1446 HighFrequencyCorrelationsBetweenChannels();
1447 }
1448
1449 void TEcnaRun::Expert2Calculations() {
1450
1451
1452
1453
1454 LowFrequencyMeanCorrelationsBetweenStins();
1455 HighFrequencyMeanCorrelationsBetweenStins();
1456 }
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470 void TEcnaRun::SampleMeans() {
1471
1472
1473
1474 if (fFlagPrint != fCodePrintNoComment) {
1475 std::cout << "*TEcnaRun::SampleMeans() " << std::endl;
1476 }
1477 if (fFlagPrint == fCodePrintAllComments) {
1478 std::cout << " Calculation: sample expectation values over the events"
1479 << " for each channel." << std::endl;
1480 }
1481
1482
1483 if (fT2d_ev == nullptr) {
1484 Int_t n_samp = fNbSampForCalc;
1485 Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
1486 fT2d_ev = new Double_t*[n_StexEcha];
1487 fCnew++;
1488 fT1d_ev = new Double_t[n_StexEcha * n_samp];
1489 fCnew++;
1490 for (Int_t i = 0; i < n_StexEcha; i++) {
1491 fT2d_ev[i] = &fT1d_ev[0] + i * n_samp;
1492 }
1493 }
1494
1495 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1496 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1497 [[clang::suppress]]
1498 if (fT2d_ev[i0StexEcha][i0Sample] != (Double_t)0) {
1499 fMiscDiag[1]++;
1500 fT2d_ev[i0StexEcha][i0Sample] = (Double_t)0;
1501 }
1502 }
1503 }
1504
1505
1506 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1507 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1508 for (Int_t i_event = 0; i_event < fNumberOfEvents; i_event++) {
1509 [[clang::suppress]] fT2d_ev[i0StexEcha][i0Sample] += fT3d_AdcValues[i0StexEcha][i0Sample][i_event];
1510 }
1511 [[clang::suppress]] fT2d_ev[i0StexEcha][i0Sample] /= fNumberOfEvents;
1512 }
1513 }
1514 fTagMSp[0] = 1;
1515 fFileHeader->fMSpCalc++;
1516 }
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526 void TEcnaRun::SampleSigmas() {
1527
1528
1529 if (fFlagPrint != fCodePrintNoComment) {
1530 std::cout << "*TEcnaRun::SampleSigmas()" << std::endl;
1531 }
1532 if (fFlagPrint == fCodePrintAllComments) {
1533 std::cout << " Calculation: sample ADC sigmas over the events "
1534 << " for each channel." << std::endl;
1535 }
1536
1537
1538
1539
1540
1541 if (fTagMSp[0] != 1) {
1542 SampleMeans();
1543 fTagMSp[0] = 0;
1544 }
1545
1546
1547 if (fT2d_sig == nullptr) {
1548 Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
1549 Int_t n_samp = fNbSampForCalc;
1550 fT2d_sig = new Double_t*[n_StexEcha];
1551 fCnew++;
1552 fT1d_sig = new Double_t[n_StexEcha * n_samp];
1553 fCnew++;
1554 for (Int_t i0StexEcha = 0; i0StexEcha < n_StexEcha; i0StexEcha++) {
1555 fT2d_sig[i0StexEcha] = &fT1d_sig[0] + i0StexEcha * n_samp;
1556 }
1557 }
1558
1559 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1560 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1561 [[clang::suppress]]
1562 if (fT2d_sig[i0StexEcha][i0Sample] != (Double_t)0) {
1563 fMiscDiag[2]++;
1564 fT2d_sig[i0StexEcha][i0Sample] = (Double_t)0;
1565 }
1566 }
1567 }
1568
1569
1570 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1571 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1572 Double_t variance = (Double_t)0.;
1573 for (Int_t i_event = 0; i_event < fNumberOfEvents; i_event++) {
1574 Double_t ecart = fT3d_AdcValues[i0StexEcha][i0Sample][i_event] - fT2d_ev[i0StexEcha][i0Sample];
1575 variance += ecart * ecart;
1576 }
1577 variance /= fNumberOfEvents;
1578 [[clang::suppress]] fT2d_sig[i0StexEcha][i0Sample] = sqrt(variance);
1579 }
1580 }
1581 fTagSSp[0] = 1;
1582 fFileHeader->fSSpCalc++;
1583 }
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601 void TEcnaRun::CovariancesBetweenSamples() {
1602
1603
1604 if (fFlagPrint != fCodePrintNoComment) {
1605 std::cout << "*TEcnaRun::CovariancesBetweenSamples()" << std::endl;
1606 }
1607 if (fFlagPrint == fCodePrintAllComments) {
1608 std::cout << " Calculation: covariances between samples"
1609 << " for each channel." << std::endl;
1610 }
1611
1612
1613 if (fT3d_cov_ss == nullptr) {
1614 const Int_t n_samp = fNbSampForCalc;
1615 const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
1616 fT3d_cov_ss = new Double_t**[n_StexEcha];
1617 fCnew++;
1618 fT3d2_cov_ss = new Double_t*[n_StexEcha * n_samp];
1619 fCnew++;
1620 fT3d1_cov_ss = new Double_t[n_StexEcha * n_samp * n_samp];
1621 fCnew++;
1622 for (Int_t i = 0; i < n_StexEcha; i++) {
1623 fT3d_cov_ss[i] = &fT3d2_cov_ss[0] + i * n_samp;
1624 for (Int_t j = 0; j < n_samp; j++) {
1625 fT3d2_cov_ss[n_samp * i + j] = &fT3d1_cov_ss[0] + n_samp * (n_samp * i + j);
1626 }
1627 }
1628 }
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638 if (fTagMSp[0] != 1) {
1639 SampleMeans();
1640 fTagMSp[0] = 0;
1641 }
1642
1643 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
1644 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1645 for (Int_t j0Sample = 0; j0Sample <= i0Sample; j0Sample++) {
1646 [[clang::suppress]] fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample] = (Double_t)0;
1647 for (Int_t i_event = 0; i_event < fNumberOfEvents; i_event++) {
1648 fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample] +=
1649 (fT3d_AdcValues[j0StexEcha][i0Sample][i_event] - fT2d_ev[j0StexEcha][i0Sample]) *
1650 (fT3d_AdcValues[j0StexEcha][j0Sample][i_event] - fT2d_ev[j0StexEcha][j0Sample]);
1651 }
1652 fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample] /= (Double_t)fNumberOfEvents;
1653 fT3d_cov_ss[j0StexEcha][j0Sample][i0Sample] = fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample];
1654 }
1655 }
1656 fTagCovCss[j0StexEcha] = 1;
1657 fFileHeader->fCovCssCalc++;
1658 }
1659 }
1660
1661
1662
1663
1664
1665
1666
1667 void TEcnaRun::CorrelationsBetweenSamples() {
1668
1669
1670
1671
1672
1673
1674 if (fTagCovCss[0] != 1) {
1675 CovariancesBetweenSamples();
1676 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
1677 fTagCovCss[j0StexEcha] = 0;
1678 }
1679 }
1680
1681 if (fFlagPrint != fCodePrintNoComment) {
1682 std::cout << "*TEcnaRun::CorrelationsBetweenSamples()" << std::endl;
1683 }
1684 if (fFlagPrint == fCodePrintAllComments) {
1685 std::cout << " Calculation: correlations between samples"
1686 << " for each channel." << std::endl;
1687 }
1688
1689
1690 if (fT3d_cor_ss == nullptr) {
1691 const Int_t n_samp = fNbSampForCalc;
1692 const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
1693 fT3d_cor_ss = new Double_t**[n_StexEcha];
1694 fCnew++;
1695 fT3d2_cor_ss = new Double_t*[n_StexEcha * n_samp];
1696 fCnew++;
1697 fT3d1_cor_ss = new Double_t[n_StexEcha * n_samp * n_samp];
1698 fCnew++;
1699 for (Int_t i = 0; i < n_StexEcha; i++) {
1700 fT3d_cor_ss[i] = &fT3d2_cor_ss[0] + i * n_samp;
1701 for (Int_t j = 0; j < n_samp; j++) {
1702 fT3d2_cor_ss[n_samp * i + j] = &fT3d1_cor_ss[0] + n_samp * (n_samp * i + j);
1703 }
1704 }
1705 }
1706
1707
1708
1709
1710 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
1711 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1712 for (Int_t j0Sample = 0; j0Sample <= i0Sample; j0Sample++) {
1713 if ((fT3d_cov_ss[j0StexEcha][i0Sample][i0Sample] > 0) && (fT3d_cov_ss[j0StexEcha][j0Sample][j0Sample] > 0)) {
1714 [[clang::suppress]] fT3d_cor_ss[j0StexEcha][i0Sample][j0Sample] =
1715 fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample] /
1716 (sqrt(fT3d_cov_ss[j0StexEcha][i0Sample][i0Sample]) * sqrt(fT3d_cov_ss[j0StexEcha][j0Sample][j0Sample]));
1717 } else {
1718 [[clang::suppress]] fT3d_cor_ss[j0StexEcha][i0Sample][j0Sample] = (Double_t)0;
1719 }
1720 fT3d_cor_ss[j0StexEcha][j0Sample][i0Sample] = fT3d_cor_ss[j0StexEcha][i0Sample][j0Sample];
1721 }
1722 }
1723 fTagCorCss[j0StexEcha] = 1;
1724 fFileHeader->fCorCssCalc++;
1725 }
1726 }
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746 void TEcnaRun::Pedestals() {
1747
1748
1749
1750
1751
1752 if (fTagMSp[0] != 1) {
1753 SampleMeans();
1754 fTagMSp[0] = 0;
1755 }
1756
1757
1758 if (fT1d_ev_ev == nullptr) {
1759 fT1d_ev_ev = new Double_t[fEcal->MaxCrysEcnaInStex()];
1760 fCnew++;
1761 }
1762 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1763 [[clang::suppress]]
1764 if (fT1d_ev_ev[i0StexEcha] != (Double_t)0) {
1765 fMiscDiag[11]++;
1766 fT1d_ev_ev[i0StexEcha] = (Double_t)0;
1767 }
1768 }
1769
1770
1771 if (fFlagPrint != fCodePrintNoComment) {
1772 std::cout << "*TEcnaRun::Pedestals()" << std::endl;
1773 }
1774 if (fFlagPrint == fCodePrintAllComments) {
1775 std::cout << " Calculation, for all the channels, of the expectation values (over the samples 1 to "
1776 << fNbSampForCalc << ")" << std::endl
1777 << " of the ADC expectation values (over the events)." << std::endl;
1778 }
1779
1780 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1781 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1782 [[clang::suppress]] fT1d_ev_ev[i0StexEcha] += fT2d_ev[i0StexEcha][i0Sample];
1783 }
1784 [[clang::suppress]] fT1d_ev_ev[i0StexEcha] /= fNbSampForCalc;
1785 }
1786 fTagPed[0] = 1;
1787 fFileHeader->fPedCalc++;
1788 }
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802 void TEcnaRun::TotalNoise() {
1803
1804
1805
1806
1807
1808 if (fTagSSp[0] != 1) {
1809 SampleSigmas();
1810 fTagSSp[0] = 0;
1811 }
1812
1813
1814 if (fT1d_evsamp_of_sigevt == nullptr) {
1815 fT1d_evsamp_of_sigevt = new Double_t[fEcal->MaxCrysEcnaInStex()];
1816 fCnew++;
1817 }
1818 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1819 if (fT1d_evsamp_of_sigevt[i0StexEcha] != (Double_t)0) {
1820 fMiscDiag[12]++;
1821 [[clang::suppress]] fT1d_evsamp_of_sigevt[i0StexEcha] = (Double_t)0;
1822 }
1823 }
1824
1825
1826 if (fFlagPrint != fCodePrintNoComment) {
1827 std::cout << "*TEcnaRun::TotalNoise()" << std::endl;
1828 }
1829 if (fFlagPrint == fCodePrintAllComments) {
1830 std::cout << " Calculation, for all the channels, of the expectation values (over the samples 1 to "
1831 << fNbSampForCalc << ")" << std::endl
1832 << " of the ADC expectation values (over the events)." << std::endl;
1833 }
1834
1835 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1836 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1837 if (fT2d_sig[i0StexEcha][i0Sample] < 0) {
1838 std::cout << "!TEcnaRun::TotalNoise() *** ERROR ***> Negative sigma!" << fTTBELL << std::endl;
1839 } else {
1840 [[clang::suppress]] fT1d_evsamp_of_sigevt[i0StexEcha] += fT2d_sig[i0StexEcha][i0Sample];
1841 }
1842 }
1843 [[clang::suppress]] fT1d_evsamp_of_sigevt[i0StexEcha] /= fNbSampForCalc;
1844 }
1845 fTagTno[0] = 1;
1846 fFileHeader->fTnoCalc++;
1847 }
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861 void TEcnaRun::LowFrequencyNoise() {
1862
1863
1864
1865
1866 if (fT1d_sigevt_of_evsamp == nullptr) {
1867 fT1d_sigevt_of_evsamp = new Double_t[fEcal->MaxCrysEcnaInStex()];
1868 fCnew++;
1869 }
1870 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1871 if (fT1d_sigevt_of_evsamp[i0StexEcha] != (Double_t)0) {
1872 fMiscDiag[13]++;
1873 [[clang::suppress]] fT1d_sigevt_of_evsamp[i0StexEcha] = (Double_t)0;
1874 }
1875 }
1876
1877
1878 TVectorD mean_over_samples(fNumberOfEvents);
1879 for (Int_t i = 0; i < fNumberOfEvents; i++) {
1880 mean_over_samples(i) = (Double_t)0.;
1881 }
1882
1883
1884 if (fFlagPrint != fCodePrintNoComment) {
1885 std::cout << "*TEcnaRun::LowFrequencyNoise()" << std::endl;
1886 }
1887 if (fFlagPrint == fCodePrintAllComments) {
1888 std::cout << " Calculation, for each channel, of the sigma (over the events)" << std::endl
1889 << " of the ADC expectation values (over the samples 1 to " << fNbSampForCalc << ")."
1890 << std::endl;
1891 }
1892
1893 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1894
1895 Double_t mean_over_events = (Double_t)0;
1896 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
1897
1898 mean_over_samples(n_event) = (Double_t)0.;
1899 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1900 mean_over_samples(n_event) += fT3d_AdcValues[i0StexEcha][i0Sample][n_event];
1901 }
1902 mean_over_samples(n_event) /= (Double_t)fNbSampForCalc;
1903
1904 mean_over_events += mean_over_samples(n_event);
1905 }
1906 mean_over_events /= (Double_t)fNumberOfEvents;
1907
1908
1909 Double_t var = (Double_t)0;
1910 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
1911 Double_t ecart = mean_over_samples(n_event) - mean_over_events;
1912 var += ecart * ecart;
1913 }
1914 var /= (Double_t)fNumberOfEvents;
1915
1916 fT1d_sigevt_of_evsamp[i0StexEcha] = sqrt(var);
1917 }
1918 fTagLfn[0] = 1;
1919 fFileHeader->fLfnCalc++;
1920 }
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934 void TEcnaRun::HighFrequencyNoise() {
1935
1936
1937
1938
1939 if (fT1d_evevt_of_sigsamp == nullptr) {
1940 fT1d_evevt_of_sigsamp = new Double_t[fEcal->MaxCrysEcnaInStex()];
1941 fCnew++;
1942 }
1943 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1944 if (fT1d_evevt_of_sigsamp[i0StexEcha] != (Double_t)0) {
1945 fMiscDiag[14]++;
1946 [[clang::suppress]] fT1d_evevt_of_sigsamp[i0StexEcha] = (Double_t)0;
1947 }
1948 }
1949
1950
1951 TVectorD mean_over_samples(fNumberOfEvents);
1952 for (Int_t i = 0; i < fNumberOfEvents; i++) {
1953 mean_over_samples(i) = (Double_t)0.;
1954 }
1955 TVectorD sigma_over_samples(fNumberOfEvents);
1956 for (Int_t i = 0; i < fNumberOfEvents; i++) {
1957 sigma_over_samples(i) = (Double_t)0.;
1958 }
1959
1960
1961 if (fFlagPrint != fCodePrintNoComment) {
1962 std::cout << "*TEcnaRun::HighFrequencyNoise()" << std::endl;
1963 }
1964 if (fFlagPrint == fCodePrintAllComments) {
1965 std::cout << " Calculation, for each channel, of the sigma (over the events)" << std::endl
1966 << " of the ADC expectation values (over the samples 1 to " << fNbSampForCalc << ")."
1967 << std::endl;
1968 }
1969
1970 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1971
1972 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
1973
1974 mean_over_samples(n_event) = (Double_t)0.;
1975 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1976 mean_over_samples(n_event) += fT3d_AdcValues[i0StexEcha][i0Sample][n_event];
1977 }
1978 mean_over_samples(n_event) /= (Double_t)fNbSampForCalc;
1979
1980
1981 Double_t var_over_samples = (Double_t)0;
1982 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1983 Double_t deviation = fT3d_AdcValues[i0StexEcha][i0Sample][n_event] - mean_over_samples(n_event);
1984 var_over_samples += deviation * deviation;
1985 }
1986 var_over_samples /= (Double_t)fNbSampForCalc;
1987
1988 if (var_over_samples < 0) {
1989 std::cout << "!TEcnaRun::HighFrequencyNoise() *** ERROR ***> Negative variance! " << fTTBELL << std::endl;
1990 } else {
1991 sigma_over_samples(n_event) = sqrt(var_over_samples);
1992 }
1993 }
1994
1995
1996 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
1997 fT1d_evevt_of_sigsamp[i0StexEcha] += sigma_over_samples(n_event);
1998 }
1999
2000 fT1d_evevt_of_sigsamp[i0StexEcha] /= (Double_t)fNumberOfEvents;
2001 }
2002 fTagHfn[0] = 1;
2003 fFileHeader->fHfnCalc++;
2004 }
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017 void TEcnaRun::MeanCorrelationsBetweenSamples() {
2018
2019
2020
2021
2022
2023 if (fTagCorCss[0] != 1) {
2024 CorrelationsBetweenSamples();
2025 fTagCorCss[0] = 0;
2026 }
2027
2028
2029 if (fT1d_ev_cor_ss == nullptr) {
2030 Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
2031 fT1d_ev_cor_ss = new Double_t[n_StexEcha];
2032 fCnew++;
2033 }
2034 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2035 if (fT1d_ev_cor_ss[i0StexEcha] != (Double_t)0) {
2036 fMiscDiag[15]++;
2037 fT1d_ev_cor_ss[i0StexEcha] = (Double_t)0;
2038 }
2039 }
2040
2041
2042
2043 Int_t ndim = (Int_t)(fNbSampForCalc * (fNbSampForCalc - 1) / 2);
2044
2045 TVectorD half_cor_ss(ndim);
2046 for (Int_t i = 0; i < ndim; i++) {
2047 half_cor_ss(i) = (Double_t)0.;
2048 }
2049
2050
2051 if (fFlagPrint != fCodePrintNoComment) {
2052 std::cout << "*TEcnaRun::MeanCorrelationsBetweenSamples()" << std::endl;
2053 }
2054 if (fFlagPrint == fCodePrintAllComments) {
2055 std::cout << " Calculation, for all the channels, of the expectation values of the" << std::endl
2056 << " correlations between the first " << fNbSampForCalc << " samples." << std::endl;
2057 }
2058
2059 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2060
2061 Int_t i_count = 0;
2062 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
2063 for (Int_t j0Sample = 0; j0Sample < i0Sample; j0Sample++) {
2064 half_cor_ss(i_count) = fT3d_cor_ss[i0StexEcha][i0Sample][j0Sample];
2065 i_count++;
2066 }
2067 }
2068
2069 fT1d_ev_cor_ss[i0StexEcha] = (Double_t)0;
2070 for (Int_t i_rcor = 0; i_rcor < ndim; i_rcor++) {
2071 fT1d_ev_cor_ss[i0StexEcha] += half_cor_ss(i_rcor);
2072 }
2073 fT1d_ev_cor_ss[i0StexEcha] /= (Double_t)ndim;
2074 }
2075 fTagMeanCorss[0] = 1;
2076 fFileHeader->fMeanCorssCalc++;
2077 }
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090 void TEcnaRun::SigmaOfCorrelationsBetweenSamples() {
2091
2092
2093
2094
2095
2096 if (fTagMeanCorss[0] != 1) {
2097 MeanCorrelationsBetweenSamples();
2098 fTagMeanCorss[0] = 0;
2099 }
2100
2101
2102 if (fT1d_sig_cor_ss == nullptr) {
2103 Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
2104 fT1d_sig_cor_ss = new Double_t[n_StexEcha];
2105 fCnew++;
2106 }
2107 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2108 if (fT1d_sig_cor_ss[i0StexEcha] != (Double_t)0) {
2109 fMiscDiag[16]++;
2110 fT1d_sig_cor_ss[i0StexEcha] = (Double_t)0;
2111 }
2112 }
2113
2114 if (fFlagPrint != fCodePrintNoComment) {
2115 std::cout << "*TEcnaRun::SigmasOfCorrelationsBetweenSamples()" << std::endl;
2116 }
2117 if (fFlagPrint == fCodePrintAllComments) {
2118 std::cout << " Calculation of the sigmas of the (sample,sample)" << std::endl
2119 << " correlations for all the channels." << std::endl;
2120 }
2121
2122
2123
2124 Int_t ndim = (Int_t)(fNbSampForCalc * (fNbSampForCalc - 1) / 2);
2125
2126 TVectorD half_cor_ss(ndim);
2127 for (Int_t i = 0; i < ndim; i++) {
2128 half_cor_ss(i) = (Double_t)0.;
2129 }
2130
2131
2132 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2133
2134 Int_t i_count = 0;
2135 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
2136 for (Int_t j0Sample = 0; j0Sample < i0Sample; j0Sample++) {
2137 half_cor_ss(i_count) = fT3d_cor_ss[i0StexEcha][i0Sample][j0Sample];
2138 i_count++;
2139 }
2140 }
2141
2142
2143 Double_t var = (Double_t)0;
2144 for (Int_t i_rcor = 0; i_rcor < ndim; i_rcor++) {
2145 Double_t ecart = half_cor_ss(i_rcor) - fT1d_ev_cor_ss[i0StexEcha];
2146 var += ecart * ecart;
2147 }
2148 var /= (Double_t)ndim;
2149 fT1d_sig_cor_ss[i0StexEcha] = sqrt(var);
2150 }
2151 fTagSigCorss[0] = 1;
2152 fFileHeader->fSigCorssCalc++;
2153 }
2154
2155
2156
2157
2158
2159
2160
2161
2162 void TEcnaRun::AveragePedestals() {
2163
2164
2165
2166
2167 if (fTagPed[0] != 1) {
2168 Pedestals();
2169 fTagPed[0] = 0;
2170 }
2171
2172 if (fT1d_av_mped == nullptr) {
2173 fT1d_av_mped = new Double_t[fEcal->MaxStinEcnaInStex()];
2174 fCnew++;
2175 }
2176 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2177 if (fT1d_av_mped[i0StexStinEcna] != (Double_t)0) {
2178 fMiscDiag[41]++;
2179 fT1d_av_mped[i0StexStinEcna] = (Double_t)0;
2180 }
2181 }
2182
2183 if (fFlagPrint != fCodePrintNoComment) {
2184 std::cout << "*TEcnaRun::AveragePedestals()" << std::endl;
2185 }
2186 if (fFlagPrint == fCodePrintAllComments) {
2187 std::cout << " Calculation, for all the " << fStinName.Data() << "s, of the average Pedestals"
2188 << std::endl;
2189 }
2190
2191
2192 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2193 Int_t n1StexStinEcna = i0StexStinEcna + 1;
2194 fT1d_av_mped[i0StexStinEcna] = (Double_t)0;
2195 for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2196 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
2197
2198 if (fStexName == "SM ") {
2199 fT1d_av_mped[i0StexStinEcna] += fT1d_ev_ev[i0StexEcha];
2200 }
2201
2202 if (fStexName == "Dee") {
2203
2204
2205
2206 Int_t n1StinEcha = i0StinEcha + 1;
2207 if (n1StexStinEcna == 10 && n1StinEcha == 11) {
2208 i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2209 }
2210 if (n1StexStinEcna == 11 && n1StinEcha == 11) {
2211 i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2212 }
2213 if (!((n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11)) {
2214 fT1d_av_mped[i0StexStinEcna] += fT1d_ev_ev[i0StexEcha];
2215 }
2216 }
2217 }
2218 Double_t xdivis = (Double_t)0.;
2219 if (fStexName == "SM ") {
2220 xdivis = (Double_t)fEcal->MaxCrysInStin();
2221 }
2222 if (fStexName == "Dee") {
2223 xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");
2224 }
2225
2226 fT1d_av_mped[i0StexStinEcna] = fT1d_av_mped[i0StexStinEcna] / xdivis;
2227 }
2228
2229 fTagAvPed[0] = 1;
2230 fFileHeader->fAvPedCalc++;
2231 }
2232
2233
2234
2235
2236
2237
2238 void TEcnaRun::AverageTotalNoise() {
2239
2240
2241
2242
2243 if (fTagTno[0] != 1) {
2244 TotalNoise();
2245 fTagTno[0] = 0;
2246 }
2247
2248 if (fT1d_av_totn == nullptr) {
2249 fT1d_av_totn = new Double_t[fEcal->MaxStinEcnaInStex()];
2250 fCnew++;
2251 }
2252 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2253 if (fT1d_av_totn[i0StexStinEcna] != (Double_t)0) {
2254 fMiscDiag[42]++;
2255 fT1d_av_totn[i0StexStinEcna] = (Double_t)0;
2256 }
2257 }
2258
2259 if (fFlagPrint != fCodePrintNoComment) {
2260 std::cout << "*TEcnaRun::AverageTotalNoise()" << std::endl;
2261 }
2262 if (fFlagPrint == fCodePrintAllComments) {
2263 std::cout << " Calculation, for all the " << fStinName.Data() << "s, of the average total Noise"
2264 << std::endl;
2265 }
2266
2267
2268 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2269 Int_t n1StexStinEcna = i0StexStinEcna + 1;
2270 fT1d_av_totn[i0StexStinEcna] = (Double_t)0;
2271 for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2272 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
2273
2274 if (fStexName == "SM ") {
2275 fT1d_av_totn[i0StexStinEcna] += fT1d_evsamp_of_sigevt[i0StexEcha];
2276 }
2277
2278 if (fStexName == "Dee") {
2279
2280
2281
2282 Int_t n1StinEcha = i0StinEcha + 1;
2283 if (n1StexStinEcna == 10 && n1StinEcha == 11) {
2284 i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2285 }
2286 if (n1StexStinEcna == 11 && n1StinEcha == 11) {
2287 i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2288 }
2289 if (!((n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11)) {
2290 fT1d_av_totn[i0StexStinEcna] += fT1d_evsamp_of_sigevt[i0StexEcha];
2291 }
2292 }
2293 }
2294 Double_t xdivis = (Double_t)0.;
2295 if (fStexName == "SM ") {
2296 xdivis = (Double_t)fEcal->MaxCrysInStin();
2297 }
2298 if (fStexName == "Dee") {
2299 xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");
2300 }
2301
2302 fT1d_av_totn[i0StexStinEcna] = fT1d_av_totn[i0StexStinEcna] / xdivis;
2303 }
2304 fTagAvTno[0] = 1;
2305 fFileHeader->fAvTnoCalc++;
2306 }
2307
2308
2309
2310
2311
2312
2313 void TEcnaRun::AverageLowFrequencyNoise() {
2314
2315
2316
2317
2318 if (fTagLfn[0] != 1) {
2319 LowFrequencyNoise();
2320 fTagLfn[0] = 0;
2321 }
2322
2323 if (fT1d_av_lofn == nullptr) {
2324 fT1d_av_lofn = new Double_t[fEcal->MaxStinEcnaInStex()];
2325 fCnew++;
2326 }
2327 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2328 if (fT1d_av_lofn[i0StexStinEcna] != (Double_t)0) {
2329 fMiscDiag[43]++;
2330 fT1d_av_lofn[i0StexStinEcna] = (Double_t)0;
2331 }
2332 }
2333
2334 if (fFlagPrint != fCodePrintNoComment) {
2335 std::cout << "*TEcnaRun::AverageLowFrequencyNoise()" << std::endl;
2336 }
2337 if (fFlagPrint == fCodePrintAllComments) {
2338 std::cout << " Calculation, for all the " << fStinName.Data() << "s, of the average Low Frequency Noise"
2339 << std::endl;
2340 }
2341
2342
2343 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2344 Int_t n1StexStinEcna = i0StexStinEcna + 1;
2345 fT1d_av_lofn[i0StexStinEcna] = (Double_t)0;
2346 for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2347 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
2348
2349 if (fStexName == "SM ") {
2350 fT1d_av_lofn[i0StexStinEcna] += fT1d_sigevt_of_evsamp[i0StexEcha];
2351 }
2352
2353 if (fStexName == "Dee") {
2354
2355
2356
2357 Int_t n1StinEcha = i0StinEcha + 1;
2358 if (n1StexStinEcna == 10 && n1StinEcha == 11) {
2359 i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2360 }
2361 if (n1StexStinEcna == 11 && n1StinEcha == 11) {
2362 i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2363 }
2364 if (!((n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11)) {
2365 fT1d_av_lofn[i0StexStinEcna] += fT1d_sigevt_of_evsamp[i0StexEcha];
2366 }
2367 }
2368 }
2369 Double_t xdivis = (Double_t)0.;
2370 if (fStexName == "SM ") {
2371 xdivis = (Double_t)fEcal->MaxCrysInStin();
2372 }
2373 if (fStexName == "Dee") {
2374 xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");
2375 }
2376
2377 fT1d_av_lofn[i0StexStinEcna] = fT1d_av_lofn[i0StexStinEcna] / xdivis;
2378 }
2379 fTagAvLfn[0] = 1;
2380 fFileHeader->fAvLfnCalc++;
2381 }
2382
2383
2384
2385
2386
2387
2388 void TEcnaRun::AverageHighFrequencyNoise() {
2389
2390
2391
2392
2393 if (fTagHfn[0] != 1) {
2394 HighFrequencyNoise();
2395 fTagHfn[0] = 0;
2396 }
2397
2398 if (fT1d_av_hifn == nullptr) {
2399 fT1d_av_hifn = new Double_t[fEcal->MaxStinEcnaInStex()];
2400 fCnew++;
2401 }
2402 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2403 if (fT1d_av_hifn[i0StexStinEcna] != (Double_t)0) {
2404 fMiscDiag[44]++;
2405 fT1d_av_hifn[i0StexStinEcna] = (Double_t)0;
2406 }
2407 }
2408
2409 if (fFlagPrint != fCodePrintNoComment) {
2410 std::cout << "*TEcnaRun::AverageHighFrequencyNoise()" << std::endl;
2411 }
2412 if (fFlagPrint == fCodePrintAllComments) {
2413 std::cout << " Calculation, for all the " << fStinName.Data() << "s, of the average High Frequency Noise"
2414 << std::endl;
2415 }
2416
2417
2418 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2419 Int_t n1StexStinEcna = i0StexStinEcna + 1;
2420 fT1d_av_hifn[i0StexStinEcna] = (Double_t)0;
2421 for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2422 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
2423
2424 if (fStexName == "SM ") {
2425 fT1d_av_hifn[i0StexStinEcna] += fT1d_evevt_of_sigsamp[i0StexEcha];
2426 }
2427
2428 if (fStexName == "Dee") {
2429
2430
2431
2432 Int_t n1StinEcha = i0StinEcha + 1;
2433 if (n1StexStinEcna == 10 && n1StinEcha == 11) {
2434 i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2435 }
2436 if (n1StexStinEcna == 11 && n1StinEcha == 11) {
2437 i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2438 }
2439 if (!((n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11)) {
2440 fT1d_av_hifn[i0StexStinEcna] += fT1d_evevt_of_sigsamp[i0StexEcha];
2441 }
2442 }
2443 }
2444 Double_t xdivis = (Double_t)0.;
2445 if (fStexName == "SM ") {
2446 xdivis = (Double_t)fEcal->MaxCrysInStin();
2447 }
2448 if (fStexName == "Dee") {
2449 xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");
2450 }
2451
2452 fT1d_av_hifn[i0StexStinEcna] = fT1d_av_hifn[i0StexStinEcna] / xdivis;
2453 }
2454 fTagAvHfn[0] = 1;
2455 fFileHeader->fAvHfnCalc++;
2456 }
2457
2458
2459
2460
2461
2462
2463 void TEcnaRun::AverageMeanCorrelationsBetweenSamples() {
2464
2465
2466
2467
2468 if (fTagMeanCorss[0] != 1) {
2469 MeanCorrelationsBetweenSamples();
2470 fTagMeanCorss[0] = 0;
2471 }
2472
2473 if (fT1d_av_ev_corss == nullptr) {
2474 fT1d_av_ev_corss = new Double_t[fEcal->MaxStinEcnaInStex()];
2475 fCnew++;
2476 }
2477 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2478 if (fT1d_av_ev_corss[i0StexStinEcna] != (Double_t)0) {
2479 fMiscDiag[45]++;
2480 fT1d_av_ev_corss[i0StexStinEcna] = (Double_t)0;
2481 }
2482 }
2483
2484 if (fFlagPrint != fCodePrintNoComment) {
2485 std::cout << "*TEcnaRun::AverageMeanCorrelationsBetweenSamples()" << std::endl;
2486 }
2487 if (fFlagPrint == fCodePrintAllComments) {
2488 std::cout << " Calculation, for all the " << fStinName.Data() << "s, of the average mean cor(s,s)"
2489 << std::endl;
2490 }
2491
2492
2493 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2494 Int_t n1StexStinEcna = i0StexStinEcna + 1;
2495 fT1d_av_ev_corss[i0StexStinEcna] = (Double_t)0;
2496 for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2497 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
2498
2499 if (fStexName == "SM ") {
2500 fT1d_av_ev_corss[i0StexStinEcna] += fT1d_ev_cor_ss[i0StexEcha];
2501 }
2502
2503 if (fStexName == "Dee") {
2504
2505
2506
2507 Int_t n1StinEcha = i0StinEcha + 1;
2508 if (n1StexStinEcna == 10 && n1StinEcha == 11) {
2509 i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2510 }
2511 if (n1StexStinEcna == 11 && n1StinEcha == 11) {
2512 i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2513 }
2514 if (!((n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11)) {
2515 fT1d_av_ev_corss[i0StexStinEcna] += fT1d_ev_cor_ss[i0StexEcha];
2516 }
2517 }
2518 }
2519 Double_t xdivis = (Double_t)0.;
2520 if (fStexName == "SM ") {
2521 xdivis = (Double_t)fEcal->MaxCrysInStin();
2522 }
2523 if (fStexName == "Dee") {
2524 xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");
2525 }
2526
2527 fT1d_av_ev_corss[i0StexStinEcna] = fT1d_av_ev_corss[i0StexStinEcna] / xdivis;
2528 }
2529 fTagAvMeanCorss[0] = 1;
2530 fFileHeader->fAvMeanCorssCalc++;
2531 }
2532
2533
2534
2535
2536
2537
2538 void TEcnaRun::AverageSigmaOfCorrelationsBetweenSamples() {
2539
2540
2541
2542
2543 if (fTagSigCorss[0] != 1) {
2544 SigmaOfCorrelationsBetweenSamples();
2545 fTagSigCorss[0] = 0;
2546 }
2547
2548 if (fT1d_av_sig_corss == nullptr) {
2549 fT1d_av_sig_corss = new Double_t[fEcal->MaxStinEcnaInStex()];
2550 fCnew++;
2551 }
2552 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2553 if (fT1d_av_sig_corss[i0StexStinEcna] != (Double_t)0) {
2554 fMiscDiag[46]++;
2555 fT1d_av_sig_corss[i0StexStinEcna] = (Double_t)0;
2556 }
2557 }
2558
2559 if (fFlagPrint != fCodePrintNoComment) {
2560 std::cout << "*TEcnaRun::AverageSigmaOfCorrelationsBetweenSamples()" << std::endl;
2561 }
2562 if (fFlagPrint == fCodePrintAllComments) {
2563 std::cout << " Calculation, for all the " << fStinName.Data() << "s, of the average sigma of cor(s,s)"
2564 << std::endl;
2565 }
2566
2567
2568 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2569 Int_t n1StexStinEcna = i0StexStinEcna + 1;
2570 fT1d_av_sig_corss[i0StexStinEcna] = (Double_t)0;
2571 for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2572 Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
2573
2574 if (fStexName == "SM ") {
2575 fT1d_av_sig_corss[i0StexStinEcna] += fT1d_sig_cor_ss[i0StexEcha];
2576 }
2577
2578 if (fStexName == "Dee") {
2579
2580
2581
2582 Int_t n1StinEcha = i0StinEcha + 1;
2583 if (n1StexStinEcna == 10 && n1StinEcha == 11) {
2584 i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2585 }
2586 if (n1StexStinEcna == 11 && n1StinEcha == 11) {
2587 i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2588 }
2589 if (!((n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11)) {
2590 fT1d_av_sig_corss[i0StexStinEcna] += fT1d_sig_cor_ss[i0StexEcha];
2591 }
2592 }
2593 }
2594 Double_t xdivis = (Double_t)0.;
2595 if (fStexName == "SM ") {
2596 xdivis = (Double_t)fEcal->MaxCrysInStin();
2597 }
2598 if (fStexName == "Dee") {
2599 xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");
2600 }
2601
2602 fT1d_av_sig_corss[i0StexStinEcna] = fT1d_av_sig_corss[i0StexStinEcna] / xdivis;
2603 }
2604 fTagAvSigCorss[0] = 1;
2605 fFileHeader->fAvSigCorssCalc++;
2606 }
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633 void TEcnaRun::LowFrequencyCovariancesBetweenChannels() {
2634
2635
2636 if (fFlagPrint != fCodePrintNoComment) {
2637 std::cout << "*TEcnaRun::LowFrequencyCovariancesBetweenChannels()" << std::endl;
2638 }
2639 if (fFlagPrint == fCodePrintAllComments) {
2640 std::cout << " Calculation of the Low Frequency Covariances between channels" << std::endl;
2641 }
2642
2643
2644 if (fT2d_lf_cov == nullptr) {
2645 const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
2646 fT2d_lf_cov = new Double_t*[n_StexEcha];
2647 fCnew++;
2648 fT2d1_lf_cov = new Double_t[n_StexEcha * n_StexEcha];
2649 fCnew++;
2650 for (Int_t i0StexEcha = 0; i0StexEcha < n_StexEcha; i0StexEcha++) {
2651 fT2d_lf_cov[i0StexEcha] = &fT2d1_lf_cov[0] + i0StexEcha * n_StexEcha;
2652 }
2653 }
2654
2655 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2656 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
2657 if (fT2d_lf_cov[i0StexEcha][j0StexEcha] != (Double_t)0) {
2658 fMiscDiag[21]++;
2659 [[clang::suppress]] fT2d_lf_cov[i0StexEcha][j0StexEcha] = (Double_t)0;
2660 }
2661 }
2662 }
2663
2664
2665 TMatrixD mean_over_samples(fEcal->MaxCrysEcnaInStex(), fNumberOfEvents);
2666 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2667 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2668 mean_over_samples(i0StexEcha, n_event) = (Double_t)0.;
2669 }
2670 }
2671
2672 TVectorD MoeOfMos(fEcal->MaxCrysEcnaInStex());
2673 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2674 MoeOfMos(i0StexEcha) = (Double_t)0.;
2675 }
2676
2677
2678 if (fFlagPrint != fCodePrintNoComment) {
2679 std::cout << " Calculation, for each pair of channels, of the covariance (over the events)" << std::endl
2680 << " between the ADC expectation values (over the samples 1 to " << fNbSampForCalc << ")."
2681 << std::endl;
2682 }
2683
2684 std::cout << " Please, wait (end at i= " << fEcal->MaxCrysEcnaInStex() << "): " << std::endl;
2685
2686 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2687 MoeOfMos(i0StexEcha) = (Double_t)0;
2688
2689 if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0) ||
2690 (fFlagSubDet == "EB")) {
2691 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2692
2693 mean_over_samples(i0StexEcha, n_event) = (Double_t)0.;
2694 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
2695 mean_over_samples(i0StexEcha, n_event) += fT3d_AdcValues[i0StexEcha][i0Sample][n_event];
2696 }
2697 mean_over_samples(i0StexEcha, n_event) /= (Double_t)fNbSampForCalc;
2698 }
2699
2700 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2701 MoeOfMos(i0StexEcha) += mean_over_samples(i0StexEcha, n_event);
2702 }
2703 MoeOfMos(i0StexEcha) /= (Double_t)fNumberOfEvents;
2704 }
2705 }
2706
2707
2708 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2709 if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0) ||
2710 (fFlagSubDet == "EB")) {
2711 for (Int_t j0StexEcha = 0; j0StexEcha <= i0StexEcha; j0StexEcha++) {
2712 if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, j0StexEcha) > 0) ||
2713 (fFlagSubDet == "EB")) {
2714 fT2d_lf_cov[i0StexEcha][j0StexEcha] = (Double_t)0;
2715 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2716 fT2d_lf_cov[i0StexEcha][j0StexEcha] += (mean_over_samples(i0StexEcha, n_event) - MoeOfMos(i0StexEcha)) *
2717 (mean_over_samples(j0StexEcha, n_event) - MoeOfMos(j0StexEcha));
2718 }
2719 fT2d_lf_cov[i0StexEcha][j0StexEcha] /= (Double_t)fNumberOfEvents;
2720
2721 fT2d_lf_cov[j0StexEcha][i0StexEcha] = fT2d_lf_cov[i0StexEcha][j0StexEcha];
2722 }
2723 }
2724 if (i0StexEcha % 100 == 0) {
2725 std::cout << i0StexEcha << "[LFN Cov], ";
2726 }
2727 }
2728 }
2729 std::cout << std::endl;
2730 fTagLfCov[0] = 1;
2731 fFileHeader->fLfCovCalc++;
2732 }
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742 void TEcnaRun::LowFrequencyCorrelationsBetweenChannels() {
2743
2744
2745
2746 if (fTagLfCov[0] != 1) {
2747 LowFrequencyCovariancesBetweenChannels();
2748 fTagLfCov[0] = 0;
2749 }
2750
2751 if (fFlagPrint != fCodePrintNoComment) {
2752 std::cout << "*TEcnaRun::LowFrequencyCorrelationsBetweenChannels()" << std::endl;
2753 }
2754 if (fFlagPrint == fCodePrintAllComments) {
2755 std::cout << " Calculation of the Low Frequency Correlations between channels" << std::endl
2756 << " Starting allocation. " << std::endl;
2757 }
2758
2759
2760 if (fT2d_lf_cor == nullptr) {
2761 const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
2762 fT2d_lf_cor = new Double_t*[n_StexEcha];
2763 fCnew++;
2764 fT2d1_lf_cor = new Double_t[n_StexEcha * n_StexEcha];
2765 fCnew++;
2766 for (Int_t i0StexEcha = 0; i0StexEcha < n_StexEcha; i0StexEcha++) {
2767 fT2d_lf_cor[i0StexEcha] = &fT2d1_lf_cor[0] + i0StexEcha * n_StexEcha;
2768 }
2769 }
2770
2771 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2772 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
2773 if (fT2d_lf_cor[i0StexEcha][j0StexEcha] != (Double_t)0) {
2774 fMiscDiag[22]++;
2775 [[clang::suppress]] fT2d_lf_cor[i0StexEcha][j0StexEcha] = (Double_t)0;
2776 }
2777 }
2778 }
2779
2780
2781
2782 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2783 if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0) ||
2784 (fFlagSubDet == "EB")) {
2785 for (Int_t j0StexEcha = 0; j0StexEcha <= i0StexEcha; j0StexEcha++) {
2786 if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, j0StexEcha) > 0) ||
2787 (fFlagSubDet == "EB")) {
2788 if (fT2d_lf_cov[i0StexEcha][i0StexEcha] > 0 && fT2d_lf_cov[j0StexEcha][j0StexEcha] > 0) {
2789 fT2d_lf_cor[i0StexEcha][j0StexEcha] =
2790 fT2d_lf_cov[i0StexEcha][j0StexEcha] /
2791 ((Double_t)sqrt(fT2d_lf_cov[i0StexEcha][i0StexEcha] * fT2d_lf_cov[j0StexEcha][j0StexEcha]));
2792 } else {
2793 fT2d_lf_cor[i0StexEcha][j0StexEcha] = (Double_t)0.;
2794 }
2795 fT2d_lf_cor[j0StexEcha][i0StexEcha] = fT2d_lf_cor[i0StexEcha][j0StexEcha];
2796 }
2797 }
2798 }
2799 if (i0StexEcha % 100 == 0) {
2800 std::cout << i0StexEcha << "[LFN Cor], ";
2801 }
2802 }
2803 std::cout << std::endl;
2804
2805 fTagLfCor[0] = 1;
2806 fFileHeader->fLfCorCalc++;
2807 }
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825 void TEcnaRun::HighFrequencyCovariancesBetweenChannels() {
2826
2827
2828 if (fFlagPrint != fCodePrintNoComment) {
2829 std::cout << "*TEcnaRun::HighFrequencyCovariancesBetweenChannels()" << std::endl;
2830 }
2831 if (fFlagPrint == fCodePrintAllComments) {
2832 std::cout << " Calculation of the High Frequency Covariances between channels" << std::endl;
2833 }
2834
2835
2836 if (fT2d_hf_cov == nullptr) {
2837 const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
2838 fT2d_hf_cov = new Double_t*[n_StexEcha];
2839 fCnew++;
2840 fT2d1_hf_cov = new Double_t[n_StexEcha * n_StexEcha];
2841 fCnew++;
2842 for (Int_t i0StexEcha = 0; i0StexEcha < n_StexEcha; i0StexEcha++) {
2843 fT2d_hf_cov[i0StexEcha] = &fT2d1_hf_cov[0] + i0StexEcha * n_StexEcha;
2844 }
2845 }
2846
2847 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2848 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
2849 if (fT2d_hf_cov[i0StexEcha][j0StexEcha] != (Double_t)0) {
2850 fMiscDiag[23]++;
2851 [[clang::suppress]] fT2d_hf_cov[i0StexEcha][j0StexEcha] = (Double_t)0;
2852 }
2853 }
2854 }
2855
2856
2857 TMatrixD mean_over_samples(fEcal->MaxCrysEcnaInStex(), fNumberOfEvents);
2858 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2859 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2860 mean_over_samples(i0StexEcha, n_event) = (Double_t)0.;
2861 }
2862 }
2863
2864 TMatrixD cov_over_samp(fEcal->MaxCrysEcnaInStex(), fEcal->MaxCrysEcnaInStex());
2865 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2866 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
2867 cov_over_samp(i0StexEcha, j0StexEcha) = (Double_t)0.;
2868 }
2869 }
2870
2871
2872 if (fFlagPrint != fCodePrintNoComment) {
2873 std::cout << " Calculation of the mean (over the events)" << std::endl
2874 << " of the covariances between the channels (over the samples 1 to " << fNbSampForCalc << ")."
2875 << std::endl;
2876 }
2877
2878 std::cout << " Please, wait (end at i= " << fEcal->MaxCrysEcnaInStex() << "): " << std::endl;
2879
2880 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2881 if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0) ||
2882 (fFlagSubDet == "EB")) {
2883 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2884
2885 mean_over_samples(i0StexEcha, n_event) = (Double_t)0.;
2886 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
2887 mean_over_samples(i0StexEcha, n_event) += fT3d_AdcValues[i0StexEcha][i0Sample][n_event];
2888 }
2889 mean_over_samples(i0StexEcha, n_event) /= (Double_t)fNbSampForCalc;
2890 }
2891 }
2892 if (i0StexEcha % 100 == 0) {
2893 std::cout << i0StexEcha << "[HFNa Cov], ";
2894 }
2895 }
2896 std::cout << std::endl;
2897
2898 std::cout << " Please, wait (end at i= " << fEcal->MaxCrysEcnaInStex() << "): " << std::endl;
2899
2900
2901 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2902 if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0) ||
2903 (fFlagSubDet == "EB")) {
2904 for (Int_t j0StexEcha = 0; j0StexEcha <= i0StexEcha; j0StexEcha++) {
2905 if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, j0StexEcha) > 0) ||
2906 (fFlagSubDet == "EB")) {
2907 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2908
2909 cov_over_samp(i0StexEcha, j0StexEcha) = (Double_t)0;
2910 for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
2911 cov_over_samp(i0StexEcha, j0StexEcha) +=
2912 (fT3d_AdcValues[i0StexEcha][i0Sample][n_event] - mean_over_samples(i0StexEcha, n_event)) *
2913 (fT3d_AdcValues[j0StexEcha][i0Sample][n_event] - mean_over_samples(j0StexEcha, n_event));
2914 }
2915 cov_over_samp(i0StexEcha, j0StexEcha) /= (Double_t)fNbSampForCalc;
2916 }
2917
2918
2919 fT2d_hf_cov[i0StexEcha][j0StexEcha] = (Double_t)0;
2920 for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2921 fT2d_hf_cov[i0StexEcha][j0StexEcha] += cov_over_samp(i0StexEcha, j0StexEcha);
2922 }
2923 fT2d_hf_cov[i0StexEcha][j0StexEcha] /= (Double_t)fNumberOfEvents;
2924
2925 fT2d_hf_cov[j0StexEcha][i0StexEcha] = fT2d_hf_cov[i0StexEcha][j0StexEcha];
2926 }
2927 }
2928 }
2929 if (i0StexEcha % 100 == 0) {
2930 std::cout << i0StexEcha << "[HFNb Cov], ";
2931 }
2932 }
2933 std::cout << std::endl;
2934
2935 fTagHfCov[0] = 1;
2936 fFileHeader->fHfCovCalc++;
2937 }
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947 void TEcnaRun::HighFrequencyCorrelationsBetweenChannels() {
2948
2949
2950
2951 if (fTagHfCov[0] != 1) {
2952 HighFrequencyCovariancesBetweenChannels();
2953 fTagHfCov[0] = 0;
2954 }
2955
2956 if (fFlagPrint != fCodePrintNoComment) {
2957 std::cout << "*TEcnaRun::HighFrequencyCorrelationsBetweenChannels()" << std::endl;
2958 }
2959 if (fFlagPrint == fCodePrintAllComments) {
2960 std::cout << " Calculation of the High Frequency Correlations between channels" << std::endl
2961 << " Starting allocation. " << std::endl;
2962 }
2963
2964
2965 if (fT2d_hf_cor == nullptr) {
2966 const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
2967 fT2d_hf_cor = new Double_t*[n_StexEcha];
2968 fCnew++;
2969 fT2d1_hf_cor = new Double_t[n_StexEcha * n_StexEcha];
2970 fCnew++;
2971 for (Int_t i0StexEcha = 0; i0StexEcha < n_StexEcha; i0StexEcha++) {
2972 fT2d_hf_cor[i0StexEcha] = &fT2d1_hf_cor[0] + i0StexEcha * n_StexEcha;
2973 }
2974 }
2975
2976 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2977 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
2978 if (fT2d_hf_cor[i0StexEcha][j0StexEcha] != (Double_t)0) {
2979 fMiscDiag[24]++;
2980 [[clang::suppress]] fT2d_hf_cor[i0StexEcha][j0StexEcha] = (Double_t)0;
2981 }
2982 }
2983 }
2984
2985
2986
2987
2988 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2989 if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0) ||
2990 (fFlagSubDet == "EB")) {
2991 for (Int_t j0StexEcha = 0; j0StexEcha <= i0StexEcha; j0StexEcha++) {
2992 if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, j0StexEcha) > 0) ||
2993 (fFlagSubDet == "EB")) {
2994 if (fT2d_hf_cov[i0StexEcha][i0StexEcha] > 0 && fT2d_hf_cov[j0StexEcha][j0StexEcha] > 0) {
2995 fT2d_hf_cor[i0StexEcha][j0StexEcha] =
2996 fT2d_hf_cov[i0StexEcha][j0StexEcha] / ((Double_t)sqrt(fT2d_hf_cov[i0StexEcha][i0StexEcha]) *
2997 (Double_t)sqrt(fT2d_hf_cov[j0StexEcha][j0StexEcha]));
2998 } else {
2999 fT2d_hf_cor[i0StexEcha][j0StexEcha] = (Double_t)0.;
3000 }
3001
3002 fT2d_hf_cor[j0StexEcha][i0StexEcha] = fT2d_hf_cor[i0StexEcha][j0StexEcha];
3003 }
3004 }
3005 }
3006 if (i0StexEcha % 100 == 0) {
3007 std::cout << i0StexEcha << "[HFN Cor], ";
3008 }
3009 }
3010 std::cout << std::endl;
3011
3012 fTagHfCor[0] = 1;
3013 fFileHeader->fHfCorCalc++;
3014 }
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028 void TEcnaRun::LowFrequencyMeanCorrelationsBetweenTowers() { LowFrequencyMeanCorrelationsBetweenStins(); }
3029 void TEcnaRun::LowFrequencyMeanCorrelationsBetweenSCs() { LowFrequencyMeanCorrelationsBetweenStins(); }
3030
3031 void TEcnaRun::LowFrequencyMeanCorrelationsBetweenStins() {
3032
3033
3034
3035
3036
3037 if (fTagLfCor[0] != 1) {
3038 LowFrequencyCorrelationsBetweenChannels();
3039 fTagLfCor[0] = 0;
3040 }
3041
3042
3043 if (fFlagPrint != fCodePrintNoComment) {
3044 std::cout << "*TEcnaRun::LowFrequencyMeanCorrelationsBetweenStins()" << std::endl;
3045 }
3046 if (fFlagPrint == fCodePrintAllComments) {
3047 std::cout << " Calculation of the mean, for each " << fStinName.Data() << ", of the" << std::endl
3048 << " Low Frequency Correlations between channels." << std::endl;
3049 }
3050
3051
3052 if (fT2d_lfcc_mostins == nullptr) {
3053 const Int_t n_Stin = fEcal->MaxStinEcnaInStex();
3054 fT2d_lfcc_mostins = new Double_t*[n_Stin];
3055 fCnew++;
3056 fT2d1_lfcc_mostins = new Double_t[n_Stin * n_Stin];
3057 fCnew++;
3058 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < n_Stin; i0StexStinEcna++) {
3059 fT2d_lfcc_mostins[i0StexStinEcna] = &fT2d1_lfcc_mostins[0] + i0StexStinEcna * n_Stin;
3060 }
3061 }
3062
3063 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
3064 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
3065 if (fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] != (Double_t)0) {
3066 fMiscDiag[31]++;
3067 [[clang::suppress]] fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] = (Double_t)0;
3068 }
3069 }
3070 }
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081 Int_t ndim = (Int_t)(fEcal->MaxCrysInStin() * fEcal->MaxCrysInStin());
3082
3083 TVectorD half_LFccMos(ndim);
3084 for (Int_t i = 0; i < ndim; i++) {
3085 half_LFccMos(i) = (Double_t)0.;
3086 }
3087
3088
3089 if (fFlagPrint != fCodePrintNoComment) {
3090 std::cout << "*TEcnaRun::LowFrequencyMeanCorrelationsBetweenStins()" << std::endl;
3091 }
3092 if (fFlagPrint == fCodePrintAllComments) {
3093 std::cout << " Calculation, for each " << fStinName.Data() << ", of the mean " << std::endl
3094 << " Low Frequency cor(c,c)." << std::endl;
3095 }
3096
3097 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
3098 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
3099
3100 Int_t i_count = 0;
3101 for (Int_t i0StinCrys = 0; i0StinCrys < fEcal->MaxCrysInStin(); i0StinCrys++) {
3102 Int_t i0StexEcha = i0StexStinEcna * fEcal->MaxCrysInStin() + i0StinCrys;
3103 for (Int_t j0StinCrys = 0; j0StinCrys < fEcal->MaxCrysInStin(); j0StinCrys++) {
3104 Int_t j0StexEcha = j0StexStinEcna * fEcal->MaxCrysInStin() + j0StinCrys;
3105 if ((i0StexEcha >= 0 && i0StexEcha < fEcal->MaxCrysEcnaInStex()) &&
3106 (j0StexEcha >= 0 && j0StexEcha < fEcal->MaxCrysEcnaInStex())) {
3107 half_LFccMos(i_count) = fT2d_lf_cor[i0StexEcha][j0StexEcha];
3108 i_count++;
3109 } else {
3110 std::cout << "!TEcnaRun::LowFrequencyMeanCorrelationsBetweenStins()> Channel number out of range."
3111 << "i0StexEcha = " << i0StexEcha << ", j0StexEcha = " << j0StexEcha << fTTBELL << std::endl;
3112 }
3113 }
3114 }
3115
3116 [[clang::suppress]] fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] = (Double_t)0;
3117 for (Int_t i_rcor = 0; i_rcor < ndim; i_rcor++) {
3118 [[clang::suppress]] fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] += fabs(half_LFccMos(i_rcor));
3119 }
3120 [[clang::suppress]] fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] /= (Double_t)ndim;
3121 }
3122 if (i0StexStinEcna % 10 == 0) {
3123 std::cout << i0StexStinEcna << "[LFN MCtt], ";
3124 }
3125 }
3126 std::cout << std::endl;
3127
3128 fTagLFccMoStins[0] = 1;
3129 fFileHeader->fLFccMoStinsCalc++;
3130 }
3131
3132
3133
3134
3135
3136 void TEcnaRun::HighFrequencyMeanCorrelationsBetweenTowers() { HighFrequencyMeanCorrelationsBetweenStins(); }
3137 void TEcnaRun::HighFrequencyMeanCorrelationsBetweenSCs() { HighFrequencyMeanCorrelationsBetweenStins(); }
3138
3139 void TEcnaRun::HighFrequencyMeanCorrelationsBetweenStins() {
3140
3141
3142
3143
3144
3145 if (fTagHfCor[0] != 1) {
3146 HighFrequencyCorrelationsBetweenChannels();
3147 fTagHfCor[0] = 0;
3148 }
3149
3150
3151 if (fFlagPrint != fCodePrintNoComment) {
3152 std::cout << "*TEcnaRun::HighFrequencyMeanCorrelationsBetweenStins()" << std::endl;
3153 }
3154 if (fFlagPrint == fCodePrintAllComments) {
3155 std::cout << " Calculation of the mean, for each " << fFlagSubDet.Data() << ", of the" << std::endl
3156 << " High Frequency Correlations between channels." << std::endl;
3157 }
3158
3159
3160 if (fT2d_hfcc_mostins == nullptr) {
3161 const Int_t n_Stin = fEcal->MaxStinEcnaInStex();
3162 fT2d_hfcc_mostins = new Double_t*[n_Stin];
3163 fCnew++;
3164 fT2d1_hfcc_mostins = new Double_t[n_Stin * n_Stin];
3165 fCnew++;
3166 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < n_Stin; i0StexStinEcna++) {
3167 fT2d_hfcc_mostins[i0StexStinEcna] = &fT2d1_hfcc_mostins[0] + i0StexStinEcna * n_Stin;
3168 }
3169 }
3170
3171 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
3172 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
3173 if (fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] != (Double_t)0) {
3174 fMiscDiag[32]++;
3175 [[clang::suppress]] fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] = (Double_t)0;
3176 }
3177 }
3178 }
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189 Int_t ndim = (Int_t)(fEcal->MaxCrysInStin() * fEcal->MaxCrysInStin());
3190
3191 TVectorD half_HFccMos(ndim);
3192 for (Int_t i = 0; i < ndim; i++) {
3193 half_HFccMos(i) = (Double_t)0.;
3194 }
3195
3196 if (fFlagPrint != fCodePrintNoComment) {
3197 std::cout << "*TEcnaRun::HighFrequencyMeanCorrelationsBetweenStins()" << std::endl;
3198 }
3199 if (fFlagPrint == fCodePrintAllComments) {
3200 std::cout << " Calculation, for each " << fFlagSubDet.Data() << ", of the mean " << std::endl
3201 << " High Frequency cor(c,c)." << std::endl;
3202 }
3203
3204
3205 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
3206 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
3207
3208 Int_t i_count = 0;
3209 for (Int_t i0StinCrys = 0; i0StinCrys < fEcal->MaxCrysInStin(); i0StinCrys++) {
3210 Int_t i0StexEcha = i0StexStinEcna * fEcal->MaxCrysInStin() + i0StinCrys;
3211 for (Int_t j0StinCrys = 0; j0StinCrys < fEcal->MaxCrysInStin(); j0StinCrys++) {
3212 Int_t j0StexEcha = j0StexStinEcna * fEcal->MaxCrysInStin() + j0StinCrys;
3213 if ((i0StexEcha >= 0 && i0StexEcha < fEcal->MaxCrysEcnaInStex()) &&
3214 (j0StexEcha >= 0 && j0StexEcha < fEcal->MaxCrysEcnaInStex())) {
3215 half_HFccMos(i_count) = fT2d_hf_cor[i0StexEcha][j0StexEcha];
3216 i_count++;
3217 } else {
3218 std::cout << "!TEcnaRun::HighFrequencyMeanCorrelationsBetweenStins()> Channel number out of range."
3219 << "i0StexEcha = " << i0StexEcha << ", j0StexEcha = " << j0StexEcha << fTTBELL << std::endl;
3220 }
3221 }
3222 }
3223
3224 fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] = (Double_t)0;
3225 for (Int_t i_rcor = 0; i_rcor < ndim; i_rcor++) {
3226 [[clang::suppress]] fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] += fabs(half_HFccMos(i_rcor));
3227 }
3228 [[clang::suppress]] fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] /= (Double_t)ndim;
3229 }
3230 if (i0StexStinEcna % 10 == 0) {
3231 std::cout << i0StexStinEcna << "[HFN MCtt], ";
3232 }
3233 }
3234 std::cout << std::endl;
3235
3236 fTagHFccMoStins[0] = 1;
3237 fFileHeader->fHFccMoStinsCalc++;
3238 }
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256 Bool_t TEcnaRun::OpenRootFile(const Text_t* name, const TString& status) {
3257
3258
3259 Bool_t ok_open = kFALSE;
3260
3261 TString s_name;
3262 s_name = fCnaParPaths->ResultsRootFilePath();
3263 s_name.Append('/');
3264 s_name.Append(name);
3265
3266
3267
3268 Long_t iCnaRootFile = fObjectManager->GetPointerValue("TEcnaRootFile");
3269 if (iCnaRootFile == 0) {
3270 gCnaRootFile = new TEcnaRootFile(fObjectManager, s_name.Data(), status);
3271 } else {
3272 gCnaRootFile = (TEcnaRootFile*)iCnaRootFile;
3273 gCnaRootFile->ReStart(s_name.Data(), status);
3274 }
3275
3276 if (gCnaRootFile->fRootFileStatus == "RECREATE") {
3277 ok_open = gCnaRootFile->OpenW();
3278 }
3279 if (gCnaRootFile->fRootFileStatus == "READ") {
3280 ok_open = gCnaRootFile->OpenR();
3281 }
3282
3283 if (!ok_open)
3284 {
3285 std::cout << "TEcnaRun::OpenRootFile> Cannot open file " << s_name.Data() << std::endl;
3286 } else {
3287 if (fFlagPrint == fCodePrintAllComments) {
3288 std::cout << "*TEcnaRun::OpenRootFile> Open ROOT file OK for file " << s_name.Data() << std::endl;
3289 }
3290 fOpenRootFile = kTRUE;
3291 }
3292 return ok_open;
3293 }
3294
3295
3296
3297
3298
3299 Bool_t TEcnaRun::CloseRootFile(const Text_t* name) {
3300
3301
3302 TString s_name;
3303 s_name = fCnaParPaths->ResultsRootFilePath();
3304 s_name.Append('/');
3305 s_name.Append(name);
3306
3307 Bool_t ok_close = kFALSE;
3308
3309 if (fOpenRootFile == kTRUE) {
3310 gCnaRootFile->CloseFile();
3311
3312 if (fFlagPrint != fCodePrintAllComments) {
3313 std::cout << "*TEcnaRun::CloseRootFile> ROOT file " << s_name.Data() << " closed." << std::endl;
3314 }
3315
3316
3317
3318 fOpenRootFile = kFALSE;
3319 ok_close = kTRUE;
3320 } else {
3321 std::cout << "*TEcnaRun::CloseRootFile(...)> No close since no file is open." << fTTBELL << std::endl;
3322 }
3323 return ok_close;
3324 }
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342 Bool_t TEcnaRun::WriteRootFile() {
3343
3344
3345
3346
3347 Bool_t ok_write = kFALSE;
3348
3349
3350 Int_t nCountEvts = 0;
3351
3352 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
3353 for (Int_t i0Sample = 0; i0Sample < fFileHeader->fNbOfSamples; i0Sample++) {
3354 nCountEvts += fT2d_NbOfEvts[i0StexEcha][i0Sample];
3355 }
3356 }
3357
3358 if (nCountEvts <= 0) {
3359
3360 std::cout << "!TEcnaRun::WriteRootFile()> No event found for file " << fCnaWrite->GetRootFileNameShort().Data()
3361 << ". File will not be written." << std::endl;
3362 ok_write = kTRUE;
3363 } else {
3364 if (fFlagPrint == fCodePrintAllComments) {
3365 std::cout << "*TEcnaRun::WriteRootFile()> Results are going to be written in the ROOT file: " << std::endl
3366 << " " << fCnaWrite->GetRootFileName().Data() << std::endl;
3367 }
3368
3369 const Text_t* FileShortName = (const Text_t*)fCnaWrite->GetRootFileNameShort().Data();
3370 ok_write = WriteRootFile(FileShortName, fFileHeader->fNbOfSamples);
3371
3372 if (ok_write == kTRUE) {
3373 if (fFlagPrint != fCodePrintNoComment) {
3374 std::cout << "*TEcnaRun::WriteRootFile()> Writing OK for file " << fCnaWrite->GetRootFileName().Data()
3375 << std::endl;
3376 }
3377 } else {
3378 std::cout << "!TEcnaRun::WriteRootFile()> Writing FAILLED for file " << fCnaWrite->GetRootFileName().Data()
3379 << fTTBELL << std::endl;
3380 }
3381 }
3382 return ok_write;
3383 }
3384
3385
3386
3387
3388
3389
3390
3391
3392 Bool_t TEcnaRun::WriteNewRootFile(const TString& TypAna) {
3393
3394
3395
3396 Bool_t ok_write = kFALSE;
3397
3398 fCnaWrite->RegisterFileParameters(TypAna.Data(),
3399 fNbSampForCalc,
3400 fFileHeader->fRunNumber,
3401 fFileHeader->fFirstReqEvtNumber,
3402 fFileHeader->fLastReqEvtNumber,
3403 fFileHeader->fReqNbOfEvts,
3404 fFileHeader->fStex,
3405 fFileHeader->fStartDate,
3406 fFileHeader->fStopDate,
3407 fFileHeader->fStartTime,
3408 fFileHeader->fStopTime);
3409
3410 fCnaWrite->fMakeResultsFileName();
3411 fNewRootFileName = fCnaWrite->GetRootFileName();
3412 fNewRootFileNameShort = fCnaWrite->GetRootFileNameShort();
3413
3414 const Text_t* FileShortName = (const Text_t*)fNewRootFileNameShort.Data();
3415
3416 if (fFlagPrint == fCodePrintAllComments) {
3417 std::cout << "*TEcnaRun::WriteNewRootFile()> Results are going to be written in the ROOT file: " << std::endl
3418 << " " << fNewRootFileNameShort.Data() << std::endl;
3419 }
3420
3421 ok_write = WriteRootFile(FileShortName, fNbSampForCalc);
3422
3423 return ok_write;
3424 }
3425
3426
3427
3428
3429
3430
3431
3432 const TString& TEcnaRun::GetNewRootFileName() const { return fNewRootFileName; }
3433 const TString& TEcnaRun::GetNewRootFileNameShort() const { return fNewRootFileNameShort; }
3434
3435
3436
3437
3438
3439
3440 Bool_t TEcnaRun::WriteRootFile(const Text_t* name, Int_t& argNbSampWrite) {
3441
3442
3443 const Text_t* file_name = name;
3444
3445 Bool_t ok_write = kFALSE;
3446
3447 if (fOpenRootFile) {
3448 std::cout << "!TEcnaRun::WriteRootFile(...) *** ERROR ***> Writing on file already open." << fTTBELL << std::endl;
3449 } else {
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494 OpenRootFile(file_name, "RECREATE");
3495
3496 TString typ_name = "?";
3497 Int_t v_nb_times = 0;
3498 Int_t v_dim_one = 0;
3499 Int_t v_dim_two = 0;
3500 Int_t v_size = 0;
3501 Int_t v_tot = 0;
3502 Int_t v_tot_writ = 0;
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515 Int_t MaxCar = fgMaxCar;
3516 typ_name.Resize(MaxCar);
3517 typ_name = "StinNumbers";
3518 v_nb_times = fFileHeader->fStinNumbersCalc;
3519 v_dim_one = 1;
3520 v_dim_two = fEcal->MaxStinEcnaInStex();
3521 v_size = v_nb_times * v_dim_one * v_dim_two;
3522 v_tot += v_size;
3523
3524 if (fFlagPrint == fCodePrintAllComments) {
3525 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3526 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3527 << v_size;
3528 }
3529
3530 for (Int_t i = 0; i < v_nb_times; i++) {
3531 if (fTagStinNumbers[0] == 1) {
3532 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypNumbers;
3533 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3534 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3535 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3536 TRootStinNumbers();
3537 gCnaRootFile->fCnaResultsTree->Fill();
3538 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3539 std::cout << " => WRITTEN ON FILE ";
3540 v_tot_writ += v_size;
3541 }
3542 }
3543 }
3544 if (fFlagPrint == fCodePrintAllComments) {
3545 std::cout << std::endl;
3546 }
3547
3548
3549
3550
3551 MaxCar = fgMaxCar;
3552 typ_name.Resize(MaxCar);
3553 typ_name = "AvPed";
3554 v_nb_times = fFileHeader->fAvPedCalc;
3555 v_dim_one = 1;
3556 v_dim_two = fEcal->MaxStinEcnaInStex();
3557 v_size = v_nb_times * v_dim_one * v_dim_two;
3558 v_tot += v_size;
3559
3560 if (fFlagPrint == fCodePrintAllComments) {
3561 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3562 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3563 << v_size;
3564 }
3565
3566 for (Int_t i = 0; i < v_nb_times; i++) {
3567 if (fTagAvPed[0] == 1) {
3568 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAvPed;
3569 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3570 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3571 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3572 TRootAvPed();
3573 gCnaRootFile->fCnaResultsTree->Fill();
3574 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3575 std::cout << " => WRITTEN ON FILE ";
3576 v_tot_writ += v_size;
3577 }
3578 }
3579 }
3580 if (fFlagPrint == fCodePrintAllComments) {
3581 std::cout << std::endl;
3582 }
3583
3584
3585
3586
3587 MaxCar = fgMaxCar;
3588 typ_name.Resize(MaxCar);
3589 typ_name = "AvTno";
3590 v_nb_times = fFileHeader->fAvTnoCalc;
3591 v_dim_one = 1;
3592 v_dim_two = fEcal->MaxStinEcnaInStex();
3593 v_size = v_nb_times * v_dim_one * v_dim_two;
3594 v_tot += v_size;
3595
3596 if (fFlagPrint == fCodePrintAllComments) {
3597 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3598 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3599 << v_size;
3600 }
3601
3602 for (Int_t i = 0; i < v_nb_times; i++) {
3603 if (fTagAvTno[0] == 1) {
3604 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAvTno;
3605 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3606 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3607 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3608 TRootAvTno();
3609 gCnaRootFile->fCnaResultsTree->Fill();
3610 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3611 std::cout << " => WRITTEN ON FILE ";
3612 v_tot_writ += v_size;
3613 }
3614 }
3615 }
3616 if (fFlagPrint == fCodePrintAllComments) {
3617 std::cout << std::endl;
3618 }
3619
3620
3621
3622
3623 MaxCar = fgMaxCar;
3624 typ_name.Resize(MaxCar);
3625 typ_name = "AvLfn";
3626 v_nb_times = fFileHeader->fAvLfnCalc;
3627 v_dim_one = 1;
3628 v_dim_two = fEcal->MaxStinEcnaInStex();
3629 v_size = v_nb_times * v_dim_one * v_dim_two;
3630 v_tot += v_size;
3631
3632 if (fFlagPrint == fCodePrintAllComments) {
3633 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3634 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3635 << v_size;
3636 }
3637
3638 for (Int_t i = 0; i < v_nb_times; i++) {
3639 if (fTagAvLfn[0] == 1) {
3640 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAvLfn;
3641 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3642 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3643 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3644 TRootAvLfn();
3645 gCnaRootFile->fCnaResultsTree->Fill();
3646 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3647 std::cout << " => WRITTEN ON FILE ";
3648 v_tot_writ += v_size;
3649 }
3650 }
3651 }
3652 if (fFlagPrint == fCodePrintAllComments) {
3653 std::cout << std::endl;
3654 }
3655
3656
3657
3658
3659 MaxCar = fgMaxCar;
3660 typ_name.Resize(MaxCar);
3661 typ_name = "AvHfn";
3662 v_nb_times = fFileHeader->fAvHfnCalc;
3663 v_dim_one = 1;
3664 v_dim_two = fEcal->MaxStinEcnaInStex();
3665 v_size = v_nb_times * v_dim_one * v_dim_two;
3666 v_tot += v_size;
3667
3668 if (fFlagPrint == fCodePrintAllComments) {
3669 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3670 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3671 << v_size;
3672 }
3673
3674 for (Int_t i = 0; i < v_nb_times; i++) {
3675 if (fTagAvHfn[0] == 1) {
3676 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAvHfn;
3677 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3678 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3679 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3680 TRootAvHfn();
3681 gCnaRootFile->fCnaResultsTree->Fill();
3682 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3683 std::cout << " => WRITTEN ON FILE ";
3684 v_tot_writ += v_size;
3685 }
3686 }
3687 }
3688 if (fFlagPrint == fCodePrintAllComments) {
3689 std::cout << std::endl;
3690 }
3691
3692
3693
3694
3695 MaxCar = fgMaxCar;
3696 typ_name.Resize(MaxCar);
3697 typ_name = "AvMeanCorss";
3698 v_nb_times = fFileHeader->fAvMeanCorssCalc;
3699 v_dim_one = 1;
3700 v_dim_two = fEcal->MaxStinEcnaInStex();
3701 v_size = v_nb_times * v_dim_one * v_dim_two;
3702 v_tot += v_size;
3703
3704 if (fFlagPrint == fCodePrintAllComments) {
3705 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3706 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3707 << v_size;
3708 }
3709
3710 for (Int_t i = 0; i < v_nb_times; i++) {
3711 if (fTagAvMeanCorss[0] == 1) {
3712 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAvMeanCorss;
3713 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3714 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3715 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3716 TRootAvEvCorss();
3717 gCnaRootFile->fCnaResultsTree->Fill();
3718 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3719 std::cout << " => WRITTEN ON FILE ";
3720 v_tot_writ += v_size;
3721 }
3722 }
3723 }
3724 if (fFlagPrint == fCodePrintAllComments) {
3725 std::cout << std::endl;
3726 }
3727
3728
3729
3730
3731 MaxCar = fgMaxCar;
3732 typ_name.Resize(MaxCar);
3733 typ_name = "AvSigCorss";
3734 v_nb_times = fFileHeader->fAvSigCorssCalc;
3735 v_dim_one = 1;
3736 v_dim_two = fEcal->MaxStinEcnaInStex();
3737 v_size = v_nb_times * v_dim_one * v_dim_two;
3738 v_tot += v_size;
3739
3740 if (fFlagPrint == fCodePrintAllComments) {
3741 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3742 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3743 << v_size;
3744 }
3745
3746 for (Int_t i = 0; i < v_nb_times; i++) {
3747 if (fTagAvSigCorss[0] == 1) {
3748 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAvSigCorss;
3749 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3750 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3751 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3752 TRootAvSigCorss();
3753 gCnaRootFile->fCnaResultsTree->Fill();
3754 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3755 std::cout << " => WRITTEN ON FILE ";
3756 v_tot_writ += v_size;
3757 }
3758 }
3759 }
3760 if (fFlagPrint == fCodePrintAllComments) {
3761 std::cout << std::endl;
3762 }
3763
3764
3765
3766
3767 MaxCar = fgMaxCar;
3768 typ_name.Resize(MaxCar);
3769 typ_name = "Ped";
3770 v_nb_times = fFileHeader->fPedCalc;
3771 v_dim_one = 1;
3772 v_dim_two = fEcal->MaxCrysEcnaInStex();
3773 v_size = v_nb_times * v_dim_one * v_dim_two;
3774 v_tot += v_size;
3775
3776 if (fFlagPrint == fCodePrintAllComments) {
3777 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3778 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3779 << v_size;
3780 }
3781
3782 for (Int_t i = 0; i < v_nb_times; i++) {
3783 if (fTagPed[0] == 1) {
3784 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypPed;
3785 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3786 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3787 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3788 TRootPed();
3789 gCnaRootFile->fCnaResultsTree->Fill();
3790 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3791 std::cout << " => WRITTEN ON FILE ";
3792 v_tot_writ += v_size;
3793 }
3794 }
3795 }
3796 if (fFlagPrint == fCodePrintAllComments) {
3797 std::cout << std::endl;
3798 }
3799
3800
3801
3802
3803 MaxCar = fgMaxCar;
3804 typ_name.Resize(MaxCar);
3805 typ_name = "Tno";
3806 v_nb_times = fFileHeader->fTnoCalc;
3807 v_dim_one = 1;
3808 v_dim_two = fEcal->MaxCrysEcnaInStex();
3809 v_size = v_nb_times * v_dim_one * v_dim_two;
3810 v_tot += v_size;
3811
3812 if (fFlagPrint == fCodePrintAllComments) {
3813 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3814 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3815 << v_size;
3816 }
3817
3818 for (Int_t i = 0; i < v_nb_times; i++) {
3819 if (fTagTno[0] == 1) {
3820 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypTno;
3821 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3822 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3823 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3824 TRootTno();
3825 gCnaRootFile->fCnaResultsTree->Fill();
3826 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3827 std::cout << " => WRITTEN ON FILE ";
3828 v_tot_writ += v_size;
3829 }
3830 }
3831 }
3832 if (fFlagPrint == fCodePrintAllComments) {
3833 std::cout << std::endl;
3834 }
3835
3836
3837
3838
3839 MaxCar = fgMaxCar;
3840 typ_name.Resize(MaxCar);
3841 typ_name = "MeanCorss";
3842 v_nb_times = fFileHeader->fMeanCorssCalc;
3843 v_dim_one = 1;
3844 v_dim_two = fEcal->MaxCrysEcnaInStex();
3845 v_size = v_nb_times * v_dim_one * v_dim_two;
3846 v_tot += v_size;
3847
3848 if (fFlagPrint == fCodePrintAllComments) {
3849 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3850 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3851 << v_size;
3852 }
3853
3854 for (Int_t i = 0; i < v_nb_times; i++) {
3855 if (fTagMeanCorss[0] == 1) {
3856 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypMeanCorss;
3857 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3858 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3859 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3860 TRootMeanCorss();
3861 gCnaRootFile->fCnaResultsTree->Fill();
3862 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3863 std::cout << " => WRITTEN ON FILE ";
3864 v_tot_writ += v_size;
3865 }
3866 }
3867 }
3868 if (fFlagPrint == fCodePrintAllComments) {
3869 std::cout << std::endl;
3870 }
3871
3872
3873
3874
3875 MaxCar = fgMaxCar;
3876 typ_name.Resize(MaxCar);
3877 typ_name = "Lfn";
3878 v_nb_times = fFileHeader->fLfnCalc;
3879 v_dim_one = 1;
3880 v_dim_two = fEcal->MaxCrysEcnaInStex();
3881 v_size = v_nb_times * v_dim_one * v_dim_two;
3882 v_tot += v_size;
3883
3884 if (fFlagPrint == fCodePrintAllComments) {
3885 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3886 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3887 << v_size;
3888 }
3889
3890 for (Int_t i = 0; i < v_nb_times; i++) {
3891 if (fTagLfn[0] == 1) {
3892 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypLfn;
3893 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3894 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3895 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3896 TRootLfn();
3897 gCnaRootFile->fCnaResultsTree->Fill();
3898 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3899 std::cout << " => WRITTEN ON FILE ";
3900 v_tot_writ += v_size;
3901 }
3902 }
3903 }
3904 if (fFlagPrint == fCodePrintAllComments) {
3905 std::cout << std::endl;
3906 }
3907
3908
3909
3910
3911 MaxCar = fgMaxCar;
3912 typ_name.Resize(MaxCar);
3913 typ_name = "Hfn";
3914 v_nb_times = fFileHeader->fHfnCalc;
3915 v_dim_one = 1;
3916 v_dim_two = fEcal->MaxCrysEcnaInStex();
3917 v_size = v_nb_times * v_dim_one * v_dim_two;
3918 v_tot += v_size;
3919
3920 if (fFlagPrint == fCodePrintAllComments) {
3921 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3922 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3923 << v_size;
3924 }
3925
3926 for (Int_t i = 0; i < v_nb_times; i++) {
3927 if (fTagHfn[0] == 1) {
3928 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypHfn;
3929 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3930 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3931 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3932 TRootHfn();
3933 gCnaRootFile->fCnaResultsTree->Fill();
3934 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3935 std::cout << " => WRITTEN ON FILE ";
3936 v_tot_writ += v_size;
3937 }
3938 }
3939 }
3940 if (fFlagPrint == fCodePrintAllComments) {
3941 std::cout << std::endl;
3942 }
3943
3944
3945
3946
3947 MaxCar = fgMaxCar;
3948 typ_name.Resize(MaxCar);
3949 typ_name = "SigCorss";
3950 v_nb_times = fFileHeader->fSigCorssCalc;
3951 v_dim_one = 1;
3952 v_dim_two = fEcal->MaxCrysEcnaInStex();
3953 v_size = v_nb_times * v_dim_one * v_dim_two;
3954 v_tot += v_size;
3955
3956 if (fFlagPrint == fCodePrintAllComments) {
3957 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3958 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3959 << v_size;
3960 }
3961
3962 for (Int_t i = 0; i < v_nb_times; i++) {
3963 if (fTagSigCorss[0] == 1) {
3964 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypSigCorss;
3965 gCnaRootFile->fCnaIndivResult->fIthElement = i;
3966 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3967 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
3968 TRootSigCorss();
3969 gCnaRootFile->fCnaResultsTree->Fill();
3970 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3971 std::cout << " => WRITTEN ON FILE ";
3972 v_tot_writ += v_size;
3973 }
3974 }
3975 }
3976 if (fFlagPrint == fCodePrintAllComments) {
3977 std::cout << std::endl;
3978 }
3979
3980
3981
3982
3983 MaxCar = fgMaxCar;
3984 typ_name.Resize(MaxCar);
3985 typ_name = "LFccMoStins";
3986 v_nb_times = fFileHeader->fLFccMoStinsCalc;
3987 v_dim_one = fEcal->MaxStinEcnaInStex();
3988 v_dim_two = fEcal->MaxStinEcnaInStex();
3989 v_size = v_nb_times * v_dim_one * v_dim_two;
3990 v_tot += v_size;
3991
3992 if (fFlagPrint == fCodePrintAllComments) {
3993 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3994 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3995 << v_size;
3996 }
3997
3998 for (Int_t i = 0; i < v_nb_times; i++) {
3999 if (fTagLFccMoStins[0] == 1) {
4000 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypLFccMoStins;
4001 gCnaRootFile->fCnaIndivResult->fIthElement = i;
4002 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4003 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1, 1);
4004 TRootLFccMoStins();
4005 gCnaRootFile->fCnaResultsTree->Fill();
4006 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4007 std::cout << " => WRITTEN ON FILE ";
4008 v_tot_writ += v_size;
4009 }
4010 }
4011 }
4012 if (fFlagPrint == fCodePrintAllComments) {
4013 std::cout << std::endl;
4014 }
4015
4016
4017
4018
4019 MaxCar = fgMaxCar;
4020 typ_name.Resize(MaxCar);
4021 typ_name = "HFccMoStins";
4022 v_nb_times = fFileHeader->fHFccMoStinsCalc;
4023 v_dim_one = fEcal->MaxStinEcnaInStex();
4024 v_dim_two = fEcal->MaxStinEcnaInStex();
4025 v_size = v_nb_times * v_dim_one * v_dim_two;
4026 v_tot += v_size;
4027
4028 if (fFlagPrint == fCodePrintAllComments) {
4029 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4030 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4031 << v_size;
4032 }
4033
4034 for (Int_t i = 0; i < v_nb_times; i++) {
4035 if (fTagHFccMoStins[0] == 1) {
4036 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypHFccMoStins;
4037 gCnaRootFile->fCnaIndivResult->fIthElement = i;
4038 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4039 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1, 1);
4040 TRootHFccMoStins();
4041 gCnaRootFile->fCnaResultsTree->Fill();
4042 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4043 std::cout << " => WRITTEN ON FILE ";
4044 v_tot_writ += v_size;
4045 }
4046 }
4047 }
4048 if (fFlagPrint == fCodePrintAllComments) {
4049 std::cout << std::endl;
4050 }
4051
4052
4053
4054
4055 MaxCar = fgMaxCar;
4056 typ_name.Resize(MaxCar);
4057 typ_name = "NbOfEvts";
4058 v_nb_times = fFileHeader->fNbOfEvtsCalc;
4059 v_dim_one = fEcal->MaxCrysEcnaInStex();
4060 v_dim_two = argNbSampWrite;
4061 v_size = v_nb_times * v_dim_one * v_dim_two;
4062 v_tot += v_size;
4063
4064 if (fFlagPrint == fCodePrintAllComments) {
4065 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4066 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4067 << v_size;
4068 }
4069
4070 for (Int_t i = 0; i < v_nb_times; i++) {
4071 if (fTagNbOfEvts[0] == 1) {
4072 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypNbOfEvts;
4073 gCnaRootFile->fCnaIndivResult->fIthElement = i;
4074 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
4075 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
4076 TRootNbOfEvts(argNbSampWrite);
4077 gCnaRootFile->fCnaResultsTree->Fill();
4078 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4079 std::cout << " => WRITTEN ON FILE ";
4080 v_tot_writ += v_size;
4081 }
4082 }
4083 }
4084 if (fFlagPrint == fCodePrintAllComments) {
4085 std::cout << std::endl;
4086 }
4087
4088
4089
4090
4091 MaxCar = fgMaxCar;
4092 typ_name.Resize(MaxCar);
4093 typ_name = "MSp";
4094 v_nb_times = fFileHeader->fMSpCalc;
4095 v_dim_one = fEcal->MaxCrysEcnaInStex();
4096 v_dim_two = argNbSampWrite;
4097 v_size = v_nb_times * v_dim_one * v_dim_two;
4098 v_tot += v_size;
4099
4100 if (fFlagPrint == fCodePrintAllComments) {
4101 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4102 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4103 << v_size;
4104 }
4105
4106 for (Int_t i = 0; i < v_nb_times; i++) {
4107 if (fTagMSp[0] == 1) {
4108 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypMSp;
4109 gCnaRootFile->fCnaIndivResult->fIthElement = i;
4110 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
4111 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
4112 TRootMSp(argNbSampWrite);
4113 gCnaRootFile->fCnaResultsTree->Fill();
4114 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4115 std::cout << " => WRITTEN ON FILE ";
4116 v_tot_writ += v_size;
4117 }
4118 }
4119 }
4120 if (fFlagPrint == fCodePrintAllComments) {
4121 std::cout << std::endl;
4122 }
4123
4124
4125
4126
4127 MaxCar = fgMaxCar;
4128 typ_name.Resize(MaxCar);
4129 typ_name = "SSp";
4130 v_nb_times = fFileHeader->fSSpCalc;
4131 v_dim_one = fEcal->MaxCrysEcnaInStex();
4132 v_dim_two = argNbSampWrite;
4133 v_size = v_nb_times * v_dim_one * v_dim_two;
4134 v_tot += v_size;
4135
4136 if (fFlagPrint == fCodePrintAllComments) {
4137 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4138 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4139 << v_size;
4140 }
4141
4142 for (Int_t i = 0; i < v_nb_times; i++) {
4143 if (fTagSSp[0] == 1) {
4144 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypSSp;
4145 gCnaRootFile->fCnaIndivResult->fIthElement = i;
4146 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
4147 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
4148 TRootSSp(argNbSampWrite);
4149 gCnaRootFile->fCnaResultsTree->Fill();
4150 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4151 std::cout << " => WRITTEN ON FILE ";
4152 v_tot_writ += v_size;
4153 }
4154 }
4155 }
4156 if (fFlagPrint == fCodePrintAllComments) {
4157 std::cout << std::endl;
4158 }
4159
4160
4161
4162
4163
4164 MaxCar = fgMaxCar;
4165 typ_name.Resize(MaxCar);
4166 typ_name = "CovCss";
4167 v_nb_times = fFileHeader->fCovCssCalc;
4168 v_dim_one = argNbSampWrite;
4169 v_dim_two = argNbSampWrite;
4170 v_size = v_nb_times * v_dim_one * v_dim_two;
4171 v_tot += v_size;
4172
4173 if (fFlagPrint == fCodePrintAllComments) {
4174 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4175 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4176 << v_size;
4177 }
4178
4179 for (Int_t i0StexEcha = 0; i0StexEcha < v_nb_times; i0StexEcha++) {
4180 if (fTagCovCss[i0StexEcha] == 1) {
4181 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypCovCss;
4182 gCnaRootFile->fCnaIndivResult->fIthElement = i0StexEcha;
4183 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4184 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1, 1);
4185 TRootCovCss(i0StexEcha, argNbSampWrite);
4186 gCnaRootFile->fCnaResultsTree->Fill();
4187 if (i0StexEcha == 0 && fFlagPrint == fCodePrintAllComments) {
4188 std::cout << " => WRITTEN ON FILE ";
4189 v_tot_writ += v_size;
4190 }
4191 }
4192 }
4193 if (fFlagPrint == fCodePrintAllComments) {
4194 std::cout << std::endl;
4195 }
4196
4197
4198
4199
4200 MaxCar = fgMaxCar;
4201 typ_name.Resize(MaxCar);
4202 typ_name = "CorCss";
4203 v_nb_times = fFileHeader->fCorCssCalc;
4204 v_dim_one = argNbSampWrite;
4205 v_dim_two = argNbSampWrite;
4206 v_size = v_nb_times * v_dim_one * v_dim_two;
4207 v_tot += v_size;
4208
4209 if (fFlagPrint == fCodePrintAllComments) {
4210 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4211 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4212 << v_size;
4213 }
4214
4215 for (Int_t i0StexEcha = 0; i0StexEcha < v_nb_times; i0StexEcha++) {
4216 if (fTagCorCss[i0StexEcha] == 1) {
4217 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypCorCss;
4218 gCnaRootFile->fCnaIndivResult->fIthElement = i0StexEcha;
4219 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4220 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1, 1);
4221 TRootCorCss(i0StexEcha, argNbSampWrite);
4222 gCnaRootFile->fCnaResultsTree->Fill();
4223 if (i0StexEcha == 0 && fFlagPrint == fCodePrintAllComments) {
4224 std::cout << " => WRITTEN ON FILE ";
4225 v_tot_writ += v_size;
4226 }
4227 }
4228 }
4229 if (fFlagPrint == fCodePrintAllComments) {
4230 std::cout << std::endl;
4231 }
4232
4233
4234
4235
4236 MaxCar = fgMaxCar;
4237 typ_name.Resize(MaxCar);
4238 typ_name = "AdcEvt";
4239 v_nb_times = fFileHeader->fAdcEvtCalc;
4240 v_dim_one = argNbSampWrite;
4241 v_dim_two = fFileHeader->fReqNbOfEvts;
4242 v_size = v_nb_times * v_dim_one * v_dim_two;
4243 v_tot += v_size;
4244
4245 if (fFlagPrint == fCodePrintAllComments) {
4246 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4247 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4248 << v_size;
4249 }
4250
4251 for (Int_t i0StexEcha = 0; i0StexEcha < v_nb_times; i0StexEcha++) {
4252 if (fTagAdcEvt[i0StexEcha] == 1) {
4253 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypAdcEvt;
4254 gCnaRootFile->fCnaIndivResult->fIthElement = i0StexEcha;
4255 gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
4256 gCnaRootFile->fCnaIndivResult->fMatMat.ReSet(1, 1);
4257 TRootAdcEvt(i0StexEcha, argNbSampWrite);
4258 gCnaRootFile->fCnaResultsTree->Fill();
4259 if (i0StexEcha == 0 && fFlagPrint == fCodePrintAllComments) {
4260 std::cout << " => WRITTEN ON FILE ";
4261 v_tot_writ += v_size;
4262 }
4263 }
4264 }
4265 if (fFlagPrint == fCodePrintAllComments) {
4266 std::cout << std::endl;
4267 }
4268
4269
4270
4271
4272 MaxCar = fgMaxCar;
4273 typ_name.Resize(MaxCar);
4274 typ_name = "LfCov";
4275 v_nb_times = fFileHeader->fLfCovCalc;
4276 v_dim_one = fEcal->MaxCrysEcnaInStex();
4277 v_dim_two = fEcal->MaxCrysEcnaInStex();
4278 v_size = v_nb_times * v_dim_one * v_dim_two;
4279 v_tot += v_size;
4280
4281 if (fFlagPrint == fCodePrintAllComments) {
4282 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4283 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4284 << v_size;
4285 }
4286
4287 for (Int_t i = 0; i < v_nb_times; i++) {
4288 if (fTagLfCov[0] == 1) {
4289 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypLfCov;
4290 gCnaRootFile->fCnaIndivResult->fIthElement = i;
4291 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4292 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1, 1);
4293 TRootLfCov();
4294 gCnaRootFile->fCnaResultsTree->Fill();
4295 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4296 std::cout << " => WRITTEN ON FILE ";
4297 v_tot_writ += v_size;
4298 }
4299 }
4300 }
4301 if (fFlagPrint == fCodePrintAllComments) {
4302 std::cout << std::endl;
4303 }
4304
4305
4306
4307
4308 MaxCar = fgMaxCar;
4309 typ_name.Resize(MaxCar);
4310 typ_name = "LfCor";
4311 v_nb_times = fFileHeader->fLfCorCalc;
4312 v_dim_one = fEcal->MaxCrysEcnaInStex();
4313 v_dim_two = fEcal->MaxCrysEcnaInStex();
4314 v_size = v_nb_times * v_dim_one * v_dim_two;
4315 v_tot += v_size;
4316
4317 if (fFlagPrint == fCodePrintAllComments) {
4318 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4319 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4320 << v_size;
4321 }
4322
4323 for (Int_t i = 0; i < v_nb_times; i++) {
4324 if (fTagLfCor[0] == 1) {
4325 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypLfCor;
4326 gCnaRootFile->fCnaIndivResult->fIthElement = i;
4327 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4328 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1, 1);
4329 TRootLfCor();
4330 gCnaRootFile->fCnaResultsTree->Fill();
4331 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4332 std::cout << " => WRITTEN ON FILE ";
4333 v_tot_writ += v_size;
4334 }
4335 }
4336 }
4337 if (fFlagPrint == fCodePrintAllComments) {
4338 std::cout << std::endl;
4339 }
4340
4341
4342
4343
4344 MaxCar = fgMaxCar;
4345 typ_name.Resize(MaxCar);
4346 typ_name = "HfCov";
4347 v_nb_times = fFileHeader->fHfCovCalc;
4348 v_dim_one = fEcal->MaxCrysEcnaInStex();
4349 v_dim_two = fEcal->MaxCrysEcnaInStex();
4350 v_size = v_nb_times * v_dim_one * v_dim_two;
4351 v_tot += v_size;
4352
4353 if (fFlagPrint == fCodePrintAllComments) {
4354 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4355 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4356 << v_size;
4357 }
4358
4359 for (Int_t i = 0; i < v_nb_times; i++) {
4360 if (fTagHfCov[0] == 1) {
4361 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypHfCov;
4362 gCnaRootFile->fCnaIndivResult->fIthElement = i;
4363 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4364 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1, 1);
4365 TRootHfCov();
4366 gCnaRootFile->fCnaResultsTree->Fill();
4367 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4368 std::cout << " => WRITTEN ON FILE ";
4369 v_tot_writ += v_size;
4370 }
4371 }
4372 }
4373 if (fFlagPrint == fCodePrintAllComments) {
4374 std::cout << std::endl;
4375 }
4376
4377
4378
4379
4380 MaxCar = fgMaxCar;
4381 typ_name.Resize(MaxCar);
4382 typ_name = "HfCor";
4383 v_nb_times = fFileHeader->fHfCorCalc;
4384 v_dim_one = fEcal->MaxCrysEcnaInStex();
4385 v_dim_two = fEcal->MaxCrysEcnaInStex();
4386 v_size = v_nb_times * v_dim_one * v_dim_two;
4387 v_tot += v_size;
4388
4389 if (fFlagPrint == fCodePrintAllComments) {
4390 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4391 << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4392 << v_size;
4393 }
4394
4395 for (Int_t i = 0; i < v_nb_times; i++) {
4396 if (fTagHfCor[0] == 1) {
4397 gCnaRootFile->fCnaIndivResult->fTypOfCnaResult = cTypHfCor;
4398 gCnaRootFile->fCnaIndivResult->fIthElement = i;
4399 gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4400 gCnaRootFile->fCnaIndivResult->fMatHis.ReSet(1, 1);
4401 TRootHfCor();
4402 gCnaRootFile->fCnaResultsTree->Fill();
4403 if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4404 std::cout << " => WRITTEN ON FILE ";
4405 v_tot_writ += v_size;
4406 }
4407 }
4408 }
4409 if (fFlagPrint == fCodePrintAllComments) {
4410 std::cout << std::endl;
4411 }
4412
4413
4414
4415 gCnaRootFile->fRootFile->Write();
4416
4417 fFileHeader->Write();
4418
4419
4420 if (fFlagPrint == fCodePrintAllComments) {
4421 std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(20) << "TOTAL: " << std::setw(21)
4422 << "CALCULATED = " << std::setw(9) << v_tot << " => WRITTEN ON FILE = " << std::setw(9) << v_tot_writ
4423 << std::endl;
4424 }
4425
4426 if (fFlagPrint == fCodePrintAllComments) {
4427 std::cout << "*TEcnaRun::WriteRootFile(...)> Write OK in file " << file_name << " in directory:" << std::endl
4428 << " " << fCnaParPaths->ResultsRootFilePath().Data() << std::endl;
4429 }
4430
4431 ok_write = kTRUE;
4432
4433
4434 CloseRootFile(file_name);
4435 }
4436 return ok_write;
4437 }
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447 void TEcnaRun::TRootStinNumbers() {
4448 if (fTagStinNumbers[0] == 1) {
4449 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4450 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_StexStinFromIndex[j0StexStinEcna];
4451 }
4452 }
4453 }
4454
4455
4456
4457
4458
4459
4460
4461 void TEcnaRun::TRootNbOfEvts(const Int_t& argNbSampWrite) {
4462 if (fTagNbOfEvts[0] == 1) {
4463 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4464 for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++) {
4465 gCnaRootFile->fCnaIndivResult->fMatHis(j0StexEcha, i0Sample) = fT2d_NbOfEvts[j0StexEcha][i0Sample];
4466 }
4467 }
4468 }
4469 }
4470
4471
4472
4473
4474
4475
4476
4477 void TEcnaRun::TRootAdcEvt(const Int_t& user_StexEcha, const Int_t& argNbSampWrite) {
4478 if (fTagAdcEvt[user_StexEcha] == 1) {
4479 for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++) {
4480
4481 for (Int_t j_bin = 0; j_bin < fFileHeader->fReqNbOfEvts; j_bin++) {
4482 gCnaRootFile->fCnaIndivResult->fMatHis(i0Sample, j_bin) = (Double_t)0.;
4483 }
4484
4485 for (Int_t j_bin = 0; j_bin < fFileHeader->fReqNbOfEvts; j_bin++) {
4486 gCnaRootFile->fCnaIndivResult->fMatHis(i0Sample, j_bin) = fT3d_AdcValues[user_StexEcha][i0Sample][j_bin];
4487 }
4488 }
4489 }
4490 }
4491
4492
4493
4494
4495
4496
4497
4498 void TEcnaRun::TRootMSp(const Int_t& argNbSampWrite) {
4499 if (fTagMSp[0] == 1) {
4500 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4501 for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++) {
4502 gCnaRootFile->fCnaIndivResult->fMatHis(j0StexEcha, i0Sample) = fT2d_ev[j0StexEcha][i0Sample];
4503 }
4504 }
4505 }
4506 }
4507
4508
4509
4510
4511
4512
4513
4514 void TEcnaRun::TRootSSp(const Int_t& argNbSampWrite) {
4515 if (fTagSSp[0] == 1) {
4516 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4517 for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++) {
4518 gCnaRootFile->fCnaIndivResult->fMatHis(j0StexEcha, i0Sample) = fT2d_sig[j0StexEcha][i0Sample];
4519 }
4520 }
4521 }
4522 }
4523
4524
4525
4526
4527
4528
4529
4530
4531 void TEcnaRun::TRootLFccMoStins() {
4532 if (fTagLFccMoStins[0] == 1) {
4533 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
4534 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4535 gCnaRootFile->fCnaIndivResult->fMatMat(i0StexStinEcna, j0StexStinEcna) =
4536 fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna];
4537 }
4538 }
4539 }
4540 }
4541
4542
4543
4544
4545
4546
4547
4548
4549 void TEcnaRun::TRootHFccMoStins() {
4550 if (fTagHFccMoStins[0] == 1) {
4551 for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
4552 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4553 gCnaRootFile->fCnaIndivResult->fMatMat(i0StexStinEcna, j0StexStinEcna) =
4554 fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna];
4555 }
4556 }
4557 }
4558 }
4559
4560
4561
4562
4563
4564
4565
4566 void TEcnaRun::TRootAvTno() {
4567 if (fTagAvTno[0] == 1) {
4568 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4569 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_av_totn[j0StexStinEcna];
4570 }
4571 }
4572 }
4573
4574
4575
4576
4577
4578
4579 void TEcnaRun::TRootAvLfn() {
4580 if (fTagAvLfn[0] == 1) {
4581 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4582 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_av_lofn[j0StexStinEcna];
4583 }
4584 }
4585 }
4586
4587
4588
4589
4590
4591
4592
4593 void TEcnaRun::TRootAvHfn() {
4594 if (fTagAvHfn[0] == 1) {
4595 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4596 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_av_hifn[j0StexStinEcna];
4597 }
4598 }
4599 }
4600
4601
4602
4603
4604
4605
4606
4607 void TEcnaRun::TRootLfCov() {
4608 if (fTagLfCov[0] == 1) {
4609 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
4610 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4611 gCnaRootFile->fCnaIndivResult->fMatMat(i0StexEcha, j0StexEcha) = fT2d_lf_cov[i0StexEcha][j0StexEcha];
4612 }
4613 }
4614 }
4615 }
4616
4617
4618
4619
4620
4621
4622
4623 void TEcnaRun::TRootLfCor() {
4624 if (fTagLfCor[0] == 1) {
4625 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
4626 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4627 gCnaRootFile->fCnaIndivResult->fMatMat(i0StexEcha, j0StexEcha) = fT2d_lf_cor[i0StexEcha][j0StexEcha];
4628 }
4629 }
4630 }
4631 }
4632
4633
4634
4635
4636
4637
4638
4639 void TEcnaRun::TRootHfCov() {
4640 if (fTagHfCov[0] == 1) {
4641 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
4642 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4643 gCnaRootFile->fCnaIndivResult->fMatMat(i0StexEcha, j0StexEcha) = fT2d_hf_cov[i0StexEcha][j0StexEcha];
4644 }
4645 }
4646 }
4647 }
4648
4649
4650
4651
4652
4653
4654
4655 void TEcnaRun::TRootHfCor() {
4656 if (fTagHfCor[0] == 1) {
4657 for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
4658 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4659 gCnaRootFile->fCnaIndivResult->fMatMat(i0StexEcha, j0StexEcha) = fT2d_hf_cor[i0StexEcha][j0StexEcha];
4660 }
4661 }
4662 }
4663 }
4664
4665
4666
4667
4668
4669
4670
4671 void TEcnaRun::TRootCovCss(const Int_t& user_StexEcha, const Int_t& argNbSampWrite) {
4672 if (fTagCovCss[user_StexEcha] == 1) {
4673 for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++) {
4674 for (Int_t j0Sample = 0; j0Sample < argNbSampWrite; j0Sample++) {
4675 gCnaRootFile->fCnaIndivResult->fMatMat(i0Sample, j0Sample) = fT3d_cov_ss[user_StexEcha][i0Sample][j0Sample];
4676 }
4677 }
4678 }
4679 }
4680
4681
4682
4683
4684
4685
4686
4687 void TEcnaRun::TRootCorCss(const Int_t& user_StexEcha, const Int_t& argNbSampWrite) {
4688 if (fTagCorCss[user_StexEcha] == 1) {
4689 for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++) {
4690 for (Int_t j0Sample = 0; j0Sample < argNbSampWrite; j0Sample++) {
4691 gCnaRootFile->fCnaIndivResult->fMatMat(i0Sample, j0Sample) = fT3d_cor_ss[user_StexEcha][i0Sample][j0Sample];
4692 }
4693 }
4694 }
4695 }
4696
4697
4698
4699
4700
4701
4702
4703
4704 void TEcnaRun::TRootPed() {
4705 if (fTagPed[0] == 1) {
4706 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4707 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) = fT1d_ev_ev[j0StexEcha];
4708 }
4709 }
4710 }
4711
4712
4713
4714
4715
4716
4717
4718 void TEcnaRun::TRootTno() {
4719 if (fTagTno[0] == 1) {
4720 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4721 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) = fT1d_evsamp_of_sigevt[j0StexEcha];
4722 }
4723 }
4724 }
4725
4726
4727
4728
4729
4730
4731
4732
4733 void TEcnaRun::TRootMeanCorss() {
4734 if (fTagMeanCorss[0] == 1) {
4735 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4736 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) = fT1d_ev_cor_ss[j0StexEcha];
4737 }
4738 }
4739 }
4740
4741
4742
4743
4744
4745
4746
4747
4748 void TEcnaRun::TRootLfn() {
4749 if (fTagLfn[0] == 1) {
4750 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4751 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) = fT1d_sigevt_of_evsamp[j0StexEcha];
4752 }
4753 }
4754 }
4755
4756
4757
4758
4759
4760
4761
4762
4763 void TEcnaRun::TRootHfn() {
4764 if (fTagHfn[0] == 1) {
4765 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4766 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) = fT1d_evevt_of_sigsamp[j0StexEcha];
4767 }
4768 }
4769 }
4770
4771
4772
4773
4774
4775
4776
4777
4778 void TEcnaRun::TRootSigCorss() {
4779 if (fTagSigCorss[0] == 1) {
4780 for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4781 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) = fT1d_sig_cor_ss[j0StexEcha];
4782 }
4783 }
4784 }
4785
4786
4787
4788
4789
4790
4791
4792
4793 void TEcnaRun::TRootAvPed() {
4794 if (fTagAvPed[0] == 1) {
4795 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4796 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_av_mped[j0StexStinEcna];
4797 }
4798 }
4799 }
4800
4801
4802
4803
4804
4805
4806
4807
4808 void TEcnaRun::TRootAvEvCorss() {
4809 if (fTagAvMeanCorss[0] == 1)
4810 {
4811 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4812 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_av_ev_corss[j0StexStinEcna];
4813 }
4814 }
4815 }
4816
4817
4818
4819
4820
4821
4822
4823
4824 void TEcnaRun::TRootAvSigCorss() {
4825 if (fTagAvSigCorss[0] == 1)
4826 {
4827 for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4828 gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_av_sig_corss[j0StexStinEcna];
4829 }
4830 }
4831 }
4832
4833
4834
4835
4836
4837
4838
4839 void TEcnaRun::PrintComments() {
4840
4841
4842 fFlagPrint = fCodePrintComments;
4843 std::cout << "*TEcnaRun::PrintComments()> Warnings and some comments on init will be printed" << std::endl;
4844 }
4845
4846 void TEcnaRun::PrintWarnings() {
4847
4848
4849 fFlagPrint = fCodePrintWarnings;
4850 std::cout << "*TEcnaRun::PrintWarnings()> Warnings will be printed" << std::endl;
4851 }
4852
4853 void TEcnaRun::PrintAllComments() {
4854
4855
4856 fFlagPrint = fCodePrintAllComments;
4857 std::cout << "*TEcnaRun::PrintAllComments()> All the comments will be printed" << std::endl;
4858 }
4859
4860 void TEcnaRun::PrintNoComment() {
4861
4862
4863 fFlagPrint = fCodePrintNoComment;
4864 }
4865