CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TEcnaRead Class Reference

#include <TEcnaRead.h>

List of all members.

Public Member Functions

void Adelete (const TString)
void Anew (const TString)
Bool_t CloseRootFile (const Text_t *)
Bool_t DataExist ()
void FileParameters (TString, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, TString)
TString GetAnalysisName ()
Int_t GetFirstReqEvtNumber ()
Int_t GetLastReqEvtNumber ()
Int_t GetNbOfSamples ()
Int_t GetNumberOfBinsSampleAsFunctionOfTime ()
Int_t GetNumberOfEvents (const Int_t &, const Int_t &)
Int_t GetReqNbOfEvts ()
TString GetRootFileName ()
TString GetRootFileNameShort ()
Int_t GetRunNumber ()
TString GetRunType ()
TString GetStartDate ()
time_t GetStartTime ()
Int_t GetStexNumber ()
Int_t GetStexStinFromIndex (const Int_t &)
Int_t GetStinIndex (const Int_t &)
TString GetStopDate ()
time_t GetStopTime ()
TString GetTechReadCode (const TString, const TString)
TString GetTypeOfQuantity (const CnaResultTyp)
void Init ()
Bool_t LookAtRootFile ()
Bool_t OpenRootFile (const Text_t *, TString)
TEcnaReadoperator= (const TEcnaRead &)
void PrintAllComments ()
void PrintComments ()
void PrintNoComment ()
void PrintWarnings ()
TVectorD Read1DHisto (const Int_t &, const TString, const Int_t &, const Int_t &, const Int_t &)
TVectorD Read1DHisto (const Int_t &, const TString, const Int_t &)
TVectorD Read1DHisto (const Int_t &, const TString, const TString)
TVectorD ReadAverageHighFrequencyNoise (const Int_t &)
TVectorD ReadAverageLowFrequencyNoise (const Int_t &)
TVectorD ReadAverageMeanCorrelationsBetweenSamples (const Int_t &)
TVectorD ReadAverageNumberOfEvents (const Int_t &)
TVectorD ReadAveragePedestals (const Int_t &)
TVectorD ReadAverageSigmaOfCorrelationsBetweenSamples (const Int_t &)
TVectorD ReadAverageTotalNoise (const Int_t &)
TMatrixD ReadCorrelationsBetweenSamples (const Int_t &, const Int_t &, const Int_t &)
TMatrixD ReadCovariancesBetweenSamples (const Int_t &, const Int_t &, const Int_t &)
TMatrixD ReadHighFrequencyCorrelationsBetweenChannels (const Int_t &, const Int_t &, const Int_t &)
TMatrixD ReadHighFrequencyCorrelationsBetweenChannels (const Int_t &)
TMatrixD ReadHighFrequencyCovariancesBetweenChannels (const Int_t &, const Int_t &, const Int_t &)
TMatrixD ReadHighFrequencyCovariancesBetweenChannels (const Int_t &)
TMatrixD ReadHighFrequencyMeanCorrelationsBetweenStins (const Int_t &)
TVectorD ReadHighFrequencyNoise (const Int_t &)
TMatrixD ReadLowFrequencyCorrelationsBetweenChannels (const Int_t &, const Int_t &, const Int_t &)
TMatrixD ReadLowFrequencyCorrelationsBetweenChannels (const Int_t &)
TMatrixD ReadLowFrequencyCovariancesBetweenChannels (const Int_t &)
TMatrixD ReadLowFrequencyCovariancesBetweenChannels (const Int_t &, const Int_t &, const Int_t &)
TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins (const Int_t &)
TVectorD ReadLowFrequencyNoise (const Int_t &)
TMatrixD ReadMatrix (const Int_t &, const TString, const TString)
TMatrixD ReadMatrix (const Int_t &, const TString, const TString, const Int_t &, const Int_t &)
TVectorD ReadMeanCorrelationsBetweenSamples (const Int_t &)
TVectorD ReadNumberOfEvents (const Int_t &)
TMatrixD ReadNumberOfEventsForSamples (const Int_t &, const Int_t &, const Int_t &)
TVectorD ReadPedestals (const Int_t &)
TVectorD ReadRelevantCorrelationsBetweenSamples (const Int_t &, const Int_t &, const Int_t &)
Bool_t ReadRootFileHeader (const Int_t &)
TVectorD ReadSampleAdcValues (const Int_t &, const Int_t &, const Int_t &, const Int_t &)
Double_t *** ReadSampleAdcValuesSameFile (const Int_t &, const Int_t &, const Int_t &)
TVectorD ReadSampleMeans (const Int_t &, const Int_t &, const Int_t &)
TVectorD ReadSampleMeans (const Int_t &, const Int_t &)
TVectorD ReadSampleSigmas (const Int_t &, const Int_t &, const Int_t &)
TVectorD ReadSampleSigmas (const Int_t &, const Int_t &)
TVectorD ReadSigmaOfCorrelationsBetweenSamples (const Int_t &)
TVectorD ReadStinNumbers (const Int_t &)
TVectorD ReadTotalNoise (const Int_t &)
void SetEcalSubDetector (const TString)
 TEcnaRead (const TEcnaRead &)
 TEcnaRead (TEcnaObject *, const TString)
 TEcnaRead ()
void TestArrayDimH1 (const TString, const TString, const Int_t &, const Int_t &)
void TestArrayDimH2 (const TString, const TString, const Int_t &, const Int_t &)
virtual ~TEcnaRead ()

Private Member Functions

void fCopy (const TEcnaRead &)

Private Attributes

Int_t fCdelete
TEcnaParCoutfCnaParCout
TEcnaParHistosfCnaParHistos
TEcnaParPathsfCnaParPaths
TEcnaWritefCnaWrite
Int_t fCnew
Int_t fCodePrintAllComments
Int_t fCodePrintComments
Int_t fCodePrintNoComment
Int_t fCodePrintWarnings
TString fCurrentlyOpenFileName
Bool_t fDataExist
TEcnaParEcalfEcal
TEcnaNumberingfEcalNumbering
TEcnaHeaderfFileHeader
TString fFlagNoFileOpen
Int_t fFlagPrint
TString fFlagSubDet
Int_t fgMaxCar
Int_t fLookAtRootFile
Int_t fMemoStinNumbers
Int_t fNbChanByLine
Int_t fNbSampByLine
TEcnaObjectfObjectManager
Bool_t fOpenRootFile
TString fPathRoot
Int_t fReadyToReadRootFile
TString fStexName
TString fStinName
Int_t * fT1d_StexStinFromIndex
Double_t * fT3d1_AdcValues
Double_t ** fT3d2_AdcValues
Double_t *** fT3d_AdcValues
Int_t * fTagStinNumbers
TString fTTBELL

Detailed Description

----------------------------------------------------------- TEcnaRead.h Update: 15/02/2011 Authors: B.Fabbro (bernard.fabbro@cea.fr), FX Gentit DSM/IRFU/SPP CEA-Saclay Copyright: Those valid for CEA sofware

ECNA web page: https://cms-fabbro.web.cern.ch/cms-fabbro/ cna_new/Correlated_Noise_Analysis/ECNA_cna_1.htm -----------------------------------------------------------

==============> INTRODUCTION

This class allows the user to read the .root results files (containing expectation values, variances, covariances, correlations and other quantities of interest) previously computed by the class TEcnaRun. The results are available in arrays.

==============> PRELIMINARY REMARK

Another class named TEcnaHistos can be used directly to make plots of results previously computed by means of the class TEcnaRun. The class TEcnaHistos calls TEcnaRead and manage the reading of the .root result file

I N S T R U C T I O N S F O R U S E ***

==============> TEcnaRead DECLARATION

The declaration is done by calling the constructor without argument:

TEcnaRead* MyCnaRead = new TEcnaRead();

==============> PREPARATION METHOD FileParameters(...)

There is a preparation method named: FileParameters(...);

FileParameters(...) is used to read the quantities written in the ROOT files in order to use these quantities for analysis.

....... Example of program using FileParameters(...)

This example describes the reading of one result file. This file is situated in a directory which name is given by the contents of a TString named PathForRootFile

................ Set values for the arguments and call to the method

TString AnalysisName = "AdcPed12" Int_t RunNumber = 132440; Int_t FirstReqEvtNumber = 1; | (numbering starting from 1) Int_t LastReqEvtNumber = 300; | => treats 150 evts between evt#100 and evt#300 (included) Int_t ReqNbOfEvts = 150; | TString PathForRootFile = "/afs/cern.ch/etc..." // .root result files directory

TEcnaRead* MyCnaRead = new TEcnaRead(); MyCnaRead->FileParameters(AnalysisName, RunNumber, FirstReqEvtNumber, LastReqEvtNumber, ReqNbOfEvts, StexNumber, PathForRootFile);

==> Stex = SM if EB, Dee if EE

==============> CALL TO THE METHOD: Bool_t LookAtRootFile() (MANDATORY) and method: Bool_t DataExist(); // if data exist: kTRUE , if not: kFALSE

This methods returns a boolean. It tests the existence of the ROOT file corresponding to the argument values given in the call to the method FileParameters(...). It is recommended to test the return value of the method.

....... Example of use:

if( MyCnaRead->LookAtRootFile() == kFALSE ) { cout << "*** ERROR: ROOT file not found" << endl; } else { ........... The ROOT file exists and has been found

---> CALLS TO THE METHODS WHICH RECOVER THE QUANTITIES. EXAMPLE: (see the complete list of the methods hereafter)

Int_t MaxSamples = 10; TMatrixD CorMat(MaxSamples,MaxSamples); Int_t Tower = 59; Int_t Channel = 4; CorMat = MyCnaRead->ReadMatrix(MaxSamples, "Cor", "Samples", Tower, Channel);

arguments: "Cor" = correlation matrix, "Samples" = between samples large amount of possibilities for syntax: "Cor", "cor", "correlation", etc... "Samples", "samples", "samp", etc...

if( MyCnaRead->DataExist() == kFALSE ) { : Analysis of the correlations, etc... : } else { cout << "problem while reading file. data not available. " << endl; }

}

=======================* | DETAILLED DESCRIPTION | =======================*

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

Method FileParameters(...) and associated methods

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

TEcnaRead* MyCnaRead = new TEcnaRead(); // declaration of the object MyCnaRead

MyCnaRead->FileParameters(AnalysisName, RunNumber, NbOfSamples FirstReqEvtNumber, LastReqEvtNumber, ReqNbOfEvts, StexNumber, PathForRootFile);

Arguments:

TString AnalysisName: code for the analysis. According to this code, the analyzer EcnaAnalyser selects the event type (PEDESTAL_STD, PEDESTAL_GAP, LASER_STD, etc...) and some other event characteristics (example: the gain in pedestal runs: AnalysisName = "Ped1" or "Ped6" or "Ped12") See EcnaAnalyser.h for a list of available codes. The string AnalysisName is automatically included in the name of the results files (see below: results files paragraph).

Int_t NbOfSamples number of samples (=10 maximum) Int_t RunNumber run number Int_t FirstReqEvtNumber first requested event number (numbering starting from 1) Int_t LastReqEvtNumber last requested event number Int_t ReqNbOfEvts requested number of events Int_t StexNumber Stex number (Stex = SM if EB, Dee if EE)

TString PathForRootFile: Path of the directory containing the ROOT file. The path must be complete: /afs/cern.ch/user/... etc...

==============> METHODS TO RECOVER THE QUANTITIES FROM THE ROOT FILE

SM = SuperModule (EB) equivalent to a Dee (EE) SC = SuperCrystal (EE) equivalent to a Tower (EB)

Stex = SM in case of EB , Dee in case of EE Stin = Tower in case of EB , SC in case of EE

n1StexStin = Stin# in Stex = Tower# in SM (RANGE = [1,68]) if EB = SC# in Dee (RANGE = [1,149]) if EE

i0StexEcha = Channel# in Stex = Channel# in SM (RANGE = [0,1699]) if EB = Channel# in Dee (RANGE = [0,3724]) if EE

i0StinEcha = Channel# in Stin = Channel# in tower (RANGE = [0,24]) if EB = Channel# in SC (RANGE = [0,24]) if EE

MaxCrysInStin = Maximum number of Xtals in a tower or a SC (25) MaxCrysEcnaInStex = Maximum number of Xtals in SM (1700) or in the matrix including Dee (5000) MaxStinEcnaInStex = Maximum number of towers in SM (68) or in the matrix including Dee (200) MaxSampADC = Maximum number of samples (10) NbOfSample = Number of samples used to perform the calculations (example: for the 3 first samples, NbOfSample = 3)

=============================== Standard methods for the user ===============================

Intervals: Tower or SC: [1,...] Channel:[0,24] Sample:[1,10]

........................................................................... TVectorD Read1DHisto(const Int_t& VecDim, const TString Quantity, const Int_t& Tower or SC, const Int_t& Channel, const Int_t& Sample);

Example: Int_t Tower = 59; Int_t Channel = 10; Int_t Sample = 4; NbOfEvts = 150; TVectorD Adc(NbOfEvts); Adc = Read1DHisto(NbOfEvts, "AdcValue", Tower, Channel, Sample;

........................................................................... TVectorD Read1DHisto(const Int_t& VecDim, const TString Quantity, const Int_t& Tower or SC);

Example: Int_t Tower = 59; TVectorD SampMean(fEcal->MaxCrysInTow()*fEcal->MaxSampADC()); SampMean = Read1DHisto(fEcal->MaxCrysInTow()*fEcal->MaxSampADC(), "SampleMean", Tower);

........................................................................... TVectorD Read1DHisto(const Int_t& VecDim, const TString Quantity, const TString Detector);

Example: TVectorD Pedestal(fEcal->MaxCrysInTow()); Pedestal = Read1DHisto(fEcal->MaxCrysInTow(), "Ped","SM");

........................................................................... TMatrixD ReadMatrix(const Int_t&, const TString, const TString, const Int_t&, const Int_t&); TMatrixD ReadMatrix(const Int_t&, const TString, const TString);

=============================== more "technical" methods ===============================

TVectorD and TMatrixD sizes are indicated after the argument lists

TMatrixD ReadNumberOfEventsForSamples(const Int_t& n1StexStin, const Int_t& MaxCrysInStin, const Int_t& NbOfSamples); TMatrixD(MaxCrysInStin,NbOfSamples)

TVectorD ReadSampleAdcValues(const Int_t& i0StexEcha, const Int_t& sample, const Int_t& ReqNbOfEvts); TVectorD(ReqNbOfEvts)

TVectorD ReadSampleMeans(const Int_t& n1StexStin, const Int_t& i0StinEcha, const Int_t& NbOfSamples); TVectorD(NbOfSamples)

TVectorD ReadSampleMeans(const Int_t& n1StexStin, const Int_t& MaxCrysInStin*NbOfSamples); TVectorD(MaxCrysInStin*NbOfSamples)

TVectorD ReadSampleSigmas(const Int_t& n1StexStin, const Int_t& i0StinEcha, const Int_t& NbOfSamples); TVectorD(NbOfSamples)

TVectorD ReadSampleSigmas(const Int_t& n1StexStin, const Int_t& MaxCrysInStin*NbOfSamples); TVectorD(MaxCrysInStin*NbOfSamples)

TMatrixD ReadCovariancesBetweenSamples(const Int_t& n1StexStin, const Int_t& i0StinEcha); TMatrixD(NbOfSamples,NbOfSamples)

TMatrixD ReadCorrelationsBetweenSamples(const Int_t& n1StexStin, const Int_t& i0StinEcha); TMatrixD(NbOfSamples,NbOfSamples)

----------------------------------------------------------- TMatrixD

TMatrixD size is (MaxCrysInStin, MaxCrysInStin)

TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t& n1StexStin_X, const Int_t& n1StexStin_Y, const Int_t& MaxCrysInStin);

TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t& n1StexStin_X, const Int_t& n1StexStin_Y, const Int_t& MaxCrysInStin);

TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t& n1StexStin_X, const Int_t& n1StexStin_Y, const Int_t& MaxCrysInStin);

TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t& n1StexStin_X, const Int_t& n1StexStin_Y, const Int_t& MaxCrysInStin);

----------------------------------------------------------- TMatrixD

TMatrixD size is (MaxCrysEcnaInStex, MaxCrysEcnaInStex) (BIG!: 1700x1700 for EB and 5000x5000 for EE)

TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t& MaxCrysEcnaInStex); TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t& MaxCrysEcnaInStex);

TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t& MaxCrysEcnaInStex); TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t& MaxCrysEcnaInStex);

----------------------------------------------------------- TMatrixD

TMatrixD size is (MaxStinEcnaInStex, MaxStinEcnaInStex)

TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t& MaxStinEcnaInStex); TMatrixD ReadHighFrequencyMeanCorrelationsBetweenStins(const Int_t& MaxStinEcnaInStex);

----------------------------------------------------------- TVectorD

TVectorD sizes are indicated after the argument lists

TVectorD ReadPedestals(const Int_t& MaxCrysEcnaInStex); // TVectorD(MaxCrysEcnaInStex) TVectorD ReadTotalNoise(const Int_t& MaxCrysEcnaInStex); // TVectorD(MaxCrysEcnaInStex) TVectorD ReadMeanCorrelationsBetweenSamples(const Int_t& MaxCrysEcnaInStex); // TVectorD(MaxCrysEcnaInStex)

TVectorD ReadLowFrequencyNoise(const Int_t& MaxCrysEcnaInStex); // TVectorD(MaxCrysEcnaInStex) TVectorD ReadHighFrequencyNoise(const Int_t& MaxCrysEcnaInStex); // TVectorD(MaxCrysEcnaInStex) TVectorD ReadSigmaOfCorrelationsBetweenSamples(const Int_t& MaxCrysEcnaInStex); // TVectorD(MaxCrysEcnaInStex)

---------------------------------------------------------------------------------------------------------------- TString GetStartDate() TString GetStopDate() TString GetRunType() Int_t GetFirstReqEvtNumber(); Int_t GetReqNbOfEvts();

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

Print Methods

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

Just after the declaration with the constructor, you can set a "Print Flag" by means of the following "Print Methods":

TEcnaRead* MyCnaRead = new TEcnaRead(....); // declaration of the object MyCnaRead

Print Methods:

MyCnaRead->PrintNoComment(); // Set flag to forbid printing of all the comments except ERRORS.

MyCnaRead->PrintWarnings(); // (DEFAULT) Set flag to authorize printing of some warnings. WARNING/INFO: information on something unusual in the data. WARNING/CORRECTION: something wrong (but not too serious) in the value of some argument. Automatically modified to a correct value.

MyCnaRead->PrintComments(); // Set flag to authorize printing of infos and some comments concerning initialisations

MyCnaRead->PrintAllComments(); // Set flag to authorize printing of all the comments

------------------------------------------------------------------------------------------------

Definition at line 352 of file TEcnaRead.h.


Constructor & Destructor Documentation

TEcnaRead::TEcnaRead ( )
TEcnaRead::TEcnaRead ( TEcnaObject pObjectManager,
const TString  SubDet 
)

Definition at line 26 of file TEcnaRead.cc.

References fCnaParCout, fCnaParHistos, fCnaParPaths, fCnaWrite, fEcal, fEcalNumbering, fFileHeader, fObjectManager, TEcnaObject::GetPointerValue(), Init(), TEcnaObject::RegisterPointer(), and SetEcalSubDetector().

