Unable to access a variable from a branch structured similarly to std::vector<std::set<int16_t>>

Dear experts,
I am trying to access a variable from a branch structured similarly to std::vector<std::set<int16_t>>
I am trying to access the variable with the following lines of code in the macro

static constexpr Int_t kMaxPFCandidates = 1167;
std::set<int> PFCandidates_regionsOfInterest_[kMaxPFCandidates];
TBranch        *b_PFCandidates_regionsOfInterest_;
fChain->SetBranchAddress("PFCandidates.regionsOfInterest_",PFCandidates_regionsOfInterest_, &b_PFCandidates_regionsOfInterest_);

Now in the event loop

for (Long64_t jentry=0; jentry<nentries;jentry++){     
      Long64_t ientry = LoadTree(jentry);     
         for (int iPFcan=0; iPFcan < PFCandidates_; iPFcan++){            
                if (PFCandidates_>0){
                std::set<int> mySet = PFCandidates_regionsOfInterest_[iPFcan];             
                cout<<"mySet.size()\t " <<mySet.size<<endl;             
              }
          }
}

The set’s size appears to be zero, indicating that I might be unable to retrieve PFCandidates.regionsOfInterest_. Is there something I’m overlooking, or do objects like std::vector<std::set> require a different access method than SetBranchAddress?

Best
Prafulla

Maybe @pcanal can give some hints

Hi,

The challenge is that you have a collection of unsplit objects and those are harder to get to. The easiest solution is to consider moving your code to use RDataFrame.

Cheers,
Philippe.

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