CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ErrorsAnalyzer Class Reference

#include <MuonAnalysis/MomentumScaleCalibration/plugins/ErrorsAnalyzer.cc>

Inheritance diagram for ErrorsAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 ErrorsAnalyzer (const edm::ParameterSet &)
 
 ~ErrorsAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void drawHistograms (const TProfile *histo, const TProfile *histoPlusErr, const TProfile *histoMinusErr, const TString &type)
 
void endJob () override
 
void fillHistograms ()
 
void fillValueError ()
 

Private Attributes

bool debug_
 
std::vector< int > errorFactors_
 
std::vector< double > errors_
 
int etaBins_
 
double etaMax_
 
double etaMin_
 
uint32_t maxEvents_
 
TString outputFileName_
 
std::vector< double > parameters_
 
int ptBins_
 
double ptMax_
 
double ptMin_
 
int resolFitType_
 
TProfile * sigmaMassVsEta_
 
TProfile * sigmaMassVsEtaMinusErr_
 
TProfile * sigmaMassVsEtaPlusErr_
 
TProfile * sigmaMassVsPt_
 
TProfile * sigmaMassVsPtMinusErr_
 
TProfile * sigmaMassVsPtPlusErr_
 
TProfile * sigmaPtVsEta_
 
TProfile * sigmaPtVsEtaMinusErr_
 
TProfile * sigmaPtVsEtaPlusErr_
 
TProfile * sigmaPtVsPt_
 
TProfile * sigmaPtVsPtMinusErr_
 
TProfile * sigmaPtVsPtPlusErr_
 
TString treeFileName_
 
std::vector< double > valueMinusError_
 
std::vector< double > valuePlusError_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 48 of file ErrorsAnalyzer.h.

Constructor & Destructor Documentation

ErrorsAnalyzer::ErrorsAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 6 of file ErrorsAnalyzer.cc.

References gather_cfg::cout, errorFactors_, errors_, etaBins_, etaMax_, etaMin_, cmsRelvalreport::exit, fillValueError(), edm::ParameterSet::getParameter(), parameters_, ptBins_, ptMax_, ptMin_, sigmaMassVsEta_, sigmaMassVsEtaMinusErr_, sigmaMassVsEtaPlusErr_, sigmaMassVsPt_, sigmaMassVsPtMinusErr_, sigmaMassVsPtPlusErr_, sigmaPtVsEta_, sigmaPtVsEtaMinusErr_, sigmaPtVsEtaPlusErr_, sigmaPtVsPt_, sigmaPtVsPtMinusErr_, and sigmaPtVsPtPlusErr_.

