CMS 3D CMS Logo

PFTauRenderPlugin.cc
Go to the documentation of this file.
1 
7 #include "DQM/DQMRenderPlugin.h"
8 #include "utils.h"
9 
10 #include "TProfile2D.h"
11 #include "TStyle.h"
12 #include "TCanvas.h"
13 #include "TGraphPolar.h"
14 #include "TColor.h"
15 #include "TText.h"
16 #include "TLine.h"
17 #include <cassert>
18 #include <string>
19 
20 using namespace std;
21 
22 class PFTauRenderPlugin : public DQMRenderPlugin
23 {
24 public:
25  virtual bool applies( const VisDQMObject & o, const VisDQMImgInfo & )
26  {
27  return ((o.name.find( "RecoTauV/" ) != std::string::npos ) && (o.name.find( "Eff" ) != std::string::npos ) ); //Size and SumPt are already configured
28  }
29 
30  virtual void preDraw( TCanvas * canvas, const VisDQMObject & o, const VisDQMImgInfo & , VisDQMRenderInfo & renderInfo)
31  {
32  canvas->cd();
33  TH1* obj = dynamic_cast<TH1*>( o.object );
34  if(!obj) return; //nothing to do for TH2
35  //general setings
36  //drawing options
37  gStyle->SetOptStat(0);
38  renderInfo.drawOptions = "E0";
39  if(o.name.find( "Rejection" ) != std::string::npos ) canvas->SetLogy();
40  if(o.name.find( "RealData" ) != std::string::npos ) canvas->SetLogy();
41 
42  //titles and axis
43  string discriminator = stripDicriminator(o.name);
44  string variable = stripVar(o.name);
45  obj->SetTitle((discriminator+" fake rate vs "+variable).c_str());
46  obj->GetXaxis()->SetTitle(variable.c_str());
47  obj->GetYaxis()->SetTitle("fake rate");
48  double min = (canvas->GetLogy() ) ? 0.001 : 0.;
49  double max = (canvas->GetLogy() ) ? 2. : 1.2;
50  obj->GetYaxis()->SetRangeUser(min,max);
51  obj->SetMarkerStyle(20);
52  }
53 
54  virtual void postDraw( TCanvas *, const VisDQMObject &, const VisDQMImgInfo & )
55  {
56  }
57 
58 private:
59 
60  string stripDicriminator(string name)
61  {
62  return name.substr(name.rfind("/")+1,name.rfind("Eff")-name.rfind("/")-1);
63  }
64  string stripVar(string name)
65  {
66  return name.substr(name.rfind("Eff")+3);
67  }
68 };
69 
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
PFTauRenderPlugin::stripDicriminator
string stripDicriminator(string name)
Definition: PFTauRenderPlugin.cc:60
PFTauRenderPlugin::preDraw
virtual void preDraw(TCanvas *canvas, const VisDQMObject &o, const VisDQMImgInfo &, VisDQMRenderInfo &renderInfo)
Definition: PFTauRenderPlugin.cc:30
min
T min(T a, T b)
Definition: MathUtil.h:58
PFTauRenderPlugin::postDraw
virtual void postDraw(TCanvas *, const VisDQMObject &, const VisDQMImgInfo &)
Definition: PFTauRenderPlugin.cc:54
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
PDWG_TauSkim_cff.discriminator
discriminator
Definition: PDWG_TauSkim_cff.py:7
PFTauRenderPlugin::applies
virtual bool applies(const VisDQMObject &o, const VisDQMImgInfo &)
Definition: PFTauRenderPlugin.cc:25
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
PFTauRenderPlugin
Definition: PFTauRenderPlugin.cc:22
PFTauRenderPlugin::stripVar
string stripVar(string name)
Definition: PFTauRenderPlugin.cc:64
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
taus_updatedMVAIds_cff.variable
variable
Definition: taus_updatedMVAIds_cff.py:33
std
Definition: JetResolutionObject.h:76
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17