CMS 3D CMS Logo

Public Member Functions | Public Attributes | Protected Member Functions

TEcnaRootFile Class Reference

#include <TEcnaRootFile.h>

List of all members.

Public Member Functions

void CloseFile ()
Bool_t OpenR (const Text_t *="")
Bool_t OpenW (const Text_t *="")
Bool_t ReadElement (Int_t)
Bool_t ReadElement (CnaResultTyp, Int_t)
Int_t ReadElementNextEntryNumber (CnaResultTyp, Int_t)
void ReStart (const Text_t *, TString)
void ReStart (const Text_t *)
 TEcnaRootFile (TEcnaObject *, const Text_t *)
 TEcnaRootFile (const Text_t *)
 TEcnaRootFile (TEcnaObject *, const Text_t *, TString)
 TEcnaRootFile ()
 TEcnaRootFile (const Text_t *, TString)
 ~TEcnaRootFile ()

Public Attributes

TEcnaResultTypefCnaIndivResult
TBranch * fCnaResultsBranch
TTree * fCnaResultsTree
Int_t fCounterBytesCnaResults
Int_t fNbEntries
TFile * fRootFile
TString fRootFileName
TString fRootFileStatus

Protected Member Functions

void Init ()

Detailed Description

----------------------------------------------------------- TEcnaRootFile.h Update: 30/09/2011 Authors: FX Gentit, B.Fabbro (bernard.fabbro@cea.fr) 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 -----------------------------------------------------------

Definition at line 25 of file TEcnaRootFile.h.


Constructor & Destructor Documentation

TEcnaRootFile::TEcnaRootFile ( )
TEcnaRootFile::TEcnaRootFile ( TEcnaObject pObjectManager,
const Text_t *  name,
TString  status 
)

Definition at line 29 of file TEcnaRootFile.cc.

References fRootFileName, fRootFileStatus, Init(), mergeVDriftHistosByStation::name, TEcnaObject::RegisterPointer(), and ntuplemaker::status.

                                                                                            {
//constructor

 // cout << "[Info Management] CLASS: TEcnaRootFile.      CREATE OBJECT: this = " << this << endl;

  Init();
  Long_t i_this = (Long_t)this;
  pObjectManager->RegisterPointer("TEcnaRootFile", i_this);

  fRootFileName   = name;
  fRootFileStatus = status;
}
TEcnaRootFile::TEcnaRootFile ( TEcnaObject pObjectManager,
const Text_t *  name 
)

Definition at line 42 of file TEcnaRootFile.cc.

References fRootFileName, fRootFileStatus, Init(), mergeVDriftHistosByStation::name, and TEcnaObject::RegisterPointer().

                                                                            {
//constructor

 // cout << "[Info Management] CLASS: TEcnaRootFile.      CREATE OBJECT: this = " << this << endl;

  Init();
  Long_t i_this = (Long_t)this;
  pObjectManager->RegisterPointer("TEcnaRootFile", i_this);

  fRootFileName = name;
  fRootFileStatus = "READ";
}
TEcnaRootFile::TEcnaRootFile ( const Text_t *  name)

Definition at line 65 of file TEcnaRootFile.cc.

References fRootFileName, fRootFileStatus, Init(), and mergeVDriftHistosByStation::name.

                                               {
//constructor

 // cout << "[Info Management] CLASS: TEcnaRootFile.      CREATE OBJECT: this = " << this << endl;

  Init();
  fRootFileName = name;
  fRootFileStatus = "READ";
}
TEcnaRootFile::TEcnaRootFile ( const Text_t *  name,
TString  status 
)

Definition at line 55 of file TEcnaRootFile.cc.

References fRootFileName, fRootFileStatus, Init(), mergeVDriftHistosByStation::name, and ntuplemaker::status.

                                                               {
//constructor

 // cout << "[Info Management] CLASS: TEcnaRootFile.      CREATE OBJECT: this = " << this << endl;

  Init();
  fRootFileName   = name;
  fRootFileStatus = status;
}
TEcnaRootFile::~TEcnaRootFile ( )

Definition at line 75 of file TEcnaRootFile.cc.

References fCnaIndivResult.

                              {
//destructor

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

  if( fCnaIndivResult != 0 ){delete fCnaIndivResult;}
}

Member Function Documentation

void TEcnaRootFile::CloseFile ( )

Definition at line 117 of file TEcnaRootFile.cc.

References fCnaResultsBranch, fCnaResultsTree, fCounterBytesCnaResults, and fRootFile.

Referenced by TEcnaRun::CloseRootFile(), and TEcnaRead::CloseRootFile().

                              {
//Close the CNA root file for reading
  if( fRootFile != 0 )
    {
      fRootFile->Close();
      delete fRootFile; fRootFile = 0;
    }
  fCounterBytesCnaResults = 0;
  fCnaResultsTree         = 0;
  fCnaResultsBranch       = 0;
}
void TEcnaRootFile::Init ( void  ) [protected]

Definition at line 83 of file TEcnaRootFile.cc.

References fCnaIndivResult, fCnaResultsBranch, fCnaResultsTree, fCounterBytesCnaResults, fNbEntries, fRootFile, fRootFileName, and fRootFileStatus.

Referenced by ReStart(), and TEcnaRootFile().

{
//Set default values in all variables

  TString sEmpty = "";
  fRootFileName   = sEmpty.Data();
  fRootFileStatus = sEmpty.Data();

  fRootFile               = 0;
  fCounterBytesCnaResults = 0;
  fNbEntries              = 0;
  fCnaResultsTree         = 0;
  fCnaResultsBranch       = 0;
  fCnaIndivResult         = 0;
}
Bool_t TEcnaRootFile::OpenR ( const Text_t *  name = "")

Definition at line 129 of file TEcnaRootFile.cc.

References fCnaIndivResult, fCnaResultsBranch, fCnaResultsTree, fNbEntries, fRootFile, fRootFileName, mergeVDriftHistosByStation::name, and convertSQLiteXML::ok.

Referenced by TEcnaRead::OpenRootFile(), and TEcnaRun::OpenRootFile().

                                              {
//Open the CNA root file for reading
  Bool_t ok;
  TString sEmpty = "";
  if( name != sEmpty ){fRootFileName = name;}

  if( fRootFile == 0 ){fRootFile = new TFile(fRootFileName.Data(),"READ");}

  ok = fRootFile->IsOpen();
  if (ok) {
    fCnaResultsTree = (TTree *)fRootFile->Get("CNAResults");
    if (fCnaResultsTree) {
      if( fCnaIndivResult == 0 ){fCnaIndivResult = new TEcnaResultType();}
      fCnaResultsBranch = fCnaResultsTree->GetBranch("Results");
      fCnaResultsBranch->SetAddress(&fCnaIndivResult);
      fNbEntries = (Int_t)fCnaResultsTree->GetEntries();
    }
    else ok = kFALSE;
  }
  return ok;
}
Bool_t TEcnaRootFile::OpenW ( const Text_t *  name = "")

Definition at line 151 of file TEcnaRootFile.cc.

References fCnaIndivResult, fCnaResultsBranch, fCnaResultsTree, fRootFile, fRootFileName, mergeVDriftHistosByStation::name, and convertSQLiteXML::ok.

Referenced by TEcnaRead::OpenRootFile(), and TEcnaRun::OpenRootFile().

                                              {
//Open root file for writing
  Bool_t ok = kTRUE;
  TString sEmpty = "";
  if( name != sEmpty ){fRootFileName = name;}

  if( fRootFile == 0 ){fRootFile = new TFile(fRootFileName.Data(),"RECREATE");}
  if (fRootFile) {
    fCnaResultsTree = new TTree("CNAResults","CNAResults");
    fCnaIndivResult = new TEcnaResultType();
    fCnaResultsBranch = fCnaResultsTree->
      Branch("Results","TEcnaResultType", &fCnaIndivResult, 64000, 0);
  }
  else ok = kFALSE;
  return ok;
}
Bool_t TEcnaRootFile::ReadElement ( CnaResultTyp  typ,
Int_t  k 
)

Definition at line 175 of file TEcnaRootFile.cc.

References fCnaIndivResult, fCnaResultsTree, fCounterBytesCnaResults, TEcnaResultType::fIthElement, fNbEntries, TEcnaResultType::fTypOfCnaResult, i, gen::k, and convertSQLiteXML::ok.

                                                           {
//Look for kth element of type typ
  Bool_t ok = kFALSE;
  Int_t i = 0;
  do {
    fCounterBytesCnaResults += fCnaResultsTree->GetEntry(i);
    ok = ( ( fCnaIndivResult->fIthElement == k ) &&
           ( fCnaIndivResult->fTypOfCnaResult == typ ));
    i++;
  } while ((i<fNbEntries) && (!ok));
  return ok;
}
Bool_t TEcnaRootFile::ReadElement ( Int_t  i)
Int_t TEcnaRootFile::ReadElementNextEntryNumber ( CnaResultTyp  typ,
Int_t  k 
)

Definition at line 188 of file TEcnaRootFile.cc.

References fCnaIndivResult, fCnaResultsTree, fCounterBytesCnaResults, TEcnaResultType::fIthElement, fNbEntries, TEcnaResultType::fTypOfCnaResult, i, gen::k, and convertSQLiteXML::ok.