6  :
7  treeFileName_( iConfig.getParameter<std::string>("InputFileName") ),
8  resolFitType_( iConfig.getParameter<int>("ResolFitType") ),
9  maxEvents_( iConfig.getParameter<int>("MaxEvents") ),
10  outputFileName_( iConfig.getParameter<std::string>("OutputFileName") ),
11  ptBins_( iConfig.getParameter<int>("PtBins") ),
12  ptMin_( iConfig.getParameter<double>("PtMin") ),
13  ptMax_( iConfig.getParameter<double>("PtMax") ),
14  etaBins_( iConfig.getParameter<int>("EtaBins") ),
15  etaMin_( iConfig.getParameter<double>("EtaMin") ),
16  etaMax_( iConfig.getParameter<double>("EtaMax") ),
17  debug_( iConfig.getParameter<bool>("Debug") )
18 {
19  parameters_ = iConfig.getParameter<std::vector<double> >("Parameters");
20  errors_ = iConfig.getParameter<std::vector<double> >("Errors");
21  errorFactors_ = iConfig.getParameter<std::vector<int> >("ErrorFactors");
22 
23  if( (parameters_.size() != errors_.size()) || (parameters_.size() != errorFactors_.size()) ) {
24  std::cout << "Error: parameters and errors have different number of values" << std::endl;
25  exit(1);
26  }
27 
29 
30  sigmaPtVsPt_ = new TProfile("sigmaPtVsPtProfile", "sigmaPtVsPt", ptBins_, ptMin_, ptMax_);
31  sigmaPtVsPtPlusErr_ = new TProfile("sigmaPtVsPtPlusErrProfile", "sigmaPtVsPtPlusErr", ptBins_, ptMin_, ptMax_);
32  sigmaPtVsPtMinusErr_ = new TProfile("sigmaPtVsPtMinusErrProfile", "sigmaPtVsPtMinusErr", ptBins_, ptMin_, ptMax_);
33 
34  sigmaPtVsEta_ = new TProfile("sigmaPtVsEtaProfile", "sigmaPtVsEta", etaBins_, etaMin_, etaMax_);
35  sigmaPtVsEtaPlusErr_ = new TProfile("sigmaPtVsEtaPlusErrProfile", "sigmaPtVsEtaPlusErr", etaBins_, etaMin_, etaMax_);
36  sigmaPtVsEtaMinusErr_ = new TProfile("sigmaPtVsEtaMinusErrProfile", "sigmaPtVsEtaMinusErr", etaBins_, etaMin_, etaMax_);
37 
38  sigmaMassVsPt_ = new TProfile("sigmaMassVsPtProfile", "sigmaMassVsPt", ptBins_, ptMin_, ptMax_);
39  sigmaMassVsPtPlusErr_ = new TProfile("sigmaMassVsPtPlusErrProfile", "sigmaMassVsPtPlusErr", ptBins_, ptMin_, ptMax_);
40  sigmaMassVsPtMinusErr_ = new TProfile("sigmaMassVsPtMinusErrProfile", "sigmaMassVsPtMinusErr", ptBins_, ptMin_, ptMax_);
41 
42  sigmaMassVsEta_ = new TProfile("sigmaMassVsEtaProfile", "sigmaMassVsEta", etaBins_, etaMin_, etaMax_);
43  sigmaMassVsEtaPlusErr_ = new TProfile("sigmaMassVsEtaPlusErrProfile", "sigmaMassVsEtaPlusErr", etaBins_, etaMin_, etaMax_);
44  sigmaMassVsEtaMinusErr_ = new TProfile("sigmaMassVsEtaMinusErrProfile", "sigmaMassVsEtaMinusErr", etaBins_, etaMin_, etaMax_);
45 }
T getParameter(std::string const &) const
TProfile * sigmaMassVsPtPlusErr_
TProfile * sigmaMassVsEta_
std::vector< double > errors_
TProfile * sigmaPtVsPtMinusErr_
TProfile * sigmaMassVsPtMinusErr_
TProfile * sigmaMassVsEtaPlusErr_
TString outputFileName_
TProfile * sigmaPtVsEtaMinusErr_
std::vector< int > errorFactors_
uint32_t maxEvents_
TProfile * sigmaPtVsPtPlusErr_
TProfile * sigmaPtVsPt_
TProfile * sigmaMassVsEtaMinusErr_
TProfile * sigmaMassVsPt_
std::vector< double > parameters_
TString treeFileName_
TProfile * sigmaPtVsEta_
TProfile * sigmaPtVsEtaPlusErr_
ErrorsAnalyzer::~ErrorsAnalyzer ( )
override

Definition at line 62 of file ErrorsAnalyzer.cc.

References drawHistograms(), fillHistograms(), download_sqlite_cfg::outputFile, outputFileName_, sigmaMassVsEta_, sigmaMassVsEtaMinusErr_, sigmaMassVsEtaPlusErr_, sigmaMassVsPt_, sigmaMassVsPtMinusErr_, sigmaMassVsPtPlusErr_, sigmaPtVsEta_, sigmaPtVsEtaMinusErr_, sigmaPtVsEtaPlusErr_, sigmaPtVsPt_, sigmaPtVsPtMinusErr_, and sigmaPtVsPtPlusErr_.

