Skip to content

Commit

Permalink
Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bonventre committed Jul 29, 2024
1 parent 9d28e09 commit f9d98e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
4 changes: 4 additions & 0 deletions RecoDataProducts/inc/ComboHit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ namespace mu2e {
// This function is called recursively, so the the vector must be empty on the top-most call
#ifndef __ROOTCLING__
// find the parent at a given level
// if parent and grandparent are the same level, will select the grandparent unless stopatfirst set
CHCPTR parent(StrawIdMask::Level level, bool stopatfirst=false) const;
void fillStrawDigiIndices( size_t chindex, SHIV& shids, bool stopatfirst=false) const;
// Fill indices to the specified level. Return value is the collection to whic
Expand All @@ -174,6 +175,9 @@ namespace mu2e {
void setAsSubset(CHCPTR const& other);
void setAsSubset(art::Handle<ComboHitCollection> const& ohandle);
void setAsSubset(art::ValidHandle<ComboHitCollection> const& ohandle);
// optionally specify what level to make as parent
// if parent and grandparent are the same level, will select the grandparent unless stopatfirst set
void setAsSubset(CHCPTR const& optr, StrawIdMask::Level level, bool stopatfirst=false);
void setAsSubset(art::Handle<ComboHitCollection> const& ohandle, StrawIdMask::Level level, bool stopatfirst=false);
void setAsSubset(art::ValidHandle<ComboHitCollection> const& ohandle, StrawIdMask::Level level, bool stopatfirst=false);
#endif
Expand Down
21 changes: 6 additions & 15 deletions RecoDataProducts/src/ComboHit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,14 @@ namespace mu2e {
void ComboHitCollection::setAsSubset(art::Handle<ComboHitCollection> const& ohandle){
if (ohandle.isValid()){
auto optr = CHCPTR(ohandle);
_parent = optr->parent();
if (_parent.refCore().isNull()){
_parent = optr;
}
setAsSubset(optr);
} else {
throw cet::exception("RECO")<<"mu2e::ComboHitCollection: invalid handle" << std::endl;
}
}
void ComboHitCollection::setAsSubset(art::ValidHandle<ComboHitCollection> const& ohandle){
auto optr = CHCPTR(ohandle);
_parent = optr->parent();
if (_parent.refCore().isNull()){
_parent = optr;
}
setAsSubset(optr);
}
void ComboHitCollection::setAsSubset(CHCPTR const& other){
_parent = other->parent();
Expand All @@ -90,19 +84,16 @@ namespace mu2e {
void ComboHitCollection::setAsSubset(art::ValidHandle<ComboHitCollection> const& ohandle, StrawIdMask::Level level, bool stopatfirst){
if (ohandle.isValid()){
auto optr = CHCPTR(ohandle);
if (optr->level() == level && (stopatfirst || optr->parent().refCore().isNull() || optr->parent()->level() != level)){
_parent = optr;
}else{
_parent = optr->parent(level,stopatfirst);
}
setAsSubset(optr,level,stopatfirst);
} else {
throw cet::exception("RECO")<<"mu2e::ComboHitCollection: invalid handle" << std::endl;
}
}


void ComboHitCollection::setAsSubset(art::Handle<ComboHitCollection> const& ohandle, StrawIdMask::Level level, bool stopatfirst){
auto optr = CHCPTR(ohandle);
setAsSubset(optr,level,stopatfirst);
}
void ComboHitCollection::setAsSubset(CHCPTR const& optr, StrawIdMask::Level level, bool stopatfirst){
if (optr->level() == level && (stopatfirst || optr->parent().refCore().isNull() || optr->parent()->level() != level)){
_parent = optr;
}else{
Expand Down

0 comments on commit f9d98e0

Please sign in to comment.