Hi,
I’m trying to separate datasets based on their pdg ID numbers. The way I do this is by declaring a RooCategory object, then simply categorize the data based on a variable in my ntuple that stores the pdg ID. In the case of the W and Z (pdg = 24 and 23, respectively), I do something like:
RooCategory muonCategory("muonCategory","muonCategory");
muonCategory.defineType("Z",23);
muonCategory.defineType("W",24);
RooArgSet muonRecArgSet(muonCategory);
RooDataSet* ds = new RooDataSet(fileName,fileName,muonArgSet);
// --- Load the MC tree ---
int promptNt[50];
int nmu;
TChain* tree = new TChain("tree","tree");
int nFiles = tree->Add(pathName+fileName);
tree->SetBranchAddress("nmu", &nmu);
tree->SetBranchAddress("prompt", &promptNt);
// --- Set branch status ---
tree->SetBranchStatus("*",0) ;
tree->SetBranchStatus("nmu", 1);
tree->SetBranchStatus("prompt", 1);
for ( int i = 0; i < tree->GetEntries(); ++i ) {
tree->LoadTree(i);
tree->GetEntry(i);
for (int imu = 0; imu<nmu; ++imu){
if ( promptNt[imu] == 23) muonArgSet.setCatLabel("muonCategory","Z");
else if ( promptNt[imu] == 24) muonArgSet.setCatLabel("muonCategory","W");
set->add(muonArgSet);
}
}
ds = (RooDataSet*)ds->reduce(Cut("muonCategory==muonCategory::W"));
However, the number of entries are identical before and after I perform the last line
ds = ds->reduce(Cut(“muonCategory==muonCategory::W”)). I have a work around by making prompt a RooRealVar and cutting on it that way (which gives me the subset I’m looking for). However I’d like to know why the last line doesn’t apply the cut to my data?