63 {
64  gROOT->SetStyle("Plain");
65 
67 
68  TFile * outputFile = new TFile(outputFileName_, "RECREATE");
69 
72 
75 
76  outputFile->Write();
77  outputFile->Close();
78 }
TProfile * sigmaMassVsPtPlusErr_
TProfile * sigmaMassVsEta_
void drawHistograms(const TProfile *histo, const TProfile *histoPlusErr, const TProfile *histoMinusErr, const TString &type)
TProfile * sigmaPtVsPtMinusErr_
TProfile * sigmaMassVsPtMinusErr_
TProfile * sigmaMassVsEtaPlusErr_
TString outputFileName_
TProfile * sigmaPtVsEtaMinusErr_
TProfile * sigmaPtVsPtPlusErr_
TProfile * sigmaPtVsPt_
TProfile * sigmaMassVsEtaMinusErr_
TProfile * sigmaMassVsPt_
TProfile * sigmaPtVsEta_
TProfile * sigmaPtVsEtaPlusErr_

Member Function Documentation

void ErrorsAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 177 of file ErrorsAnalyzer.cc.

178 {
179 }
void ErrorsAnalyzer::drawHistograms ( const TProfile *  histo,
const TProfile *  histoPlusErr,
const TProfile *  histoMinusErr,
const TString &  type 
)
private

Definition at line 80 of file ErrorsAnalyzer.cc.

References svgfig::canvas(), mps_fire::i, sigmaMassVsEta_, sigmaMassVsEtaMinusErr_, sigmaMassVsEtaPlusErr_, sigmaPtVsEta_, sigmaPtVsEtaMinusErr_, sigmaPtVsEtaPlusErr_, fftjetcommon_cfi::title, and MuonErrorMatrixValues_cff::values.

Referenced by ~ErrorsAnalyzer().

