CMS 3D CMS Logo

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

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() [1/5]

TEcnaRootFile::TEcnaRootFile ( )

Definition at line 21 of file TEcnaRootFile.cc.

References Init().

21  {
22  //constructor without arguments
23 
24  // std::cout << "[Info Management] CLASS: TEcnaRootFile. CREATE OBJECT: this = " << this << std::endl;
25 
26  Init();
27 }

◆ TEcnaRootFile() [2/5]

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 mps_update::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:100
TString fRootFileStatus
Definition: TEcnaRootFile.h:31
TString fRootFileName
Definition: TEcnaRootFile.h:30

◆ TEcnaRootFile() [3/5]

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:100
TString fRootFileStatus
Definition: TEcnaRootFile.h:31
TString fRootFileName
Definition: TEcnaRootFile.h:30

◆ TEcnaRootFile() [4/5]

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:31
TString fRootFileName
Definition: TEcnaRootFile.h:30

◆ TEcnaRootFile() [5/5]

TEcnaRootFile::TEcnaRootFile ( const Text_t *  name,
const TString &  status 
)

Definition at line 55 of file TEcnaRootFile.cc.

References fRootFileName, fRootFileStatus, Init(), mergeVDriftHistosByStation::name, and mps_update::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:31
TString fRootFileName
Definition: TEcnaRootFile.h:30

◆ ~TEcnaRootFile()

TEcnaRootFile::~TEcnaRootFile ( )
override

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 != nullptr) {
81  delete fCnaIndivResult;
82  }
83 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:42

Member Function Documentation

◆ CloseFile()

void TEcnaRootFile::CloseFile ( )

Definition at line 116 of file TEcnaRootFile.cc.

References fCnaResultsBranch, fCnaResultsTree, fCounterBytesCnaResults, and fRootFile.

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

116  {
117  //Close the CNA root file for reading
118  if (fRootFile != nullptr) {
119  fRootFile->Close();
120  delete fRootFile;
121  fRootFile = nullptr;
122  }
124  fCnaResultsTree = nullptr;
125  fCnaResultsBranch = nullptr;
126 }
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:41
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:35
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:37
TFile * fRootFile
Definition: TEcnaRootFile.h:33

◆ Init()

void TEcnaRootFile::Init ( void  )
protected

Definition at line 85 of file TEcnaRootFile.cc.

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

Referenced by ReStart(), and TEcnaRootFile().

