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  TString GetAnalysisName();
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  TString GetStartDate();
545  TString GetStopDate();
546  TString GetRootFileName();
547  TString GetRootFileNameShort();
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:1196
TVectorD ReadLowFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2070
Int_t GetRunNumber()
Definition: TEcnaRead.cc:823
TVectorD ReadAverageHighFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2585
Int_t fCnew
Definition: TEcnaRead.h:360
Int_t GetLastReqEvtNumber()
Definition: TEcnaRead.cc:825
Int_t fMemoStinNumbers
Definition: TEcnaRead.h:390
TEcnaRead & operator=(const TEcnaRead &)
Definition: TEcnaRead.cc:253
CnaResultTyp
TMatrixD ReadCovariancesBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:2816
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:328
TVectorD ReadSampleAdcValues(const Int_t &, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1347
Int_t GetNumberOfEvents(const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:4108
TString GetStartDate()
Definition: TEcnaRead.cc:835
TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3147
Int_t GetStinIndex(const Int_t &)
Definition: TEcnaRead.cc:4276
TVectorD ReadSigmaOfCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2216
TEcnaWrite * fCnaWrite
Definition: TEcnaRead.h:374
Int_t fgMaxCar
Definition: TEcnaRead.h:358
TString GetRootFileNameShort()
Definition: TEcnaRead.cc:4247
void PrintComments()
Definition: TEcnaRead.cc:4332
TVectorD ReadAverageNumberOfEvents(const Int_t &)
Definition: TEcnaRead.cc:2294
time_t GetStopTime()
Definition: TEcnaRead.cc:834
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:3906
TMatrixD ReadMatrix(const Int_t &, const TString &, const TString &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:550
void Adelete(const TString &)
Definition: TEcnaRead.cc:201
Int_t GetNumberOfBinsSampleAsFunctionOfTime()
Definition: TEcnaRead.cc:4270
TVectorD ReadRelevantCorrelationsBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:2975
TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t &)
Definition: TEcnaRead.cc:3813
TVectorD ReadAverageTotalNoise(const Int_t &)
Definition: TEcnaRead.cc:2437
TString GetTypeOfQuantity(const CnaResultTyp)
Definition: TEcnaRead.cc:4140
Int_t fCodePrintWarnings
Definition: TEcnaRead.h:400
Int_t GetFirstReqEvtNumber()
Definition: TEcnaRead.cc:824
Bool_t ReadRootFileHeader(const Int_t &)
Definition: TEcnaRead.cc:1111
Int_t fCodePrintNoComment
Definition: TEcnaRead.h:400
void SetEcalSubDetector(const TString &)
Definition: TEcnaRead.cc:175
Int_t * fT1d_StexStinFromIndex
Definition: TEcnaRead.h:388
TVectorD ReadStinNumbers(const Int_t &)
Definition: TEcnaRead.cc:1243
TVectorD ReadSampleSigmas(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1580
Int_t GetStexStinFromIndex(const Int_t &)
Definition: TEcnaRead.cc:4255
TString fStexName
Definition: TEcnaRead.h:379
TString fTTBELL
Definition: TEcnaRead.h:363
TVectorD ReadTotalNoise(const Int_t &)
Definition: TEcnaRead.cc:1925
~TEcnaRead() override
Definition: TEcnaRead.cc:266
TVectorD ReadAveragePedestals(const Int_t &)
Definition: TEcnaRead.cc:2363
TString GetStopDate()
Definition: TEcnaRead.cc:836
TEcnaParCout * fCnaParCout
Definition: TEcnaRead.h:367
TString fFlagNoFileOpen
Definition: TEcnaRead.h:383
void PrintNoComment()
Definition: TEcnaRead.cc:4353
TVectorD ReadPedestals(const Int_t &)
Definition: TEcnaRead.cc:1852
TString GetRootFileName()
Definition: TEcnaRead.cc:4246
TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3059
Double_t ** fT3d2_AdcValues
Definition: TEcnaRead.h:408
Double_t * fT3d1_AdcValues
Definition: TEcnaRead.h:409
Bool_t DataExist()
Definition: TEcnaRead.cc:1100
TEcnaParPaths * fCnaParPaths
Definition: TEcnaRead.h:368
Int_t GetNbOfSamples()
Definition: TEcnaRead.cc:822
Int_t fCdelete
Definition: TEcnaRead.h:361
void fCopy(const TEcnaRead &)
Definition: TEcnaRead.cc:211
TString GetAnalysisName()
Definition: TEcnaRead.cc:821
TEcnaHeader * fFileHeader
Definition: TEcnaRead.h:370
TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3324
Int_t fNbSampByLine
Definition: TEcnaRead.h:397
void Init()
Definition: TEcnaRead.cc:115
void Anew(const TString &)
Definition: TEcnaRead.cc:193
TVectorD ReadHighFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2143
TMatrixD ReadNumberOfEventsForSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1765
Double_t *** ReadSampleAdcValuesSameFile(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:4009
TVectorD ReadAverageLowFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2511
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:732
TString GetTechReadCode(const TString &, const TString &)
Definition: TEcnaRead.cc:660
Int_t GetReqNbOfEvts()
Definition: TEcnaRead.cc:826
TEcnaParEcal * fEcal
Definition: TEcnaRead.h:371
Bool_t OpenRootFile(const Text_t *, const TString &)
Definition: TEcnaRead.cc:935
Int_t fFlagPrint
Definition: TEcnaRead.h:399
TEcnaObject * fObjectManager
Definition: TEcnaRead.h:365
TEcnaNumbering * fEcalNumbering
Definition: TEcnaRead.h:372
TString GetRunType()
Definition: TEcnaRead.cc:837
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:2897
TVectorD ReadMeanCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:1996
Bool_t LookAtRootFile()
Definition: TEcnaRead.cc:1043
TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3236
Double_t *** fT3d_AdcValues
Definition: TEcnaRead.h:407
Bool_t CloseRootFile(const Text_t *)
Definition: TEcnaRead.cc:1000
Bool_t fOpenRootFile
Definition: TEcnaRead.h:381
Int_t GetStexNumber()
Definition: TEcnaRead.cc:827
Int_t * fTagStinNumbers
Definition: TEcnaRead.h:389
Int_t fNbChanByLine
Definition: TEcnaRead.h:396
void PrintAllComments()
Definition: TEcnaRead.cc:4346
Int_t fCodePrintComments
Definition: TEcnaRead.h:400
void TestArrayDimH2(const TString &, const TString &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1217
TVectorD ReadSampleMeans(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1426
TVectorD ReadAverageMeanCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2659
TString fStinName
Definition: TEcnaRead.h:379
TString fCurrentlyOpenFileName
Definition: TEcnaRead.h:382
TVectorD ReadAverageSigmaOfCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2735
Int_t fLookAtRootFile
Definition: TEcnaRead.h:386
void PrintWarnings()
Definition: TEcnaRead.cc:4339
time_t GetStartTime()
Definition: TEcnaRead.cc:833
TVectorD ReadNumberOfEvents(const Int_t &)
Definition: TEcnaRead.cc:1719