{
  fObjectManager = (TEcnaObject*)pObjectManager;
  Long_t i_this = (Long_t)this;
  pObjectManager->RegisterPointer("TEcnaRead", i_this);

 //----------------------- Object management
  //............................ fCnaParCout
  fCnaParCout = 0;
  Long_t iCnaParCout = pObjectManager->GetPointerValue("TEcnaParCout");
  if( iCnaParCout == 0 )
    {fCnaParCout = new TEcnaParCout(pObjectManager); /*fCnew++*/}
  else
    {fCnaParCout = (TEcnaParCout*)iCnaParCout;}

  //............................ fCnaParPaths
  fCnaParPaths = 0;
  Long_t iCnaParPaths = pObjectManager->GetPointerValue("TEcnaParPaths");
  if( iCnaParPaths == 0 )
    {fCnaParPaths = new TEcnaParPaths(pObjectManager); /*fCnew++*/}
  else
    {fCnaParPaths = (TEcnaParPaths*)iCnaParPaths;}

  //............................ fEcalNumbering
  fEcalNumbering = 0;
  Long_t iEcalNumbering = pObjectManager->GetPointerValue("TEcnaNumbering");
  if( iEcalNumbering == 0 )
    {fEcalNumbering = new TEcnaNumbering(pObjectManager, SubDet.Data()); /*fCnew++*/}
  else
    {fEcalNumbering = (TEcnaNumbering*)iEcalNumbering;}

  //............................ fCnaParHistos
  fCnaParHistos = 0;
  Long_t iCnaParHistos = pObjectManager->GetPointerValue("TEcnaParHistos");
  if( iCnaParHistos == 0 )
    {fCnaParHistos = new TEcnaParHistos(pObjectManager, SubDet.Data()); /*fCnew++*/}
  else
    {fCnaParHistos = (TEcnaParHistos*)iCnaParHistos;}

  //............................ fCnaWrite
  fCnaWrite = 0;
  Long_t iCnaWrite = pObjectManager->GetPointerValue("TEcnaWrite");
  if( iCnaWrite == 0 )
    {fCnaWrite = new TEcnaWrite(pObjectManager, SubDet.Data()); /*fCnew++*/}
  else
    {fCnaWrite = (TEcnaWrite*)iCnaWrite;}

  // fEcal = 0; fEcal = new TEcnaParEcal(SubDet.Data());            // Anew("fEcal");
  //............................ fEcal  => to be changed in fParEcal
  fEcal = 0;
  Long_t iParEcal = pObjectManager->GetPointerValue("TEcnaParEcal");
  if( iParEcal == 0 )
    {fEcal = new TEcnaParEcal(pObjectManager, SubDet.Data()); /*fCnew++*/}
  else
    {fEcal = (TEcnaParEcal*)iParEcal;}

  //fFileHeader  = 0; 
  //const Text_t *h_name  = "CnaHeader";  //==> voir cette question avec FXG
  //const Text_t *h_title = "CnaHeader";  //==> voir cette question avec FXG
  //fFileHeader = new TEcnaHeader(h_name, h_title);  // Anew("fFileHeader");

  //............................ fFileHeader
  const Text_t *h_name  = "CnaHeader";  //==> voir cette question avec FXG
  const Text_t *h_title = "CnaHeader";  //==> voir cette question avec FXG

  // "CnaHeader" est le nom du fichier utilisé dans ReadRootFileHeader(...) sous la forme:
  //
  // TEcnaHeader *h;
  // h =(TEcnaHeader*)gCnaRootFile->fRootFile->Get("CnaHeader");
  //

  fFileHeader = 0;
  Long_t iFileHeader = pObjectManager->GetPointerValue("TEcnaHeader");
  if( iFileHeader == 0 )
    {fFileHeader = new TEcnaHeader(pObjectManager, h_name, h_title); /*fCnew++*/}
  else
    {fFileHeader = (TEcnaHeader*)iFileHeader;}

  Init();
  SetEcalSubDetector(SubDet.Data());

 // cout << "[Info Management] CLASS: TEcnaRead.          CREATE OBJECT: this = " << this << endl;
}
TEcnaRead::TEcnaRead ( const TEcnaRead dcop)

Definition at line 234 of file TEcnaRead.cc.

References gather_cfg::cout.

{
  cout << "*TEcnaRead::TEcnaRead(const TEcnaRead& dcop)> "
       << " It is time to write a copy constructor"
       << endl;
  
  // { Int_t cintoto;  cin >> cintoto; }
  
}
TEcnaRead::~TEcnaRead ( ) [virtual]

Definition at line 264 of file TEcnaRead.cc.

References Adelete(), gather_cfg::cout, fCdelete, fCnew, fCodePrintAllComments, fCodePrintComments, fFlagPrint, fT1d_StexStinFromIndex, fT3d1_AdcValues, fT3d2_AdcValues, fT3d_AdcValues, fTagStinNumbers, and fTTBELL.

{
//Destructor
  
  // cout << "[Info Management] CLASS: TEcnaRead.          DESTROY OBJECT: this = " << this << endl;

  if(fFlagPrint == fCodePrintAllComments || fFlagPrint == fCodePrintComments){
    cout << "*TEcnaRead::~TEcnaRead()> Entering destructor" << endl;}
  
  //if (fFileHeader    != 0){delete fFileHeader;    Adelete("fFileHeader");}
  //if (fEcal          != 0){delete fEcal;          Adelete("fEcal");}
  //if (fCnaParCout    != 0){delete fCnaParCout;    Adelete("fCnaParCout");}
  //if (fCnaParPaths   != 0){delete fCnaParPaths;   Adelete("fCnaParPaths");}
  //if (fCnaWrite      != 0){delete fCnaWrite;      Adelete("fCnaWrite");}
  //if (fEcalNumbering != 0){delete fEcalNumbering; Adelete("fEcalNumbering");}

  if (fT1d_StexStinFromIndex != 0){delete [] fT1d_StexStinFromIndex; Adelete("fT1d_StexStinFromIndex");}
  if (fTagStinNumbers        != 0){delete [] fTagStinNumbers;        Adelete("fTagStinNumbers");}

  if (fT3d_AdcValues  != 0){delete [] fT3d_AdcValues;  Adelete("fT3d_AdcValues");}
  if (fT3d2_AdcValues != 0){delete [] fT3d2_AdcValues; Adelete("fT3d2_AdcValues");}
  if (fT3d1_AdcValues != 0){delete [] fT3d1_AdcValues; Adelete("fT3d1_AdcValues");}

  if ( fCnew != fCdelete )
    {
      cout << "!TEcnaRead/destructor> WRONG MANAGEMENT OF ALLOCATIONS: fCnew = "
           << fCnew << ", fCdelete = " << fCdelete << fTTBELL << endl;
    }
  else
    {
      // cout << "*TEcnaRead/destructor> BRAVO! GOOD MANAGEMENT OF ALLOCATIONS: fCnew = "
      //      << fCnew << ", fCdelete = " << fCdelete << endl;
    }
  
  if(fFlagPrint == fCodePrintAllComments || fFlagPrint == fCodePrintComments){
    cout << "*TEcnaRead::~TEcnaRead()> End of destructor " << endl;}
}

Member Function Documentation

void TEcnaRead::Adelete ( const TString  VarName)

Definition at line 193 of file TEcnaRead.cc.

References fCdelete.

Referenced by ~TEcnaRead().

{
  // allocation survey for delete
  
  fCdelete++;
  // cout << "TEcnaRead::Adelete> ========== delete" << setw(4) << fCdelete << " -> " << setw(25)
  //      << VarName.Data() << " / object(this): " << this << endl;
}
void TEcnaRead::Anew ( const TString  VarName)

Definition at line 184 of file TEcnaRead.cc.

References fCnew.

Referenced by LookAtRootFile().

{
  // allocation survey for new
  
  fCnew++;
  // cout << "TEcnaRead::Anew---> new " << setw(4) << fCnew << " --------------> " << setw(25)
  //      << VarName.Data() << " / object(this): " << this << endl;
}
Bool_t TEcnaRead::CloseRootFile ( const Text_t *  name)

Definition at line 875 of file TEcnaRead.cc.

References TEcnaRootFile::CloseFile(), gather_cfg::cout, fCodePrintAllComments, fCurrentlyOpenFileName, fFlagNoFileOpen, fFlagPrint, fOpenRootFile, fReadyToReadRootFile, fTTBELL, and gCnaRootFile.

Referenced by ReadAverageHighFrequencyNoise(), ReadAverageLowFrequencyNoise(), ReadAverageMeanCorrelationsBetweenSamples(), ReadAveragePedestals(), ReadAverageSigmaOfCorrelationsBetweenSamples(), ReadAverageTotalNoise(), ReadCorrelationsBetweenSamples(), ReadCovariancesBetweenSamples(), ReadHighFrequencyCorrelationsBetweenChannels(), ReadHighFrequencyCovariancesBetweenChannels(), ReadHighFrequencyMeanCorrelationsBetweenStins(), ReadHighFrequencyNoise(), ReadLowFrequencyCorrelationsBetweenChannels(), ReadLowFrequencyCovariancesBetweenChannels(), ReadLowFrequencyMeanCorrelationsBetweenStins(), ReadLowFrequencyNoise(), ReadMeanCorrelationsBetweenSamples(), ReadNumberOfEventsForSamples(), ReadPedestals(), ReadRelevantCorrelationsBetweenSamples(), ReadRootFileHeader(), ReadSampleAdcValues(), ReadSampleAdcValuesSameFile(), ReadSampleMeans(), ReadSampleSigmas(), ReadSigmaOfCorrelationsBetweenSamples(), ReadStinNumbers(), and ReadTotalNoise().

                                                  {
//Close the Root file
 
  Bool_t ok_close = kFALSE;

  if (fOpenRootFile == kTRUE ) 
    {
      if( gCnaRootFile != 0 )
        {
          gCnaRootFile->CloseFile();
          
          if(fFlagPrint == fCodePrintAllComments){
            TString e_path;  e_path.Append(name);
            cout << "*TEcnaRead::CloseRootFile> Close ROOT file " << e_path.Data() << " OK " << endl;}
          if(fFlagPrint == fCodePrintAllComments){
            Long_t pointer_value = (Long_t)gCnaRootFile;
            cout << "*TEcnaRead::CloseRootFile(...)> going to delete gCnaRootFile, gCnaRootFile = " << gCnaRootFile
                 << ", pointer = " << pointer_value << endl;}

          //delete gCnaRootFile;   gCnaRootFile = 0;  Adelete("gCnaRootFile");
          
          ok_close      = kTRUE;
          fOpenRootFile = kFALSE;
          fCurrentlyOpenFileName = fFlagNoFileOpen;
          fReadyToReadRootFile = 0;
        }
      else
        {
          cout << "*TEcnaRead::CloseRootFile(...)> RootFile pointer equal to zero. Close not possible. gCnaRootFile = "
               << gCnaRootFile
               << fTTBELL << endl;
        }
    }
  else
    {
      cout << "*TEcnaRead::CloseRootFile(...)> no close since no file is open. fOpenRootFile = " << fOpenRootFile
           << endl;
    }
  return ok_close;
}
Bool_t TEcnaRead::DataExist ( )
void TEcnaRead::fCopy ( const TEcnaRead rund) [private]

Definition at line 204 of file TEcnaRead.cc.

References fCdelete, fCnew, fCodePrintAllComments, fCodePrintComments, fCodePrintNoComment, fCodePrintWarnings, fFileHeader, fFlagPrint, fOpenRootFile, fPathRoot, and fTagStinNumbers.

Referenced by operator=().

{
//Private copy

  fFileHeader   = rund.fFileHeader;
  fOpenRootFile = rund.fOpenRootFile;

  //........................................ Codes 

  fCodePrintComments    = rund.fCodePrintComments;
  fCodePrintWarnings    = rund.fCodePrintWarnings;
  fCodePrintAllComments = rund.fCodePrintAllComments;
  fCodePrintNoComment   = rund.fCodePrintNoComment;

  //.................................................. Tags
  fTagStinNumbers  = rund.fTagStinNumbers;

  fFlagPrint = rund.fFlagPrint;
  fPathRoot  = rund.fPathRoot;

  fCnew    = rund.fCnew;
  fCdelete = rund.fCdelete;
}
void TEcnaRead::FileParameters ( TString  typ_ana,
const Int_t &  nb_of_samples,
const Int_t &  run_number,
const Int_t &  nfirst,
const Int_t &  nlast,
const Int_t &  nreqevts,
const Int_t &  Stex,
TString  path_root 
)

Definition at line 649 of file TEcnaRead.cc.

References gather_cfg::cout, fCnaWrite, fCodePrintAllComments, fCodePrintComments, fFileHeader, TEcnaHeader::fFirstReqEvtNumber, fFlagPrint, TEcnaHeader::fLastReqEvtNumber, TEcnaWrite::fMakeResultsFileName(), fMemoStinNumbers, TEcnaHeader::fNbOfSamples, fObjectManager, fPathRoot, fReadyToReadRootFile, TEcnaHeader::fReqNbOfEvts, TEcnaHeader::fRunNumber, TEcnaHeader::fStex, TEcnaHeader::fTypAna, TEcnaHeader::HeaderParameters(), nlast, and TEcnaWrite::RegisterFileParameters().

Referenced by TEcnaHistos::EvSamplesXtals(), Read1DHisto(), TEcnaRun::ReadSampleAdcValues(), TEcnaHistos::SigmaSamplesXtals(), TEcnaHistos::StexHocoVecoLHFCorcc(), TEcnaHistos::ViewHistime(), TEcnaHistos::ViewHisto(), TEcnaHistos::ViewMatrix(), TEcnaHistos::ViewStas(), TEcnaHistos::ViewStex(), TEcnaHistos::ViewStin(), TEcnaHistos::XtalSamplesEv(), and TEcnaHistos::XtalSamplesSigma().

{
  // Preparation for reading the ROOT file
  // Preliminary save of the arguments values because they can be of the form: fFileHeader->...
  // and because fFileHeader can be deleted and re-created in this method

  TString sTypAna      = typ_ana;
  Int_t   nNbOfSamples = nb_of_samples;
  Int_t   nRunNumber   = run_number;
  Int_t   nFirstEvt    = nfirst;
  Int_t   nLastEvt     = nlast;
  Int_t   nReqNbOfEvts = nreqevts;
  Int_t   nStexNumber  = Stex;

  //................................................................................................
  const Text_t *h_name  = "CnaHeader";   //==> voir cette question avec FXG
  const Text_t *h_title = "CnaHeader";   //==> voir cette question avec FXG

  // "CnaHeader" est le nom du fichier utilisé dans ReadRootFileHeader(...) sous la forme:
  //
  // TEcnaHeader *h;
  // h =(TEcnaHeader*)gCnaRootFile->fRootFile->Get("CnaHeader");
  //

  //----------- old version, with arguments h_name, h_title, (FXG) ----------
  //
  // fFileHeader->HeaderParameters(h_name,    h_title,
  //                               sTypAna,   nNbOfSamples, nRunNumber,
  //                               nFirstEvt, nLastEvt, nReqNbOfEvts, nStexNumber);
  //
  //-------------------------------------------------------------------------

  //---------- new version
  if( fFileHeader == 0 ){fFileHeader = new TEcnaHeader(fObjectManager, h_name, h_title);  /* Anew("fFileHeader") */ ;}
  fFileHeader->HeaderParameters(sTypAna,   nNbOfSamples, nRunNumber,
                                nFirstEvt, nLastEvt,     nReqNbOfEvts, nStexNumber);

  // After this call to TEcnaHeader, we have:
  //     fFileHeader->fTypAna            = sTypAna
  //     fFileHeader->fNbOfSamples       = nNbOfSamples
  //     fFileHeader->fRunNumber         = nRunNumber
  //     fFileHeader->fFirstReqEvtNumber = nFirstEvt
  //     fFileHeader->fLastReqEvtNumber  = nLastEvt
  //     fFileHeader->fReqNbOfEvts       = nReqNbOfEvts
  //     fFileHeader->fStex              = nStexNumber                       ( FileParameters(...) )
  //.......................... path_root
  fPathRoot = path_root;

  //-------- gets the arguments for the file names (long and short) and makes these names
  fCnaWrite->RegisterFileParameters(typ_ana, nb_of_samples, run_number, nfirst, nlast, nreqevts, Stex);
  fCnaWrite->fMakeResultsFileName();
  //         names can be now recovered by call to TEcnaWrite methods: GetRootFileName() and GetRootFileNameShort()

  //------------------------- init Stin numbers memo flags
  fMemoStinNumbers = 0;

  if( fFlagPrint == fCodePrintAllComments || fFlagPrint == fCodePrintComments )
    {
      cout << endl;
      cout << "*TEcnaRead::FileParameters(...)>" << endl
           << "          The method has been called with the following argument values:" << endl
           << "          Analysis name                = "
           << fFileHeader->fTypAna << endl
           << "          Nb of required samples       = "
           << fFileHeader->fNbOfSamples << endl
           << "          Run number                   = "
           << fFileHeader->fRunNumber << endl
           << "          First requested event number = "
           << fFileHeader->fFirstReqEvtNumber << endl
           << "          Last requested event number  = "
           << fFileHeader->fLastReqEvtNumber << endl
           << "          Requested number of events   = "
           << fFileHeader->fReqNbOfEvts << endl
           << "          Stex number                  = "
           << fFileHeader->fStex << endl
           << "          Path for the ROOT file       = "
           << fPathRoot << endl
           << endl;
    }
  
  fReadyToReadRootFile = 1;           // set flag

} //----------------- end of FileParameters(...)
TString TEcnaRead::GetAnalysisName ( )

Definition at line 742 of file TEcnaRead.cc.

References fFileHeader, and TEcnaHeader::fTypAna.

Referenced by TEcnaHistos::FileParameters().

{return fFileHeader->fTypAna;}
Int_t TEcnaRead::GetFirstReqEvtNumber ( )

Definition at line 745 of file TEcnaRead.cc.

References fFileHeader, and TEcnaHeader::fFirstReqEvtNumber.

Referenced by TEcnaHistos::FileParameters().

Int_t TEcnaRead::GetLastReqEvtNumber ( )

Definition at line 746 of file TEcnaRead.cc.

References fFileHeader, and TEcnaHeader::fLastReqEvtNumber.

Referenced by TEcnaHistos::FileParameters().

Int_t TEcnaRead::GetNbOfSamples ( )

Definition at line 743 of file TEcnaRead.cc.

References fFileHeader, and TEcnaHeader::fNbOfSamples.

Referenced by TEcnaHistos::FileParameters().

Int_t TEcnaRead::GetNumberOfBinsSampleAsFunctionOfTime ( )

Definition at line 4398 of file TEcnaRead.cc.

References GetReqNbOfEvts().

{return GetReqNbOfEvts();}
Int_t TEcnaRead::GetNumberOfEvents ( const Int_t &  xFapNbOfReqEvts,
const Int_t &  xStexNumber 
)

Definition at line 4294 of file TEcnaRead.cc.

References fCdelete, fCnaWrite, fCnew, fEcal, i, TEcnaParEcal::MaxCrysEcnaInStex(), TEcnaWrite::NumberOfEventsAnalysis(), and ReadNumberOfEvents().

Referenced by TEcnaHistos::FileParameters(), TEcnaHistos::StexHocoVecoLHFCorcc(), TEcnaHistos::ViewHisto(), TEcnaHistos::ViewMatrix(), TEcnaHistos::ViewStas(), TEcnaHistos::ViewStex(), and TEcnaHistos::ViewStin().

{
  //...... Calculate the number of found events  (file existence already tested in calling method)
  Int_t xFapNbOfEvts = 0; 

  TVectorD NOFE_histp(fEcal->MaxCrysEcnaInStex());
  for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){NOFE_histp(i)=(Double_t)0.;}
  NOFE_histp = ReadNumberOfEvents(fEcal->MaxCrysEcnaInStex());

  //... Call to fCnaWrite->NumberOfEventsAnalysis(...) 1rst argument must be Int_t, not TVectorD,
  //    duplicate NOFE_histp to NOFE_int to obtain fFapNbOfEvts from fCnaWrite->NumberOfEventsAnalysis(...)
  Int_t* NOFE_int = new Int_t[fEcal->MaxCrysEcnaInStex()];   fCnew++;
  for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){NOFE_int[i]=(Int_t)NOFE_histp(i);}

  xFapNbOfEvts =
    fCnaWrite->NumberOfEventsAnalysis(NOFE_int, fEcal->MaxCrysEcnaInStex(), xFapNbOfReqEvts, xStexNumber);

  delete [] NOFE_int; NOFE_int = 0;                          fCdelete++;

  return xFapNbOfEvts;
}
Int_t TEcnaRead::GetReqNbOfEvts ( )
TString TEcnaRead::GetRootFileName ( )