85  {
86  //Set default values in all variables
87 
88  TString sEmpty = "";
89  fRootFileName = sEmpty.Data();
90  fRootFileStatus = sEmpty.Data();
91 
92  fRootFile = nullptr;
94  fNbEntries = 0;
95  fCnaResultsTree = nullptr;
96  fCnaResultsBranch = nullptr;
97  fCnaIndivResult = nullptr;
98 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:42
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:41
TString fRootFileStatus
Definition: TEcnaRootFile.h:31
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:35
TString fRootFileName
Definition: TEcnaRootFile.h:30
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:37
TFile * fRootFile
Definition: TEcnaRootFile.h:33

◆ OpenR()

Bool_t TEcnaRootFile::OpenR ( const Text_t *  name = "")

Definition at line 128 of file TEcnaRootFile.cc.

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

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

128  {
129  //Open the CNA root file for reading
130  Bool_t ok;
131  TString sEmpty = "";
132  if (name != sEmpty) {
134  }
135 
136  if (fRootFile == nullptr) {
137  fRootFile = new TFile(fRootFileName.Data(), "READ");
138  }
139 
140  ok = fRootFile->IsOpen();
141  if (ok) {
142  fCnaResultsTree = (TTree *)fRootFile->Get("CNAResults");
143  if (fCnaResultsTree) {
144  if (fCnaIndivResult == nullptr) {
146  }
147  fCnaResultsBranch = fCnaResultsTree->GetBranch("Results");
148  fCnaResultsBranch->SetAddress(&fCnaIndivResult);
149  fNbEntries = (Int_t)fCnaResultsTree->GetEntries();
150  } else
151  ok = kFALSE;
152  }
153  return ok;
154 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:42
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:41
TString fRootFileName
Definition: TEcnaRootFile.h:30
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:37
TFile * fRootFile
Definition: TEcnaRootFile.h:33

◆ OpenW()

Bool_t TEcnaRootFile::OpenW ( const Text_t *  name = "")

Definition at line 156 of file TEcnaRootFile.cc.

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

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

156  {
157  //Open root file for writing
158  Bool_t ok = kTRUE;
159  TString sEmpty = "";
160  if (name != sEmpty) {
162  }
163 
164  if (fRootFile == nullptr) {
165  fRootFile = new TFile(fRootFileName.Data(), "RECREATE");
166  }
167  if (fRootFile) {
168  fCnaResultsTree = new TTree("CNAResults", "CNAResults");
170  fCnaResultsBranch = fCnaResultsTree->Branch("Results", "TEcnaResultType", &fCnaIndivResult, 64000, 0);
171  } else
172  ok = kFALSE;
173  return ok;
174 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:42
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:41
TString fRootFileName
Definition: TEcnaRootFile.h:30
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:37
TFile * fRootFile
Definition: TEcnaRootFile.h:33

◆ ReadElement() [1/2]

Bool_t TEcnaRootFile::ReadElement ( Int_t  i)

Definition at line 176 of file TEcnaRootFile.cc.

References fCnaResultsTree, fCounterBytesCnaResults, mps_fire::i, 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().

176  {
177  //Read element i
178  Bool_t ok = kTRUE;
180  return ok;
181 }
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:35
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:37

◆ ReadElement() [2/2]

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

Definition at line 183 of file TEcnaRootFile.cc.

References fCnaIndivResult, fCnaResultsTree, fCounterBytesCnaResults, TEcnaResultType::fIthElement, fNbEntries, TEcnaResultType::fTypOfCnaResult, mps_fire::i, isotrackApplyRegressor::k, convertSQLiteXML::ok, and make_classfiles::typ.

183  {
184  //Look for kth element of type typ
185  Bool_t ok = kFALSE;
186  Int_t i = 0;
187  do {
190  i++;
191  } while ((i < fNbEntries) && (!ok));
192  return ok;
193 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:42
CnaResultTyp fTypOfCnaResult
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:35
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:37

◆ ReadElementNextEntryNumber()

Int_t TEcnaRootFile::ReadElementNextEntryNumber ( CnaResultTyp  typ,
Int_t  k 
)

Definition at line 195 of file TEcnaRootFile.cc.

References fCnaIndivResult, fCnaResultsTree, fCounterBytesCnaResults, TEcnaResultType::fIthElement, fNbEntries, TEcnaResultType::fTypOfCnaResult, mps_fire::i, isotrackApplyRegressor::k, convertSQLiteXML::ok, and make_classfiles::typ.

Referenced by TEcnaRead::ReadSampleAdcValuesSameFile().

195  {
196  //Look for kth element of type typ and return the next entry number
197  Bool_t ok = kFALSE;
198 
199  Int_t i = 0;
200  do {
203  i++;
204  } while ((i < fNbEntries) && (!ok));
205 
206  if (ok == kFALSE) {
207  i = -1;
208  }
209  return i;
210 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:42
CnaResultTyp fTypOfCnaResult
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:35
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:37

◆ ReStart() [1/2]

void TEcnaRootFile::ReStart ( const Text_t *  name)

Definition at line 100 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:31
TString fRootFileName
Definition: TEcnaRootFile.h:30

◆ ReStart() [2/2]

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 mps_update::status.

108  {
109  // Set default values + fRootFileName + fRootFileStatus
110 
111  Init();
114 }
TString fRootFileStatus
Definition: TEcnaRootFile.h:31
TString fRootFileName
Definition: TEcnaRootFile.h:30

Member Data Documentation

◆ fCnaIndivResult

TEcnaResultType* TEcnaRootFile::fCnaIndivResult

Definition at line 42 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().

◆ fCnaResultsBranch

TBranch* TEcnaRootFile::fCnaResultsBranch

Definition at line 41 of file TEcnaRootFile.h.

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

◆ fCnaResultsTree

TTree* TEcnaRootFile::fCnaResultsTree

◆ fCounterBytesCnaResults

Int_t TEcnaRootFile::fCounterBytesCnaResults

Definition at line 35 of file TEcnaRootFile.h.

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

◆ fNbEntries

Int_t TEcnaRootFile::fNbEntries

Definition at line 36 of file TEcnaRootFile.h.

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

◆ fRootFile

TFile* TEcnaRootFile::fRootFile

◆ fRootFileName

TString TEcnaRootFile::fRootFileName

Definition at line 30 of file TEcnaRootFile.h.

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

◆ fRootFileStatus

TString TEcnaRootFile::fRootFileStatus