Logo ROOT   6.18/05
Reference Guide
RooCatType.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\file RooCatType.cxx
19\class RooCatType
20\ingroup Roofitcore
21
22RooCatType is an auxilary class for RooAbsCategory and defines a
23a single category state. The class holds a string label and an integer
24index value which define the state
25**/
26
27#include "RooFit.h"
28
29#include <stdlib.h>
30#include "TClass.h"
31#include "RooCatType.h"
32
33#include "Riostream.h"
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::cout << "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:58
#define ClassImp(name)
Definition: Rtypes.h:365
char name[80]
Definition: TGX11.cxx:109
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state.
Definition: RooCatType.h:22
char _label[256]
Definition: RooCatType.h:103
virtual void printTitle(std::ostream &os) const
Print the title of the state.
Definition: RooCatType.cxx:70
virtual const Text_t * GetName() const
Returns name of object.
Definition: RooCatType.h:44
virtual void SetName(const Text_t *name)
Constructor with name argument.
Definition: RooCatType.cxx:46
virtual void printClassName(std::ostream &os) const
Print the class name of the state.
Definition: RooCatType.cxx:80
virtual void printName(std::ostream &os) const
Print the name of the state.
Definition: RooCatType.cxx:60
virtual void printValue(std::ostream &os) const
Print the value (index integer) of the state.
Definition: RooCatType.cxx:90
Int_t getVal() const
Definition: RooCatType.h:79
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:401