Skip to content

Commit

Permalink
add cellid only for current collection
Browse files Browse the repository at this point in the history
  • Loading branch information
fdplacido authored and vvolkl committed Oct 1, 2021
1 parent 1176b21 commit 3af7e26
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
17 changes: 8 additions & 9 deletions SimG4Components/src/SimG4SaveCalHits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,15 @@ StatusCode SimG4SaveCalHits::saveOutput(const G4Event& aEvent) {
auto edmHits = m_caloHits.createAndPut();
for (int iter_coll = 0; iter_coll < collections->GetNumberOfCollections(); iter_coll++) {
collect = collections->GetHC(iter_coll);

// Add CellID encoding string to collection metadata
auto lcdd = m_geoSvc->lcdd();
auto allReadouts = lcdd->readouts();
auto idspec = lcdd->idSpecification(collect->GetName());
auto field_str = idspec.fieldDescription();
auto& coll_md = m_podioDataSvc->getProvider().getCollectionMetaData( m_caloHits.get()->getID() );
coll_md.setValue("CellIDEncodingString", field_str);

if (std::find(m_readoutNames.begin(), m_readoutNames.end(), collect->GetName()) != m_readoutNames.end()) {
// Add CellID encoding string to collection metadata
auto lcdd = m_geoSvc->lcdd();
auto allReadouts = lcdd->readouts();
auto idspec = lcdd->idSpecification(collect->GetName());
auto field_str = idspec.fieldDescription();
auto& coll_md = m_podioDataSvc->getProvider().getCollectionMetaData( m_caloHits.get()->getID() );
coll_md.setValue("CellIDEncodingString", field_str);

size_t n_hit = collect->GetSize();
debug() << "\t" << n_hit << " hits are stored in a collection #" << iter_coll << ": " << collect->GetName()
<< endmsg;
Expand Down
16 changes: 8 additions & 8 deletions SimG4Components/src/SimG4SaveTrackerHits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ StatusCode SimG4SaveTrackerHits::saveOutput(const G4Event& aEvent) {
edm4hep::SimTrackerHitCollection* edmHits = m_trackHits.createAndPut();
for (int iter_coll = 0; iter_coll < collections->GetNumberOfCollections(); iter_coll++) {
collect = collections->GetHC(iter_coll);
if (std::find(m_readoutNames.begin(), m_readoutNames.end(), collect->GetName()) != m_readoutNames.end()) {

// Add CellID encoding string to collection metadata
auto lcdd = m_geoSvc->lcdd();
auto allReadouts = lcdd->readouts();
auto idspec = lcdd->idSpecification(collect->GetName());
auto field_str = idspec.fieldDescription();
auto& coll_md = m_podioDataSvc->getProvider().getCollectionMetaData( m_trackHits.get()->getID() );
coll_md.setValue("CellIDEncodingString", field_str);
// Add CellID encoding string to collection metadata
auto lcdd = m_geoSvc->lcdd();
auto allReadouts = lcdd->readouts();
auto idspec = lcdd->idSpecification(collect->GetName());
auto field_str = idspec.fieldDescription();
auto& coll_md = m_podioDataSvc->getProvider().getCollectionMetaData( m_trackHits.get()->getID() );
coll_md.setValue("CellIDEncodingString", field_str);

if (std::find(m_readoutNames.begin(), m_readoutNames.end(), collect->GetName()) != m_readoutNames.end()) {
size_t n_hit = collect->GetSize();
verbose() << "\t" << n_hit << " hits are stored in a tracker collection #" << iter_coll << ": "
<< collect->GetName() << endmsg;
Expand Down

0 comments on commit 3af7e26

Please sign in to comment.