CMS 3D CMS Logo

TEcnaRead.h
Go to the documentation of this file.
1 #ifndef CL_TEcnaRead_H
2 #define CL_TEcnaRead_H
3 
4 #include <ctime>
5 #include <cmath>
6 
7 #include "TSystem.h"
8 #include "TObject.h"
9 #include "TString.h"
10 #include "Riostream.h"
11 #include "TVectorD.h"
12 #include "TMatrixD.h"
13 
24 
351 
352 class TEcnaRead : public TObject {
353 private:
354  //............ attributes
355 
356  // static const Int_t fgMaxCar = 512; <== DANGEROUS !
357 
358  Int_t fgMaxCar; // Max nb of caracters for char*
359 
360  Int_t fCnew; // flags for dynamical allocation
361  Int_t fCdelete;
362 
363  TString fTTBELL;
364 
365  TEcnaObject *fObjectManager; // pointer to TEcnaObject keeped in attribute
366 
367  TEcnaParCout *fCnaParCout; // for comments or error messages
368  TEcnaParPaths *fCnaParPaths; // for NbBinsADC
369 
370  TEcnaHeader *fFileHeader; // header for result file
371  TEcnaParEcal *fEcal; // for Ecal parameters
372  TEcnaNumbering *fEcalNumbering; // for Ecal numbering
373  TEcnaParHistos *fCnaParHistos; // for Histo codes
374  TEcnaWrite *fCnaWrite; // for writing in ascii files
375 
376  // TEcnaRootFile *gCnaRootFile;
377 
378  TString fFlagSubDet;
380 
381  Bool_t fOpenRootFile; // flag open ROOT file (open = kTRUE, close = kFALSE)
382  TString fCurrentlyOpenFileName; // Name of the file currently open
383  TString fFlagNoFileOpen; // Flag to indicate that no file is open
384 
387 
388  Int_t *fT1d_StexStinFromIndex; // 1D array[Stin] Stin Number as a function of the index Stin
391 
392  // Int_t fMemoReadNumberOfEventsforSamples;
393 
394  TString fPathRoot; // path for results .root files directory
395 
396  Int_t fNbChanByLine; // Nb channels by line (for ASCII results file)
397  Int_t fNbSampByLine; // Nb samples by line (for ASCII results file)
398 
399  Int_t fFlagPrint;
401 
402  //............... flag data exists
403 
404  Bool_t fDataExist;
405 
406  //................ 3d array for sample ADC value fast transfert
407  Double_t ***fT3d_AdcValues; // 3D array[channel][sample][event] ADC values distibutions
408  Double_t **fT3d2_AdcValues;
409  Double_t *fT3d1_AdcValues;
410 
411  //==========================================================================================
412  //
413  // M E T H O D S
414  //
415  //==========================================================================================
416  //.......................................... private methods
417 
418  void fCopy(const TEcnaRead &);
419 
420 public:
421  //................. constructors
422  TEcnaRead(); // constructor without argument (FOR USER'S DECLARATION)
423  // constructor with argument (FOR USER'S DECLARATION):
424  TEcnaRead(TEcnaObject *, const TString &);
425 
426  TEcnaRead(const TEcnaRead &); // copy constructor
427 
428  //.................... C++ methods
429  TEcnaRead &operator=(const TEcnaRead &); // overloading of the operator=
430 
431  //................. destructor
432  ~TEcnaRead() override;
433 
434  //========================================================================
435  //
436  // METHODS FOR THE USER
437  //
438  //========================================================================
439  void FileParameters(const TString &,
440  const Int_t &,
441  const Int_t &,
442  const Int_t &,
443  const Int_t &,
444  const Int_t &,
445  const Int_t &,
446  const TString &);
447 
448  Bool_t LookAtRootFile(); // if file exists: kTRUE , if not: kFALSE
449  Bool_t DataExist(); // if data exist: kTRUE , if not: kFALSE
450 
451  TVectorD Read1DHisto(const Int_t &, const TString &, const Int_t &, const Int_t &, const Int_t &);
452  TVectorD Read1DHisto(const Int_t &, const TString &, const Int_t &);
453  TVectorD Read1DHisto(const Int_t &, const TString &, const TString &);
454 
455  TMatrixD ReadMatrix(const Int_t &, const TString &, const TString &, const Int_t &, const Int_t &);
456  TMatrixD ReadMatrix(const Int_t &, const TString &, const TString &);
457 
458  //========================================================================
459  //
460  // "TECHNICAL" METHODS
461  //
462  //========================================================================
463  //...................................................... methods that will (should) be private
464  void Init();
465  void SetEcalSubDetector(const TString &);
466 
467  void Anew(const TString &);
468  void Adelete(const TString &);
469 
470  Bool_t OpenRootFile(const Text_t *, const TString &);
471  Bool_t CloseRootFile(const Text_t *);
472  void TestArrayDimH1(const TString &, const TString &, const Int_t &, const Int_t &);
473  void TestArrayDimH2(const TString &, const TString &, const Int_t &, const Int_t &);
474 
475  Bool_t ReadRootFileHeader(const Int_t &);
476 
477  TVectorD ReadSampleAdcValues(const Int_t &,
478  const Int_t &,
479  const Int_t &,
480  const Int_t &); //(nb evts in burst) of (StinEcha,samp)
481  //------------------------------------------------------------------------------------------------
482  TVectorD ReadSampleMeans(const Int_t &, const Int_t &, const Int_t &); // (sample) of (StexStin,Xtal)
483  TVectorD ReadSampleMeans(const Int_t &, const Int_t &); // (MaxCrysInStin*sample) of (StexStin)
484 
485  TVectorD ReadSampleSigmas(const Int_t &, const Int_t &, const Int_t &); // (sample) of (StexStin,Xtal)
486  TVectorD ReadSampleSigmas(const Int_t &, const Int_t &); // (MaxCrysInStin*sample) of (StexStin)
487 
488  //------------------------------------------------------------------------------------------------
489  TVectorD ReadNumberOfEvents(const Int_t &); // EcnaStexCrys of (StexEcha)
490  TVectorD ReadPedestals(const Int_t &); // EcnaStexCrys of (StexEcha)
491  TVectorD ReadTotalNoise(const Int_t &); // EcnaStexCrys of (StexEcha)
492  TVectorD ReadLowFrequencyNoise(const Int_t &); // EcnaStexCrys of (StexEcha)
493  TVectorD ReadHighFrequencyNoise(const Int_t &); // EcnaStexCrys of (StexEcha)
494  TVectorD ReadMeanCorrelationsBetweenSamples(const Int_t &); // EcnaStexCrys of (StexEcha)
495  TVectorD ReadSigmaOfCorrelationsBetweenSamples(const Int_t &); // EcnaStexCrys of (StexEcha)
496 
497  //------------------------------------------------------------------------------------------------
498  TVectorD ReadAverageNumberOfEvents(const Int_t &); // EcnaStexStin of (StexStin)
499  TVectorD ReadAveragePedestals(const Int_t &); // EcnaStexStin of (StexStin)
500  TVectorD ReadAverageTotalNoise(const Int_t &); // EcnaStexStin of (StexStin)
501  TVectorD ReadAverageLowFrequencyNoise(const Int_t &); // EcnaStexStin of (StexStin)
502  TVectorD ReadAverageHighFrequencyNoise(const Int_t &); // EcnaStexStin of (StexStin)
503  TVectorD ReadAverageMeanCorrelationsBetweenSamples(const Int_t &); // EcnaStexStin of (StexStin)
504  TVectorD ReadAverageSigmaOfCorrelationsBetweenSamples(const Int_t &); // EcnaStexStin of (StexStin)
505 
506  //------------------------------------------------------------------------------------------------
507  TMatrixD ReadCovariancesBetweenSamples(const Int_t &,
508  const Int_t &,
509  const Int_t &); // (samp,samp) of (StexStin,Xtal)
510  TMatrixD ReadCorrelationsBetweenSamples(const Int_t &,
511  const Int_t &,
512  const Int_t &); // (samp,samp) of (StexStin,Xtal)
513 
514  //-----------------------------------------------------------------------------------------------
515  TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &);
516  TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &);
517  // (Xtal in Stin X, Xtal in Stin Y) of (Stin_X, Stin_Y)
518 
519  TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &);
520  TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &);
521  // (Xtal in Stin X, Xtal in Stin Y) of (Stin_X, Stin_Y)
522 
523  //------------------- (BIG MATRIX 1700x1700 for barrel, 5000x5000? for endcap) ------------------
524  TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t &); // (Xtal in Stin X, Xtal in Stin Y) for all Stins
525  TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t &);
526  TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t &); // (Xtal in Stin X, Xtal in Stin Y) for all Stins
527  TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t &);
528 
529  //-----------------------------------------------------------------------------------------------
530  TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t &); // 1 of (Stin,Stin)
531  TMatrixD ReadHighFrequencyMeanCorrelationsBetweenStins(const Int_t &); // 1 of (Stin,Stin)
532 
533  //------------------------------------------------------------------------------------------------
534  const TString &GetAnalysisName() const;
535  Int_t GetNbOfSamples();
536  Int_t GetRunNumber();
537  Int_t GetFirstReqEvtNumber();
538  Int_t GetLastReqEvtNumber();
539  Int_t GetReqNbOfEvts();
540  Int_t GetStexNumber();
541 
542  time_t GetStartTime();
543  time_t GetStopTime();
544  const TString &GetStartDate() const;
545  const TString &GetStopDate() const;
546  const TString &GetRootFileName() const;
547  const TString &GetRootFileNameShort() const;
548 
549  TString GetRunType();
550 
551  //------------------------------------------------------------------------------- "technical" methods
552  TVectorD ReadRelevantCorrelationsBetweenSamples(const Int_t &, const Int_t &, const Int_t &);
553  // N(N-1)/2 of (StexStin, Xtal)
554 
555  Int_t GetStexStinFromIndex(const Int_t &); // (no read in the ROOT file)
556  Int_t GetStinIndex(const Int_t &); // Stin index from Stin number (StexStin)
557 
558  TVectorD ReadStinNumbers(const Int_t &);
559  TMatrixD ReadNumberOfEventsForSamples(const Int_t &, const Int_t &, const Int_t &); // (Xtal,sample) of (StexStin)
560 
561  Double_t ***ReadSampleAdcValuesSameFile(const Int_t &, const Int_t &, const Int_t &);
562 
563  Int_t GetNumberOfEvents(const Int_t &, const Int_t &);
565 
566  TString GetTypeOfQuantity(const CnaResultTyp);
567 
568  TString GetTechReadCode(const TString &, const TString &);
569 
570  //------------------------------------------------------------------------------------------------
571  //............... Flags Print Comments/Debug
572 
573  void PrintNoComment(); // (default) Set flags to forbid the printing of all the comments
574  // except ERRORS
575  void PrintWarnings(); // Set flags to authorize printing of some warnings
576  void PrintComments(); // Set flags to authorize printing of infos and some comments
577  // concerning initialisations
578  void PrintAllComments(); // Set flags to authorize printing of all the comments
579 
580  ClassDefOverride(TEcnaRead, 1) // Calculation of correlated noises from data
581 };
582 
583 #endif // CL_TEcnaRead_H
void TestArrayDimH1(const TString &, const TString &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1193
const TString & GetRootFileNameShort() const
Definition: TEcnaRead.cc:4213
TVectorD ReadLowFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2058
Int_t GetRunNumber()
Definition: TEcnaRead.cc:820
TVectorD ReadAverageHighFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2567
Int_t fCnew
Definition: TEcnaRead.h:360
Int_t GetLastReqEvtNumber()
Definition: TEcnaRead.cc:822
Int_t fMemoStinNumbers
Definition: TEcnaRead.h:390
TEcnaRead & operator=(const TEcnaRead &)
Definition: TEcnaRead.cc:250
CnaResultTyp
TMatrixD ReadCovariancesBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:2795
TString fPathRoot
Definition: TEcnaRead.h:394
TVectorD Read1DHisto(const Int_t &, const TString &, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:325
TVectorD ReadSampleAdcValues(const Int_t &, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1343
Int_t GetNumberOfEvents(const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:4074
TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3122
Int_t GetStinIndex(const Int_t &)
Definition: TEcnaRead.cc:4242
TVectorD ReadSigmaOfCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2202
TEcnaWrite * fCnaWrite
Definition: TEcnaRead.h:374
Int_t fgMaxCar
Definition: TEcnaRead.h:358
const TString & GetStartDate() const
Definition: TEcnaRead.cc:832
void PrintComments()
Definition: TEcnaRead.cc:4298
TVectorD ReadAverageNumberOfEvents(const Int_t &)
Definition: TEcnaRead.cc:2279
time_t GetStopTime()
Definition: TEcnaRead.cc:831
Int_t fReadyToReadRootFile
Definition: TEcnaRead.h:385
TEcnaParHistos * fCnaParHistos
Definition: TEcnaRead.h:373
Int_t fCodePrintAllComments
Definition: TEcnaRead.h:400
TMatrixD ReadHighFrequencyMeanCorrelationsBetweenStins(const Int_t &)
Definition: TEcnaRead.cc:3873
TMatrixD ReadMatrix(const Int_t &, const TString &, const TString &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:547
void Adelete(const TString &)
Definition: TEcnaRead.cc:198
Int_t GetNumberOfBinsSampleAsFunctionOfTime()
Definition: TEcnaRead.cc:4236
TVectorD ReadRelevantCorrelationsBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:2952
TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t &)
Definition: TEcnaRead.cc:3781
TVectorD ReadAverageTotalNoise(const Int_t &)
Definition: TEcnaRead.cc:2421
TString GetTypeOfQuantity(const CnaResultTyp)
Definition: TEcnaRead.cc:4106
Int_t fCodePrintWarnings
Definition: TEcnaRead.h:400
const TString & GetStopDate() const
Definition: TEcnaRead.cc:833
const TString & GetRootFileName() const
Definition: TEcnaRead.cc:4212
Int_t GetFirstReqEvtNumber()
Definition: TEcnaRead.cc:821
Bool_t ReadRootFileHeader(const Int_t &)
Definition: TEcnaRead.cc:1108
Int_t fCodePrintNoComment
Definition: TEcnaRead.h:400
void SetEcalSubDetector(const TString &)
Definition: TEcnaRead.cc:172
Int_t * fT1d_StexStinFromIndex
Definition: TEcnaRead.h:388
TVectorD ReadStinNumbers(const Int_t &)
Definition: TEcnaRead.cc:1240
TVectorD ReadSampleSigmas(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1573
Int_t GetStexStinFromIndex(const Int_t &)
Definition: TEcnaRead.cc:4221
TString fStexName
Definition: TEcnaRead.h:379
TString fTTBELL
Definition: TEcnaRead.h:363
TVectorD ReadTotalNoise(const Int_t &)
Definition: TEcnaRead.cc:1915
~TEcnaRead() override
Definition: TEcnaRead.cc:263
TVectorD ReadAveragePedestals(const Int_t &)
Definition: TEcnaRead.cc:2348
TEcnaParCout * fCnaParCout
Definition: TEcnaRead.h:367
TString fFlagNoFileOpen
Definition: TEcnaRead.h:383
void PrintNoComment()
Definition: TEcnaRead.cc:4319
TVectorD ReadPedestals(const Int_t &)
Definition: TEcnaRead.cc:1843
TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3035
Double_t ** fT3d2_AdcValues
Definition: TEcnaRead.h:408
Double_t * fT3d1_AdcValues
Definition: TEcnaRead.h:409
Bool_t DataExist()
Definition: TEcnaRead.cc:1097
TEcnaParPaths * fCnaParPaths
Definition: TEcnaRead.h:368
Int_t GetNbOfSamples()
Definition: TEcnaRead.cc:819
Int_t fCdelete
Definition: TEcnaRead.h:361
void fCopy(const TEcnaRead &)
Definition: TEcnaRead.cc:208
TEcnaHeader * fFileHeader
Definition: TEcnaRead.h:370
TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3297
Int_t fNbSampByLine
Definition: TEcnaRead.h:397
void Init()
Definition: TEcnaRead.cc:115
void Anew(const TString &)
Definition: TEcnaRead.cc:190
TVectorD ReadHighFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2130
TMatrixD ReadNumberOfEventsForSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1757
Double_t *** ReadSampleAdcValuesSameFile(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3975
TVectorD ReadAverageLowFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2494
void FileParameters(const TString &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const TString &)
Definition: TEcnaRead.cc:729
TString GetTechReadCode(const TString &, const TString &)
Definition: TEcnaRead.cc:657
const TString & GetAnalysisName() const
Definition: TEcnaRead.cc:818
Int_t GetReqNbOfEvts()
Definition: TEcnaRead.cc:823
TEcnaParEcal * fEcal
Definition: TEcnaRead.h:371
Bool_t OpenRootFile(const Text_t *, const TString &)
Definition: TEcnaRead.cc:932
Int_t fFlagPrint
Definition: TEcnaRead.h:399
TEcnaObject * fObjectManager
Definition: TEcnaRead.h:365
TEcnaNumbering * fEcalNumbering
Definition: TEcnaRead.h:372
TString GetRunType()
Definition: TEcnaRead.cc:834
Bool_t fDataExist
Definition: TEcnaRead.h:404
TString fFlagSubDet
Definition: TEcnaRead.h:378
TMatrixD ReadCorrelationsBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:2875
TVectorD ReadMeanCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:1985
Bool_t LookAtRootFile()
Definition: TEcnaRead.cc:1040
TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3210
Double_t *** fT3d_AdcValues
Definition: TEcnaRead.h:407
Bool_t CloseRootFile(const Text_t *)
Definition: TEcnaRead.cc:997
Bool_t fOpenRootFile
Definition: TEcnaRead.h:381
Int_t GetStexNumber()
Definition: TEcnaRead.cc:824
Int_t * fTagStinNumbers
Definition: TEcnaRead.h:389
Int_t fNbChanByLine
Definition: TEcnaRead.h:396
void PrintAllComments()
Definition: TEcnaRead.cc:4312
Int_t fCodePrintComments
Definition: TEcnaRead.h:400
void TestArrayDimH2(const TString &, const TString &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1214
TVectorD ReadSampleMeans(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1421
TVectorD ReadAverageMeanCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2640
TString fStinName
Definition: TEcnaRead.h:379
TString fCurrentlyOpenFileName
Definition: TEcnaRead.h:382
TVectorD ReadAverageSigmaOfCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2715
Int_t fLookAtRootFile
Definition: TEcnaRead.h:386
void PrintWarnings()
Definition: TEcnaRead.cc:4305
time_t GetStartTime()
Definition: TEcnaRead.cc:830
TVectorD ReadNumberOfEvents(const Int_t &)
Definition: TEcnaRead.cc:1711