Definition at line 4375 of file TEcnaRead.cc.

References fCnaWrite, and TEcnaWrite::GetRootFileName().

Referenced by TEcnaRun::ReadSampleAdcValues().

TString TEcnaRead::GetRootFileNameShort ( )
Int_t TEcnaRead::GetRunNumber ( )

Definition at line 744 of file TEcnaRead.cc.

References fFileHeader, and TEcnaHeader::fRunNumber.

Referenced by TEcnaHistos::FileParameters().

TString TEcnaRead::GetRunType ( )

Definition at line 758 of file TEcnaRead.cc.

References fFileHeader, and TEcnaHeader::fRunType.

Referenced by TEcnaHistos::FileParameters(), TEcnaHistos::StexHocoVecoLHFCorcc(), TEcnaHistos::ViewHisto(), TEcnaHistos::ViewMatrix(), TEcnaHistos::ViewStas(), TEcnaHistos::ViewStex(), and TEcnaHistos::ViewStin().

{
  TString cType = "run type not defined";
  Int_t numtype = fFileHeader->fRunType;
  //----------------------------------------- run types

  if( numtype ==  0 ){cType = "COSMICS";}
  if( numtype ==  1 ){cType = "BEAMH4";}
  if( numtype ==  2 ){cType = "BEAMH2";}
  if( numtype ==  3 ){cType = "MTCC";}
  if( numtype ==  4 ){cType = "LASER_STD";}
  if( numtype ==  5 ){cType = "LASER_POWER_SCAN";}
  if( numtype ==  6 ){cType = "LASER_DELAY_SCAN";}
  if( numtype ==  7 ){cType = "TESTPULSE_SCAN_MEM";}
  if( numtype ==  8 ){cType = "TESTPULSE_MGPA";}
  if( numtype ==  9 ){cType = "PEDESTAL_STD";}
  if( numtype == 10 ){cType = "PEDESTAL_OFFSET_SCAN";}
  if( numtype == 11 ){cType = "PEDESTAL_25NS_SCAN";}
  if( numtype == 12 ){cType = "LED_STD";}

  if( numtype == 13 ){cType = "PHYSICS_GLOBAL";}
  if( numtype == 14 ){cType = "COSMICS_GLOBAL";}
  if( numtype == 15 ){cType = "HALO_GLOBAL";}

  if( numtype == 16 ){cType = "LASER_GAP";}
  if( numtype == 17 ){cType = "TESTPULSE_GAP";}
  if( numtype == 18 ){cType = "PEDESTAL_GAP";}
  if( numtype == 19 ){cType = "LED_GAP";}

  if( numtype == 20 ){cType = "PHYSICS_LOCAL";}
  if( numtype == 21 ){cType = "COSMICS_LOCAL";}
  if( numtype == 22 ){cType = "HALO_LOCAL";}
  if( numtype == 23 ){cType = "CALIB_LOCAL";}

  if( numtype == 24 ){cType = "PEDSIM";}

  return cType;
}
TString TEcnaRead::GetStartDate ( )
time_t TEcnaRead::GetStartTime ( )
Int_t TEcnaRead::GetStexNumber ( )

Definition at line 748 of file TEcnaRead.cc.

References fFileHeader, and TEcnaHeader::fStex.

Referenced by TEcnaHistos::FileParameters().

{return fFileHeader->fStex;}
Int_t TEcnaRead::GetStexStinFromIndex ( const Int_t &  i0StexStinEcna)

Definition at line 4384 of file TEcnaRead.cc.

References fEcal, i, TEcnaParEcal::MaxStinEcnaInStex(), and ReadStinNumbers().

Referenced by TEcnaRun::ReadSampleAdcValues(), and TEcnaHistos::ViewStex().

{
// Get the Stin number in Stex from the Stin index

  Int_t number = -1;
  TVectorD vec(fEcal->MaxStinEcnaInStex());
  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
  vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
  number = (Int_t)vec(i0StexStinEcna);
  return number;
}
Int_t TEcnaRead::GetStinIndex ( const Int_t &  n1StexStin)

Definition at line 4404 of file TEcnaRead.cc.

References gather_cfg::cout, fCodePrintAllComments, fEcal, fFlagPrint, fTTBELL, i, TEcnaParEcal::MaxStinEcnaInStex(), and ReadStinNumbers().

Referenced by ReadHighFrequencyCorrelationsBetweenChannels(), ReadHighFrequencyCovariancesBetweenChannels(), ReadLowFrequencyCorrelationsBetweenChannels(), ReadLowFrequencyCovariancesBetweenChannels(), and ReadNumberOfEventsForSamples().

{
//Get the index of the Stin from its number in Stex

  if(fFlagPrint == fCodePrintAllComments){
    cout << "*TEcnaRead::GetStinIndex(...)> fEcal->MaxStinEcnaInStex() = "
         << fEcal->MaxStinEcnaInStex() << endl
         << "                              n1StexStin = " << n1StexStin
         << endl << endl;}

  Int_t Stin_index = n1StexStin-1;    // suppose les 68 tours 

#define NOGT
#ifndef NOGT
  Int_t Stin_index = -1;
  TVectorD vec(fEcal->MaxStinEcnaInStex());
  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
  vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());

  //........................... Get the Stin index

  for(Int_t i=0; i < fEcal->MaxStinEcnaInStex(); i++)
    {
      if(fFlagPrint == fCodePrintAllComments){
        cout << "*TEcnaRead::GetStinIndex(...)> StinNumber[" << i << "] = "
             << vec[i] << endl;}
      if ( vec[i] == n1StexStin ){Stin_index = i;}
    }

  if(fFlagPrint == fCodePrintAllComments){
    cout << "~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-" << endl;
    cout << "*TEcnaRead::GetStinIndex> Stin number: " << n1StexStin  << endl
         << "                          Stin index : " << Stin_index << endl;
    cout << "~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-" << endl;}

  if ( Stin_index < 0 )
    {
      if(fFlagPrint == fCodePrintAllComments){
        cout << "!TEcnaRead::GetStinIndex *** WARNING ***> n1StexStin" << n1StexStin << " : "
             << "index Stin not found"
             << fTTBELL << endl;}
    }
#endif // NOGT

  return Stin_index;
}
TString TEcnaRead::GetStopDate ( )
time_t TEcnaRead::GetStopTime ( )
TString TEcnaRead::GetTechReadCode ( const TString  StandardQuantity,
const TString  StandardDetector 
)

Definition at line 602 of file TEcnaRead.cc.

References gather_cfg::cout, and fTTBELL.

Referenced by Read1DHisto().

{
  TString rTechReadCode = "?";
  TString dTechDetector = "?";

  if( StandardDetector == "SM" || StandardDetector == "Dee"){dTechDetector = "Stex";}
  if( StandardDetector == "EB" || StandardDetector == "EE" ){dTechDetector = "Stas";}

  if( dTechDetector == "?")
    {
      cout << "!TEcnaRead::GetTechReadCode(...)> *** ERROR: wrong standard code *** dTechDetector = "
           << dTechDetector << ", StandardDetector = " << StandardDetector
           << fTTBELL << endl;
    }
  else
    {
      if( StandardQuantity == "NOE" && dTechDetector == "Stex" ){rTechReadCode = "NOEStex";}
      if( StandardQuantity == "NOE" && dTechDetector == "Stas" ){rTechReadCode = "NOEStas";}
      if( StandardQuantity == "Ped" && dTechDetector == "Stex" ){rTechReadCode = "PedStex";}
      if( StandardQuantity == "Ped" && dTechDetector == "Stas" ){rTechReadCode = "PedStas";}
      if( StandardQuantity == "TNo" && dTechDetector == "Stex" ){rTechReadCode = "TNoStex";}
      if( StandardQuantity == "TNo" && dTechDetector == "Stas" ){rTechReadCode = "TNoStas";}
      if( StandardQuantity == "LFN" && dTechDetector == "Stex" ){rTechReadCode = "LFNStex";}
      if( StandardQuantity == "LFN" && dTechDetector == "Stas" ){rTechReadCode = "LFNStas";}
      if( StandardQuantity == "HFN" && dTechDetector == "Stex" ){rTechReadCode = "HFNStex";}
      if( StandardQuantity == "HFN" && dTechDetector == "Stas" ){rTechReadCode = "HFNStas";}
      if( StandardQuantity == "MCs" && dTechDetector == "Stex" ){rTechReadCode = "MCsStex";}
      if( StandardQuantity == "MCs" && dTechDetector == "Stas" ){rTechReadCode = "MCsStas";}
      if( StandardQuantity == "SCs" && dTechDetector == "Stex" ){rTechReadCode = "SCsStex";}
      if( StandardQuantity == "SCs" && dTechDetector == "Stas" ){rTechReadCode = "SCsStas";}
    }

  if( rTechReadCode == "?")
    {
      cout << "!TEcnaRead::GetTechReadCode(...)> *** ERROR: wrong standard code *** rTechReadCode = " << rTechReadCode
           << ", StandardQuantity = " << StandardQuantity
           << fTTBELL << endl;
    }

  return rTechReadCode;
}
TString TEcnaRead::GetTypeOfQuantity ( const CnaResultTyp  arg_typ)

Definition at line 4321 of file TEcnaRead.cc.

References cTypAdcEvt, cTypAvHfn, cTypAvLfn, cTypAvMeanCorss, cTypAvPed, cTypAvSigCorss, cTypAvTno, cTypCorCss, cTypCovCss, cTypHFccMoStins, cTypHfCor, cTypHfCov, cTypHfn, cTypLFccMoStins, cTypLfCor, cTypLfCov, cTypLfn, cTypMeanCorss, cTypMSp, cTypNbOfEvts, cTypNumbers, cTypPed, cTypSigCorss, cTypSSp, cTypTno, and fFlagSubDet.

Referenced by ReadAverageHighFrequencyNoise(), ReadAverageLowFrequencyNoise(), ReadAverageMeanCorrelationsBetweenSamples(), ReadAveragePedestals(), ReadAverageSigmaOfCorrelationsBetweenSamples(), ReadAverageTotalNoise(), ReadCorrelationsBetweenSamples(), ReadCovariancesBetweenSamples(), ReadHighFrequencyCorrelationsBetweenChannels(), ReadHighFrequencyCovariancesBetweenChannels(), ReadHighFrequencyMeanCorrelationsBetweenStins(), ReadHighFrequencyNoise(), ReadLowFrequencyCorrelationsBetweenChannels(), ReadLowFrequencyCovariancesBetweenChannels(), ReadLowFrequencyMeanCorrelationsBetweenStins(), ReadLowFrequencyNoise(), ReadMeanCorrelationsBetweenSamples(), ReadNumberOfEventsForSamples(), ReadPedestals(), ReadRelevantCorrelationsBetweenSamples(), ReadSampleAdcValues(), ReadSampleAdcValuesSameFile(), ReadSampleMeans(), ReadSampleSigmas(), ReadSigmaOfCorrelationsBetweenSamples(), ReadStinNumbers(), and ReadTotalNoise().

{
  TString quantity_name = "?";

  if( arg_typ == cTypNumbers)
    {
      if( fFlagSubDet == "EB" ){quantity_name = "SM numbers";}
      if( fFlagSubDet == "EE" ){quantity_name = "Dee numbers";}
    }
  if( arg_typ == cTypMSp    ){quantity_name = "Mean samples";}
  if( arg_typ == cTypSSp    ){quantity_name = "Sigma of samples";}

  if( arg_typ == cTypNbOfEvts ){quantity_name = "Number of events";}
  if( arg_typ == cTypPed      ){quantity_name = "Pedestals";}
  if( arg_typ == cTypTno      ){quantity_name = "Total noise";}
  if( arg_typ == cTypLfn      ){quantity_name = "LF noise";}
  if( arg_typ == cTypHfn      ){quantity_name = "HF noise";}
  if( arg_typ == cTypMeanCorss){quantity_name = "Mean cor(s,s')";}
  if( arg_typ == cTypSigCorss ){quantity_name = "Sigma of cor(s,s')";}

  if( arg_typ == cTypAvPed      ){quantity_name = "Average pedestals";}
  if( arg_typ == cTypAvTno      ){quantity_name = "Average total noise";}
  if( arg_typ == cTypAvLfn      ){quantity_name = "Average LF noise";}
  if( arg_typ == cTypAvHfn      ){quantity_name = "Average HF noise";}
  if( arg_typ == cTypAvMeanCorss){quantity_name = "Average mean cor(s,s')";}
  if( arg_typ == cTypAvSigCorss ){quantity_name = "Average sigma of cor(s,s')";}

  if( arg_typ == cTypAdcEvt ){quantity_name = "Sample ADC a.f.o event number";}

  if( arg_typ == cTypCovCss ){quantity_name = "Cov(s,s')";}
  if( arg_typ == cTypCorCss ){quantity_name = "Cor(s,s')";}
  if( arg_typ == cTypLfCov  ){quantity_name = "LF Cov(c,c')";}
  if( arg_typ == cTypLfCor  ){quantity_name = "LF Cor(c,c')";}
  if( arg_typ == cTypHfCov  ){quantity_name = "HF Cov(c,c')";}
  if( arg_typ == cTypHfCor  ){quantity_name = "HF Cor(c,c')";}

  if( fFlagSubDet == "EB" )
    {
      if( arg_typ == cTypLFccMoStins){quantity_name = "Mean LF |Cor(c,c')| in (tow,tow')";}
      if( arg_typ == cTypHFccMoStins){quantity_name = "Mean HF |Cor(c,c')| in (tow,tow')";}
    }
  if( fFlagSubDet == "EE" )
    {
      if( arg_typ == cTypLFccMoStins){quantity_name = "Mean LF |Cor(c,c')| in (SC,SC')";}
      if( arg_typ == cTypHFccMoStins){quantity_name = "Mean HF |Cor(c,c')| in (SC,SC')";}
    }
  return quantity_name;
}
void TEcnaRead::Init ( void  )

Definition at line 110 of file TEcnaRead.cc.

References fCdelete, fCnaParCout, fCnew, fCodePrintAllComments, fCodePrintComments, fCodePrintNoComment, fCodePrintWarnings, fCurrentlyOpenFileName, fDataExist, fFlagNoFileOpen, fFlagPrint, fgMaxCar, fLookAtRootFile, fMemoStinNumbers, fOpenRootFile, fPathRoot, fReadyToReadRootFile, fT1d_StexStinFromIndex, fT3d1_AdcValues, fT3d2_AdcValues, fT3d_AdcValues, fTagStinNumbers, fTTBELL, gCnaRootFile, and TEcnaParCout::GetCodePrint().

Referenced by TEcnaRead().

{
//Initialisation concerning the ROOT file

  fCnew    = 0;
  fCdelete = 0;

  fTTBELL = '\007';

  fgMaxCar = (Int_t)512;

  fCodePrintNoComment   = fCnaParCout->GetCodePrint("NoComment");
  fCodePrintWarnings    = fCnaParCout->GetCodePrint("Warnings ");
  fCodePrintComments    = fCnaParCout->GetCodePrint("Comments");
  fCodePrintAllComments = fCnaParCout->GetCodePrint("AllComments");

  //.................................. Set flag print to "Warnings"   (Init)
  fFlagPrint = fCodePrintWarnings;

  //................................ tags and array Stin numbers
  fTagStinNumbers  = 0;
  fMemoStinNumbers = 0;
  fT1d_StexStinFromIndex = 0;

  //................................ 
  //  fMemoReadNumberOfEventsforSamples = 0;

  //.......................... flag data exist (utile ici?)
  fDataExist = kFALSE;

  //......................... transfert Sample ADC Values 3D array   (Init)
  fT3d_AdcValues  = 0;
  fT3d2_AdcValues = 0;
  fT3d1_AdcValues = 0;

  //................................. path for .root files
  Int_t MaxCar = fgMaxCar;
  MaxCar = fgMaxCar;
  fPathRoot.Resize(MaxCar);
  fPathRoot  = "fPathRoot not defined";

  //.................................. Pointer and Flags for Root File   (Init)
  gCnaRootFile = 0;

  fOpenRootFile = kFALSE;
  fReadyToReadRootFile = 0;
  fLookAtRootFile      = 0;

  //................................. currently open file
  MaxCar = fgMaxCar;
  fFlagNoFileOpen.Resize(MaxCar);
  fFlagNoFileOpen = "No file is open";

  MaxCar = fgMaxCar;
  fCurrentlyOpenFileName.Resize(MaxCar);
  fCurrentlyOpenFileName = fFlagNoFileOpen;

}// end of Init()
Bool_t TEcnaRead::LookAtRootFile ( )

Definition at line 922 of file TEcnaRead.cc.

References Anew(), gather_cfg::cout, fEcal, fFileHeader, fLookAtRootFile, fReadyToReadRootFile, TEcnaHeader::fStinNumbersCalc, fT1d_StexStinFromIndex, fTagStinNumbers, fTTBELL, i, TEcnaParEcal::MaxStinEcnaInStex(), ReadRootFileHeader(), and ReadStinNumbers().

Referenced by TEcnaHistos::EvSamplesXtals(), Read1DHisto(), TEcnaRun::ReadSampleAdcValues(), TEcnaHistos::SigmaSamplesXtals(), TEcnaHistos::StexHocoVecoLHFCorcc(), TEcnaHistos::ViewHistime(), TEcnaHistos::ViewHisto(), TEcnaHistos::ViewMatrix(), TEcnaHistos::ViewStas(), TEcnaHistos::ViewStex(), TEcnaHistos::ViewStin(), TEcnaHistos::XtalSamplesEv(), and TEcnaHistos::XtalSamplesSigma().

{
//---------- Reads the ROOT file header and makes allocations and some other things

  fLookAtRootFile = 0;          // set flag to zero before looking for the file

  Bool_t ok_read = kFALSE;

  if(fReadyToReadRootFile == 1)
    {
      //------------ Call to ReadRootFileHeader
      Int_t iprint = 0;
      if( ReadRootFileHeader(iprint) == kTRUE )   //    (1) = print, (0) = no print
        {
          //........................................ allocation tags      
          if( fTagStinNumbers == 0 ){fTagStinNumbers = new Int_t[1]; Anew("fTagStinNumbers");}

          //...................... allocation for fT1d_StexStinFromIndex[]
          if(fT1d_StexStinFromIndex == 0)
            {fT1d_StexStinFromIndex = new Int_t[fEcal->MaxStinEcnaInStex()]; Anew("fT1d_StexStinFromIndex");}
          
          //.. recover of the Stin numbers from the ROOT file (= init fT1d_StexStinFromIndex+init TagStin)
          TVectorD vec(fEcal->MaxStinEcnaInStex());
          for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
          vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
          
          for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++ ){
            fT1d_StexStinFromIndex[i] = (Int_t)vec(i);}

          fTagStinNumbers[0] = 1;                fFileHeader->fStinNumbersCalc++;
          ok_read = kTRUE;
          
          fLookAtRootFile = 1;           // set flag
        }
      else
        {
          cout << "!TEcnaRead::LookAtRootFile()> *** ERROR ***>"
               << " ROOT file not found " << fTTBELL << endl;
          ok_read = kFALSE; 
        }
    }
  else
    {
      cout << "!TEcnaRead::LookAtRootFile()> *** ERROR ***>"
           << " FileParameters not called " << fTTBELL << endl;
      ok_read = kFALSE;      
    }
  return ok_read;
} //----------------- end of LookAtRootFile()
Bool_t TEcnaRead::OpenRootFile ( const Text_t *  name,
TString  status 
)

Definition at line 807 of file TEcnaRead.cc.