82 {
83  TH1D * sigmaPtVsEtaTH1D = new TH1D(type, type, histo->GetNbinsX(),
84  histo->GetXaxis()->GetXmin(), histo->GetXaxis()->GetXmax());
85  TH1D * sigmaPtVsEtaPlusErrTH1D = new TH1D(type+"PlusErr", type+"PlusErr", histo->GetNbinsX(),
86  histo->GetXaxis()->GetXmin(), histo->GetXaxis()->GetXmax());
87  TH1D * sigmaPtVsEtaMinusErrTH1D = new TH1D(type+"MinusErr", type+"MinusErr", histo->GetNbinsX(),
88  histo->GetXaxis()->GetXmin(), histo->GetXaxis()->GetXmax());
89 
90  TH1D * sigmaMassVsEtaTH1D = new TH1D(type, type, histo->GetNbinsX(),
91  histo->GetXaxis()->GetXmin(), histo->GetXaxis()->GetXmax());
92  TH1D * sigmaMassVsEtaPlusErrTH1D = new TH1D(type+"PlusErr", type+"PlusErr", histo->GetNbinsX(),
93  histo->GetXaxis()->GetXmin(), histo->GetXaxis()->GetXmax());
94  TH1D * sigmaMassVsEtaMinusErrTH1D = new TH1D(type+"MinusErr", type+"MinusErr", histo->GetNbinsX(),
95  histo->GetXaxis()->GetXmin(), histo->GetXaxis()->GetXmax());
96 
97  TCanvas * canvas = new TCanvas("canvas"+type, "canvas"+type, 1000, 800);
98  for( int iBin = 1; iBin <= histo->GetNbinsX(); ++iBin ) {
99  sigmaPtVsEtaTH1D->SetBinContent(iBin, histo->GetBinContent(iBin));
100  sigmaPtVsEtaPlusErrTH1D->SetBinContent(iBin, histoPlusErr->GetBinContent(iBin));
101  sigmaPtVsEtaMinusErrTH1D->SetBinContent(iBin, histoMinusErr->GetBinContent(iBin));
102  }
103  int numBins = sigmaPtVsEtaTH1D->GetNbinsX();
104  // Draw TGraph with asymmetric errors
105  Double_t * values = sigmaPtVsEtaTH1D->GetArray();
106  Double_t * valuesPlus = sigmaPtVsEtaPlusErrTH1D->GetArray();
107  Double_t * valuesMinus = sigmaPtVsEtaMinusErrTH1D->GetArray();
108  double * posErrors = new double[numBins];
109  double * negErrors = new double[numBins];
110 
111  TGraphAsymmErrors * graphAsymmErrors = new TGraphAsymmErrors(sigmaPtVsEtaTH1D);
112  TGraph * graph = new TGraph(sigmaPtVsEtaTH1D);
113 
114  for( int i=1; i<=numBins; ++i ) {
115  // std::cout << "filling " << i << std::endl;
116  posErrors[i-1] = valuesPlus[i] - values[i];
117  if( valuesMinus[i] < 0 ) negErrors[i-1] = values[i];
118  else negErrors[i-1] = values[i] - valuesMinus[i];
119 
120  graphAsymmErrors->SetPointEYlow(i-1, negErrors[i-1]);
121  graphAsymmErrors->SetPointEYhigh(i-1, posErrors[i-1]);
122  }
123 
124  canvas->Draw();
125 
126  delete [] posErrors;
127  delete [] negErrors;
128 
129  graphAsymmErrors->SetTitle("");
130  graphAsymmErrors->SetFillColor(kGray);
131  graphAsymmErrors->Draw("A2");
132  TString title(type);
133  if( type == "Eta" ) title = "#eta";
134  graphAsymmErrors->GetXaxis()->SetTitle(title);
135  graphAsymmErrors->GetYaxis()->SetTitle("#sigmaPt/Pt");
136  graph->Draw();
137 
138  // graph->SetLineColor(kGray);
139  // graph->SetMarkerColor(kBlack);
140  // graph->Draw("AP");
141 
142 // if( debug_ ) {
143 // sigmaPtVsEtaPlusErrTH1D->SetLineColor(kRed);
144 // sigmaPtVsEtaMinusErrTH1D->SetLineColor(kBlue);
145 // }
146 // else {
147 // sigmaPtVsEtaPlusErrTH1D->SetFillColor(kGray);
148 // sigmaPtVsEtaPlusErrTH1D->SetLineColor(kWhite);
149 // sigmaPtVsEtaMinusErrTH1D->SetFillColor(kWhite);
150 // sigmaPtVsEtaMinusErrTH1D->SetLineColor(kWhite);
151 // }
152 // sigmaPtVsEtaPlusErrTH1D->Draw();
153 // sigmaPtVsEtaTH1D->Draw("SAME");
154 // sigmaPtVsEtaMinusErrTH1D->Draw("SAME");
155 
156  sigmaPtVsEtaPlusErrTH1D->Write();
157  sigmaPtVsEtaTH1D->Write();
158  sigmaPtVsEtaMinusErrTH1D->Write();
159 
160  sigmaPtVsEtaPlusErr_->Write();
161  sigmaPtVsEta_->Write();
162  sigmaPtVsEtaMinusErr_->Write();
163 
164  // Mass
165  sigmaMassVsEtaPlusErrTH1D->Write();
166  sigmaMassVsEtaTH1D->Write();
167  sigmaMassVsEtaMinusErrTH1D->Write();
168 
169  sigmaMassVsEtaPlusErr_->Write();
170  sigmaMassVsEta_->Write();
171  sigmaMassVsEtaMinusErr_->Write();
172 
173  canvas->Write();
174 }
type
Definition: HCALResponse.h:21
TProfile * sigmaMassVsEta_
TProfile * sigmaMassVsEtaPlusErr_
TProfile * sigmaPtVsEtaMinusErr_
TProfile * sigmaMassVsEtaMinusErr_
def canvas(sub, attr)
Definition: svgfig.py:482
TProfile * sigmaPtVsEta_
TProfile * sigmaPtVsEtaPlusErr_
void ErrorsAnalyzer::endJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file ErrorsAnalyzer.h.

59 {};
void ErrorsAnalyzer::fillHistograms ( )
private

