Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize file size for MatacqProducer::msize #34279

Merged
merged 1 commit into from Jul 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc
Expand Up @@ -364,7 +364,7 @@ bool MatacqProducer::getMatacqEvent(uint32_t runNumber, int32_t orbitId, bool fi
filepos_t pos = posEstim_.pos(orbitId);

// struct stat st;
filepos_t fsize;
filepos_t fsize = -1;
// if(0==stat(inFileName_.c_str(), &st)){
if (msize(fsize)) {
// const int64_t fsize = st.st_size;
Expand Down Expand Up @@ -747,19 +747,24 @@ void MatacqProducer::PosEstimator::init(MatacqProducer* mp) {
return;
}

filepos_t s;
filepos_t s = -1;
mp->msize(s);

//number of complete events:
const unsigned nEvents = s / eventLength_ / 8;

if (nEvents == 0) {
if (s == -1) {
if (verbosity_)
cout << "[Matacq " << now() << "] File is missing!" << endl;
orbitStepMean_ = 0;
return;
} else if (s == 0) {
if (verbosity_)
cout << "[Matacq " << now() << "] File is empty!" << endl;
orbitStepMean_ = 0;
return;
}

//number of complete events:
const unsigned nEvents = s / eventLength_ / 8;

if (verbosity_ > 1)
cout << "[Matacq " << now() << "] File size: " << s << " Number of events: " << nEvents << endl;

Expand Down