ROOT logo
/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 * @(#)root/roofitcore:$Id: RooMapCatEntry.cxx 20879 2007-11-19 11:22:56Z rdm $
 * 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 ;
}
 RooMapCatEntry.cxx:1
 RooMapCatEntry.cxx:2
 RooMapCatEntry.cxx:3
 RooMapCatEntry.cxx:4
 RooMapCatEntry.cxx:5
 RooMapCatEntry.cxx:6
 RooMapCatEntry.cxx:7
 RooMapCatEntry.cxx:8
 RooMapCatEntry.cxx:9
 RooMapCatEntry.cxx:10
 RooMapCatEntry.cxx:11
 RooMapCatEntry.cxx:12
 RooMapCatEntry.cxx:13
 RooMapCatEntry.cxx:14
 RooMapCatEntry.cxx:15
 RooMapCatEntry.cxx:16
 RooMapCatEntry.cxx:17
 RooMapCatEntry.cxx:18
 RooMapCatEntry.cxx:19
 RooMapCatEntry.cxx:20
 RooMapCatEntry.cxx:21
 RooMapCatEntry.cxx:22
 RooMapCatEntry.cxx:23
 RooMapCatEntry.cxx:24
 RooMapCatEntry.cxx:25
 RooMapCatEntry.cxx:26
 RooMapCatEntry.cxx:27
 RooMapCatEntry.cxx:28
 RooMapCatEntry.cxx:29
 RooMapCatEntry.cxx:30
 RooMapCatEntry.cxx:31
 RooMapCatEntry.cxx:32
 RooMapCatEntry.cxx:33
 RooMapCatEntry.cxx:34
 RooMapCatEntry.cxx:35
 RooMapCatEntry.cxx:36
 RooMapCatEntry.cxx:37
 RooMapCatEntry.cxx:38
 RooMapCatEntry.cxx:39
 RooMapCatEntry.cxx:40
 RooMapCatEntry.cxx:41
 RooMapCatEntry.cxx:42
 RooMapCatEntry.cxx:43
 RooMapCatEntry.cxx:44
 RooMapCatEntry.cxx:45
 RooMapCatEntry.cxx:46
 RooMapCatEntry.cxx:47
 RooMapCatEntry.cxx:48
 RooMapCatEntry.cxx:49
 RooMapCatEntry.cxx:50
 RooMapCatEntry.cxx:51
 RooMapCatEntry.cxx:52
 RooMapCatEntry.cxx:53
 RooMapCatEntry.cxx:54
 RooMapCatEntry.cxx:55
 RooMapCatEntry.cxx:56
 RooMapCatEntry.cxx:57
 RooMapCatEntry.cxx:58
 RooMapCatEntry.cxx:59
 RooMapCatEntry.cxx:60
 RooMapCatEntry.cxx:61
 RooMapCatEntry.cxx:62