CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Protected Member Functions
TEcnaRootFile Class Reference

#include <TEcnaRootFile.h>

Inheritance diagram for TEcnaRootFile:

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 *)
 
void ReStart (const Text_t *, const TString &)
 
 TEcnaRootFile ()
 
 TEcnaRootFile (TEcnaObject *, const Text_t *, const TString &)
 
 TEcnaRootFile (TEcnaObject *, const Text_t *)
 
 TEcnaRootFile (const Text_t *)
 
 TEcnaRootFile (const Text_t *, const 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: 05/10/2012 Authors: FX Gentit, B.Fabbro (berna.nosp@m.rd.f.nosp@m.abbro.nosp@m.@cea.nosp@m..fr) DSM/IRFU/SPP CEA-Saclay Copyright: Those valid for CEA sofware

ECNA web page: http://cms-fabbro.web.cern.ch/cms-fabbro/

cna_new/Correlated_Noise_Analysis/ECNA_main_page.htm

Definition at line 25 of file TEcnaRootFile.h.

Constructor & Destructor Documentation

TEcnaRootFile::TEcnaRootFile ( )

Definition at line 21 of file TEcnaRootFile.cc.

21  {
22 //constructor without arguments
23 
24  // std::cout << "[Info Management] CLASS: TEcnaRootFile. CREATE OBJECT: this = " << this << std::endl;
25 
26  Init();
27 }
TEcnaRootFile::TEcnaRootFile ( TEcnaObject pObjectManager,
const Text_t *  name,
const TString &  status 
)

Definition at line 29 of file TEcnaRootFile.cc.

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

29  {
30 //constructor
31 
32  // std::cout << "[Info Management] CLASS: TEcnaRootFile. CREATE OBJECT: this = " << this << std::endl;
33 
34  Init();
35  Long_t i_this = (Long_t)this;
36  pObjectManager->RegisterPointer("TEcnaRootFile", i_this);
37 
40 }
Bool_t RegisterPointer(const TString &, const Long_t &)
Definition: TEcnaObject.cc:105
TString fRootFileStatus
Definition: TEcnaRootFile.h:34
TString fRootFileName
Definition: TEcnaRootFile.h:33
tuple status
Definition: ntuplemaker.py:245
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().

42  {
43 //constructor
44 
45  // std::cout << "[Info Management] CLASS: TEcnaRootFile. CREATE OBJECT: this = " << this << std::endl;
46 
47  Init();
48  Long_t i_this = (Long_t)this;
49  pObjectManager->RegisterPointer("TEcnaRootFile", i_this);
50 
52  fRootFileStatus = "READ";
53 }
Bool_t RegisterPointer(const TString &, const Long_t &)
Definition: TEcnaObject.cc:105
TString fRootFileStatus
Definition: TEcnaRootFile.h:34
TString fRootFileName
Definition: TEcnaRootFile.h:33
TEcnaRootFile::TEcnaRootFile ( const Text_t *  name)

Definition at line 65 of file TEcnaRootFile.cc.

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

65  {
66 //constructor
67 
68  // std::cout << "[Info Management] CLASS: TEcnaRootFile. CREATE OBJECT: this = " << this << std::endl;
69 
70  Init();
72  fRootFileStatus = "READ";
73 }
TString fRootFileStatus
Definition: TEcnaRootFile.h:34
TString fRootFileName
Definition: TEcnaRootFile.h:33
TEcnaRootFile::TEcnaRootFile ( const Text_t *  name,
const TString &  status 
)

Definition at line 55 of file TEcnaRootFile.cc.

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

55  {
56 //constructor
57 
58  // std::cout << "[Info Management] CLASS: TEcnaRootFile. CREATE OBJECT: this = " << this << std::endl;
59 
60  Init();
63 }
TString fRootFileStatus
Definition: TEcnaRootFile.h:34
TString fRootFileName
Definition: TEcnaRootFile.h:33
tuple status
Definition: ntuplemaker.py:245
TEcnaRootFile::~TEcnaRootFile ( )

Definition at line 75 of file TEcnaRootFile.cc.

References fCnaIndivResult.

75  {
76 //destructor
77 
78  //std::cout << "[Info Management] CLASS: TEcnaRootFile. DESTROY OBJECT: this = " << this << std::endl;
79 
80  if( fCnaIndivResult != 0 ){delete fCnaIndivResult;}
81 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:45

Member Function Documentation

void TEcnaRootFile::CloseFile ( )

Definition at line 117 of file TEcnaRootFile.cc.

References fCnaResultsBranch, fCnaResultsTree, fCounterBytesCnaResults, and fRootFile.

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

117  {
118 //Close the CNA root file for reading
119  if( fRootFile != 0 )
120  {
121  fRootFile->Close();
122  delete fRootFile; fRootFile = 0;
123  }
125  fCnaResultsTree = 0;
126  fCnaResultsBranch = 0;
127 }
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:44
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:38
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:40
TFile * fRootFile
Definition: TEcnaRootFile.h:36
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().

84 {
85 //Set default values in all variables
86 
87  TString sEmpty = "";
88  fRootFileName = sEmpty.Data();
89  fRootFileStatus = sEmpty.Data();
90 
91  fRootFile = 0;
93  fNbEntries = 0;
94  fCnaResultsTree = 0;
96  fCnaIndivResult = 0;
97 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:45
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:44
TString fRootFileStatus
Definition: TEcnaRootFile.h:34
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:38
TString fRootFileName
Definition: TEcnaRootFile.h:33
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:40
TFile * fRootFile
Definition: TEcnaRootFile.h:36
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().

129  {
130 //Open the CNA root file for reading
131  Bool_t ok;
132  TString sEmpty = "";
133  if( name != sEmpty ){fRootFileName = name;}
134 
135  if( fRootFile == 0 ){fRootFile = new TFile(fRootFileName.Data(),"READ");}
136 
137  ok = fRootFile->IsOpen();
138  if (ok) {
139  fCnaResultsTree = (TTree *)fRootFile->Get("CNAResults");
140  if (fCnaResultsTree) {
141  if( fCnaIndivResult == 0 ){fCnaIndivResult = new TEcnaResultType();}
142  fCnaResultsBranch = fCnaResultsTree->GetBranch("Results");
143  fCnaResultsBranch->SetAddress(&fCnaIndivResult);
144  fNbEntries = (Int_t)fCnaResultsTree->GetEntries();
145  }
146  else ok = kFALSE;
147  }
148  return ok;
149 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:45
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:44
TString fRootFileName
Definition: TEcnaRootFile.h:33
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:40
TFile * fRootFile
Definition: TEcnaRootFile.h:36
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().

151  {
152 //Open root file for writing
153  Bool_t ok = kTRUE;
154  TString sEmpty = "";
155  if( name != sEmpty ){fRootFileName = name;}
156 
157  if( fRootFile == 0 ){fRootFile = new TFile(fRootFileName.Data(),"RECREATE");}
158  if (fRootFile) {
159  fCnaResultsTree = new TTree("CNAResults","CNAResults");
162  Branch("Results","TEcnaResultType", &fCnaIndivResult, 64000, 0);
163  }
164  else ok = kFALSE;
165  return ok;
166 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:45
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:44
TString fRootFileName
Definition: TEcnaRootFile.h:33
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:40
TFile * fRootFile
Definition: TEcnaRootFile.h:36
Bool_t TEcnaRootFile::ReadElement ( Int_t  i)

Definition at line 168 of file TEcnaRootFile.cc.

References fCnaResultsTree, fCounterBytesCnaResults, and convertSQLiteXML::ok.

Referenced by TEcnaRead::ReadAverageHighFrequencyNoise(), TEcnaRead::ReadAverageLowFrequencyNoise(), TEcnaRead::ReadAverageMeanCorrelationsBetweenSamples(), TEcnaRead::ReadAveragePedestals(), TEcnaRead::ReadAverageSigmaOfCorrelationsBetweenSamples(), TEcnaRead::ReadAverageTotalNoise(), TEcnaRead::ReadCorrelationsBetweenSamples(), TEcnaRead::ReadCovariancesBetweenSamples(), 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(), and TEcnaRead::ReadTotalNoise().

168  {
169 //Read element i
170  Bool_t ok = kTRUE;
172  return ok;
173 }
int i
Definition: DBlmapReader.cc:9
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:38
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:40
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, relval_steps::k, and convertSQLiteXML::ok.

175  {
176 //Look for kth element of type typ
177  Bool_t ok = kFALSE;
178  Int_t i = 0;
179  do {
181  ok = ( ( fCnaIndivResult->fIthElement == k ) &&
182  ( fCnaIndivResult->fTypOfCnaResult == typ ));
183  i++;
184  } while ((i<fNbEntries) && (!ok));
185  return ok;
186 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:45
int i
Definition: DBlmapReader.cc:9
CnaResultTyp fTypOfCnaResult
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:38
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:40
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, relval_steps::k, and convertSQLiteXML::ok.

Referenced by TEcnaRead::ReadSampleAdcValuesSameFile().

188  {
189 //Look for kth element of type typ and return the next entry number
190  Bool_t ok = kFALSE;
191 
192  Int_t i = 0;
193  do {
195  ok = ( ( fCnaIndivResult->fIthElement == k ) &&
196  ( fCnaIndivResult->fTypOfCnaResult == typ ));
197  i++;
198  } while ((i<fNbEntries) && (!ok));
199 
200  if( ok == kFALSE ){i = -1;}
201  return i;
202 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:45
int i
Definition: DBlmapReader.cc:9
CnaResultTyp fTypOfCnaResult
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:38
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:40
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().

100 {
101  // Set default values + fRootFileName + fRootFileStatus
102 
103  Init();
105  fRootFileStatus = "READ";
106 }
TString fRootFileStatus
Definition: TEcnaRootFile.h:34
TString fRootFileName
Definition: TEcnaRootFile.h:33
void TEcnaRootFile::ReStart ( const Text_t *  name,
const TString &  status 
)

Definition at line 108 of file TEcnaRootFile.cc.

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

109 {
110  // Set default values + fRootFileName + fRootFileStatus
111 
112  Init();
115 }
TString fRootFileStatus
Definition: TEcnaRootFile.h:34
TString fRootFileName
Definition: TEcnaRootFile.h:33
tuple status
Definition: ntuplemaker.py:245

Member Data Documentation

TEcnaResultType* TEcnaRootFile::fCnaIndivResult

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().

TBranch* TEcnaRootFile::fCnaResultsBranch

Definition at line 44 of file TEcnaRootFile.h.

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

TTree* TEcnaRootFile::fCnaResultsTree
Int_t TEcnaRootFile::fCounterBytesCnaResults

Definition at line 38 of file TEcnaRootFile.h.

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

Int_t TEcnaRootFile::fNbEntries

Definition at line 39 of file TEcnaRootFile.h.

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

TFile* TEcnaRootFile::fRootFile
TString TEcnaRootFile::fRootFileName

Definition at line 33 of file TEcnaRootFile.h.

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

TString TEcnaRootFile::fRootFileStatus