CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ResolutionCreator Class Reference
Inheritance diagram for ResolutionCreator:
edm::EDAnalyzer

Public Member Functions

 ResolutionCreator (const edm::ParameterSet &)
 
 ~ResolutionCreator ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 

Private Attributes

std::vector< double > etabinVals_
 
int etanrbins
 
TF1 * fResEtaBin [10][20]
 
TF1 * fResPtEtaBin [10][20][20]
 
TH1F * hResEtaBin [10][20]
 
TH1F * hResPtEtaBin [10][20][20]
 
std::string labelName_
 
int matchingAlgo_
 
double maxDist_
 
double minDR_
 
int nrFilled
 
std::string objectType_
 
std::vector< double > pTbinVals_
 
int ptnrbins
 
TTree * tResVar
 
bool useDeltaR_
 
bool useMaxDist_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 38 of file ResolutionCreator.cc.

Constructor & Destructor Documentation

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

Definition at line 71 of file ResolutionCreator.cc.

References etabinVals_, edm::ParameterSet::getParameter(), labelName_, minDR_, nrFilled, objectType_, and pTbinVals_.

72 {
73  // input parameters
74  objectType_ = iConfig.getParameter< std::string > ("object");
75  labelName_ = iConfig.getParameter< std::string > ("label");
76  if(objectType_ != "met"){
77  etabinVals_ = iConfig.getParameter< std::vector<double> > ("etabinValues");
78  }
79  pTbinVals_ = iConfig.getParameter< std::vector<double> > ("pTbinValues");
80  minDR_ = iConfig.getParameter< double > ("minMatchingDR");
81 
82  nrFilled = 0;
83 
84 }
T getParameter(std::string const &) const
std::vector< double > etabinVals_
std::vector< double > pTbinVals_
ResolutionCreator::~ResolutionCreator ( )

Definition at line 87 of file ResolutionCreator.cc.

88 {
89 }

Member Function Documentation

void ResolutionCreator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 98 of file ResolutionCreator.cc.

References abs, b, bgen, alignCSCRings::e, HI_PhotonSkim_cff::electrons, reco::LeafCandidate::energy(), etabinVals_, etanrbins, HcalObjRepresent::Fill(), TtGenEvtProducer_cfi::genEvt, edm::Event::getByLabel(), hResPtEtaBin, j, fwrapper::jets, labelName_, m, minDR_, reco::CompositeRefCandidateT< D >::mother(), reco::Candidate::mother(), patZpeak::muons, nrFilled, reco::CompositeRefCandidateT< D >::numberOfMothers(), reco::Candidate::numberOfMothers(), objectType_, AlCaHLTBitMon_ParallelJobs::p, reco::LeafCandidate::p4(), reco::Candidate::pdgId(), reco::LeafCandidate::pdgId(), hitfit::phidiff(), pTbinVals_, reco::LeafCandidate::status(), and metsig::tau.

