The second error I got was related to the instantiation of EventInfo object in EventInfoReader: the AnalysisConfig object is created on stack, then its address is passed to EventInfo and then the AnalysisConfig object goes out of scope, thus rendering its pointer invalid. The solution is to move AnalysisConfig to heap.
The third error was caused by reading a collection that does not exist in the input Ntuple (GenPhotonCandidates). Swapped writers_genPhotonFilter for writers_met in the cfg file. Also limited the number of events to 100 -- just for testing.
I then got a fourth error that was related to lumiscale weights. I hacked the EvtWeightRecorder to see if I get any more errors -- and I unfortunately did, so that's where I stopped. I'm not going to push the hack I did here, but the rest of the changes in this PR should be solid.
Also, added .gitignroe, since there were too many artifacts created by scram after compiling the code, which we don't want to accidentally push to the repo.
The main problem that triggered this investigation was this line: https://github.com/HEP-KBFI/TallinnNtupleProducer/blob/ed53fc8e90e8df7959e21d1cdd0a63066d14c60b/Framework/bin/produceNtuple.cc#L248 The
writer
object wasnullptr
which is why the 2nd line that follows caused the segmentation violation. I'm not entirely sure how the ownership works here, but the C++ documentation says that if the object is not owned then the lastget()
call returns anullptr
. In any case, promoting thewriter
variable tounique_ptr
seems to work.The second error I got was related to the instantiation of
EventInfo
object inEventInfoReader
: theAnalysisConfig
object is created on stack, then its address is passed toEventInfo
and then theAnalysisConfig
object goes out of scope, thus rendering its pointer invalid. The solution is to moveAnalysisConfig
to heap.The third error was caused by reading a collection that does not exist in the input Ntuple (GenPhotonCandidates). Swapped
writers_genPhotonFilter
forwriters_met
in the cfg file. Also limited the number of events to 100 -- just for testing.I then got a fourth error that was related to lumiscale weights. I hacked the
EvtWeightRecorder
to see if I get any more errors -- and I unfortunately did, so that's where I stopped. I'm not going to push the hack I did here, but the rest of the changes in this PR should be solid.Also, added
.gitignroe
, since there were too many artifacts created byscram
after compiling the code, which we don't want to accidentally push to the repo.