Definition at line 181 of file ErrorsAnalyzer.cc.

References gather_cfg::cout, MuScleFitUtils::debug, debug_, MuScleFitUtils::debugMassResol_, DEFINE_FWK_MODULE, mps_fire::i, MuScleFitUtils::massResolution(), maxEvents_, parameters_, hiDetachedQuadStep_cff::pt1, hiDetachedQuadStep_cff::pt2, RootTreeHandler::readTree(), MuScleFitUtils::resfind, resolFitType_, MuScleFitUtils::resolutionFunction, resolutionFunctionService(), resolutionFunctionVecService(), sigmaMassVsEta_, sigmaMassVsEtaMinusErr_, sigmaMassVsEtaPlusErr_, sigmaMassVsPt_, sigmaMassVsPtMinusErr_, sigmaMassVsPtPlusErr_, resolutionFunctionBase< T >::sigmaPt(), sigmaPtVsEta_, sigmaPtVsEtaMinusErr_, sigmaPtVsEtaPlusErr_, sigmaPtVsPt_, sigmaPtVsPtMinusErr_, sigmaPtVsPtPlusErr_, treeFileName_, valueMinusError_, and valuePlusError_.

Referenced by ~ErrorsAnalyzer().

182 {
183  std::cout << "Reading muon pairs from Root Tree in " << treeFileName_ << std::endl;
184  RootTreeHandler rootTreeHandler;
185 
186  typedef std::vector<std::pair<lorentzVector,lorentzVector> > MuonPairVector;
187  MuonPairVector savedPair;
188  std::vector<std::pair<unsigned int, unsigned long long> > evtRun;
189  rootTreeHandler.readTree(maxEvents_, treeFileName_, &savedPair, 0, &evtRun);
190  // rootTreeHandler.readTree(maxEvents, inputRootTreeFileName_, &savedPair, &(MuScleFitUtils::genPair));
191 
196  MuScleFitUtils::resfind = std::vector<int>(6, 0);
197 
198  // Loop on all the pairs
199  unsigned int i = 0;
200  MuonPairVector::iterator it = savedPair.begin();
201  std::cout << "Starting loop on " << savedPair.size() << " muons" << std::endl;
202  for( ; it != savedPair.end(); ++it, ++i ) {
203  double pt1 = it->first.pt();
204  double eta1 = it->first.eta();
205  double pt2 = it->second.pt();
206  double eta2 = it->second.eta();
207 
208  if( debug_ ) {
209  std::cout << "pt1 = " << pt1 << ", eta1 = " << eta1 << ", pt2 = " << pt2 << ", eta2 = " << eta2 << std::endl;
210  }
211 
212  if( pt1 == 0 && pt2 == 0 && eta1 == 0 && eta2 == 0 ) continue;
213 
214  double sigmaPt1 = resolutionFunctionForVec->sigmaPt( pt1,eta1,parameters_ );
215  double sigmaPt2 = resolutionFunctionForVec->sigmaPt( pt2,eta2,parameters_ );
216  double sigmaPtPlusErr1 = resolutionFunctionForVec->sigmaPt( pt1,eta1,valuePlusError_ );
217  double sigmaPtPlusErr2 = resolutionFunctionForVec->sigmaPt( pt2,eta2,valuePlusError_ );
218  double sigmaPtMinusErr1 = resolutionFunctionForVec->sigmaPt( pt1,eta1,valueMinusError_ );
219  double sigmaPtMinusErr2 = resolutionFunctionForVec->sigmaPt( pt2,eta2,valueMinusError_ );
220 
221  double sigmaMass = MuScleFitUtils::massResolution( it->first, it->second, parameters_ );
222  double sigmaMassPlusErr = MuScleFitUtils::massResolution( it->first, it->second, valuePlusError_ );
223  double sigmaMassMinusErr = MuScleFitUtils::massResolution( it->first, it->second, valueMinusError_ );
224 
225  if( debug_ ) {
226  std::cout << "sigmaPt1 = " << sigmaPt1 << " + " << sigmaPtPlusErr1 << " - " << sigmaPtMinusErr1 << std::endl;
227  std::cout << "sigmaPt2 = " << sigmaPt2 << " + " << sigmaPtPlusErr2 << " - " << sigmaPtMinusErr2 << std::endl;
228  std::cout << "sigmaMass = " << sigmaMass << " + " << sigmaMassPlusErr << " - " << sigmaMassMinusErr << std::endl;
229  }
230 
231  // Protections from nans
232  if( pt1 != pt1 ) continue;
233  if( pt2 != pt2 ) continue;
234  if( eta1 != eta1 ) continue;
235  if( eta2 != eta2 ) continue;
236  if( sigmaPt1 != sigmaPt1 ) continue;
237  if( sigmaPt2 != sigmaPt2 ) continue;
238  if( sigmaPtPlusErr1 != sigmaPtPlusErr1 ) continue;
239  if( sigmaPtPlusErr2 != sigmaPtPlusErr2 ) continue;
240  if( sigmaPtMinusErr1 != sigmaPtMinusErr1 ) continue;
241  if( sigmaPtMinusErr2 != sigmaPtMinusErr2 ) continue;
242  if( sigmaMass != sigmaMass ) continue;
243  if( sigmaMassPlusErr != sigmaMassPlusErr ) continue;
244  if( sigmaMassMinusErr != sigmaMassMinusErr ) continue;
245 
246  std::cout << "Muon pair number " << i << std::endl;
247 
248  // std::cout << "sigmaPt1 = " << sigmaPt1 << ", sigmaPt2 = " << sigmaPt2 << std::endl;
249  // std::cout << "sigmaPtPlusErr1 = " << sigmaPtPlusErr1 << ", sigmaPtMinusErr2 = " << sigmaPtMinusErr2 << std::endl;
250  // std::cout << "sigmaPtMinusErr1 = " << sigmaPtPlusErr1 << ", sigmaPtMinusErr2 = " << sigmaPtMinusErr2 << std::endl;
251 
252  sigmaPtVsPt_->Fill(pt1, sigmaPt1);
253  sigmaPtVsPt_->Fill(pt2, sigmaPt2);
254  sigmaPtVsPtPlusErr_->Fill(pt1, sigmaPtPlusErr1);
255  sigmaPtVsPtPlusErr_->Fill(pt2, sigmaPtPlusErr2);
256  sigmaPtVsPtMinusErr_->Fill(pt1, sigmaPtMinusErr1);
257  sigmaPtVsPtMinusErr_->Fill(pt2, sigmaPtMinusErr2);
258 
259  sigmaPtVsEta_->Fill(eta1, sigmaPt1);
260  sigmaPtVsEta_->Fill(eta2, sigmaPt2);
261  sigmaPtVsEtaPlusErr_->Fill(eta1, sigmaPtPlusErr1);
262  sigmaPtVsEtaPlusErr_->Fill(eta2, sigmaPtPlusErr2);
263  sigmaPtVsEtaMinusErr_->Fill(eta1, sigmaPtMinusErr1);
264  sigmaPtVsEtaMinusErr_->Fill(eta2, sigmaPtMinusErr2);
265 
266 
267  sigmaMassVsPt_->Fill(pt1, sigmaMass);
268  sigmaMassVsPt_->Fill(pt2, sigmaMass);
269  sigmaMassVsPtPlusErr_->Fill(pt1, sigmaMassPlusErr);
270  sigmaMassVsPtPlusErr_->Fill(pt2, sigmaMassPlusErr);
271  sigmaMassVsPtMinusErr_->Fill(pt1, sigmaMassMinusErr);
272  sigmaMassVsPtMinusErr_->Fill(pt2, sigmaMassMinusErr);
273 
274  sigmaMassVsEta_->Fill(eta1, sigmaMass);
275  sigmaMassVsEta_->Fill(eta2, sigmaMass);
276  sigmaMassVsEtaPlusErr_->Fill(eta1, sigmaMassPlusErr);
277  sigmaMassVsEtaPlusErr_->Fill(eta2, sigmaMassPlusErr);
278  sigmaMassVsEtaMinusErr_->Fill(eta1, sigmaMassMinusErr);
279  sigmaMassVsEtaMinusErr_->Fill(eta2, sigmaMassMinusErr);
280  }
281 }
TProfile * sigmaMassVsPtPlusErr_
TProfile * sigmaMassVsEta_
std::vector< double > valueMinusError_
TProfile * sigmaPtVsPtMinusErr_
TProfile * sigmaMassVsPtMinusErr_
static bool debugMassResol_
TProfile * sigmaMassVsEtaPlusErr_
static int debug
void readTree(const int maxEvents, const TString &fileName, MuonPairVector *savedPair, const int muonType, std::vector< std::pair< unsigned int, unsigned long long > > *evtRun, MuonPairVector *genPair=nullptr)
TProfile * sigmaPtVsEtaMinusErr_
virtual double sigmaPt(const double &pt, const double &eta, const T &parval)=0
resolutionFunctionBase< std::vector< double > > * resolutionFunctionVecService(const int identifier)
Service to build the resolution functor corresponding to the passed identifier when receiving a std::...
Definition: Functions.cc:50
static double massResolution(const lorentzVector &mu1, const lorentzVector &mu2)
std::vector< std::pair< lorentzVector, lorentzVector > > MuonPairVector
uint32_t maxEvents_
std::vector< double > valuePlusError_
TProfile * sigmaPtVsPtPlusErr_
TProfile * sigmaPtVsPt_
TProfile * sigmaMassVsEtaMinusErr_
TProfile * sigmaMassVsPt_
resolutionFunctionBase< double * > * resolutionFunctionService(const int identifier)
Service to build the resolution functor corresponding to the passed identifier.
Definition: Functions.cc:38
std::vector< double > parameters_
static std::vector< int > resfind
TString treeFileName_
TProfile * sigmaPtVsEta_
TProfile * sigmaPtVsEtaPlusErr_
static resolutionFunctionBase< double * > * resolutionFunction
void ErrorsAnalyzer::fillValueError ( )
private

