CMS 3D CMS Logo

TCnaRootFile Class Reference

#include <CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TCnaRootFile.h>

List of all members.

Public Member Functions

void CloseFile ()
Bool_t OpenR (Text_t *="")
Bool_t OpenW (Text_t *="")
Bool_t ReadElement (CnaResultTyp, Int_t)
Bool_t ReadElement (Int_t)
 TCnaRootFile (const Text_t *, TString)
 TCnaRootFile (const Text_t *)
 TCnaRootFile ()
 ~TCnaRootFile ()

Public Attributes

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

Protected Member Functions

void Init ()


Detailed Description

Definition at line 10 of file TCnaRootFile.h.


Constructor & Destructor Documentation

TCnaRootFile::TCnaRootFile (  )  [inline]

Definition at line 31 of file TCnaRootFile.h.

References Init().

00031 { Init();             }

TCnaRootFile::TCnaRootFile ( const Text_t *   ) 

TCnaRootFile::TCnaRootFile ( const Text_t *  name,
TString  status 
)

Definition at line 22 of file TCnaRootFile.cc.

References fRootFileName, fRootFileStatus, and Init().

00022                                                              {
00023 //constructor
00024   Init();
00025   fRootFileName   = name;
00026   fRootFileStatus = status;
00027 }

TCnaRootFile::~TCnaRootFile (  ) 

Definition at line 29 of file TCnaRootFile.cc.

00029                             {
00030 //destructor
00031 }


Member Function Documentation

void TCnaRootFile::CloseFile (  ) 

Definition at line 45 of file TCnaRootFile.cc.

References fCnaResultsBranch, fCnaResultsTree, fCounterBytesCnaResults, and fRootFile.

Referenced by TCnaRunEB::CloseRootFile(), and TCnaReadEB::CloseRootFile().

00045                              {
00046 //Close the CNA root file for reading
00047   fRootFile->Close();
00048   delete fRootFile;
00049   fRootFile               = 0;
00050   fCounterBytesCnaResults = 0;
00051   fCnaResultsTree         = 0;
00052   fCnaResultsBranch       = 0;
00053 }

void TCnaRootFile::Init ( void   )  [protected]

Definition at line 33 of file TCnaRootFile.cc.

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

Referenced by TCnaRootFile().

00033                         {
00034 //Set default values in all variables
00035   fRootFileName           = "";
00036   fRootFileStatus         = "";
00037   fRootFile               = 0;
00038   fCounterBytesCnaResults = 0;
00039   fNbEntries              = 0;
00040   fCnaResultsTree         = 0;
00041   fCnaResultsBranch       = 0;
00042   fCnaIndivResult         = 0;
00043 }

Bool_t TCnaRootFile::OpenR ( Text_t *  name = ""  ) 

Definition at line 55 of file TCnaRootFile.cc.

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

Referenced by TCnaRunEB::OpenRootFile(), and TCnaReadEB::OpenRootFile().

00055                                        {
00056 //Open the CNA root file for reading
00057   Bool_t ok;
00058   if (name != "") fRootFileName = name;
00059   fRootFile = new TFile(fRootFileName.Data(),"READ");
00060   ok = fRootFile->IsOpen();
00061   if (ok) {
00062     fCnaResultsTree = (TTree *)fRootFile->Get("CNAResults");
00063     //cout << "*TCnaRootFile::OpenR(..)> fCnaResultsTree : " << fCnaResultsTree << endl;
00064     if (fCnaResultsTree) {
00065       fCnaIndivResult = new TCnaResultType();
00066       //cout << "*TCnaRootFile::OpenR(..)> fCnaIndivResult : " << fCnaIndivResult << endl;
00067       fCnaResultsBranch = fCnaResultsTree->GetBranch("Results");
00068       fCnaResultsBranch->SetAddress(&fCnaIndivResult);
00069       fNbEntries = (Int_t) fCnaResultsTree->GetEntries();
00070       //cout << "*TCnaRootFile::OpenR(..)> fNbEntries : " << fNbEntries << endl;
00071     }
00072     else ok = kFALSE;
00073   }
00074   return ok;
00075 }

Bool_t TCnaRootFile::OpenW ( Text_t *  name = ""  ) 

Definition at line 77 of file TCnaRootFile.cc.

References fCnaIndivResult, fCnaResultsBranch, fCnaResultsTree, fRootFile, and fRootFileName.

Referenced by TCnaRunEB::OpenRootFile(), and TCnaReadEB::OpenRootFile().

