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)
 
 TEcnaRootFile ()
 
 TEcnaRootFile (const Text_t *)
 
 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

Definition at line 10 of file TEcnaRootFile.h.

Constructor & Destructor Documentation

TEcnaRootFile::TEcnaRootFile ( )

Definition at line 15 of file TEcnaRootFile.cc.

15  {
16 //constructor without arguments
17 
18  // cout << "[Info Management] CLASS: TEcnaRootFile. CREATE OBJECT: this = " << this << endl;
19 
20  Init();
21 }
TEcnaRootFile::TEcnaRootFile ( const Text_t *  name)

Definition at line 23 of file TEcnaRootFile.cc.

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

23  {
24 //constructor
25 
26  // cout << "[Info Management] CLASS: TEcnaRootFile. CREATE OBJECT: this = " << this << endl;
27 
28  Init();
30 }
TString fRootFileName
Definition: TEcnaRootFile.h:18
TEcnaRootFile::TEcnaRootFile ( const Text_t *  name,
TString  status 
)

Definition at line 32 of file TEcnaRootFile.cc.

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

32  {
33 //constructor
34 
35  // cout << "[Info Management] CLASS: TEcnaRootFile. CREATE OBJECT: this = " << this << endl;
36 
37  Init();
40 }
TString fRootFileStatus
Definition: TEcnaRootFile.h:19
TString fRootFileName
Definition: TEcnaRootFile.h:18
tuple status
Definition: ntuplemaker.py:245
TEcnaRootFile::~TEcnaRootFile ( )

Definition at line 42 of file TEcnaRootFile.cc.

References fCnaIndivResult.

