CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
UtilsClient.h
Go to the documentation of this file.
1 #ifndef UtilsClient_H
2 #define UtilsClient_H
3 
15 #include "TObject.h"
16 
17 class TH1;
18 class TProfile;
19 class TProfile2D;
20 class TClass;
21 
22 class UtilsClient {
23 
24  public:
25 
32  template<class T> static T getHisto( const MonitorElement* me, bool clone = false, T ret = 0);
33 
40  static void printBadChannels( const MonitorElement* me, TH1* hi, bool positive_only = false );
41 
50  static bool getBinStatistics( TH1* histo, const int ix, const int iy, float& num, float& mean, float& rms, float minEntries = 1. );
51 
57  static bool getBinQuality( const MonitorElement* me, const int ix, const int iy );
58 
64  static bool getBinStatus( const MonitorElement* me, const int ix, const int iy );
65 
71  static void maskBinContent( const MonitorElement* me, const int ix, const int iy );
72 
77  static int getFirstNonEmptyChannel( const TProfile2D* histo );
78 
79  private:
80 
81  UtilsClient() {}; // Hidden to force static use
82  ~UtilsClient() {}; // Hidden to force static use
83 
84 };
85 
86 template<class T>
87 inline
88 T
90 {
91  if( me ) {
92  TObject* ob = const_cast<MonitorElement*>(me)->getRootObject();
93  if( ob ) {
94  if( clone ) {
95  if( ret ) {
96  delete ret;
97  }
98  std::string s = "ME " + me->getName();
99  ret = dynamic_cast<T>(ob->Clone(s.c_str()));
100  if( ret ) {
101  ret->SetDirectory(0);
102  }
103  } else {
104  ret = dynamic_cast<T>(ob);
105  }
106  } else {
107  ret = 0;
108  }
109  } else {
110  if( !clone ) {
111  ret = 0;
112  }
113  }
114  return ret;
115 }
116 
117 #endif
const std::string & getName(void) const
get name of ME
static T getHisto(const MonitorElement *me, bool clone=false, T ret=0)
Returns the histogram contained by the Monitor Element.
Definition: UtilsClient.h:89
static bool getBinQuality(const MonitorElement *me, const int ix, const int iy)
Returns true if the bin quality is good or masked.
Definition: UtilsClient.cc:201
static void maskBinContent(const MonitorElement *me, const int ix, const int iy)
Mask the bin content.
Definition: UtilsClient.cc:231
static bool getBinStatus(const MonitorElement *me, const int ix, const int iy)
Returns true if the bin status is red/dark red.
Definition: UtilsClient.cc:216
Utilities for Ecal Monitor Client.
Definition: UtilsClient.h:22
static bool getBinStatistics(TH1 *histo, const int ix, const int iy, float &num, float &mean, float &rms, float minEntries=1.)
Returns true if the bin contains good statistical data.
Definition: UtilsClient.cc:74
tuple clone
Definition: statics.py:58
long double T
static void printBadChannels(const MonitorElement *me, TH1 *hi, bool positive_only=false)
Print the bad channels.
Definition: UtilsClient.cc:14
static int getFirstNonEmptyChannel(const TProfile2D *histo)
Find the first non empty bin.
Definition: UtilsClient.cc:246