test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TEcnaRead.h
Go to the documentation of this file.
1 #ifndef CL_TEcnaRead_H
2 #define CL_TEcnaRead_H
3 
4 #include <time.h>
5 #include <math.h>
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 
354  private:
355 
356  //............ attributes
357 
358  // static const Int_t fgMaxCar = 512; <== DANGEROUS !
359 
360  Int_t fgMaxCar; // Max nb of caracters for char*
361 
362  Int_t fCnew; // flags for dynamical allocation
363  Int_t fCdelete;
364 
365  TString fTTBELL;
366 
367  TEcnaObject *fObjectManager; // pointer to TEcnaObject keeped in attribute
368 
369  TEcnaParCout *fCnaParCout; // for comments or error messages
370  TEcnaParPaths *fCnaParPaths; // for NbBinsADC
371 
372  TEcnaHeader *fFileHeader; // header for result file
373  TEcnaParEcal *fEcal; // for Ecal parameters
374  TEcnaNumbering *fEcalNumbering; // for Ecal numbering
375  TEcnaParHistos *fCnaParHistos; // for Histo codes
376  TEcnaWrite *fCnaWrite; // for writing in ascii files
377 
378  // TEcnaRootFile *gCnaRootFile;
379 
380  TString fFlagSubDet;
382 
383  Bool_t fOpenRootFile; // flag open ROOT file (open = kTRUE, close = kFALSE)
384  TString fCurrentlyOpenFileName; // Name of the file currently open
385  TString fFlagNoFileOpen; // Flag to indicate that no file is open
386 
389 
390  Int_t* fT1d_StexStinFromIndex; // 1D array[Stin] Stin Number as a function of the index Stin
393 
394  // Int_t fMemoReadNumberOfEventsforSamples;
395 
396  TString fPathRoot; // path for results .root files directory
397 
398  Int_t fNbChanByLine; // Nb channels by line (for ASCII results file)
399  Int_t fNbSampByLine; // Nb samples by line (for ASCII results file)
400 
401  Int_t fFlagPrint;
403 
404  //............... flag data exists
405 
406  Bool_t fDataExist;
407 
408  //................ 3d array for sample ADC value fast transfert
409  Double_t*** fT3d_AdcValues; // 3D array[channel][sample][event] ADC values distibutions
410  Double_t** fT3d2_AdcValues;
411  Double_t* fT3d1_AdcValues;
412 
413  //==========================================================================================
414  //
415  // M E T H O D S
416  //
417  //==========================================================================================
418  //.......................................... private methods
419 
420  void fCopy(const TEcnaRead&);
421 
422  public:
423 
424  //................. constructors
425  TEcnaRead(); // constructor without argument (FOR USER'S DECLARATION)
426  // constructor with argument (FOR USER'S DECLARATION):
427  TEcnaRead(TEcnaObject*, const TString&);
428 
429  TEcnaRead(const TEcnaRead&); // copy constructor
430 
431  //.................... C++ methods
432  TEcnaRead& operator=(const TEcnaRead&); // overloading of the operator=
433 
434  //................. destructor
435  virtual ~TEcnaRead();
436 
437  //========================================================================
438  //
439  // METHODS FOR THE USER
440  //
441  //========================================================================
442  void FileParameters(const TString&,
443  const Int_t&, const Int_t&, const Int_t&,
444  const Int_t&, const Int_t&, const Int_t&, const TString&);
445 
446  Bool_t LookAtRootFile(); // if file exists: kTRUE , if not: kFALSE
447  Bool_t DataExist(); // if data exist: kTRUE , if not: kFALSE
448 
449  TVectorD Read1DHisto(const Int_t&, const TString&, const Int_t&, const Int_t&, const Int_t&);
450  TVectorD Read1DHisto(const Int_t&, const TString&, const Int_t&);
451  TVectorD Read1DHisto(const Int_t&, const TString&, const TString&);
452 
453  TMatrixD ReadMatrix(const Int_t&, const TString&, const TString&, const Int_t&, const Int_t&);
454  TMatrixD ReadMatrix(const Int_t&, const TString&, const TString&);
455 
456  //========================================================================
457  //
458  // "TECHNICAL" METHODS
459  //
460  //========================================================================
461  //...................................................... methods that will (should) be private
462  void Init();
463  void SetEcalSubDetector(const TString&);
464 
465  void Anew(const TString&);
466  void Adelete(const TString&);
467 
468  Bool_t OpenRootFile(const Text_t *, const TString&);
469  Bool_t CloseRootFile(const Text_t *);
470  void TestArrayDimH1(const TString&, const TString&, const Int_t&, const Int_t&);
471  void TestArrayDimH2(const TString&, const TString&, const Int_t&, const Int_t&);
472 
473  Bool_t ReadRootFileHeader(const Int_t&);
474 
475  TVectorD ReadSampleAdcValues(const Int_t&, const Int_t&, const Int_t&, const Int_t&); //(nb evts in burst) of (StinEcha,samp)
476  //------------------------------------------------------------------------------------------------
477  TVectorD ReadSampleMeans(const Int_t&, const Int_t&, const Int_t&); // (sample) of (StexStin,Xtal)
478  TVectorD ReadSampleMeans(const Int_t&, const Int_t&); // (MaxCrysInStin*sample) of (StexStin)
479 
480  TVectorD ReadSampleSigmas(const Int_t&, const Int_t&, const Int_t&); // (sample) of (StexStin,Xtal)
481  TVectorD ReadSampleSigmas(const Int_t&, const Int_t&); // (MaxCrysInStin*sample) of (StexStin)
482 
483  //------------------------------------------------------------------------------------------------
484  TVectorD ReadNumberOfEvents(const Int_t&); // EcnaStexCrys of (StexEcha)
485  TVectorD ReadPedestals(const Int_t&); // EcnaStexCrys of (StexEcha)
486  TVectorD ReadTotalNoise(const Int_t&); // EcnaStexCrys of (StexEcha)
487  TVectorD ReadLowFrequencyNoise(const Int_t&); // EcnaStexCrys of (StexEcha)
488  TVectorD ReadHighFrequencyNoise(const Int_t&); // EcnaStexCrys of (StexEcha)
489  TVectorD ReadMeanCorrelationsBetweenSamples(const Int_t&); // EcnaStexCrys of (StexEcha)
490  TVectorD ReadSigmaOfCorrelationsBetweenSamples(const Int_t&); // EcnaStexCrys of (StexEcha)
491 
492  //------------------------------------------------------------------------------------------------
493  TVectorD ReadAverageNumberOfEvents(const Int_t&); // EcnaStexStin of (StexStin)
494  TVectorD ReadAveragePedestals(const Int_t&); // EcnaStexStin of (StexStin)
495  TVectorD ReadAverageTotalNoise(const Int_t&); // EcnaStexStin of (StexStin)
496  TVectorD ReadAverageLowFrequencyNoise(const Int_t&); // EcnaStexStin of (StexStin)
497  TVectorD ReadAverageHighFrequencyNoise(const Int_t&); // EcnaStexStin of (StexStin)
498  TVectorD ReadAverageMeanCorrelationsBetweenSamples(const Int_t&); // EcnaStexStin of (StexStin)
499  TVectorD ReadAverageSigmaOfCorrelationsBetweenSamples(const Int_t&); // EcnaStexStin of (StexStin)
500 
501  //------------------------------------------------------------------------------------------------
502  TMatrixD ReadCovariancesBetweenSamples(const Int_t&, const Int_t&, const Int_t&); // (samp,samp) of (StexStin,Xtal)
503  TMatrixD ReadCorrelationsBetweenSamples(const Int_t&, const Int_t&, const Int_t&); // (samp,samp) of (StexStin,Xtal)
504 
505  //-----------------------------------------------------------------------------------------------
506  TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t&, const Int_t&, const Int_t&);
507  TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t&, const Int_t&, const Int_t&);
508  // (Xtal in Stin X, Xtal in Stin Y) of (Stin_X, Stin_Y)
509 
510  TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t&, const Int_t&, const Int_t&);
511  TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t&, const Int_t&, const Int_t&);
512  // (Xtal in Stin X, Xtal in Stin Y) of (Stin_X, Stin_Y)
513 
514  //------------------- (BIG MATRIX 1700x1700 for barrel, 5000x5000? for endcap) ------------------
515  TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t&); // (Xtal in Stin X, Xtal in Stin Y) for all Stins
516  TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t&);
517  TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t&); // (Xtal in Stin X, Xtal in Stin Y) for all Stins
518  TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t&);
519 
520  //-----------------------------------------------------------------------------------------------
521  TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t&); // 1 of (Stin,Stin)
522  TMatrixD ReadHighFrequencyMeanCorrelationsBetweenStins(const Int_t&); // 1 of (Stin,Stin)
523 
524  //------------------------------------------------------------------------------------------------
525  TString GetAnalysisName();
526  Int_t GetNbOfSamples();
527  Int_t GetRunNumber();
528  Int_t GetFirstReqEvtNumber();
529  Int_t GetLastReqEvtNumber();
530  Int_t GetReqNbOfEvts();
531  Int_t GetStexNumber();
532 
533  time_t GetStartTime();
534  time_t GetStopTime();
535  TString GetStartDate();
536  TString GetStopDate();
537  TString GetRootFileName();
538  TString GetRootFileNameShort();
539 
540  TString GetRunType();
541 
542  //------------------------------------------------------------------------------- "technical" methods
543  TVectorD ReadRelevantCorrelationsBetweenSamples(const Int_t&, const Int_t&, const Int_t&);
544  // N(N-1)/2 of (StexStin, Xtal)
545 
546  Int_t GetStexStinFromIndex(const Int_t&); // (no read in the ROOT file)
547  Int_t GetStinIndex(const Int_t&); // Stin index from Stin number (StexStin)
548 
549  TVectorD ReadStinNumbers(const Int_t&);
550  TMatrixD ReadNumberOfEventsForSamples(const Int_t&, const Int_t&, const Int_t&); // (Xtal,sample) of (StexStin)
551 
552  Double_t*** ReadSampleAdcValuesSameFile(const Int_t&, const Int_t&, const Int_t&);
553 
554  Int_t GetNumberOfEvents(const Int_t&, const Int_t&);
556 
557  TString GetTypeOfQuantity(const CnaResultTyp);
558 
559  TString GetTechReadCode(const TString&, const TString&);
560 
561  //------------------------------------------------------------------------------------------------
562  //............... Flags Print Comments/Debug
563 
564  void PrintNoComment(); // (default) Set flags to forbid the printing of all the comments
565  // except ERRORS
566  void PrintWarnings(); // Set flags to authorize printing of some warnings
567  void PrintComments(); // Set flags to authorize printing of infos and some comments
568  // concerning initialisations
569  void PrintAllComments(); // Set flags to authorize printing of all the comments
570 
571 ClassDef(TEcnaRead,1) // Calculation of correlated noises from data
572 };
573 
574 #endif // CL_TEcnaRead_H
575 
576 
void TestArrayDimH1(const TString &, const TString &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1076
TVectorD ReadLowFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2049
Int_t GetRunNumber()
Definition: TEcnaRead.cc:744
TVectorD ReadAverageHighFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2610
Int_t fCnew
Definition: TEcnaRead.h:362
Int_t GetLastReqEvtNumber()
Definition: TEcnaRead.cc:746
Int_t fMemoStinNumbers
Definition: TEcnaRead.h:392
TEcnaRead & operator=(const TEcnaRead &)
Definition: TEcnaRead.cc:250
CnaResultTyp
TMatrixD ReadCovariancesBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:2867
TString fPathRoot
Definition: TEcnaRead.h:396
TVectorD Read1DHisto(const Int_t &, const TString &, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:313
TVectorD ReadSampleAdcValues(const Int_t &, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1248
Int_t GetNumberOfEvents(const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:4275
TString GetStartDate()
Definition: TEcnaRead.cc:756
TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3221
Int_t GetStinIndex(const Int_t &)
Definition: TEcnaRead.cc:4385
TVectorD ReadSigmaOfCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2211
TEcnaWrite * fCnaWrite
Definition: TEcnaRead.h:376
Int_t fgMaxCar
Definition: TEcnaRead.h:360
TString GetRootFileNameShort()
Definition: TEcnaRead.cc:4357
void PrintComments()
Definition: TEcnaRead.cc:4438
TVectorD ReadAverageNumberOfEvents(const Int_t &)
Definition: TEcnaRead.cc:2296
time_t GetStopTime()
Definition: TEcnaRead.cc:755
Int_t fReadyToReadRootFile
Definition: TEcnaRead.h:387
TEcnaParHistos * fCnaParHistos
Definition: TEcnaRead.h:375
Int_t fCodePrintAllComments
Definition: TEcnaRead.h:402
TMatrixD ReadHighFrequencyMeanCorrelationsBetweenStins(const Int_t &)
Definition: TEcnaRead.cc:4053
TMatrixD ReadMatrix(const Int_t &, const TString &, const TString &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:501
void Adelete(const TString &)
Definition: TEcnaRead.cc:193
Int_t GetNumberOfBinsSampleAsFunctionOfTime()
Definition: TEcnaRead.cc:4379
TVectorD ReadRelevantCorrelationsBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3038
TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t &)
Definition: TEcnaRead.cc:3951
TVectorD ReadAverageTotalNoise(const Int_t &)
Definition: TEcnaRead.cc:2444
TString GetTypeOfQuantity(const CnaResultTyp)
Definition: TEcnaRead.cc:4302
Int_t fCodePrintWarnings
Definition: TEcnaRead.h:402
Int_t GetFirstReqEvtNumber()
Definition: TEcnaRead.cc:745
Bool_t ReadRootFileHeader(const Int_t &)
Definition: TEcnaRead.cc:988
Int_t fCodePrintNoComment
Definition: TEcnaRead.h:402
void SetEcalSubDetector(const TString &)
Definition: TEcnaRead.cc:171
Int_t * fT1d_StexStinFromIndex
Definition: TEcnaRead.h:390
TVectorD ReadStinNumbers(const Int_t &)
Definition: TEcnaRead.cc:1129
TVectorD ReadSampleSigmas(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1507
Int_t GetStexStinFromIndex(const Int_t &)
Definition: TEcnaRead.cc:4365
TString fStexName
Definition: TEcnaRead.h:381
TString fTTBELL
Definition: TEcnaRead.h:365
TVectorD ReadTotalNoise(const Int_t &)
Definition: TEcnaRead.cc:1889
TVectorD ReadAveragePedestals(const Int_t &)
Definition: TEcnaRead.cc:2361
TString GetStopDate()
Definition: TEcnaRead.cc:757
TEcnaParCout * fCnaParCout
Definition: TEcnaRead.h:369
TString fFlagNoFileOpen
Definition: TEcnaRead.h:385
void PrintNoComment()
Definition: TEcnaRead.cc:4462
TVectorD ReadPedestals(const Int_t &)
Definition: TEcnaRead.cc:1807
TString GetRootFileName()
Definition: TEcnaRead.cc:4356
TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3125
Double_t ** fT3d2_AdcValues
Definition: TEcnaRead.h:410
Double_t * fT3d1_AdcValues
Definition: TEcnaRead.h:411
Bool_t DataExist()
Definition: TEcnaRead.cc:976
TEcnaParPaths * fCnaParPaths
Definition: TEcnaRead.h:370
Int_t GetNbOfSamples()
Definition: TEcnaRead.cc:743
Int_t fCdelete
Definition: TEcnaRead.h:363
void fCopy(const TEcnaRead &)
Definition: TEcnaRead.cc:204
TString GetAnalysisName()
Definition: TEcnaRead.cc:742
TEcnaHeader * fFileHeader
Definition: TEcnaRead.h:372
TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3413
Int_t fNbSampByLine
Definition: TEcnaRead.h:399
void Init()
Definition: TEcnaRead.cc:110
void Anew(const TString &)
Definition: TEcnaRead.cc:184
TVectorD ReadHighFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2130
TMatrixD ReadNumberOfEventsForSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1705
Double_t *** ReadSampleAdcValuesSameFile(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:4162
TVectorD ReadAverageLowFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2527
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:649
TString GetTechReadCode(const TString &, const TString &)
Definition: TEcnaRead.cc:602
Int_t GetReqNbOfEvts()
Definition: TEcnaRead.cc:747
TEcnaParEcal * fEcal
Definition: TEcnaRead.h:373
Bool_t OpenRootFile(const Text_t *, const TString &)
Definition: TEcnaRead.cc:807
Int_t fFlagPrint
Definition: TEcnaRead.h:401
TEcnaObject * fObjectManager
Definition: TEcnaRead.h:367
TEcnaNumbering * fEcalNumbering
Definition: TEcnaRead.h:374
TString GetRunType()
Definition: TEcnaRead.cc:758
Bool_t fDataExist
Definition: TEcnaRead.h:406
TString fFlagSubDet
Definition: TEcnaRead.h:380
TMatrixD ReadCorrelationsBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:2956
TVectorD ReadMeanCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:1968
Bool_t LookAtRootFile()
Definition: TEcnaRead.cc:922
TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3317
Double_t *** fT3d_AdcValues
Definition: TEcnaRead.h:409
Bool_t CloseRootFile(const Text_t *)
Definition: TEcnaRead.cc:875
virtual ~TEcnaRead()
Definition: TEcnaRead.cc:264
Bool_t fOpenRootFile
Definition: TEcnaRead.h:383
Int_t GetStexNumber()
Definition: TEcnaRead.cc:748
Int_t * fTagStinNumbers
Definition: TEcnaRead.h:391
Int_t fNbChanByLine
Definition: TEcnaRead.h:398
void PrintAllComments()
Definition: TEcnaRead.cc:4454
Int_t fCodePrintComments
Definition: TEcnaRead.h:402
void TestArrayDimH2(const TString &, const TString &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1100
TVectorD ReadSampleMeans(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1335
TVectorD ReadAverageMeanCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2693
TString fStinName
Definition: TEcnaRead.h:381
TString fCurrentlyOpenFileName
Definition: TEcnaRead.h:384
TVectorD ReadAverageSigmaOfCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2777
Int_t fLookAtRootFile
Definition: TEcnaRead.h:388
void PrintWarnings()
Definition: TEcnaRead.cc:4446
time_t GetStartTime()
Definition: TEcnaRead.cc:754
TVectorD ReadNumberOfEvents(const Int_t &)
Definition: TEcnaRead.cc:1662