99 {
100 
101  // Get the gen and cal object fourvector
102  std::vector<reco::Particle *> p4gen, p4rec;
103 
105  iEvent.getByLabel ("genEvt",genEvt);
106 
107  if(genEvt->particles().size()<10) return;
108 
109  if(objectType_ == "electron"){
110  edm::Handle<std::vector<pat::Electron> > electrons; //to calculate the ResolutionCreator for the electrons, i used the TopElectron instead of the AOD information
111  iEvent.getByLabel(labelName_,electrons);
112  for(size_t e=0; e<electrons->size(); e++) {
113  for(size_t p=0; p<genEvt->particles().size(); p++){
114  if( (std::abs(genEvt->particles()[p].pdgId()) == 11) && (ROOT::Math::VectorUtil::DeltaR(genEvt->particles()[p].p4(), (*electrons)[e].p4()) < minDR_) ) {
115  //p4gen.push_back(new reco::Particle(genEvt->particles()[p]));
116  //p4rec.push_back(new reco::Particle((pat::Electron)((*electrons)[e])));
117  }
118  }
119  }
120  }
121  else if(objectType_ == "muon"){
123  iEvent.getByLabel(labelName_,muons);
124  for(size_t m=0; m<muons->size(); m++) {
125  for(size_t p=0; p<genEvt->particles().size(); p++){
126  if( (std::abs(genEvt->particles()[p].pdgId()) == 13) && (ROOT::Math::VectorUtil::DeltaR(genEvt->particles()[p].p4(), (*muons)[m].p4()) < minDR_) ) {
127  //p4gen.push_back(new reco::Particle(genEvt->particles()[p]));
128  //p4rec.push_back(new reco::Particle((pat::Muon)((*muons)[m])));
129  }
130  }
131  }
132  }
133  else if(objectType_ == "lJets" ){
135  iEvent.getByLabel(labelName_,jets);
136  if(jets->size()>=4) {
137  for(unsigned int j = 0; j<4; j++){
138  for(size_t p=0; p<genEvt->particles().size(); p++){
139  if( (std::abs(genEvt->particles()[p].pdgId()) < 5) && (ROOT::Math::VectorUtil::DeltaR(genEvt->particles()[p].p4(), (*jets)[j].p4())< minDR_) ){
140  //p4gen.push_back(new reco::Particle(genEvt->particles()[p]));
141  //p4rec.push_back(new reco::Particle((pat::Jet)(*jets)[j]));
142  }
143  }
144  }
145  }
146  }
147  else if(objectType_ == "bJets" ){
149  iEvent.getByLabel(labelName_,jets);
150  if(jets->size()>=4) {
151  for(unsigned int j = 0; j<4; j++){
152  for(size_t p=0; p<genEvt->particles().size(); p++){
153  if( (std::abs(genEvt->particles()[p].pdgId()) == 5) && (ROOT::Math::VectorUtil::DeltaR(genEvt->particles()[p].p4(), (*jets)[j].p4())< minDR_) ) {
154  //p4gen.push_back(new reco::Particle(genEvt->particles()[p]));
155  //p4rec.push_back(new reco::Particle((pat::Jet)(*jets)[j]));
156  }
157  }
158  }
159  }
160  }
161  else if(objectType_ == "met"){
163  iEvent.getByLabel(labelName_,mets);
164  if(mets->size()>=1) {
165  if( genEvt->isSemiLeptonic() && genEvt->singleNeutrino() != 0 && ROOT::Math::VectorUtil::DeltaR(genEvt->singleNeutrino()->p4(), (*mets)[0].p4()) < minDR_) {
166  //p4gen.push_back(new reco::Particle(0,genEvt->singleNeutrino()->p4(),math::XYZPoint()));
167  //p4rec.push_back(new reco::Particle((pat::MET)((*mets)[0])));
168  }
169  }
170  }
171  else if(objectType_ == "tau"){
173  iEvent.getByLabel(labelName_,taus);
174  for(std::vector<pat::Tau>::const_iterator tau = taus->begin(); tau != taus->end(); ++tau) {
175  // find the tau (if any) that matches a MC tau from W
176  reco::GenParticle genLepton = *(tau->genLepton());
177  if( std::abs(genLepton.pdgId())==15 && genLepton.status()==2 &&
178  genLepton.numberOfMothers()>0 &&
179  std::abs(genLepton.mother(0)->pdgId())==15 &&
180  genLepton.mother(0)->numberOfMothers()>0 &&
181  std::abs(genLepton.mother(0)->mother(0)->pdgId())==24 &&
182  ROOT::Math::VectorUtil::DeltaR(genLepton.p4(), tau->p4()) < minDR_ ) {
183  }
184  //p4gen.push_back(new reco::Particle(genLepton));
185  //p4rec.push_back(new reco::Particle(*tau));
186  }
187  }
188  // Fill the object's value
189  for(unsigned m=0; m<p4gen.size(); m++){
190  double Egen = p4gen[m]->energy();
191  double Thetagen = p4gen[m]->theta();
192  double Phigen = p4gen[m]->phi();
193  double Etgen = p4gen[m]->et();
194  double Etagen = p4gen[m]->eta();
195  double Ecal = p4rec[m]->energy();
196  double Thetacal = p4rec[m]->theta();
197  double Phical = p4rec[m]->phi();
198  double Etcal = p4rec[m]->et();
199  double Etacal = p4rec[m]->eta();
200  double phidiff = Phical- Phigen;
201  if(phidiff>3.14159) phidiff = 2.*3.14159 - phidiff;
202  if(phidiff<-3.14159) phidiff = -phidiff - 2.*3.14159;
203 
204  // find eta and et bin
205  int etabin = 0;
206  if(etanrbins > 1){
207  for(unsigned int b=0; b<etabinVals_.size()-1; b++) {
208  if(fabs(Etacal) > etabinVals_[b]) etabin = b;
209  }
210  }
211 
212  int ptbin = 0;
213  for(unsigned int b=0; b<pTbinVals_.size()-1; b++) {
214  if(p4rec[m]->pt() > pTbinVals_[b]) ptbin = b;
215  }
216 
217  // calculate the resolution on "a", "b", "c" & "d" according to the definition (CMS-NOTE-2006-023):
218  // p = a*|p_meas|*u_1 + b*u_2 + c*u_3
219  // E(fit) = E_meas * d
220  //
221  // with u_1 = p/|p_meas|
222  // u_3 = (u_z x u_1)/|u_z x u_1|
223  // u_2 = (u_1 x u_3)/|u_1 x u_3|
224  //
225  // The initial parameters values are chosen like (a, b, c, d) = (1., 0., 0., 1.)
226 
227  // 1/ calculate the unitary vectors of the basis u_1, u_2, u_3
228  ROOT::Math::SVector<double,3> pcalvec(p4rec[m]->px(),p4rec[m]->py(),p4rec[m]->pz());
229  ROOT::Math::SVector<double,3> pgenvec(p4gen[m]->px(),p4gen[m]->py(),p4gen[m]->pz());
230 
231  ROOT::Math::SVector<double,3> u_z(0,0,1);
232  ROOT::Math::SVector<double,3> u_1 = ROOT::Math::Unit(pcalvec);
233  ROOT::Math::SVector<double,3> u_3 = ROOT::Math::Cross(u_z,u_1)/ROOT::Math::Mag(ROOT::Math::Cross(u_z,u_1));
234  ROOT::Math::SVector<double,3> u_2 = ROOT::Math::Cross(u_1,u_3)/ROOT::Math::Mag(ROOT::Math::Cross(u_1,u_3));
235  double acal = 1.;
236  double bcal = 0.;
237  double ccal = 0.;
238  double dcal = 1.;
239  double agen = ROOT::Math::Dot(pgenvec,u_1)/ROOT::Math::Mag(pcalvec);
240  double bgen = ROOT::Math::Dot(pgenvec,u_2);
241  double cgen = ROOT::Math::Dot(pgenvec,u_3);
242  double dgen = Egen/Ecal;
243 
244  //fill histograms
245  ++nrFilled;
246  hResPtEtaBin[0][etabin][ptbin] -> Fill(acal-agen);
247  hResPtEtaBin[1][etabin][ptbin] -> Fill(bcal-bgen);
248  hResPtEtaBin[2][etabin][ptbin] -> Fill(ccal-cgen);
249  hResPtEtaBin[3][etabin][ptbin] -> Fill(dcal-dgen);
250  hResPtEtaBin[4][etabin][ptbin] -> Fill(Thetacal-Thetagen);
251  hResPtEtaBin[5][etabin][ptbin] -> Fill(phidiff);
252  hResPtEtaBin[6][etabin][ptbin] -> Fill(Etcal-Etgen);
253  hResPtEtaBin[7][etabin][ptbin] -> Fill(Etacal-Etagen);
254 
255  delete p4gen[m];
256  delete p4rec[m];
257  }
258 
259 }
virtual int pdgId() const
PDG identifier.
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
virtual int status() const
status word
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
#define abs(x)
Definition: mlp_lapack.h:159
double phidiff(double phi)
Normalized difference in azimuthal angles to a range between .
Definition: fourvec.cc:231
double bgen
Definition: HydjetWrapper.h:43
virtual double energy() const
energy
std::vector< double > etabinVals_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
virtual size_t numberOfMothers() const
number of mothers
vector< PseudoJet > jets
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual int pdgId() const =0
PDG identifier.
TH1F * hResPtEtaBin[10][20][20]
double b
Definition: hdecay.h:120
tuple muons
Definition: patZpeak.py:38
std::vector< double > pTbinVals_
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
virtual const Candidate * mother(size_type=0) const
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
void ResolutionCreator::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 264 of file ResolutionCreator.cc.

