Correlation between truth and reco events

Dear experts

I have two samples with truth and reconstructed events. I want to plot the correlation between the reconstructed and truth events for certain variables by selecting the events that have the same eventnumber and runnumber.

My problem is I do not know to select the events that have the same eventnumber and runnumber.

Here, I have attached the macros for your kind information.

Thanking you
Kanhaiya Gupta
correlation.C (2.3 KB)

_
Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


At least: h_top_pt->Fill(reco_t_pt, truth_t_pt);

I am not sure, but may be something like:

   // Running over the entries of the branches
   for (int i=0; i<nentries; i++) {
      truth->GetEntry(i); 
      reco->GetEntry(i);
      if (reco_eventnumber == truth_eventnumber && reco_runnumber == truth_runnumber) {
         h_top_pt->Fill(reco_t_pt, truth_t_pt);
         h_top_eta->Fill(reco_t_eta, truth_t_eta);
      }
   }

But this assumes the event number i in truth correspond to the event number i in reco. Is it the case ?
Also I noticed that your histograms have only 4 bins along X and Y . Is it normal ?

Note: I included @Wile_E_Coyote suggestion.

Yes, the histograms have four bins.

But this assumes the event number i in truth corresponds to the event number i in reco . Is it the case ?

I am not sure I wrote the code correctly. My aim is to select the event from the truth and reco that have the same runnumber and eventnumber.

Maybe you can suggest what can be the correct way to select the events.

Thanking you

The test enclosing the filling of the histograms I added, is doing that. But, as I said, that will work only if the event number i in truth correspond to the event number i in reco .

Sorry, still we are not sure that the event number i in truth correspond to the event number i in reco.

I think for event number i in reco, we have to scan all the truth events and then if runNumber and eventNumber matches than that will be corresponding event at the truth level.

But I have no idea how to do scan of events using ROOT.

Something like that I guess:

   // Running over the entries of the branches
   for (int i=0; i<nentries1; i++) {
      reco->GetEntry(i);
      for (int j=0; j<nentries2; j++) {
         truth->GetEntry(j); 
         if (reco_eventnumber == truth_eventnumber && reco_runnumber == truth_runnumber) {
            h_top_pt->Fill(reco_t_pt,reco_t_pt);
            h_top_eta->Fill(reco_t_eta, truth_t_eta);
         }
      }
   }

Thank you

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.