/*****************************************************************************
* Project: RooFit *
* Package: RooFitCore *
* File: $Id: RooMapCatEntry.cc,v 1.12 2005/06/16 09:31:28 wverkerke Exp $
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
// -- CLASS DESCRIPTION [AUX] --
// RooMapCatEntry is an auxilary class for RooMappedCategory and defines a
// a mapping. A mapping consists of a wildcard regular expression, that
// can be matched against the input category state label and an output
// category state (RooCatType), which should be assign if the match is successfull.
#include "RooFit.h"
#include "RooMapCatEntry.h"
#include "RooMapCatEntry.h"
#include "TString.h"
ClassImp(RooMapCatEntry)
;
RooMapCatEntry::RooMapCatEntry(const char* exp, const RooCatType* cat) :
TNamed(exp,mangle(exp).Data()), _regexp(mangle(exp),kTRUE), _cat(*cat)
{
}
RooMapCatEntry::RooMapCatEntry(const RooMapCatEntry& other) :
TNamed(other), _regexp(other.GetTitle(),kTRUE), _cat(other._cat)
{
}
Bool_t RooMapCatEntry::match(const char* testPattern) const
{
return (TString(testPattern).Index(_regexp)>=0) ;
}
TString RooMapCatEntry::mangle(const char* exp) const
{
// Mangle name : escape regexp character '+'
TString t ;
const char *c = exp ;
while(*c) {
if (*c=='+') t.Append('\\') ;
t.Append(*c) ;
c++ ;
}
return t ;
}
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.