Definition at line 47 of file ErrorsAnalyzer.cc.

References errorFactors_, errors_, mps_fire::i, parameters_, valueMinusError_, and valuePlusError_.

Referenced by ErrorsAnalyzer().

48 {
49  valuePlusError_.resize(parameters_.size());
50  valueMinusError_.resize(parameters_.size());
51 
52  std::vector<double>::const_iterator parIt = parameters_.begin();
53  std::vector<double>::const_iterator errIt = errors_.begin();
54  std::vector<int>::const_iterator errFactorIt = errorFactors_.begin();
55  int i=0;
56  for( ; parIt != parameters_.end(); ++parIt, ++errIt, ++errFactorIt, ++i ) {
57  valuePlusError_[i] = *parIt + (*errIt)*(*errFactorIt);
58  valueMinusError_[i] = *parIt - (*errIt)*(*errFactorIt);
59  }
60 }
std::vector< double > valueMinusError_
std::vector< double > errors_
std::vector< int > errorFactors_
std::vector< double > valuePlusError_
std::vector< double > parameters_

Member Data Documentation

bool ErrorsAnalyzer::debug_
private

Definition at line 71 of file ErrorsAnalyzer.h.

Referenced by fillHistograms().

std::vector<int> ErrorsAnalyzer::errorFactors_
private