References gather_cfg::cout, fCodePrintAllComments, fCurrentlyOpenFileName, fFlagPrint, fObjectManager, fOpenRootFile, fPathRoot, TEcnaRootFile::fRootFileStatus, gCnaRootFile, TEcnaObject::GetPointerValue(), TEcnaRootFile::OpenR(), TEcnaRootFile::OpenW(), TEcnaRootFile::ReStart(), and ntuplemaker::status.

Referenced by ReadAverageHighFrequencyNoise(), ReadAverageLowFrequencyNoise(), ReadAverageMeanCorrelationsBetweenSamples(), ReadAveragePedestals(), ReadAverageSigmaOfCorrelationsBetweenSamples(), ReadAverageTotalNoise(), ReadCorrelationsBetweenSamples(), ReadCovariancesBetweenSamples(), ReadHighFrequencyCorrelationsBetweenChannels(), ReadHighFrequencyCovariancesBetweenChannels(), ReadHighFrequencyMeanCorrelationsBetweenStins(), ReadHighFrequencyNoise(), ReadLowFrequencyCorrelationsBetweenChannels(), ReadLowFrequencyCovariancesBetweenChannels(), ReadLowFrequencyMeanCorrelationsBetweenStins(), ReadLowFrequencyNoise(), ReadMeanCorrelationsBetweenSamples(), ReadNumberOfEventsForSamples(), ReadPedestals(), ReadRelevantCorrelationsBetweenSamples(), ReadRootFileHeader(), ReadSampleAdcValues(), ReadSampleAdcValuesSameFile(), ReadSampleMeans(), ReadSampleSigmas(), ReadSigmaOfCorrelationsBetweenSamples(), ReadStinNumbers(), and ReadTotalNoise().

                                                                 {
//Open the Root file

  Bool_t ok_open = kFALSE;

  TString s_name;
  s_name = fPathRoot;
  s_name.Append('/');
  s_name.Append(name);

  // if( gCnaRootFile != 0 )
  //  {
  //    Int_t iPointer = (Int_t)gCnaRootFile;
  //   cout << "*TEcnaRead::OpenRootFile(...)> RootFile pointer not (re)initialized to 0. gCnaRootFile = "
  //       << gCnaRootFile << ", pointer =  " << iPointer << fTTBELL << endl;
  //
  //   delete gCnaRootFile; gCnaRootFile = 0;  Adelete("gCnaRootFile");
  //  }

  //if( gCnaRootFile != 0 ){gCnaRootFile->ReStart(s_name.Data(), status);}
  //if( gCnaRootFile == 0 )
  //  {
      // gCnaRootFile = new TEcnaRootFile(fObjectManager, s_name.Data(), status);  Anew("gCnaRootFile");

      Long_t iCnaRootFile = fObjectManager->GetPointerValue("TEcnaRootFile");
      if( iCnaRootFile == 0 )
        {
          gCnaRootFile = new TEcnaRootFile(fObjectManager, s_name.Data(), status); /* Anew("gCnaRootFile");*/
        }
      else
        { 
          gCnaRootFile = (TEcnaRootFile*)iCnaRootFile;
          gCnaRootFile->ReStart(s_name.Data(), status);
        }
  //  }
  
  if ( gCnaRootFile->fRootFileStatus == "RECREATE" ){ok_open = gCnaRootFile->OpenW();}
  if ( gCnaRootFile->fRootFileStatus == "READ"     ){ok_open = gCnaRootFile->OpenR();}

  if ( ok_open == kFALSE )
    {
      cout << "!TEcnaRead::OpenRootFile> " << s_name.Data() << ": file not found." << endl;
      //if( gCnaRootFile != 0 )
      //  {delete gCnaRootFile; gCnaRootFile = 0;  Adelete("gCnaRootFile");}
    }
  else
    {
      if(fFlagPrint == fCodePrintAllComments)
        {
          cout << "*TEcnaRead::OpenRootFile> Open ROOT file " << s_name.Data() << " OK "
               << ", gCnaRootFile = " << gCnaRootFile << endl;
        }      
      fOpenRootFile = kTRUE;
      fCurrentlyOpenFileName = s_name;
      if(fFlagPrint == fCodePrintAllComments)
        {
          cout << "*TEcnaRead::OpenRootFile> Open ROOT file: " << fCurrentlyOpenFileName.Data() << " => OK "
               << ", gCnaRootFile = " << gCnaRootFile << endl << endl;
        }
    }
  return ok_open;
}                     // end of OpenRootFile()
TEcnaRead & TEcnaRead::operator= ( const TEcnaRead dcop)

Definition at line 250 of file TEcnaRead.cc.

References fCopy().

{
//Overloading of the operator=

  fCopy(dcop);
  return *this;
}
void TEcnaRead::PrintAllComments ( )

Definition at line 4473 of file TEcnaRead.cc.

References gather_cfg::cout, fCodePrintAllComments, and fFlagPrint.

{
// Set flags to authorize printing of the comments of all the methods

  fFlagPrint = fCodePrintAllComments;
  cout << "*TEcnaRead::PrintAllComments()> All the comments will be printed" << endl;
}
void TEcnaRead::PrintComments ( )

Definition at line 4457 of file TEcnaRead.cc.

References gather_cfg::cout, fCodePrintComments, and fFlagPrint.

{
// Set flags to authorize printing of some comments concerning initialisations (default)

  fFlagPrint = fCodePrintComments;
  cout << "*TEcnaRead::PrintComments()> Warnings and some comments on init will be printed" << endl;
}
void TEcnaRead::PrintNoComment ( )
void TEcnaRead::PrintWarnings ( )

Definition at line 4465 of file TEcnaRead.cc.

References gather_cfg::cout, fCodePrintWarnings, and fFlagPrint.

{
// Set flags to authorize printing of warnings

  fFlagPrint = fCodePrintWarnings;
  cout << "*TEcnaRead::PrintWarnings()> Warnings will be printed" << endl;
}
TVectorD TEcnaRead::Read1DHisto ( const Int_t &  VecDim,
const TString  UserQuantity,
const TString  UserDetector 
)

Definition at line 383 of file TEcnaRead.cc.

References TEcnaParHistos::BuildStandard1DHistoCodeY(), TEcnaParHistos::BuildStandardDetectorCode(), gather_cfg::cout, fCnaParHistos, fEcal, fFileHeader, TEcnaHeader::fFirstReqEvtNumber, FileParameters(), TEcnaHeader::fLastReqEvtNumber, TEcnaHeader::fNbOfSamples, fPathRoot, TEcnaHeader::fReqNbOfEvts, TEcnaHeader::fRunNumber, TEcnaHeader::fStartDate, TEcnaHeader::fStopDate, fTTBELL, TEcnaHeader::fTypAna, GetStartDate(), GetStartTime(), GetStopDate(), GetStopTime(), GetTechReadCode(), i, LookAtRootFile(), TEcnaParEcal::MaxCrysEcnaInStex(), TEcnaParEcal::MaxStexInStas(), TEcnaParEcal::MaxStinEcnaInStas(), TEcnaParEcal::MaxStinEcnaInStex(), ReadAverageHighFrequencyNoise(), ReadAverageLowFrequencyNoise(), ReadAverageMeanCorrelationsBetweenSamples(), ReadAverageNumberOfEvents(), ReadAveragePedestals(), ReadAverageSigmaOfCorrelationsBetweenSamples(), ReadAverageTotalNoise(), ReadHighFrequencyNoise(), ReadLowFrequencyNoise(), ReadMeanCorrelationsBetweenSamples(), ReadNumberOfEvents(), ReadPedestals(), ReadSigmaOfCorrelationsBetweenSamples(), and ReadTotalNoise().

{
  // VecDim = fEcal->MaxCrysEcnaInStex if StandardDetector = "SM" or "Dee"
  // VecDim = fEcal->MaxStinEcnaInStas if StandardDetector = "EB" or "EE"

  Int_t VecDimTest = 1;
  TString StandardDetector = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
  if( StandardDetector == "SM" || StandardDetector == "Dee"){VecDimTest = fEcal->MaxCrysEcnaInStex();}
  if( StandardDetector == "EB" || StandardDetector == "EE" ){VecDimTest = fEcal->MaxStinEcnaInStas();}

  if( VecDim == VecDimTest )
    {
      TVectorD vec(VecDim);

      TString CallingMethod = "1D";
      TString StandardQuantity = "?";
      StandardQuantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, UserQuantity);
      TString rTechReadCode = GetTechReadCode(StandardQuantity, StandardDetector);

      if( rTechReadCode != "?" )
        {
          if( StandardDetector == "SM" || StandardDetector == "Dee")
            {
              if( rTechReadCode == "NOEStex" ){vec = ReadNumberOfEvents(fEcal->MaxCrysEcnaInStex());}
              if( rTechReadCode == "PedStex" ){vec = ReadPedestals(fEcal->MaxCrysEcnaInStex());}
              if( rTechReadCode == "TNoStex" ){vec = ReadTotalNoise(fEcal->MaxCrysEcnaInStex());}
              if( rTechReadCode == "LFNStex" ){vec = ReadLowFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
              if( rTechReadCode == "HFNStex" ){vec = ReadHighFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
              if( rTechReadCode == "MCsStex" ){vec = ReadMeanCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
              if( rTechReadCode == "SCsStex" ){vec = ReadSigmaOfCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
            }

          if( StandardDetector == "EB" || StandardDetector == "EE" )
            {
              TVectorD vecStex(fEcal->MaxStinEcnaInStex());
              for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vecStex(i)=(Double_t)0.;}

              time_t xStartTime = GetStartTime();
              time_t xStopTime =  GetStopTime();
              TString xStartDate = "sStartDate";
              TString xStopDate  = "sStopDate";

              for(Int_t i0Stex=0; i0Stex<fEcal->MaxStexInStas(); i0Stex++)
                {
                  Int_t n1Stex = i0Stex+1;
                  FileParameters(fFileHeader->fTypAna,           fFileHeader->fNbOfSamples,
                                 fFileHeader->fRunNumber,        fFileHeader->fFirstReqEvtNumber,
                                 fFileHeader->fLastReqEvtNumber, fFileHeader->fReqNbOfEvts,
                                 n1Stex, fPathRoot);

                  if( LookAtRootFile() == kTRUE )
                    {
                      if( rTechReadCode == "NOEStas" ){vecStex = ReadAverageNumberOfEvents(fEcal->MaxStinEcnaInStex());}
                      if( rTechReadCode == "PedStas" ){vecStex = ReadAveragePedestals(fEcal->MaxStinEcnaInStex());}
                      if( rTechReadCode == "TNoStas" ){vecStex = ReadAverageTotalNoise(fEcal->MaxStinEcnaInStex());}
                      if( rTechReadCode == "LFNStas" ){vecStex = ReadAverageLowFrequencyNoise(fEcal->MaxStinEcnaInStex());}
                      if( rTechReadCode == "HFNStas" ){vecStex = ReadAverageHighFrequencyNoise(fEcal->MaxStinEcnaInStex());}
                      if( rTechReadCode == "MCsStas" )
                        {vecStex = ReadAverageMeanCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
                      if( rTechReadCode == "SCsStas" )
                        {vecStex = ReadAverageSigmaOfCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
                  
                      for(Int_t i0Stin=0; i0Stin<fEcal->MaxStinEcnaInStex(); i0Stin++)
                        {
                          vec(fEcal->MaxStinEcnaInStex()*i0Stex+i0Stin) = vecStex(i0Stin);
                        }

                      //............ Get start and stop date for the Stas (Stas = EB or EE)
                      if( i0Stex == 0 )
                        {
                          xStartTime = GetStartTime();
                          xStopTime =  GetStopTime();
                          xStartDate = GetStartDate();
                          xStopDate  = GetStopDate();
                        }
                      time_t  cStartTime = GetStartTime();
                      time_t  cStopTime  = GetStopTime();
                      TString cStartDate = GetStartDate();
                      TString cStopDate  = GetStopDate();

                      if( cStartTime < xStartTime ){xStartTime = cStartTime; xStartDate = cStartDate;}
                      if( cStopTime  > xStopTime  ){xStopTime  = cStopTime;  xStopDate  = cStopDate;}

                      fFileHeader->fStartDate = xStartDate;
                      fFileHeader->fStopDate  = xStopDate;
                    }
                  else
                    {
                      cout  << "!TEcnaRead::Read1DHisto(const TString, const TString)> *ERROR* =====> "
                            << " ROOT file not found" << fTTBELL << endl;
                    }
                }
            }
        }
      else
        {
          for(Int_t i=0; i<VecDim; i++){vec(i) = (double_t)0.;}
          cout <<"!TEcnaRead::Read1DHisto(...)> UserQuantity = " << UserQuantity
               << ", UserDetector = " << UserDetector
               << ". Wrong code(s). No file reading." << fTTBELL << endl;
        }
      return vec;
    }
  else
    {
      TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i) = (double_t)0.;}
      cout <<"!TEcnaRead::Read1DHisto(...)> UserQuantity = " << UserQuantity
           << ", UserDetector = " << UserDetector << ", VecDim = " << VecDim
           << ". Wrong code(s) or array dimension. No file reading." << fTTBELL << endl; 
      return vec;
    }
}  // end of Read1DHisto / Stex and Stas histos
TVectorD TEcnaRead::Read1DHisto ( const Int_t &  VecDim,
const TString  UserQuantity,
const Int_t &  n1StexStin,
const Int_t &  i0StinEcha,
const Int_t &  n1Sample 
)

Definition at line 313 of file TEcnaRead.cc.

References TEcnaParHistos::BuildStandard1DHistoCodeY(), gather_cfg::cout, fCnaParHistos, fFileHeader, TEcnaHeader::fReqNbOfEvts, fTTBELL, i, and ReadSampleAdcValues().

{
  Int_t VecDimTest = fFileHeader->fReqNbOfEvts;

  if( VecDim == VecDimTest )
    {
      TVectorD vec(VecDim);

      TString CallingMethod = "1D";
      TString StandardQuantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, UserQuantity);

      if( StandardQuantity == "Adc" )
        {
          Int_t i0Sample = n1Sample-1;
          vec = ReadSampleAdcValues(n1StexStin, i0StinEcha, i0Sample, VecDim);
        }
      else
        {
          for(Int_t i=0; i<VecDim; i++){vec(i) = (double_t)0.;}
          cout <<"!TEcnaRead::Read1DHisto(...)>  UserQuantity = " << UserQuantity
               << "(StandardQuantity = " << StandardQuantity
               << "). Wrong code, no file reading." << fTTBELL << endl;
        }
      return vec;
    }
  else
    {
      TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i) = (double_t)0.;}
      cout <<"!TEcnaRead::Read1DHisto(...)> UserQuantity = " << UserQuantity
           << ", VecDim = " << VecDim << "(VecDimTest = " << VecDimTest << ")"
           << ". Wrong code or array dimension. No file reading." << fTTBELL << endl;
      return vec;
    }
}  // end of Read1DHisto / ReadSampleAdcValues
TVectorD TEcnaRead::Read1DHisto ( const Int_t &  VecDim,
const TString  UserQuantity,
const Int_t &  n1StexStin 
)

Definition at line 349 of file TEcnaRead.cc.

References TEcnaParHistos::BuildStandard1DHistoCodeY(), gather_cfg::cout, fCnaParHistos, fEcal, fTTBELL, i, TEcnaParEcal::MaxCrysInStin(), TEcnaParEcal::MaxSampADC(), ReadSampleMeans(), and ReadSampleSigmas().

{
  Int_t  VecDimTest = fEcal->MaxCrysInStin()*fEcal->MaxSampADC();
  if( VecDim == VecDimTest )
    {
      TVectorD vec(VecDim);
      
      TString CallingMethod = "1D";
      TString StandardQuantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, UserQuantity);
      
      if( StandardQuantity == "MSp" || StandardQuantity == "SSp" )
        {
          if( StandardQuantity == "MSp" ){vec = ReadSampleMeans(n1StexStin, VecDim);}
          if( StandardQuantity == "SSp" ){vec = ReadSampleSigmas(n1StexStin, VecDim);}
        }
      else
        {
          for(Int_t i=0; i<VecDim; i++){vec(i) = (double_t)0.;}
          cout <<"!TEcnaRead::Read1DHisto(...)>  UserQuantity = " << UserQuantity
               << ", StandardQuantity = " << StandardQuantity
               << ". Wrong code, no file reading." << fTTBELL << endl;
        }
      return vec;
    }
  else
    {
      TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i) = (double_t)0.;}
      cout <<"!TEcnaRead::Read1DHisto(...)> UserQuantity = " << UserQuantity
           << ", VecDim = " << VecDim << "(VecDimTest = " << VecDimTest << ")"
           << ". Wrong code or array dimension. No file reading." << fTTBELL << endl; 
      return vec;
    }
}  // end of Read1DHisto / ReadSampleMeans , ReadSampleSigmas
TVectorD TEcnaRead::ReadAverageHighFrequencyNoise ( const Int_t &  VecDim)

Definition at line 2629 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypAvHfn, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by Read1DHisto(), TEcnaHistos::ViewHisto(), and TEcnaHistos::ViewStas().