References b, edm::errors::Configuration, etabinVals_, etanrbins, edm::hlt::Exception, fResEtaBin, fResPtEtaBin, hResEtaBin, hResPtEtaBin, TFileDirectory::make(), objectType_, pTbinVals_, ptnrbins, and tResVar.

265 {
267  if (!fs) throw edm::Exception(edm::errors::Configuration, "TFileService missing from configuration!");
268 
269  // input constants
270  TString resObsName[8] = {"_ares","_bres","_cres","_dres","_thres","_phres","_etres","_etares"};
271  int resObsNrBins = 120;
272  if( (objectType_ == "muon") || (objectType_ == "electron") ) resObsNrBins = 80;
273  std::vector<double> resObsMin, resObsMax;
274  if(objectType_ == "electron"){
275  resObsMin.push_back(-0.15); resObsMin.push_back(-0.2); resObsMin.push_back(-0.1); resObsMin.push_back(-0.15); resObsMin.push_back(-0.0012); resObsMin.push_back(-0.009); resObsMin.push_back(-16); resObsMin.push_back(-0.0012);
276  resObsMax.push_back( 0.15); resObsMax.push_back( 0.2); resObsMax.push_back( 0.1); resObsMax.push_back( 0.15); resObsMax.push_back( 0.0012); resObsMax.push_back( 0.009); resObsMax.push_back( 16); resObsMax.push_back( 0.0012);
277  } else if(objectType_ == "muon"){
278  resObsMin.push_back(-0.15); resObsMin.push_back(-0.1); resObsMin.push_back(-0.05); resObsMin.push_back(-0.15); resObsMin.push_back(-0.004); resObsMin.push_back(-0.003); resObsMin.push_back(-8); resObsMin.push_back(-0.004);
279  resObsMax.push_back( 0.15); resObsMax.push_back( 0.1); resObsMax.push_back( 0.05); resObsMax.push_back( 0.15); resObsMax.push_back( 0.004); resObsMax.push_back( 0.003); resObsMax.push_back( 8); resObsMax.push_back( 0.004);
280  } else if(objectType_ == "tau"){
281  resObsMin.push_back(-1.); resObsMin.push_back(-10.); resObsMin.push_back(-10); resObsMin.push_back(-1.); resObsMin.push_back(-0.1); resObsMin.push_back(-0.1); resObsMin.push_back(-80); resObsMin.push_back(-0.1);
282  resObsMax.push_back( 1.); resObsMax.push_back( 10.); resObsMax.push_back( 10); resObsMax.push_back( 1.); resObsMax.push_back( 0.1); resObsMax.push_back( 0.1); resObsMax.push_back( 50); resObsMax.push_back( 0.1);
283  } else if(objectType_ == "lJets" || objectType_ == "bJets"){
284  resObsMin.push_back(-1.); resObsMin.push_back(-10.); resObsMin.push_back(-10.); resObsMin.push_back(-1.); resObsMin.push_back(-0.4); resObsMin.push_back(-0.6); resObsMin.push_back( -80); resObsMin.push_back(-0.6);
285  resObsMax.push_back( 1.); resObsMax.push_back( 10.); resObsMax.push_back( 10.); resObsMax.push_back( 1.); resObsMax.push_back( 0.4); resObsMax.push_back( 0.6); resObsMax.push_back( 80); resObsMax.push_back( 0.6);
286  } else{
287  resObsMin.push_back(-2.); resObsMin.push_back(-150.); resObsMin.push_back(-150.); resObsMin.push_back(-2.); resObsMin.push_back(-6); resObsMin.push_back(-6); resObsMin.push_back( -180); resObsMin.push_back(-6);
288  resObsMax.push_back( 3.); resObsMax.push_back( 150.); resObsMax.push_back( 150.); resObsMax.push_back( 3.); resObsMax.push_back( 6); resObsMax.push_back( 6); resObsMax.push_back( 180); resObsMax.push_back( 6);
289  }
290 
291  const char* resObsVsPtFit[8] = { "[0]+[1]*exp(-[2]*x)",
292  "[0]+[1]*exp(-[2]*x)",
293  "[0]+[1]*exp(-[2]*x)",
294  "[0]+[1]*exp(-[2]*x)",
295  "[0]+[1]*exp(-[2]*x)",
296  "[0]+[1]*exp(-[2]*x)",
297  "pol1",
298  "[0]+[1]*exp(-[2]*x)"
299  };
300 
301  ptnrbins = pTbinVals_.size()-1;
302  double *ptbins = new double[pTbinVals_.size()];
303  for(unsigned int b=0; b<pTbinVals_.size(); b++) ptbins[b] = pTbinVals_[b];
304  double *etabins;
305  if(objectType_ != "met"){
306  etanrbins = etabinVals_.size()-1;
307  etabins = new double[etabinVals_.size()];
308  for(unsigned int b=0; b<etabinVals_.size(); b++) etabins[b] = etabinVals_[b];
309  }else{
310  etanrbins = 1;
311  etabins = new double[2];
312  etabins[0] = 0; etabins[1] = 5.;
313  }
314 
315 
316  //define the histograms booked
317  for(Int_t ro=0; ro<8; ro++) {
318  for(Int_t etab=0; etab<etanrbins; etab++) {
319  for(Int_t ptb=0; ptb<ptnrbins; ptb++) {
320  TString obsName = objectType_; obsName += resObsName[ro]; obsName += "_etabin"; obsName += etab; obsName += "_ptbin";
321  obsName += ptb;
322  hResPtEtaBin[ro][etab][ptb] = fs->make<TH1F>(obsName,obsName,resObsNrBins,resObsMin[ro],resObsMax[ro]);
323  fResPtEtaBin[ro][etab][ptb] = fs->make<TF1>("F_"+obsName,"gaus");
324  }
325  TString obsName2 = objectType_; obsName2 += resObsName[ro]; obsName2 += "_etabin"; obsName2 += etab;
326  hResEtaBin[ro][etab] = fs->make<TH1F>(obsName2,obsName2,ptnrbins,ptbins);
327  fResEtaBin[ro][etab] = fs->make<TF1>("F_"+obsName2,resObsVsPtFit[ro],pTbinVals_[0],pTbinVals_[pTbinVals_.size()-1]);
328  }
329  }
330  tResVar = fs->make< TTree >("tResVar","Resolution tree");
331 
332  delete [] etabins;
333  delete [] ptbins;
334 
335 }
TF1 * fResEtaBin[10][20]
std::vector< double > etabinVals_
TH1F * hResEtaBin[10][20]
TF1 * fResPtEtaBin[10][20][20]
TH1F * hResPtEtaBin[10][20][20]
double b
Definition: hdecay.h:120
T * make() const
make new ROOT object
std::vector< double > pTbinVals_
void ResolutionCreator::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 339 of file ResolutionCreator.cc.

