TCut in RooCategory

Dear root experts,

I’m trying to compute trigger efficiencies and fit them using an unbinned fit with RooFit.

My input tree has a branch that stores a TString in which I concatenate all trigger paths triggering the event.
I thought it would be practical to do like this, in order to be sure to store a maximal information about the trigger paths in use in the input dataset.

I wonder if I can define a RooCategory from a condition on the TString branch (called trig_pass), in the form of a TCut.
Here is an extract from my code [*].
It does not work, and before starting creating 1 Int_t branch (with 0=failing, 1=passing) per trigger path of interest in the input tree, I was wondering if there is any way to proceed like this.

Thanks in advance for your answer!


  // Input variables
  RooRealVar xaxis("metnomu","PFMETNoMu [GeV]",0,500);
  RooRealVar pfMhtNoMu("mhtnomu","PFMHTNoMu [GeV]",0,5000);

  // Trigger matching
  RooCategory *category = new RooCategory("trig_pass.Contains('HLT')","");
  category->defineType("accept",1) ;
  category->defineType("reject",0) ;

  // Input dataset
  RooDataSet dataSet("data","data from tree",
		     RooArgSet(xaxis, *category, pfMhtNoMu),
		     Import(*_tree), Cut("mhtnomu>=0") );

  Int_t color=kRed;
  Int_t style=kOpenCircle;
  RooPlot* frame = xaxis.frame(Bins(18000),Title("Fitted efficiency")) ;
  dataSet.plotOn(frame, Binning(binning), Efficiency(*category), MarkerColor(color), LineColor(color), MarkerStyle(style) );

Have you solved this issue ?