Exercise 3

  1. Example code
    1. Get a data product from the event (GenParticleCollection) and print out the size of the data product (number of generted tracks). # Hard code the module label of the creator module.
  2. Activities
    1. Handles can be used as pointers. See and ex03Activity01.fcl. # ex03Activity02.fcl this runs the event dumper. Look at the names of the products in the event. Notice run scope data products. # Remove the const. Observe the error message # Misspell the name of the module that created the data product. Observe the error message. # Rewrite the exercise to use the handle as a pointer. # In the source area, art-workbook/artwb, do: diff Ex01/CMakeLists.txt Ex03/CMakeLists.txt Note that one line has been added, the name of the library that contains the data products.
  3. Ideas to discuss
    1. What is a data product # Find source for GenparticleCollection.h and GenParticle.h. # GenParticleCollection is a typedef. Under the covers it is just a std::vector<GenParticle>. Explain why we used a typedef. # art::Handle # const correctness in product access. # Explain about the overhead everytime that you dereference a handle. Use judgement about when to use which style of access. # Explain the naming scheme of data products - forward reference for the instance name part.