References error, eta(), etabinVals_, etanrbins, fResEtaBin, fResPtEtaBin, hResEtaBin, hResPtEtaBin, nrFilled, objectType_, pTbinVals_, ptnrbins, tResVar, and relativeConstraints::value.

339  {
340  TString resObsName2[8] = {"a","b","c","d","theta","phi","et","eta"};
341  Int_t ro=0;
342  Double_t pt=0.;
343  Double_t eta=0.;
344  Double_t value,error;
345 
346  tResVar->Branch("Pt",&pt,"Pt/D");
347  tResVar->Branch("Eta",&eta,"Eta/D");
348  tResVar->Branch("ro",&ro,"ro/I");
349  tResVar->Branch("value",&value,"value/D");
350  tResVar->Branch("error",&error,"error/D");
351 
352  for(ro=0; ro<8; ro++) {
353  for(int etab=0; etab<etanrbins; etab++) {
354  //CD set eta at the center of the bin
355  eta = etanrbins > 1 ? (etabinVals_[etab]+etabinVals_[etab+1])/2. : 2.5 ;
356  for(int ptb=0; ptb<ptnrbins; ptb++) {
357  //CD set pt at the center of the bin
358  pt = (pTbinVals_[ptb]+pTbinVals_[ptb+1])/2.;
359  double maxcontent = 0.;
360  int maxbin = 0;
361  for(int nb=1; nb<hResPtEtaBin[ro][etab][ptb]->GetNbinsX(); nb ++){
362  if (hResPtEtaBin[ro][etab][ptb]->GetBinContent(nb)>maxcontent) {
363  maxcontent = hResPtEtaBin[ro][etab][ptb]->GetBinContent(nb);
364  maxbin = nb;
365  }
366  }
367  int range = (int)(hResPtEtaBin[ro][etab][ptb]->GetNbinsX()/6); //in order that ~1/3 of X-axis range is fitted
368  fResPtEtaBin[ro][etab][ptb] -> SetRange(hResPtEtaBin[ro][etab][ptb]->GetBinCenter(maxbin-range),
369  hResPtEtaBin[ro][etab][ptb]->GetBinCenter(maxbin+range));
370  fResPtEtaBin[ro][etab][ptb] -> SetParameters(hResPtEtaBin[ro][etab][ptb] -> GetMaximum(),
371  hResPtEtaBin[ro][etab][ptb] -> GetMean(),
372  hResPtEtaBin[ro][etab][ptb] -> GetRMS());
373  hResPtEtaBin[ro][etab][ptb] -> Fit(fResPtEtaBin[ro][etab][ptb]->GetName(),"RQ");
374  hResEtaBin[ro][etab] -> SetBinContent(ptb+1,fResPtEtaBin[ro][etab][ptb]->GetParameter(2));
375  hResEtaBin[ro][etab] -> SetBinError(ptb+1,fResPtEtaBin[ro][etab][ptb]->GetParError(2));
376  //CD: Fill the tree
377  value = fResPtEtaBin[ro][etab][ptb]->GetParameter(2); //parameter value
378  error = fResPtEtaBin[ro][etab][ptb]->GetParError(2); //parameter error
379  tResVar->Fill();
380  }
381  //CD: add a fake entry in pt=0 for the NN training
382  // for that, use a linear extrapolation.
383  pt = 0.;
384  value = ((pTbinVals_[0]+pTbinVals_[1])/2.)*(fResPtEtaBin[ro][etab][0]->GetParameter(2)-fResPtEtaBin[ro][etab][1]->GetParameter(2))/((pTbinVals_[2]-pTbinVals_[0])/2.)+fResPtEtaBin[ro][etab][0]->GetParameter(2);
385  error = fResPtEtaBin[ro][etab][0]->GetParError(2)+fResPtEtaBin[ro][etab][1]->GetParError(2);
386  tResVar->Fill();
387  // standard fit
388  hResEtaBin[ro][etab] -> Fit(fResEtaBin[ro][etab]->GetName(),"RQ");
389  }
390  }
391  if(objectType_ == "lJets" && nrFilled == 0) edm::LogProblem ("SummaryError") << "No plots filled for light jets \n";
392  if(objectType_ == "bJets" && nrFilled == 0) edm::LogProblem ("SummaryError") << "No plots filled for bjets \n";
393  if(objectType_ == "muon" && nrFilled == 0) edm::LogProblem ("SummaryError") << "No plots filled for muons \n";
394  if(objectType_ == "electron" && nrFilled == 0) edm::LogProblem ("SummaryError") << "No plots filled for electrons \n";
395  if(objectType_ == "tau" && nrFilled == 0) edm::LogProblem ("SummaryError") << "No plots filled for taus \n";
396  if(objectType_ == "met" && nrFilled == 0) edm::LogProblem ("SummaryError") << "No plots filled for met \n";
397 
398  edm::LogVerbatim ("MainResults") << " \n\n";
399  edm::LogVerbatim ("MainResults") << " ----------------------------------------------";
400  edm::LogVerbatim ("MainResults") << " ----------------------------------------------";
401  edm::LogVerbatim ("MainResults") << " Resolutions on "<< objectType_ << " with nrfilled: "<<nrFilled;
402  edm::LogVerbatim ("MainResults") << " ----------------------------------------------";
403  edm::LogVerbatim ("MainResults") << " ----------------------------------------------";
404  if(nrFilled != 0 && objectType_ != "met") {
405  for(ro=0; ro<8; ro++) {
406  edm::LogVerbatim ("MainResults") << "-------------------- ";
407  edm::LogVerbatim ("MainResults") << "\n Resolutions on " << resObsName2[ro] << "\n";
408  edm::LogVerbatim ("MainResults") << "-------------------- ";
409  for(int etab=0; etab<etanrbins; etab++) {
410  if(nrFilled != 0 && ro != 6) {
411  if(etab == 0){
412  edm::LogVerbatim ("MainResults") << "if(fabs(eta)<"<<etabinVals_[etab+1] <<") res = " <<
413  fResEtaBin[ro][etab]->GetParameter(0) << "+" << fResEtaBin[ro][etab]->GetParameter(1)
414  << "*exp(-(" <<fResEtaBin[ro][etab]->GetParameter(2) << "*pt));";
415  }else{
416  edm::LogVerbatim ("MainResults") << "else if(fabs(eta)<"<<etabinVals_[etab+1] <<") res = " <<
417  fResEtaBin[ro][etab]->GetParameter(0) << "+" << fResEtaBin[ro][etab]->GetParameter(1)
418  << "*exp(-(" <<fResEtaBin[ro][etab]->GetParameter(2) << "*pt));";
419  }
420  }else if(nrFilled != 0 && ro == 6){
421  if(etab == 0){
422  edm::LogVerbatim ("MainResults") << "if(fabs(eta)<"<<etabinVals_[etab+1] <<") res = " <<
423  fResEtaBin[ro][etab]->GetParameter(0) << "+" << fResEtaBin[ro][etab]->GetParameter(1)
424  << "*pt;";
425  }else{
426  edm::LogVerbatim ("MainResults") << "else if(fabs(eta)<"<<etabinVals_[etab+1] <<") res = " <<
427  fResEtaBin[ro][etab]->GetParameter(0) << "+" << fResEtaBin[ro][etab]->GetParameter(1)
428  << "*pt;";
429 
430  }
431  }
432  }
433  }
434  }else if(nrFilled != 0 && objectType_ == "met"){
435  for(ro=0; ro<8; ro++) {
436  edm::LogVerbatim ("MainResults") << "-------------------- ";
437  edm::LogVerbatim ("MainResults") << "\n Resolutions on " << resObsName2[ro] << "\n";
438  edm::LogVerbatim ("MainResults") << "-------------------- ";
439  if(nrFilled != 0 && ro != 6) {
440  edm::LogVerbatim ("MainResults") << "res = " <<
441  fResEtaBin[ro][0]->GetParameter(0) << "+" << fResEtaBin[ro][0]->GetParameter(1)
442  << "*exp(-(" <<fResEtaBin[ro][0]->GetParameter(2) << "*pt));";
443  }else if(nrFilled != 0 && ro == 6){
444  edm::LogVerbatim ("MainResults") << "res = " <<
445  fResEtaBin[ro][0]->GetParameter(0) << "+" << fResEtaBin[ro][0]->GetParameter(1) << "*pt;";
446  }
447  }
448  }
449 }
TF1 * fResEtaBin[10][20]
T eta() const
std::vector< double > etabinVals_
Definition: Fit.h:34
TH1F * hResEtaBin[10][20]
TF1 * fResPtEtaBin[10][20][20]
TH1F * hResPtEtaBin[10][20][20]
std::vector< double > pTbinVals_

Member Data Documentation

std::vector<double> ResolutionCreator::etabinVals_
private

Definition at line 50 of file ResolutionCreator.cc.

Referenced by analyze(), beginJob(), endJob(), and ResolutionCreator().

int ResolutionCreator::etanrbins
private

Definition at line 56 of file ResolutionCreator.cc.

Referenced by analyze(), beginJob(), and endJob().

TF1* ResolutionCreator::fResEtaBin[10][20]
private

Definition at line 61 of file ResolutionCreator.cc.

Referenced by beginJob(), and endJob().

TF1* ResolutionCreator::fResPtEtaBin[10][20][20]
private

Definition at line 60 of file ResolutionCreator.cc.

Referenced by beginJob(), and endJob().

TH1F* ResolutionCreator::hResEtaBin[10][20]
private

Definition at line 63 of file ResolutionCreator.cc.

Referenced by beginJob(), and endJob().

TH1F* ResolutionCreator::hResPtEtaBin[10][20][20]
private

Definition at line 62 of file ResolutionCreator.cc.

Referenced by analyze(), beginJob(), and endJob().

std::string ResolutionCreator::labelName_
private

Definition at line 49 of file ResolutionCreator.cc.

Referenced by analyze(), and ResolutionCreator().

int ResolutionCreator::matchingAlgo_
private

