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 (CnaResultTyp, Int_t)
 
Bool_t ReadElement (Int_t)
 
Int_t ReadElementNextEntryNumber (CnaResultTyp, Int_t)
 
void ReStart (const Text_t *)
 
void ReStart (const Text_t *, const TString &)
 
 TEcnaRootFile ()
 
 TEcnaRootFile (const Text_t *)
 
 TEcnaRootFile (const Text_t *, const TString &)
 
 TEcnaRootFile (TEcnaObject *, const Text_t *)
 
 TEcnaRootFile (TEcnaObject *, 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.

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

References Init().

◆ TEcnaRootFile() [2/5]

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

Definition at line 29 of file TEcnaRootFile.cc.

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 }

References fRootFileName, fRootFileStatus, Init(), Skims_PA_cff::name, TEcnaObject::RegisterPointer(), and mps_update::status.

◆ TEcnaRootFile() [3/5]

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

Definition at line 42 of file TEcnaRootFile.cc.

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 }

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

◆ TEcnaRootFile() [4/5]

TEcnaRootFile::TEcnaRootFile ( const Text_t *  name)

Definition at line 65 of file TEcnaRootFile.cc.

65  {
66  //constructor
67 
68  // std::cout << "[Info Management] CLASS: TEcnaRootFile. CREATE OBJECT: this = " << this << std::endl;
69 
70  Init();
72  fRootFileStatus = "READ";
73 }

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

◆ TEcnaRootFile() [5/5]

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

Definition at line 55 of file TEcnaRootFile.cc.

55  {
56  //constructor
57 
58  // std::cout << "[Info Management] CLASS: TEcnaRootFile. CREATE OBJECT: this = " << this << std::endl;
59 
60  Init();
63 }

References fRootFileName, fRootFileStatus, Init(), Skims_PA_cff::name, and mps_update::status.

◆ ~TEcnaRootFile()

TEcnaRootFile::~TEcnaRootFile ( )
override

Definition at line 75 of file TEcnaRootFile.cc.

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 }

References fCnaIndivResult.

Member Function Documentation

◆ CloseFile()

void TEcnaRootFile::CloseFile ( )

Definition at line 116 of file TEcnaRootFile.cc.

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 }

References fCnaResultsBranch, fCnaResultsTree, fCounterBytesCnaResults, and fRootFile.

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

◆ Init()

void TEcnaRootFile::Init ( void  )
protected

Definition at line 85 of file TEcnaRootFile.cc.

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 }

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

Referenced by ReStart(), and TEcnaRootFile().

◆ OpenR()

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

Definition at line 128 of file TEcnaRootFile.cc.

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 }

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

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

◆ OpenW()

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

Definition at line 156 of file TEcnaRootFile.cc.

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 }

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

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

◆ ReadElement() [1/2]

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

Definition at line 183 of file TEcnaRootFile.cc.

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 }

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

◆ ReadElement() [2/2]

Bool_t TEcnaRootFile::ReadElement ( Int_t  i)

Definition at line 176 of file TEcnaRootFile.cc.

176  {
177  //Read element i
178  Bool_t ok = kTRUE;
180  return ok;
181 }

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

◆ ReadElementNextEntryNumber()

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

Definition at line 195 of file TEcnaRootFile.cc.

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 }

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

Referenced by TEcnaRead::ReadSampleAdcValuesSameFile().

◆ ReStart() [1/2]

void TEcnaRootFile::ReStart ( const Text_t *  name)

Definition at line 100 of file TEcnaRootFile.cc.

100  {
101  // Set default values + fRootFileName + fRootFileStatus
102 
103  Init();
105  fRootFileStatus = "READ";
106 }

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

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

◆ ReStart() [2/2]

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

Definition at line 108 of file TEcnaRootFile.cc.

108  {
109  // Set default values + fRootFileName + fRootFileStatus
110 
111  Init();
114 }

References fRootFileName, fRootFileStatus, Init(), Skims_PA_cff::name, and mps_update::status.

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
TEcnaRootFile::fCounterBytesCnaResults
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:35
mps_fire.i
i
Definition: mps_fire.py:428
TEcnaRootFile::fCnaResultsBranch
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:41
TEcnaResultType::fTypOfCnaResult
CnaResultTyp fTypOfCnaResult
Definition: TEcnaResultType.h:56
mps_update.status
status
Definition: mps_update.py:69
TEcnaResultType
Definition: TEcnaResultType.h:53
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
TEcnaRootFile::fRootFileStatus
TString fRootFileStatus
Definition: TEcnaRootFile.h:31
TEcnaRootFile::fRootFileName
TString fRootFileName
Definition: TEcnaRootFile.h:30
TEcnaRootFile::Init
void Init()
Definition: TEcnaRootFile.cc:85
TEcnaRootFile::fNbEntries
Int_t fNbEntries
Definition: TEcnaRootFile.h:36
TEcnaObject::RegisterPointer
Bool_t RegisterPointer(const TString &, const Long_t &)
Definition: TEcnaObject.cc:100
dqmdumpme.k
k
Definition: dqmdumpme.py:60
TEcnaRootFile::fRootFile
TFile * fRootFile
Definition: TEcnaRootFile.h:33
TEcnaResultType::fIthElement
Int_t fIthElement
Definition: TEcnaResultType.h:57
TEcnaRootFile::fCnaIndivResult
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:42
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
TEcnaRootFile::fCnaResultsTree
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:37