42  {
43 //destructor
44 
45  //cout << "[Info Management] CLASS: TEcnaRootFile. DESTROY OBJECT: this = " << this << endl;
46 
47  if( fCnaIndivResult != 0 ){delete fCnaIndivResult;}
48 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:28

Member Function Documentation

void TEcnaRootFile::CloseFile ( )

Definition at line 63 of file TEcnaRootFile.cc.

References fCnaResultsBranch, fCnaResultsTree, fCounterBytesCnaResults, and fRootFile.

63  {
64 //Close the CNA root file for reading
65  fRootFile->Close();
66  delete fRootFile; fRootFile = 0;
68  fCnaResultsTree = 0;
70 }
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:27
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:21
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:23
TFile * fRootFile
Definition: TEcnaRootFile.h:20
void TEcnaRootFile::Init ( void  )
protected

Definition at line 50 of file TEcnaRootFile.cc.

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

Referenced by TEcnaRootFile().

51 {
52 //Set default values in all variables
53  fRootFileName = "";
54  fRootFileStatus = "";
55  fRootFile = 0;
57  fNbEntries = 0;
58  fCnaResultsTree = 0;
60  fCnaIndivResult = 0;
61 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:28
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:27
TString fRootFileStatus
Definition: TEcnaRootFile.h:19
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:21
TString fRootFileName
Definition: TEcnaRootFile.h:18
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:23
TFile * fRootFile
Definition: TEcnaRootFile.h:20
Bool_t TEcnaRootFile::OpenR ( const Text_t *  name = "")

Definition at line 72 of file TEcnaRootFile.cc.

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

72  {
73 //Open the CNA root file for reading
74  Bool_t ok;
75  TString sEmpty = "";
76  if( name != sEmpty ){fRootFileName = name;}
77 
78  if( fRootFile == 0 ){fRootFile = new TFile(fRootFileName.Data(),"READ");}
79 
80  ok = fRootFile->IsOpen();
81  if (ok) {
82  fCnaResultsTree = (TTree *)fRootFile->Get("CNAResults");
83  if (fCnaResultsTree) {
85  fCnaResultsBranch = fCnaResultsTree->GetBranch("Results");
86  fCnaResultsBranch->SetAddress(&fCnaIndivResult);
87  fNbEntries = (Int_t) fCnaResultsTree->GetEntries();
88  }
89  else ok = kFALSE;
90  }
91  return ok;
92 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:28
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:27
TString fRootFileName
Definition: TEcnaRootFile.h:18
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:23
TFile * fRootFile
Definition: TEcnaRootFile.h:20
Bool_t TEcnaRootFile::OpenW ( const Text_t *  name = "")

Definition at line 94 of file TEcnaRootFile.cc.

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

94  {
95 //Open root file for writing
96  Bool_t ok = kTRUE;
97  TString sEmpty = "";
98  if( name != sEmpty ){fRootFileName = name;}
99 
100  if( fRootFile == 0 ){fRootFile = new TFile(fRootFileName.Data(),"RECREATE");}
101  if (fRootFile) {
102  fCnaResultsTree = new TTree("CNAResults","CNAResults");
105  Branch("Results","TEcnaResultType", &fCnaIndivResult, 64000, 0);
106  }
107  else ok = kFALSE;
108  return ok;
109 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:28
TBranch * fCnaResultsBranch
Definition: TEcnaRootFile.h:27
TString fRootFileName
Definition: TEcnaRootFile.h:18
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:23
TFile * fRootFile
Definition: TEcnaRootFile.h:20
Bool_t TEcnaRootFile::ReadElement ( Int_t  i)

Definition at line 111 of file TEcnaRootFile.cc.

References fCnaResultsTree, fCounterBytesCnaResults, and convertSQLiteXML::ok.

111  {
112 //Read element i
113  Bool_t ok = kTRUE;
115  return ok;
116 }
int i
Definition: DBlmapReader.cc:9
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:21
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:23
Bool_t TEcnaRootFile::ReadElement ( CnaResultTyp  typ,
Int_t  k 
)

Definition at line 118 of file TEcnaRootFile.cc.

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

118  {
119 //Look for kth element of type typ
120  Bool_t ok = kFALSE;
121  Int_t i = 0;
122  do {
124  ok = ( ( fCnaIndivResult->fIthElement == k ) &&
125  ( fCnaIndivResult->fTypOfCnaResult == typ ));
126  i++;
127  } while ((i<fNbEntries) && (!ok));
128  return ok;
129 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:28
int i
Definition: DBlmapReader.cc:9
CnaResultTyp fTypOfCnaResult
int k[5][pyjets_maxn]
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:21
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:23
Int_t TEcnaRootFile::ReadElementNextEntryNumber ( CnaResultTyp  typ,
Int_t  k 
)

Definition at line 131 of file TEcnaRootFile.cc.

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

131  {
132 //Look for kth element of type typ and return the next entry number
133  Bool_t ok = kFALSE;
134 
135  Int_t i = 0;
136  do {
138  ok = ( ( fCnaIndivResult->fIthElement == k ) &&
139  ( fCnaIndivResult->fTypOfCnaResult == typ ));
140  i++;
141  } while ((i<fNbEntries) && (!ok));
142 
143  if( ok == kFALSE ){i = -1;}
144  return i;
145 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:28
int i
Definition: DBlmapReader.cc:9
CnaResultTyp fTypOfCnaResult
int k[5][pyjets_maxn]
Int_t fCounterBytesCnaResults
Definition: TEcnaRootFile.h:21
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:23

Member Data Documentation

TEcnaResultType* TEcnaRootFile::fCnaIndivResult
TBranch* TEcnaRootFile::fCnaResultsBranch

Definition at line 27 of file TEcnaRootFile.h.

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

TTree* TEcnaRootFile::fCnaResultsTree

Definition at line 23 of file TEcnaRootFile.h.

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

Int_t TEcnaRootFile::fCounterBytesCnaResults

Definition at line 21 of file TEcnaRootFile.h.

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

Int_t TEcnaRootFile::fNbEntries

Definition at line 22 of file TEcnaRootFile.h.

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

TFile* TEcnaRootFile::fRootFile

Definition at line 20 of file TEcnaRootFile.h.

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

TString TEcnaRootFile::fRootFileName

Definition at line 18 of file TEcnaRootFile.h.

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

TString TEcnaRootFile::fRootFileStatus

Definition at line 19 of file TEcnaRootFile.h.

Referenced by Init(), and TEcnaRootFile().