Definition at line 75 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer(), and fillValueError().

std::vector<double> ErrorsAnalyzer::errors_
private

Definition at line 74 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer(), and fillValueError().

int ErrorsAnalyzer::etaBins_
private

Definition at line 68 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer().

double ErrorsAnalyzer::etaMax_
private

Definition at line 70 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer().

double ErrorsAnalyzer::etaMin_
private

Definition at line 69 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer().

uint32_t ErrorsAnalyzer::maxEvents_
private

Definition at line 63 of file ErrorsAnalyzer.h.

Referenced by fillHistograms().

TString ErrorsAnalyzer::outputFileName_
private

Definition at line 64 of file ErrorsAnalyzer.h.

Referenced by ~ErrorsAnalyzer().

std::vector<double> ErrorsAnalyzer::parameters_
private
int ErrorsAnalyzer::ptBins_
private

Definition at line 65 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer().

double ErrorsAnalyzer::ptMax_
private

Definition at line 67 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer().

double ErrorsAnalyzer::ptMin_
private

Definition at line 66 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer().

int ErrorsAnalyzer::resolFitType_
private

Definition at line 62 of file ErrorsAnalyzer.h.

Referenced by fillHistograms().

TProfile* ErrorsAnalyzer::sigmaMassVsEta_
private

