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