problem reading objects from a file
I have run into trouble reading objects that I created, then put into an event and wrote to disk, back in from the file.
I am creating rb::Clusters, which in turn hold a PtrVector of rb::CellHits. I have a EDProducer that makes my Clusters. I also have a EDAnalyzer that can retrieve these clusters from the art::Event and print out their characteristics.
If I create the clusters in the producer, put them into the art::Event, then retrieve them and print them out using the analyzer, all in the same job, everything works just fine. However, if I produce the clusters in one job, write them out to a file (along with the list of CellHits that the PtrVectors refer to), then read them back in from the file in a different job, the program segfaults.
I can open the file in root and I see that the objects appear to be written into the file correctly. In my analyzer, it looks like I am successfully retrieving the cluster object, and I can even print out "global" cluster characteristics (simple variables that do not require access to the PtrVector of CellHits). However, as soon as I try to access the PtrVector of CellHits stored in the cluster, the program crashes.
I definitely have the CellHits my PtrVectors should be pointing to in my file. I can retrieve them from the file and print out their characteristics. I only get the seg fault when I try to access the PtrVector of CellHits from my Cluster object.
I can print the product ID of the Ptrs and the isAvailable and isTransient flags of the Ptrs that are held in my PtrVector in Cluster. Turns out all the Ptrs have product Ids of "2:2", isAvailble=1 and isTransient=0.
Do you have any ideas of why I can't retrieve these objects back from my file? Is there other information I can provide to better explain my problem?
The package is in the novasoft cvs repository. Its called ClusterMakerSS. To make the file containing clusters, you can run:
nova -c job/runclusterss.fcl /nova/data/art/genie_gen.root
that will produce a file called sscluster.root
to try to read the file back in, run
nova -c job/anaclusterss.fcl -s sscluster.root -o newfile.root
If you just want to try the last part, I have a file with the cluster objects written out at:
#2 Updated by Christopher Green over 9 years ago
Thank you for the report, Patricia. Sorry for the delay in replying to your issue.
It took me a while to reproduce your segfault because I was initially using the ClusterMakerSS package out of
$SRT_PUBLIC_CONTEXT and was unable to reproduce the problem. However, once I checked out the current state of the package locally I was able to observe the same behavior of segfaulting in the analyzer, specifically the diagnostic output lines you had added.
I will continue to analyze the problem tomorrow and ascertain the origin of the corruption and why this was not caught by our existing tests
#3 Updated by Christopher Green over 9 years ago
- Category changed from Metadata to Navigation
We have identified a problem with restoration of Ptr and PtrVector. We are working on it and should have something for you by early next week.
We apologize for the problems you've been encountering, and are treating this as a priority.
#4 Updated by Marc Paterno over 9 years ago
- Assignee changed from Christopher Green to Marc Paterno
We now have a test that isolates the bug that caused the failure that Patricia originally observed. The code to fix this bug is in ffca5042181ef5ada63ca43088b42e2ad7647d59, in the PtrVector branch of the repository. We will move this to the master branch as soon as possible, and put out a new release with this fix.
Thank you for bringing this to our attention, and for your patience while we fixed it.