{
//Read the expectation values of the Pedestals
//for all the Stins of a given Stex
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()

  TestArrayDimH1("ReadAverageHighFrequencyNoise", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);

  TVectorD vec(VecDim);
 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  CnaResultTyp typ = cTypAvHfn;    // averaged High FrequencyNoise type
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
  
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadAverageHighFrequencyNoise(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadAverageHighFrequencyNoise(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++)
            {
              vec(i0StexStin)  = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadAverageHighFrequencyNoise(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                              -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
} // end of ReadAverageHighFrequencyNoise
TVectorD TEcnaRead::ReadAverageLowFrequencyNoise ( const Int_t &  VecDim)

Definition at line 2546 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypAvLfn, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by Read1DHisto(), TEcnaHistos::ViewHisto(), and TEcnaHistos::ViewStas().

{
//Read the expectation values of the Pedestals
//for all the Stins of a given Stex
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()

  TestArrayDimH1("ReadAverageLowFrequencyNoise", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);

  TVectorD vec(VecDim);
  for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  CnaResultTyp typ = cTypAvLfn;    // averaged Low FrequencyNoise type
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
  
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;

//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadAverageLowFrequencyNoise(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadAverageLowFrequencyNoise(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++)
            {
              vec(i0StexStin)  = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadAverageLowFrequencyNoise(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                             -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
} // end of ReadAverageLowFrequencyNoise
TVectorD TEcnaRead::ReadAverageMeanCorrelationsBetweenSamples ( const Int_t &  VecDim)

Definition at line 2712 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypAvMeanCorss, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by Read1DHisto(), TEcnaHistos::ViewHisto(), and TEcnaHistos::ViewStas().

{
//Read the expectation values of the Pedestals
//for all the Stins of a given Stex
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()

  TestArrayDimH1("ReadAverageMeanCorrelationsBetweenSamples", "fEcal->MaxStinEcnaInStex()",
                 fEcal->MaxStinEcnaInStex(), VecDim);

  TVectorD vec(VecDim);
 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  CnaResultTyp typ = cTypAvMeanCorss;    // averaged MeanCorrelationsBetweenSamples type
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;

  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
    
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadAverageMeanCorrelationsBetweenSamples(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadAverageMeanCorrelationsBetweenSamples(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++)
            {
              vec(i0StexStin)  = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadAverageMeanCorrelationsBetweenSamples(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                          -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
} // end of ReadAverageMeanCorrelationsBetweenSamples
TVectorD TEcnaRead::ReadAverageNumberOfEvents ( const Int_t &  VecDim)

Definition at line 2315 of file TEcnaRead.cc.

References fEcal, fEcalNumbering, fFileHeader, TEcnaHeader::fStex, fStexName, TEcnaNumbering::Get0StexEchaFrom1StexStinAnd0StinEcha(), i, TEcnaParEcal::MaxCrysEcnaInStex(), TEcnaParEcal::MaxCrysInStin(), TEcnaNumbering::MaxCrysInStinEcna(), TEcnaParEcal::MaxStinEcnaInStex(), ReadNumberOfEvents(), and TestArrayDimH1().

Referenced by Read1DHisto(), TEcnaHistos::ViewHisto(), and TEcnaHistos::ViewStas().

{
//Read the numbers of found events in the data
//for the crystals and for the samples for all the Stin's in the Stex
//in the ROOT file, compute the average on the samples and on the crystals
//and return them in a TVectorD(MaxStinEcnaInStex)
//
//Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()

  TestArrayDimH1("ReadAverageNumberOfEvents", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);

  TVectorD vecAverage(VecDim);
  for(Int_t i=0; i<VecDim; i++){vecAverage(i)=(Double_t)0.;}

  TVectorD vecMean(fEcal->MaxCrysEcnaInStex());
  for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){vecMean(i)=(Double_t)0.;}

  vecMean = ReadNumberOfEvents(fEcal->MaxCrysEcnaInStex());

  for(Int_t i0StexStin=0; i0StexStin<VecDim; i0StexStin++)
    {
      vecAverage(i0StexStin) = 0;
      //.... average value over the crystals
      for(Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++)
        {
          Int_t n1StexStin = i0StexStin+1;
          Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
          
          if( fStexName == "SM" )
            {vecAverage(i0StexStin) += vecMean(i0StexEcha);}

          if( fStexName == "Dee" )
            {
              //--------- EE --> Special translation for mixed SCEcna (29 and 32)
              //                 Xtal 11 of SCEcna 29 -> Xtal 11 of SCEcna 10
              //                 Xtal 11 of SCEcna 32 -> Xtal 11 of SCEcna 11
              Int_t n1StinEcha = i0StinEcha+1;
              if( n1StexStin == 10 && n1StinEcha == 11 )
                {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);}
              if( n1StexStin == 11 && n1StinEcha == 11 )
                {i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);}
              if( !( (n1StexStin == 29 || n1StexStin == 32) && n1StinEcha == 11 )  )
                {vecAverage(i0StexStin) += vecMean(i0StexEcha);}
            }
        }

      Double_t xdivis = (Double_t)0.;
      if( fStexName == "SM"  )
        {xdivis = (Double_t)fEcal->MaxCrysInStin();}
      if( fStexName == "Dee" )
        {
          Int_t n1StexStin = i0StexStin+1;
          xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStin, "TEcnaRead");
        }

      vecAverage(i0StexStin) = vecAverage(i0StexStin)/xdivis;   
    }
  return vecAverage;
}
TVectorD TEcnaRead::ReadAveragePedestals ( const Int_t &  VecDim)

Definition at line 2380 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypAvPed, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by Read1DHisto(), TEcnaHistos::ViewHisto(), and TEcnaHistos::ViewStas().

{
//Read the expectation values of the Pedestals
//for all the Stins of a given Stex
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()

  TestArrayDimH1("ReadAveragePedestals", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);

  TVectorD vec(VecDim);
  for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  CnaResultTyp typ = cTypAvPed;    // averaged pedestals type
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;

  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadAveragePedestals(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadAveragePedestals(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for(Int_t i0StexStin=0; i0StexStin<VecDim; i0StexStin++)
            {
              vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadAveragePedestals(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                     -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
} // end of ReadAveragePedestals
TVectorD TEcnaRead::ReadAverageSigmaOfCorrelationsBetweenSamples ( const Int_t &  VecDim)

Definition at line 2796 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypAvSigCorss, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by Read1DHisto(), TEcnaHistos::ViewHisto(), and TEcnaHistos::ViewStas().

{
//Read the expectation values of the Pedestals
//for all the Stins of a given Stex
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()

  TestArrayDimH1("ReadAverageSigmaOfCorrelationsBetweenSamples", "fEcal->MaxStinEcnaInStex()",
                 fEcal->MaxStinEcnaInStex(), VecDim);

  TVectorD vec(VecDim);
 for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  CnaResultTyp typ = cTypAvSigCorss;    // averaged SigmaOfCorrelationsBetweenSamples type
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;

  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
      
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadAverageSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadAverageSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++)
            {
              vec(i0StexStin)  = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadAverageSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                             -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
} // end of ReadAverageSigmaOfCorrelationsBetweenSamples
TVectorD TEcnaRead::ReadAverageTotalNoise ( const Int_t &  VecDim)

Definition at line 2463 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypAvTno, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by Read1DHisto(), TEcnaHistos::ViewHisto(), and TEcnaHistos::ViewStas().

{
//Read the expectation values of the Total Noise
//for all the Stins of a given Stex
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()

  TestArrayDimH1("ReadAverageTotalNoise", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);

  TVectorD vec(VecDim);
  for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  CnaResultTyp typ = cTypAvTno;    // averaged Total Noise type
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
  
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadAverageTotalNoise(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadAverageTotalNoise(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++)
            {
              vec(i0StexStin)  = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadAverageTotalNoise(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                      -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
}
TMatrixD TEcnaRead::ReadCorrelationsBetweenSamples ( const Int_t &  n1StexStin,
const Int_t &  i0StinEcha,
const Int_t &  MatDim 
)

Definition at line 2975 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypCorCss, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcalNumbering, fFileHeader, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaHeader::fNbOfSamples, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaNumbering::Get0StexEchaFrom1StexStinAnd0StinEcha(), TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, j, OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH2().

Referenced by ReadMatrix(), TEcnaHistos::ViewMatrix(), and TEcnaHistos::ViewStin().

{
//Read the (sample,sample) correlations for a given channel
//in ROOT file and return them in a TMatrixD
//
//Possible values for MatDim: (1) MatDim = fFileHeader->fNbOfSamples

  TestArrayDimH2("ReadCorrelationsBetweenSamples", "fFileHeader->fNbOfSamples", fFileHeader->fNbOfSamples, MatDim);

  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
  TMatrixD mat(MatDim, MatDim);
  for(Int_t i=0; i- MatDim <0; i++)
    {for(Int_t j=0; j-MatDim<0; j++){mat(i,j)=(Double_t)0.;}}

  CnaResultTyp typ = cTypCorCss;
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
    
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
      
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadCorrelationsBetweenSamples(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadCorrelationsBetweenSamples(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      ok_read = gCnaRootFile->ReadElement(typ, i0StexEcha);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_samp = 0; i_samp - MatDim < 0; i_samp++){
            for ( Int_t j_samp = 0; j_samp - MatDim < 0; j_samp++){
              mat(i_samp, j_samp) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp,j_samp);}}
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadCorrelationsBetweenSamples() *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                            -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return mat;
}
TMatrixD TEcnaRead::ReadCovariancesBetweenSamples ( const Int_t &  n1StexStin,
const Int_t &  i0StinEcha,
const Int_t &  MatDim 
)

Definition at line 2886 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypCovCss, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcalNumbering, fFileHeader, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaHeader::fNbOfSamples, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaNumbering::Get0StexEchaFrom1StexStinAnd0StinEcha(), TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, j, OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH2().

Referenced by ReadMatrix(), TEcnaHistos::ViewMatrix(), and TEcnaHistos::ViewStin().

{
//Read the (sample,sample) covariances for a given channel
//in ROOT file and return them in a TMatrixD
//
//Possible values for MatDim: (1) MatDim = fFileHeader->fNbOfSamples

  TestArrayDimH2("ReadCovariancesBetweenSamples", "fFileHeader->fNbOfSamples", fFileHeader->fNbOfSamples, MatDim);

  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);

  TMatrixD mat(MatDim, MatDim);
  for(Int_t i=0; i-MatDim<0; i++)
    {for(Int_t j=0; j-MatDim<0; j++){mat(i,j)=(Double_t)0.;}}
  
  CnaResultTyp typ = cTypCovCss;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
  
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
      
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadCovariancesBetweenSamples(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadCovariancesBetweenSamples(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      ok_read = gCnaRootFile->ReadElement(typ, i0StexEcha);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for( Int_t i_samp = 0; i_samp - MatDim < 0; i_samp++ )
            {
              for ( Int_t j_samp = 0; j_samp - MatDim < 0; j_samp++)
                {
                 mat(i_samp, j_samp) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp,j_samp);
                }
            }
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadCovariancesBetweenSamples() *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                           -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return mat;
}
TMatrixD TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels ( const Int_t &  n1StexStin_a,
const Int_t &  n1StexStin_b,
const Int_t &  MatDim 
)

Definition at line 3432 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypHfCor, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetStinIndex(), GetTypeOfQuantity(), i, j, TEcnaParEcal::MaxCrysInStin(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH2().

Referenced by ReadMatrix(), TEcnaHistos::StexHocoVecoLHFCorcc(), and TEcnaHistos::ViewMatrix().

{
//Read the High Frequency Cor(i0StinEcha of Stin_a, i0StinEcha of Stin b)
//in ROOT file and return them in a TMatrixD
//
//Possible values for MatDim: (1) MatDim = fEcal->MaxCrysInStin()

  TestArrayDimH2("ReadHighFrequencyCorrelationsBetweenChannels", "fEcal->MaxCrysInStin()",
                 fEcal->MaxCrysInStin(), MatDim);

  Int_t   index_Stin_a = GetStinIndex(n1StexStin_a);
  Int_t   index_Stin_b = GetStinIndex(n1StexStin_b);

  TMatrixD mat(MatDim, MatDim);
  for(Int_t i=0; i-MatDim<0; i++)
    {for(Int_t j=0; j-MatDim<0; j++){mat(i,j)=(Double_t)0.;}}
  
  CnaResultTyp typ = cTypHfCor;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
    
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
    
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(...) *** ERROR ***>"
//         << " Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;

      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_crys = 0; i_crys - MatDim<0; i_crys++)
            {
              Int_t i_cna_chan = index_Stin_a*MatDim + i_crys;
              for ( Int_t j_crys = 0; j_crys - MatDim<0; j_crys++)
                {
                  Int_t j_cna_chan = index_Stin_b*MatDim + j_crys;
                  mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
                }
            }
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                             -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return mat;
}
TMatrixD TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels ( const Int_t &  MatDim)

Definition at line 3859 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypHfCor, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, j, TEcnaParEcal::MaxCrysEcnaInStex(), TEcnaParEcal::MaxCrysInStin(), TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), ReadStinNumbers(), and TestArrayDimH2().

{
//Read all the High Frequency correlations
//in ROOT file and return them in a TMatrixD
//
//Possible values for MatDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()

  TestArrayDimH2("ReadHighFrequencyCorrelationsBetweenChannels", "fEcal->MaxCrysEcnaInStex()",
                 fEcal->MaxCrysEcnaInStex(), MatDim);

  //=====> WARNING: BIG MATRIX (1700x1700)
  TMatrixD mat(MatDim, MatDim);
  for(Int_t i=0; i-MatDim<0; i++){for(Int_t j=0; j-MatDim<0; j++){mat(i,j)=(Double_t)0.;}}

  TVectorD vec(fEcal->MaxStinEcnaInStex());
  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
  vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
  
  CnaResultTyp typ = cTypHfCor;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
    
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels() *** ERROR ***>"
//         << " Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for (Int_t index_Stin_a = 0; index_Stin_a < fEcal->MaxStinEcnaInStex(); index_Stin_a++)
            {
              if ( vec(index_Stin_a) > 0 && vec(index_Stin_a) <= fEcal->MaxStinEcnaInStex())
                {
                  for (Int_t index_Stin_b = 0; index_Stin_b < fEcal->MaxStinEcnaInStex(); index_Stin_b++)
                    {
                      if ( vec(index_Stin_b) > 0 && vec(index_Stin_b) <= fEcal->MaxStinEcnaInStex())
                        {
                          for ( Int_t i_crys = 0; i_crys < fEcal->MaxCrysInStin(); i_crys++)
                            {
                              Int_t i_cna_chan = index_Stin_a*fEcal->MaxCrysInStin() + i_crys;
                              Int_t i_chan_sm = (Int_t)(vec(index_Stin_a)-1)*fEcal->MaxCrysInStin() + i_crys;
                              for ( Int_t j_crys = 0; j_crys < fEcal->MaxCrysInStin(); j_crys++)
                                {
                                  Int_t j_cna_chan = index_Stin_b*fEcal->MaxCrysInStin() + j_crys;
                                  Int_t j_chan_sm = (Int_t)(vec(index_Stin_b)-1)*fEcal->MaxCrysInStin() + j_crys;
                                  mat(i_chan_sm, j_chan_sm) =
                                    gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
                                }
                            }
                        }
                    }
                }
            }
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels() *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                          -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return mat;
}
TMatrixD TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels ( const Int_t &  n1StexStin_a,
const Int_t &  n1StexStin_b,
const Int_t &  MatDim 
)

Definition at line 3336 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypHfCov, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetStinIndex(), GetTypeOfQuantity(), i, j, TEcnaParEcal::MaxCrysInStin(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH2().

Referenced by ReadMatrix(), and TEcnaHistos::ViewMatrix().

{
//Read the High Frequency cov(i0StinEcha of Stin_a, i0StinEcha of Stin b)
//in ROOT file and return them in a TMatrixD
//
//Possible values for MatDim: (1) MatDim = fEcal->MaxCrysInStin()

  TestArrayDimH2("ReadHighFrequencyCovariancesBetweenChannels", "fEcal->MaxCrysInStin()",
                 fEcal->MaxCrysInStin(), MatDim);

  Int_t   index_Stin_a = GetStinIndex(n1StexStin_a);
  Int_t   index_Stin_b = GetStinIndex(n1StexStin_b);

  TMatrixD mat(MatDim, MatDim);
  for(Int_t i=0; i-MatDim<0; i++)
    {for(Int_t j=0; j-MatDim<0; j++){mat(i,j)=(Double_t)0.;}}
  
  CnaResultTyp typ = cTypHfCov;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
    
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(...) *** ERROR ***>"
//         << " Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ,i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_crys = 0; i_crys - MatDim<0; i_crys++)
            {
              Int_t i_cna_chan = index_Stin_a*MatDim + i_crys;
              for ( Int_t j_crys = 0; j_crys - MatDim<0; j_crys++)
                {
                  Int_t j_cna_chan = index_Stin_b*MatDim + j_crys;
                  mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
                }
            }
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                            -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return mat;
}
TMatrixD TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels ( const Int_t &  MatDim)

Definition at line 3749 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypHfCov, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, j, TEcnaParEcal::MaxCrysEcnaInStex(), TEcnaParEcal::MaxCrysInStin(), TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), ReadStinNumbers(), and TestArrayDimH2().

{
//Read all the High Frequency covariances
//in ROOT file and return them in a TMatrixD
//
//Possible values for MatDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()

  TestArrayDimH2("ReadHighFrequencyCovariancesBetweenChannels", "fEcal->MaxCrysEcnaInStex()",
                 fEcal->MaxCrysEcnaInStex(), MatDim);

  //=====> WARNING: BIG MATRIX (1700x1700)
  TMatrixD mat(MatDim, MatDim);
  for(Int_t i=0; i-MatDim<0; i++){for(Int_t j=0; j-MatDim<0; j++){mat(i,j)=(Double_t)0.;}}

  TVectorD vec(fEcal->MaxStinEcnaInStex());
  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
  vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
  
  CnaResultTyp typ = cTypHfCov;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
    
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;

//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels() *** ERROR ***>"
//         << " Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for (Int_t index_Stin_a = 0; index_Stin_a < fEcal->MaxStinEcnaInStex(); index_Stin_a++)
            {
              if ( vec(index_Stin_a) > 0 && vec(index_Stin_a) <= fEcal->MaxStinEcnaInStex())
                {
                  for (Int_t index_Stin_b = 0; index_Stin_b < fEcal->MaxStinEcnaInStex(); index_Stin_b++)
                    {
                      if ( vec(index_Stin_b) > 0 && vec(index_Stin_b) <= fEcal->MaxStinEcnaInStex())
                        {
                          for ( Int_t i_crys = 0; i_crys < fEcal->MaxCrysInStin(); i_crys++)
                            {
                              Int_t i_cna_chan = index_Stin_a*fEcal->MaxCrysInStin() + i_crys;
                              Int_t i_chan_sm = (Int_t)(vec(index_Stin_a)-1)*fEcal->MaxCrysInStin() +i_crys;
                              for ( Int_t j_crys = 0; j_crys < fEcal->MaxCrysInStin(); j_crys++)
                                {
                                  Int_t j_cna_chan = index_Stin_b*fEcal->MaxCrysInStin() + j_crys;
                                  Int_t j_chan_sm = (Int_t)(vec(index_Stin_b)-1)*fEcal->MaxCrysInStin() +j_crys;
                                  mat(i_chan_sm, j_chan_sm) =
                                    gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
                                }
                            }
                        }
                    }
                }
            }
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels() *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                         -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return mat;
}
TMatrixD TEcnaRead::ReadHighFrequencyMeanCorrelationsBetweenStins ( const Int_t &  MatDim)

Definition at line 4072 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypHFccMoStins, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, j, TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), ReadStinNumbers(), and TestArrayDimH2().

Referenced by ReadMatrix(), and TEcnaHistos::ViewMatrix().

{
//Read all the High Frequency Mean Correlations Between Stins the for all (Stin_X, Stin_Y)
//in ROOT file and return them in a TMatrixD
//
//Possible values for MatDim: (1) MatDim = fEcal->MaxStinEcnaInStex()

  TestArrayDimH2("ReadHighFrequencyMeanCorrelationsBetweenStins", "fEcal->MaxStinEcnaInStex()",
                 fEcal->MaxStinEcnaInStex(), MatDim);

  TMatrixD mat(MatDim, MatDim);
  for(Int_t i=0; i-MatDim<0; i++)
    {for(Int_t j=0; j-MatDim<0; j++){mat(i,j)=(Double_t)0.;}}

  TVectorD vec(fEcal->MaxStinEcnaInStex());
  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
  vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());

  CnaResultTyp typ = cTypHFccMoStins;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
    
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadHighFrequencyMeanCorrelationsBetweenStins() *** ERROR ***>"
//         << " Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadHighFrequencyMeanCorrelationsBetweenStins(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for(Int_t index_Stin_a = 0; index_Stin_a - MatDim<0; index_Stin_a++)
            {
              for(Int_t index_Stin_b = 0; index_Stin_b - MatDim<0; index_Stin_b++)   
                {
                  if( vec(index_Stin_a) > 0 && vec(index_Stin_a) <= MatDim)
                    {
                      if( vec(index_Stin_b) > 0 && vec(index_Stin_b) <= MatDim)
                        {
                          Int_t vec_ia_m = (Int_t)vec(index_Stin_a)-1;
                          Int_t vec_ib_m = (Int_t)vec(index_Stin_b)-1;
                          mat((Int_t)vec_ia_m, (Int_t)vec_ib_m) =
                            gCnaRootFile->fCnaIndivResult->fMatMat(index_Stin_a,index_Stin_b);
                        }
                    }
                }
            }
        } 
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadHighFrequencyMeanCorrelationsBetweenStins() *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                           -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return mat;
}
TVectorD TEcnaRead::ReadHighFrequencyNoise ( const Int_t &  VecDim)

Definition at line 2149 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypHfn, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxCrysEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by TEcnaHistos::GetHistoValues(), Read1DHisto(), TEcnaHistos::ViewHistime(), and TEcnaHistos::ViewStex().

{
//Read the sigmas of the sigmas of the samples
//for all the channels of a given Stin
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()

  TestArrayDimH1("ReadHighFrequencyNoise", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), VecDim);
  
  TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
  CnaResultTyp typ = cTypHfn;        // high frequency noise type
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
  
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;

//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadHighFrequencyNoise(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadHighFrequencyNoise(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++)
            {
              vec(i_StexCrys)  = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_StexCrys);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadHighFrequencyNoise(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                       -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
}
TMatrixD TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels ( const Int_t &  MatDim)

Definition at line 3639 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypLfCor, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, j, TEcnaParEcal::MaxCrysEcnaInStex(), TEcnaParEcal::MaxCrysInStin(), TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), ReadStinNumbers(), and TestArrayDimH2().

{
//Read all the Low Frequency correlations
//in ROOT file and return them in a TMatrixD
//
//Possible values for MatDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()

  TestArrayDimH2("ReadLowFrequencyCorrelationsBetweenChannels", "fEcal->MaxCrysEcnaInStex()",
                 fEcal->MaxCrysEcnaInStex(), MatDim);

  //=====> WARNING: BIG MATRIX (1700x1700)
  TMatrixD mat(MatDim, MatDim);
  for(Int_t i=0; i-MatDim<0; i++){for(Int_t j=0; j-MatDim<0; j++){mat(i,j)=(Double_t)0.;}}

  TVectorD vec(fEcal->MaxStinEcnaInStex());
  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
  vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
  
  CnaResultTyp typ = cTypLfCor;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
    
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
    
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels() *** ERROR ***>"
//         << " Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for (Int_t index_Stin_a = 0; index_Stin_a < fEcal->MaxStinEcnaInStex(); index_Stin_a++)
            {
              if ( vec(index_Stin_a) > 0 && vec(index_Stin_a) <= fEcal->MaxStinEcnaInStex())
                {
                  for (Int_t index_Stin_b = 0; index_Stin_b < fEcal->MaxStinEcnaInStex(); index_Stin_b++)
                    {
                      if ( vec(index_Stin_b) > 0 && vec(index_Stin_b) <= fEcal->MaxStinEcnaInStex())
                        {
                          for ( Int_t i_crys = 0; i_crys < fEcal->MaxCrysInStin(); i_crys++)
                            {
                              Int_t i_cna_chan = index_Stin_a*fEcal->MaxCrysInStin() + i_crys;
                              Int_t i_chan_sm = (Int_t)(vec(index_Stin_a)-1)*fEcal->MaxCrysInStin() + i_crys;
                              for ( Int_t j_crys = 0; j_crys < fEcal->MaxCrysInStin(); j_crys++)
                                {
                                  Int_t j_cna_chan = index_Stin_b*fEcal->MaxCrysInStin() + j_crys;
                                  Int_t j_chan_sm = (Int_t)(vec(index_Stin_b)-1)*fEcal->MaxCrysInStin() + j_crys;
                                  mat(i_chan_sm, j_chan_sm) =
                                    gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
                                }
                            }
                        }
                    }
                }
            }
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels() *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                         ->  quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return mat;
}
TMatrixD TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels ( const Int_t &  n1StexStin_a,
const Int_t &  n1StexStin_b,
const Int_t &  MatDim 
)

Definition at line 3240 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypLfCor, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetStinIndex(), GetTypeOfQuantity(), i, j, TEcnaParEcal::MaxCrysInStin(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH2().

Referenced by ReadMatrix(), TEcnaHistos::StexHocoVecoLHFCorcc(), and TEcnaHistos::ViewMatrix().

{
//Read the Low Frequency cor(i0StinEcha of Stin_a, i0StinEcha of Stin b)
//in ROOT file and return them in a TMatrixD
//
//Possible values for MatDim: (1) MatDim = fEcal->MaxCrysInStin()

  TestArrayDimH2("ReadLowFrequencyCorrelationsBetweenChannels", "fEcal->MaxCrysInStin()", fEcal->MaxCrysInStin(), MatDim);

  Int_t   index_Stin_a = GetStinIndex(n1StexStin_a);
  Int_t   index_Stin_b = GetStinIndex(n1StexStin_b);

  TMatrixD mat(MatDim, MatDim);
  for(Int_t i=0; i-MatDim<0; i++)
    {for(Int_t j=0; j-MatDim<0; j++){mat(i,j)=(Double_t)0.;}}
  
  CnaResultTyp typ = cTypLfCor;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
    
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(...) *** ERROR ***>"
//         << " Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;

      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_crys = 0; i_crys - MatDim<0; i_crys++)
            {
              Int_t i_cna_chan = index_Stin_a*MatDim + i_crys;
              for ( Int_t j_crys = 0; j_crys - MatDim<0; j_crys++)
                {
                  Int_t j_cna_chan = index_Stin_b*MatDim + j_crys;
                  mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
                }
            }
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                            -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return mat;
}
TMatrixD TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels ( const Int_t &  n1StexStin_a,
const Int_t &  n1StexStin_b,
const Int_t &  MatDim 
)

Definition at line 3144 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypLfCov, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetStinIndex(), GetTypeOfQuantity(), i, j, TEcnaParEcal::MaxCrysInStin(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH2().

Referenced by ReadMatrix(), and TEcnaHistos::ViewMatrix().

{
//Read the Low Frequency cov(i0StinEcha of Stin_a, i0StinEcha of Stin b)
//in ROOT file and return them in a TMatrixD
//
//Possible values for MatDim: (1) MatDim = fEcal->MaxCrysInStin()

  TestArrayDimH2("ReadLowFrequencyCovariancesBetweenChannels", "fEcal->MaxCrysInStin()",
                 fEcal->MaxCrysInStin(), MatDim);

  Int_t   index_Stin_a = GetStinIndex(n1StexStin_a);
  Int_t   index_Stin_b = GetStinIndex(n1StexStin_b);

  TMatrixD mat(MatDim, MatDim);
  for(Int_t i=0; i-MatDim<0; i++)
    {for(Int_t j=0; j-MatDim<0; j++){mat(i,j)=(Double_t)0.;}}
  
  CnaResultTyp typ = cTypLfCov;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
    
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(...) *** ERROR ***>"
//         << " Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ,i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_crys = 0; i_crys - MatDim < 0; i_crys++)
            {
              Int_t i_cna_chan = index_Stin_a*MatDim + i_crys;
              for ( Int_t j_crys = 0; j_crys - MatDim<0; j_crys++)
                {
                  Int_t j_cna_chan = index_Stin_b*MatDim + j_crys;
                  mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
                }
            }
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                           -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return mat;
}
TMatrixD TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels ( const Int_t &  MatDim)

Definition at line 3529 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypLfCov, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, j, TEcnaParEcal::MaxCrysEcnaInStex(), TEcnaParEcal::MaxCrysInStin(), TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), ReadStinNumbers(), and TestArrayDimH2().

{
//Read all the Low Frequency covariances
//in ROOT file and return them in a TMatrixD
//
//Possible values for MatDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()

  TestArrayDimH2("ReadLowFrequencyCovariancesBetweenChannels", "fEcal->MaxCrysEcnaInStex()",
                 fEcal->MaxCrysEcnaInStex(), MatDim);

  //=====> WARNING: BIG MATRIX (1700x1700)
  TMatrixD mat(MatDim, MatDim);
  for(Int_t i=0; i-MatDim<0; i++){for(Int_t j=0; j-MatDim<0; j++){mat(i,j)=(Double_t)0.;}}

  TVectorD vec(fEcal->MaxStinEcnaInStex());
  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
  vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());
  
  CnaResultTyp typ = cTypLfCov;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
    
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels() *** ERROR ***>"
//         << " Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for (Int_t index_Stin_a = 0; index_Stin_a < fEcal->MaxStinEcnaInStex(); index_Stin_a++)
            {
              if ( vec(index_Stin_a) > 0 && vec(index_Stin_a) <= fEcal->MaxStinEcnaInStex())
                {
                  for (Int_t index_Stin_b = 0; index_Stin_b < fEcal->MaxStinEcnaInStex(); index_Stin_b++)
                    {
                      if ( vec(index_Stin_b) > 0 && vec(index_Stin_b) <= fEcal->MaxStinEcnaInStex())
                        {
                          for ( Int_t i_crys = 0; i_crys < fEcal->MaxCrysInStin(); i_crys++)
                            {
                              Int_t i_cna_chan = index_Stin_a*fEcal->MaxCrysInStin() + i_crys;
                              Int_t i_chan_sm = (Int_t)(vec(index_Stin_a)-1)*fEcal->MaxCrysInStin() +i_crys;
                              for ( Int_t j_crys = 0; j_crys < fEcal->MaxCrysInStin(); j_crys++)
                                {
                                  Int_t j_cna_chan = index_Stin_b*fEcal->MaxCrysInStin() + j_crys;
                                  Int_t j_chan_sm = (Int_t)(vec(index_Stin_b)-1)*fEcal->MaxCrysInStin() +j_crys;
                                  mat(i_chan_sm, j_chan_sm) =
                                    gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan,j_cna_chan);
                                }
                            }
                        }
                    }
                }
            }
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels() *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                        -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return mat;
}
TMatrixD TEcnaRead::ReadLowFrequencyMeanCorrelationsBetweenStins ( const Int_t &  MatDim)

Definition at line 3970 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypLFccMoStins, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, j, TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), ReadStinNumbers(), and TestArrayDimH2().

Referenced by ReadMatrix(), and TEcnaHistos::ViewMatrix().

{
//Read all the Low Frequency Mean Correlations Between Stins the for all (Stin_X, Stin_Y)
//in ROOT file and return them in a TMatrixD
//
//Possible values for MatDim: (1) MatDim = fEcal->MaxStinEcnaInStex()

  TestArrayDimH2("ReadLowFrequencyMeanCorrelationsBetweenStins", "fEcal->MaxStinEcnaInStex()",
                 fEcal->MaxStinEcnaInStex(), MatDim);

  TMatrixD mat(MatDim, MatDim);
  for(Int_t i=0; i-MatDim<0; i++)
    {for(Int_t j=0; j-MatDim<0; j++){mat(i,j)=(Double_t)0.;}}

  TVectorD vec(fEcal->MaxStinEcnaInStex());
  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vec(i)=(Double_t)0.;}
  vec = ReadStinNumbers(fEcal->MaxStinEcnaInStex());

  CnaResultTyp typ = cTypLFccMoStins;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
    
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
    
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadLowFrequencyMeanCorrelationsBetweenStins() *** ERROR ***>"
//         << " Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadLowFrequencyMeanCorrelationsBetweenStins(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for(Int_t index_Stin_a = 0; index_Stin_a - MatDim < 0; index_Stin_a++)
            {
              for(Int_t index_Stin_b = 0; index_Stin_b - MatDim < 0; index_Stin_b++)   
                {
                  if( vec(index_Stin_a) > 0 && vec(index_Stin_a) <= MatDim)
                    {
                      if( vec(index_Stin_b) > 0 && vec(index_Stin_b) <= MatDim)
                        {
                          Int_t vec_ia_m = (Int_t)vec(index_Stin_a)-1;
                          Int_t vec_ib_m = (Int_t)vec(index_Stin_b)-1;
                          mat((Int_t)vec_ia_m, vec_ib_m) =
                            gCnaRootFile->fCnaIndivResult->fMatMat(index_Stin_a,index_Stin_b);
                        }
                    }
                }
            }
        } 
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadLowFrequencyMeanCorrelationsBetweenStins() *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                          -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return mat;
}
TVectorD TEcnaRead::ReadLowFrequencyNoise ( const Int_t &  VecDim)

Definition at line 2068 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypLfn, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxCrysEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by TEcnaHistos::GetHistoValues(), Read1DHisto(), TEcnaHistos::ViewHistime(), and TEcnaHistos::ViewStex().

{
//Read the sigmas of the expectation values of the samples
//for all the channels of a given Stin
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()

  TestArrayDimH1("ReadLowFrequencyNoise", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), VecDim);

  TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
  CnaResultTyp typ = cTypLfn;        // low frequency noise type
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;

  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
    
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadLowFrequencyNoise(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadLowFrequencyNoise(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++)
            {
              vec(i_StexCrys)  = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_StexCrys);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadLowFrequencyNoise(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                      -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
}
TMatrixD TEcnaRead::ReadMatrix ( const Int_t &  MatDim,
const TString  UserCorOrCov,
const TString  UserBetweenWhat 
)

Definition at line 556 of file TEcnaRead.cc.

References TEcnaParHistos::BuildStandardBetweenWhatCode(), TEcnaParHistos::BuildStandardCovOrCorCode(), gather_cfg::cout, fCnaParHistos, fTTBELL, i, j, ReadHighFrequencyCorrelationsBetweenChannels(), ReadHighFrequencyCovariancesBetweenChannels(), ReadHighFrequencyMeanCorrelationsBetweenStins(), ReadLowFrequencyCorrelationsBetweenChannels(), ReadLowFrequencyCovariancesBetweenChannels(), and ReadLowFrequencyMeanCorrelationsBetweenStins().

{
  //------------------- (BIG MATRIX 1700x1700 for barrel, 5000x5000 for endcap) ------------------
  TMatrixD mat(MatDim, MatDim);
  TString CallingMethod = "2D";
  TString StandardMatrixType  = "?";
  TString StandardBetweenWhat = "?";

  StandardMatrixType  = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
  StandardBetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);

  if( StandardMatrixType != "?" && StandardBetweenWhat != "?" )
    {
      //......................... between channels (covariances, correlations)
      if( StandardMatrixType == "Cov" && StandardBetweenWhat == "MccLF" )
        {mat = ReadLowFrequencyCovariancesBetweenChannels(MatDim);}

      if( StandardMatrixType == "Cor" && StandardBetweenWhat == "MccLF" )
        {mat = ReadLowFrequencyCorrelationsBetweenChannels(MatDim);}

      if( StandardMatrixType == "Cov" && StandardBetweenWhat == "MccHF" )
        {mat = ReadHighFrequencyCovariancesBetweenChannels(MatDim);}

      if( StandardMatrixType == "Cor" && StandardBetweenWhat == "MccHF" )
        {mat = ReadHighFrequencyCorrelationsBetweenChannels(MatDim);}

      //......................... between Stins (mean correlations)
      if( StandardMatrixType == "Cor" && StandardBetweenWhat == "MttLF" )
        {mat = ReadLowFrequencyMeanCorrelationsBetweenStins(MatDim);}

      if( StandardMatrixType == "Cor" && StandardBetweenWhat == "MttHF" )
        {mat = ReadHighFrequencyMeanCorrelationsBetweenStins(MatDim);}
  }
  else
    {
      for(Int_t i=0; i-MatDim<0; i++)
        {for(Int_t j=0; j-MatDim<0; j++)
            {mat(i,j) = (double_t)0.;}}
      cout <<"!TEcnaRead::ReadMatrix(...)> UserCorOrCov = " << UserCorOrCov
           << ", UserBetweenWhat = " << UserBetweenWhat
           << ". Wrong code(s), no file reading." << fTTBELL << endl;
    }
  return mat;
}
TMatrixD TEcnaRead::ReadMatrix ( const Int_t &  MatDim,
const TString  UserCorOrCov,
const TString  UserBetweenWhat,
const Int_t &  nb_arg_1,
const Int_t &  nb_arg_2 
)

Definition at line 501 of file TEcnaRead.cc.

References TEcnaParHistos::BuildStandardBetweenWhatCode(), TEcnaParHistos::BuildStandardCovOrCorCode(), gather_cfg::cout, fCnaParHistos, fTTBELL, i, j, ReadCorrelationsBetweenSamples(), ReadCovariancesBetweenSamples(), ReadHighFrequencyCorrelationsBetweenChannels(), ReadHighFrequencyCovariancesBetweenChannels(), ReadLowFrequencyCorrelationsBetweenChannels(), and ReadLowFrequencyCovariancesBetweenChannels().

{
  TMatrixD mat(MatDim, MatDim);
  TString CallingMethod = "2D";
  TString StandardMatrixType  = "?";
  TString StandardBetweenWhat = "?";

  StandardMatrixType  = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
  StandardBetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);

  if( StandardMatrixType != "?" && StandardBetweenWhat != "?" )
    {
      if( StandardBetweenWhat == "Mss" )
        {
          Int_t n1StexStin = nb_arg_1; 
          Int_t i0StinEcha = nb_arg_2;
          
          if( StandardMatrixType == "Cov" )
            {mat = ReadCovariancesBetweenSamples(n1StexStin, i0StinEcha, MatDim);}
          
          if( StandardMatrixType == "Cor" )
            {mat = ReadCorrelationsBetweenSamples(n1StexStin, i0StinEcha, MatDim);}
        }

      if( StandardBetweenWhat != "Mss" )
        {
          Int_t n1StexStin_a = nb_arg_1; 
          Int_t n1StexStin_b = nb_arg_2;

          if( StandardMatrixType == "Cov" && StandardBetweenWhat == "MccLF" )
            {mat = ReadLowFrequencyCovariancesBetweenChannels(n1StexStin_a, n1StexStin_b, MatDim);}

          if( StandardMatrixType == "Cor" && StandardBetweenWhat == "MccLF" )
            {mat = ReadLowFrequencyCorrelationsBetweenChannels(n1StexStin_a, n1StexStin_b, MatDim);}

          if( StandardMatrixType == "Cov" && StandardBetweenWhat == "MccHF" )
            {mat = ReadHighFrequencyCovariancesBetweenChannels(n1StexStin_a, n1StexStin_b, MatDim);}

          if( StandardMatrixType == "Cor" && StandardBetweenWhat == "MccHF" )
            {mat = ReadHighFrequencyCorrelationsBetweenChannels(n1StexStin_a, n1StexStin_b, MatDim);}
        }
    }
  else
    {
      for(Int_t i=0; i-MatDim<0; i++)
        {for(Int_t j=0; j-MatDim<0; j++)
            {mat(i,j) = (double_t)0.;}}
      cout <<"!TEcnaRead::ReadMatrix(...)> UserCorOrCov = " << UserCorOrCov
           << ", UserBetweenWhat = " << UserBetweenWhat
           << ". Wrong code(s), no file reading." << fTTBELL << endl;
    }
  return mat;
}
TVectorD TEcnaRead::ReadMeanCorrelationsBetweenSamples ( const Int_t &  VecDim)

