Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooThresholdCategory.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooThresholdCategory.h,v 1.8 2007/05/11 09:11:30 verkerke Exp $
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 #ifndef ROO_THRESHOLD_CATEGORY
17 #define ROO_THRESHOLD_CATEGORY
18 
19 #include "RooAbsCategory.h"
20 #include "RooRealProxy.h"
21 #include "RooCatType.h"
22 
23 #include <vector>
24 #include <utility>
25 
26 class RooThresholdCategory : public RooAbsCategory {
27 
28 public:
29  // Constructors etc.
30  RooThresholdCategory() {};
31  RooThresholdCategory(const char *name, const char *title, RooAbsReal& inputVar,
32  const char* defCatName="Default", Int_t defCatIdx=0);
33  RooThresholdCategory(const RooThresholdCategory& other, const char *name=0) ;
34  virtual TObject* clone(const char* newname) const { return new RooThresholdCategory(*this, newname); }
35 
36  // Mapping function
37  Bool_t addThreshold(Double_t upperLimit, const char* catName, Int_t catIdx=-99999) ;
38 
39  // Printing interface (human readable)
40  virtual void printMultiline(std::ostream& os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const ;
41 
42  void writeToStream(std::ostream& os, Bool_t compact) const ;
43 
44 protected:
45 
46  RooRealProxy _inputVar ;
47  const RooCatType* _defCat{nullptr};
48  std::vector<std::pair<double,RooCatType>> _threshList;
49 
50  virtual RooCatType evaluate() const ;
51 
52  ClassDef(RooThresholdCategory, 2) // Real-to-Category function defined by series of thresholds
53 };
54 
55 #endif