00077                                        {
00078 //Open root file for writing
00079   Bool_t ok = kTRUE;
00080   if (name != "") fRootFileName = name;
00081 
00082   //cout << "*TCnaRootFile::OpenW(...)> fRootFileName.Data() = "
00083   //     << fRootFileName.Data() << endl;
00084 
00085   fRootFile = new TFile(fRootFileName.Data(),"RECREATE");
00086   if (fRootFile) {
00087     fCnaResultsTree = new TTree("CNAResults","CNAResults");
00088     fCnaIndivResult = new TCnaResultType();
00089     fCnaResultsBranch = fCnaResultsTree->
00090       Branch("Results","TCnaResultType", &fCnaIndivResult, 64000, 0);
00091   }
00092   else ok = kFALSE;
00093   return ok;
00094 }

Bool_t TCnaRootFile::ReadElement ( CnaResultTyp  typ,
Int_t  k 
)

Definition at line 103 of file TCnaRootFile.cc.

References fCnaIndivResult, fCnaResultsTree, fCounterBytesCnaResults, TCnaResultType::fIthElement, fNbEntries, TCnaResultType::fTypOfCnaResult, and i.

00103                                                           {
00104 //Look for kth element of type typ
00105   Bool_t ok = kFALSE;
00106   Int_t i = 0;
00107   do {
00108     // cout << "*TCnaRootFile::ReadElement(typ,k)> fIthElement     = "
00109     // << fCnaIndivResult->fIthElement << endl;
00110     // cout << "*TCnaRootFile::ReadElement(typ,k)> fTypOfCnaResult = "
00111     // << fCnaIndivResult->fTypOfCnaResult << endl;
00112 
00113     fCounterBytesCnaResults += fCnaResultsTree->GetEntry(i);
00114     ok = ( ( fCnaIndivResult->fIthElement == k ) &&
00115            ( fCnaIndivResult->fTypOfCnaResult == typ ));
00116     i++;
00117   } while ((i<fNbEntries) && (!ok));
00118   return ok;
00119 }

Bool_t TCnaRootFile::ReadElement ( Int_t  i  ) 

Definition at line 96 of file TCnaRootFile.cc.

References fCnaResultsTree, and fCounterBytesCnaResults.

Referenced by TCnaReadEB::ReadCorrectionFactorsToCorss(), TCnaReadEB::ReadCorrectionFactorsToCovss(), TCnaReadEB::ReadCorrectionsToSamplesFromCovss(), TCnaReadEB::ReadCorrelationsBetweenCrystalsMeanOverSamples(), TCnaReadEB::ReadCorrelationsBetweenSamples(), TCnaReadEB::ReadCorrelationsBetweenTowersMeanOverSamplesAndChannels(), TCnaReadEB::ReadCovariancesBetweenCrystalsMeanOverSamples(), TCnaReadEB::ReadCovariancesBetweenSamples(), TCnaReadEB::ReadCovariancesBetweenTowersMeanOverSamplesAndChannels(), TCnaReadEB::ReadEventDistribution(), TCnaReadEB::ReadEventDistributionXmax(), TCnaReadEB::ReadEventDistributionXmin(), TCnaReadEB::ReadExpectationValuesOfCorrelationsBetweenSamples(), TCnaReadEB::ReadExpectationValuesOfExpectationValuesOfSamples(), TCnaReadEB::ReadExpectationValuesOfSamples(), TCnaReadEB::ReadExpectationValuesOfSigmasOfSamples(), TCnaReadEB::ReadNumbersOfFoundEventsForSamples(), TCnaReadEB::ReadRelevantCorrelationsBetweenSamples(), TCnaReadEB::ReadSampleAsFunctionOfTime(), TCnaReadEB::ReadSigmasOfCorrelationsBetweenSamples(), TCnaReadEB::ReadSigmasOfExpectationValuesOfSamples(), TCnaReadEB::ReadSigmasOfSamples(), TCnaReadEB::ReadSigmasOfSigmasOfSamples(), TCnaReadEB::ReadTowerNumbers(), and TCnaReadEB::ReadVariancesOfSamples().

00096                                         {
00097 //Read element i
00098   Bool_t ok = kTRUE;
00099   fCounterBytesCnaResults += fCnaResultsTree->GetEntry(i);
00100   return ok;
00101 }


Member Data Documentation

TCnaResultType* TCnaRootFile::fCnaIndivResult