Definition at line 89 of file ErrorsAnalyzer.h.

Referenced by drawHistograms(), ErrorsAnalyzer(), fillHistograms(), and ~ErrorsAnalyzer().

TProfile* ErrorsAnalyzer::sigmaMassVsEtaMinusErr_
private

Definition at line 91 of file ErrorsAnalyzer.h.

Referenced by drawHistograms(), ErrorsAnalyzer(), fillHistograms(), and ~ErrorsAnalyzer().

TProfile* ErrorsAnalyzer::sigmaMassVsEtaPlusErr_
private

Definition at line 90 of file ErrorsAnalyzer.h.

Referenced by drawHistograms(), ErrorsAnalyzer(), fillHistograms(), and ~ErrorsAnalyzer().

TProfile* ErrorsAnalyzer::sigmaMassVsPt_
private

Definition at line 93 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer(), fillHistograms(), and ~ErrorsAnalyzer().

TProfile* ErrorsAnalyzer::sigmaMassVsPtMinusErr_
private

Definition at line 95 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer(), fillHistograms(), and ~ErrorsAnalyzer().

TProfile* ErrorsAnalyzer::sigmaMassVsPtPlusErr_
private

Definition at line 94 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer(), fillHistograms(), and ~ErrorsAnalyzer().

TProfile* ErrorsAnalyzer::sigmaPtVsEta_
private

Definition at line 80 of file ErrorsAnalyzer.h.

Referenced by drawHistograms(), ErrorsAnalyzer(), fillHistograms(), and ~ErrorsAnalyzer().

TProfile* ErrorsAnalyzer::sigmaPtVsEtaMinusErr_
private

Definition at line 82 of file ErrorsAnalyzer.h.

Referenced by drawHistograms(), ErrorsAnalyzer(), fillHistograms(), and ~ErrorsAnalyzer().

TProfile* ErrorsAnalyzer::sigmaPtVsEtaPlusErr_
private

Definition at line 81 of file ErrorsAnalyzer.h.

Referenced by drawHistograms(), ErrorsAnalyzer(), fillHistograms(), and ~ErrorsAnalyzer().

TProfile* ErrorsAnalyzer::sigmaPtVsPt_
private

Definition at line 84 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer(), fillHistograms(), and ~ErrorsAnalyzer().

TProfile* ErrorsAnalyzer::sigmaPtVsPtMinusErr_
private

Definition at line 86 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer(), fillHistograms(), and ~ErrorsAnalyzer().

TProfile* ErrorsAnalyzer::sigmaPtVsPtPlusErr_
private

Definition at line 85 of file ErrorsAnalyzer.h.

Referenced by ErrorsAnalyzer(), fillHistograms(), and ~ErrorsAnalyzer().

TString ErrorsAnalyzer::treeFileName_
private

Definition at line 59 of file ErrorsAnalyzer.h.

Referenced by fillHistograms().

std::vector<double> ErrorsAnalyzer::valueMinusError_
private

Definition at line 78 of file ErrorsAnalyzer.h.

Referenced by fillHistograms(), and fillValueError().

std::vector<double> ErrorsAnalyzer::valuePlusError_
private

Definition at line 77 of file ErrorsAnalyzer.h.

Referenced by fillHistograms(), and fillValueError().