Definition at line 1987 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypMeanCorss, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxCrysEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by TEcnaHistos::GetHistoValues(), Read1DHisto(), TEcnaHistos::ViewHistime(), and TEcnaHistos::ViewStex().

{
//Read the Expectation values of the (sample,sample) correlations
//for all the channels of a given Stin
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim: (1) VecDim = fEcal->MaxCrysEcnaInStex()

  TestArrayDimH1("ReadMeanCorrelationsBetweenSamples", "fEcal->MaxCrysEcnaInStex()",
                 fEcal->MaxCrysEcnaInStex(), VecDim);

  TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
  CnaResultTyp typ = cTypMeanCorss;     // mean corss type
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;

  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
   
  //if ( fOpenRootFile )
  //  {
  //    cout << "!TEcnaRead::ReadMeanCorrelationsBetweenSamples(...) *** ERROR ***> "
  //       << "Reading on file already open." << fTTBELL << endl;
  //  }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");
      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadMeanCorrelationsBetweenSamples(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++)
            {
              vec(i_StexCrys)  = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_StexCrys);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadMeanCorrelationsBetweenSamples(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                   ->  quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
}
TVectorD TEcnaRead::ReadNumberOfEvents ( const Int_t &  VecDim)

Definition at line 1681 of file TEcnaRead.cc.

References fEcal, fEcalNumbering, fFileHeader, TEcnaHeader::fNbOfSamples, TEcnaNumbering::Get0StexEchaFrom1StexStinAnd0StinEcha(), i, j, TEcnaParEcal::MaxCrysEcnaInStex(), TEcnaParEcal::MaxCrysInStin(), TEcnaParEcal::MaxStinEcnaInStex(), ReadNumberOfEventsForSamples(), and TestArrayDimH1().

Referenced by TEcnaHistos::GetHistoValues(), GetNumberOfEvents(), Read1DHisto(), ReadAverageNumberOfEvents(), and TEcnaHistos::ViewStex().

{
//Read the numbers of found events in the data
//for the crystals and for the samples for all the Stin's in the Stex
//in the ROOT file, compute the average on the samples
//and return them in a TVectorD(MaxCrysEcnaInStex)
//
//Possible values for VecDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()

  TestArrayDimH1("ReadNumberOfEvents", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), VecDim);

  TVectorD vec(VecDim);
  for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  TMatrixD mat(fEcal->MaxCrysInStin(), fFileHeader->fNbOfSamples);

  for(Int_t iStexStin=0; iStexStin<fEcal->MaxStinEcnaInStex(); iStexStin++)
    {
      //............. set mat(,) to zero before reading it
      for(Int_t i=0; i<fEcal->MaxCrysInStin(); i++)
        {for(Int_t j=0; j<fFileHeader->fNbOfSamples; j++){mat(i,j)=(Double_t)0.;}}
      //............. read mat(,)
      Int_t n1StexStin = iStexStin+1;
      mat = ReadNumberOfEventsForSamples(n1StexStin, fEcal->MaxCrysInStin(), fFileHeader->fNbOfSamples);

      for(Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++)
        {
          Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
          vec(i0StexEcha) = 0; 
          //.... average value over the samples
          for(Int_t i_samp=0; i_samp<fFileHeader->fNbOfSamples; i_samp++)
            {vec(i0StexEcha) += mat(i0StinEcha, i_samp);}
          vec(i0StexEcha) = vec(i0StexEcha)/fFileHeader->fNbOfSamples;
        } 
    }
  return vec;
}
TMatrixD TEcnaRead::ReadNumberOfEventsForSamples ( const Int_t &  n1StexStin,
const Int_t &  MatDimX,
const Int_t &  MatDimY 
)

