43 Long_t i_this = (Long_t)
this;
49 if (iCnaParCout == 0) {
58 if (iCnaParPaths == 0) {
81 Long_t iEcalNumbering = pObjectManager->
GetPointerValue(
"TEcnaNumbering");
82 if (iEcalNumbering == 0) {
102 if (pCnaParPaths ==
nullptr) {
115 if (pCnaParCout ==
nullptr) {
123 if (pEcal ==
nullptr) {
131 if (pEcalNumbering ==
nullptr) {
286 if (pEcal ==
nullptr) {
298 if (pEcalNumbering ==
nullptr) {
412 const Int_t& MaxArray,
413 const Int_t& NbOfReqEvts,
414 const Int_t& StexNumber) {
420 Int_t rNumberOfEvents = 0;
421 Int_t PresentNumber = 0;
422 Int_t EmptyChannel = 0;
423 Int_t DifferentMinusValue = 0;
424 Int_t DifferentPlusValue = 0;
427 for (Int_t i_SSoSE = 0; i_SSoSE < MaxArray; i_SSoSE++) {
428 Int_t NbOfEvts = ArrayNbOfEvts[i_SSoSE];
431 if (PresentNumber == 0)
433 PresentNumber = NbOfEvts;
436 if (NbOfEvts > PresentNumber)
438 PresentNumber = NbOfEvts;
439 DifferentPlusValue++;
441 if (NbOfEvts < PresentNumber)
443 DifferentMinusValue++;
451 rNumberOfEvents = PresentNumber;
453 if (EmptyChannel > 0) {
456 std::cout <<
"!TEcnaWrite::NumberOfEventsAnalysis()> *** WARNING *** " << EmptyChannel
457 <<
" empty channels detected in SM " << StexNumber <<
" (EB "
463 if (EmptyChannel > 0) {
464 std::cout <<
"!TEcnaWrite::NumberOfEventsAnalysis()> *** WARNING *** " << EmptyChannel
465 <<
" empty channels detected in Dee " << StexNumber << std::endl;
470 if (DifferentMinusValue > 0 || DifferentPlusValue > 0) {
471 std::cout <<
"!TEcnaWrite::NumberOfEventsAnalysis()> " << std::endl;
475 std::cout <<
"************** W A R N I N G : NUMBER OF EVENTS NOT CONSTANT FOR SM " << StexNumber <<
" (EB "
481 std::cout <<
"****************** W A R N I N G : NUMBER OF EVENTS NOT CONSTANT FOR Dee " << StexNumber
482 <<
" **************************";
488 <<
" The number of events is not the same for all the non-empty channels." << std::endl
489 <<
" The maximum number (" << rNumberOfEvents <<
") is considered as the number of events for calculations "
491 <<
" of pedestals, noises and correlations." << std::endl
492 <<
" Number of channels with 0 < nb of evts < " << rNumberOfEvents <<
" : " << DifferentMinusValue
495 <<
" Number of empty channels : " << EmptyChannel << std::endl
496 <<
" Some values of pedestals, noises and correlations may be wrong for channels" << std::endl
497 <<
" with number of events different from " << rNumberOfEvents <<
"." << std::endl
498 <<
" Please, check the histogram 'Numbers of events'." << std::endl
499 <<
"*******************************************************************************************************"
503 if (rNumberOfEvents < NbOfReqEvts) {
504 std::cout <<
"*TEcnaWrite::NumberOfEventsAnalysis()> *** INFO *** Number of events found in data = "
505 << rNumberOfEvents <<
": less than number of requested events ( = " << NbOfReqEvts <<
")"
510 return rNumberOfEvents;
515 const Int_t& MaxCrysEcnaInStex,
516 const Int_t& MaxNbOfSamples,
517 const Int_t& NbOfReqEvts) {
523 Int_t rNumberOfEvents = 0;
524 Int_t PresentNumber = 0;
525 Int_t DifferentMinusValue = 0;
526 Int_t DifferentPlusValue = 0;
528 for (Int_t i0StexEcha = 0; i0StexEcha < MaxCrysEcnaInStex; i0StexEcha++) {
529 for (Int_t i_samp = 0; i_samp < MaxNbOfSamples; i_samp++) {
530 Int_t NbOfEvts = T2d_NbOfEvts[i0StexEcha][i_samp];
533 if (PresentNumber == 0) {
534 PresentNumber = NbOfEvts;
536 if (NbOfEvts > PresentNumber) {
537 PresentNumber = NbOfEvts;
538 DifferentPlusValue++;
540 if (NbOfEvts < PresentNumber) {
541 DifferentMinusValue++;
548 rNumberOfEvents = PresentNumber;
550 if (DifferentMinusValue > 0 || DifferentPlusValue > 0) {
552 <<
"!TEcnaWrite::NumberOfEventsAnalysis()> " << std::endl
553 <<
"****************** W A R N I N G : NUMBER OF EVENTS NOT CONSTANT ! *********************************"
556 <<
" The number of events is not the same for all the non-empty channels" << std::endl
557 <<
" The maximum number (" << rNumberOfEvents <<
") is considered as the number of events " << std::endl
558 <<
" for calculations of pedestals, noises and correlations." << std::endl
559 <<
" Number of channels with 0 < nb of evts < " << rNumberOfEvents <<
" : " << DifferentMinusValue
563 <<
" Some values of pedestals, noises and correlations may be wrong for channels" << std::endl
564 <<
" with number of events different from " << rNumberOfEvents <<
"." << std::endl
565 <<
" Please, check the histogram 'Numbers of events'." << std::endl
566 <<
"*******************************************************************************************************"
570 if (rNumberOfEvents < NbOfReqEvts) {
571 std::cout <<
"*TEcnaWrite::NumberOfEventsAnalysis()> *** INFO *** Number of events found in data = "
572 << rNumberOfEvents <<
": less than number of requested events ( = " << NbOfReqEvts <<
")"
577 return rNumberOfEvents;
582 const Int_t& ArgNbOfSamples,
583 const Int_t& ArgRunNumber,
584 const Int_t& ArgFirstReqEvtNumber,
585 const Int_t& ArgLastReqEvtNumber,
586 const Int_t& ArgReqNbOfEvts,
587 const Int_t& ArgStexNumber) {
598 const Int_t& ArgNbOfSamples,
599 const Int_t& ArgRunNumber,
600 const Int_t& ArgFirstReqEvtNumber,
601 const Int_t& ArgLastReqEvtNumber,
602 const Int_t& ArgReqNbOfEvts,
603 const Int_t& ArgStexNumber,
604 const TString& ArgStartDate,
605 const TString& ArgStopDate,
606 const time_t ArgStartTime,
607 const time_t ArgStopTime) {
661 char* f_in_short =
new char[
fgMaxCar];
684 TString sPointInterrog =
"?";
685 TString sDollarHome =
"$HOME";
689 std::cout <<
"!TEcnaWrite::fMakeResultsFileName> * * * W A R N I N G * * * " << std::endl
691 <<
" Path for results .root file not defined. Default option will be used here:" << std::endl
692 <<
" your results files will be written in your HOME directory." << std::endl
694 <<
" In order to write the .root results file in a specific directory," << std::endl
695 <<
" you have to create a file named path_results_root in a subdirectory named ECNA" << std::endl
696 <<
" previously created in your home directory." << std::endl
697 <<
" This file must have only one line containing the path of the directory" << std::endl
698 <<
" where must be the .root result files." << std::endl
701 TString home_path = gSystem->Getenv(
"HOME");
709 TString home_path = gSystem->Getenv(
"HOME");
715 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d",
726 "%s_S1_%d_R%d_%d_%d_%d_%s%d",
742 std::cout <<
"!TEcnaWrite::fMakeResultsFileName> * * * W A R N I N G * * * " << std::endl
744 <<
" Path for results .ascii file not defined. Default option will be used here:" << std::endl
745 <<
" your results files will be written in your HOME directory." << std::endl
747 <<
" In order to write the .ascii results file in a specific directory," << std::endl
748 <<
" you have to create a file named path_results_ascii in a subdirectory named ECNA" << std::endl
749 <<
" previously created in your home directory." << std::endl
750 <<
" This file must have only one line containing the path of the directory" << std::endl
751 <<
" where must be the .ascii result files." << std::endl
754 TString home_path = gSystem->Getenv(
"HOME");
762 TString home_path = gSystem->Getenv(
"HOME");
769 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_header",
780 "%s_S1_%d_R%d_%d_%d_%d_%s%d_header",
794 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_NbOfEvents",
805 "%s_S1_%d_R%d_%d_%d_%d_%s%d_NbOfEvents",
818 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_Pedestals",
829 "%s_S1_%d_R%d_%d_%d_%d_%s%d_Pedestals",
842 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_TotalNoise",
853 "%s_S1_%d_R%d_%d_%d_%d_%s%d_TotalNoise",
866 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_LFNoise",
877 "%s_S1_%d_R%d_%d_%d_%d_%s%d_LFNoise",
890 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_HFNoise",
901 "%s_S1_%d_R%d_%d_%d_%d_%s%d_HFNoise",
914 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_MeanCorss",
925 "%s_S1_%d_R%d_%d_%d_%d_%s%d_MeanCorss",
938 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_SigmaCorss",
949 "%s_S1_%d_R%d_%d_%d_%d_%s%d_SigmaCorss",
962 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_Covss_%s%d_Channel_%d",
976 "%s_S1_%d_R%d_%d_%d_%d_%s%d_Covss_%s%d_Channel_%d",
992 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_Corss_%s%d_Channel_%d",
1006 "%s_S1_%d_R%d_%d_%d_%d_%s%d_Corss_%s%d_Channel_%d",
1025 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_SampleMeans",
1036 "%s_S1_%d_R%d_%d_%d_%d_%s%d_SampleMeans",
1049 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_SampleSigmas",
1060 "%s_S1_%d_R%d_%d_%d_%d_%s%d_SampleSigmas",
1073 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_AverageTotalNoise_c%d",
1085 "%s_S1_%d_R%d_%d_%d_%d_%s%d_AverageTotalNoise_c%d",
1099 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_LF_cov",
1110 "%s_S1_%d_R%d_%d_%d_%d_%s%d_LF_cov",
1123 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_LF_cor",
1134 "%s_S1_%d_R%d_%d_%d_%d_%s%d_LF_cor",
1147 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_AveragePedestals",
1158 "%s_S1_%d_R%d_%d_%d_%d_%s%d_AveragePedestals",
1171 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_AverageMeanCorss%d",
1183 "%s_S1_%d_R%d_%d_%d_%d_%s%d_AverageMeanCorss%d",
1197 "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_AverageSigmaCorss%d",
1209 "%s_S1_%d_R%d_%d_%d_%d_%s%d_AverageSigmaCorss%d",
1240 if (f_in[
i] !=
'\0') {
1241 f_name[
i] = f_in[
i];
1254 f_name[
ii + 1] =
'a';
1255 f_name[
ii + 2] =
's';
1256 f_name[
ii + 3] =
'c';
1257 f_name[
ii + 4] =
'i';
1258 f_name[
ii + 5] =
'i';
1265 f_name[
ii + 1] =
'r';
1266 f_name[
ii + 2] =
'o';
1267 f_name[
ii + 3] =
'o';
1268 f_name[
ii + 4] =
't';
1273 std::cout <<
"*TEcnaWrite::fMakeResultsFileName(...)> Name too long (for f_name)."
1274 <<
" No room enough for the extension. (ii = " <<
ii <<
")" <<
fTTBELL << std::endl;
1279 char* f_name_short =
new char[
fgMaxCar];
1283 f_name_short[
i] =
'\0';
1288 if (f_in_short[
i] !=
'\0') {
1289 f_name_short[
i] = f_in_short[
i];
1301 f_name_short[
ii] =
'.';
1302 f_name_short[
ii + 1] =
'a';
1303 f_name_short[
ii + 2] =
's';
1304 f_name_short[
ii + 3] =
'c';
1305 f_name_short[
ii + 4] =
'i';
1306 f_name_short[
ii + 5] =
'i';
1313 f_name_short[
ii] =
'.';
1314 f_name_short[
ii + 1] =
'r';
1315 f_name_short[
ii + 2] =
'o';
1316 f_name_short[
ii + 3] =
'o';
1317 f_name_short[
ii + 4] =
't';
1322 std::cout <<
"*TEcnaWrite::fMakeResultsFileName(...)> Name too long (for f_name_short)."
1323 <<
" No room enough for the extension. (ii = " <<
ii <<
")" <<
fTTBELL << std::endl;
1328 delete[] f_name_short;
1329 f_name_short =
nullptr;
1335 delete[] f_in_short;
1336 f_in_short =
nullptr;
1360 const Text_t* t_file_nohome = (
const Text_t*)EndOfAsciiFileName.Data();
1362 TString home_path = gSystem->Getenv(
"HOME");
1493 if (HistoCode ==
"D_NOE_ChNb") {
1496 if (HistoCode ==
"D_Ped_ChNb") {
1499 if (HistoCode ==
"D_TNo_ChNb") {
1502 if (HistoCode ==
"D_LFN_ChNb") {
1505 if (HistoCode ==
"D_HFN_ChNb") {
1508 if (HistoCode ==
"D_MCs_ChNb") {
1511 if (HistoCode ==
"D_SCs_ChNb") {
1519 fFcout_f << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
1520 fFcout_f << std::setprecision(3) << std::setw(6);
1523 fFcout_f.setf(std::ios::left, std::ios::adjustfield);
1524 fFcout_f.setf(std::ios::right, std::ios::adjustfield);
1526 std::cout << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
1527 std::cout << std::setprecision(3) << std::setw(6);
1530 std::cout.setf(std::ios::left, std::ios::adjustfield);
1531 std::cout.setf(std::ios::right, std::ios::adjustfield);
1536 aStexName.Resize(MaxCar);
1537 aStexName =
"SM or Dee?";
1541 aStinName.Resize(MaxCar);
1542 aStinName =
"Tower or SC?";
1546 aHoco.Resize(MaxCar);
1547 aHoco =
"Eta or IX?";
1551 aVeco.Resize(MaxCar);
1552 aVeco =
"Phi or IY?";
1556 aSpecifa.Resize(MaxCar);
1561 aSpecifc.Resize(MaxCar);
1566 aSpecifd.Resize(MaxCar);
1571 aSpecife.Resize(MaxCar);
1576 aSpecif1.Resize(MaxCar);
1581 aSpecif2.Resize(MaxCar);
1586 aStinName =
"tower";
1587 aSpecifa =
" channel# ";
1590 aSpecifc =
" channel# ";
1591 aSpecifd =
" crystal# ";
1597 aSpecifa =
" Sector# ";
1600 aSpecifc =
" crystal# ";
1601 aSpecifd =
" SC # ";
1602 aSpecife =
"Sector";
1606 for (Int_t i0StexEcha = 0; i0StexEcha < HisSize; i0StexEcha++) {
1607 Int_t n1StexStin = 0;
1608 Int_t StexStinEcna = 0;
1609 Int_t i0StinEcha = 0;
1610 Int_t n1StinEcha = 0;
1611 Int_t n1StexCrys = 0;
1612 Int_t n1DataSector = 0;
1617 StexStinEcna = n1StexStin;
1629 if (n1StexStin > 0) {
1631 if (HistoCode ==
"D_NOE_ChNb") {
1632 aSpecif1 =
"Number of";
1633 aSpecif2 =
" events (requested)";
1635 if (HistoCode ==
"D_Ped_ChNb") {
1636 aSpecif1 =
"Pedestals";
1639 if (HistoCode ==
"D_TNo_ChNb") {
1640 aSpecif1 =
" Total ";
1641 aSpecif2 =
" noise ";
1643 if (HistoCode ==
"D_MCs_ChNb") {
1644 aSpecif1 =
" Mean ";
1645 aSpecif2 =
" cor(s,s) ";
1647 if (HistoCode ==
"D_LFN_ChNb") {
1648 aSpecif1 =
" Low Fq";
1649 aSpecif2 =
" noise ";
1651 if (HistoCode ==
"D_HFN_ChNb") {
1652 aSpecif1 =
" High Fq";
1653 aSpecif2 =
" noise ";
1655 if (HistoCode ==
"D_SCs_ChNb") {
1656 aSpecif1 =
" Sigma of";
1657 aSpecif2 =
" cor(s,s) ";
1662 fFcout_f << aSpecifa.Data() <<
" " << aStinName.Data() <<
"# " << aSpecifc.Data() << aSpecifd.Data()
1663 << aHoco.Data() << aVeco.Data() << aSpecif1.Data() << std::endl;
1665 fFcout_f <<
" in " << aStexName.Data() <<
" in " << aStexName.Data() <<
" in " << aStinName.Data() <<
" in "
1666 << aSpecife.Data() <<
" in " << aStexName.Data() <<
" in " << aStexName.Data() << aSpecif2.Data()
1671 Double_t
value = read_histo(i0StexEcha);
1674 fFcout_f << std::setw(7) << i0StexEcha << std::setw(8) << n1StexStin << std::setw(11)
1676 << std::setw(10) << n1StexCrys << std::setw(10)
1681 Int_t n1StinEcha_m = n1StinEcha - 1;
1682 fFcout_f << std::setw(7) << n1DataSector << std::setw(8) << n1StexStin << std::setw(11)
1684 << std::setw(10) << n1SCinDS << std::setw(10)
1689 if (HistoCode ==
"D_NOE_ChNb") {
1705 std::cout <<
"*TEcnaWrite::WriteAsciiHisto(...)> INFO: "
1706 <<
"histo has been written in file: " << std::endl
1724 const Int_t& user_StinEcha,
1725 const Int_t& MatSize,
1726 const TMatrixD& read_matrix) {
1760 const Int_t& user_StinEcha,
1761 const Int_t& MatSize,
1762 const TMatrixD& read_matrix) {
1799 const Int_t& i_pasx_arg,
1800 const Int_t& i_pasy_arg,
1801 const Int_t& MatSize,
1802 const TMatrixD& read_matrix) {
1805 Int_t i_pasx = i_pasx_arg;
1806 Int_t i_pasy = i_pasy_arg;
1810 fFcout_f << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
1813 fFcout_f.setf(std::ios::left, std::ios::adjustfield);
1814 fFcout_f.setf(std::ios::right, std::ios::adjustfield);
1815 fFcout_f << std::setprecision(3) << std::setw(6);
1817 std::cout << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
1820 std::cout.setf(std::ios::left, std::ios::adjustfield);
1821 std::cout.setf(std::ios::right, std::ios::adjustfield);
1822 std::cout << std::setprecision(3) << std::setw(6);
1839 Int_t justap_chan = 0;
1856 for (Int_t
i = 0;
i < justap_chan;
i++) {
1890 Int_t justap_samp = 0;
1907 for (Int_t
i = 0;
i < justap_samp;
i++) {
1946 fFcout_f <<
"Covariance matrix between channels "
1948 isx_max = justap_chan;
1949 isy_max = justap_chan;
1952 fFcout_f <<
"*Correlation matrix between channels "
1954 isx_max = justap_chan;
1955 isy_max = justap_chan;
1959 fFcout_f <<
"Covariance matrix between channels "
1960 <<
"averaged on the samples ";
1961 isx_max = justap_chan;
1962 isy_max = justap_chan;
1965 fFcout_f <<
"Correlation matrix between channels "
1966 <<
"averaged on the samples ";
1967 isx_max = justap_chan;
1968 isy_max = justap_chan;
1972 Int_t n1StexStin = 0;
1973 Int_t i0StinEcha = 0;
1974 Int_t n1StinEcha = 0;
1990 fFcout_f <<
"Covariance matrix between samples "
1992 <<
fStinName <<
": " << i0StinEcha <<
")";
1995 fFcout_f <<
"Covariance matrix between samples "
1997 <<
fStinName <<
": " << n1StinEcha <<
")";
1999 isx_max = justap_samp;
2000 isy_max = justap_samp;
2004 fFcout_f <<
"Correlation matrix between samples "
2006 <<
fStinName <<
": " << i0StinEcha <<
")";
2009 fFcout_f <<
"Correlation matrix between samples "
2011 <<
fStinName <<
": " << n1StinEcha <<
")";
2013 isx_max = justap_samp;
2014 isy_max = justap_samp;
2019 fFcout_f <<
"Correction factors to the covariances "
2021 <<
" , channel in " <<
fStinName <<
": " << i0StinEcha <<
")";
2024 fFcout_f <<
"Correction factors to the covariances "
2026 <<
" , channel in " <<
fStinName <<
": " << n1StinEcha <<
")";
2028 isx_max = justap_samp;
2029 isy_max = justap_samp;
2034 fFcout_f <<
"Correction factors to the correlations "
2036 <<
" , channel in " <<
fStinName <<
": " << i0StinEcha <<
")";
2039 fFcout_f <<
"Correction factors to the correlations "
2041 <<
" , channel in " <<
fStinName <<
": " << n1StinEcha <<
")";
2043 isx_max = justap_samp;
2044 isy_max = justap_samp;
2054 if (i_pasx > isx_max) {
2059 n_sctx = isx_max / i_pasx;
2060 max_verix = n_sctx * i_pasx;
2061 if (max_verix < isx_max) {
2070 if (i_pasy > isy_max) {
2075 n_scty = isy_max / i_pasy;
2076 max_veriy = n_scty * i_pasy;
2077 if (max_veriy < isy_max) {
2085 fFcout_f <<
"sector size = " <<
fSectSampSizeX <<
" , number of sectors = " << n_sctx <<
" x " << n_scty << endl;
2097 Int_t ix_inf = -i_pasx;
2099 for (Int_t nsx = 0; nsx < n_sctx; nsx++) {
2101 ix_inf = ix_inf + i_pasx;
2102 Int_t ix_sup = ix_inf + i_pasx;
2104 Int_t iy_inf = -i_pasy;
2106 for (Int_t nsy = 0; nsy < n_scty; nsy++) {
2107 iy_inf = iy_inf + i_pasy;
2108 Int_t iy_sup = iy_inf + i_pasy;
2119 for (Int_t iy_c = iy_inf; iy_c < iy_sup; iy_c++) {
2129 fFcout_f << std::endl << std::endl;
2131 for (Int_t ix_c = ix_inf; ix_c < ix_sup; ix_c++) {
2141 for (Int_t iy_c = iy_inf; iy_c < iy_sup; iy_c++) {
2171 std::cout <<
"*TEcnaWrite::fT2dWriteAscii(....)> INFO: "
2172 <<
"matrix has been written in file: " << std::endl
2191 void TEcnaWrite::WriteAsciiSampleMeans() {
2201 fT1dWriteAscii(i_code, i_lic1, i_lic2);
2210 void TEcnaWrite::WriteAsciiSampleSigmas() {
2213 Int_t i_code = fCodeVar;
2220 fT1dWriteAscii(i_code, i_lic1, i_lic2);