Logo ROOT  
Reference Guide
RooCatTypeLegacy.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/**
18\class RooCatType
19\ingroup Roofitlegacy
20
21RooCatType is an auxilary class for RooAbsCategory and defines a
22a single category state. The class holds a string label and an integer
23index value which define the state
24**/
25
27
28#include "RooFit.h"
29
30#include "TClass.h"
31
32#include <iostream>
33
34
35
36using namespace std;
37
39;
40
41
42
43////////////////////////////////////////////////////////////////////////////////
44/// Constructor with name argument
45
47{
48 if (strlen(name)>255) {
49 std::cerr << "RooCatType::SetName warning: label '" << name << "' truncated at 255 chars" << std::endl ;
50 _label[255]=0 ;
51 }
52 strncpy(_label,name,255) ;
53}
54
55
56
57////////////////////////////////////////////////////////////////////////////////
58/// Print the name of the state
59
60void RooCatType::printName(ostream& os) const
61{
62 os << GetName() ;
63}
64
65
66
67////////////////////////////////////////////////////////////////////////////////
68/// Print the title of the state
69
70void RooCatType::printTitle(ostream& os) const
71{
72 os << GetTitle() ;
73}
74
75
76
77////////////////////////////////////////////////////////////////////////////////
78/// Print the class name of the state
79
80void RooCatType::printClassName(ostream& os) const
81{
82 os << IsA()->GetName() ;
83}
84
85
86
87////////////////////////////////////////////////////////////////////////////////
88/// Print the value (index integer) of the state
89
90void RooCatType::printValue(ostream& os) const
91{
92 os << getVal() ;
93}
94
char Text_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:364
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state.
char _label[256]
virtual const Text_t * GetName() const
Returns name of object.
virtual void printTitle(std::ostream &os) const
Print the title of the state.
void SetName(const Text_t *name)
Constructor with name argument.
virtual void printClassName(std::ostream &os) const
Print the class name of the state.
virtual void printName(std::ostream &os) const
Print the name of the state.
virtual void printValue(std::ostream &os) const
Print the value (index integer) of the state.
Int_t getVal() const
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:403
static const std::string name("name")