Dear all,
I would like to count the number of times I have a specific particle track (e.g. a muon).
In a tree I have the following branches/variables:
static constexpr Int_t kMaxMCTracks = 1000;
Double_t fVox; ///< Vertex X
...
Int_t MCTracks_;
Int_t MCTracks_fPdgCode[kMaxMCTracks]; //[MCTracks_]
Int_t MCTracks_fMother[kMaxMCTracks][2]; //[MCTracks_]
Int_t MCTracks_fDaughter[kMaxMCTracks][2];//[MCTracks_]
...
fChain->SetBranchAddress("fVox", &fVox, &b_Primary_fVox);
...
fChain->SetBranchAddress("MCTracks", &MCTracks_, &b_MCTracks_);
fChain->SetBranchAddress("MCTracks.fPdgCode", MCTracks_fPdgCode, &b_MCTracks_fPdgCode);
fChain->SetBranchAddress("MCTracks.fMother[2]", MCTracks_fMother, &b_MCTracks_fMother);
fChain->SetBranchAddress("MCTracks.fDaughter[2]", MCTracks_fDaughter, &b_MCTracks_fDaughter);
Is there a way, through RDataFrame to count how many tracks are there with a given fPdgCode?
I tried something like that:
auto nmuons = d->Filter("MCTracks.fPdgCode==13||MCTracks.fPdgCode==-13").Count();
cout << *nmuons << endl;
but it doesn’t work.
Thank you for your help!
Best, Germano
Please read tips for efficient and successful posting and posting code
_ROOT Version: 6.22/02
_Platform: MacOSX
Compiler: Not Provided