Skip to content

Commit

Permalink
Fixed output collection in event
Browse files Browse the repository at this point in the history
  • Loading branch information
pandreetto committed Apr 21, 2023
1 parent 5f23738 commit d9f00da
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/MuonCVXDRealDigitiser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,18 @@ void MuonCVXDRealDigitiser::processRunHeader(LCRunHeader* run)

void MuonCVXDRealDigitiser::processEvent(LCEvent * evt)
{
LCCollectionVec *THcol = new LCCollectionVec(LCIO::TRACKERHITPLANE);
CellIDEncoder<TrackerHitPlaneImpl> cellid_encoder(lcio::LCTrackerCellID::encoding_string(), THcol);

LCCollectionVec* relCol = new LCCollectionVec(LCIO::LCRELATION);
// to store the weights
LCFlagImpl lcFlag { 0 };
lcFlag.setBit(LCIO::LCREL_WEIGHTED);
relCol->setFlag(lcFlag.getFlag());

evt->addCollection(THcol, _outputCollectionName.c_str());
evt->addCollection(relCol, _colVTXRelation.c_str());

LCCollection* STHcol = nullptr;
try
{
Expand All @@ -312,18 +324,13 @@ void MuonCVXDRealDigitiser::processEvent(LCEvent * evt)
STHcol = nullptr;
}

if (STHcol == nullptr or STHcol->getNumberOfElements() == 0) return;
if (STHcol == nullptr or STHcol->getNumberOfElements() == 0)
{
streamlog_out(MESSAGE) << "Number of produced hits: " << THcol->getNumberOfElements() << std::endl;
}
std::string encoder_str { STHcol->getParameters().getStringVal(lcio::LCIO::CellIDEncoding) };
CellIDDecoder<TrackerHitPlaneImpl> cellid_decoder { encoder_str };

LCCollectionVec *THcol = new LCCollectionVec(LCIO::TRACKERHITPLANE);

LCCollectionVec* relCol = new LCCollectionVec(LCIO::LCRELATION);
// to store the weights
LCFlagImpl lcFlag { 0 };
lcFlag.setBit(LCIO::LCREL_WEIGHTED);
relCol->setFlag(lcFlag.getFlag());

std::size_t RELHISTOSIZE { 10 };
vector<std::size_t> relHisto {};
relHisto.assign(RELHISTOSIZE, 0);
Expand Down Expand Up @@ -565,8 +572,6 @@ void MuonCVXDRealDigitiser::processEvent(LCEvent * evt)
}
}
streamlog_out(MESSAGE) << "Number of produced hits: " << THcol->getNumberOfElements() << std::endl;
evt->addCollection(THcol, _outputCollectionName.c_str());
evt->addCollection(relCol, _colVTXRelation.c_str());
int count = 0;
streamlog_out(DEBUG) << "Hit relation histogram:" << std::endl;
for (std::size_t k = 0; k < RELHISTOSIZE; k++)
Expand Down

0 comments on commit d9f00da

Please sign in to comment.