Skip to content

Conversation

@fengyvoid
Copy link
Contributor

EBLoadRaw Tool in EventBuildingV2 tool set.

This is splitted from PR #307

Changes based on your comments:

· EBLoadRaw line 295 - maybe relax this check to if line[0]=='#' otherwise trailing comments would result in the file being omitted.
Changed, now it's at line 314. I leave the previous commented line there just in case.

New changes:
I add some variables like 'PMTMatchingForced' to force a matching at the end of each partfile. Without it there maybe ~1 to 5% of events unpaired because of the asynchronizely loading and pairing of PMT and trigger.

@fengyvoid
Copy link
Contributor Author

For the force matching, we have tested them a while ago, and current processed data on pnfs are all already with that update.

@S81D S81D self-assigned this Aug 22, 2025
@S81D
Copy link
Collaborator

S81D commented Aug 25, 2025

Looks good.

Comment on lines +72 to +75
CData = new std::vector<CardData>;
TData = new TriggerData;
MData = new MRDOut;
LData = new PsecData;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CData TData MData and LData appear to be leaking

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure....
on line 597 CData is populated with PMTData->Get("CardData", *CData); (note the de-reference means it should set the value of CData, not overwrite the pointer), and subsequently on line 599 the CData pointer is passed to the CardData BoostStore, which will take ownership and handle deletion.
That does make me somewhat nervous that the CardData BoostStore may delete CData, resulting in the de-reference on line 597 segfaulting.... 🤔 Presumably if this doesn't happen CData CardData doesn't get deleted, or at least by the time it does, line 597 is never encountered again....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your correct i rescind my objection

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but agree with your comment about tis reuse...

one can set the pointer and ask the boost store not to manage the data which is a fix for that

// First, parse the lines and get all files.
std::string line;
ifstream myfile(FileList.c_str());
if (myfile.is_open())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps an else { std::cerr<<... would be sensible

m_data->CStore.Set("subrunNumber", -9999);
}

if (std::regex_search(fileName, match, rawFileNumber_regex) && match.size() > 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can do a single regex match that captures multiple matches at once....
sscanf may be a simpler alternative for something this simple.

ss_trigoverlap << "TrigOverlap_R" << RunNumber << "S" << SubRunNumber << "p" << PartFileNumber;
std::cout << "EBLoadRaw: Loading Trigger Overlap data: " << ss_trigoverlap.str() << std::endl;
BoostStore TrigOverlapStore;
bool store_exist = TrigOverlapStore.Initialise(ss_trigoverlap.str().c_str());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this have a configurable path prefix?

}
LoadedLAPPDTotalEntries += LAPPDTotalEntries;
}
catch (std::exception &e)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does anything in this try block actually throw?

{
BoostStore TrigOverlapStore;
std::stringstream ss_trigoverlap;
ss_trigoverlap << "TrigOverlap_R" << RunNumber << "S" << SubRunNumber << "p" << PartFileNumber;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preceding path?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants