Skip to content

Commit

Permalink
Dont reload friends if same file
Browse files Browse the repository at this point in the history
  • Loading branch information
markrosslonergan committed Jun 27, 2023
1 parent 7eabaf4 commit 56bb28e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/SBNcovariance.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,14 @@ SBNcovariance::SBNcovariance(std::string xmlname, bool useuniverse) : SBNconfig(
std::string treefriendname = (*montecarlo_file_friend_treename_iter).second.at(k);
std::string treefriendfile = (*montecarlo_file_friend_iter).second.at(k);

std::cout << otag<<" Adding a friend tree: " <<treefriendname<<" from file: "<< treefriendfile <<std::endl;
if(treefriendfile==fn){//its the same file
std::cout << otag<<" Adding a friend tree: " <<treefriendname<<" from SAME file: "<< treefriendfile <<std::endl;
trees[fid]->AddFriend(treefriendname.c_str());
}else{
std::cout << otag<<" Adding a friend tree: " <<treefriendname<<" from different file: "<< treefriendfile <<std::endl;
trees[fid]->AddFriend(treefriendname.c_str(),treefriendfile.c_str());

trees[fid]->AddFriend(treefriendname.c_str(),treefriendfile.c_str());
}
}
}

Expand Down Expand Up @@ -385,9 +390,16 @@ SBNcovariance::SBNcovariance(std::string xmlname) : SBNconfig(xmlname) {
std::string treefriendname = (*montecarlo_file_friend_treename_iter).second.at(k);
std::string treefriendfile = (*montecarlo_file_friend_iter).second.at(k);

std::cout << otag<<" Adding a friend tree: " <<treefriendname<<" from file: "<< treefriendfile <<std::endl;

trees[fid]->AddFriend(treefriendname.c_str(),treefriendfile.c_str());
if(treefriendfile==fn){//its the same file
std::cout << otag<<" Adding a friend tree: " <<treefriendname<<" from SAME file: "<< treefriendfile <<std::endl;
trees[fid]->AddFriend(treefriendname.c_str());
}else{
std::cout << otag<<" Adding a friend tree: " <<treefriendname<<" from different file: "<< treefriendfile <<std::endl;
trees[fid]->AddFriend(treefriendname.c_str(),treefriendfile.c_str());

}

}
}

Expand Down

0 comments on commit 56bb28e

Please sign in to comment.