Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nptool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab has been updated. More info
here
and
there
.
Show more breadcrumbs
np
nptool
Commits
057597a3
Commit
057597a3
authored
14 years ago
by
matta
Browse files
Options
Downloads
Patches
Plain Diff
* Adding new functionality to RootInput Class
- Now Can add Friend Tree using a RunToTreat file
parent
e64cd3ee
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NPLib/IORoot/RootInput.cxx
+70
-1
70 additions, 1 deletion
NPLib/IORoot/RootInput.cxx
NPLib/IORoot/RootInput.h
+5
-0
5 additions, 0 deletions
NPLib/IORoot/RootInput.h
with
75 additions
and
1 deletion
NPLib/IORoot/RootInput.cxx
+
70
−
1
View file @
057597a3
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
*****************************************************************************/
*****************************************************************************/
#include
<iostream>
#include
<iostream>
#include
<sstream>
#include
<fstream>
#include
<fstream>
#include
<limits>
#include
<limits>
...
@@ -48,10 +49,10 @@ void RootInput::Destroy()
...
@@ -48,10 +49,10 @@ void RootInput::Destroy()
}
}
}
}
// fileNameBase doit etre le nom du TChain.
// fileNameBase doit etre le nom du TChain.
RootInput
::
RootInput
(
string
configFileName
)
RootInput
::
RootInput
(
string
configFileName
)
{
{
NumberOfFriend
=
0
;
bool
CheckTreeName
=
false
;
bool
CheckTreeName
=
false
;
bool
CheckRootFileName
=
false
;
bool
CheckRootFileName
=
false
;
...
@@ -110,7 +111,75 @@ RootInput::RootInput(string configFileName)
...
@@ -110,7 +111,75 @@ RootInput::RootInput(string configFileName)
cout
<<
"/////////////////////////////////"
<<
endl
;
cout
<<
"/////////////////////////////////"
<<
endl
;
}
}
void
RootInput
::
AddFriendChain
(
string
RunToAdd
)
{
NumberOfFriend
++
;
ostringstream
suffix_buffer
;
suffix_buffer
<<
"_"
<<
NumberOfFriend
;
string
suffix
=
suffix_buffer
.
str
();
bool
CheckTreeName
=
false
;
bool
CheckRootFileName
=
false
;
// Read configuration file Buffer
string
lineBuffer
,
dataBuffer
;
// Open file
ifstream
inputConfigFile
;
inputConfigFile
.
open
(
RunToAdd
.
c_str
());
TChain
*
localChain
=
new
TChain
();
cout
<<
"/////////////////////////////////"
<<
endl
;
cout
<<
"Adding frien to current TChain"
<<
endl
;
if
(
!
inputConfigFile
)
{
cout
<<
"Run to Add file :"
<<
RunToAdd
<<
" not found "
<<
endl
;
return
;
}
else
{
while
(
!
inputConfigFile
.
eof
())
{
getline
(
inputConfigFile
,
lineBuffer
);
// search for token giving the TTree name
if
(
lineBuffer
.
compare
(
0
,
9
,
"TTreeName"
)
==
0
)
{
inputConfigFile
>>
dataBuffer
;
// adding suffix to insure uniquity of the chain name
dataBuffer
+
suffix
;
// initialize localChain
localChain
->
SetName
(
dataBuffer
.
c_str
());
CheckTreeName
=
true
;
}
// search for token giving the list of Root files to treat
else
if
(
lineBuffer
.
compare
(
0
,
12
,
"RootFileName"
)
==
0
&&
localChain
)
{
CheckRootFileName
=
true
;
while
(
!
inputConfigFile
.
eof
())
{
inputConfigFile
>>
dataBuffer
;
// ignore comment Line
if
(
dataBuffer
.
compare
(
0
,
1
,
"%"
)
==
0
)
{
inputConfigFile
.
ignore
(
std
::
numeric_limits
<
std
::
streamsize
>::
max
(),
'\n'
);
}
else
if
(
!
inputConfigFile
.
eof
())
{
localChain
->
Add
(
dataBuffer
.
c_str
());
cout
<<
"Adding file "
<<
dataBuffer
<<
" to TChain"
<<
endl
;
}
}
}
}
}
if
(
!
CheckRootFileName
||
!
CheckTreeName
)
cout
<<
"WARNING: Token not found for InputTree Declaration : Input Tree has not be Added to the current Chain"
<<
endl
;
else
pRootChain
->
AddFriend
(
localChain
->
GetName
()
);
cout
<<
"/////////////////////////////////"
<<
endl
;
}
RootInput
::~
RootInput
()
RootInput
::~
RootInput
()
{
{
...
...
This diff is collapsed.
Click to expand it.
NPLib/IORoot/RootInput.h
+
5
−
0
View file @
057597a3
...
@@ -64,10 +64,15 @@ private:
...
@@ -64,10 +64,15 @@ private:
static
RootInput
*
instance
;
static
RootInput
*
instance
;
public:
public:
// Return the private chain
TChain
*
GetChain
()
{
return
pRootChain
;};
TChain
*
GetChain
()
{
return
pRootChain
;};
// Add a Friend chain to the input chain
void
AddFriendChain
(
string
RunToAdd
);
private
:
private
:
TChain
*
pRootChain
;
TChain
*
pRootChain
;
int
NumberOfFriend
;
};
};
#endif // ROOTINPUT_HH
#endif // ROOTINPUT_HH
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment