Project

General

Profile

read_event.cc

read data code example with instance name - Robert Sulej, 03/22/2016 10:15 AM

 
1
bool some_analyzer::readEvent(art::Event const & evt)
2
{
3
    art::Handle< std::vector<recob::Track> > trkListHandle;
4
    if (evt.getByLabel("pmtrack", trkListHandle))
5
    {
6
        art::FindManyP< recob::Vertex > vtxFromTrk(trkListHandle, evt, "pmtrack"); // usual way to recover vertices
7
        art::FindManyP< recob::Vertex > kinkFromTrk(trkListHandle, evt, art::InputTag("pmtrack", "kink")); // instance name specified to recover kinks
8

    
9
        for (size_t t = 0; t < trkListHandle->size(); t++)
10
        {
11
            std::cout << "vertices at " << t << ": " << vtxFromTrk.at(t).size() << std::endl;
12
            std::cout << "kinks at " << t << ": " << kinkFromTrk.at(t).size() << std::endl;
13
        }
14
    }
15
}