Definition at line 52 of file ResolutionCreator.cc.

double ResolutionCreator::maxDist_
private

Definition at line 55 of file ResolutionCreator.cc.

double ResolutionCreator::minDR_
private

Definition at line 51 of file ResolutionCreator.cc.

Referenced by analyze(), and ResolutionCreator().

int ResolutionCreator::nrFilled
private

Definition at line 57 of file ResolutionCreator.cc.

Referenced by analyze(), endJob(), and ResolutionCreator().

std::string ResolutionCreator::objectType_
private

Definition at line 49 of file ResolutionCreator.cc.

Referenced by analyze(), beginJob(), endJob(), and ResolutionCreator().

std::vector<double> ResolutionCreator::pTbinVals_
private

Definition at line 50 of file ResolutionCreator.cc.

Referenced by analyze(), beginJob(), endJob(), and ResolutionCreator().

int ResolutionCreator::ptnrbins
private

Definition at line 56 of file ResolutionCreator.cc.

Referenced by beginJob(), and endJob().

TTree* ResolutionCreator::tResVar
private

Definition at line 64 of file ResolutionCreator.cc.

Referenced by beginJob(), and endJob().

bool ResolutionCreator::useDeltaR_
private

Definition at line 54 of file ResolutionCreator.cc.

bool ResolutionCreator::useMaxDist_
private

Definition at line 53 of file ResolutionCreator.cc.