test_Ids.C 992 B

1234567891011121314151617181920212223
  1. R__LOAD_LIBRARY(/nica/mpd21/parfenov/mpd_winter2019/winter_scripts/build_test/PicoDst/libPicoDst.so)
  2. void test_Ids()
  3. {
  4. TFile *fi = new TFile("test_picodst.root","read");
  5. TTree *tree = (TTree*) fi->Get("picodst");
  6. TClonesArray *recoTracks = nullptr;
  7. TClonesArray *mcTracks = nullptr;
  8. tree->SetBranchAddress("mctracks",&mcTracks);
  9. tree->SetBranchAddress("recotracks",&recoTracks);
  10. for (int iEv=0; iEv<tree->GetEntriesFast(); iEv++)
  11. {
  12. tree->GetEntry(iEv);
  13. for (int i=0; i<recoTracks->GetEntriesFast(); i++)
  14. {
  15. auto recoTrack = (PicoDstRecoTrack*) recoTracks->UncheckedAt(i);
  16. auto mcTrack = (PicoDstMCTrack*) mcTracks->UncheckedAt(recoTrack->GetMcId());
  17. if (recoTrack->GetInitialMcId() != mcTrack->GetInitialId())
  18. std::cout << "Event " << iEv << ", recotrack " << i << ": InitMcId(reco)= " << recoTrack->GetInitialMcId() << ", InitMcId(mc)= " << mcTrack->GetInitialId() << ", McId= " << recoTrack->GetMcId() << std::endl;
  19. }
  20. }
  21. }