CMS 3D CMS Logo

SimJetResponseAnalysis.cc File Reference

#include <iostream>
#include <sstream>
#include <istream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cmath>
#include <functional>
#include "SimJetResponseAnalysis.h"
#include "FWCore/Framework/interface/Event.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "DataFormats/JetReco/interface/CaloJet.h"
#include "DataFormats/METReco/interface/CaloMET.h"
#include "DataFormats/JetReco/interface/CaloJetCollection.h"
#include "DataFormats/JetReco/interface/GenJet.h"
#include "DataFormats/METReco/interface/GenMET.h"
#include "DataFormats/JetReco/interface/GenJetCollection.h"
#include "CaloTowerBoundriesMC.h"
#include "JetUtilMC.h"
#include "FWCore/PluginManager/interface/ModuleDef.h"
#include "FWCore/Framework/interface/MakerMacros.h"

Go to the source code of this file.

Typedefs

typedef
CaloJetCollection::const_iterator 
CalJetIter
typedef
GenJetCollection::const_iterator 
GenJetIter

Functions

 DEFINE_FWK_MODULE (SimJetResponseAnalysis)
void GetMPV (TH1 *h, double &mean, double &width, double &error)


Typedef Documentation

typedef CaloJetCollection::const_iterator CalJetIter

Definition at line 35 of file SimJetResponseAnalysis.cc.

typedef GenJetCollection::const_iterator GenJetIter

Definition at line 36 of file SimJetResponseAnalysis.cc.


Function Documentation

DEFINE_FWK_MODULE ( SimJetResponseAnalysis   ) 

void GetMPV ( TH1 *  h,
double &  mean,
double &  width,
double &  error 
)

Definition at line 559 of file SimJetResponseAnalysis.cc.

References g, nevents, norm, and funct::sqrt().

Referenced by SimJetResponseAnalysis::GetSimJetResponse().

00559                                                              {
00560  
00561   mean=0.0;
00562   width=0.0;
00563   error=0.0;
00564   Double_t nevents=h->GetEntries();  
00565   if(nevents<1) return;
00566 
00567   h->SetNormFactor(1.0);
00568 
00569   //  Double_t median[1];
00570   //  Double_t half[1]={0.5};
00571   //  h->GetQuantiles(1,median,half);
00572   //  Double_t gausmean=median[0];
00573 
00574   Double_t gausmean=h->GetMean();
00575   Double_t gauswidth=h->GetRMS();
00576   Double_t norm=1.0;
00577  
00578   TF1 *g = new TF1("g","gaus(0)",gausmean-2.0*gauswidth,gausmean+2.0*gauswidth);
00579   g->SetParLimits(0,0.0,2.0);
00580   g->SetParameter(0,norm);
00581   g->SetParameter(1,gausmean);
00582   g->SetParameter(2,gauswidth);
00583   h->Fit(g,"RQN");
00584  
00585   norm=g->GetParameter(0);
00586   gausmean=g->GetParameter(1);
00587   gauswidth=g->GetParameter(2);
00588  
00589   g->SetRange(gausmean-1.0*gauswidth,gausmean+1.0*gauswidth);
00590   g->SetParameter(0,norm);
00591   g->SetParameter(1,gausmean);
00592   g->SetParameter(2,gauswidth);
00593   h->Fit(g,"RQN");
00594  
00595   norm=g->GetParameter(0);
00596   gausmean=g->GetParameter(1);
00597   gauswidth=g->GetParameter(2);
00598  
00599   g->SetRange(gausmean-1.0*gauswidth,gausmean+1.0*gauswidth);
00600   g->SetParameter(0,norm);
00601   g->SetParameter(1,gausmean);
00602   g->SetParameter(2,gauswidth);
00603   h->Fit(g,"RQ");
00604 
00605   mean=g->GetParameter(1);
00606   width=g->GetParameter(2);
00607   error=width/sqrt(nevents);
00608 
00609 }


Generated on Tue Jun 9 17:54:30 2009 for CMSSW by  doxygen 1.5.4