Referenced by TEcnaRead::ReadSampleAdcValuesSameFile().

                                                                         {
//Look for kth element of type typ and return the next entry number
  Bool_t ok = kFALSE;

  Int_t i = 0;
  do {
    fCounterBytesCnaResults += fCnaResultsTree->GetEntry(i);
    ok = ( ( fCnaIndivResult->fIthElement == k ) &&
           ( fCnaIndivResult->fTypOfCnaResult == typ ));
    i++;
  } while ((i<fNbEntries) && (!ok));

  if( ok == kFALSE ){i = -1;}
  return i;
}
void TEcnaRootFile::ReStart ( const Text_t *  name,
TString  status 
)

Definition at line 108 of file TEcnaRootFile.cc.

References fRootFileName, fRootFileStatus, Init(), mergeVDriftHistosByStation::name, and ntuplemaker::status.

{
  // Set default values + fRootFileName + fRootFileStatus

  Init();
  fRootFileName   = name;
  fRootFileStatus = status;
}
void TEcnaRootFile::ReStart ( const Text_t *  name)

Definition at line 99 of file TEcnaRootFile.cc.

References fRootFileName, fRootFileStatus, Init(), and mergeVDriftHistosByStation::name.

Referenced by TEcnaRead::OpenRootFile(), and TEcnaRun::OpenRootFile().

{
  // Set default values + fRootFileName + fRootFileStatus

  Init();
  fRootFileName   = name;
  fRootFileStatus = "READ";
}

Member Data Documentation

Definition at line 45 of file TEcnaRootFile.h.

Referenced by Init(), OpenR(), OpenW(), TEcnaRead::ReadAverageHighFrequencyNoise(), TEcnaRead::ReadAverageLowFrequencyNoise(), TEcnaRead::ReadAverageMeanCorrelationsBetweenSamples(), TEcnaRead::ReadAveragePedestals(), TEcnaRead::ReadAverageSigmaOfCorrelationsBetweenSamples(), TEcnaRead::ReadAverageTotalNoise(), TEcnaRead::ReadCorrelationsBetweenSamples(), TEcnaRead::ReadCovariancesBetweenSamples(), ReadElement(), ReadElementNextEntryNumber(), TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(), TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(), TEcnaRead::ReadHighFrequencyMeanCorrelationsBetweenStins(), TEcnaRead::ReadHighFrequencyNoise(), TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(), TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(), TEcnaRead::ReadLowFrequencyMeanCorrelationsBetweenStins(), TEcnaRead::ReadLowFrequencyNoise(), TEcnaRead::ReadMeanCorrelationsBetweenSamples(), TEcnaRead::ReadNumberOfEventsForSamples(), TEcnaRead::ReadPedestals(), TEcnaRead::ReadRelevantCorrelationsBetweenSamples(), TEcnaRead::ReadSampleAdcValues(), TEcnaRead::ReadSampleAdcValuesSameFile(), TEcnaRead::ReadSampleMeans(), TEcnaRead::ReadSampleSigmas(), TEcnaRead::ReadSigmaOfCorrelationsBetweenSamples(), TEcnaRead::ReadStinNumbers(), TEcnaRead::ReadTotalNoise(), TEcnaRun::TRootAdcEvt(), TEcnaRun::TRootAvEvCorss(), TEcnaRun::TRootAvHfn(), TEcnaRun::TRootAvLfn(), TEcnaRun::TRootAvPed(), TEcnaRun::TRootAvSigCorss(), TEcnaRun::TRootAvTno(), TEcnaRun::TRootCorCss(), TEcnaRun::TRootCovCss(), TEcnaRun::TRootHFccMoStins(), TEcnaRun::TRootHfCor(), TEcnaRun::TRootHfCov(), TEcnaRun::TRootHfn(), TEcnaRun::TRootLFccMoStins(), TEcnaRun::TRootLfCor(), TEcnaRun::TRootLfCov(), TEcnaRun::TRootLfn(), TEcnaRun::TRootMeanCorss(), TEcnaRun::TRootMSp(), TEcnaRun::TRootNbOfEvts(), TEcnaRun::TRootPed(), TEcnaRun::TRootSigCorss(), TEcnaRun::TRootSSp(), TEcnaRun::TRootStinNumbers(), TEcnaRun::TRootTno(), TEcnaRun::WriteRootFile(), and ~TEcnaRootFile().

Definition at line 44 of file TEcnaRootFile.h.

Referenced by CloseFile(), Init(), OpenR(), and OpenW().

Definition at line 38 of file TEcnaRootFile.h.

Referenced by CloseFile(), Init(), ReadElement(), and ReadElementNextEntryNumber().

Definition at line 39 of file TEcnaRootFile.h.

Referenced by Init(), OpenR(), ReadElement(), and ReadElementNextEntryNumber().

Definition at line 33 of file TEcnaRootFile.h.

Referenced by Init(), OpenR(), OpenW(), ReStart(), and TEcnaRootFile().