Definition at line 28 of file TCnaRootFile.h.

Referenced by Init(), OpenR(), OpenW(), TCnaReadEB::ReadCorrectionFactorsToCorss(), TCnaReadEB::ReadCorrectionFactorsToCovss(), TCnaReadEB::ReadCorrectionsToSamplesFromCovss(), TCnaReadEB::ReadCorrelationsBetweenCrystalsMeanOverSamples(), TCnaReadEB::ReadCorrelationsBetweenSamples(), TCnaReadEB::ReadCorrelationsBetweenTowersMeanOverSamplesAndChannels(), TCnaReadEB::ReadCovariancesBetweenCrystalsMeanOverSamples(), TCnaReadEB::ReadCovariancesBetweenSamples(), TCnaReadEB::ReadCovariancesBetweenTowersMeanOverSamplesAndChannels(), ReadElement(), TCnaReadEB::ReadEventDistribution(), TCnaReadEB::ReadEventDistributionXmax(), TCnaReadEB::ReadEventDistributionXmin(), TCnaReadEB::ReadExpectationValuesOfCorrelationsBetweenSamples(), TCnaReadEB::ReadExpectationValuesOfExpectationValuesOfSamples(), TCnaReadEB::ReadExpectationValuesOfSamples(), TCnaReadEB::ReadExpectationValuesOfSigmasOfSamples(), TCnaReadEB::ReadNumbersOfFoundEventsForSamples(), TCnaReadEB::ReadRelevantCorrelationsBetweenSamples(), TCnaReadEB::ReadSampleAsFunctionOfTime(), TCnaReadEB::ReadSigmasOfCorrelationsBetweenSamples(), TCnaReadEB::ReadSigmasOfExpectationValuesOfSamples(), TCnaReadEB::ReadSigmasOfSamples(), TCnaReadEB::ReadSigmasOfSigmasOfSamples(), TCnaReadEB::ReadTowerNumbers(), TCnaReadEB::ReadVariancesOfSamples(), TCnaRunEB::TRootCorCorrecCovCss(), TCnaRunEB::TRootCorCss(), TCnaRunEB::TRootCorMosccMot(), TCnaRunEB::TRootCorSccMos(), TCnaRunEB::TRootCovCorrecCovCss(), TCnaRunEB::TRootCovCss(), TCnaRunEB::TRootCovMosccMot(), TCnaRunEB::TRootCovSccMos(), TCnaRunEB::TRootEv(), TCnaRunEB::TRootEvCorCss(), TCnaRunEB::TRootEvEv(), TCnaRunEB::TRootEvSig(), TCnaRunEB::TRootEvts(), TCnaRunEB::TRootEvtsXmax(), TCnaRunEB::TRootEvtsXmin(), TCnaRunEB::TRootLastEvtNumber(), TCnaRunEB::TRootSampTime(), TCnaRunEB::TRootSigCorCss(), TCnaRunEB::TRootSigEv(), TCnaRunEB::TRootSigSig(), TCnaRunEB::TRootSvCorrecCovCss(), TCnaRunEB::TRootTowerNumbers(), TCnaRunEB::TRootVar(), and TCnaRunEB::WriteRootFile().

TBranch* TCnaRootFile::fCnaResultsBranch

Definition at line 27 of file TCnaRootFile.h.

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

TTree* TCnaRootFile::fCnaResultsTree

Definition at line 23 of file TCnaRootFile.h.

Referenced by CloseFile(), Init(), OpenR(), OpenW(), ReadElement(), and TCnaRunEB::WriteRootFile().

Int_t TCnaRootFile::fCounterBytesCnaResults

Definition at line 21 of file TCnaRootFile.h.

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

Int_t TCnaRootFile::fNbEntries

Definition at line 22 of file TCnaRootFile.h.

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

TFile* TCnaRootFile::fRootFile

Definition at line 20 of file TCnaRootFile.h.

Referenced by CloseFile(), Init(), OpenR(), OpenW(), TCnaReadEB::ReadRootFileHeader(), and TCnaRunEB::WriteRootFile().

TString TCnaRootFile::fRootFileName

Definition at line 18 of file TCnaRootFile.h.

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

TString TCnaRootFile::fRootFileStatus

Definition at line 19 of file TCnaRootFile.h.

Referenced by Init(), TCnaRunEB::OpenRootFile(), TCnaReadEB::OpenRootFile(), and TCnaRootFile().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:33:11 2009 for CMSSW by  doxygen 1.5.4