Definition at line 1724 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypNbOfEvts, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, fLookAtRootFile, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetStinIndex(), GetTypeOfQuantity(), i, j, OpenRootFile(), and TEcnaRootFile::ReadElement().

Referenced by ReadNumberOfEvents(), and TEcnaRun::ReadSampleAdcValues().

{
//Read the numbers of found events in the data
//for the crystals and for the samples, for a given Stin in the Stex
//in the ROOT file and return them in a TMatrixD(MaxCrysInStin,NbOfSamples)
//
//Possible values for MatDimX and MatDimY:
//  (1) MatDimX = fEcal->MaxCrysInStin(), MatDimY = fFileHeader->fNbOfSamples



  TMatrixD mat(MatDimX, MatDimY);
  for(Int_t i=0; i-MatDimX<0; i++)
    {for(Int_t j=0; j-MatDimY<0; j++){mat(i,j)=(Double_t)0.;}}

  Int_t Stin_index = GetStinIndex(n1StexStin);
  if( Stin_index >= 0 )
    {
      if(fLookAtRootFile == 1)
        {
          CnaResultTyp typ = cTypNbOfEvts;
          const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
          const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
          
          Bool_t ok_open = kFALSE;
          Bool_t ok_read = kFALSE;
          
          TString FileNameLong = fCnaWrite->GetRootFileName();
          Bool_t allowed_to_read = kFALSE;
          
          //      if ( fOpenRootFile )
          //        {
          //          cout << "!TEcnaRead::ReadNumberOfEventsForSamples(...) *** ERROR ***> "
          //               << " Reading on file already open." << fTTBELL << endl;
          //        }

          if( FileNameLong == fCurrentlyOpenFileName  )
            {
              allowed_to_read = kTRUE;
            }
          else
            {
              if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
              ok_open = OpenRootFile(file_name, "READ");  // set fOpenRootFile to kTRUE
              if(ok_open)
                {
                  allowed_to_read = kTRUE;
                }
              else
                {
                  cout << "!TEcnaRead::ReadNumberOfEventsForSamples(...) *** ERROR ***> Open .root file failed for file: "
                       << file_name << fTTBELL << endl;
                  allowed_to_read = kFALSE;
                  ok_read = kFALSE;
                }
            }
          
          if( allowed_to_read == kTRUE )
            {
              Int_t i_zero = 0;
              ok_read = gCnaRootFile->ReadElement(typ, i_zero);
              
              if ( ok_read == kTRUE )
                {
                  fDataExist = kTRUE;
                  for (Int_t i_crys=0; i_crys-MatDimX<0; i_crys++)
                    {                 
                      Int_t j_cna_chan = Stin_index*MatDimX + i_crys;
                      for ( Int_t i_samp=0; i_samp-MatDimY<0; i_samp++)
                        {
                          mat(i_crys, i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(j_cna_chan, i_samp);
                        }
                    }
                }
              else
                {
                  fDataExist = kFALSE;
                  cout << "!TEcnaRead::ReadNumberOfEventsForSamples(...) *** ERROR ***> "
                       << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
                       << "                                                                 -> quantity: <"
                       << GetTypeOfQuantity(typ) << "> not available in file."
                       << fTTBELL << endl;
                }
            }
          CloseRootFile(file_name);
        }  // end of if (fLookAtRootFile == 1)
      else
        {
          cout << "!TEcnaRead::ReadNumberOfEventsForSamples(...) *** ERROR ***> "
               << "It is not possible to access the number of found events: the ROOT file has not been read."
               << fTTBELL << endl;
        }
    }  // end of if (Stin_index >= 0)
  return mat;
}// ----------------- end of ReadNumberOfEventsForSamples(...)
TVectorD TEcnaRead::ReadPedestals ( const Int_t &  VecDim)

Definition at line 1826 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypPed, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxCrysEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by TEcnaHistos::GetHistoValues(), Read1DHisto(), TEcnaHistos::ViewHistime(), and TEcnaHistos::ViewStex().

{
//Read the expectation values of the expectation values of the samples
//for all the channels of a given Stin
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()

  TestArrayDimH1("ReadPedestals", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), VecDim);

  TVectorD vec(VecDim);
  for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  CnaResultTyp typ = cTypPed;    // pedestals type
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
  
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
//    if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadPedestals(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");
      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadPedestals(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++)
            {
              vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i_StexCrys);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadPedestals(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                              -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
}
TVectorD TEcnaRead::ReadRelevantCorrelationsBetweenSamples ( const Int_t &  n1StexStin,
const Int_t &  i0StinEcha,
const Int_t &  InPutMatDim 
)

Definition at line 3057 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypCorCss, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcalNumbering, fFileHeader, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatMat, TEcnaHeader::fNbOfSamples, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaNumbering::Get0StexEchaFrom1StexStinAnd0StinEcha(), TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH2().

{
//Read the (sample,sample) correlations for a given channel
//in ROOT file and return the relevant correlations in a TVectorD
//
//Possible values for InPutMatDim: (1) InPutMatDim = fFileHeader->fNbOfSamples
//
//  *===>  OutPut TVectorD dimension value = InPutMatDim*(InPutMatDim-1)/2

  TestArrayDimH2("ReadRelevantCorrelationsBetweenSamples", "fFileHeader->fNbOfSamples",
                 fFileHeader->fNbOfSamples, InPutMatDim);

  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
  Int_t nb_of_relevant = InPutMatDim*(InPutMatDim-1)/2;
  TVectorD vec_rel(nb_of_relevant); for(Int_t i=0; i<nb_of_relevant; i++){vec_rel(i)=(Double_t)0.;}
  CnaResultTyp typ = cTypCorCss;
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
    
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;

//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadRelevantCorrelationsBetweenSamples(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadRelevantCorrelationsBetweenSamples(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      ok_read = gCnaRootFile->ReadElement(typ, i0StexEcha);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          Int_t k_cor = 0;
          for ( Int_t i_samp = 0; i_samp < InPutMatDim; i_samp++){
            for ( Int_t j_samp = 0; j_samp < i_samp; j_samp++){
              vec_rel(k_cor) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp,j_samp);
              k_cor++;}}
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadRelevantCorrelationsBetweenSamples() *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                    -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec_rel;
}
Bool_t TEcnaRead::ReadRootFileHeader ( const Int_t &  i_print)

Definition at line 990 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, TEcnaHeader::fAdcEvtCalc, TEcnaHeader::fAvHfnCalc, TEcnaHeader::fAvLfnCalc, TEcnaHeader::fAvMeanCorssCalc, TEcnaHeader::fAvPedCalc, TEcnaHeader::fAvSigCorssCalc, TEcnaHeader::fAvTnoCalc, fCnaWrite, TEcnaHeader::fCorCssCalc, TEcnaHeader::fCovCssCalc, fCurrentlyOpenFileName, fFileHeader, fFlagNoFileOpen, TEcnaHeader::fHFccMoStinsCalc, TEcnaHeader::fHfCorCalc, TEcnaHeader::fHfCovCalc, cmsPerfSuiteHarvest::file_name, TEcnaHeader::fLFccMoStinsCalc, TEcnaHeader::fLfCorCalc, TEcnaHeader::fLfCovCalc, TEcnaHeader::fMeanCorssCalc, TEcnaHeader::fMSpCalc, TEcnaRootFile::fRootFile, TEcnaWrite::fRootFileNameShort, TEcnaHeader::fRunType, TEcnaHeader::fSigCorssCalc, TEcnaHeader::fSSpCalc, TEcnaHeader::fStartDate, TEcnaHeader::fStartTime, TEcnaHeader::fStinNumbersCalc, TEcnaHeader::fStopDate, TEcnaHeader::fStopTime, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), OpenRootFile(), and TEcnaHeader::Print().

Referenced by LookAtRootFile().

{
//Read the header of the Root file => test the file existence

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  if( i_print == 1 ){cout << "*TEcnaRead::ReadRootFileHeader> file_name = "
                         << fCnaWrite->fRootFileNameShort.Data() << endl;}

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
 
  TString FileNameLong = fCnaWrite->GetRootFileName(); 
  Bool_t allowed_to_read = kFALSE;

  //  if( fOpenRootFile )
  //    {
  //      cout << "!TEcnaRead::ReadRootFileHeader(...)*** ERROR ***> "
  //       << "Reading header on file already open." << endl;
  //    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");
      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadRootFileHeader(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      TEcnaHeader *headerFile;
      headerFile =(TEcnaHeader*)gCnaRootFile->fRootFile->Get("CnaHeader");

      //..... get the attributes which are not already set by the call to TEcnaHeader
      //      in FileParameters(...) and are only available in the ROOT file

      fFileHeader->fStartTime = headerFile->fStartTime;
      fFileHeader->fStopTime  = headerFile->fStopTime;
      fFileHeader->fStartDate = headerFile->fStartDate;
      fFileHeader->fStopDate  = headerFile->fStopDate;

      fFileHeader->fRunType   = headerFile->fRunType;

      //....... Les f..Calc dans le header: pour acces direct a la taille des differentes data du fichier
      fFileHeader->fStinNumbersCalc = headerFile->fStinNumbersCalc;
      fFileHeader->fAdcEvtCalc      = headerFile->fAdcEvtCalc;
      fFileHeader->fMSpCalc         = headerFile->fMSpCalc;
      fFileHeader->fSSpCalc         = headerFile->fSSpCalc;
      fFileHeader->fAvTnoCalc       = headerFile->fAvTnoCalc;
      fFileHeader->fAvLfnCalc       = headerFile->fAvLfnCalc;
      fFileHeader->fAvHfnCalc       = headerFile->fAvHfnCalc;

      fFileHeader->fCovCssCalc      = headerFile->fCovCssCalc;
      fFileHeader->fCorCssCalc      = headerFile->fCorCssCalc;
      fFileHeader->fHfCovCalc       = headerFile->fHfCovCalc;
      fFileHeader->fHfCorCalc       = headerFile->fHfCorCalc;
      fFileHeader->fLfCovCalc       = headerFile->fLfCovCalc;
      fFileHeader->fLfCorCalc       = headerFile->fLfCorCalc;
      fFileHeader->fLFccMoStinsCalc = headerFile->fLFccMoStinsCalc;
      fFileHeader->fHFccMoStinsCalc = headerFile->fHFccMoStinsCalc;
      fFileHeader->fMeanCorssCalc   = headerFile->fMeanCorssCalc;
      fFileHeader->fSigCorssCalc    = headerFile->fSigCorssCalc;

      fFileHeader->fAvPedCalc       = headerFile->fAvPedCalc;
      fFileHeader->fAvMeanCorssCalc = headerFile->fAvMeanCorssCalc;
      fFileHeader->fAvSigCorssCalc  = headerFile->fAvSigCorssCalc;
          
      if(i_print == 1){fFileHeader->Print();}
      ok_read = kTRUE;

      CloseRootFile(file_name);
    }
  return ok_read;
}
TVectorD TEcnaRead::ReadSampleAdcValues ( const Int_t &  n1StexStin,
const Int_t &  i0StinEcha,
const Int_t &  sample,
const Int_t &  VecDim 
)

Definition at line 1251 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypAdcEvt, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcalNumbering, fFileHeader, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaHeader::fReqNbOfEvts, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaNumbering::Get0StexEchaFrom1StexStinAnd0StinEcha(), TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by TEcnaHistos::GetHistoValues(), and Read1DHisto().

{
//Read the sample ADC values for each event for a given i0StexEcha and a given sample
//in the results ROOT file and return it in a TVectorD(requested nb of events)
//
//Possible values for VecDim: (1) VecDim = fFileHeader->fReqNbOfEvts

  TestArrayDimH1("ReadSampleAdcValues", "fFileHeader->fReqNbOfEvts", fFileHeader->fReqNbOfEvts, VecDim);

  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);

  TVectorD vec(VecDim);
  for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  CnaResultTyp typ = cTypAdcEvt;   //  sample as a function of time type

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;

  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
  //  if ( fOpenRootFile )
  //   {
  //     cout << "!TEcnaRead::ReadSampleAdcValues(...) *** ERROR ***> "
  //       << "Reading on file already open." << fTTBELL << endl;
  //   }
  
  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadSampleAdcValues(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }
  
  if( allowed_to_read == kTRUE )
    {
      ok_read = gCnaRootFile->ReadElement(typ, i0StexEcha);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_bin=0; i_bin<VecDim; i_bin++)
            {
              vec(i_bin) = gCnaRootFile->fCnaIndivResult->fMatHis(sample, i_bin);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadSampleAdcValues(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                 -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
}
Double_t *** TEcnaRead::ReadSampleAdcValuesSameFile ( const Int_t &  DimX,
const Int_t &  DimY,
const Int_t &  DimZ 
)

Definition at line 4181 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypAdcEvt, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCnew, fDataExist, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fT3d1_AdcValues, fT3d2_AdcValues, fT3d_AdcValues, fTTBELL, gCnaRootFile, GetTypeOfQuantity(), OpenRootFile(), TEcnaRootFile::ReadElement(), TEcnaRootFile::ReadElementNextEntryNumber(), and compare_using_db::sample.

Referenced by TEcnaRun::ReadSampleAdcValues().

{

//Possible values for DimX, DimY, DimZ : (1) DimX = fEcal->MaxCrysEcnaInStex()
//                                           DimY = fFileHeader->fNbOfSamples
//                                           DimZ = fFileHeader->fReqNbOfEvts

  if(fT3d_AdcValues == 0)
    {
      //............ Allocation for the 3d array 
      fT3d_AdcValues   = new Double_t**[DimX];                         fCnew++;  
      fT3d2_AdcValues  = new  Double_t*[DimX*DimY];                    fCnew++;  
      fT3d1_AdcValues  = new   Double_t[DimX*DimY*DimZ];               fCnew++;
      
      for(Int_t i0StexEcha = 0 ; i0StexEcha < DimX ; i0StexEcha++){
        fT3d_AdcValues[i0StexEcha] = &fT3d2_AdcValues[0] + i0StexEcha*DimY;
        for(Int_t j_samp = 0 ; j_samp < DimY ; j_samp++){
          fT3d2_AdcValues[DimY*i0StexEcha + j_samp] = &fT3d1_AdcValues[0]+
            DimZ*(DimY*i0StexEcha+j_samp);}}
    }
  
  //................................. Init to zero                 (ReadSampleAdcValuesSameFile)
  for (Int_t iza=0; iza<DimX; iza++)
    {
      for (Int_t izb=0; izb<DimY; izb++)
        {
          for (Int_t izc=0; izc<DimZ; izc++)
            {
              if( fT3d_AdcValues[iza][izb][izc] != (Double_t)0 )
                {
                  fT3d_AdcValues[iza][izb][izc] = (Double_t)0;
                }
            }
        }
    }     
  
  //-------------------------------------------------------------------------- (ReadSampleAdcValuesSameFile)
  CnaResultTyp typ = cTypAdcEvt;   //  sample as a function of time type

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;

  Int_t  i_entry      = 0;  
  Int_t  i_entry_fail = 0;  

  ok_open = OpenRootFile(file_name, "READ");
  
  if( ok_open == kTRUE )
    {
      for(Int_t i0StexEcha=0; i0StexEcha<DimX; i0StexEcha++)
        {
          if( i0StexEcha == 0 )
            {
              i_entry = gCnaRootFile->ReadElementNextEntryNumber(typ, i0StexEcha);
              if( i_entry >= 0 ){ok_read = kTRUE;}
            }
          if( i_entry >= 0 )                                                //  (ReadSampleAdcValuesSameFile)
            {
              if( i0StexEcha > 0 ){ok_read = gCnaRootFile->ReadElement(i_entry); i_entry++;}
              
              if ( ok_read == kTRUE )
                {
                  fDataExist = kTRUE;     
                  for(Int_t sample=0; sample<DimY; sample++)
                    {
                      for ( Int_t i_bin=0; i_bin<DimZ; i_bin++)
                        {
                          fT3d_AdcValues[i0StexEcha][sample][i_bin]
                            = gCnaRootFile->fCnaIndivResult->fMatHis(sample, i_bin);
                        }  
                    }
                } 
              else                                                        //  (ReadSampleAdcValuesSameFile)
                {
                  fDataExist = kFALSE;
                  cout << "!TEcnaRead::ReadSampleAdcValuesSameFile(...) *** ERROR ***> "
                       << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
                       << "                                                         -> quantity: <"
                       << GetTypeOfQuantity(typ) << "> not available in file."
                       << fTTBELL << endl;
                }
            }
          else
            {
              i_entry_fail++;
            }
        }
      CloseRootFile(file_name);
    }
  else
    {
      cout  << "*TEcnaRead::ReadSampleAdcValuesSameFile(...)> *ERROR* =====> "
            << " ROOT file not found" << fTTBELL << endl;
    }

  if(i_entry_fail > 0 )
    {
      cout  << "*TEcnaRead::ReadSampleAdcValuesSameFile(...)> *ERROR* =====> "
            << " Entry reading failure(s). i_entry_fail = "
            << i_entry_fail << fTTBELL << endl;
    }
  return fT3d_AdcValues;
}
TVectorD TEcnaRead::ReadSampleMeans ( const Int_t &  n1StexStin,
const Int_t &  i0StinEcha,
const Int_t &  VecDim 
)

Definition at line 1338 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypMSp, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcalNumbering, fFileHeader, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaHeader::fNbOfSamples, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaNumbering::Get0StexEchaFrom1StexStinAnd0StinEcha(), TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by TEcnaHistos::EvSamplesXtals(), TEcnaHistos::GetHistoValues(), Read1DHisto(), and TEcnaHistos::XtalSamplesEv().

{
//Read the expectation values of the samples
//for a given Stin and a given channel
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim : (1) VecDim = fFileHeader->fNbOfSamples

  TestArrayDimH1("ReadSampleMeans", "fFileHeader->fNbOfSamples", fFileHeader->fNbOfSamples, VecDim);

  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
  
  TVectorD vec(VecDim);
  for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  CnaResultTyp typ = cTypMSp;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;

  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
    
  // if ( fOpenRootFile )
  //  {
  //    cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> "
  //       << " Reading on file already open." << fTTBELL << endl;
  //  }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");
      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }
  
  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_samp = 0; i_samp < VecDim; i_samp++)
            {
              vec(i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(i0StexEcha, i_samp);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
}
TVectorD TEcnaRead::ReadSampleMeans ( const Int_t &  n1StexStin,
const Int_t &  VecDim 
)

Definition at line 1419 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypMSp, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fEcalNumbering, fFileHeader, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaHeader::fNbOfSamples, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaNumbering::Get0StexEchaFrom1StexStinAnd0StinEcha(), TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxCrysInStin(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

{
//Read the expectation values of the samples
//for all the channel of a given Stin 
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim : (1) VecDim = fFileHeader->fNbOfSamples*fEcal->MaxCrysInStin()

  TestArrayDimH1("ReadSampleMeans", "fFileHeader->fNbOfSamples*fEcal->MaxCrysInStin()",
                 fFileHeader->fNbOfSamples*fEcal->MaxCrysInStin() , VecDim);
  
  TVectorD vec(VecDim);
  for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  CnaResultTyp typ = cTypMSp;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;

  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
      
  //if ( fOpenRootFile )
  //  {
  //    cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> "
  //       << " Reading on file already open." << fTTBELL << endl;
  //  }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    } 
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }
  
  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;

          for( Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++ )
            {
              Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
              for ( Int_t i_samp=0; i_samp<fFileHeader->fNbOfSamples; i_samp++ )
                {
                  vec(i0StinEcha*fFileHeader->fNbOfSamples+i_samp) =
                    gCnaRootFile->fCnaIndivResult->fMatHis(i0StexEcha, i_samp);
                }
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
}
TVectorD TEcnaRead::ReadSampleSigmas ( const Int_t &  n1StexStin,
const Int_t &  VecDim 
)

Definition at line 1591 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypSSp, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fEcalNumbering, fFileHeader, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaHeader::fNbOfSamples, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaNumbering::Get0StexEchaFrom1StexStinAnd0StinEcha(), TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxCrysInStin(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

{
//Read the expectation values of the samples
//for all the channel of a given Stin
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim : (1) VecDim = fFileHeader->fNbOfSamples*fEcal->MaxCrysInStin()

  TestArrayDimH1("ReadSampleSigmas", "fFileHeader->fNbOfSamples*fEcal->MaxCrysInStin()", 
                 fFileHeader->fNbOfSamples*fEcal->MaxCrysInStin(), VecDim);
  
  TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  CnaResultTyp typ = cTypSSp;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;

  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
       
  //if ( fOpenRootFile )
  //  {
  //    cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> "
  //       << "Reading on file already open." << fTTBELL << endl;
  // }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }
  
  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;

          for( Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++ )
            {
              Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
              for ( Int_t i_samp = 0; i_samp < fFileHeader->fNbOfSamples; i_samp++)
                {
                  vec(i0StinEcha*fFileHeader->fNbOfSamples+i_samp) =
                    gCnaRootFile->fCnaIndivResult->fMatHis(i0StexEcha,i_samp);
                }
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                 -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
}
TVectorD TEcnaRead::ReadSampleSigmas ( const Int_t &  n1StexStin,
const Int_t &  i0StinEcha,
const Int_t &  VecDim 
)

Definition at line 1510 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypSSp, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcalNumbering, fFileHeader, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaHeader::fNbOfSamples, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaNumbering::Get0StexEchaFrom1StexStinAnd0StinEcha(), TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by TEcnaHistos::GetHistoValues(), Read1DHisto(), TEcnaHistos::SigmaSamplesXtals(), and TEcnaHistos::XtalSamplesSigma().

{
//Read the expectation values of the samples
//for a given Stin and a given channel
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim : (1) VecDim = fFileHeader->fNbOfSamples

  TestArrayDimH1("ReadSampleSigmas", "fFileHeader->fNbOfSamples", fFileHeader->fNbOfSamples, VecDim);

  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
  
  TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  CnaResultTyp typ = cTypSSp;

  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;

  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
     
  //if ( fOpenRootFile )
  //  {
  //    cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> "
  //       << "Reading on file already open." << fTTBELL << endl;
  //  }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }
  
  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_samp = 0; i_samp < VecDim; i_samp++)
            {
              vec(i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(i0StexEcha,i_samp);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                 -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
}
TVectorD TEcnaRead::ReadSigmaOfCorrelationsBetweenSamples ( const Int_t &  VecDim)

Definition at line 2230 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypSigCorss, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxCrysEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by TEcnaHistos::GetHistoValues(), Read1DHisto(), TEcnaHistos::ViewHistime(), and TEcnaHistos::ViewStex().

{
//Read the Expectation values of the (sample,sample) correlations
//for all the channels of a given Stin
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()

  TestArrayDimH1("ReadSigmaOfCorrelationsBetweenSamples", "fEcal->MaxCrysEcnaInStex()",
                 fEcal->MaxCrysEcnaInStex(), VecDim);

  TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
  CnaResultTyp typ = cTypSigCorss;  // sigma of corss type
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;
  
  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
//  if ( fOpenRootFile )
//    {
//      cout << "!TEcnaRead::ReadSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> "
//         << "Reading on file already open." << fTTBELL << endl;
//    }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");

      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++)
            {
              vec(i_StexCrys)  = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_StexCrys);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                                                      -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
}
TVectorD TEcnaRead::ReadStinNumbers ( const Int_t &  VecDim)

Definition at line 1132 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypNumbers, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCodePrintAllComments, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, fFlagPrint, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, fMemoStinNumbers, TEcnaWrite::fRootFileNameShort, fT1d_StexStinFromIndex, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxStinEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by TEcnaHistos::GetOkViewHisto(), GetStexStinFromIndex(), GetStinIndex(), LookAtRootFile(), ReadHighFrequencyCorrelationsBetweenChannels(), ReadHighFrequencyCovariancesBetweenChannels(), ReadHighFrequencyMeanCorrelationsBetweenStins(), ReadLowFrequencyCorrelationsBetweenChannels(), ReadLowFrequencyCovariancesBetweenChannels(), ReadLowFrequencyMeanCorrelationsBetweenStins(), TEcnaRun::ReadSampleAdcValues(), TEcnaHistos::StexHocoVecoLHFCorcc(), TEcnaHistos::ViewMatrix(), and TEcnaHistos::ViewStin().

{
//Get the Stin numbers and put them in a TVectorD
//Read the ROOT file at first call and load in a TVectorD attribute
//Get directly the TVectorD attribute at other times
//
// Possible values for VecDim:
//          (1) VecDim = fEcal->MaxStinEcnaInStex()

  TVectorD vec(VecDim);

  TestArrayDimH1("ReadStinNumbers", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);

  for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}

  if (fMemoStinNumbers == 0)
    {
      CnaResultTyp typ = cTypNumbers;
      const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
      const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

      //.............. reading of the ROOT file data type TResultTyp = cTypStinsNumbers
      //               to get the conversion: Stin index -> Stin number (n1StexStin)

      Bool_t ok_open = kFALSE;
      Bool_t ok_read = kFALSE;

      TString FileNameLong = fCnaWrite->GetRootFileName();
      Bool_t allowed_to_read = kFALSE;

//      if ( fOpenRootFile )
//      {
//        cout << "!TEcnaRead::ReadStinNumbers(...) *** ERROR ***> Reading on file already open."
//             << fTTBELL << endl;
//      }

      if( FileNameLong == fCurrentlyOpenFileName )
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
          ok_open = OpenRootFile(file_name, "READ");
          
          if(ok_open)
            {
              allowed_to_read = kTRUE;
            }
          else
            {
              cout << "!TEcnaRead::ReadStinNumbers(...) *** ERROR ***> Open .root file failed for file: "
                   << file_name << fTTBELL << endl;
              allowed_to_read = kFALSE;
              ok_read = kFALSE;
            }
        }

      if( allowed_to_read == kTRUE )
        {
          Int_t i_zero = 0;
          ok_read = gCnaRootFile->ReadElement(typ, i_zero);
          
          if( ok_read == kTRUE )
            {
              fDataExist = kTRUE;
              //......... Get the Stin numbers and put them in TVectorD vec()
              for ( Int_t i_Stin = 0; i_Stin < VecDim; i_Stin++)
                {
                  vec(i_Stin) = gCnaRootFile->fCnaIndivResult->fMatHis(0,i_Stin);
                  fT1d_StexStinFromIndex[i_Stin] = (Int_t)vec(i_Stin);
                }
              fMemoStinNumbers++;
            }
          else
            {
              fDataExist = kFALSE;
              cout << "!TEcnaRead::ReadStinNumbers(...) *** ERROR ***> "
                   << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
                   << "                                                -> quantity: <"
                   << GetTypeOfQuantity(typ) << "> not available in file."
                   << fTTBELL << endl;
            }
          CloseRootFile(file_name);
        }
      
      if( ok_read == kTRUE )
        {
          //........................... Print the Stin numbers 
          if(fFlagPrint == fCodePrintAllComments)
            {
              for(Int_t i=0; i < VecDim; i++)
                {
                  cout << "*TEcnaRead::ReadStinNumbers(...)> StinNumber[" << i << "] = "
                       << vec[i] << endl;
                }
            }
        }
    }
  else
    {
      fDataExist = kTRUE;
      for ( Int_t i_Stin = 0; i_Stin < VecDim; i_Stin++)
        {vec(i_Stin) = fT1d_StexStinFromIndex[i_Stin];}
    }
  return vec;
} // ----------------- ( end of ReadStinNumbers(...) ) -----------------
TVectorD TEcnaRead::ReadTotalNoise ( const Int_t &  VecDim)

Definition at line 1908 of file TEcnaRead.cc.

References CloseRootFile(), gather_cfg::cout, cTypTno, TEcnaRootFile::fCnaIndivResult, fCnaWrite, fCurrentlyOpenFileName, fDataExist, fEcal, fFlagNoFileOpen, cmsPerfSuiteHarvest::file_name, TEcnaResultType::fMatHis, TEcnaWrite::fRootFileNameShort, fTTBELL, gCnaRootFile, TEcnaWrite::GetRootFileName(), GetTypeOfQuantity(), i, TEcnaParEcal::MaxCrysEcnaInStex(), OpenRootFile(), TEcnaRootFile::ReadElement(), and TestArrayDimH1().

Referenced by TEcnaHistos::GetHistoValues(), Read1DHisto(), TEcnaHistos::ViewHistime(), and TEcnaHistos::ViewStex().

{
//Read the expectation values of the sigmas of the samples
//for all the channels of a given Stin
//in the ROOT file and return them in a TVectorD
//
//Possible values for VecDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()

  TestArrayDimH1("ReadTotalNoise", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), VecDim);

  TVectorD vec(VecDim); for(Int_t i=0; i<VecDim; i++){vec(i)=(Double_t)0.;}
  CnaResultTyp typ = cTypTno;   // Total noise type
  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();

  Bool_t ok_open = kFALSE;
  Bool_t ok_read = kFALSE;

  TString FileNameLong = fCnaWrite->GetRootFileName();
  Bool_t allowed_to_read = kFALSE;
  
  //  if ( fOpenRootFile )
  //  {
  //    cout << "!TEcnaRead::ReadTotalNoise(...) *** ERROR ***> "
  //       << "Reading on file already open." << fTTBELL << endl;
  //  }

  if( FileNameLong == fCurrentlyOpenFileName )
    {
      allowed_to_read = kTRUE;
    }
  else
    {
      if( fCurrentlyOpenFileName != fFlagNoFileOpen ){CloseRootFile(current_file_name);}
      ok_open = OpenRootFile(file_name, "READ");
      if(ok_open)
        {
          allowed_to_read = kTRUE;
        }
      else
        {
          cout << "!TEcnaRead::ReadTotalNoise(...) *** ERROR ***> Open .root file failed for file: "
               << file_name << fTTBELL << endl;
          allowed_to_read = kFALSE;
          ok_read = kFALSE;
        }
    }

  if( allowed_to_read == kTRUE )
    {
      Int_t i_zero = 0;
      ok_read = gCnaRootFile->ReadElement(typ, i_zero);
      
      if ( ok_read == kTRUE )
        {
          fDataExist = kTRUE;
          for ( Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++)
            {
              vec(i_StexCrys)  = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero,i_StexCrys);
            }   
        }
      else
        {
          fDataExist = kFALSE;
          cout << "!TEcnaRead::ReadTotalNoise(...) *** ERROR ***> "
               << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << endl
               << "                                               -> quantity: <"
               << GetTypeOfQuantity(typ) << "> not available in file."
               << fTTBELL << endl;
        }
      CloseRootFile(file_name);
    }
  return vec;
}
void TEcnaRead::SetEcalSubDetector ( const TString  SubDet)

Definition at line 171 of file TEcnaRead.cc.

References fEcal, fFlagSubDet, fgMaxCar, fStexName, fStinName, and TEcnaParEcal::GetEcalSubDetector().

Referenced by TEcnaRead().

{
 // Set Subdetector (EB or EE)

  Int_t MaxCar = fgMaxCar;
  fFlagSubDet.Resize(MaxCar);
  fFlagSubDet = fEcal->GetEcalSubDetector();

  if( fFlagSubDet == "EB" ){fStexName = "SM";  fStinName = "tower";}
  if( fFlagSubDet == "EE" ){fStexName = "Dee"; fStinName = "SC";}
}
void TEcnaRead::TestArrayDimH1 ( const TString  CallingMethod,
const TString  MaxName,
const Int_t &  MaxValue,
const Int_t &  VecDim 
)

Definition at line 1079 of file TEcnaRead.cc.

References gather_cfg::cout, and fTTBELL.

Referenced by ReadAverageHighFrequencyNoise(), ReadAverageLowFrequencyNoise(), ReadAverageMeanCorrelationsBetweenSamples(), ReadAverageNumberOfEvents(), ReadAveragePedestals(), ReadAverageSigmaOfCorrelationsBetweenSamples(), ReadAverageTotalNoise(), ReadHighFrequencyNoise(), ReadLowFrequencyNoise(), ReadMeanCorrelationsBetweenSamples(), ReadNumberOfEvents(), ReadPedestals(), ReadSampleAdcValues(), ReadSampleMeans(), ReadSampleSigmas(), ReadSigmaOfCorrelationsBetweenSamples(), ReadStinNumbers(), and ReadTotalNoise().

{
// array dim test

  if( MaxValue != VecDim)
    {
      cout << "!TEcnaRead::TestArrayDimH1(...)> No matching for array dimension: CallingMethod: " << CallingMethod.Data()
           << ", MaxName: " << MaxName.Data()
           << ", Maxvalue = " << MaxValue
           << ", VecDim = " << VecDim << fTTBELL << endl;
    }
#define NOPM
#ifndef NOPM
  else
    {
      cout << "!TEcnaRead::TestArrayDimH1(...)> matching array dimension: OK. CallingMethod: " << CallingMethod.Data()
           << ", MaxName: " << MaxName.Data()
           << ", Maxvalue = " << MaxValue
           << ", VecDim = " << VecDim << endl;
    }
#endif // NOPM
}
void TEcnaRead::TestArrayDimH2 ( const TString  CallingMethod,
const TString  MaxName,
const Int_t &  MaxValue,
const Int_t &  MatDim 
)

Definition at line 1103 of file TEcnaRead.cc.

References gather_cfg::cout, and fTTBELL.

Referenced by ReadCorrelationsBetweenSamples(), ReadCovariancesBetweenSamples(), ReadHighFrequencyCorrelationsBetweenChannels(), ReadHighFrequencyCovariancesBetweenChannels(), ReadHighFrequencyMeanCorrelationsBetweenStins(), ReadLowFrequencyCorrelationsBetweenChannels(), ReadLowFrequencyCovariancesBetweenChannels(), ReadLowFrequencyMeanCorrelationsBetweenStins(), and ReadRelevantCorrelationsBetweenSamples().

{
// array dim test

  if( MaxValue != MatDim)
    {
      cout << "!TEcnaRead::TestArrayDimH2(...)> No matching for array dimension: CallingMethod: " << CallingMethod.Data()
           << ", MaxName: " << MaxName.Data()
           << ", Maxvalue = " << MaxValue
           << ", MatDim = " << MatDim << fTTBELL << endl;
    }
#define NOPN
#ifndef NOPN
  else
    {
      cout << "!TEcnaRead::TestArrayDimH2(...)> matching array dimension: OK. CallingMethod: " << CallingMethod.Data()
           << ", MaxName: " << MaxName.Data()
           << ", Maxvalue = " << MaxValue
           << ", MatDim = " << MatDim << endl;
    }
#endif // NOPN
}

Member Data Documentation

Int_t TEcnaRead::fCdelete [private]

Definition at line 363 of file TEcnaRead.h.

Referenced by Adelete(), fCopy(), GetNumberOfEvents(), Init(), and ~TEcnaRead().

Definition at line 369 of file TEcnaRead.h.

Referenced by Init(), and TEcnaRead().

Definition at line 375 of file TEcnaRead.h.

Referenced by Read1DHisto(), ReadMatrix(), and TEcnaRead().

Definition at line 370 of file TEcnaRead.h.

Referenced by TEcnaRead().

Int_t TEcnaRead::fCnew [private]

Definition at line 402 of file TEcnaRead.h.

Referenced by fCopy(), FileParameters(), Init(), PrintComments(), and ~TEcnaRead().

Definition at line 402 of file TEcnaRead.h.

Referenced by fCopy(), Init(), and PrintNoComment().

Definition at line 402 of file TEcnaRead.h.

Referenced by fCopy(), Init(), and PrintWarnings().

Bool_t TEcnaRead::fDataExist [private]
TString TEcnaRead::fFlagNoFileOpen [private]
Int_t TEcnaRead::fFlagPrint [private]
TString TEcnaRead::fFlagSubDet [private]

Definition at line 380 of file TEcnaRead.h.

Referenced by GetTypeOfQuantity(), and SetEcalSubDetector().

Int_t TEcnaRead::fgMaxCar [private]

Definition at line 360 of file TEcnaRead.h.

Referenced by Init(), and SetEcalSubDetector().

Int_t TEcnaRead::fLookAtRootFile [private]

Definition at line 388 of file TEcnaRead.h.

Referenced by Init(), LookAtRootFile(), and ReadNumberOfEventsForSamples().

Int_t TEcnaRead::fMemoStinNumbers [private]

Definition at line 392 of file TEcnaRead.h.

Referenced by FileParameters(), Init(), and ReadStinNumbers().

Int_t TEcnaRead::fNbChanByLine [private]

Definition at line 398 of file TEcnaRead.h.

Int_t TEcnaRead::fNbSampByLine [private]

Definition at line 399 of file TEcnaRead.h.

Definition at line 367 of file TEcnaRead.h.

Referenced by FileParameters(), OpenRootFile(), and TEcnaRead().

Bool_t TEcnaRead::fOpenRootFile [private]

Definition at line 383 of file TEcnaRead.h.

Referenced by CloseRootFile(), fCopy(), Init(), and OpenRootFile().

TString TEcnaRead::fPathRoot [private]

Definition at line 396 of file TEcnaRead.h.

Referenced by fCopy(), FileParameters(), Init(), OpenRootFile(), and Read1DHisto().

Definition at line 387 of file TEcnaRead.h.

Referenced by CloseRootFile(), FileParameters(), Init(), and LookAtRootFile().

TString TEcnaRead::fStexName [private]

Definition at line 381 of file TEcnaRead.h.

Referenced by ReadAverageNumberOfEvents(), and SetEcalSubDetector().

TString TEcnaRead::fStinName [private]

Definition at line 381 of file TEcnaRead.h.

Referenced by SetEcalSubDetector().

Definition at line 390 of file TEcnaRead.h.

Referenced by Init(), LookAtRootFile(), ReadStinNumbers(), and ~TEcnaRead().

Double_t* TEcnaRead::fT3d1_AdcValues [private]

Definition at line 411 of file TEcnaRead.h.

Referenced by Init(), ReadSampleAdcValuesSameFile(), and ~TEcnaRead().

Double_t** TEcnaRead::fT3d2_AdcValues [private]

Definition at line 410 of file TEcnaRead.h.

Referenced by Init(), ReadSampleAdcValuesSameFile(), and ~TEcnaRead().

Double_t*** TEcnaRead::fT3d_AdcValues [private]

Definition at line 409 of file TEcnaRead.h.

Referenced by Init(), ReadSampleAdcValuesSameFile(), and ~TEcnaRead().

Int_t* TEcnaRead::fTagStinNumbers [private]

Definition at line 391 of file TEcnaRead.h.

Referenced by fCopy(), Init(), LookAtRootFile(), and ~TEcnaRead().

TString TEcnaRead::fTTBELL [private]