CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFRootEventManager.cc
Go to the documentation of this file.
4 
7 
9 
12 
14 
17 
19 
21 
24 
28 
34 
38 
40 
41 #include "TFile.h"
42 #include "TTree.h"
43 #include "TBranch.h"
44 #include "TCutG.h"
45 #include "TVector3.h"
46 #include "TROOT.h"
47 
48 #include <iostream>
49 #include <vector>
50 #include <cstdlib>
51 
52 using namespace std;
53 // using namespace boost;
54 using namespace reco;
55 
56 using boost::shared_ptr;
57 
59 
60 
61 
63  :
64  iEvent_(0),
65  options_(0),
66  ev_(0),
67  tree_(0),
68  outTree_(0),
69  outEvent_(0),
70  // clusters_(new reco::PFClusterCollection),
71  eventAuxiliary_( new edm::EventAuxiliary ),
72  clustersECAL_(new reco::PFClusterCollection),
73  clustersHCAL_(new reco::PFClusterCollection),
74  clustersHO_(new reco::PFClusterCollection),
75  clustersHFEM_(new reco::PFClusterCollection),
76  clustersHFHAD_(new reco::PFClusterCollection),
77  clustersPS_(new reco::PFClusterCollection),
78  pfBlocks_(new reco::PFBlockCollection),
79  pfCandidates_(new reco::PFCandidateCollection),
80  pfCandidateElectronExtras_(new reco::PFCandidateElectronExtraCollection),
81  //pfJets_(new reco::PFJetCollection),
82  outFile_(0),
83  calibFile_(0)
84 {
85 
86 
87  // iEvent_=0;
89  = new TH1F("h_deltaETvisible_MCEHT","Jet Et difference CaloTowers-MC"
90  ,1000,-50.,50.);
92  = new TH1F("h_deltaETvisible_MCPF" ,"Jet Et difference ParticleFlow-MC"
93  ,1000,-50.,50.);
94 
95  readOptions(file, true, true);
96 
98 
99  // maxERecHitEcal_ = -1;
100  // maxERecHitHcal_ = -1;
101 
102 }
103 
104 
106 
107  unsigned int nev = ev_->size();
108  for ( unsigned int entry = 0; entry < nev; ++entry ) {
109  ev_->to(entry);
110  const edm::EventBase& iEv = *ev_;
111  mapEventToEntry_[iEv.id().run()][iEv.id().luminosityBlock()][iEv.id().event()] = entry;
112  }
113 
114  cout<<"Number of events: "<< nev
115  <<" starting with event: "<<mapEventToEntry_.begin()->first<<endl;
116 }
117 
118 
120 
121  if(outEvent_) {
122  outEvent_->reset();
123  outTree_->GetBranch("event")->SetAddress(&outEvent_);
124  }
125 
126  if ( ev_ && ev_->isValid() )
127  ev_->getTFile()->cd();
128 }
129 
130 
131 
133  bool refresh,
134  bool reconnect) {
135 
136  readSpecificOptions(file);
137 
138  cout<<"calling PFRootEventManager::readOptions"<<endl;
139 
140 
141  reset();
142 
143  PFGeometry pfGeometry; // initialize geometry
144 
145  // cout<<"reading options "<<endl;
146 
147  try {
148  if( !options_ )
149  options_ = new IO(file);
150  else if( refresh) {
151  delete options_;
152  options_ = new IO(file);
153  }
154  }
155  catch( const string& err ) {
156  cout<<err<<endl;
157  return;
158  }
159 
160 
161  debug_ = false;
162  options_->GetOpt("rootevent", "debug", debug_);
163 
164 
165  // output text file for calibration
166  string calibfilename;
167  options_->GetOpt("calib","outfile",calibfilename);
168  if (!calibfilename.empty()) {
169  calibFile_ = new std::ofstream(calibfilename.c_str());
170  std::cout << "Calib file name " << calibfilename << " " << calibfilename.c_str() << std::endl;
171  }
172 
173  // output root file ------------------------------------------
174 
175 
176  if(!outFile_) {
177  string outfilename;
178  options_->GetOpt("root","outfile", outfilename);
179  bool doOutTree = false;
180  options_->GetOpt("root","outtree", doOutTree);
181  if(doOutTree) {
182  if(!outfilename.empty() ) {
183  outFile_ = TFile::Open(outfilename.c_str(), "recreate");
184 
185  outFile_->cd();
186  //options_->GetOpt("root","outtree", doOutTree);
187  //if(doOutTree) {
188  // cout<<"do tree"<<endl;
189  outEvent_ = new EventColin();
190  outTree_ = new TTree("Eff","");
191  outTree_->Branch("event","EventColin", &outEvent_,32000,2);
192  }
193  // cout<<"don't do tree"<<endl;
194  }
195  }
196  // PFJet benchmark options and output jetfile to be open before input file!!!--
197 
198  doPFJetBenchmark_ = false;
199  options_->GetOpt("pfjet_benchmark", "on/off", doPFJetBenchmark_);
200 
201  if (doPFJetBenchmark_) {
202  string outjetfilename;
203  options_->GetOpt("pfjet_benchmark", "outjetfile", outjetfilename);
204 
205  bool pfjBenchmarkDebug;
206  options_->GetOpt("pfjet_benchmark", "debug", pfjBenchmarkDebug);
207 
208  bool plotAgainstReco=0;
209  options_->GetOpt("pfjet_benchmark", "plotAgainstReco", plotAgainstReco);
210 
211  bool onlyTwoJets=1;
212  options_->GetOpt("pfjet_benchmark", "onlyTwoJets", onlyTwoJets);
213 
214  double deltaRMax=0.1;
215  options_->GetOpt("pfjet_benchmark", "deltaRMax", deltaRMax);
216 
217  fastsim_=true;
218  options_->GetOpt("Simulation","Fast",fastsim_);
219 
220  PFJetBenchmark_.setup( outjetfilename,
221  pfjBenchmarkDebug,
222  plotAgainstReco,
223  onlyTwoJets,
224  deltaRMax );
225  }
226 
227 // PFMET benchmark options and output jetfile to be open before input file!!!--
228 
229  doPFMETBenchmark_ = false;
230  options_->GetOpt("pfmet_benchmark", "on/off", doPFMETBenchmark_);
231 
232  if (doPFMETBenchmark_) {
233  //COLIN : looks like this benchmark is not written in the standard output file. Any particular reason for it?
234 
235  doMet_ = false;
236  options_->GetOpt("MET", "on/off", doMet_);
237 
238  JECinCaloMet_ = false;
239  options_->GetOpt("pfmet_benchmark", "JECinCaloMET", JECinCaloMet_);
240 
241  std::string outmetfilename;
242  options_->GetOpt("pfmet_benchmark", "outmetfile", outmetfilename);
243 
244  // define here the various benchmark comparison
245  metManager_.reset( new METManager(outmetfilename) );
246  metManager_->addGenBenchmark("PF");
247  metManager_->addGenBenchmark("Calo");
248  if ( doMet_ ) metManager_->addGenBenchmark("recompPF");
249  if (JECinCaloMet_) metManager_->addGenBenchmark("corrCalo");
250 
251  bool pfmetBenchmarkDebug;
252  options_->GetOpt("pfmet_benchmark", "debug", pfmetBenchmarkDebug);
253 
254  MET1cut = 10.0;
255  options_->GetOpt("pfmet_benchmark", "truemetcut", MET1cut);
256 
257  DeltaMETcut = 30.0;
258  options_->GetOpt("pfmet_benchmark", "deltametcut", DeltaMETcut);
259 
260  DeltaPhicut = 0.8;
261  options_->GetOpt("pfmet_benchmark", "deltaphicut", DeltaPhicut);
262 
263 
264  std::vector<unsigned int> vIgnoreParticlesIDs;
265  options_->GetOpt("pfmet_benchmark", "trueMetIgnoreParticlesIDs", vIgnoreParticlesIDs);
266  //std::cout << "FL: vIgnoreParticlesIDs.size() = " << vIgnoreParticlesIDs.size() << std::endl;
267  //std::cout << "FL: first = " << vIgnoreParticlesIDs[0] << std::endl;
268  metManager_->SetIgnoreParticlesIDs(&vIgnoreParticlesIDs);
269 
270  std::vector<unsigned int> trueMetSpecificIdCut;
271  std::vector<double> trueMetSpecificEtaCut;
272  options_->GetOpt("pfmet_benchmark", "trueMetSpecificIdCut", trueMetSpecificIdCut);
273  options_->GetOpt("pfmet_benchmark", "trueMetSpecificEtaCut", trueMetSpecificEtaCut);
274  if (trueMetSpecificIdCut.size()!=trueMetSpecificEtaCut.size()) std::cout << "Warning: PFRootEventManager: trueMetSpecificIdCut.size()!=trueMetSpecificEtaCut.size()" << std::endl;
275  else metManager_->SetSpecificIdCut(&trueMetSpecificIdCut,&trueMetSpecificEtaCut);
276 
277  }
278 
280  options_->GetOpt("pfCandidate_benchmark", "on/off", doPFCandidateBenchmark_);
282  cout<<"+++ Setting PFCandidate benchmark"<<endl;
283  TDirectory* dir = outFile_->mkdir("DQMData");
284  dir = dir->mkdir("PFTask");
285  dir = dir->mkdir("particleFlowManager");
287 
288  float dRMax = 0.5;
289  options_->GetOpt("pfCandidate_benchmark", "dRMax", dRMax);
290  float ptMin = 2;
291  options_->GetOpt("pfCandidate_benchmark", "ptMin", ptMin);
292  bool matchCharge = true;
293  options_->GetOpt("pfCandidate_benchmark", "matchCharge", matchCharge);
294  int mode = static_cast<int>(Benchmark::DEFAULT);
295  options_->GetOpt("pfCandidate_benchmark", "mode", mode);
296 
297  pfCandidateManager_.setParameters( dRMax, matchCharge,
298  static_cast<Benchmark::Mode>(mode));
299  pfCandidateManager_.setRange( ptMin, 10e5, -4.5, 4.5, -10, 10);
301  //COLIN need to set the subdirectory.
302  cout<<"+++ Done "<<endl;
303  }
304  // Addition to have DQM histograms : by S. Dutta
305  doPFDQM_ = true;
306  options_->GetOpt("pfDQM_monitor", "on/off", doPFDQM_);
307 
308  if (doPFDQM_) {
309  cout<<"+++ Setting PFDQM Monitoring " <<endl;
310  string dqmfilename;
311  dqmFile_ = 0;
312  options_->GetOpt("pfDQM_monitor","DQMFilename", dqmfilename);
313  dqmFile_ = TFile::Open(dqmfilename.c_str(), "recreate");
314 
315  TDirectory* dir = dqmFile_->mkdir("DQMData");
316  TDirectory* dir1 = dir->mkdir("PFJetValidation");
317  TDirectory* dir2 = dir->mkdir("PFMETValidation");
318  pfJetMonitor_.setDirectory( dir1 );
319  pfMETMonitor_.setDirectory( dir2 );
320  float dRMax = 0.5;
321  options_->GetOpt("pfCandidate_benchmark", "dRMax", dRMax);
322  float ptMin = 2;
323  options_->GetOpt("pfCandidate_benchmark", "ptMin", ptMin);
324  bool matchCharge = true;
325  options_->GetOpt("pfCandidate_benchmark", "matchCharge", matchCharge);
326  int mode = static_cast<int>(Benchmark::DEFAULT);
327  options_->GetOpt("pfCandidate_benchmark", "mode", mode);
328 
329  pfJetMonitor_.setParameters( dRMax, matchCharge, static_cast<Benchmark::Mode>(mode),
330  ptMin, 10e5, -4.5, 4.5, -10.0, 10.0, false);
332 
333  pfMETMonitor_.setParameters( static_cast<Benchmark::Mode>(mode),
334  ptMin, 10e5, -4.5, 4.5, -10.0, 10.0, false);
336  }
337 //-----------------------------------------------
338 
339 
340  std::string outputFile0;
341  TFile* file0 = 0;
342  TH2F* hBNeighbour0 = 0;
343  TH2F* hENeighbour0 = 0;
344  options_->GetOpt("clustering", "ECAL", outputFile0);
345  if(!outputFile0.empty() ) {
346  file0 = TFile::Open(outputFile0.c_str(),"recreate");
347  hBNeighbour0 = new TH2F("BNeighbour0","f_{Neighbours} vs 1/E_{Seed} (ECAL Barrel)",500, 0., 0.5, 1000,0.,1.);
348  hENeighbour0 = new TH2F("ENeighbour0","f_{Neighbours} vs 1/E_{Seed} (ECAL Endcap)",500, 0., 0.2, 1000,0.,1.);
349  }
350 
351  std::string outputFile1;
352  TFile* file1 = 0;
353  TH2F* hBNeighbour1 = 0;
354  TH2F* hENeighbour1 = 0;
355  options_->GetOpt("clustering", "HCAL", outputFile1);
356  if(!outputFile1.empty() ) {
357  file1 = TFile::Open(outputFile1.c_str(),"recreate");
358  hBNeighbour1 = new TH2F("BNeighbour1","f_{Neighbours} vs 1/E_{Seed} (HCAL Barrel)",500, 0., 0.05, 400,0.,1.);
359  hENeighbour1 = new TH2F("ENeighbour1","f_{Neighbours} vs 1/E_{Seed} (HCAL Endcap)",500, 0., 0.05, 400,0.,1.);
360  }
361 
362  std::string outputFile2;
363  TFile* file2 = 0;
364  TH2F* hBNeighbour2 = 0;
365  TH2F* hENeighbour2 = 0;
366  options_->GetOpt("clustering", "HFEM", outputFile2);
367  if(!outputFile2.empty() ) {
368  file2 = TFile::Open(outputFile2.c_str(),"recreate");
369  hBNeighbour2 = new TH2F("BNeighbour2","f_{Neighbours} vs 1/E_{Seed} (HFEM Barrel)",500, 0., 0.02, 400,0.,1.);
370  hENeighbour2 = new TH2F("ENeighbour2","f_{Neighbours} vs 1/E_{Seed} (HFEM Endcap)",500, 0., 0.02, 400,0.,1.);
371  }
372 
373  std::string outputFile3;
374  TFile* file3 = 0;
375  TH2F* hBNeighbour3 = 0;
376  TH2F* hENeighbour3 = 0;
377  options_->GetOpt("clustering", "HFHAD", outputFile3);
378  if(!outputFile3.empty() ) {
379  file3 = TFile::Open(outputFile3.c_str(),"recreate");
380  hBNeighbour3 = new TH2F("BNeighbour3","f_{Neighbours} vs 1/E_{Seed} (HFHAD Barrel)",500, 0., 0.02, 400,0.,1.);
381  hENeighbour3 = new TH2F("ENeighbour3","f_{Neighbours} vs 1/E_{Seed} (HFHAD Endcap)",500, 0., 0.02, 400,0.,1.);
382  }
383 
384  std::string outputFile4;
385  TFile* file4 = 0;
386  TH2F* hBNeighbour4 = 0;
387  TH2F* hENeighbour4 = 0;
388  options_->GetOpt("clustering", "Preshower", outputFile4);
389  if(!outputFile4.empty() ) {
390  file4 = TFile::Open(outputFile4.c_str(),"recreate");
391  hBNeighbour4 = new TH2F("BNeighbour4","f_{Neighbours} vs 1/E_{Seed} (Preshower Barrel)",200, 0., 1000., 400,0.,1.);
392  hENeighbour4 = new TH2F("ENeighbour4","f_{Neighbours} vs 1/E_{Seed} (Preshower Endcap)",200, 0., 1000., 400,0.,1.);
393  }
394 
395  // input root file --------------------------------------------
396 
397  if( reconnect )
398  connect();
399 
400  // filter --------------------------------------------------------------
401 
402  filterNParticles_ = 0;
403  options_->GetOpt("filter", "nparticles", filterNParticles_);
404 
405  filterHadronicTaus_ = true;
406  options_->GetOpt("filter", "hadronic_taus", filterHadronicTaus_);
407 
408  filterTaus_.clear();
409  options_->GetOpt("filter", "taus", filterTaus_);
410  if( !filterTaus_.empty() &&
411  filterTaus_.size() != 2 ) {
412  cerr<<"PFRootEventManager::ReadOptions, bad filter/taus option."<<endl
413  <<"please use : "<<endl
414  <<"\tfilter taus n_charged n_neutral"<<endl;
415  filterTaus_.clear();
416  }
417 
418 
419  // clustering parameters -----------------------------------------------
420 
421  //Rechit for Ring 0 and +-1/2
422  double threshold_R0=0.4;
423  options_->GetOpt("clustering", "threshold_Hit_R0", threshold_R0);
424 
425  double threshold_R1=1.0;
426  options_->GetOpt("clustering", "threshold_Hit_R1", threshold_R1);
427 
428  //Clustering
429  double threshHO_Seed_Ring0=1.0;
430  options_->GetOpt("clustering", "threshHO_Seed_Ring0", threshHO_Seed_Ring0);
431 
432  double threshHO_Ring0=0.5;
433  options_->GetOpt("clustering", "threshHO_Ring0", threshHO_Ring0);
434 
435  double threshHO_Seed_Outer=3.1;
436  options_->GetOpt("clustering", "threshHO_Seed_Outer", threshHO_Seed_Outer);
437 
438  double threshHO_Outer=1.0;
439  options_->GetOpt("clustering", "threshHO_Outer", threshHO_Outer);
440 
441 
442  doClustering_ = true;
443  //options_->GetOpt("clustering", "on/off", doClustering_);
444 
445  bool clusteringDebug = false;
446  options_->GetOpt("clustering", "debug", clusteringDebug );
447 
448  findRecHitNeighbours_ = true;
449  options_->GetOpt("clustering", "findRecHitNeighbours",
451 
452  double threshEcalBarrel = 0.1;
453  options_->GetOpt("clustering", "thresh_Ecal_Barrel", threshEcalBarrel);
454 
455  double threshPtEcalBarrel = 0.0;
456  options_->GetOpt("clustering", "thresh_Pt_Ecal_Barrel", threshPtEcalBarrel);
457 
458  double threshSeedEcalBarrel = 0.3;
459  options_->GetOpt("clustering", "thresh_Seed_Ecal_Barrel",
460  threshSeedEcalBarrel);
461 
462  double threshPtSeedEcalBarrel = 0.0;
463  options_->GetOpt("clustering", "thresh_Pt_Seed_Ecal_Barrel",
464  threshPtSeedEcalBarrel);
465 
466  double threshCleanEcalBarrel = 1E5;
467  options_->GetOpt("clustering", "thresh_Clean_Ecal_Barrel",
468  threshCleanEcalBarrel);
469 
470  std::vector<double> minS4S1CleanEcalBarrel;
471  options_->GetOpt("clustering", "minS4S1_Clean_Ecal_Barrel",
472  minS4S1CleanEcalBarrel);
473 
474  double threshDoubleSpikeEcalBarrel = 10.;
475  options_->GetOpt("clustering", "thresh_DoubleSpike_Ecal_Barrel",
476  threshDoubleSpikeEcalBarrel);
477 
478  double minS6S2DoubleSpikeEcalBarrel = 0.04;
479  options_->GetOpt("clustering", "minS6S2_DoubleSpike_Ecal_Barrel",
480  minS6S2DoubleSpikeEcalBarrel);
481 
482  double threshEcalEndcap = 0.2;
483  options_->GetOpt("clustering", "thresh_Ecal_Endcap", threshEcalEndcap);
484 
485  double threshPtEcalEndcap = 0.0;
486  options_->GetOpt("clustering", "thresh_Pt_Ecal_Endcap", threshPtEcalEndcap);
487 
488  double threshSeedEcalEndcap = 0.8;
489  options_->GetOpt("clustering", "thresh_Seed_Ecal_Endcap",
490  threshSeedEcalEndcap);
491 
492  double threshPtSeedEcalEndcap = 0.0;
493  options_->GetOpt("clustering", "thresh_Pt_Seed_Ecal_Endcap",
494  threshPtSeedEcalEndcap);
495 
496  double threshCleanEcalEndcap = 1E5;
497  options_->GetOpt("clustering", "thresh_Clean_Ecal_Endcap",
498  threshCleanEcalEndcap);
499 
500  std::vector<double> minS4S1CleanEcalEndcap;
501  options_->GetOpt("clustering", "minS4S1_Clean_Ecal_Endcap",
502  minS4S1CleanEcalEndcap);
503 
504  double threshDoubleSpikeEcalEndcap = 1E9;
505  options_->GetOpt("clustering", "thresh_DoubleSpike_Ecal_Endcap",
506  threshDoubleSpikeEcalEndcap);
507 
508  double minS6S2DoubleSpikeEcalEndcap = -1.;
509  options_->GetOpt("clustering", "minS6S2_DoubleSpike_Ecal_Endcap",
510  minS6S2DoubleSpikeEcalEndcap);
511 
512  double showerSigmaEcal = 3;
513  options_->GetOpt("clustering", "shower_Sigma_Ecal",
514  showerSigmaEcal);
515 
516  int nNeighboursEcal = 4;
517  options_->GetOpt("clustering", "neighbours_Ecal", nNeighboursEcal);
518 
519  int posCalcNCrystalEcal = -1;
520  options_->GetOpt("clustering", "posCalc_nCrystal_Ecal",
521  posCalcNCrystalEcal);
522 
523  double posCalcP1Ecal
524  = threshEcalBarrel<threshEcalEndcap ? threshEcalBarrel:threshEcalEndcap;
525 // options_->GetOpt("clustering", "posCalc_p1_Ecal",
526 // posCalcP1Ecal);
527 
528  bool useCornerCellsEcal = false;
529  options_->GetOpt("clustering", "useCornerCells_Ecal",
530  useCornerCellsEcal);
531 
532  clusterAlgoECAL_.setHistos(file0,hBNeighbour0,hENeighbour0);
533 
534  clusterAlgoECAL_.setThreshBarrel( threshEcalBarrel );
535  clusterAlgoECAL_.setThreshSeedBarrel( threshSeedEcalBarrel );
536 
537  clusterAlgoECAL_.setThreshPtBarrel( threshPtEcalBarrel );
538  clusterAlgoECAL_.setThreshPtSeedBarrel( threshPtSeedEcalBarrel );
539 
540  clusterAlgoECAL_.setThreshCleanBarrel(threshCleanEcalBarrel);
541  clusterAlgoECAL_.setS4S1CleanBarrel(minS4S1CleanEcalBarrel);
542 
543  clusterAlgoECAL_.setThreshDoubleSpikeBarrel( threshDoubleSpikeEcalBarrel );
544  clusterAlgoECAL_.setS6S2DoubleSpikeBarrel( minS6S2DoubleSpikeEcalBarrel );
545 
546  clusterAlgoECAL_.setThreshEndcap( threshEcalEndcap );
547  clusterAlgoECAL_.setThreshSeedEndcap( threshSeedEcalEndcap );
548 
549  clusterAlgoECAL_.setThreshPtEndcap( threshPtEcalEndcap );
550  clusterAlgoECAL_.setThreshPtSeedEndcap( threshPtSeedEcalEndcap );
551 
552  clusterAlgoECAL_.setThreshCleanEndcap(threshCleanEcalEndcap);
553  clusterAlgoECAL_.setS4S1CleanEndcap(minS4S1CleanEcalEndcap);
554 
555  clusterAlgoECAL_.setThreshDoubleSpikeEndcap( threshDoubleSpikeEcalEndcap );
556  clusterAlgoECAL_.setS6S2DoubleSpikeEndcap( minS6S2DoubleSpikeEcalEndcap );
557 
558  clusterAlgoECAL_.setNNeighbours( nNeighboursEcal );
559  clusterAlgoECAL_.setShowerSigma( showerSigmaEcal );
560 
561  clusterAlgoECAL_.setPosCalcNCrystal( posCalcNCrystalEcal );
562  clusterAlgoECAL_.setPosCalcP1( posCalcP1Ecal );
563 
564  clusterAlgoECAL_.setUseCornerCells( useCornerCellsEcal );
565 
566  clusterAlgoECAL_.enableDebugging( clusteringDebug );
567 
568  int dcormode = 0;
569  options_->GetOpt("clustering", "depthCor_Mode", dcormode);
570 
571  double dcora = -1;
572  options_->GetOpt("clustering", "depthCor_A", dcora);
573  double dcorb = -1;
574  options_->GetOpt("clustering", "depthCor_B", dcorb);
575  double dcorap = -1;
576  options_->GetOpt("clustering", "depthCor_A_preshower", dcorap);
577  double dcorbp = -1;
578  options_->GetOpt("clustering", "depthCor_B_preshower", dcorbp);
579 
580  // if( dcormode > 0 &&
581  // dcora > -0.5 &&
582  // dcorb > -0.5 &&
583  // dcorap > -0.5 &&
584  // dcorbp > -0.5 ) {
585 
586  // cout<<"set depth correction "
587  // <<dcormode<<" "<<dcora<<" "<<dcorb<<" "<<dcorap<<" "<<dcorbp<<endl;
589  dcora, dcorb,
590  dcorap, dcorbp);
591  // }
592  // else {
593  // reco::PFCluster::setDepthCorParameters( -1,
594  // 0,0 ,
595  // 0,0 );
596  // }
597 
598 
599  // And now the HCAL
600  double threshHcalBarrel = 0.8;
601  options_->GetOpt("clustering", "thresh_Hcal_Barrel", threshHcalBarrel);
602 
603  double threshPtHcalBarrel = 0.0;
604  options_->GetOpt("clustering", "thresh_Pt_Hcal_Barrel", threshPtHcalBarrel);
605 
606  double threshSeedHcalBarrel = 1.4;
607  options_->GetOpt("clustering", "thresh_Seed_Hcal_Barrel",
608  threshSeedHcalBarrel);
609 
610  double threshPtSeedHcalBarrel = 0.0;
611  options_->GetOpt("clustering", "thresh_Pt_Seed_Hcal_Barrel",
612  threshPtSeedHcalBarrel);
613 
614  double threshCleanHcalBarrel = 1E5;
615  options_->GetOpt("clustering", "thresh_Clean_Hcal_Barrel",
616  threshCleanHcalBarrel);
617 
618  std::vector<double> minS4S1CleanHcalBarrel;
619  options_->GetOpt("clustering", "minS4S1_Clean_Hcal_Barrel",
620  minS4S1CleanHcalBarrel);
621 
622  double threshHcalEndcap = 0.8;
623  options_->GetOpt("clustering", "thresh_Hcal_Endcap", threshHcalEndcap);
624 
625  double threshPtHcalEndcap = 0.0;
626  options_->GetOpt("clustering", "thresh_Pt_Hcal_Endcap", threshPtHcalEndcap);
627 
628  double threshSeedHcalEndcap = 1.4;
629  options_->GetOpt("clustering", "thresh_Seed_Hcal_Endcap",
630  threshSeedHcalEndcap);
631 
632  double threshPtSeedHcalEndcap = 0.0;
633  options_->GetOpt("clustering", "thresh_Pt_Seed_Hcal_Endcap",
634  threshPtSeedHcalEndcap);
635 
636  double threshCleanHcalEndcap = 1E5;
637  options_->GetOpt("clustering", "thresh_Clean_Hcal_Endcap",
638  threshCleanHcalEndcap);
639 
640  std::vector<double> minS4S1CleanHcalEndcap;
641  options_->GetOpt("clustering", "minS4S1_Clean_Hcal_Endcap",
642  minS4S1CleanHcalEndcap);
643 
644  double showerSigmaHcal = 15;
645  options_->GetOpt("clustering", "shower_Sigma_Hcal",
646  showerSigmaHcal);
647 
648  int nNeighboursHcal = 4;
649  options_->GetOpt("clustering", "neighbours_Hcal", nNeighboursHcal);
650 
651  int posCalcNCrystalHcal = 5;
652  options_->GetOpt("clustering", "posCalc_nCrystal_Hcal",
653  posCalcNCrystalHcal);
654 
655  bool useCornerCellsHcal = false;
656  options_->GetOpt("clustering", "useCornerCells_Hcal",
657  useCornerCellsHcal);
658 
659  bool cleanRBXandHPDs = false;
660  options_->GetOpt("clustering", "cleanRBXandHPDs_Hcal",
661  cleanRBXandHPDs);
662 
663  double posCalcP1Hcal
664  = threshHcalBarrel<threshHcalEndcap ? threshHcalBarrel:threshHcalEndcap;
665 // options_->GetOpt("clustering", "posCalc_p1_Hcal",
666 // posCalcP1Hcal);
667 
668 
669  clusterAlgoHCAL_.setHistos(file1,hBNeighbour1,hENeighbour1);
670 
671 
672  clusterAlgoHCAL_.setThreshBarrel( threshHcalBarrel );
673  clusterAlgoHCAL_.setThreshSeedBarrel( threshSeedHcalBarrel );
674 
675  clusterAlgoHCAL_.setThreshPtBarrel( threshPtHcalBarrel );
676  clusterAlgoHCAL_.setThreshPtSeedBarrel( threshPtSeedHcalBarrel );
677 
678  clusterAlgoHCAL_.setThreshCleanBarrel(threshCleanHcalBarrel);
679  clusterAlgoHCAL_.setS4S1CleanBarrel(minS4S1CleanHcalBarrel);
680 
681  clusterAlgoHCAL_.setThreshEndcap( threshHcalEndcap );
682  clusterAlgoHCAL_.setThreshSeedEndcap( threshSeedHcalEndcap );
683 
684  clusterAlgoHCAL_.setThreshPtEndcap( threshPtHcalEndcap );
685  clusterAlgoHCAL_.setThreshPtSeedEndcap( threshPtSeedHcalEndcap );
686 
687  clusterAlgoHCAL_.setThreshCleanEndcap(threshCleanHcalEndcap);
688  clusterAlgoHCAL_.setS4S1CleanEndcap(minS4S1CleanHcalEndcap);
689 
690  clusterAlgoHCAL_.setNNeighbours( nNeighboursHcal );
691  clusterAlgoHCAL_.setShowerSigma( showerSigmaHcal );
692 
693  clusterAlgoHCAL_.setPosCalcNCrystal( posCalcNCrystalHcal );
694  clusterAlgoHCAL_.setPosCalcP1( posCalcP1Hcal );
695 
696  clusterAlgoHCAL_.setUseCornerCells( useCornerCellsHcal );
697  clusterAlgoHCAL_.setCleanRBXandHPDs( cleanRBXandHPDs );
698 
699  clusterAlgoHCAL_.enableDebugging( clusteringDebug );
700 
701 
702  // And now the HO
703  double threshHOBarrel = 0.5;
704  options_->GetOpt("clustering", "thresh_HO_Barrel", threshHOBarrel);
705 
706  double threshPtHOBarrel = 0.0;
707  options_->GetOpt("clustering", "thresh_Pt_HO_Barrel", threshPtHOBarrel);
708 
709  double threshSeedHOBarrel = 1.0;
710  options_->GetOpt("clustering", "thresh_Seed_HO_Barrel",
711  threshSeedHOBarrel);
712 
713  double threshPtSeedHOBarrel = 0.0;
714  options_->GetOpt("clustering", "thresh_Pt_Seed_HO_Barrel",
715  threshPtSeedHOBarrel);
716 
717  double threshCleanHOBarrel = 1E5;
718  options_->GetOpt("clustering", "thresh_Clean_HO_Barrel",
719  threshCleanHOBarrel);
720 
721  std::vector<double> minS4S1CleanHOBarrel;
722  options_->GetOpt("clustering", "minS4S1_Clean_HO_Barrel",
723  minS4S1CleanHOBarrel);
724 
725  double threshDoubleSpikeHOBarrel = 1E9;
726  options_->GetOpt("clustering", "thresh_DoubleSpike_HO_Barrel",
727  threshDoubleSpikeHOBarrel);
728 
729  double minS6S2DoubleSpikeHOBarrel = -1;
730  options_->GetOpt("clustering", "minS6S2_DoubleSpike_HO_Barrel",
731  minS6S2DoubleSpikeHOBarrel);
732 
733  double threshHOEndcap = 1.0;
734  options_->GetOpt("clustering", "thresh_HO_Endcap", threshHOEndcap);
735 
736  double threshPtHOEndcap = 0.0;
737  options_->GetOpt("clustering", "thresh_Pt_HO_Endcap", threshPtHOEndcap);
738 
739  double threshSeedHOEndcap = 3.1;
740  options_->GetOpt("clustering", "thresh_Seed_HO_Endcap",
741  threshSeedHOEndcap);
742 
743  double threshPtSeedHOEndcap = 0.0;
744  options_->GetOpt("clustering", "thresh_Pt_Seed_HO_Endcap",
745  threshPtSeedHOEndcap);
746 
747  double threshCleanHOEndcap = 1E5;
748  options_->GetOpt("clustering", "thresh_Clean_HO_Endcap",
749  threshCleanHOEndcap);
750 
751  std::vector<double> minS4S1CleanHOEndcap;
752  options_->GetOpt("clustering", "minS4S1_Clean_HO_Endcap",
753  minS4S1CleanHOEndcap);
754 
755  double threshDoubleSpikeHOEndcap = 1E9;
756  options_->GetOpt("clustering", "thresh_DoubleSpike_HO_Endcap",
757  threshDoubleSpikeHOEndcap);
758 
759  double minS6S2DoubleSpikeHOEndcap = -1;
760  options_->GetOpt("clustering", "minS6S2_DoubleSpike_HO_Endcap",
761  minS6S2DoubleSpikeHOEndcap);
762 
763  double showerSigmaHO = 15;
764  options_->GetOpt("clustering", "shower_Sigma_HO",
765  showerSigmaHO);
766 
767  int nNeighboursHO = 4;
768  options_->GetOpt("clustering", "neighbours_HO", nNeighboursHO);
769 
770  int posCalcNCrystalHO = 5;
771  options_->GetOpt("clustering", "posCalc_nCrystal_HO",
772  posCalcNCrystalHO);
773 
774  bool useCornerCellsHO = false;
775  options_->GetOpt("clustering", "useCornerCells_HO",
776  useCornerCellsHO);
777 
778  bool cleanRBXandHPDsHO = false;
779  options_->GetOpt("clustering", "cleanRBXandHPDs_HO",
780  cleanRBXandHPDsHO);
781 
782  double posCalcP1HO
783  = threshHOBarrel<threshHOEndcap ? threshHOBarrel:threshHOEndcap;
784 // options_->GetOpt("clustering", "posCalc_p1_HO",
785 // posCalcP1HO);
786 
787 
788  clusterAlgoHO_.setHistos(file1,hBNeighbour1,hENeighbour1);
789 
790 
791  clusterAlgoHO_.setThreshBarrel( threshHOBarrel );
792  clusterAlgoHO_.setThreshSeedBarrel( threshSeedHOBarrel );
793 
794  clusterAlgoHO_.setThreshPtBarrel( threshPtHOBarrel );
795  clusterAlgoHO_.setThreshPtSeedBarrel( threshPtSeedHOBarrel );
796 
797  clusterAlgoHO_.setThreshCleanBarrel(threshCleanHOBarrel);
798  clusterAlgoHO_.setS4S1CleanBarrel(minS4S1CleanHOBarrel);
799 
800  clusterAlgoHO_.setThreshDoubleSpikeBarrel( threshDoubleSpikeHOBarrel );
801  clusterAlgoHO_.setS6S2DoubleSpikeBarrel( minS6S2DoubleSpikeHOBarrel );
802 
803  clusterAlgoHO_.setThreshEndcap( threshHOEndcap );
804  clusterAlgoHO_.setThreshSeedEndcap( threshSeedHOEndcap );
805 
806  clusterAlgoHO_.setThreshPtEndcap( threshPtHOEndcap );
807  clusterAlgoHO_.setThreshPtSeedEndcap( threshPtSeedHOEndcap );
808 
809  clusterAlgoHO_.setThreshCleanEndcap(threshCleanHOEndcap);
810  clusterAlgoHO_.setS4S1CleanEndcap(minS4S1CleanHOEndcap);
811 
812  clusterAlgoHO_.setThreshDoubleSpikeEndcap( threshDoubleSpikeHOEndcap );
813  clusterAlgoHO_.setS6S2DoubleSpikeEndcap( minS6S2DoubleSpikeHOEndcap );
814 
815  clusterAlgoHO_.setNNeighbours( nNeighboursHO );
816  clusterAlgoHO_.setShowerSigma( showerSigmaHO );
817 
818  clusterAlgoHO_.setPosCalcNCrystal( posCalcNCrystalHO );
819  clusterAlgoHO_.setPosCalcP1( posCalcP1HO );
820 
821  clusterAlgoHO_.setUseCornerCells( useCornerCellsHO );
822  clusterAlgoHO_.setCleanRBXandHPDs( cleanRBXandHPDs );
823 
824  clusterAlgoHO_.enableDebugging( clusteringDebug );
825 
826 
827  // clustering HF EM
828 
829  double threshHFEM = 0.;
830  options_->GetOpt("clustering", "thresh_HFEM", threshHFEM);
831 
832  double threshPtHFEM = 0.;
833  options_->GetOpt("clustering", "thresh_Pt_HFEM", threshPtHFEM);
834 
835  double threshSeedHFEM = 0.001;
836  options_->GetOpt("clustering", "thresh_Seed_HFEM",
837  threshSeedHFEM);
838 
839  double threshPtSeedHFEM = 0.0;
840  options_->GetOpt("clustering", "thresh_Pt_Seed_HFEM",
841  threshPtSeedHFEM);
842 
843  double threshCleanHFEM = 1E5;
844  options_->GetOpt("clustering", "thresh_Clean_HFEM",
845  threshCleanHFEM);
846 
847  std::vector<double> minS4S1CleanHFEM;
848  options_->GetOpt("clustering", "minS4S1_Clean_HFEM",
849  minS4S1CleanHFEM);
850 
851  double showerSigmaHFEM = 0.1;
852  options_->GetOpt("clustering", "shower_Sigma_HFEM",
853  showerSigmaHFEM);
854 
855  int nNeighboursHFEM = 4;
856  options_->GetOpt("clustering", "neighbours_HFEM", nNeighboursHFEM);
857 
858  int posCalcNCrystalHFEM = -1;
859  options_->GetOpt("clustering", "posCalc_nCrystal_HFEM",
860  posCalcNCrystalHFEM);
861 
862  bool useCornerCellsHFEM = false;
863  options_->GetOpt("clustering", "useCornerCells_HFEM",
864  useCornerCellsHFEM);
865 
866  double posCalcP1HFEM = threshHFEM;
867 // options_->GetOpt("clustering", "posCalc_p1_HFEM",
868 // posCalcP1HFEM);
869 
870 
871  clusterAlgoHFEM_.setHistos(file2,hBNeighbour2,hENeighbour2);
872 
873  clusterAlgoHFEM_.setThreshEndcap( threshHFEM );
874  clusterAlgoHFEM_.setThreshSeedEndcap( threshSeedHFEM );
875 
876  clusterAlgoHFEM_.setThreshPtEndcap( threshPtHFEM );
877  clusterAlgoHFEM_.setThreshPtSeedEndcap( threshPtSeedHFEM );
878 
879  clusterAlgoHFEM_.setThreshCleanEndcap(threshCleanHFEM);
880  clusterAlgoHFEM_.setS4S1CleanEndcap(minS4S1CleanHFEM);
881 
882  clusterAlgoHFEM_.setNNeighbours( nNeighboursHFEM );
883  clusterAlgoHFEM_.setShowerSigma( showerSigmaHFEM );
884 
885  clusterAlgoHFEM_.setPosCalcNCrystal( posCalcNCrystalHFEM );
886  clusterAlgoHFEM_.setPosCalcP1( posCalcP1HFEM );
887 
888  clusterAlgoHFEM_.setUseCornerCells( useCornerCellsHFEM );
889 
890  clusterAlgoHFEM_.enableDebugging( clusteringDebug );
891 
892  // clustering HFHAD
893 
894  double threshHFHAD = 0.;
895  options_->GetOpt("clustering", "thresh_HFHAD", threshHFHAD);
896 
897  double threshPtHFHAD = 0.;
898  options_->GetOpt("clustering", "thresh_Pt_HFHAD", threshPtHFHAD);
899 
900  double threshSeedHFHAD = 0.001;
901  options_->GetOpt("clustering", "thresh_Seed_HFHAD",
902  threshSeedHFHAD);
903 
904  double threshPtSeedHFHAD = 0.0;
905  options_->GetOpt("clustering", "thresh_Pt_Seed_HFHAD",
906  threshPtSeedHFHAD);
907 
908  double threshCleanHFHAD = 1E5;
909  options_->GetOpt("clustering", "thresh_Clean_HFHAD",
910  threshCleanHFHAD);
911 
912  std::vector<double> minS4S1CleanHFHAD;
913  options_->GetOpt("clustering", "minS4S1_Clean_HFHAD",
914  minS4S1CleanHFHAD);
915 
916  double showerSigmaHFHAD = 0.1;
917  options_->GetOpt("clustering", "shower_Sigma_HFHAD",
918  showerSigmaHFHAD);
919 
920  int nNeighboursHFHAD = 4;
921  options_->GetOpt("clustering", "neighbours_HFHAD", nNeighboursHFHAD);
922 
923  int posCalcNCrystalHFHAD = -1;
924  options_->GetOpt("clustering", "posCalc_nCrystal_HFHAD",
925  posCalcNCrystalHFHAD);
926 
927  bool useCornerCellsHFHAD = false;
928  options_->GetOpt("clustering", "useCornerCells_HFHAD",
929  useCornerCellsHFHAD);
930 
931  double posCalcP1HFHAD = threshHFHAD;
932 // options_->GetOpt("clustering", "posCalc_p1_HFHAD",
933 // posCalcP1HFHAD);
934 
935 
936  clusterAlgoHFHAD_.setHistos(file3,hBNeighbour3,hENeighbour3);
937 
938  clusterAlgoHFHAD_.setThreshEndcap( threshHFHAD );
939  clusterAlgoHFHAD_.setThreshSeedEndcap( threshSeedHFHAD );
940 
941  clusterAlgoHFHAD_.setThreshPtEndcap( threshPtHFHAD );
942  clusterAlgoHFHAD_.setThreshPtSeedEndcap( threshPtSeedHFHAD );
943 
944  clusterAlgoHFHAD_.setThreshCleanEndcap(threshCleanHFHAD);
945  clusterAlgoHFHAD_.setS4S1CleanEndcap(minS4S1CleanHFHAD);
946 
947  clusterAlgoHFHAD_.setNNeighbours( nNeighboursHFHAD );
948  clusterAlgoHFHAD_.setShowerSigma( showerSigmaHFHAD );
949 
950  clusterAlgoHFHAD_.setPosCalcNCrystal( posCalcNCrystalHFHAD );
951  clusterAlgoHFHAD_.setPosCalcP1( posCalcP1HFHAD );
952 
953  clusterAlgoHFHAD_.setUseCornerCells( useCornerCellsHFHAD );
954 
955  clusterAlgoHFHAD_.enableDebugging( clusteringDebug );
956 
957  // clustering preshower
958 
959  double threshPS = 0.0001;
960  options_->GetOpt("clustering", "thresh_PS", threshPS);
961 
962  double threshPtPS = 0.0;
963  options_->GetOpt("clustering", "thresh_Pt_PS", threshPtPS);
964 
965  double threshSeedPS = 0.001;
966  options_->GetOpt("clustering", "thresh_Seed_PS",
967  threshSeedPS);
968 
969  double threshPtSeedPS = 0.0;
970  options_->GetOpt("clustering", "thresh_Pt_Seed_PS", threshPtSeedPS);
971 
972  double threshCleanPS = 1E5;
973  options_->GetOpt("clustering", "thresh_Clean_PS", threshCleanPS);
974 
975  std::vector<double> minS4S1CleanPS;
976  options_->GetOpt("clustering", "minS4S1_Clean_PS", minS4S1CleanPS);
977 
978  //Comment Michel: PSBarrel shall be removed?
979  double threshPSBarrel = threshPS;
980  double threshSeedPSBarrel = threshSeedPS;
981 
982  double threshPtPSBarrel = threshPtPS;
983  double threshPtSeedPSBarrel = threshPtSeedPS;
984 
985  double threshCleanPSBarrel = threshCleanPS;
986  std::vector<double> minS4S1CleanPSBarrel = minS4S1CleanPS;
987 
988  double threshPSEndcap = threshPS;
989  double threshSeedPSEndcap = threshSeedPS;
990 
991  double threshPtPSEndcap = threshPtPS;
992  double threshPtSeedPSEndcap = threshPtSeedPS;
993 
994  double threshCleanPSEndcap = threshCleanPS;
995  std::vector<double> minS4S1CleanPSEndcap = minS4S1CleanPS;
996 
997  double showerSigmaPS = 0.1;
998  options_->GetOpt("clustering", "shower_Sigma_PS",
999  showerSigmaPS);
1000 
1001  int nNeighboursPS = 4;
1002  options_->GetOpt("clustering", "neighbours_PS", nNeighboursPS);
1003 
1004  int posCalcNCrystalPS = -1;
1005  options_->GetOpt("clustering", "posCalc_nCrystal_PS",
1006  posCalcNCrystalPS);
1007 
1008  bool useCornerCellsPS = false;
1009  options_->GetOpt("clustering", "useCornerCells_PS",
1010  useCornerCellsPS);
1011 
1012  double posCalcP1PS = threshPS;
1013 // options_->GetOpt("clustering", "posCalc_p1_PS",
1014 // posCalcP1PS);
1015 
1016 
1017  clusterAlgoPS_.setHistos(file4,hBNeighbour4,hENeighbour4);
1018 
1019 
1020 
1021  clusterAlgoPS_.setThreshBarrel( threshPSBarrel );
1022  clusterAlgoPS_.setThreshSeedBarrel( threshSeedPSBarrel );
1023 
1024  clusterAlgoPS_.setThreshPtBarrel( threshPtPSBarrel );
1025  clusterAlgoPS_.setThreshPtSeedBarrel( threshPtSeedPSBarrel );
1026 
1027  clusterAlgoPS_.setThreshCleanBarrel(threshCleanPSBarrel);
1028  clusterAlgoPS_.setS4S1CleanBarrel(minS4S1CleanPSBarrel);
1029 
1030  clusterAlgoPS_.setThreshEndcap( threshPSEndcap );
1031  clusterAlgoPS_.setThreshSeedEndcap( threshSeedPSEndcap );
1032 
1033  clusterAlgoPS_.setThreshPtEndcap( threshPtPSEndcap );
1034  clusterAlgoPS_.setThreshPtSeedEndcap( threshPtSeedPSEndcap );
1035 
1036  clusterAlgoPS_.setThreshCleanEndcap(threshCleanPSEndcap);
1037  clusterAlgoPS_.setS4S1CleanEndcap(minS4S1CleanPSEndcap);
1038 
1039  clusterAlgoPS_.setNNeighbours( nNeighboursPS );
1040  clusterAlgoPS_.setShowerSigma( showerSigmaPS );
1041 
1042  clusterAlgoPS_.setPosCalcNCrystal( posCalcNCrystalPS );
1043  clusterAlgoPS_.setPosCalcP1( posCalcP1PS );
1044 
1045  clusterAlgoPS_.setUseCornerCells( useCornerCellsPS );
1046 
1047  clusterAlgoPS_.enableDebugging( clusteringDebug );
1048 
1049  // options for particle flow ---------------------------------------------
1050 
1051 
1052  doParticleFlow_ = true;
1053  doCompare_ = false;
1054  options_->GetOpt("particle_flow", "on/off", doParticleFlow_);
1055  options_->GetOpt("particle_flow", "comparison", doCompare_);
1056 
1058  options_->GetOpt("particle_flow", "useKDTreeTrackEcalLinker", useKDTreeTrackEcalLinker_);
1059  std::cout << "Use Track-ECAL link optimization: " << useKDTreeTrackEcalLinker_ << std::endl;
1061 
1062  std::vector<double> DPtovPtCut;
1063  std::vector<unsigned> NHitCut;
1064  bool useIterTracking;
1065  int nuclearInteractionsPurity;
1066  options_->GetOpt("particle_flow", "DPtoverPt_Cut", DPtovPtCut);
1067  options_->GetOpt("particle_flow", "NHit_Cut", NHitCut);
1068  options_->GetOpt("particle_flow", "useIterTracking", useIterTracking);
1069  options_->GetOpt("particle_flow", "nuclearInteractionsPurity", nuclearInteractionsPurity);
1070 
1071 
1072  std::vector<double> PhotonSelectionCuts;
1073  options_->GetOpt("particle_flow","useEGPhotons",useEGPhotons_);
1074  options_->GetOpt("particle_flow","photonSelection", PhotonSelectionCuts);
1075 
1076  try {
1077  pfBlockAlgo_.setParameters( DPtovPtCut,
1078  NHitCut,
1079  useIterTracking,
1081  nuclearInteractionsPurity,
1082  useEGPhotons_,
1083  PhotonSelectionCuts,
1084  false,
1085  false
1086  );
1087  }
1088  catch( std::exception& err ) {
1089  cerr<<"exception setting PFBlockAlgo parameters: "
1090  <<err.what()<<". terminating."<<endl;
1091  delete this;
1092  exit(1);
1093  }
1094 
1095 
1096  bool blockAlgoDebug = false;
1097  options_->GetOpt("blockAlgo", "debug", blockAlgoDebug);
1098  pfBlockAlgo_.setDebug( blockAlgoDebug );
1099 
1100  bool AlgoDebug = false;
1101  options_->GetOpt("PFAlgo", "debug", AlgoDebug);
1102  pfAlgo_.setDebug( AlgoDebug );
1103 
1104  // read PFCluster calibration parameters
1105  boost::shared_ptr<PFEnergyCalibration>
1106  calibration( new PFEnergyCalibration() );
1107  calibration_ = calibration;
1108 
1109  bool usePFSCEleCalib;
1110  std::vector<double> calibPFSCEle_Fbrem_barrel;
1111  std::vector<double> calibPFSCEle_Fbrem_endcap;
1112  std::vector<double> calibPFSCEle_barrel;
1113  std::vector<double> calibPFSCEle_endcap;
1114  options_->GetOpt("particle_flow","usePFSCEleCalib",usePFSCEleCalib);
1115  options_->GetOpt("particle_flow","calibPFSCEle_Fbrem_barrel",calibPFSCEle_Fbrem_barrel);
1116  options_->GetOpt("particle_flow","calibPFSCEle_Fbrem_endcap",calibPFSCEle_Fbrem_endcap);
1117  options_->GetOpt("particle_flow","calibPFSCEle_barrel",calibPFSCEle_barrel);
1118  options_->GetOpt("particle_flow","calibPFSCEle_endcap",calibPFSCEle_endcap);
1119  boost::shared_ptr<PFSCEnergyCalibration>
1120  thePFSCEnergyCalibration (new PFSCEnergyCalibration(calibPFSCEle_Fbrem_barrel,calibPFSCEle_Fbrem_endcap,
1121  calibPFSCEle_barrel,calibPFSCEle_endcap ));
1122 
1123  bool useEGammaSupercluster;
1124  double sumEtEcalIsoForEgammaSC_barrel;
1125  double sumEtEcalIsoForEgammaSC_endcap;
1126  double coneEcalIsoForEgammaSC;
1127  double sumPtTrackIsoForEgammaSC_barrel;
1128  double sumPtTrackIsoForEgammaSC_endcap;
1129  unsigned int nTrackIsoForEgammaSC;
1130  double coneTrackIsoForEgammaSC;
1131  options_->GetOpt("particle_flow","useEGammaSupercluster",useEGammaSupercluster);
1132  options_->GetOpt("particle_flow","sumEtEcalIsoForEgammaSC_barrel",sumEtEcalIsoForEgammaSC_barrel);
1133  options_->GetOpt("particle_flow","sumEtEcalIsoForEgammaSC_endcap",sumEtEcalIsoForEgammaSC_endcap);
1134  options_->GetOpt("particle_flow","coneEcalIsoForEgammaSC",coneEcalIsoForEgammaSC);
1135  options_->GetOpt("particle_flow","sumPtTrackIsoForEgammaSC_barrel",sumPtTrackIsoForEgammaSC_barrel);
1136  options_->GetOpt("particle_flow","sumPtTrackIsoForEgammaSC_endcap",sumPtTrackIsoForEgammaSC_endcap);
1137  options_->GetOpt("particle_flow","nTrackIsoForEgammaSC",nTrackIsoForEgammaSC);
1138  options_->GetOpt("particle_flow","coneTrackIsoForEgammaSC",coneTrackIsoForEgammaSC);
1139  options_->GetOpt("particle_flow","useEGammaElectrons",useEGElectrons_);
1140 
1141  //--ab: get calibration factors for HF:
1142  bool calibHF_use = false;
1143  std::vector<double> calibHF_eta_step;
1144  std::vector<double> calibHF_a_EMonly;
1145  std::vector<double> calibHF_b_HADonly;
1146  std::vector<double> calibHF_a_EMHAD;
1147  std::vector<double> calibHF_b_EMHAD;
1148 
1149  options_->GetOpt("particle_flow","calib_calibHF_use",calibHF_use);
1150  options_->GetOpt("particle_flow","calib_calibHF_eta_step",calibHF_eta_step);
1151  options_->GetOpt("particle_flow","calib_calibHF_a_EMonly",calibHF_a_EMonly);
1152  options_->GetOpt("particle_flow","calib_calibHF_b_HADonly",calibHF_b_HADonly);
1153  options_->GetOpt("particle_flow","calib_calibHF_a_EMHAD",calibHF_a_EMHAD);
1154  options_->GetOpt("particle_flow","calib_calibHF_b_EMHAD",calibHF_b_EMHAD);
1155 
1156  boost::shared_ptr<PFEnergyCalibrationHF> thepfEnergyCalibrationHF
1157  ( new PFEnergyCalibrationHF(calibHF_use,calibHF_eta_step,calibHF_a_EMonly,calibHF_b_HADonly,calibHF_a_EMHAD,calibHF_b_EMHAD) ) ;
1158 
1159  thepfEnergyCalibrationHF_ = thepfEnergyCalibrationHF;
1160 
1161 
1162  //----------------------------------------
1163  double nSigmaECAL = 99999;
1164  options_->GetOpt("particle_flow", "nsigma_ECAL", nSigmaECAL);
1165  double nSigmaHCAL = 99999;
1166  options_->GetOpt("particle_flow", "nsigma_HCAL", nSigmaHCAL);
1167 
1168  try {
1169  pfAlgo_.setParameters( nSigmaECAL, nSigmaHCAL,
1170  calibration, thepfEnergyCalibrationHF_);
1171  }
1172  catch( std::exception& err ) {
1173  cerr<<"exception setting PFAlgo parameters: "
1174  <<err.what()<<". terminating."<<endl;
1175  delete this;
1176  exit(1);
1177  }
1178 
1179  std::vector<double> muonHCAL;
1180  std::vector<double> muonECAL;
1181  std::vector<double> muonHO;
1182  options_->GetOpt("particle_flow", "muon_HCAL", muonHCAL);
1183  options_->GetOpt("particle_flow", "muon_ECAL", muonECAL);
1184  options_->GetOpt("particle_flow", "muon_HO", muonHO);
1185 
1186  assert ( muonHCAL.size() == 2 && muonECAL.size() == 2 && muonHO.size() == 2);
1187 
1188  double nSigmaTRACK = 3.0;
1189  options_->GetOpt("particle_flow", "nsigma_TRACK", nSigmaTRACK);
1190 
1191  double ptError = 1.0;
1192  options_->GetOpt("particle_flow", "pt_error", ptError);
1193 
1194  std::vector<double> factors45;
1195  options_->GetOpt("particle_flow", "factors_45", factors45);
1196  assert ( factors45.size() == 2 );
1197 
1198  edm::ParameterSet iConfig;
1199 
1200 
1201  double maxDPtOPt;
1202  options_->GetOpt("particle_flow", "maxDPtOPt", maxDPtOPt);
1203  iConfig.addParameter<double>("maxDPtOPt",maxDPtOPt);
1204 
1205  int minTrackerHits;
1206  options_->GetOpt("particle_flow", "minTrackerHits", minTrackerHits);
1207  iConfig.addParameter<int>("minTrackerHits",minTrackerHits);
1208 
1209  int minPixelHits;
1210  options_->GetOpt("particle_flow", "minPixelHits", minPixelHits);
1211  iConfig.addParameter<int>("minPixelHits",minPixelHits);
1212 
1214  options_->GetOpt("particle_flow", "trackQuality", trackQuality);
1215  iConfig.addParameter<std::string>("trackQuality",trackQuality);
1216 
1217  double ptErrorScale;
1218  options_->GetOpt("particle_flow", "ptErrorScale", ptErrorScale);
1219  iConfig.addParameter<double>("ptErrorScale",ptErrorScale);
1220 
1221  double eventFractionForCleaning;
1222  options_->GetOpt("particle_flow", "eventFractionForCleaning", eventFractionForCleaning);
1223  iConfig.addParameter<double>("eventFractionForCleaning",eventFractionForCleaning);
1224 
1225  double dzpv;
1226  options_->GetOpt("particle_flow", "dzPV", dzpv);
1227  iConfig.addParameter<double>("dzPV",dzpv);
1228 
1229  bool postMuonCleaning;
1230  options_->GetOpt("particle_flow", "postMuonCleaning", postMuonCleaning);
1231  iConfig.addParameter<bool>("postMuonCleaning",postMuonCleaning);
1232 
1233  double minPtForPostCleaning;
1234  options_->GetOpt("particle_flow", "minPtForPostCleaning", minPtForPostCleaning);
1235  iConfig.addParameter<double>("minPtForPostCleaning",minPtForPostCleaning);
1236 
1237  double eventFactorForCosmics;
1238  options_->GetOpt("particle_flow", "eventFactorForCosmics", eventFactorForCosmics);
1239  iConfig.addParameter<double>("eventFactorForCosmics",eventFactorForCosmics);
1240 
1241  double minSignificanceForCleaning;
1242  options_->GetOpt("particle_flow", "metSignificanceForCleaning", minSignificanceForCleaning);
1243  iConfig.addParameter<double>("metSignificanceForCleaning",minSignificanceForCleaning);
1244 
1245  double minSignificanceForRejection;
1246  options_->GetOpt("particle_flow", "metSignificanceForRejection", minSignificanceForRejection);
1247  iConfig.addParameter<double>("metSignificanceForRejection",minSignificanceForRejection);
1248 
1249  double metFactorForCleaning;
1250  options_->GetOpt("particle_flow", "metFactorForCleaning", metFactorForCleaning);
1251  iConfig.addParameter<double>("metFactorForCleaning",metFactorForCleaning);
1252 
1253  double eventFractionForRejection;
1254  options_->GetOpt("particle_flow", "eventFractionForRejection", eventFractionForRejection);
1255  iConfig.addParameter<double>("eventFractionForRejection",eventFractionForRejection);
1256 
1257  double metFactorForRejection;
1258  options_->GetOpt("particle_flow", "metFactorForRejection", metFactorForRejection);
1259  iConfig.addParameter<double>("metFactorForRejection",metFactorForRejection);
1260 
1261  double metFactorForHighEta;
1262  options_->GetOpt("particle_flow", "metFactorForHighEta", metFactorForHighEta);
1263  iConfig.addParameter<double>("metFactorForHighEta",metFactorForHighEta);
1264 
1265  double ptFactorForHighEta;
1266  options_->GetOpt("particle_flow", "ptFactorForHighEta", ptFactorForHighEta);
1267  iConfig.addParameter<double>("ptFactorForHighEta",ptFactorForHighEta);
1268 
1269 
1270  double metFactorForFakes;
1271  options_->GetOpt("particle_flow", "metFactorForFakes", metFactorForFakes);
1272  iConfig.addParameter<double>("metFactorForFakes",metFactorForFakes);
1273 
1274  double minMomentumForPunchThrough;
1275  options_->GetOpt("particle_flow", "minMomentumForPunchThrough", minMomentumForPunchThrough);
1276  iConfig.addParameter<double>("minMomentumForPunchThrough",minMomentumForPunchThrough);
1277 
1278  double minEnergyForPunchThrough;
1279  options_->GetOpt("particle_flow", "minEnergyForPunchThrough", minEnergyForPunchThrough);
1280  iConfig.addParameter<double>("minEnergyForPunchThrough",minEnergyForPunchThrough);
1281 
1282 
1283  double punchThroughFactor;
1284  options_->GetOpt("particle_flow", "punchThroughFactor", punchThroughFactor);
1285  iConfig.addParameter<double>("punchThroughFactor",punchThroughFactor);
1286 
1287  double punchThroughMETFactor;
1288  options_->GetOpt("particle_flow", "punchThroughMETFactor", punchThroughMETFactor);
1289  iConfig.addParameter<double>("punchThroughMETFactor",punchThroughMETFactor);
1290 
1291 
1292  double cosmicRejectionDistance;
1293  options_->GetOpt("particle_flow", "cosmicRejectionDistance", cosmicRejectionDistance);
1294  iConfig.addParameter<double>("cosmicRejectionDistance",cosmicRejectionDistance);
1295 
1296  try {
1298 }
1299  catch( std::exception& err ) {
1300  cerr<<"exception setting PFAlgo Muon and Fake parameters: "
1301  <<err.what()<<". terminating."<<endl;
1302  delete this;
1303  exit(1);
1304  }
1305 
1306  bool postHFCleaning = true;
1307  options_->GetOpt("particle_flow", "postHFCleaning", postHFCleaning);
1308  double minHFCleaningPt = 5.;
1309  options_->GetOpt("particle_flow", "minHFCleaningPt", minHFCleaningPt);
1310  double minSignificance = 2.5;
1311  options_->GetOpt("particle_flow", "minSignificance", minSignificance);
1312  double maxSignificance = 2.5;
1313  options_->GetOpt("particle_flow", "maxSignificance", maxSignificance);
1314  double minSignificanceReduction = 1.4;
1315  options_->GetOpt("particle_flow", "minSignificanceReduction", minSignificanceReduction);
1316  double maxDeltaPhiPt = 7.0;
1317  options_->GetOpt("particle_flow", "maxDeltaPhiPt", maxDeltaPhiPt);
1318  double minDeltaMet = 0.4;
1319  options_->GetOpt("particle_flow", "minDeltaMet", minDeltaMet);
1320 
1321  // Set post HF cleaning muon parameters
1322  try {
1323  pfAlgo_.setPostHFCleaningParameters(postHFCleaning,
1324  minHFCleaningPt,
1325  minSignificance,
1326  maxSignificance,
1327  minSignificanceReduction,
1328  maxDeltaPhiPt,
1329  minDeltaMet);
1330  }
1331  catch( std::exception& err ) {
1332  cerr<<"exception setting post HF cleaning parameters: "
1333  <<err.what()<<". terminating."<<endl;
1334  delete this;
1335  exit(1);
1336  }
1337 
1338  useAtHLT_ = false;
1339  options_->GetOpt("particle_flow", "useAtHLT", useAtHLT_);
1340  cout<<"use HLT tracking "<<useAtHLT_<<endl;
1341 
1342  useHO_ = true;
1343  options_->GetOpt("particle_flow", "useHO", useHO_);
1344  cout<<"use of HO "<<useHO_<<endl;
1345 
1346 
1347  usePFElectrons_ = false; // set true to use PFElectrons
1348  options_->GetOpt("particle_flow", "usePFElectrons", usePFElectrons_);
1349  cout<<"use PFElectrons "<<usePFElectrons_<<endl;
1350 
1351  if( usePFElectrons_ ) {
1352  // PFElectrons options -----------------------------
1353  double mvaEleCut = -1.; // if = -1. get all the pre-id electrons
1354  options_->GetOpt("particle_flow", "electron_mvaCut", mvaEleCut);
1355 
1356  bool applyCrackCorrections=true;
1357  options_->GetOpt("particle_flow","electron_crackCorrection",applyCrackCorrections);
1358 
1359  string mvaWeightFileEleID = "";
1360  options_->GetOpt("particle_flow", "electronID_mvaWeightFile",
1361  mvaWeightFileEleID);
1362  mvaWeightFileEleID = expand(mvaWeightFileEleID);
1363 
1364  std::string egammaElectronstagname;
1365  options_->GetOpt("particle_flow","egammaElectrons",egammaElectronstagname);
1366  egammaElectronsTag_ = edm::InputTag(egammaElectronstagname);
1367 
1368  //HO in the algorithm or not
1371 
1372  try {
1373  pfAlgo_.setPFEleParameters(mvaEleCut,
1374  mvaWeightFileEleID,
1376  thePFSCEnergyCalibration,
1377  calibration,
1378  sumEtEcalIsoForEgammaSC_barrel,
1379  sumEtEcalIsoForEgammaSC_endcap,
1380  coneEcalIsoForEgammaSC,
1381  sumPtTrackIsoForEgammaSC_barrel,
1382  sumPtTrackIsoForEgammaSC_endcap,
1383  nTrackIsoForEgammaSC,
1384  coneTrackIsoForEgammaSC,
1385  applyCrackCorrections,
1386  usePFSCEleCalib,
1388  useEGammaSupercluster);
1389  }
1390  catch( std::exception& err ) {
1391  cerr<<"exception setting PFAlgo Electron parameters: "
1392  <<err.what()<<". terminating."<<endl;
1393  delete this;
1394  exit(1);
1395  }
1396  }
1397 
1398  bool usePFPhotons = true;
1399  bool useReg=false;
1400  string mvaWeightFileConvID = "";
1401  string mvaWeightFileRegLCEB="";
1402  string mvaWeightFileRegLCEE="";
1403  string mvaWeightFileRegGCEB="";
1404  string mvaWeightFileRegGCEEhr9="";
1405  string mvaWeightFileRegGCEElr9="";
1406  string mvaWeightFileRegRes="";
1407  string X0Map="";
1408  double mvaConvCut=-1.;
1409  double sumPtTrackIsoForPhoton=2.0;
1410  double sumPtTrackIsoSlopeForPhoton=0.001;
1411  options_->GetOpt("particle_flow", "usePFPhotons", usePFPhotons);
1412  options_->GetOpt("particle_flow", "conv_mvaCut", mvaConvCut);
1413  options_->GetOpt("particle_flow", "useReg", useReg);
1414  options_->GetOpt("particle_flow", "convID_mvaWeightFile", mvaWeightFileConvID);
1415  options_->GetOpt("particle_flow", "mvaWeightFileRegLCEB", mvaWeightFileRegLCEB);
1416  options_->GetOpt("particle_flow", "mvaWeightFileRegLCEE", mvaWeightFileRegLCEE);
1417  options_->GetOpt("particle_flow", "mvaWeightFileRegGCEB", mvaWeightFileRegGCEB);
1418  options_->GetOpt("particle_flow", "mvaWeightFileRegGCEEHr9", mvaWeightFileRegGCEEhr9);
1419  options_->GetOpt("particle_flow", "mvaWeightFileRegGCEELr9", mvaWeightFileRegGCEElr9);
1420  options_->GetOpt("particle_flow", "mvaWeightFileRegRes", mvaWeightFileRegRes);
1421  options_->GetOpt("particle_flow", "X0Map", X0Map);
1422  options_->GetOpt("particle_flow","sumPtTrackIsoForPhoton",sumPtTrackIsoForPhoton);
1423  options_->GetOpt("particle_flow","sumPtTrackIsoSlopeForPhoton",sumPtTrackIsoSlopeForPhoton);
1424  // cout<<"use PFPhotons "<<usePFPhotons<<endl;
1425 
1426  if( usePFPhotons ) {
1427  // PFPhoton options -----------------------------
1428  TFile *infile_PFLCEB = new TFile(mvaWeightFileRegLCEB.c_str(),"READ");
1429  TFile *infile_PFLCEE = new TFile(mvaWeightFileRegLCEE.c_str(),"READ");
1430  TFile *infile_PFGCEB = new TFile(mvaWeightFileRegGCEB.c_str(),"READ");
1431  TFile *infile_PFGCEEhR9 = new TFile(mvaWeightFileRegGCEEhr9.c_str(),"READ");
1432  TFile *infile_PFGCEElR9 = new TFile(mvaWeightFileRegGCEElr9.c_str(),"READ");
1433  TFile *infile_PFRes = new TFile(mvaWeightFileRegRes.c_str(),"READ");
1434 
1435  const GBRForest *gbrLCBar = (GBRForest*)infile_PFLCEB->Get("PFLCorrEB");
1436  const GBRForest *gbrLCEnd = (GBRForest*)infile_PFLCEE->Get("PFLCorrEE");
1437  const GBRForest *gbrGCEB = (GBRForest*)infile_PFGCEB->Get("PFGCorrEB");
1438  const GBRForest *gbrGCEEhr9 = (GBRForest*)infile_PFGCEEhR9->Get("PFGCorrEEHr9");
1439  const GBRForest *gbrGCEElr9 = (GBRForest*)infile_PFGCEElR9->Get("PFGCorrEELr9");
1440  const GBRForest *gbrRes = (GBRForest*)infile_PFRes->Get("PFRes");
1441  try {
1443  (usePFPhotons,
1444  mvaWeightFileConvID,
1445  mvaConvCut,
1446  useReg,
1447  X0Map,
1448  calibration,
1449  sumPtTrackIsoForPhoton,
1450  sumPtTrackIsoSlopeForPhoton
1451  );
1452  pfAlgo_.setPFPhotonRegWeights(gbrLCBar, gbrLCEnd,gbrGCEB,
1453  gbrGCEEhr9,gbrGCEElr9,
1454  gbrRes
1455  );
1456 
1457  }
1458  catch( std::exception& err ) {
1459  cerr<<"exception setting PFAlgo Photon parameters: "
1460  <<err.what()<<". terminating."<<endl;
1461  delete this;
1462  exit(1);
1463  }
1464  }
1465 
1466 
1467 
1468  bool rejectTracks_Bad = true;
1469  bool rejectTracks_Step45 = true;
1470  bool usePFConversions = false; // set true to use PFConversions
1471  bool usePFNuclearInteractions = false;
1472  bool usePFV0s = false;
1473 
1474 
1475  double dptRel_DispVtx = 10;
1476 
1477 
1478  options_->GetOpt("particle_flow", "usePFConversions", usePFConversions);
1479  options_->GetOpt("particle_flow", "usePFV0s", usePFV0s);
1480  options_->GetOpt("particle_flow", "usePFNuclearInteractions", usePFNuclearInteractions);
1481  options_->GetOpt("particle_flow", "dptRel_DispVtx", dptRel_DispVtx);
1482 
1483  try {
1484  pfAlgo_.setDisplacedVerticesParameters(rejectTracks_Bad,
1485  rejectTracks_Step45,
1486  usePFNuclearInteractions,
1487  usePFConversions,
1488  usePFV0s,
1489  dptRel_DispVtx);
1490 
1491  }
1492  catch( std::exception& err ) {
1493  cerr<<"exception setting PFAlgo displaced vertex parameters: "
1494  <<err.what()<<". terminating."<<endl;
1495  delete this;
1496  exit(1);
1497  }
1498 
1499  bool bCorrect = false;
1500  bool bCalibPrimary = false;
1501  double dptRel_PrimaryTrack = 0;
1502  double dptRel_MergedTrack = 0;
1503  double ptErrorSecondary = 0;
1504  vector<double> nuclCalibFactors;
1505 
1506  options_->GetOpt("particle_flow", "bCorrect", bCorrect);
1507  options_->GetOpt("particle_flow", "bCalibPrimary", bCalibPrimary);
1508  options_->GetOpt("particle_flow", "dptRel_PrimaryTrack", dptRel_PrimaryTrack);
1509  options_->GetOpt("particle_flow", "dptRel_MergedTrack", dptRel_MergedTrack);
1510  options_->GetOpt("particle_flow", "ptErrorSecondary", ptErrorSecondary);
1511  options_->GetOpt("particle_flow", "nuclCalibFactors", nuclCalibFactors);
1512 
1513  try {
1514  pfAlgo_.setCandConnectorParameters(bCorrect, bCalibPrimary, dptRel_PrimaryTrack, dptRel_MergedTrack, ptErrorSecondary, nuclCalibFactors);
1515  }
1516  catch( std::exception& err ) {
1517  cerr<<"exception setting PFAlgo cand connector parameters: "
1518  <<err.what()<<". terminating."<<endl;
1519  delete this;
1520  exit(1);
1521  }
1522 
1523 
1524 
1525 
1526  int algo = 2;
1527  options_->GetOpt("particle_flow", "algorithm", algo);
1528 
1529  pfAlgo_.setAlgo( algo );
1530  // pfAlgoOther_.setAlgo( 1 );
1531 
1532 
1533  // jets options ---------------------------------
1534 
1535  doJets_ = false;
1536  options_->GetOpt("jets", "on/off", doJets_);
1537 
1538  jetsDebug_ = false;
1539  options_->GetOpt("jets", "debug", jetsDebug_);
1540 
1541  jetAlgoType_=3; //FastJet as Default
1542  options_->GetOpt("jets", "algo", jetAlgoType_);
1543 
1544  double mEtInputCut = 0.5;
1545  options_->GetOpt("jets", "EtInputCut", mEtInputCut);
1546 
1547  double mEInputCut = 0.;
1548  options_->GetOpt("jets", "EInputCut", mEInputCut);
1549 
1550  double seedThreshold = 1.0;
1551  options_->GetOpt("jets", "seedThreshold", seedThreshold);
1552 
1553  double coneRadius = 0.5;
1554  options_->GetOpt("jets", "coneRadius", coneRadius);
1555 
1556  double coneAreaFraction= 1.0;
1557  options_->GetOpt("jets", "coneAreaFraction", coneAreaFraction);
1558 
1559  int maxPairSize=2;
1560  options_->GetOpt("jets", "maxPairSize", maxPairSize);
1561 
1562  int maxIterations=100;
1563  options_->GetOpt("jets", "maxIterations", maxIterations);
1564 
1565  double overlapThreshold = 0.75;
1566  options_->GetOpt("jets", "overlapThreshold", overlapThreshold);
1567 
1568  double ptMin = 10.;
1569  options_->GetOpt("jets", "ptMin", ptMin);
1570 
1571  double rparam = 1.0;
1572  options_->GetOpt("jets", "rParam", rparam);
1573 
1574  jetMaker_.setmEtInputCut (mEtInputCut);
1575  jetMaker_.setmEInputCut(mEInputCut);
1576  jetMaker_.setSeedThreshold(seedThreshold);
1577  jetMaker_.setConeRadius(coneRadius);
1578  jetMaker_.setConeAreaFraction(coneAreaFraction);
1579  jetMaker_.setMaxPairSize(maxPairSize);
1580  jetMaker_.setMaxIterations(maxIterations) ;
1581  jetMaker_.setOverlapThreshold(overlapThreshold) ;
1582  jetMaker_.setPtMin (ptMin);
1583  jetMaker_.setRParam (rparam);
1586  cout <<"Opt: doJets? " << doJets_ <<endl;
1587  cout <<"Opt: jetsDebug " << jetsDebug_ <<endl;
1588  cout <<"Opt: algoType " << jetAlgoType_ <<endl;
1589  cout <<"----------------------------------" << endl;
1590 
1591 
1592  // tau benchmark options ---------------------------------
1593 
1594  doTauBenchmark_ = false;
1595  options_->GetOpt("tau_benchmark", "on/off", doTauBenchmark_);
1596 
1597  if (doTauBenchmark_) {
1598  double coneAngle = 0.5;
1599  options_->GetOpt("tau_benchmark", "cone_angle", coneAngle);
1600 
1601  double seedEt = 0.4;
1602  options_->GetOpt("tau_benchmark", "seed_et", seedEt);
1603 
1604  double coneMerge = 100.0;
1605  options_->GetOpt("tau_benchmark", "cone_merge", coneMerge);
1606 
1607  options_->GetOpt("tau_benchmark", "debug", tauBenchmarkDebug_);
1608 
1609  // cout<<"jets debug "<<jetsDebug_<<endl;
1610 
1611  if( tauBenchmarkDebug_ ) {
1612  cout << "Tau Benchmark Options : ";
1613  cout << "Angle=" << coneAngle << " seedEt=" << seedEt
1614  << " Merge=" << coneMerge << endl;
1615  }
1616 
1617  jetAlgo_.SetConeAngle(coneAngle);
1618  jetAlgo_.SetSeedEt(seedEt);
1619  jetAlgo_.SetConeMerge(coneMerge);
1620  }
1621 
1622 
1623 
1624  // print flags -------------
1625 
1626  printRecHits_ = false;
1627  printRecHitsEMin_ = 0.;
1628  options_->GetOpt("print", "rechits", printRecHits_ );
1629  options_->GetOpt("print", "rechits_emin", printRecHitsEMin_ );
1630 
1631  printClusters_ = false;
1632  printClustersEMin_ = 0.;
1633  options_->GetOpt("print", "clusters", printClusters_ );
1634  options_->GetOpt("print", "clusters_emin", printClustersEMin_ );
1635 
1636  printPFBlocks_ = false;
1637  options_->GetOpt("print", "PFBlocks", printPFBlocks_ );
1638 
1639  printPFCandidates_ = true;
1641  options_->GetOpt("print", "PFCandidates", printPFCandidates_ );
1642  options_->GetOpt("print", "PFCandidates_ptmin", printPFCandidatesPtMin_ );
1643 
1644  printPFJets_ = true;
1645  printPFJetsPtMin_ = 0.;
1646  options_->GetOpt("print", "jets", printPFJets_ );
1647  options_->GetOpt("print", "jets_ptmin", printPFJetsPtMin_ );
1648 
1649  printSimParticles_ = true;
1651  options_->GetOpt("print", "simParticles", printSimParticles_ );
1652  options_->GetOpt("print", "simParticles_ptmin", printSimParticlesPtMin_ );
1653 
1654  printGenParticles_ = true;
1656  options_->GetOpt("print", "genParticles", printGenParticles_ );
1657  options_->GetOpt("print", "genParticles_ptmin", printGenParticlesPtMin_ );
1658 
1659  //MCTruthMatching Tool set to false by default
1660  //can only be used with fastsim and the UnFoldedMode set to true
1661  //when generating the simulated file
1662  printMCTruthMatching_ = false;
1663  options_->GetOpt("print", "mctruthmatching", printMCTruthMatching_ );
1664 
1665 
1666  verbosity_ = VERBOSE;
1667  options_->GetOpt("print", "verbosity", verbosity_ );
1668  cout<<"verbosity : "<<verbosity_<<endl;
1669 
1670 
1671 
1672 
1673 
1674 }
1675 
1676 void PFRootEventManager::connect( const char* infilename ) {
1677 
1678  cout<<"Opening input root files"<<endl;
1679 
1680  options_->GetOpt("root","file", inFileNames_);
1681 
1682 
1683 
1684  try {
1686  }
1687  catch(string& err) {
1688  cout<<err<<endl;
1689  }
1690 
1692 
1693 
1694  if ( !ev_ || !ev_->isValid() ) {
1695  cout << "The rootfile(s) " << endl;
1696  for ( unsigned int ifile=0; ifile<inFileNames_.size(); ++ifile )
1697  std::cout << " - " << inFileNames_[ifile] << std::endl;
1698  cout << " is (are) not valid file(s) to open" << endl;
1699  return;
1700  } else {
1701  cout << "The rootfile(s) : " << endl;
1702  for ( unsigned int ifile=0; ifile<inFileNames_.size(); ++ifile )
1703  std::cout << " - " << inFileNames_[ifile] << std::endl;
1704  cout<<" are opened with " << ev_->size() << " events." <<endl;
1705  }
1706 
1707  // hits branches ----------------------------------------------
1708  std::string rechitsECALtagname;
1709  options_->GetOpt("root","rechits_ECAL_inputTag", rechitsECALtagname);
1710  rechitsECALTag_ = edm::InputTag(rechitsECALtagname);
1711 
1712  std::string rechitsHCALtagname;
1713  options_->GetOpt("root","rechits_HCAL_inputTag", rechitsHCALtagname);
1714  rechitsHCALTag_ = edm::InputTag(rechitsHCALtagname);
1715 
1716  std::string rechitsHOtagname;
1717  options_->GetOpt("root","rechits_HO_inputTag", rechitsHOtagname);
1718  rechitsHOTag_ = edm::InputTag(rechitsHOtagname);
1719 
1720  std::string rechitsHFEMtagname;
1721  options_->GetOpt("root","rechits_HFEM_inputTag", rechitsHFEMtagname);
1722  rechitsHFEMTag_ = edm::InputTag(rechitsHFEMtagname);
1723 
1724  std::string rechitsHFHADtagname;
1725  options_->GetOpt("root","rechits_HFHAD_inputTag", rechitsHFHADtagname);
1726  rechitsHFHADTag_ = edm::InputTag(rechitsHFHADtagname);
1727 
1728  std::vector<string> rechitsCLEANEDtagnames;
1729  options_->GetOpt("root","rechits_CLEANED_inputTags", rechitsCLEANEDtagnames);
1730  for ( unsigned tags = 0; tags<rechitsCLEANEDtagnames.size(); ++tags )
1731  rechitsCLEANEDTags_.push_back(edm::InputTag(rechitsCLEANEDtagnames[tags]));
1732  rechitsCLEANEDV_.resize(rechitsCLEANEDTags_.size());
1734 
1735 
1736  // Tracks branches
1737  std::string rechitsPStagname;
1738  options_->GetOpt("root","rechits_PS_inputTag", rechitsPStagname);
1739  rechitsPSTag_ = edm::InputTag(rechitsPStagname);
1740 
1741  std::string recTrackstagname;
1742  options_->GetOpt("root","recTracks_inputTag", recTrackstagname);
1743  recTracksTag_ = edm::InputTag(recTrackstagname);
1744 
1745  std::string displacedRecTrackstagname;
1746  options_->GetOpt("root","displacedRecTracks_inputTag", displacedRecTrackstagname);
1747  displacedRecTracksTag_ = edm::InputTag(displacedRecTrackstagname);
1748 
1749  std::string primaryVerticestagname;
1750  options_->GetOpt("root","primaryVertices_inputTag", primaryVerticestagname);
1751  primaryVerticesTag_ = edm::InputTag(primaryVerticestagname);
1752 
1753  std::string stdTrackstagname;
1754  options_->GetOpt("root","stdTracks_inputTag", stdTrackstagname);
1755  stdTracksTag_ = edm::InputTag(stdTrackstagname);
1756 
1757  std::string gsfrecTrackstagname;
1758  options_->GetOpt("root","gsfrecTracks_inputTag", gsfrecTrackstagname);
1759  gsfrecTracksTag_ = edm::InputTag(gsfrecTrackstagname);
1760 
1761  useConvBremGsfTracks_ = false;
1762  options_->GetOpt("particle_flow", "useConvBremGsfTracks", useConvBremGsfTracks_);
1763  if ( useConvBremGsfTracks_ ) {
1764  std::string convBremGsfrecTrackstagname;
1765  options_->GetOpt("root","convBremGsfrecTracks_inputTag", convBremGsfrecTrackstagname);
1766  convBremGsfrecTracksTag_ = edm::InputTag(convBremGsfrecTrackstagname);
1767  }
1768 
1769  useConvBremPFRecTracks_ = false;
1770  options_->GetOpt("particle_flow", "useConvBremPFRecTracks", useConvBremPFRecTracks_);
1771 
1772 
1773  // muons branch
1774  std::string muonstagname;
1775  options_->GetOpt("root","muon_inputTag", muonstagname);
1776  muonsTag_ = edm::InputTag(muonstagname);
1777 
1778  // conversion
1779  usePFConversions_=false;
1780  options_->GetOpt("particle_flow", "usePFConversions", usePFConversions_);
1781  if( usePFConversions_ ) {
1782  std::string conversiontagname;
1783  options_->GetOpt("root","conversion_inputTag", conversiontagname);
1784  conversionTag_ = edm::InputTag(conversiontagname);
1785  }
1786 
1787  // V0
1788  usePFV0s_=false;
1789  options_->GetOpt("particle_flow", "usePFV0s", usePFV0s_);
1790  if( usePFV0s_ ) {
1791  std::string v0tagname;
1792  options_->GetOpt("root","V0_inputTag", v0tagname);
1793  v0Tag_ = edm::InputTag(v0tagname);
1794  }
1795 
1796  // Photons
1797  std::string photontagname;
1798  options_->GetOpt("root","Photon_inputTag",photontagname);
1799  photonTag_ = edm::InputTag(photontagname);
1800 
1801  //Displaced Vertices
1803  options_->GetOpt("particle_flow", "usePFNuclearInteractions", usePFNuclearInteractions_);
1805  std::string pfNuclearTrackerVertextagname;
1806  options_->GetOpt("root","PFDisplacedVertex_inputTag", pfNuclearTrackerVertextagname);
1807  pfNuclearTrackerVertexTag_ = edm::InputTag(pfNuclearTrackerVertextagname);
1808  }
1809 
1810  std::string trueParticlestagname;
1811  options_->GetOpt("root","trueParticles_inputTag", trueParticlestagname);
1812  trueParticlesTag_ = edm::InputTag(trueParticlestagname);
1813 
1814  std::string MCTruthtagname;
1815  options_->GetOpt("root","MCTruth_inputTag", MCTruthtagname);
1816  MCTruthTag_ = edm::InputTag(MCTruthtagname);
1817 
1818  std::string caloTowerstagname;
1819  options_->GetOpt("root","caloTowers_inputTag", caloTowerstagname);
1820  caloTowersTag_ = edm::InputTag(caloTowerstagname);
1821 
1822  std::string genJetstagname;
1823  options_->GetOpt("root","genJets_inputTag", genJetstagname);
1824  genJetsTag_ = edm::InputTag(genJetstagname);
1825 
1826 
1827  std::string genParticlesforMETtagname;
1828  options_->GetOpt("root","genParticlesforMET_inputTag", genParticlesforMETtagname);
1829  genParticlesforMETTag_ = edm::InputTag(genParticlesforMETtagname);
1830 
1831  std::string genParticlesforJetstagname;
1832  options_->GetOpt("root","genParticlesforJets_inputTag", genParticlesforJetstagname);
1833  genParticlesforJetsTag_ = edm::InputTag(genParticlesforJetstagname);
1834 
1835  // PF candidates
1836  std::string pfCandidatetagname;
1837  options_->GetOpt("root","particleFlowCand_inputTag", pfCandidatetagname);
1838  pfCandidateTag_ = edm::InputTag(pfCandidatetagname);
1839 
1840  std::string caloJetstagname;
1841  options_->GetOpt("root","CaloJets_inputTag", caloJetstagname);
1842  caloJetsTag_ = edm::InputTag(caloJetstagname);
1843 
1844  std::string corrcaloJetstagname;
1845  options_->GetOpt("root","corrCaloJets_inputTag", corrcaloJetstagname);
1846  corrcaloJetsTag_ = edm::InputTag(corrcaloJetstagname);
1847 
1848  std::string pfJetstagname;
1849  options_->GetOpt("root","PFJets_inputTag", pfJetstagname);
1850  pfJetsTag_ = edm::InputTag(pfJetstagname);
1851 
1852  std::string pfMetstagname;
1853  options_->GetOpt("root","PFMET_inputTag", pfMetstagname);
1854  pfMetsTag_ = edm::InputTag(pfMetstagname);
1855 
1856  std::string caloMetstagname;
1857  options_->GetOpt("root","CaloMET_inputTag", caloMetstagname);
1858  caloMetsTag_ = edm::InputTag(caloMetstagname);
1859 
1860  std::string tcMetstagname;
1861  options_->GetOpt("root","TCMET_inputTag", tcMetstagname);
1862  tcMetsTag_ = edm::InputTag(tcMetstagname);
1863 
1864 }
1865 
1866 
1867 
1868 
1869 
1871 
1872  if(outFile_) {
1873  outFile_->Close();
1874  }
1875 
1876  if(outEvent_) delete outEvent_;
1877 
1878  delete options_;
1879 
1880 }
1881 
1882 
1884 
1886  if(doPFMETBenchmark_) metManager_->write();
1893 
1894  // Addition to have DQM histograms : by S. Dutta
1895  if (doPFDQM_) {
1896  cout << " Writing DQM root file " << endl;
1897  pfJetMonitor_.write();
1898  pfMETMonitor_.write();
1899  dqmFile_->Write();
1900  }
1901  //-----------------------------------------------
1902  if(outFile_) {
1903  outFile_->Write();
1904 // outFile_->cd();
1905 // // write histos here
1906 // cout<<"writing output to "<<outFile_->GetName()<<endl;
1907 // h_deltaETvisible_MCEHT_->Write();
1908 // h_deltaETvisible_MCPF_->Write();
1909 // if(outTree_) outTree_->Write();
1910 // if(doPFCandidateBenchmark_) pfCandidateBenchmark_.write();
1911  }
1912 }
1913 
1914 
1916 
1917  RunsMap::const_iterator iR = mapEventToEntry_.find( run );
1918  if( iR != mapEventToEntry_.end() ) {
1919  LumisMap::const_iterator iL = iR->second.find( lumi );
1920  if( iL != iR->second.end() ) {
1921  EventToEntry::const_iterator iE = iL->second.find( event );
1922  if( iE != iL->second.end() ) {
1923  return iE->second;
1924  }
1925  else {
1926  cout<<"event "<<event<<" not found in run "<<run<<", lumi "<<lumi<<endl;
1927  }
1928  }
1929  else {
1930  cout<<"lumi "<<lumi<<" not found in run "<<run<<endl;
1931  }
1932  }
1933  else{
1934  cout<<"run "<<run<<" not found"<<endl;
1935  }
1936  return -1;
1937 }
1938 
1940 
1941  int entry = eventToEntry(run, lumi, event);
1942  if( entry < 0 ) {
1943  cout<<"event "<<event<<" is not present, sorry."<<endl;
1944  return false;
1945  }
1946  else
1947  return processEntry( entry );
1948 }
1949 
1950 
1952 
1953  reset();
1954 
1955  iEvent_ = entry;
1956 
1957  bool exists = ev_->to(entry);
1958  if ( !exists ) {
1959  std::cout << "Entry " << entry << " does not exist " << std::endl;
1960  return false;
1961  }
1962  const edm::EventBase& iEvent = *ev_;
1963 
1964  if( outEvent_ ) outEvent_->setNumber(entry);
1965 
1966  if(verbosity_ == VERBOSE ||
1967  //entry < 10000 ||
1968  entry < 10 ||
1969  (entry < 100 && entry%10 == 0) ||
1970  (entry < 1000 && entry%100 == 0) ||
1971  entry%1000 == 0 )
1972  cout<<"process entry "<< entry
1973  <<", run "<<iEvent.id().run()
1974  <<", lumi "<<iEvent.id().luminosityBlock()
1975  <<", event:"<<iEvent.id().event()
1976  << endl;
1977 
1978  //ev_->getTFile()->cd();
1979 
1980  bool goodevent = readFromSimulation(entry);
1981 
1982  /*
1983  std::cout << "Rechits cleaned : " << std::endl;
1984  for(unsigned i=0; i<rechitsCLEANED_.size(); i++) {
1985  string seedstatus = " ";
1986  printRecHit(rechitsCLEANED_[i], i, seedstatus.c_str());
1987  }
1988  */
1989 
1990  if(verbosity_ == VERBOSE ) {
1991  cout<<"number of vertices : "<<primaryVertices_.size()<<endl;
1992  cout<<"number of recTracks : "<<recTracks_.size()<<endl;
1993  cout<<"number of gsfrecTracks : "<<gsfrecTracks_.size()<<endl;
1994  cout<<"number of convBremGsfrecTracks : "<<convBremGsfrecTracks_.size()<<endl;
1995  cout<<"number of muons : "<<muons_.size()<<endl;
1996  cout<<"number of displaced vertices : "<<pfNuclearTrackerVertex_.size()<<endl;
1997  cout<<"number of conversions : "<<conversion_.size()<<endl;
1998  cout<<"number of v0 : "<<v0_.size()<<endl;
1999  cout<<"number of stdTracks : "<<stdTracks_.size()<<endl;
2000  cout<<"number of true particles : "<<trueParticles_.size()<<endl;
2001  cout<<"number of ECAL rechits : "<<rechitsECAL_.size()<<endl;
2002  cout<<"number of HCAL rechits : "<<rechitsHCAL_.size()<<endl;
2003  cout<<"number of HO rechits : "<<rechitsHO_.size()<<endl;
2004  cout<<"number of HFEM rechits : "<<rechitsHFEM_.size()<<endl;
2005  cout<<"number of HFHAD rechits : "<<rechitsHFHAD_.size()<<endl;
2006  cout<<"number of HF Cleaned rechits : "<<rechitsCLEANED_.size()<<endl;
2007  cout<<"number of PS rechits : "<<rechitsPS_.size()<<endl;
2008  }
2009 
2010  if( doClustering_ ) {
2011  clustering();
2012 
2013  } else if( verbosity_ == VERBOSE ) {
2014  cout<<"clustering is OFF - clusters come from the input file"<<endl;
2015  }
2016 
2017  if(verbosity_ == VERBOSE ) {
2018  if(clustersECAL_.get() ) {
2019  cout<<"number of ECAL clusters : "<<clustersECAL_->size()<<endl;
2020  }
2021  if(clustersHCAL_.get() ) {
2022  cout<<"number of HCAL clusters : "<<clustersHCAL_->size()<<endl;
2023  }
2024 
2025  if(useHO_ && clustersHO_.get() ) {
2026  cout<<"number of HO clusters : "<<clustersHO_->size()<<endl;
2027  }
2028 
2029  if(clustersHFEM_.get() ) {
2030  cout<<"number of HFEM clusters : "<<clustersHFEM_->size()<<endl;
2031  }
2032  if(clustersHFHAD_.get() ) {
2033  cout<<"number of HFHAD clusters : "<<clustersHFHAD_->size()<<endl;
2034  }
2035  if(clustersPS_.get() ) {
2036  cout<<"number of PS clusters : "<<clustersPS_->size()<<endl;
2037  }
2038  }
2039 
2040  if(doParticleFlow_) {
2041  particleFlow();
2042  if (doCompare_) pfCandCompare(entry);
2043  }
2044 
2045  if(doJets_) {
2049  }
2050 
2051  // call print() in verbose mode
2052  if( verbosity_ == VERBOSE ) print();
2053 
2054  //COLIN the PFJet and PFMET benchmarks are very messy.
2055  //COLIN compare with the filling of the PFCandidateBenchmark, which is one line.
2056 
2057  goodevent = eventAccepted();
2058 
2059  // evaluate PFJet Benchmark
2060  if(doPFJetBenchmark_) { // start PFJet Benchmark
2061 
2063  double resPt = PFJetBenchmark_.resPtMax();
2064  double resChargedHadEnergy = PFJetBenchmark_.resChargedHadEnergyMax();
2065  double resNeutralHadEnergy = PFJetBenchmark_.resNeutralHadEnergyMax();
2066  double resNeutralEmEnergy = PFJetBenchmark_.resNeutralEmEnergyMax();
2067 
2068  if( verbosity_ == VERBOSE ){ //start debug print
2069 
2070  cout << " =====================PFJetBenchmark =================" << endl;
2071  cout<<"Resol Pt max "<<resPt
2072  <<" resChargedHadEnergy Max " << resChargedHadEnergy
2073  <<" resNeutralHadEnergy Max " << resNeutralHadEnergy
2074  << " resNeutralEmEnergy Max "<< resNeutralEmEnergy << endl;
2075  } // end debug print
2076 
2077  // PJ : printout for bad events (selected by the "if")
2078  /*
2079  if ( fabs(resPt) > 0.4 )
2080  std::cout << "'" << iEvent.id().run() << ":" << iEvent.id().event() << "-"
2081  << iEvent.id().run() << ":" << iEvent.id().event() << "'," << std::endl;
2082  */
2083  if ( resPt < -1. ) {
2084  cout << " =====================PFJetBenchmark =================" << endl;
2085  cout<<"process entry "<< entry << endl;
2086  cout<<"Resol Pt max "<<resPt
2087  <<" resChargedHadEnergy Max " << resChargedHadEnergy
2088  <<" resNeutralHadEnergy Max " << resNeutralHadEnergy
2089  << " resNeutralEmEnergy Max "<< resNeutralEmEnergy
2090  << " Jet pt " << genJets_[0].pt() << endl;
2091  // return true;
2092  } else {
2093  // return false;
2094  }
2095  // if (resNeutralEmEnergy>0.5) return true;
2096  // else return false;
2097  }// end PFJet Benchmark
2098 
2099  // Addition to have DQM histograms : by S. Dutta
2100  reco::MET reComputedMet_;
2101  reco::MET computedGenMet_;
2102  //-----------------------------------------------
2103 
2104  //COLIN would be nice to move this long code to a separate function.
2105  // is it necessary to re-set everything at each event??
2106  if(doPFMETBenchmark_) { // start PFMet Benchmark
2107 
2108  // Fill here the various met benchmarks
2109  // pfMET vs GenMET
2110  metManager_->setMET1(&genParticlesCMSSW_);
2111  metManager_->setMET2(&pfMetsCMSSW_[0]);
2112  metManager_->FillHisto("PF");
2113  // cout events in tail
2114  metManager_->coutTailEvents(entry,DeltaMETcut,DeltaPhicut, MET1cut);
2115 
2116  // caloMET vs GenMET
2117  metManager_->setMET2(&caloMetsCMSSW_[0]);
2118  metManager_->FillHisto("Calo");
2119 
2120  if ( doMet_ ) {
2121  // recomputed pfMET vs GenMET
2122  metManager_->setMET2(*pfCandidates_);
2123  metManager_->FillHisto("recompPF");
2124  metManager_->coutTailEvents(entry,DeltaMETcut,DeltaPhicut, MET1cut);
2125  }
2126 
2127  if (JECinCaloMet_)
2128  {
2129  // corrCaloMET vs GenMET
2130  metManager_->setMET2(&caloMetsCMSSW_[0]);
2131  metManager_->propagateJECtoMET2(caloJetsCMSSW_, corrcaloJetsCMSSW_);
2132  metManager_->FillHisto("corrCalo");
2133  }
2134  }// end PFMET Benchmark
2135 
2136  if( goodevent && doPFCandidateBenchmark_ ) {
2138  }
2139 
2140  // Addition to have DQM histograms : by S. Dutta
2141  if( goodevent && doPFDQM_ ) {
2142  float deltaMin, deltaMax;
2143  pfJetMonitor_.fill( pfJets_, genJets_, deltaMin, deltaMax);
2144  if (doPFMETBenchmark_) {
2145  pfMETMonitor_.fillOne( reComputedMet_, computedGenMet_, deltaMin, deltaMax);
2146  }
2147  }
2148  //-----------------------------------------------
2149  // evaluate tau Benchmark
2150  if( goodevent && doTauBenchmark_) { // start tau Benchmark
2151  double deltaEt = 0.;
2152  deltaEt = tauBenchmark( *pfCandidates_ );
2153  if( verbosity_ == VERBOSE ) cout<<"delta E_t ="<<deltaEt <<endl;
2154  // cout<<"delta E_t ="<<deltaEt<<" delta E_t Other ="<<deltaEt1<<endl;
2155 
2156 
2157  // if( deltaEt>0.4 ) {
2158  // cout<<deltaEt<<endl;
2159  // return true;
2160  // }
2161  // else return false;
2162 
2163 
2164  } // end tau Benchmark
2165 
2166  if(goodevent && outTree_)
2167  outTree_->Fill();
2168 
2169  if(calibFile_)
2171 
2172  return goodevent;
2173 
2174 }
2175 
2176 
2177 
2179  // return highPtJet(10);
2180  //return highPtPFCandidate( 10, PFCandidate::h );
2181  return true;
2182 }
2183 
2185  for( unsigned i=0; i<pfJets_.size(); ++i) {
2186  if( pfJets_[i].pt() > ptMin ) return true;
2187  }
2188  return false;
2189 }
2190 
2193  for( unsigned i=0; i<pfCandidates_->size(); ++i) {
2194 
2195  const PFCandidate& pfc = (*pfCandidates_)[i];
2196  if(type!= PFCandidate::X &&
2197  pfc.particleId() != type ) continue;
2198  if( pfc.pt() > ptMin ) return true;
2199  }
2200  return false;
2201 }
2202 
2203 
2205 
2206  if (verbosity_ == VERBOSE ) {
2207  cout <<"start reading from simulation"<<endl;
2208  }
2209 
2210 
2211  // if(!tree_) return false;
2212 
2213  const edm::EventBase& iEvent = *ev_;
2214 
2215 
2216  bool foundstdTracks = iEvent.getByLabel(stdTracksTag_,stdTracksHandle_);
2217  if ( foundstdTracks ) {
2219  // cout << "Found " << stdTracks_.size() << " standard tracks" << endl;
2220  } else {
2221  cerr<<"PFRootEventManager::ProcessEntry : stdTracks Collection not found : "
2222  <<entry << " " << stdTracksTag_<<endl;
2223  }
2224 
2225  bool foundMCTruth = iEvent.getByLabel(MCTruthTag_,MCTruthHandle_);
2226  if ( foundMCTruth ) {
2228  // cout << "Found MC truth" << endl;
2229  } else {
2230  // cerr<<"PFRootEventManager::ProcessEntry : MCTruth Collection not found : "
2231  // <<entry << " " << MCTruthTag_<<endl;
2232  }
2233 
2234  bool foundTP = iEvent.getByLabel(trueParticlesTag_,trueParticlesHandle_);
2235  if ( foundTP ) {
2237  // cout << "Found " << trueParticles_.size() << " true particles" << endl;
2238  } else {
2239  //cerr<<"PFRootEventManager::ProcessEntry : trueParticles Collection not found : "
2240  // <<entry << " " << trueParticlesTag_<<endl;
2241  }
2242 
2243  bool foundECAL = iEvent.getByLabel(rechitsECALTag_,rechitsECALHandle_);
2244  if ( foundECAL ) {
2246  // cout << "Found " << rechitsECAL_.size() << " ECAL rechits" << endl;
2247  } else {
2248  cerr<<"PFRootEventManager::ProcessEntry : rechitsECAL Collection not found : "
2249  <<entry << " " << rechitsECALTag_<<endl;
2250  }
2251 
2252  bool foundHCAL = iEvent.getByLabel(rechitsHCALTag_,rechitsHCALHandle_);
2253  if ( foundHCAL ) {
2255  // cout << "Found " << rechitsHCAL_.size() << " HCAL rechits" << endl;
2256  } else {
2257  cerr<<"PFRootEventManager::ProcessEntry : rechitsHCAL Collection not found : "
2258  <<entry << " " << rechitsHCALTag_<<endl;
2259  }
2260 
2261  if (useHO_) {
2262  bool foundHO = iEvent.getByLabel(rechitsHOTag_,rechitsHOHandle_);
2263  if ( foundHO ) {
2265  // cout << "Found " << rechitsHO_.size() << " HO rechits" << endl;
2266  } else {
2267  cerr<<"PFRootEventManager::ProcessEntry : rechitsHO Collection not found : "
2268  <<entry << " " << rechitsHOTag_<<endl;
2269  }
2270  }
2271 
2272  bool foundHFEM = iEvent.getByLabel(rechitsHFEMTag_,rechitsHFEMHandle_);
2273  if ( foundHFEM ) {
2275  // cout << "Found " << rechitsHFEM_.size() << " HFEM rechits" << endl;
2276  } else {
2277  cerr<<"PFRootEventManager::ProcessEntry : rechitsHFEM Collection not found : "
2278  <<entry << " " << rechitsHFEMTag_<<endl;
2279  }
2280 
2281  bool foundHFHAD = iEvent.getByLabel(rechitsHFHADTag_,rechitsHFHADHandle_);
2282  if ( foundHFHAD ) {
2284  // cout << "Found " << rechitsHFHAD_.size() << " HFHAD rechits" << endl;
2285  } else {
2286  cerr<<"PFRootEventManager::ProcessEntry : rechitsHFHAD Collection not found : "
2287  <<entry << " " << rechitsHFHADTag_<<endl;
2288  }
2289 
2290  for ( unsigned i=0; i<rechitsCLEANEDTags_.size(); ++i ) {
2291  bool foundCLEANED = iEvent.getByLabel(rechitsCLEANEDTags_[i],
2293  if ( foundCLEANED ) {
2295  // cout << "Found " << rechitsCLEANEDV_[i].size() << " CLEANED rechits" << endl;
2296  } else {
2297  cerr<<"PFRootEventManager::ProcessEntry : rechitsCLEANED Collection not found : "
2298  <<entry << " " << rechitsCLEANEDTags_[i]<<endl;
2299  }
2300 
2301  }
2302 
2303  bool foundPS = iEvent.getByLabel(rechitsPSTag_,rechitsPSHandle_);
2304  if ( foundPS ) {
2306  // cout << "Found " << rechitsPS_.size() << " PS rechits" << endl;
2307  } else {
2308  cerr<<"PFRootEventManager::ProcessEntry : rechitsPS Collection not found : "
2309  <<entry << " " << rechitsPSTag_<<endl;
2310  }
2311 
2312  bool foundCT = iEvent.getByLabel(caloTowersTag_,caloTowersHandle_);
2313  if ( foundCT ) {
2315  // cout << "Found " << caloTowers_.size() << " calo Towers" << endl;
2316  } else {
2317  cerr<<"PFRootEventManager::ProcessEntry : caloTowers Collection not found : "
2318  <<entry << " " << caloTowersTag_<<endl;
2319  }
2320 
2321  bool foundPV = iEvent.getByLabel(primaryVerticesTag_,primaryVerticesHandle_);
2322  if ( foundPV ) {
2324  // cout << "Found " << primaryVertices_.size() << " primary vertices" << endl;
2325  } else {
2326  cerr<<"PFRootEventManager::ProcessEntry : primaryVertices Collection not found : "
2327  <<entry << " " << primaryVerticesTag_<<endl;
2328  }
2329 
2330 
2332  if ( foundPFV ) {
2334  // cout << "Found " << pfNuclearTrackerVertex_.size() << " secondary PF vertices" << endl;
2335  } else if ( usePFNuclearInteractions_ ) {
2336  cerr<<"PFRootEventManager::ProcessEntry : pfNuclearTrackerVertex Collection not found : "
2337  <<entry << " " << pfNuclearTrackerVertexTag_<<endl;
2338  }
2339 
2340  bool foundrecTracks = iEvent.getByLabel(recTracksTag_,recTracksHandle_);
2341  if ( foundrecTracks ) {
2343  // cout << "Found " << recTracks_.size() << " PFRecTracks" << endl;
2344  } else {
2345  cerr<<"PFRootEventManager::ProcessEntry : recTracks Collection not found : "
2346  <<entry << " " << recTracksTag_<<endl;
2347  }
2348 
2349  bool founddisplacedRecTracks = iEvent.getByLabel(displacedRecTracksTag_,displacedRecTracksHandle_);
2350  if ( founddisplacedRecTracks ) {
2352  // cout << "Found " << displacedRecTracks_.size() << " PFRecTracks" << endl;
2353  } else {
2354  cerr<<"PFRootEventManager::ProcessEntry : displacedRecTracks Collection not found : "
2355  <<entry << " " << displacedRecTracksTag_<<endl;
2356  }
2357 
2358 
2359  bool foundgsfrecTracks = iEvent.getByLabel(gsfrecTracksTag_,gsfrecTracksHandle_);
2360  if ( foundgsfrecTracks ) {
2362  // cout << "Found " << gsfrecTracks_.size() << " GsfPFRecTracks" << endl;
2363  } else {
2364  cerr<<"PFRootEventManager::ProcessEntry : gsfrecTracks Collection not found : "
2365  <<entry << " " << gsfrecTracksTag_<<endl;
2366  }
2367 
2368  bool foundconvBremGsfrecTracks = iEvent.getByLabel(convBremGsfrecTracksTag_,convBremGsfrecTracksHandle_);
2369  if ( foundconvBremGsfrecTracks ) {
2371  // cout << "Found " << convBremGsfrecTracks_.size() << " ConvBremGsfPFRecTracks" << endl;
2372  } else if ( useConvBremGsfTracks_ ) {
2373  cerr<<"PFRootEventManager::ProcessEntry : convBremGsfrecTracks Collection not found : "
2374  <<entry << " " << convBremGsfrecTracksTag_<<endl;
2375  }
2376 
2377  bool foundmuons = iEvent.getByLabel(muonsTag_,muonsHandle_);
2378  if ( foundmuons ) {
2379  muons_ = *muonsHandle_;
2380  /*
2381  cout << "Found " << muons_.size() << " muons" << endl;
2382  for ( unsigned imu=0; imu<muons_.size(); ++imu ) {
2383  std::cout << " Muon " << imu << ":" << std::endl;
2384  reco::MuonRef muonref( &muons_, imu );
2385  PFMuonAlgo::printMuonProperties(muonref);
2386  }
2387  */
2388  } else {
2389  cerr<<"PFRootEventManager::ProcessEntry : muons Collection not found : "
2390  <<entry << " " << muonsTag_<<endl;
2391  }
2392 
2393  bool foundconversion = iEvent.getByLabel(conversionTag_,conversionHandle_);
2394  if ( foundconversion ) {
2396  // cout << "Found " << conversion_.size() << " conversion" << endl;
2397  } else if ( usePFConversions_ ) {
2398  cerr<<"PFRootEventManager::ProcessEntry : conversion Collection not found : "
2399  <<entry << " " << conversionTag_<<endl;
2400  }
2401 
2402 
2403 
2404  bool foundv0 = iEvent.getByLabel(v0Tag_,v0Handle_);
2405  if ( foundv0 ) {
2406  v0_ = *v0Handle_;
2407  // cout << "Found " << v0_.size() << " v0" << endl;
2408  } else if ( usePFV0s_ ) {
2409  cerr<<"PFRootEventManager::ProcessEntry : v0 Collection not found : "
2410  <<entry << " " << v0Tag_<<endl;
2411  }
2412 
2413  if(useEGPhotons_) {
2414  bool foundPhotons = iEvent.getByLabel(photonTag_,photonHandle_);
2415  if ( foundPhotons) {
2416  photons_ = *photonHandle_;
2417  } else {
2418  cerr <<"PFRootEventManager::ProcessEntry : photon collection not found : "
2419  << entry << " " << photonTag_ << endl;
2420  }
2421  }
2422 
2423  if(useEGElectrons_) {
2424  bool foundElectrons = iEvent.getByLabel(egammaElectronsTag_,egammaElectronHandle_);
2425  if ( foundElectrons) {
2426  // std::cout << " Found collection " << std::endl;
2428  } else
2429  {
2430  cerr <<"PFRootEventManager::ProcessEntry : electron collection not found : "
2431  << entry << " " << egammaElectronsTag_ << endl;
2432  }
2433  }
2434 
2435  bool foundgenJets = iEvent.getByLabel(genJetsTag_,genJetsHandle_);
2436  if ( foundgenJets ) {
2438  // cout << "Found " << genJetsCMSSW_.size() << " genJets" << endl;
2439  } else {
2440  //cerr<<"PFRootEventManager::ProcessEntry : genJets Collection not found : "
2441  // <<entry << " " << genJetsTag_<<endl;
2442  }
2443 
2444  bool foundgenParticlesforJets = iEvent.getByLabel(genParticlesforJetsTag_,genParticlesforJetsHandle_);
2445  if ( foundgenParticlesforJets ) {
2447  // cout << "Found " << genParticlesforJets_.size() << " genParticlesforJets" << endl;
2448  } else {
2449  //cerr<<"PFRootEventManager::ProcessEntry : genParticlesforJets Collection not found : "
2450  // <<entry << " " << genParticlesforJetsTag_<<endl;
2451  }
2452 
2453  bool foundgenParticlesforMET = iEvent.getByLabel(genParticlesforMETTag_,genParticlesforMETHandle_);
2454  if ( foundgenParticlesforMET ) {
2456  // cout << "Found " << genParticlesCMSSW_.size() << " genParticlesforMET" << endl;
2457  } else {
2458  //cerr<<"PFRootEventManager::ProcessEntry : genParticlesforMET Collection not found : "
2459  // <<entry << " " << genParticlesforMETTag_<<endl;
2460  }
2461 
2462  bool foundcaloJets = iEvent.getByLabel(caloJetsTag_,caloJetsHandle_);
2463  if ( foundcaloJets ) {
2465  // cout << "Found " << caloJetsCMSSW_.size() << " caloJets" << endl;
2466  } else {
2467  cerr<<"PFRootEventManager::ProcessEntry : caloJets Collection not found : "
2468  <<entry << " " << caloJetsTag_<<endl;
2469  }
2470 
2471  bool foundcorrcaloJets = iEvent.getByLabel(corrcaloJetsTag_,corrcaloJetsHandle_);
2472  if ( foundcorrcaloJets ) {
2474  // cout << "Found " << corrcaloJetsCMSSW_.size() << " corrcaloJets" << endl;
2475  } else {
2476  //cerr<<"PFRootEventManager::ProcessEntry : corrcaloJets Collection not found : "
2477  // <<entry << " " << corrcaloJetsTag_<<endl;
2478  }
2479 
2480  bool foundpfJets = iEvent.getByLabel(pfJetsTag_,pfJetsHandle_);
2481  if ( foundpfJets ) {
2483  // cout << "Found " << pfJetsCMSSW_.size() << " PFJets" << endl;
2484  } else {
2485  cerr<<"PFRootEventManager::ProcessEntry : PFJets Collection not found : "
2486  <<entry << " " << pfJetsTag_<<endl;
2487  }
2488 
2489  bool foundpfCands = iEvent.getByLabel(pfCandidateTag_,pfCandidateHandle_);
2490  if ( foundpfCands ) {
2492  // cout << "Found " << pfCandCMSSW_.size() << " PFCandidates" << endl;
2493  } else {
2494  cerr<<"PFRootEventManager::ProcessEntry : PFCandidate Collection not found : "
2495  <<entry << " " << pfCandidateTag_<<endl;
2496  }
2497 
2498  bool foundpfMets = iEvent.getByLabel(pfMetsTag_,pfMetsHandle_);
2499  if ( foundpfMets ) {
2501  //cout << "Found " << pfMetsCMSSW_.size() << " PFMets" << endl;
2502  } else {
2503  cerr<<"PFRootEventManager::ProcessEntry : PFMets Collection not found : "
2504  <<entry << " " << pfMetsTag_<<endl;
2505  }
2506 
2507  bool foundtcMets = iEvent.getByLabel(tcMetsTag_,tcMetsHandle_);
2508  if ( foundtcMets ) {
2510  //cout << "Found " << tcMetsCMSSW_.size() << " TCMets" << endl;
2511  } else {
2512  cerr<<"TCRootEventManager::ProcessEntry : TCMets Collection not found : "
2513  <<entry << " " << tcMetsTag_<<endl;
2514  }
2515 
2516  bool foundcaloMets = iEvent.getByLabel(caloMetsTag_,caloMetsHandle_);
2517  if ( foundcaloMets ) {
2519  //cout << "Found " << caloMetsCMSSW_.size() << " CALOMets" << endl;
2520  } else {
2521  cerr<<"CALORootEventManager::ProcessEntry : CALOMets Collection not found : "
2522  <<entry << " " << caloMetsTag_<<endl;
2523  }
2524 
2525  // now can use the tree
2526 
2527  bool goodevent = true;
2528  if(trueParticles_.size() ) {
2529  // this is a filter to select single particle events.
2531  trueParticles_.size() != filterNParticles_ ) {
2532  cout << "PFRootEventManager : event discarded Nparticles="
2533  <<filterNParticles_<< endl;
2534  goodevent = false;
2535  }
2536  if(goodevent && doTauBenchmark_ && filterHadronicTaus_ && !isHadronicTau() ) {
2537  cout << "PFRootEventManager : leptonic tau discarded " << endl;
2538  goodevent = false;
2539  }
2540  if( goodevent && doTauBenchmark_ && !filterTaus_.empty()
2541  && !countChargedAndPhotons() ) {
2542  assert( filterTaus_.size() == 2 );
2543  cout <<"PFRootEventManager : tau discarded: "
2544  <<"number of charged and neutral particles different from "
2545  <<filterTaus_[0]<<","<<filterTaus_[1]<<endl;
2546  goodevent = false;
2547  }
2548 
2549  if(goodevent)
2551 
2552  }
2553 
2554  // if(caloTowersBranch_) {
2555  // if(goodevent)
2556  // fillOutEventWithCaloTowers( caloTowers_ );
2557  // }
2558 
2559  if(rechitsECAL_.size()) {
2561  }
2562  if(rechitsHCAL_.size()) {
2564  }
2565 
2566  if (useHO_) {
2567  if(rechitsHO_.size()) {
2569  }
2570  }
2571 
2572  if(rechitsHFEM_.size()) {
2574  }
2575  if(rechitsHFHAD_.size()) {
2577  }
2578  rechitsCLEANED_.clear();
2579  for ( unsigned i=0; i<rechitsCLEANEDV_.size(); ++i ) {
2580  if(rechitsCLEANEDV_[i].size()) {
2582  for ( unsigned j=0; j<rechitsCLEANEDV_[i].size(); ++j ) {
2583  rechitsCLEANED_.push_back( (rechitsCLEANEDV_[i])[j] );
2584  }
2585  }
2586  }
2587 
2588  if(rechitsPS_.size()) {
2590  }
2591 
2592  /*
2593  if ( recTracks_.size() ) {
2594  PreprocessRecTracks( recTracks_);
2595  }
2596 
2597  if ( displacedRecTracks_.size() ) {
2598  // cout << "preprocessing rec tracks" << endl;
2599  PreprocessRecTracks( displacedRecTracks_);
2600  }
2601 
2602 
2603  if(gsfrecTracks_.size()) {
2604  PreprocessRecTracks( gsfrecTracks_);
2605  }
2606 
2607  if(convBremGsfrecTracks_.size()) {
2608  PreprocessRecTracks( convBremGsfrecTracks_);
2609  }
2610  */
2611 
2612  return goodevent;
2613 }
2614 
2615 
2617 
2618  for ( unsigned i=0; i < trueParticles_.size(); i++) {
2619  const reco::PFSimParticle& ptc = trueParticles_[i];
2620  const std::vector<int>& ptcdaughters = ptc.daughterIds();
2621  if (std::abs(ptc.pdgCode()) == 15) {
2622  for ( unsigned int dapt=0; dapt < ptcdaughters.size(); ++dapt) {
2623 
2624  const reco::PFSimParticle& daughter
2625  = trueParticles_[ptcdaughters[dapt]];
2626 
2627 
2628  int pdgdaugther = daughter.pdgCode();
2629  int abspdgdaughter = std::abs(pdgdaugther);
2630 
2631 
2632  if (abspdgdaughter == 11 ||
2633  abspdgdaughter == 13) {
2634  return false;
2635  }//electron or muons?
2636  }//loop daughter
2637  }//tau
2638  }//loop particles
2639 
2640 
2641  return true;
2642 }
2643 
2644 
2645 
2647 
2648  int nPhoton = 0;
2649  int nCharged = 0;
2650 
2651  for ( unsigned i=0; i < trueParticles_.size(); i++) {
2652  const reco::PFSimParticle& ptc = trueParticles_[i];
2653 
2654  const std::vector<int>& daughters = ptc.daughterIds();
2655 
2656  // if the particle decays before ECAL, we do not want to
2657  // consider it.
2658  if(!daughters.empty() ) continue;
2659 
2660  double charge = ptc.charge();
2661  double pdgCode = ptc.pdgCode();
2662 
2663  if( std::abs(charge)>1e-9)
2664  nCharged++;
2665  else if( pdgCode==22 )
2666  nPhoton++;
2667  }
2668 
2669  // const HepMC::GenEvent* myGenEvent = MCTruth_.GetEvent();
2670  // if(!myGenEvent) {
2671  // cerr<<"impossible to filter on the number of charged and "
2672  // <<"neutral particles without the HepMCProduct. "
2673  // <<"Please check that the branch edmHepMCProduct_*_*_* is found"<<endl;
2674  // exit(1);
2675  // }
2676 
2677  // for ( HepMC::GenEvent::particle_const_iterator
2678  // piter = myGenEvent->particles_begin();
2679  // piter != myGenEvent->particles_end();
2680  // ++piter ) {
2681 
2682  // const HepMC::GenParticle* p = *piter;
2683  // int partId = p->pdg_id();Long64_t lines = T->ReadFile("mon_fichier","i:j:k:x:y:z");
2684 
2685  // // pdgTable_->GetParticle( partId )->Print();
2686 
2687  // int charge = chargeValue(partId);
2688  // cout<<partId <<" "<<charge/3.<<endl;
2689 
2690  // if(charge)
2691  // nCharged++;
2692  // else
2693  // nNeutral++;
2694  // }
2695 
2696  if( nCharged == filterTaus_[0] &&
2697  nPhoton == filterTaus_[1] )
2698  return true;
2699  else
2700  return false;
2701 }
2702 
2703 
2704 
2705 int PFRootEventManager::chargeValue(const int& Id) const {
2706 
2707 
2708  //...Purpose: to give three times the charge for a particle/parton.
2709 
2710  // ID = particle ID
2711  // hepchg = particle charge times 3
2712 
2713  int kqa,kq1,kq2,kq3,kqj,irt,kqx,kqn;
2714  int hepchg;
2715 
2716 
2717  int ichg[109]={-1,2,-1,2,-1,2,-1,2,0,0,-3,0,-3,0,-3,0,
2718  -3,0,0,0,0,0,0,3,0,0,0,0,0,0,3,0,3,6,0,0,3,6,0,0,-1,2,-1,2,-1,2,0,0,0,0,
2719  -3,0,-3,0,-3,0,0,0,0,0,-1,2,-1,2,-1,2,0,0,0,0,
2720  -3,0,-3,0,-3,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
2721 
2722 
2723  //...Initial values. Simple case of direct readout.
2724  hepchg=0;
2725  kqa=std::abs(Id);
2726  kqn=kqa/1000000000%10;
2727  kqx=kqa/1000000%10;
2728  kq3=kqa/1000%10;
2729  kq2=kqa/100%10;
2730  kq1=kqa/10%10;
2731  kqj=kqa%10;
2732  irt=kqa%10000;
2733 
2734  //...illegal or ion
2735  //...set ion charge to zero - not enough information
2736  if(kqa==0 || kqa >= 10000000) {
2737 
2738  if(kqn==1) {hepchg=0;}
2739  }
2740  //... direct translation
2741  else if(kqa<=100) {hepchg = ichg[kqa-1];}
2742  //... deuteron or tritium
2743  else if(kqa==100 || kqa==101) {hepchg = -3;}
2744  //... alpha or He3
2745  else if(kqa==102 || kqa==104) {hepchg = -6;}
2746  //... KS and KL (and undefined)
2747  else if(kqj == 0) {hepchg = 0;}
2748  //C... direct translation
2749  else if(kqx>0 && irt<100)
2750  {
2751  hepchg = ichg[irt-1];
2752  if(kqa==1000017 || kqa==1000018) {hepchg = 0;}
2753  if(kqa==1000034 || kqa==1000052) {hepchg = 0;}
2754  if(kqa==1000053 || kqa==1000054) {hepchg = 0;}
2755  if(kqa==5100061 || kqa==5100062) {hepchg = 6;}
2756  }
2757  //...Construction from quark content for heavy meson, diquark, baryon.
2758  //...Mesons.
2759  else if(kq3==0)
2760  {
2761  hepchg = ichg[kq2-1]-ichg[kq1-1];
2762  //...Strange or beauty mesons.
2763  if((kq2==3) || (kq2==5)) {hepchg = ichg[kq1-1]-ichg[kq2-1];}
2764  }
2765  else if(kq1 == 0) {
2766  //...Diquarks.
2767  hepchg = ichg[kq3-1] + ichg[kq2-1];
2768  }
2769 
2770  else{
2771  //...Baryons
2772  hepchg = ichg[kq3-1]+ichg[kq2-1]+ichg[kq1-1];
2773  }
2774 
2775  //... fix sign of charge
2776  if(Id<0 && hepchg!=0) {hepchg = -1*hepchg;}
2777 
2778  // cout << hepchg<< endl;
2779  return hepchg;
2780 }
2781 
2782 
2783 
2784 void
2786  /*
2787  for( unsigned i=0; i<recTracks.size(); ++i ) {
2788  recTracks[i].calculatePositionREP();
2789  }
2790  */
2791 }
2792 
2793 void
2795  /*
2796  for( unsigned i=0; i<recTracks.size(); ++i ) {
2797  recTracks[i].calculatePositionREP();
2798  recTracks[i].calculateBremPositionREP();
2799  }
2800  */
2801 }
2802 
2803 
2804 
2805 void
2807  bool findNeighbours) {
2808 
2809 
2810  map<unsigned, unsigned> detId2index;
2811 
2812  for(unsigned i=0; i<rechits.size(); i++) {
2813  rechits[i].calculatePositionREP();
2814 
2815  if(findNeighbours)
2816  detId2index.insert( make_pair(rechits[i].detId(), i) );
2817  }
2818 
2819  if(findNeighbours) {
2820  for(unsigned i=0; i<rechits.size(); i++) {
2821  setRecHitNeigbours( rechits[i], detId2index );
2822  }
2823  }
2824 }
2825 
2826 
2829  const map<unsigned, unsigned>& detId2index ) {
2830 
2831  rh.clearNeighbours();
2832 
2833  vector<unsigned> neighbours4DetId = rh.neighboursIds4();
2834  vector<unsigned> neighbours8DetId = rh.neighboursIds8();
2835 
2836  for( unsigned i=0; i<neighbours4DetId.size(); i++) {
2837  unsigned detId = neighbours4DetId[i];
2838  // cout<<"finding n for detId "<<detId<<endl;
2839  const map<unsigned, unsigned>::const_iterator& it = detId2index.find(detId);
2840 
2841  if(it != detId2index.end() ) {
2842  // cout<<"found n index "<<it->second<<endl;
2843  rh.add4Neighbour( it->second );
2844  }
2845  }
2846 
2847  for( unsigned i=0; i<neighbours8DetId.size(); i++) {
2848  unsigned detId = neighbours8DetId[i];
2849  // cout<<"finding n for detId "<<detId<<endl;
2850  const map<unsigned, unsigned>::const_iterator& it = detId2index.find(detId);
2851 
2852  if(it != detId2index.end() ) {
2853  // cout<<"found n index "<<it->second<<endl;
2854  rh.add8Neighbour( it->second );
2855  }
2856  }
2857 
2858 
2859 }
2860 
2861 
2863 
2864  if (verbosity_ == VERBOSE ) {
2865  cout <<"start clustering"<<endl;
2866  }
2867 
2868  vector<bool> mask;
2869  // ECAL clustering -------------------------------------------
2870 
2871  fillRecHitMask( mask, rechitsECAL_ );
2874 
2875  assert(clustersECAL_.get() );
2876 
2878 
2879  // HCAL clustering -------------------------------------------
2880 
2881  fillRecHitMask( mask, rechitsHCAL_ );
2884 
2886 
2887  // HO clustering -------------------------------------------
2888 
2889  if (useHO_) {
2890  fillRecHitMask( mask, rechitsHO_ );
2891 
2893 
2895 
2897  }
2898 
2899  // HF clustering -------------------------------------------
2900 
2901  fillRecHitMask( mask, rechitsHFEM_ );
2904 
2905  fillRecHitMask( mask, rechitsHFHAD_ );
2908 
2909  // PS clustering -------------------------------------------
2910 
2911  fillRecHitMask( mask, rechitsPS_ );
2914 
2916 
2917 }
2918 
2919 
2920 
2921 void
2923  clusters) {
2924 
2925  if(!outEvent_) return;
2926 
2927  for(unsigned i=0; i<clusters.size(); i++) {
2928  EventColin::Cluster cluster;
2929  cluster.eta = clusters[i].position().Eta();
2930  cluster.phi = clusters[i].position().Phi();
2931  cluster.e = clusters[i].energy();
2932  cluster.layer = clusters[i].layer();
2933  if (!useHO_ && cluster.layer==PFLayer::HCAL_BARREL2) continue;
2934  cluster.type = 1;
2935 
2938  switch( clusters[i].layer() ) {
2939  case PFLayer::ECAL_BARREL:
2940  case PFLayer::ECAL_ENDCAP:
2942  break;
2943  case PFLayer::HCAL_BARREL1:
2944  case PFLayer::HCAL_ENDCAP:
2946  break;
2947 
2948  case PFLayer::HCAL_BARREL2:
2950  break;
2951 
2952  default:
2953  break;
2954  }
2955  if(tpLayer < reco::PFTrajectoryPoint::NLayers) {
2956  try {
2957  double peta = -10;
2958  double phi = -10;
2959  double pe = -10;
2960 
2961  const reco::PFSimParticle& ptc
2962  = closestParticle( tpLayer,
2963  cluster.eta, cluster.phi,
2964  peta, phi, pe );
2965 
2966 
2967  cluster.particle.eta = peta;
2968  cluster.particle.phi = phi;
2969  cluster.particle.e = pe;
2970  cluster.particle.pdgCode = ptc.pdgCode();
2971 
2972 
2973  }
2974  catch( std::exception& err ) {
2975  // cerr<<err.what()<<endl;
2976  }
2977  }
2978 
2979  outEvent_->addCluster(cluster);
2980  }
2981 }
2982 
2983 
2984 void
2986 
2987  if(!outEvent_) return;
2988 
2989  for ( unsigned i=0; i < trueParticles.size(); i++) {
2990 
2991  const reco::PFSimParticle& ptc = trueParticles[i];
2992 
2993  unsigned ntrajpoints = ptc.nTrajectoryPoints();
2994 
2995  if(ptc.daughterIds().empty() ) { // stable
2998 
2999  if(ntrajpoints == 3) {
3000  // old format for PFSimCandidates.
3001  // in this case, the PFSimCandidate which does not decay
3002  // before ECAL has 3 points: initial, ecal entrance, hcal entrance
3003  ecalEntrance = static_cast<reco::PFTrajectoryPoint::LayerType>(1);
3004  }
3005  // else continue; // endcap case we do not care;
3006 
3007  const reco::PFTrajectoryPoint& tpatecal
3008  = ptc.extrapolatedPoint( ecalEntrance );
3009 
3010  EventColin::Particle outptc;
3011  outptc.eta = tpatecal.position().Eta();
3012  outptc.phi = tpatecal.position().Phi();
3013  outptc.e = tpatecal.momentum().E();
3014  outptc.pdgCode = ptc.pdgCode();
3015 
3016 
3017  outEvent_->addParticle(outptc);
3018  }
3019  }
3020 }
3021 
3022 void
3024 
3025  if(!outEvent_) return;
3026 
3027  for ( unsigned i=0; i < pfCandidates.size(); i++) {
3028 
3029  const reco::PFCandidate& candidate = pfCandidates[i];
3030 
3031  EventColin::Particle outptc;
3032  outptc.eta = candidate.eta();
3033  outptc.phi = candidate.phi();
3034  outptc.e = candidate.energy();
3035  outptc.pdgCode = candidate.particleId();
3036 
3037 
3038  outEvent_->addCandidate(outptc);
3039  }
3040 }
3041 
3042 
3043 void
3045 
3046  if(!outEvent_) return;
3047 
3048  for ( unsigned i=0; i < cts.size(); i++) {
3049 
3050  const CaloTower& ct = cts[i];
3051 
3052  EventColin::CaloTower outct;
3053  outct.e = ct.energy();
3054  outct.ee = ct.emEnergy();
3055  outct.eh = ct.hadEnergy();
3056 
3057  outEvent_->addCaloTower( outct );
3058  }
3059 }
3060 
3061 
3062 void
3064  blocks ) {
3065 
3066  if(!outEvent_) return;
3067 
3068  for ( unsigned i=0; i < blocks.size(); i++) {
3069 
3070  // const reco::PFBlock& block = blocks[i];
3071 
3072  EventColin::Block outblock;
3073 
3074  outEvent_->addBlock( outblock );
3075  }
3076 }
3077 
3078 
3079 
3081 
3082  if (verbosity_ == VERBOSE ) {
3083  cout <<"start particle flow"<<endl;
3084  }
3085 
3086 
3087  if( debug_) {
3088  cout<<"PFRootEventManager::particleFlow start"<<endl;
3089  // cout<<"number of elements in memory: "
3090  // <<reco::PFBlockElement::instanceCounter()<<endl;
3091  }
3092 
3093 
3095  edm::ProductID(1) );
3096 
3098  edm::ProductID(77) );
3099 
3101  edm::ProductID(2) );
3102 
3104  edm::ProductID(3) );
3105 
3107  edm::ProductID(21) ); //GMA put this four
3108 
3110  edm::ProductID(31) );
3111 
3113  edm::ProductID(32) );
3114 
3116  edm::ProductID(4) );
3117 
3119  edm::ProductID(5) );
3120 
3122  edm::ProductID(6) );
3123 
3125  edm::ProductID(7) );
3126 
3127 
3128  //recoPFRecTracks_pfNuclearTrackerVertex__TEST.
3129 
3131  edm::ProductID(8) );
3132 
3134  edm::ProductID(9) );
3135 
3136 
3138  edm::ProductID(10) );
3139 
3141  edm::ProductID(11) );
3142 
3144 
3147 
3149 
3150  vector<bool> trackMask;
3151  fillTrackMask( trackMask, recTracks_ );
3152  vector<bool> gsftrackMask;
3153  fillTrackMask( gsftrackMask, gsfrecTracks_ );
3154  vector<bool> ecalMask;
3155  fillClusterMask( ecalMask, *clustersECAL_ );
3156  vector<bool> hcalMask;
3157  fillClusterMask( hcalMask, *clustersHCAL_ );
3158 
3159  vector<bool> scmask;
3160 
3161  vector<bool> hoMask;
3162  if (useHO_) {fillClusterMask( hoMask, *clustersHO_ );}
3163 
3164  vector<bool> hfemMask;
3165  fillClusterMask( hfemMask, *clustersHFEM_ );
3166  vector<bool> hfhadMask;
3167  fillClusterMask( hfhadMask, *clustersHFHAD_ );
3168  vector<bool> psMask;
3169  fillClusterMask( psMask, *clustersPS_ );
3170  vector<bool> photonMask;
3171  fillPhotonMask( photonMask, photons_ );
3172 
3173  if ( !useAtHLT_ )
3174  pfBlockAlgo_.setInput( trackh, gsftrackh, convBremGsftrackh,
3175  muonh, nuclearh, displacedtrackh, convh, v0,
3176  ecalh, hcalh, hoh, hfemh, hfhadh, psh,
3177  photonh, ebsch, eesch, pfclusassoch, trackMask,gsftrackMask,
3178  ecalMask, hcalMask, hoMask, hfemMask, hfhadMask, psMask,photonMask,scmask );
3179  else
3180  pfBlockAlgo_.setInput( trackh, muonh, ecalh, hcalh, hfemh, hfhadh, psh, hoh,
3181  trackMask, ecalMask, hcalMask, hoMask, psMask);
3182 
3184 
3185  if( debug_) cout<<pfBlockAlgo_<<endl;
3186 
3188 
3190  if(useEGElectrons_)
3192 
3194  // pfAlgoOther_.reconstructParticles( blockh );
3195 
3196  // pfAlgo_.postMuonCleaning(muonsHandle_, *vertexh);
3197 
3198 
3199  if(usePFElectrons_) {
3202  pfAlgo_.setElectronExtraRef(electronExtraProd);
3203  }
3204 
3206 
3207  if( debug_) cout<< pfAlgo_<<endl;
3209  // pfCandidatesOther_ = pfAlgoOther_.transferCandidates();
3210 
3212 
3213  if( debug_) cout<<"PFRootEventManager::particleFlow stop"<<endl;
3214 }
3215 
3217 
3218  /*
3219  cout << "ievt " << entry <<" : PFCandidate : "
3220  << " original size : " << pfCandCMSSW_.size()
3221  << " current size : " << pfCandidates_->size() << endl;
3222  */
3223 
3224  bool differentSize = pfCandCMSSW_.size() != pfCandidates_->size();
3225  if ( differentSize ) {
3226  cout << "+++WARNING+++ PFCandidate size changed for entry "
3227  << entry << " !" << endl
3228  << " - original size : " << pfCandCMSSW_.size() << endl
3229  << " - current size : " << pfCandidates_->size() << endl;
3230  } else {
3231  for(unsigned i=0; i<pfCandidates_->size(); i++) {
3232  double deltaE = (*pfCandidates_)[i].energy()-pfCandCMSSW_[i].energy();
3233  double deltaEta = (*pfCandidates_)[i].eta()-pfCandCMSSW_[i].eta();
3234  double deltaPhi = (*pfCandidates_)[i].phi()-pfCandCMSSW_[i].phi();
3235  if ( fabs(deltaE) > 1E-4 ||
3236  fabs(deltaEta) > 1E-9 ||
3237  fabs(deltaPhi) > 1E-9 ) {
3238  cout << "+++WARNING+++ PFCandidate " << i
3239  << " changed for entry " << entry << " ! " << endl
3240  << " - Original : " << pfCandCMSSW_[i] << endl
3241  << " - Current : " << (*pfCandidates_)[i] << endl
3242  << " DeltaE = : " << deltaE << endl
3243  << " DeltaEta = : " << deltaEta << endl
3244  << " DeltaPhi = : " << deltaPhi << endl << endl;
3245  }
3246  }
3247  }
3248 }
3249 
3250 
3252 
3253  if (verbosity_ == VERBOSE || jetsDebug_) {
3254  cout<<endl;
3255  cout<<"start reconstruct GenJets --- "<<endl;
3256  cout<< " input gen particles for jet: all neutrinos removed ; muons present" << endl;
3257  }
3258 
3259  genJets_.clear();
3261 
3262  if ( !genParticlesforJets_.size() ) return;
3263 
3264  for(unsigned i=0; i<genParticlesforJets_.size(); i++) {
3265 
3266  const reco::GenParticle& genPart = *(genParticlesforJets_[i]);
3267 
3268  // remove all muons/neutrinos for PFJet studies
3269  // if (reco::isNeutrino( genPart ) || reco::isMuon( genPart )) continue;
3270  // remove all neutrinos for PFJet studies
3271  if (reco::isNeutrino( genPart )) continue;
3272  // Work-around a bug in the pythia di-jet gun.
3273  if (std::abs(genPart.pdgId())<7 || std::abs(genPart.pdgId())==21 ) continue;
3274 
3275  if (jetsDebug_ ) {
3276  cout << " #" << i << " PDG code:" << genPart.pdgId()
3277  << " status " << genPart.status()
3278  << ", p/pt/eta/phi: " << genPart.p() << '/' << genPart.pt()
3279  << '/' << genPart.eta() << '/' << genPart.phi() << endl;
3280  }
3281 
3283  }
3284 
3285  vector<ProtoJet> protoJets;
3287 
3288 
3289  // Convert Protojets to GenJets
3290  int ijet = 0;
3291  typedef vector <ProtoJet>::const_iterator IPJ;
3292  for (IPJ ipj = protoJets.begin(); ipj != protoJets.end (); ipj++) {
3293  const ProtoJet& protojet = *ipj;
3294  const ProtoJet::Constituents& constituents = protojet.getTowerList();
3295 
3296  reco::Jet::Point vertex (0,0,0); // do not have true vertex yet, use default
3298  JetMaker::makeSpecific(constituents, &specific);
3299  // constructor without constituents
3300  GenJet newJet (protojet.p4(), vertex, specific);
3301 
3302  // last step is to copy the constituents into the jet (new jet definition since 18X)
3303  // namespace reco {
3304  //class Jet : public CompositeRefBaseCandidate {
3305  // public:
3306  // typedef reco::CandidateBaseRefVector Constituents;
3307 
3308  ProtoJet::Constituents::const_iterator constituent = constituents.begin();
3309  for (; constituent != constituents.end(); ++constituent) {
3310  // find index of this ProtoJet constituent in the overall collection PFconstit
3311  // see class IndexedCandidate in JetRecoTypes.h
3312  uint index = constituent->index();
3313  newJet.addDaughter( genParticlesforJetsPtrs_[index] );
3314  } // end loop on ProtoJet constituents
3315  // last step: copy ProtoJet Variables into Jet
3316  newJet.setJetArea(protojet.jetArea());
3317  newJet.setPileup(protojet.pileup());
3318  newJet.setNPasses(protojet.nPasses());
3319  ++ijet;
3320  if (jetsDebug_ ) cout<<" gen jet "<<ijet<<" "<<newJet.print()<<endl;
3321  genJets_.push_back (newJet);
3322 
3323  } // end loop on protojets iterator IPJ
3324 
3325 }
3326 
3328 
3329  if (verbosity_ == VERBOSE || jetsDebug_ ) {
3330  cout<<endl;
3331  cout<<"start reconstruct CaloJets --- "<<endl;
3332  }
3333  caloJets_.clear();
3335 
3336  for( unsigned i=0; i<caloTowers_.size(); i++) {
3337  reco::CandidatePtr candPtr( &caloTowers_, i );
3338  caloTowersPtrs_.push_back( candPtr );
3339  }
3340 
3342 
3343  if (jetsDebug_ ) {
3344  for(unsigned ipj=0; ipj<caloJets_.size(); ipj++) {
3345  const ProtoJet& protojet = caloJets_[ipj];
3346  cout<<" calo jet "<<ipj<<" "<<protojet.pt() <<endl;
3347  }
3348  }
3349 
3350 }
3351 
3352 
3354 
3355  if (verbosity_ == VERBOSE || jetsDebug_) {
3356  cout<<endl;
3357  cout<<"start reconstruct PF Jets --- "<<endl;
3358  }
3359  pfJets_.clear();
3361 
3362  for( unsigned i=0; i<pfCandidates_->size(); i++) {
3363  reco::CandidatePtr candPtr( pfCandidates_.get(), i );
3364  pfCandidatesPtrs_.push_back( candPtr );
3365  }
3366 
3367  vector<ProtoJet> protoJets;
3369 
3370  // Convert Protojets to PFJets
3371 
3372  int ijet = 0;
3373  typedef vector <ProtoJet>::const_iterator IPJ;
3374  for (IPJ ipj = protoJets.begin(); ipj != protoJets.end (); ipj++) {
3375  const ProtoJet& protojet = *ipj;
3376  const ProtoJet::Constituents& constituents = protojet.getTowerList();
3377 
3378  reco::Jet::Point vertex (0,0,0); // do not have true vertex yet, use default
3380  JetMaker::makeSpecific(constituents, &specific);
3381  // constructor without constituents
3382  PFJet newJet (protojet.p4(), vertex, specific);
3383 
3384  // last step is to copy the constituents into the jet (new jet definition since 18X)
3385  // namespace reco {
3386  //class Jet : public CompositeRefBaseCandidate {
3387  // public:
3388  // typedef reco::CandidateBaseRefVector Constituents;
3389 
3390  ProtoJet::Constituents::const_iterator constituent = constituents.begin();
3391  for (; constituent != constituents.end(); ++constituent) {
3392  // find index of this ProtoJet constituent in the overall collection PFconstit
3393  // see class IndexedCandidate in JetRecoTypes.h
3394  uint index = constituent->index();
3395  newJet.addDaughter(pfCandidatesPtrs_[index]);
3396  } // end loop on ProtoJet constituents
3397  // last step: copy ProtoJet Variables into Jet
3398  newJet.setJetArea(protojet.jetArea());
3399  newJet.setPileup(protojet.pileup());
3400  newJet.setNPasses(protojet.nPasses());
3401  ++ijet;
3402  if (jetsDebug_ ) cout<<" PF jet "<<ijet<<" "<<newJet.print()<<endl;
3403  pfJets_.push_back (newJet);
3404 
3405  } // end loop on protojets iterator IPJ
3406 
3407 }
3408 
3409 void
3411 
3412  // cout<<"!!! Make FWLite Jets "<<endl;
3414  // vector<ProtoJet> output;
3415  jetMaker_.applyCuts (Candidates, &input);
3416  if (jetAlgoType_==1) {// ICone
3418  jetMaker_.makeIterativeConeJets(input, &output);
3419  }
3420  if (jetAlgoType_==2) {// MCone
3421  jetMaker_.makeMidpointJets(input, &output);
3422  }
3423  if (jetAlgoType_==3) {// Fastjet
3424  jetMaker_.makeFastJets(input, &output);
3425  }
3426  if((jetAlgoType_>3)||(jetAlgoType_<0)) {
3427  cout<<"Unknown Jet Algo ! " <<jetAlgoType_ << endl;
3428  }
3429  //if (jetsDebug_) cout<<"Proto Jet Size " <<output.size()<<endl;
3430 
3431 }
3432 
3433 
3434 
3436 double
3438  //std::cout << "building jets from MC particles,"
3439  // << "PF particles and caloTowers" << std::endl;
3440 
3441  //initialize Jets Reconstruction
3442  jetAlgo_.Clear();
3443 
3444  //COLIN The following comment is not really adequate,
3445  // since partTOTMC is not an action..
3446  // one should say what this variable is for.
3447  // see my comment later
3448  //MAKING TRUE PARTICLE JETS
3449 // TLorentzVector partTOTMC;
3450 
3451  // colin: the following is not necessary
3452  // since the lorentz vectors are initialized to 0,0,0,0.
3453  // partTOTMC.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
3454 
3455  //MAKING JETS WITH TAU DAUGHTERS
3456  //Colin: this vector vectPART is not necessary !!
3457  //it was just an efficient copy of trueparticles_.....
3458 // vector<reco::PFSimParticle> vectPART;
3459 // for ( unsigned i=0; i < trueParticles_.size(); i++) {
3460 // const reco::PFSimParticle& ptc = trueParticles_[i];
3461 // vectPART.push_back(ptc);
3462 // }//loop
3463 
3464 
3465  //COLIN one must not loop on trueParticles_ to find taus.
3466  //the code was giving wrong results on non single tau events.
3467 
3468  // first check that this is a single tau event.
3469 
3470  TLorentzVector partTOTMC;
3471  bool tauFound = false;
3472  bool tooManyTaus = false;
3473  if (fastsim_){
3474 
3475  for ( unsigned i=0; i < trueParticles_.size(); i++) {
3476  const reco::PFSimParticle& ptc = trueParticles_[i];
3477  if (std::abs(ptc.pdgCode()) == 15) {
3478  // this is a tau
3479  if( i ) tooManyTaus = true;
3480  else tauFound=true;
3481  }
3482  }
3483 
3484  if(!tauFound || tooManyTaus ) {
3485  // cerr<<"PFRootEventManager::tauBenchmark : not a single tau event"<<endl;
3486  return -9999;
3487  }
3488 
3489  // loop on the daugthers of the tau
3490  const std::vector<int>& ptcdaughters = trueParticles_[0].daughterIds();
3491 
3492  // will contain the sum of the lorentz vectors of the visible daughters
3493  // of the tau.
3494 
3495 
3496  for ( unsigned int dapt=0; dapt < ptcdaughters.size(); ++dapt) {
3497 
3498  const reco::PFTrajectoryPoint& tpatvtx
3499  = trueParticles_[ptcdaughters[dapt]].trajectoryPoint(0);
3500  TLorentzVector partMC;
3501  partMC.SetPxPyPzE(tpatvtx.momentum().Px(),
3502  tpatvtx.momentum().Py(),
3503  tpatvtx.momentum().Pz(),
3504  tpatvtx.momentum().E());
3505 
3506  partTOTMC += partMC;
3507  if (tauBenchmarkDebug_) {
3508  //pdgcode
3509  int pdgcode = trueParticles_[ptcdaughters[dapt]].pdgCode();
3510  cout << pdgcode << endl;
3511  cout << tpatvtx << endl;
3512  cout << partMC.Px() << " " << partMC.Py() << " "
3513  << partMC.Pz() << " " << partMC.E()
3514  << " PT="
3515  << sqrt(partMC.Px()*partMC.Px()+partMC.Py()*partMC.Py())
3516  << endl;
3517  }//debug
3518  }//loop daughter
3519  }else{
3520 
3521  uint itau=0;
3522  const HepMC::GenEvent* myGenEvent = MCTruth_.GetEvent();
3523  for ( HepMC::GenEvent::particle_const_iterator
3524  piter = myGenEvent->particles_begin();
3525  piter != myGenEvent->particles_end();
3526  ++piter ) {
3527 
3528 
3529  if (std::abs((*piter)->pdg_id())==15){
3530  itau++;
3531  tauFound=true;
3532  for ( HepMC::GenVertex::particles_out_const_iterator bp =
3533  (*piter)->end_vertex()->particles_out_const_begin();
3534  bp != (*piter)->end_vertex()->particles_out_const_end(); ++bp ) {
3535  uint nuId=std::abs((*bp)->pdg_id());
3536  bool isNeutrino=(nuId==12)||(nuId==14)||(nuId==16);
3537  if (!isNeutrino){
3538 
3539 
3540  TLorentzVector partMC;
3541  partMC.SetPxPyPzE((*bp)->momentum().x(),
3542  (*bp)->momentum().y(),
3543  (*bp)->momentum().z(),
3544  (*bp)->momentum().e());
3545  partTOTMC += partMC;
3546  }
3547  }
3548  }
3549  }
3550  if (itau>1) tooManyTaus=true;
3551 
3552  if(!tauFound || tooManyTaus ) {
3553  cerr<<"PFRootEventManager::tauBenchmark : not a single tau event"<<endl;
3554  return -9999;
3555  }
3556  }
3557 
3558 
3559  EventColin::Jet jetmc;
3560 
3561  jetmc.eta = partTOTMC.Eta();
3562  jetmc.phi = partTOTMC.Phi();
3563  jetmc.et = partTOTMC.Et();
3564  jetmc.e = partTOTMC.E();
3565 
3566  if(outEvent_) outEvent_->addJetMC( jetmc );
3567 
3568  /*
3569  //MC JETS RECONSTRUCTION (visible energy)
3570  for ( unsigned i=0; i < trueParticles_.size(); i++) {
3571  const reco::PFSimParticle& ptc = trueParticles_[i];
3572  const std::vector<int>& ptcdaughters = ptc.daughterIds();
3573 
3574  //PARTICULE NOT DISINTEGRATING BEFORE ECAL
3575  if(ptcdaughters.size() != 0) continue;
3576 
3577  //TAKE INFO AT VERTEX //////////////////////////////////////////////////
3578  const reco::PFTrajectoryPoint& tpatvtx = ptc.trajectoryPoint(0);
3579  TLorentzVector partMC;
3580  partMC.SetPxPyPzE(tpatvtx.momentum().Px(),
3581  tpatvtx.momentum().Py(),
3582  tpatvtx.momentum().Pz(),
3583  tpatvtx.momentum().E());
3584 
3585  partTOTMC += partMC;
3586  if (tauBenchmarkDebug_) {
3587  //pdgcode
3588  int pdgcode = ptc.pdgCode();
3589  cout << pdgcode << endl;
3590  cout << tpatvtx << endl;
3591  cout << partMC.Px() << " " << partMC.Py() << " "
3592  << partMC.Pz() << " " << partMC.E()
3593  << " PT="
3594  << sqrt(partMC.Px()*partMC.Px()+partMC.Py()*partMC.Py())
3595  << endl;
3596  }//debug?
3597  }//loop true particles
3598  */
3599  if (tauBenchmarkDebug_) {
3600  cout << " ET Vector=" << partTOTMC.Et()
3601  << " " << partTOTMC.Eta()
3602  << " " << partTOTMC.Phi() << endl; cout << endl;
3603  }//debug
3604 
3606  //CALO TOWER JETS (ECAL+HCAL Towers)
3607  //cout << endl;
3608  //cout << "THERE ARE " << caloTowers_.size() << " CALO TOWERS" << endl;
3609 
3610  vector<TLorentzVector> allcalotowers;
3611  // vector<double> allemenergy;
3612  // vector<double> allhadenergy;
3613  double threshCaloTowers = 1E-10;
3614  for ( unsigned int i = 0; i < caloTowers_.size(); ++i) {
3615 
3616  if(caloTowers_[i].energy() < threshCaloTowers) {
3617  // cout<<"skipping calotower"<<endl;
3618  continue;
3619  }
3620 
3621  TLorentzVector caloT;
3622  TVector3 pepr( caloTowers_[i].eta(),
3623  caloTowers_[i].phi(),
3624  caloTowers_[i].energy());
3625  TVector3 pxyz = Utils::VectorEPRtoXYZ( pepr );
3626  caloT.SetPxPyPzE(pxyz.X(),pxyz.Y(),pxyz.Z(),caloTowers_[i].energy());
3627  allcalotowers.push_back(caloT);
3628  // allemenergy.push_back( caloTowers_[i].emEnergy() );
3629  // allhadenergy.push_back( caloTowers_[i].hadEnergy() );
3630  }//loop calo towers
3631  if ( tauBenchmarkDebug_)
3632  cout << " RETRIEVED " << allcalotowers.size()
3633  << " CALOTOWER 4-VECTORS " << endl;
3634 
3635  //ECAL+HCAL tower jets computation
3636  jetAlgo_.Clear();
3637  const vector< PFJetAlgorithm::Jet >& caloTjets
3638  = jetAlgo_.FindJets( &allcalotowers );
3639 
3640  //cout << caloTjets.size() << " CaloTower Jets found" << endl;
3641  double JetEHTETmax = 0.0;
3642  for ( unsigned i = 0; i < caloTjets.size(); i++) {
3643  TLorentzVector jetmom = caloTjets[i].GetMomentum();
3644  double jetcalo_pt = sqrt(jetmom.Px()*jetmom.Px()+jetmom.Py()*jetmom.Py());
3645  double jetcalo_et = jetmom.Et();
3646 
3648  jet.eta = jetmom.Eta();
3649  jet.phi = jetmom.Phi();
3650  jet.et = jetmom.Et();
3651  jet.e = jetmom.E();
3652 
3653  const vector<int>& indexes = caloTjets[i].GetIndexes();
3654  for( unsigned ii=0; ii<indexes.size(); ii++){
3655  jet.ee += caloTowers_[ indexes[ii] ].emEnergy();
3656  jet.eh += caloTowers_[ indexes[ii] ].hadEnergy();
3657  jet.ete += caloTowers_[ indexes[ii] ].emEt();
3658  jet.eth += caloTowers_[ indexes[ii] ].hadEt();
3659  }
3660 
3661  if(outEvent_) outEvent_->addJetEHT( jet );
3662 
3663  if ( tauBenchmarkDebug_) {
3664  cout << " ECAL+HCAL jet : " << caloTjets[i] << endl;
3665  cout << jetmom.Px() << " " << jetmom.Py() << " "
3666  << jetmom.Pz() << " " << jetmom.E()
3667  << " PT=" << jetcalo_pt << endl;
3668  }//debug
3669 
3670  if (jetcalo_et >= JetEHTETmax)
3671  JetEHTETmax = jetcalo_et;
3672  }//loop MCjets
3673 
3675  //PARTICLE FLOW JETS
3676  vector<TLorentzVector> allrecparticles;
3677  // if ( tauBenchmarkDebug_) {
3678  // cout << endl;
3679  // cout << " THERE ARE " << pfBlocks_.size() << " EFLOW BLOCKS" << endl;
3680  // }//debug
3681 
3682  // for ( unsigned iefb = 0; iefb < pfBlocks_.size(); iefb++) {
3683  // const std::vector< PFBlockParticle >& recparticles
3684  // = pfBlocks_[iefb].particles();
3685 
3686 
3687 
3688  for(unsigned i=0; i<candidates.size(); i++) {
3689 
3690  // if (tauBenchmarkDebug_)
3691  // cout << " there are " << recparticles.size()
3692  // << " particle in this block" << endl;
3693 
3694  const reco::PFCandidate& candidate = candidates[i];
3695 
3696  if (tauBenchmarkDebug_) {
3697  cout << i << " " << candidate << endl;
3698  int type = candidate.particleId();
3699  cout << " type= " << type << " " << candidate.charge()
3700  << endl;
3701  }//debug
3702 
3703  const math::XYZTLorentzVector& PFpart = candidate.p4();
3704 
3705  TLorentzVector partRec(PFpart.Px(),
3706  PFpart.Py(),
3707  PFpart.Pz(),
3708  PFpart.E());
3709 
3710  //loading 4-vectors of Rec particles
3711  allrecparticles.push_back( partRec );
3712 
3713  }//loop on candidates
3714 
3715 
3716  if (tauBenchmarkDebug_)
3717  cout << " THERE ARE " << allrecparticles.size()
3718  << " RECONSTRUCTED 4-VECTORS" << endl;
3719 
3720  jetAlgo_.Clear();
3721  const vector< PFJetAlgorithm::Jet >& PFjets
3722  = jetAlgo_.FindJets( &allrecparticles );
3723 
3724  if (tauBenchmarkDebug_)
3725  cout << PFjets.size() << " PF Jets found" << endl;
3726  double JetPFETmax = 0.0;
3727  for ( unsigned i = 0; i < PFjets.size(); i++) {
3728  TLorentzVector jetmom = PFjets[i].GetMomentum();
3729  double jetpf_pt = sqrt(jetmom.Px()*jetmom.Px()+jetmom.Py()*jetmom.Py());
3730  double jetpf_et = jetmom.Et();
3731 
3733  jet.eta = jetmom.Eta();
3734  jet.phi = jetmom.Phi();
3735  jet.et = jetmom.Et();
3736  jet.e = jetmom.E();
3737 
3738  if(outEvent_) outEvent_->addJetPF( jet );
3739 
3740  if (tauBenchmarkDebug_) {
3741  cout <<" Rec jet : "<< PFjets[i] <<endl;
3742  cout << jetmom.Px() << " " << jetmom.Py() << " "
3743  << jetmom.Pz() << " " << jetmom.E()
3744  << " PT=" << jetpf_pt << " eta="<< jetmom.Eta()
3745  << " Phi=" << jetmom.Phi() << endl;
3746  cout << "------------------------------------------------" << endl;
3747  }//debug
3748 
3749  if (jetpf_et >= JetPFETmax)
3750  JetPFETmax = jetpf_et;
3751  }//loop PF jets
3752 
3753  //fill histos
3754 
3755  double deltaEtEHT = JetEHTETmax - partTOTMC.Et();
3756  h_deltaETvisible_MCEHT_->Fill(deltaEtEHT);
3757 
3758  double deltaEt = JetPFETmax - partTOTMC.Et();
3759  h_deltaETvisible_MCPF_ ->Fill(deltaEt);
3760 
3761  if (verbosity_ == VERBOSE ) {
3762  cout << "tau benchmark E_T(PF) - E_T(true) = " << deltaEt << endl;
3763  }
3764 
3765  return deltaEt/partTOTMC.Et();
3766 }//Makejets
3767 
3768 
3769 
3770 
3771 
3772 /*
3773 
3774 void PFRootEventManager::lookForGenParticle(unsigned barcode) {
3775 
3776 const HepMC::GenEvent* event = MCTruth_.GetEvent();
3777 if(!event) {
3778 cerr<<"no GenEvent"<<endl;
3779 return;
3780 }
3781 
3782 const HepMC::GenParticle* particle = event->barcode_to_particle(barcode);
3783 if(!particle) {
3784 cerr<<"no particle with barcode "<<barcode<<endl;
3785 return;
3786 }
3787 
3788 math::XYZTLorentzVector momentum(particle->momentum().px(),
3789 particle->momentum().py(),
3790 particle->momentum().pz(),
3791 particle->momentum().e());
3792 
3793 double eta = momentum.Eta();
3794 double phi = momentum.phi();
3795 
3796 double phisize = 0.05;
3797 double etasize = 0.05;
3798 
3799 double etagate = displayZoomFactor_ * etasize;
3800 double phigate = displayZoomFactor_ * phisize;
3801 
3802 if(displayHist_[EPE]) {
3803 displayHist_[EPE]->GetXaxis()->SetRangeUser(eta-etagate, eta+etagate);
3804 displayHist_[EPE]->GetYaxis()->SetRangeUser(phi-phigate, phi+phigate);
3805 }
3806 if(displayHist_[EPH]) {
3807 displayHist_[EPH]->GetXaxis()->SetRangeUser(eta-etagate, eta+etagate);
3808 displayHist_[EPH]->GetYaxis()->SetRangeUser(phi-phigate, phi+phigate);
3809 }
3810 
3811 updateDisplay();
3812 
3813 }
3814 */
3815 
3816 
3817 
3818 string PFRootEventManager::expand(const string& oldString) const {
3819 
3820  string newString = oldString;
3821 
3822  string dollar = "$";
3823  string slash = "/";
3824 
3825  // protection necessary or segv !!
3826  int dollarPos = newString.find(dollar,0);
3827  if( dollarPos == -1 ) return oldString;
3828 
3829  int lengh = newString.find(slash,0) - newString.find(dollar,0) + 1;
3830  string env_variable =
3831  newString.substr( ( newString.find(dollar,0) + 1 ), lengh -2);
3832  // the env var could be defined between { }
3833  int begin = env_variable.find_first_of("{");
3834  int end = env_variable.find_last_of("}");
3835 
3836  // cout << "var=" << env_variable << begin<<" "<<end<< endl;
3837 
3838 
3839  env_variable = env_variable.substr( begin+1, end-1 );
3840  // cout << "var=" << env_variable <<endl;
3841 
3842 
3843  // cerr<<"call getenv "<<endl;
3844  char* directory = getenv( env_variable.c_str() );
3845 
3846  if(!directory) {
3847  cerr<<"please define environment variable $"<<env_variable<<endl;
3848  delete this;
3849  exit(1);
3850  }
3851  string sdir = directory;
3852  sdir += "/";
3853 
3854  newString.replace( 0, lengh , sdir);
3855 
3856  if (verbosity_ == VERBOSE ) {
3857  cout << "expand " <<oldString<<" to "<< newString << endl;
3858  }
3859 
3860  return newString;
3861 }
3862 
3863 
3864 void
3866 
3867  if(!out) return;
3868  // if (!out.is_open()) return;
3869 
3870  // Use only for one PFSimParticle/GenParticles
3871  const HepMC::GenEvent* myGenEvent = MCTruth_.GetEvent();
3872  if(!myGenEvent) return;
3873  int nGen = 0;
3874  for ( HepMC::GenEvent::particle_const_iterator
3875  piter = myGenEvent->particles_begin();
3876  piter != myGenEvent->particles_end();
3877  ++piter ) nGen++;
3878  int nSim = trueParticles_.size();
3879  if ( nGen != 1 || nSim != 1 ) return;
3880 
3881  // One GenJet
3882  if ( genJets_.size() != 1 ) return;
3883  double true_E = genJets_[0].p();
3884  double true_eta = genJets_[0].eta();
3885  double true_phi = genJets_[0].phi();
3886 
3887  // One particle-flow jet
3888  // if ( pfJets_.size() != 1 ) return;
3889  double rec_ECALEnergy = 0.;
3890  double rec_HCALEnergy = 0.;
3891  double deltaRMin = 999.;
3892  unsigned int theJet = 0;
3893  for ( unsigned int ijet=0; ijet<pfJets_.size(); ++ijet ) {
3894  double rec_ECAL = pfJets_[ijet].neutralEmEnergy();
3895  double rec_HCAL = pfJets_[ijet].neutralHadronEnergy();
3896  double rec_eta = pfJets_[0].eta();
3897  double rec_phi = pfJets_[0].phi();
3898  double deltaR = std::sqrt( (rec_eta-true_eta)*(rec_eta-true_eta)
3899  + (rec_phi-true_phi)*(rec_phi-true_phi) );
3900  if ( deltaR < deltaRMin ) {
3901  deltaRMin = deltaR;
3902  rec_ECALEnergy = rec_ECAL;
3903  rec_HCALEnergy = rec_HCAL;
3904  }
3905  }
3906  if ( deltaRMin > 0.1 ) return;
3907 
3908  std::vector < PFCandidatePtr > constituents = pfJets_[theJet].getPFConstituents ();
3909  double pat_ECALEnergy = 0.;
3910  double pat_HCALEnergy = 0.;
3911  for (unsigned ic = 0; ic < constituents.size (); ++ic) {
3912  if ( constituents[ic]->particleId() < 4 ) continue;
3913  if ( constituents[ic]->particleId() == 4 )
3914  pat_ECALEnergy += constituents[ic]->rawEcalEnergy();
3915  else if ( constituents[ic]->particleId() == 5 )
3916  pat_HCALEnergy += constituents[ic]->rawHcalEnergy();
3917  }
3918 
3919  out << true_eta << " " << true_phi << " " << true_E
3920  << " " << rec_ECALEnergy << " " << rec_HCALEnergy
3921  << " " << pat_ECALEnergy << " " << pat_HCALEnergy
3922  << " " << deltaRMin << std::endl;
3923 }
3924 
3925 void PFRootEventManager::print(ostream& out,int maxNLines ) const {
3926 
3927  if(!out) return;
3928 
3929  //If McTruthMatching print a detailed list
3930  //of matching between simparticles and PFCandidates
3931  //MCTruth Matching vectors.
3932  std::vector< std::list <simMatch> > candSimMatchTrack;
3933  std::vector< std::list <simMatch> > candSimMatchEcal;
3934  if( printMCTruthMatching_){
3936  *pfCandidates_,
3937  candSimMatchTrack,
3938  candSimMatchEcal);
3939  }
3940 
3941 
3942  if( printRecHits_ ) {
3943  out<<"ECAL RecHits ==============================================="<<endl;
3944  printRecHits(rechitsECAL_, clusterAlgoECAL_, out ); out<<endl;
3945  out<<"HCAL RecHits ==============================================="<<endl;
3946  printRecHits(rechitsHCAL_, clusterAlgoHCAL_, out ); out<<endl;
3947  if (useHO_) {
3948  out<<"HO RecHits ================================================="<<endl;
3949  printRecHits(rechitsHO_, clusterAlgoHO_, out ); out<<endl;
3950  }
3951  out<<"HFEM RecHits ==============================================="<<endl;
3952  printRecHits(rechitsHFEM_, clusterAlgoHFEM_, out ); out<<endl;
3953  out<<"HFHAD RecHits =============================================="<<endl;
3954  printRecHits(rechitsHFHAD_, clusterAlgoHFHAD_, out ); out<<endl;
3955  out<<"PS RecHits ================================================="<<endl;
3956  printRecHits(rechitsPS_, clusterAlgoPS_, out ); out<<endl;
3957  }
3958 
3959  if( printClusters_ ) {
3960  out<<"ECAL Clusters ============================================="<<endl;
3961  printClusters( *clustersECAL_, out); out<<endl;
3962  out<<"HCAL Clusters ============================================="<<endl;
3963  printClusters( *clustersHCAL_, out); out<<endl;
3964  if (useHO_) {
3965  out<<"HO Clusters ==============================================="<<endl;
3966  printClusters( *clustersHO_, out); out<<endl;
3967  }
3968  out<<"HFEM Clusters ============================================="<<endl;
3969  printClusters( *clustersHFEM_, out); out<<endl;
3970  out<<"HFHAD Clusters ============================================"<<endl;
3971  printClusters( *clustersHFHAD_, out); out<<endl;
3972  out<<"PS Clusters ============================================="<<endl;
3973  printClusters( *clustersPS_, out); out<<endl;
3974  }
3975  bool printTracks = true;
3976  if( printTracks) {
3977 
3978  }
3979  if( printPFBlocks_ ) {
3980  out<<"Particle Flow Blocks ======================================"<<endl;
3981  for(unsigned i=0; i<pfBlocks_->size(); i++) {
3982  out<<i<<" "<<(*pfBlocks_)[i]<<endl;
3983  }
3984  out<<endl;
3985  }
3986  if(printPFCandidates_) {
3987  out<<"Particle Flow Candidates =================================="<<endl;
3988  double mex = 0.;
3989  double mey = 0.;
3990  for(unsigned i=0; i<pfCandidates_->size(); i++) {
3991  const PFCandidate& pfc = (*pfCandidates_)[i];
3992  mex -= pfc.px();
3993  mey -= pfc.py();
3994  if(pfc.pt()>printPFCandidatesPtMin_)
3995  out<<i<<" " <<(*pfCandidates_)[i]<<endl;
3996  }
3997  out<<endl;
3998  out<< "MEX, MEY, MET ============================================" <<endl
3999  << mex << " " << mey << " " << sqrt(mex*mex+mey*mey);
4000  out<<endl;
4001  out<<endl;
4002 
4003  //print a detailed list of PFSimParticles matching
4004  //the PFCandiates
4006  cout<<"MCTruthMatching Results"<<endl;
4007  for(unsigned icand=0; icand<pfCandidates_->size();
4008  icand++) {
4009  out <<icand<<" " <<(*pfCandidates_)[icand]<<endl;
4010  out << "is matching:" << endl;
4011 
4012  //tracking
4013  ITM it_t = candSimMatchTrack[icand].begin();
4014  ITM itend_t = candSimMatchTrack[icand].end();
4015  for(;it_t!=itend_t;++it_t){
4016  unsigned simid = it_t->second;
4017  out << "\tSimParticle " << trueParticles_[simid]
4018  <<endl;
4019  out << "\t\tthrough Track matching pTrectrack="
4020  << it_t->first << " GeV" << endl;
4021  }//loop simparticles
4022 
4023  ITM it_e = candSimMatchEcal[icand].begin();
4024  ITM itend_e = candSimMatchEcal[icand].end();
4025  for(;it_e!=itend_e;++it_e){
4026  unsigned simid = it_e->second;
4027  out << "\tSimParticle " << trueParticles_[simid]
4028  << endl;
4029  out << "\t\tsimparticle contributing to a total of "
4030  << it_e->first
4031  << " GeV of its ECAL cluster"
4032  << endl;
4033  }//loop simparticles
4034  cout<<"________________"<<endl;
4035  }//loop candidates
4036  }
4037  }
4038  if(printPFJets_) {
4039  out<<"Jets ====================================================="<<endl;
4040  out<<"Particle Flow: "<<endl;
4041  for(unsigned i=0; i<pfJets_.size(); i++) {
4042  if (pfJets_[i].pt() > printPFJetsPtMin_ )
4043  out<<i<<pfJets_[i].print()<<endl;
4044  }
4045  out<<endl;
4046  out<<"Generated: "<<endl;
4047  for(unsigned i=0; i<genJets_.size(); i++) {
4048  if (genJets_[i].pt() > printPFJetsPtMin_ )
4049  out<<i<<genJets_[i].print()<<endl;
4050  // <<" invisible energy = "<<genJets_[i].invisibleEnergy()<<endl;
4051  }
4052  out<<endl;
4053  out<<"Calo: "<<endl;
4054  for(unsigned i=0; i<caloJets_.size(); i++) {
4055  out<<"pt = "<<caloJets_[i].pt()<<endl;
4056  }
4057  out<<endl;
4058  }
4059  if( printSimParticles_ ) {
4060  out<<"Sim Particles ==========================================="<<endl;
4061 
4062  for(unsigned i=0; i<trueParticles_.size(); i++) {
4063  if( trackInsideGCut( trueParticles_[i]) ){
4064 
4065  const reco::PFSimParticle& ptc = trueParticles_[i];
4066 
4067  // get trajectory at start point
4068  const reco::PFTrajectoryPoint& tp0 = ptc.extrapolatedPoint( 0 );
4069 
4070  if(tp0.momentum().pt()>printSimParticlesPtMin_)
4071  out<<"\t"<<trueParticles_[i]<<endl;
4072  }
4073  }
4074 
4075  //print a detailed list of PFSimParticles matching
4076  //the PFCandiates
4077  if(printMCTruthMatching_) {
4078  cout<<"MCTruthMatching Results"<<endl;
4079  for ( unsigned i=0; i < trueParticles_.size(); i++) {
4080  cout << "==== Particle Simulated " << i << endl;
4081  const reco::PFSimParticle& ptc = trueParticles_[i];
4082  out <<i<<" "<<trueParticles_[i]<<endl;
4083 
4084  if(!ptc.daughterIds().empty()){
4085  cout << "Look at the desintegration products" << endl;
4086  cout << endl;
4087  continue;
4088  }
4089 
4090  //TRACKING
4091  if(ptc.rectrackId() != 99999){
4092  cout << "matching pfCandidate (trough tracking): " << endl;
4093  for( unsigned icand=0; icand<pfCandidates_->size()
4094  ; icand++ )
4095  {
4096  ITM it = candSimMatchTrack[icand].begin();
4097  ITM itend = candSimMatchTrack[icand].end();
4098  for(;it!=itend;++it)
4099  if( i == it->second ){
4100  out<<icand<<" "<<(*pfCandidates_)[icand]<<endl;
4101  cout << endl;
4102  }
4103  }//loop candidate
4104  }//trackmatch
4105 
4106  //CALORIMETRY
4107  vector<unsigned> rechitSimIDs
4108  = ptc.recHitContrib();
4109  vector<double> rechitSimFrac
4110  = ptc.recHitContribFrac();
4111  //cout << "Number of rechits contrib =" << rechitSimIDs.size() << endl;
4112  if( !rechitSimIDs.size() ) continue; //no rechit
4113 
4114  cout << "matching pfCandidate (through ECAL): " << endl;
4115 
4116  //look at total ECAL desposition:
4117  double totalEcalE = 0.0;
4118  for(unsigned irh=0; irh<rechitsECAL_.size();++irh)
4119  for ( unsigned isimrh=0; isimrh < rechitSimIDs.size();
4120  isimrh++ )
4121  if(rechitSimIDs[isimrh] == rechitsECAL_[irh].detId())
4122  totalEcalE += (rechitsECAL_[irh].energy()*rechitSimFrac[isimrh]/100.0);
4123  cout << "For info, this particle deposits E=" << totalEcalE
4124  << "(GeV) in the ECAL" << endl;
4125 
4126  for( unsigned icand=0; icand<pfCandidates_->size()
4127  ; icand++ )
4128  {
4129  ITM it = candSimMatchEcal[icand].begin();
4130  ITM itend = candSimMatchEcal[icand].end();
4131  for(;it!=itend;++it)
4132  if( i == it->second )
4133  out<<icand<<" "<<it->first<<"GeV "<<(*pfCandidates_)[icand]<<endl;
4134  }//loop candidate
4135  cout << endl;
4136  }//loop particles
4137  }//mctruthmatching
4138 
4139  }
4140 
4141 
4142  if ( printGenParticles_ ) {
4143  printGenParticles(out,maxNLines);
4144  }
4145 }
4146 
4147 
4148 void
4150  int maxNLines) const {
4151 
4152 
4153  const HepMC::GenEvent* myGenEvent = MCTruth_.GetEvent();
4154  if(!myGenEvent) return;
4155 
4156  out<<"GenParticles ==========================================="<<endl;
4157 
4158  std::cout << "Id Gen Name eta phi pT E Vtx1 "
4159  << " x y z "
4160  << "Moth Vtx2 eta phi R Z Da1 Da2 Ecal?"
4161  << std::endl;
4162 
4163  int nLines = 0;
4164  for ( HepMC::GenEvent::particle_const_iterator
4165  piter = myGenEvent->particles_begin();
4166  piter != myGenEvent->particles_end();
4167  ++piter ) {
4168 
4169  if( nLines == maxNLines) break;
4170  nLines++;
4171 
4172  HepMC::GenParticle* p = *piter;
4173  /* */
4174  int partId = p->pdg_id();
4175 
4176  // We have here a subset of particles only.
4177  // To be filled according to the needs.
4178  /*switch(partId) {
4179  case 1: { name = "d"; break; }
4180  case 2: { name = "u"; break; }
4181  case 3: { name = "s"; break; }
4182  case 4: { name = "c"; break; }
4183  case 5: { name = "b"; break; }
4184  case 6: { name = "t"; break; }
4185  case -1: { name = "~d"; break; }
4186  case -2: { name = "~u"; break; }
4187  case -3: { name = "~s"; break; }
4188  case -4: { name = "~c"; break; }
4189  case -5: { name = "~b"; break; }
4190  case -6: { name = "~t"; break; }
4191  case 11: { name = "e-"; break; }
4192  case -11: { name = "e+"; break; }
4193  case 12: { name = "nu_e"; break; }
4194  case -12: { name = "~nu_e"; break; }
4195  case 13: { name = "mu-"; break; }
4196  case -13: { name = "mu+"; break; }
4197  case 14: { name = "nu_mu"; break; }
4198  case -14: { name = "~nu_mu"; break; }
4199  case 15: { name = "tau-"; break; }
4200  case -15: { name = "tau+"; break; }
4201  case 16: { name = "nu_tau"; break; }
4202  case -16: { name = "~nu_tau"; break; }
4203  case 21: { name = "gluon"; break; }
4204  case 22: { name = "gamma"; break; }
4205  case 23: { name = "Z0"; break; }
4206  case 24: { name = "W+"; break; }
4207  case 25: { name = "H0"; break; }
4208  case -24: { name = "W-"; break; }
4209  case 111: { name = "pi0"; break; }
4210  case 113: { name = "rho0"; break; }
4211  case 223: { name = "omega"; break; }
4212  case 333: { name = "phi"; break; }
4213  case 443: { name = "J/psi"; break; }
4214  case 553: { name = "Upsilon"; break; }
4215  case 130: { name = "K0L"; break; }
4216  case 211: { name = "pi+"; break; }
4217  case -211: { name = "pi-"; break; }
4218  case 213: { name = "rho+"; break; }
4219  case -213: { name = "rho-"; break; }
4220  case 221: { name = "eta"; break; }
4221  case 331: { name = "eta'"; break; }
4222  case 441: { name = "etac"; break; }
4223  case 551: { name = "etab"; break; }
4224  case 310: { name = "K0S"; break; }
4225  case 311: { name = "K0"; break; }
4226  case -311: { name = "Kbar0"; break; }
4227  case 321: { name = "K+"; break; }
4228  case -321: { name = "K-"; break; }
4229  case 411: { name = "D+"; break; }
4230  case -411: { name = "D-"; break; }
4231  case 421: { name = "D0"; break; }
4232  case 431: { name = "Ds_+"; break; }
4233  case -431: { name = "Ds_-"; break; }
4234  case 511: { name = "B0"; break; }
4235  case 521: { name = "B+"; break; }
4236  case -521: { name = "B-"; break; }
4237  case 531: { name = "Bs_0"; break; }
4238  case 541: { name = "Bc_+"; break; }
4239  case -541: { name = "Bc_+"; break; }
4240  case 313: { name = "K*0"; break; }
4241  case -313: { name = "K*bar0"; break; }
4242  case 323: { name = "K*+"; break; }
4243  case -323: { name = "K*-"; break; }
4244  case 413: { name = "D*+"; break; }
4245  case -413: { name = "D*-"; break; }
4246  case 423: { name = "D*0"; break; }
4247  case 513: { name = "B*0"; break; }
4248  case 523: { name = "B*+"; break; }
4249  case -523: { name = "B*-"; break; }
4250  case 533: { name = "B*_s0"; break; }
4251  case 543: { name = "B*_c+"; break; }
4252  case -543: { name = "B*_c-"; break; }
4253  case 1114: { name = "Delta-"; break; }
4254  case -1114: { name = "Deltabar+"; break; }
4255  case -2112: { name = "nbar0"; break; }
4256  case 2112: { name = "n"; break; }
4257  case 2114: { name = "Delta0"; break; }
4258  case -2114: { name = "Deltabar0"; break; }
4259  case 3122: { name = "Lambda0"; break; }
4260  case -3122: { name = "Lambdabar0"; break; }
4261  case 3112: { name = "Sigma-"; break; }
4262  case -3112: { name = "Sigmabar+"; break; }
4263  case 3212: { name = "Sigma0"; break; }
4264  case -3212: { name = "Sigmabar0"; break; }
4265  case 3214: { name = "Sigma*0"; break; }
4266  case -3214: { name = "Sigma*bar0"; break; }
4267  case 3222: { name = "Sigma+"; break; }
4268  case -3222: { name = "Sigmabar-"; break; }
4269  case 2212: { name = "p"; break; }
4270  case -2212: { name = "~p"; break; }
4271  case -2214: { name = "Delta-"; break; }
4272  case 2214: { name = "Delta+"; break; }
4273  case -2224: { name = "Deltabar--"; break; }
4274  case 2224: { name = "Delta++"; break; }
4275  default: {
4276  name = "unknown";
4277  cout << "Unknown code : " << partId << endl;
4278  }
4279  }
4280  */
4281  std::string latexString;
4282  std::string name = getGenParticleName(partId,latexString);
4283 
4284  math::XYZTLorentzVector momentum1(p->momentum().px(),
4285  p->momentum().py(),
4286  p->momentum().pz(),
4287  p->momentum().e() );
4288 
4289  if(momentum1.pt()<printGenParticlesPtMin_) continue;
4290 
4291  int vertexId1 = 0;
4292 
4293  if ( !p->production_vertex() && p->pdg_id() == 2212 ) continue;
4294 
4295  math::XYZVector vertex1;
4296  vertexId1 = -1;
4297 
4298  if(p->production_vertex() ) {
4299  vertex1.SetCoordinates( p->production_vertex()->position().x()/10.,
4300  p->production_vertex()->position().y()/10.,
4301  p->production_vertex()->position().z()/10. );
4302  vertexId1 = p->production_vertex()->barcode();
4303  }
4304 
4305  out.setf(std::ios::fixed, std::ios::floatfield);
4306  out.setf(std::ios::right, std::ios::adjustfield);
4307 
4308  out << std::setw(4) << p->barcode() << " "
4309  << name;
4310 
4311  for(unsigned int k=0;k<11-name.length() && k<12; k++) out << " ";
4312 
4313  double eta = momentum1.eta();
4314  if ( eta > +10. ) eta = +10.;
4315  if ( eta < -10. ) eta = -10.;
4316 
4317  out << std::setw(6) << std::setprecision(2) << eta << " "
4318  << std::setw(6) << std::setprecision(2) << momentum1.phi() << " "
4319  << std::setw(7) << std::setprecision(2) << momentum1.pt() << " "
4320  << std::setw(7) << std::setprecision(2) << momentum1.e() << " "
4321  << std::setw(4) << vertexId1 << " "
4322  << std::setw(6) << std::setprecision(1) << vertex1.x() << " "
4323  << std::setw(6) << std::setprecision(1) << vertex1.y() << " "
4324  << std::setw(6) << std::setprecision(1) << vertex1.z() << " ";
4325 
4326 
4327  if( p->production_vertex() ) {
4328  if ( p->production_vertex()->particles_in_size() ) {
4329  const HepMC::GenParticle* mother =
4330  *(p->production_vertex()->particles_in_const_begin());
4331 
4332  out << std::setw(4) << mother->barcode() << " ";
4333  }
4334  else
4335  out << " " ;
4336  }
4337 
4338  if ( p->end_vertex() ) {
4339  math::XYZTLorentzVector vertex2(p->end_vertex()->position().x()/10.,
4340  p->end_vertex()->position().y()/10.,
4341  p->end_vertex()->position().z()/10.,
4342  p->end_vertex()->position().t()/10.);
4343  int vertexId2 = p->end_vertex()->barcode();
4344 
4345  std::vector<const HepMC::GenParticle*> children;
4346  HepMC::GenVertex::particles_out_const_iterator firstDaughterIt =
4347  p->end_vertex()->particles_out_const_begin();
4348  HepMC::GenVertex::particles_out_const_iterator lastDaughterIt =
4349  p->end_vertex()->particles_out_const_end();
4350  for ( ; firstDaughterIt != lastDaughterIt ; ++firstDaughterIt ) {
4351  children.push_back(*firstDaughterIt);
4352  }
4353 
4354  out << std::setw(4) << vertexId2 << " "
4355  << std::setw(6) << std::setprecision(2) << vertex2.eta() << " "
4356  << std::setw(6) << std::setprecision(2) << vertex2.phi() << " "
4357  << std::setw(5) << std::setprecision(1) << vertex2.pt() << " "
4358  << std::setw(6) << std::setprecision(1) << vertex2.z() << " ";
4359 
4360  for ( unsigned id=0; id<children.size(); ++id )
4361  out << std::setw(4) << children[id]->barcode() << " ";
4362  }
4363  out << std::endl;
4364  }
4365 }
4366 
4367 void PFRootEventManager::printRecHits(const reco::PFRecHitCollection& rechits, const PFClusterAlgo& clusterAlgo, ostream& out) const{
4368 
4369  for(unsigned i=0; i<rechits.size(); i++) {
4370  string seedstatus = " ";
4371  if(clusterAlgo.isSeed(i) )
4372  seedstatus = "SEED";
4373  printRecHit(rechits[i], i, seedstatus.c_str(), out);
4374  }
4375  return;
4376 }
4377 
4379  unsigned index,
4380  const char* seedstatus,
4381  ostream& out) const {
4382 
4383  if(!out) return;
4384  double eta = rh.position().Eta();
4385  double phi = rh.position().Phi();
4386  double energy = rh.energy();
4387 
4388  if(energy<printRecHitsEMin_) return;
4389 
4390  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4391  if( !cutg || cutg->IsInside( eta, phi ) )
4392  out<<index<<"\t"<<seedstatus<<" "<<rh<<endl;
4393 }
4394 
4396  ostream& out ) const {
4397  for(unsigned i=0; i<clusters.size(); i++) {
4398  printCluster(clusters[i], out);
4399  }
4400  return;
4401 }
4402 
4404  ostream& out ) const {
4405 
4406  if(!out) return;
4407 
4408  double eta = cluster.position().Eta();
4409  double phi = cluster.position().Phi();
4410  double energy = cluster.energy();
4411 
4412  if(energy<printClustersEMin_) return;
4413 
4414  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4415  if( !cutg || cutg->IsInside( eta, phi ) )
4416  out<<cluster<<endl;
4417 }
4418 
4420 
4421  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4422  if(!cutg) return true;
4423 
4424  const vector< reco::PFTrajectoryPoint >& points = track.trajectoryPoints();
4425 
4426  for( unsigned i=0; i<points.size(); i++) {
4427  if( ! points[i].isValid() ) continue;
4428 
4429  const math::XYZPoint& pos = points[i].position();
4430  if( cutg->IsInside( pos.Eta(), pos.Phi() ) ) return true;
4431  }
4432 
4433  // no point inside cut
4434  return false;
4435 }
4436 
4437 
4438 void
4441  const {
4442 
4443  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4444  if(!cutg) {
4445  mask.resize( rechits.size(), true);
4446  return;
4447  }
4448 
4449  mask.clear();
4450  mask.reserve( rechits.size() );
4451  for(unsigned i=0; i<rechits.size(); i++) {
4452 
4453  double eta = rechits[i].position().Eta();
4454  double phi = rechits[i].position().Phi();
4455 
4456  if( cutg->IsInside( eta, phi ) )
4457  mask.push_back( true );
4458  else
4459  mask.push_back( false );
4460  }
4461 }
4462 
4463 void
4465  const reco::PFClusterCollection& clusters)
4466  const {
4467 
4468  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4469  if(!cutg) return;
4470 
4471  mask.clear();
4472  mask.reserve( clusters.size() );
4473  for(unsigned i=0; i<clusters.size(); i++) {
4474 
4475  double eta = clusters[i].position().Eta();
4476  double phi = clusters[i].position().Phi();
4477 
4478  if( cutg->IsInside( eta, phi ) )
4479  mask.push_back( true );
4480  else
4481  mask.push_back( false );
4482  }
4483 }
4484 
4485 void
4488  const {
4489 
4490  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4491  if(!cutg) return;
4492 
4493  mask.clear();
4494  mask.reserve( tracks.size() );
4495  for(unsigned i=0; i<tracks.size(); i++) {
4496  if( trackInsideGCut( tracks[i] ) )
4497  mask.push_back( true );
4498  else
4499  mask.push_back( false );
4500  }
4501 }
4502 
4503 void
4506  const {
4507 
4508  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4509  if(!cutg) return;
4510 
4511  mask.clear();
4512  mask.reserve( photons.size() );
4513  for(unsigned i=0; i<photons.size(); i++) {
4514  double eta = photons[i].caloPosition().Eta();
4515  double phi = photons[i].caloPosition().Phi();
4516  if( cutg->IsInside( eta, phi ) )
4517  mask.push_back( true );
4518  else
4519  mask.push_back( false );
4520  }
4521 }
4522 
4523 
4524 void
4527  const {
4528 
4529  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4530  if(!cutg) return;
4531 
4532  mask.clear();
4533  mask.reserve( tracks.size() );
4534  for(unsigned i=0; i<tracks.size(); i++) {
4535  if( trackInsideGCut( tracks[i] ) )
4536  mask.push_back( true );
4537  else
4538  mask.push_back( false );
4539  }
4540 }
4541 
4542 
4543 const reco::PFSimParticle&
4545  double eta, double phi,
4546  double& peta, double& pphi, double& pe)
4547  const {
4548 
4549 
4550  if( trueParticles_.empty() ) {
4551  string err = "PFRootEventManager::closestParticle : ";
4552  err += "vector of PFSimParticles is empty";
4553  throw std::length_error( err.c_str() );
4554  }
4555 
4556  double mindist2 = 99999999;
4557  unsigned iClosest=0;
4558  for(unsigned i=0; i<trueParticles_.size(); i++) {
4559 
4560  const reco::PFSimParticle& ptc = trueParticles_[i];
4561 
4562  // protection for old version of the PFSimParticle
4563  // dataformats.
4564  if( layer >= reco::PFTrajectoryPoint::NLayers ||
4565  ptc.nTrajectoryMeasurements() + layer >=
4566  ptc.nTrajectoryPoints() ) {
4567  continue;
4568  }
4569 
4570  const reco::PFTrajectoryPoint& tp
4571  = ptc.extrapolatedPoint( layer );
4572 
4573  peta = tp.position().Eta();
4574  pphi = tp.position().Phi();
4575  pe = tp.momentum().E();
4576 
4577  double deta = peta - eta;
4578  double dphi = pphi - phi;
4579 
4580  double dist2 = deta*deta + dphi*dphi;
4581 
4582  if(dist2<mindist2) {
4583  mindist2 = dist2;
4584  iClosest = i;
4585  }
4586  }
4587 
4588  return trueParticles_[iClosest];
4589 }
4590 
4591 
4592 
4593 //-----------------------------------------------------------
4594 void
4596 
4597  cout<<"CMSSW Gen jets : size = " << genJetsCMSSW_.size() << endl;
4598  for ( unsigned i = 0; i < genJetsCMSSW_.size(); i++) {
4599  cout<<"Gen jet Et : " << genJetsCMSSW_[i].et() << endl;
4600  }
4601  cout<<"CMSSW PF jets : size = " << pfJetsCMSSW_.size() << endl;
4602  for ( unsigned i = 0; i < pfJetsCMSSW_.size(); i++) {
4603  cout<<"PF jet Et : " << pfJetsCMSSW_[i].et() << endl;
4604  }
4605  cout<<"CMSSW Calo jets : size = " << caloJetsCMSSW_.size() << endl;
4606  for ( unsigned i = 0; i < caloJetsCMSSW_.size(); i++) {
4607  cout<<"Calo jet Et : " << caloJetsCMSSW_[i].et() << endl;
4608  }
4609 }
4610 //________________________________________________________________
4612 {
4613  std::string name;
4614  switch(partId) {
4615  case 1: { name = "d";latexString="d"; break; }
4616  case 2: { name = "u";latexString="u";break; }
4617  case 3: { name = "s";latexString="s" ;break; }
4618  case 4: { name = "c";latexString="c" ; break; }
4619  case 5: { name = "b";latexString="b" ; break; }
4620  case 6: { name = "t";latexString="t" ; break; }
4621  case -1: { name = "~d";latexString="#bar{d}" ; break; }
4622  case -2: { name = "~u";latexString="#bar{u}" ; break; }
4623  case -3: { name = "~s";latexString="#bar{s}" ; break; }
4624  case -4: { name = "~c";latexString="#bar{c}" ; break; }
4625  case -5: { name = "~b";latexString="#bar{b}" ; break; }
4626  case -6: { name = "~t";latexString="#bar{t}" ; break; }
4627  case 11: { name = "e-";latexString=name ; break; }
4628  case -11: { name = "e+";latexString=name ; break; }
4629  case 12: { name = "nu_e";latexString="#nu_{e}" ; break; }
4630  case -12: { name = "~nu_e";latexString="#bar{#nu}_{e}" ; break; }
4631  case 13: { name = "mu-";latexString="#mu-" ; break; }
4632  case -13: { name = "mu+";latexString="#mu+" ; break; }
4633  case 14: { name = "nu_mu";latexString="#nu_{mu}" ; break; }
4634  case -14: { name = "~nu_mu";latexString="#bar{#nu}_{#mu}"; break; }
4635  case 15: { name = "tau-";latexString="#tau^{-}" ; break; }
4636  case -15: { name = "tau+";latexString="#tau^{+}" ; break; }
4637  case 16: { name = "nu_tau";latexString="#nu_{#tau}" ; break; }
4638  case -16: { name = "~nu_tau";latexString="#bar{#nu}_{#tau}"; break; }
4639  case 21: { name = "gluon";latexString= name; break; }
4640  case 22: { name = "gamma";latexString= "#gamma"; break; }
4641  case 23: { name = "Z0";latexString="Z^{0}" ; break; }
4642  case 24: { name = "W+";latexString="W^{+}" ; break; }
4643  case 25: { name = "H0";latexString=name ; break; }
4644  case -24: { name = "W-";latexString="W^{-}" ; break; }
4645  case 111: { name = "pi0";latexString="#pi^{0}" ; break; }
4646  case 113: { name = "rho0";latexString="#rho^{0}" ; break; }
4647  case 223: { name = "omega";latexString="#omega" ; break; }
4648  case 333: { name = "phi";latexString= "#phi"; break; }
4649  case 443: { name = "J/psi";latexString="J/#psi" ; break; }
4650  case 553: { name = "Upsilon";latexString="#Upsilon" ; break; }
4651  case 130: { name = "K0L";latexString=name ; break; }
4652  case 211: { name = "pi+";latexString="#pi^{+}" ; break; }
4653  case -211: { name = "pi-";latexString="#pi^{-}" ; break; }
4654  case 213: { name = "rho+";latexString="#rho^{+}" ; break; }
4655  case -213: { name = "rho-";latexString="#rho^{-}" ; break; }
4656  case 221: { name = "eta";latexString="#eta" ; break; }
4657  case 331: { name = "eta'";latexString="#eta'" ; break; }
4658  case 441: { name = "etac";latexString="#eta_{c}" ; break; }
4659  case 551: { name = "etab";latexString= "#eta_{b}"; break; }
4660  case 310: { name = "K0S";latexString=name ; break; }
4661  case 311: { name = "K0";latexString="K^{0}" ; break; }
4662  case -311: { name = "Kbar0";latexString="#bar{#Kappa}^{0}" ; break; }
4663  case 321: { name = "K+";latexString= "K^{+}"; break; }
4664  case -321: { name = "K-";latexString="K^{-}"; break; }
4665  case 411: { name = "D+";latexString="D^{+}" ; break; }
4666  case -411: { name = "D-";latexString="D^{-}"; break; }
4667  case 421: { name = "D0";latexString="D^{0}" ; break; }
4668  case -421: { name = "D0-bar";latexString="#overline{D^{0}}" ; break; }
4669  case 423: { name = "D*0";latexString="D^{*0}" ; break; }
4670  case -423: { name = "D*0-bar";latexString="#overline{D^{*0}}" ; break; }
4671  case 431: { name = "Ds_+";latexString="Ds_{+}" ; break; }
4672  case -431: { name = "Ds_-";latexString="Ds_{-}" ; break; }
4673  case 511: { name = "B0";latexString= name; break; }
4674  case 521: { name = "B+";latexString="B^{+}" ; break; }
4675  case -521: { name = "B-";latexString="B^{-}" ; break; }
4676  case 531: { name = "Bs_0";latexString="Bs_{0}" ; break; }
4677  case -531: { name = "anti-Bs_0";latexString="#overline{Bs_{0}}" ; break; }
4678  case 541: { name = "Bc_+";latexString="Bc_{+}" ; break; }
4679  case -541: { name = "Bc_+";latexString="Bc_{+}" ; break; }
4680  case 313: { name = "K*0";latexString="K^{*0}" ; break; }
4681  case -313: { name = "K*bar0";latexString="#bar{K}^{*0}" ; break; }
4682  case 323: { name = "K*+";latexString="#K^{*+}"; break; }
4683  case -323: { name = "K*-";latexString="#K^{*-}" ; break; }
4684  case 413: { name = "D*+";latexString= "D^{*+}"; break; }
4685  case -413: { name = "D*-";latexString= "D^{*-}" ; break; }
4686 
4687  case 433: { name = "Ds*+";latexString="D_{s}^{*+}" ; break; }
4688  case -433: { name = "Ds*-";latexString="B_{S}{*-}" ; break; }
4689 
4690  case 513: { name = "B*0";latexString="B^{*0}" ; break; }
4691  case -513: { name = "anti-B*0";latexString="#overline{B^{*0}}" ; break; }
4692  case 523: { name = "B*+";latexString="B^{*+}" ; break; }
4693  case -523: { name = "B*-";latexString="B^{*-}" ; break; }
4694 
4695  case 533: { name = "B*_s0";latexString="B^{*}_{s0}" ; break; }
4696  case -533 : {name="anti-B_s0"; latexString= "#overline{B_{s}^{0}}";break; }
4697 
4698  case 543: { name = "B*_c+";latexString= "B^{*}_{c+}"; break; }
4699  case -543: { name = "B*_c-";latexString= "B^{*}_{c-}"; break; }
4700  case 1114: { name = "Delta-";latexString="#Delta^{-}" ; break; }
4701  case -1114: { name = "Deltabar+";latexString="#bar{#Delta}^{+}" ; break; }
4702  case -2112: { name = "nbar0";latexString="{bar}n^{0}" ; break; }
4703  case 2112: { name = "n"; latexString=name ;break;}
4704  case 2114: { name = "Delta0"; latexString="#Delta^{0}" ;break; }
4705  case -2114: { name = "Deltabar0"; latexString="#bar{#Delta}^{0}" ;break; }
4706  case 3122: { name = "Lambda0";latexString= "#Lambda^{0}"; break; }
4707  case -3122: { name = "Lambdabar0";latexString="#bar{#Lambda}^{0}" ; break; }
4708  case 3112: { name = "Sigma-"; latexString="#Sigma" ;break; }
4709  case -3112: { name = "Sigmabar+"; latexString="#bar{#Sigma}^{+}" ;break; }
4710  case 3114: { name = "Sigma*-"; latexString="#Sigma^{*}" ;break; }
4711  case -3114: { name = "Sigmabar*+"; latexString="#bar{#Sigma}^{*+}" ;break; }
4712 
4713 
4714  case 3212: { name = "Sigma0";latexString="#Sigma^{0}" ; break; }
4715  case -3212: { name = "Sigmabar0";latexString="#bar{#Sigma}^{0}" ; break; }
4716  case 3214: { name = "Sigma*0"; latexString="#Sigma^{*0}" ;break; }
4717  case -3214: { name = "Sigma*bar0";latexString="#bar{#Sigma}^{*0}" ; break; }
4718  case 3222: { name = "Sigma+"; latexString="#Sigma^{+}" ;break; }
4719  case -3222: { name = "Sigmabar-"; latexString="#bar{#Sigma}^{-}";break; }
4720  case 3224: { name = "Sigma*+"; latexString="#Sigma^{*+}" ;break; }
4721  case -3224: { name = "Sigmabar*-"; latexString="#bar{#Sigma}^{*-}";break; }
4722 
4723  case 2212: { name = "p";latexString=name ; break; }
4724  case -2212: { name = "~p";latexString="#bar{p}" ; break; }
4725  case -2214: { name = "Delta-";latexString="#Delta^{-}" ; break; }
4726  case 2214: { name = "Delta+";latexString="#Delta^{+}" ; break; }
4727  case -2224: { name = "Deltabar--"; latexString="#bar{#Delta}^{--}" ;break; }
4728  case 2224: { name = "Delta++"; latexString= "#Delta^{++}";break; }
4729 
4730  case 3312: { name = "Xi-"; latexString= "#Xi^{-}";break; }
4731  case -3312: { name = "Xi+"; latexString= "#Xi^{+}";break; }
4732  case 3314: { name = "Xi*-"; latexString= "#Xi^{*-}";break; }
4733  case -3314: { name = "Xi*+"; latexString= "#Xi^{*+}";break; }
4734 
4735  case 3322: { name = "Xi0"; latexString= "#Xi^{0}";break; }
4736  case -3322: { name = "anti-Xi0"; latexString= "#overline{Xi^{0}}";break; }
4737  case 3324: { name = "Xi*0"; latexString= "#Xi^{*0}";break; }
4738  case -3324: { name = "anti-Xi*0"; latexString= "#overline{Xi^{*0}}";break; }
4739 
4740  case 3334: { name = "Omega-"; latexString= "#Omega^{-}";break; }
4741  case -3334: { name = "anti-Omega+"; latexString= "#Omega^{+}";break; }
4742 
4743  case 4122: { name = "Lambda_c+"; latexString= "#Lambda_{c}^{+}";break; }
4744  case -4122: { name = "Lambda_c-"; latexString= "#Lambda_{c}^{-}";break; }
4745  case 4222: { name = "Sigma_c++"; latexString= "#Sigma_{c}^{++}";break; }
4746  case -4222: { name = "Sigma_c--"; latexString= "#Sigma_{c}^{--}";break; }
4747 
4748 
4749  case 92 : {name="String"; latexString= "String";break; }
4750 
4751  case 2101 : {name="ud_0"; latexString= "ud_{0}";break; }
4752  case -2101 : {name="anti-ud_0"; latexString= "#overline{ud}_{0}";break; }
4753  case 2103 : {name="ud_1"; latexString= "ud_{1}";break; }
4754  case -2103 : {name="anti-ud_1"; latexString= "#overline{ud}_{1}";break; }
4755  case 2203 : {name="uu_1"; latexString= "uu_{1}";break; }
4756  case -2203 : {name="anti-uu_1"; latexString= "#overline{uu}_{1}";break; }
4757  case 3303 : {name="ss_1"; latexString= "#overline{ss}_{1}";break; }
4758  case 3101 : {name="sd_0"; latexString= "sd_{0}";break; }
4759  case -3101 : {name="anti-sd_0"; latexString= "#overline{sd}_{0}";break; }
4760  case 3103 : {name="sd_1"; latexString= "sd_{1}";break; }
4761  case -3103 : {name="anti-sd_1"; latexString= "#overline{sd}_{1}";break; }
4762 
4763  case 20213 : {name="a_1+"; latexString= "a_{1}^{+}";break; }
4764  case -20213 : {name="a_1-"; latexString= "a_{1}^{-}";break; }
4765 
4766  default:
4767  {
4768  name = "unknown";
4769  cout << "Unknown code : " << partId << endl;
4770  break;
4771  }
4772 
4773 
4774  }
4775  return name;
4776 
4777 }
4778 
4779 //_____________________________________________________________________________
4781  const reco::PFCandidateCollection& candidates,
4782  std::vector< std::list <simMatch> >& candSimMatchTrack,
4783  std::vector< std::list <simMatch> >& candSimMatchEcal) const
4784 {
4785 
4786  if(!out) return;
4787  out << endl;
4788  out << "Running Monte Carlo Truth Matching Tool" << endl;
4789  out << endl;
4790 
4791  //resize matching vectors
4792  candSimMatchTrack.resize(candidates.size());
4793  candSimMatchEcal.resize(candidates.size());
4794 
4795  for(unsigned i=0; i<candidates.size(); i++) {
4796  const reco::PFCandidate& pfCand = candidates[i];
4797 
4798  //Matching with ECAL clusters
4799  if (verbosity_ == VERBOSE ) {
4800  out <<i<<" " <<(*pfCandidates_)[i]<<endl;
4801  out << "is matching:" << endl;
4802  }
4803 
4804  PFCandidate::ElementsInBlocks eleInBlocks
4805  = pfCand.elementsInBlocks();
4806 
4807  for(unsigned iel=0; iel<eleInBlocks.size(); ++iel) {
4808  PFBlockRef blockRef = eleInBlocks[iel].first;
4809  unsigned indexInBlock = eleInBlocks[iel].second;
4810 
4811  //Retrieving elements of the block
4812  const reco::PFBlock& blockh
4813  = *blockRef;
4815  elements_h = blockh.elements();
4816 
4818  = elements_h[ indexInBlock ].type();
4819 // cout <<"(" << blockRef.key() << "|" <<indexInBlock <<"|"
4820 // << elements_h[ indexInBlock ].type() << ")," << endl;
4821 
4822  //TRACK=================================
4823  if(type == reco::PFBlockElement::TRACK){
4824  const reco::PFRecTrackRef trackref
4825  = elements_h[ indexInBlock ].trackRefPF();
4826  assert( !trackref.isNull() );
4827  const reco::PFRecTrack& track = *trackref;
4828  const reco::TrackRef trkREF = track.trackRef();
4829  unsigned rtrkID = track.trackId();
4830 
4831  //looking for the matching charged simulated particle:
4832  for ( unsigned isim=0; isim < trueParticles_.size(); isim++) {
4833  const reco::PFSimParticle& ptc = trueParticles_[isim];
4834  unsigned trackIDM = ptc.rectrackId();
4835  if(trackIDM != 99999
4836  && trackIDM == rtrkID){
4837 
4838  if (verbosity_ == VERBOSE )
4839  out << "\tSimParticle " << isim
4840  << " through Track matching pTrectrack="
4841  << trkREF->pt() << " GeV" << endl;
4842 
4843  //store info
4844  std::pair<double, unsigned> simtrackmatch
4845  = make_pair(trkREF->pt(),trackIDM);
4846  candSimMatchTrack[i].push_back(simtrackmatch);
4847  }//match
4848  }//loop simparticles
4849 
4850  }//TRACK
4851 
4852  //ECAL=================================
4853  if(type == reco::PFBlockElement::ECAL)
4854  {
4855  const reco::PFClusterRef clusterref
4856  = elements_h[ indexInBlock ].clusterRef();
4857  assert( !clusterref.isNull() );
4858  const reco::PFCluster& cluster = *clusterref;
4859 
4860  const std::vector< reco::PFRecHitFraction >&
4861  fracs = cluster.recHitFractions();
4862 
4863 // cout << "This is an ecal cluster of energy "
4864 // << cluster.energy() << endl;
4865  vector<unsigned> simpID;
4866  vector<double> simpEC(trueParticles_.size(),0.0);
4867  vector<unsigned> simpCN(trueParticles_.size(),0);
4868  for(unsigned int rhit = 0; rhit < fracs.size(); ++rhit){
4869 
4870  const reco::PFRecHitRef& rh = fracs[rhit].recHitRef();
4871  if(rh.isNull()) continue;
4872  const reco::PFRecHit& rechit_cluster = *rh;
4873 // cout << rhit << " ID=" << rechit_cluster.detId()
4874 // << " E=" << rechit_cluster.energy()
4875 // << " fraction=" << fracs[rhit].fraction() << " ";
4876 
4877  //loop on sim particules
4878 // cout << "coming from sim particles: ";
4879  for ( unsigned isim=0; isim < trueParticles_.size(); isim++) {
4880  const reco::PFSimParticle& ptc = trueParticles_[isim];
4881 
4882  vector<unsigned> rechitSimIDs
4883  = ptc.recHitContrib();
4884  vector<double> rechitSimFrac
4885  = ptc.recHitContribFrac();
4886  //cout << "Number of rechits contrib =" << rechitSimIDs.size() << endl;
4887  if( !rechitSimIDs.size() ) continue; //no rechit
4888 
4889  for ( unsigned isimrh=0; isimrh < rechitSimIDs.size(); isimrh++) {
4890  if( rechitSimIDs[isimrh] == rechit_cluster.detId() ){
4891 
4892  bool takenalready = false;
4893  for(unsigned iss = 0; iss < simpID.size(); ++iss)
4894  if(simpID[iss] == isim) takenalready = true;
4895  if(!takenalready) simpID.push_back(isim);
4896 
4897  simpEC[isim] +=
4898  ((rechit_cluster.energy()*rechitSimFrac[isimrh])/100.0)
4899  *fracs[rhit].fraction();
4900 
4901  simpCN[isim]++; //counting rechits
4902 
4903 // cout << isim << " with contribution of ="
4904 // << rechitSimFrac[isimrh] << "%, ";
4905  }//match rechit
4906  }//loop sim rechit
4907  }//loop sim particules
4908 // cout << endl;
4909  }//loop cand rechit
4910 
4911  for(unsigned is=0; is < simpID.size(); ++is)
4912  {
4913  double frac_of_cluster
4914  = (simpEC[simpID[is]]/cluster.energy())*100.0;
4915 
4916  //store info
4917  std::pair<double, unsigned> simecalmatch
4918  = make_pair(simpEC[simpID[is]],simpID[is]);
4919  candSimMatchEcal[i].push_back(simecalmatch);
4920 
4921  if (verbosity_ == VERBOSE ) {
4922  out << "\tSimParticle " << simpID[is]
4923  << " through ECAL matching Epfcluster="
4924  << cluster.energy()
4925  << " GeV with N=" << simpCN[simpID[is]]
4926  << " rechits in common "
4927  << endl;
4928  out << "\t\tsimparticle contributing to a total of "
4929  << simpEC[simpID[is]]
4930  << " GeV of this cluster ("
4931  << frac_of_cluster << "%) "
4932  << endl;
4933  }
4934  }//loop particle matched
4935  }//ECAL clusters
4936 
4937  }//loop elements
4938 
4939  if (verbosity_ == VERBOSE )
4940  cout << "==============================================================="
4941  << endl;
4942 
4943  }//loop pfCandidates_
4944 
4945  if (verbosity_ == VERBOSE ){
4946 
4947  cout << "=================================================================="
4948  << endl;
4949  cout << "SimParticles" << endl;
4950 
4951  //loop simulated particles
4952  for ( unsigned i=0; i < trueParticles_.size(); i++) {
4953  cout << "==== Particle Simulated " << i << endl;
4954  const reco::PFSimParticle& ptc = trueParticles_[i];
4955  out <<i<<" "<<trueParticles_[i]<<endl;
4956 
4957  if(!ptc.daughterIds().empty()){
4958  cout << "Look at the desintegration products" << endl;
4959  cout << endl;
4960  continue;
4961  }
4962 
4963  //TRACKING
4964  if(ptc.rectrackId() != 99999){
4965  cout << "matching pfCandidate (trough tracking): " << endl;
4966  for( unsigned icand=0; icand<candidates.size(); icand++ )
4967  {
4968  ITM it = candSimMatchTrack[icand].begin();
4969  ITM itend = candSimMatchTrack[icand].end();
4970  for(;it!=itend;++it)
4971  if( i == it->second ){
4972  out<<icand<<" "<<(*pfCandidates_)[icand]<<endl;
4973  cout << endl;
4974  }
4975  }//loop candidate
4976  }//trackmatch
4977 
4978 
4979  //CALORIMETRY
4980  vector<unsigned> rechitSimIDs
4981  = ptc.recHitContrib();
4982  vector<double> rechitSimFrac
4983  = ptc.recHitContribFrac();
4984  //cout << "Number of rechits contrib =" << rechitSimIDs.size() << endl;
4985  if( !rechitSimIDs.size() ) continue; //no rechit
4986 
4987  cout << "matching pfCandidate (through ECAL): " << endl;
4988 
4989  //look at total ECAL desposition:
4990  double totalEcalE = 0.0;
4991  for(unsigned irh=0; irh<rechitsECAL_.size();++irh)
4992  for ( unsigned isimrh=0; isimrh < rechitSimIDs.size();
4993  isimrh++ )
4994  if(rechitSimIDs[isimrh] == rechitsECAL_[irh].detId())
4995  totalEcalE += (rechitsECAL_[irh].energy()*rechitSimFrac[isimrh]/100.0);
4996  cout << "For info, this particle deposits E=" << totalEcalE
4997  << "(GeV) in the ECAL" << endl;
4998 
4999  for( unsigned icand=0; icand<candidates.size(); icand++ )
5000  {
5001  ITM it = candSimMatchEcal[icand].begin();
5002  ITM itend = candSimMatchEcal[icand].end();
5003  for(;it!=itend;++it)
5004  if( i == it->second )
5005  out<<icand<<" "<<it->first<<"GeV "<<(*pfCandidates_)[icand]<<endl;
5006  }//loop candidate
5007  cout << endl;
5008  }//loop particles
5009  }//verbose
5010 
5011 }//mctruthmatching
5012 //_____________________________________________________________________________
5013 
5015 PFRootEventManager::stringToTag(const std::vector< std::string >& tagname) {
5016 
5017  if ( tagname.size() == 1 )
5018  return edm::InputTag(tagname[0]);
5019 
5020  else if ( tagname.size() == 2 )
5021  return edm::InputTag(tagname[0], tagname[1]);
5022 
5023  else if ( tagname.size() == 3 )
5024  return tagname[2] == '*' ?
5025  edm::InputTag(tagname[0], tagname[1]) :
5026  edm::InputTag(tagname[0], tagname[1], tagname[2]);
5027  else {
5028  cout << "Invalid tag name with " << tagname.size() << " strings "<< endl;
5029  return edm::InputTag();
5030  }
5031 
5032 }
void setmEInputCut(double amEInputCut)
Minimum E for jet constituents.
RunNumber_t run() const
Definition: EventID.h:42
edm::InputTag displacedRecTracksTag_
CaloTowerCollection caloTowers_
std::auto_ptr< reco::PFBlockCollection > pfBlocks_
reconstructed pfblocks
bool useAtHLT_
Use HLT tracking.
const std::vector< int > & daughterIds() const
Definition: PFSimParticle.h:44
bool doMet_
MET on/off.
void setThreshCleanBarrel(double thresh)
set barrel clean threshold
edm::InputTag MCTruthTag_
std::auto_ptr< reco::PFCandidateCollection > transferCandidates()
Definition: PFAlgo.h:229
void fillClusterMask(std::vector< bool > &mask, const reco::PFClusterCollection &clusters) const
cluster mask set to true for rechits inside TCutG
type
Definition: HCALResponse.h:21
edm::Handle< reco::CaloMETCollection > caloMetsHandle_
CMSSW Calo MET.
virtual double energy() const GCC11_FINAL
energy
EventNumber_t event() const
Definition: EventID.h:44
void fillTrackMask(std::vector< bool > &mask, const reco::PFRecTrackCollection &tracks) const
track mask set to true for rechits inside TCutG
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:124
void reconstructGenJets()
reconstruct gen jets
void add4Neighbour(unsigned index)
Definition: PFRecHit.cc:176
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:22
std::string getGenParticleName(int partId, std::string &latexStringName) const
get name of genParticle
void setOverlapThreshold(double aOverlapThreshold)
????
int i
Definition: DBlmapReader.cc:9
edm::Handle< reco::GenParticleRefVector > genParticlesforJetsHandle_
input collection of gen particles
void reset()
reset before next event
void setThreshDoubleSpikeEndcap(double thresh)
set endcap thresholds for double spike cleaning
void reconstructPFJets()
reconstruct pf jets
void setParameters(Benchmark::Mode mode, float ptmin, float ptmax, float etamin, float etamax, float phimin, float phimax, bool metSpHistos)
set the parameters locally
Definition: PFMETMonitor.cc:67
dictionary specific
PFClusterAlgo clusterAlgoHFEM_
clustering algorithm for HF, electro-magnetic layer
void setDirectory(TDirectory *dir)
set directory (to use in ROOT)
PFMETMonitor pfMETMonitor_
void SetConeMerge(double coneMerge)
void printCluster(const reco::PFCluster &cluster, std::ostream &out=std::cout) const
bool tauBenchmarkDebug_
tau benchmark debug
bool printPFJets_
print PFJets yes/no
ParticleType
particle types
Definition: PFCandidate.h:43
edm::Handle< reco::PFRecHitCollection > rechitsHFEMHandle_
rechits HF EM
PFClusterAlgo clusterAlgoHO_
clustering algorithm for HO
boost::shared_ptr< PFEnergyCalibration > calibration_
edm::Handle< reco::PFJetCollection > pfJetsHandle_
CMSSW PF Jets.
void setShowerSigma(double sigma)
set shower sigma for
void add8Neighbour(unsigned index)
Definition: PFRecHit.cc:181
JetReco::InputCollection Constituents
Definition: ProtoJet.h:28
bool printPFBlocks_
print PFBlocks yes/no
PFJetBenchmark PFJetBenchmark_
PFJet Benchmark.
General option file parser.
Definition: IO.h:28
void setPFMuonAndFakeParameters(const edm::ParameterSet &pset)
Definition: PFAlgo.cc:301
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
reco::PFMETCollection pfMetsCMSSW_
bool onlyTwoJets
bool useConvBremPFRecTracks_
Use Conv Brem KF Tracks.
edm::InputTag caloJetsTag_
void fillOutEventWithPFCandidates(const reco::PFCandidateCollection &pfCandidates)
fills OutEvent with candidates
void setPosCalcP1(double p1)
set p1 for position calculation
virtual double p() const GCC11_FINAL
magnitude of momentum vector
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:43
void doClustering(const reco::PFRecHitCollection &rechits)
perform clustering
bool debug_
debug printouts for this PFRootEventManager on/off
edm::Handle< reco::PFCandidateCollection > pfCandidateHandle_
CMSSW PF candidates.
Long64_t size() const
Definition: ChainEvent.cc:311
void setDirectory(TDirectory *dir)
set directory (to use in ROOT)
boost::shared_ptr< PFEnergyCalibrationHF > thepfEnergyCalibrationHF_
static void setDepthCorParameters(int mode, double a, double b, double ap, double bp)
Definition: PFCluster.h:101
void setPosCalcNCrystal(int n)
set number of crystals for position calculation (-1 all,5, or 9)
reco::GenParticleRefVector genParticlesforJets_
double deltaRMax
void setThreshSeedBarrel(double thresh)
set barrel seed threshold
Definition: PFClusterAlgo.h:98
void setHOTag(bool ho)
Definition: PFBlockAlgo.h:205
unsigned detId() const
rechit detId
Definition: PFRecHit.h:105
edm::InputTag convBremGsfrecTracksTag_
void makeIterativeConeJets(const JetReco::InputCollection &fInput, JetReco::OutputCollection *fOutput)
Produce jet collection using CMS Iterative Cone Algorithm.
void setCandConnectorParameters(const edm::ParameterSet &iCfgCandConnector)
Definition: PFAlgo.h:73
int chargeValue(const int &pdgId) const
virtual int pdgId() const GCC11_FINAL
PDG identifier.
edm::Handle< reco::PFRecHitCollection > rechitsHCALHandle_
rechits HCAL
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:138
edm::Handle< reco::PFMETCollection > pfMetsHandle_
CMSSW PF MET.
void reconstructParticles(const reco::PFBlockHandle &blockHandle)
Definition: PFAlgo.cc:414
tuple lumi
Definition: fjr2json.py:35
const math::XYZPoint & position() const
cartesian position (x, y, z)
void setS6S2DoubleSpikeEndcap(double cut)
fwlite::ChainEvent * ev_
NEW: input event.
std::vector< InputItem > InputCollection
Definition: JetRecoTypes.h:61
IO * options_
options file parser
reco::PFJetCollection pfJetsCMSSW_
std::auto_ptr< reco::PFClusterCollection > clustersECAL_
void PreprocessRecHits(reco::PFRecHitCollection &rechits, bool findNeighbours)
preprocess a rechit vector from a given rechit branch
std::auto_ptr< reco::PFCandidateElectronExtraCollection > transferElectronExtra()
Definition: PFAlgo.h:207
bool usePFV0s_
Use of V0 in PFAlgo.
bool isSeed(unsigned rhi) const
void fill(const T &jetCollection, const C &matchedJetCollection, float &minVal, float &maxVal)
fill histograms with all particle
Definition: PFJetMonitor.h:81
reco::MuonCollection muons_
void setmEtInputCut(double amEtInputCut)
Minimum ET for jet constituents.
void setSeedThreshold(double aSeedThreshold)
Set seed to start jet reconstruction.
edm::InputTag stdTracksTag_
const Constituents & getTowerList()
Definition: ProtoJet.cc:82
void setMaxIterations(int amaxIteration)
????
std::vector< std::string > inFileNames_
input file names
PFRootEventManager()
default constructor
#define X(str)
Definition: MuonsGrabber.cc:48
reco::PFRecTrackCollection displacedRecTracks_
General CMS geometry parameters used during Particle Flow reconstruction or drawing. All methods and members are static.
Definition: PFGeometry.h:23
reco::GenJetCollection genJets_
gen Jets
edm::InputTag egammaElectronsTag_
reco::PFRecHitCollection rechitsHFHAD_
edm::InputTag photonTag_
TFile * getTFile() const
Definition: ChainEvent.h:90
edm::InputTag primaryVerticesTag_
unsigned rectrackId() const
Definition: PFSimParticle.h:47
std::vector< PFSimParticle > PFSimParticleCollection
collection of PFSimParticle objects
const edm::OwnVector< reco::PFBlockElement > & elements() const
Definition: PFBlock.h:107
edm::InputTag rechitsHFEMTag_
void addJetMC(const Jet &jets)
Definition: EventColin.h:100
edm::InputTag rechitsECALTag_
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
int pdgCode() const
Definition: PFSimParticle.h:35
reco::CandidatePtrVector caloTowersPtrs_
bool usePFNuclearInteractions_
Use of PFDisplacedVertex in PFAlgo.
Transient Jet class used by the reconstruction algorithms.
Definition: ProtoJet.h:25
bool isHadronicTau() const
study the sim event to check if the tau decay is hadronic
void checkCleaning(const reco::PFRecHitCollection &cleanedHF)
Check HF Cleaning.
Definition: PFAlgo.cc:3606
std::auto_ptr< reco::PFClusterCollection > clustersHCAL_
reco::PhotonCollection photons_
bool usePFElectrons_
Use PFElectrons.
Base class for particle flow input reconstructed tracks and simulated particles.
Definition: PFTrack.h:63
const std::vector< PFJetAlgorithm::Jet > & FindJets(const std::vector< TLorentzVector > *vecs)
std::vector< ProtoJet > caloJets_
calo Jets
int iEvent_
current event
void setDisplacedVerticesParameters(bool rejectTracks_Bad, bool rejectTracks_Step45, bool usePFNuclearInteractions, bool usePFConversions, bool usePFDecays, double dptRel_DispVtx)
Definition: PFAlgo.cc:353
void fillOutEventWithCaloTowers(const CaloTowerCollection &cts)
fills outEvent with calo towers
void setThreshBarrel(double thresh)
setters -------------------------------------------------——
Definition: PFClusterAlgo.h:94
PFClusterAlgo clusterAlgoECAL_
T eta() const
reco::PFRecTrackCollection recTracks_
edm::Handle< reco::GsfPFRecTrackCollection > gsfrecTracksHandle_
reconstructed GSF tracks
int ii
Definition: cuy.py:588
void write()
write to the TFile, in plain ROOT mode. No need to call this function in DQM mode ...
Definition: Benchmark.cc:141
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
void setConeRadius(double aConeRadius)
Set radius of the cone.
void setUseCornerCells(bool usecornercells)
activate use of cells with a common corner to build topo-clusters
bool highPtJet(double ptMin) const
returns true if there is at least one jet with pT&gt;pTmin
string outjetfilename
void setPFEleParameters(double mvaEleCut, std::string mvaWeightFileEleID, bool usePFElectrons, const boost::shared_ptr< PFSCEnergyCalibration > &thePFSCEnergyCalibration, const boost::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, double sumEtEcalIsoForEgammaSC_barrel, double sumEtEcalIsoForEgammaSC_endcap, double coneEcalIsoForEgammaSC, double sumPtTrackIsoForEgammaSC_barrel, double sumPtTrackIsoForEgammaSC_endcap, unsigned int nTrackIsoForEgammaSC, double coneTrackIsoForEgammaSC, bool applyCrackCorrections=false, bool usePFSCEleCalib=true, bool useEGElectrons=false, bool useEGammaSupercluster=true)
Definition: PFAlgo.cc:98
void setPFVertexParameters(bool useVertex, const reco::VertexCollection *primaryVertices)
Definition: PFAlgo.cc:371
void setEGElectronCollection(const reco::GsfElectronCollection &egelectrons)
Definition: PFAlgo.cc:3494
bool doJets_
jets on/off
double charge(const std::vector< uint8_t > &Ampls)
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
reco::PFRecHitCollection rechitsPS_
Jets made from PFObjects.
Definition: PFJet.h:21
void applyCuts(const reco::CandidatePtrVector &Candidates, JetReco::InputCollection *input)
void particleFlow()
performs particle flow
std::vector< ElementInBlock > ElementsInBlocks
Definition: PFCandidate.h:368
edm::Handle< reco::PhotonCollection > photonHandle_
photons
void setNumber(int number)
Definition: EventColin.h:81
void setPFPhotonParameters(bool usePFPhoton, std::string mvaWeightFileConvID, double mvaConvCut, bool useReg, std::string X0_Map, const boost::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, double sumPtTrackIsoForPhoton, double sumPtTrackIsoSlopeForPhoton)
Definition: PFAlgo.cc:160
double tauBenchmark(const reco::PFCandidateCollection &candidates)
COLIN need to get rid of this mess.
edm::InputTag pfMetsTag_
edm::Handle< std::vector< reco::CaloJet > > caloJetsHandle_
CMSSW calo Jets.
static std::string const input
Definition: EdmProvDump.cc:44
bool GetOpt(const char *tag, const char *key, std::vector< T > &values) const
reads a vector of T
Definition: IO.h:106
bool doPFMETBenchmark_
PFMET benchmark on/off.
reco::PFRecHitCollection rechitsHCAL_
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
void reconstructFWLiteJets(const reco::CandidatePtrVector &Candidates, std::vector< ProtoJet > &output)
used by the reconstruct*Jets functions
edm::InputTag gsfrecTracksTag_
edm::Handle< reco::PFRecHitCollection > rechitsECALHandle_
rechits ECAL
void setThreshPtSeedBarrel(double thresh)
Definition: PFClusterAlgo.h:99
edm::Handle< reco::PFRecHitCollection > rechitsHFHADHandle_
rechits HF HAD
std::vector< edm::Handle< reco::PFRecHitCollection > > rechitsCLEANEDHandles_
reco::PFSimParticleCollection trueParticles_
PFJetAlgorithm jetAlgo_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
edm::Handle< reco::PFSimParticleCollection > trueParticlesHandle_
true particles
double pt() const
Definition: ProtoJet.h:75
void addCandidate(const Particle &ptc)
Definition: EventColin.h:88
bool readFromSimulation(int entry)
read data from simulation tree
void setThreshSeedEndcap(double thresh)
set endcap seed threshold
edm::InputTag stringToTag(const std::vector< std::string > &tagname)
returns an InputTag from a vector of strings
void print(std::ostream &out=std::cout, int maxNLines=-1) const
print information
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
void readOptions(const char *file, bool refresh=true, bool reconnect=false)
edm::Handle< reco::TrackCollection > stdTracksHandle_
standard reconstructed tracks
std::vector< int > filterTaus_
edm::InputTag rechitsPSTag_
int iEvent
Definition: GenABIO.cc:243
void setup(std::string Filename, bool debug, bool plotAgainstReco=0, bool onlyTwoJets=1, double deltaRMax=0.1, std::string benchmarkLabel_="ParticleFlow", double recPt=-1, double maxEta=-1, DQMStore *dbe_store=NULL)
void clearNeighbours()
Definition: PFRecHit.h:82
bool isNull() const
Checks for null.
Definition: Ref.h:247
bool isNeutrino(const Candidate &part)
Definition: pdgIdUtils.h:25
edm::Handle< reco::GenJetCollection > genJetsHandle_
CMSSW gen Jets.
void fillPhotonMask(std::vector< bool > &mask, const reco::PhotonCollection &photons) const
photon mask set to true for photons inside TCutG
bool jetsDebug_
debug printouts for jet algo on/off
bool printClusters_
print clusters yes/no
reco::VertexCollection primaryVertices_
void setDebug(bool debug)
Definition: PFAlgo.h:66
edm::InputTag genParticlesforMETTag_
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
reco::CandidatePtrVector pfCandidatesPtrs_
double emEnergy() const
Definition: CaloTower.h:77
TTree * outTree_
output tree
void fillOutEventWithClusters(const reco::PFClusterCollection &clusters)
fills OutEvent with clusters
void setParameters(double nSigmaECAL, double nSigmaHCAL, const boost::shared_ptr< PFEnergyCalibration > &calibration, const boost::shared_ptr< PFEnergyCalibrationHF > &thepfEnergyCalibrationHF)
Definition: PFAlgo.cc:78
std::auto_ptr< reco::PFClusterCollection > clustersPS_
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
virtual int status() const GCC11_FINAL
status word
void printRecHits(const reco::PFRecHitCollection &rechits, const PFClusterAlgo &clusterAlgo, std::ostream &out=std::cout) const
print rechits
Definition: MET.h:32
edm::InputTag rechitsHOTag_
reco::GenJetCollection genJetsCMSSW_
T sqrt(T t)
Definition: SSEVec.h:48
void makeMidpointJets(const JetReco::InputCollection &fInput, JetReco::OutputCollection *fOutput)
Produce jet collection using CMS Midpoint Jet Algorithm.
TFile * outFile_
output file
void setup()
book histograms
void mcTruthMatching(std::ostream &out, const reco::PFCandidateCollection &candidates, std::vector< std::list< simMatch > > &candSimMatchTrack, std::vector< std::list< simMatch > > &candSimMatchEcal) const
void setDebug(bool debug)
sets debug printout flag
Definition: PFBlockAlgo.h:186
PFJetMonitor pfJetMonitor_
std::ofstream * calibFile_
void setParameters(float dRMax, bool matchCharge, Benchmark::Mode mode, float ptmin, float ptmax, float etamin, float etamax, float phimin, float phimax, bool fracHistoFlag=true)
set the parameters locally
Definition: PFJetMonitor.cc:64
void setNNeighbours(int n)
set number of neighbours for
TH1F * h_deltaETvisible_MCPF_
output histo dET ( PF - MC)
edm::InputTag pfNuclearTrackerVertexTag_
void setParameters(float dRMax=0.3, bool matchCharge=true, Benchmark::Mode mode=Benchmark::DEFAULT)
set the benchmark parameters
edm::InputTag corrcaloJetsTag_
bool doParticleFlow_
particle flow on/off
void setPFPhotonRegWeights(const GBRForest *LCorrForestEB, const GBRForest *LCorrForestEE, const GBRForest *GCorrForestBarrel, const GBRForest *GCorrForestEndcapHr9, const GBRForest *GCorrForestEndcapLr9, const GBRForest *PFEcalResolution)
Definition: PFAlgo.cc:288
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::InputTag genParticlesforJetsTag_
edm::InputTag caloTowersTag_
PFClusterAlgo clusterAlgoHCAL_
clustering algorithm for HCAL
int j
Definition: DBlmapReader.cc:9
float jetArea() const
Jet area as calculated by algorithm.
Definition: ProtoJet.cc:76
Jets made from MC generator particles.
Definition: GenJet.h:24
double resPtMax() const
PFCandidateManager pfCandidateManager_
edm::InputTag recTracksTag_
std::auto_ptr< reco::PFCandidateElectronExtraCollection > pfCandidateElectronExtras_
PFCandidateElectronExtra.
void addCluster(const Cluster &ptc)
Definition: EventColin.h:92
bool printPFCandidates_
print PFCandidates yes/no
void printClusters(const reco::PFClusterCollection &clusters, std::ostream &out=std::cout) const
print clusters
std::list< std::pair< double, unsigned > >::iterator ITM
void setS4S1CleanBarrel(const std::vector< double > &coeffs)
reco::PFCandidateCollection pfCandCMSSW_
#define end
Definition: vmac.h:37
const reco::PFTrajectoryPoint & extrapolatedPoint(unsigned layerid) const
Definition: PFTrack.cc:76
reco::GsfPFRecTrackCollection gsfrecTracks_
bool useKDTreeTrackEcalLinker_
ECAL-track link optimization.
edm::InputTag genJetsTag_
void SetConeAngle(double coneAngle)
void setThreshPtSeedEndcap(double thresh)
double resNeutralEmEnergyMax() const
double resNeutralHadEnergyMax() const
void SetSeedEt(double et)
bool usePFConversions_
Use of conversions in PFAlgo.
std::auto_ptr< reco::PFClusterCollection > clustersHO_
bool findRecHitNeighbours_
find rechit neighbours ?
reco::CandidatePtrVector genParticlesforJetsPtrs_
std::vector< double > recHitContribFrac() const
Definition: PFSimParticle.h:51
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void setPostHFCleaningParameters(bool postHFCleaning, double minHFCleaningPt, double minSignificance, double maxSignificance, double minSignificanceReduction, double maxDeltaPhiPt, double minDeltaMet)
Definition: PFAlgo.cc:336
std::vector< PFBlock > PFBlockCollection
collection of PFBlock objects
Definition: PFBlockFwd.h:11
TH1F * h_deltaETvisible_MCEHT_
output histo dET ( EHT - MC)
void setThreshPtEndcap(double thresh)
bool to(Long64_t iIndex)
Go to the event at index iIndex.
Definition: ChainEvent.cc:115
virtual bool processEntry(int entry)
process one entry (pass the TTree entry)
edm::InputTag pfJetsTag_
reco::PFRecHitCollection rechitsHFEM_
void setDebug(bool aDebug)
PFAlgo pfAlgo_
particle flow algorithm
true particle for particle flow
Definition: PFSimParticle.h:19
reco::SuperClusterCollection eesc_
double energy() const
cluster energy
Definition: PFCluster.h:72
void clustering()
read data from testbeam tree
edm::Handle< reco::PFRecHitCollection > rechitsHOHandle_
rechits HO
std::vector< reco::PFRecHitCollection > rechitsCLEANEDV_
rechits HF CLEANED
void setThreshEndcap(double thresh)
set endcap threshold
void process(const reco::PFJetCollection &, const reco::GenJetCollection &)
void addJetPF(const Jet &jets)
Definition: EventColin.h:108
edm::InputTag rechitsHFHADTag_
std::string expand(const std::string &oldString) const
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
void setThreshDoubleSpikeBarrel(double thresh)
set endcap thresholds for double spike cleaning
void setHOTag(bool ho)
Definition: PFAlgo.h:62
int k[5][pyjets_maxn]
void printRecHit(const reco::PFRecHit &rh, unsigned index, const char *seed=" ", std::ostream &out=std::cout) const
double hadEnergy() const
Definition: CaloTower.h:78
void makeFastJets(const JetReco::InputCollection &fInput, JetReco::OutputCollection *fOutput)
Produce jet collection using CMS Fast Jet Algorithm.
tuple out
Definition: dbtoconf.py:99
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
const std::vector< reco::PFTrajectoryPoint > & trajectoryPoints() const
Definition: PFTrack.h:98
tuple tags
Definition: o2o.py:248
void setConeAreaFraction(double aConeAreaFraction)
Set fraction of (alowed) overlapping.
bool makeSpecific(const JetReco::InputCollection &fConstituents, const CaloSubdetectorGeometry &fTowerGeometry, reco::CaloJet::Specific *fJetSpecific)
Make CaloJet specifics. Assumes ProtoJet is made from CaloTowerCandidates.
Definition: JetMaker.cc:20
void fillOutEventWithSimParticles(const reco::PFSimParticleCollection &ptcs)
fills OutEvent with sim particles
virtual bool processEvent(int run, int lumi, int event)
process one event (pass the CMS event number)
std::auto_ptr< reco::PFCandidateCollection > pfCandidates_
reconstructed pfCandidates
bool countChargedAndPhotons() const
const math::XYZPoint & position() const
is seed ?
Definition: PFRecHit.h:141
reco::PFRecHitCollection rechitsHO_
void setDirectory(TDirectory *dir)
set directory (to use in ROOT)
void fillOne(const reco::MET &met, const reco::MET &matchedMet, float &minVal, float &maxVal)
edm::Handle< reco::PFConversionCollection > conversionHandle_
conversions
bool plotAgainstReco
void connect(const char *infilename="")
open the root file and connect to the tree
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
const std::vector< unsigned > & neighboursIds8() const
Definition: PFRecHit.h:166
reco::GsfPFRecTrackCollection convBremGsfrecTracks_
void setInput(const T< reco::PFRecTrackCollection > &trackh, const T< reco::GsfPFRecTrackCollection > &gsftrackh, const T< reco::GsfPFRecTrackCollection > &convbremgsftrackh, const T< reco::MuonCollection > &muonh, const T< reco::PFDisplacedTrackerVertexCollection > &nuclearh, const T< reco::PFRecTrackCollection > &nucleartrackh, const T< reco::PFConversionCollection > &conv, const T< reco::PFV0Collection > &v0, const T< reco::PFClusterCollection > &ecalh, const T< reco::PFClusterCollection > &hcalh, const T< reco::PFClusterCollection > &hoh, const T< reco::PFClusterCollection > &hfemh, const T< reco::PFClusterCollection > &hfhadh, const T< reco::PFClusterCollection > &psh, const T< reco::PhotonCollection > &egphh, const T< reco::SuperClusterCollection > &sceb, const T< reco::SuperClusterCollection > &scee, const T< edm::ValueMap< reco::CaloClusterPtr > > &pfclusterassoc, const Mask &trackMask=dummyMask_, const Mask &gsftrackMask=dummyMask_, const Mask &ecalMask=dummyMask_, const Mask &hcalMask=dummyMask_, const Mask &hoMask=dummyMask_, const Mask &hfemMask=dummyMask_, const Mask &hfhadMask=dummyMask_, const Mask &psMask=dummyMask_, const Mask &phMask=dummyMask_, const Mask &scMask=dummyMask_)
set input collections of tracks and clusters
Definition: PFBlockAlgo.h:394
edm::Handle< reco::GsfElectronCollection > egammaElectronHandle_
void printGenParticles(std::ostream &out=std::cout, int maxNLines=-1) const
print the HepMC truth
const math::XYZTLorentzVector & momentum() const
4-momenta quadrivector
reco::GenParticleCollection genParticlesCMSSW_
edm::Handle< reco::GenParticleCollection > genParticlesforMETHandle_
CMSSW GenParticles.
bool doTauBenchmark_
tau benchmark on/off
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:35
reco::PFJetCollection pfJets_
PF Jets.
edm::InputTag caloMetsTag_
std::auto_ptr< reco::PFClusterCollection > clustersHFEM_
double resChargedHadEnergyMax() const
bool eventAccepted() const
returns true if the event is accepted(have a look at the function implementation) ...
virtual const_iterator begin() const
first daughter const_iterator
void write()
write histos
edm::InputTag rechitsHCALTag_
tuple tracks
Definition: testEve_cfg.py:39
void printMCCalib(std::ofstream &out) const
print calibration information
reco::PFRecHitCollection rechitsCLEANED_
unsigned int nCharged(const GenJet &jet)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
virtual int charge() const GCC11_FINAL
electric charge
std::auto_ptr< reco::PFClusterCollection > clustersHFHAD_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
edm::Handle< CaloTowerCollection > caloTowersHandle_
input collection of calotowers
const LorentzVector & p4() const
Definition: ProtoJet.h:91
unsigned int nTrajectoryMeasurements() const
Definition: PFTrack.h:94
PFBlockAlgo pfBlockAlgo_
algorithm for building the particle flow blocks
void setRange(float ptMin, float ptMax, float etaMin, float etaMax, float phiMin, float phiMax)
Definition: Benchmark.h:52
reco::TrackCollection stdTracks_
std::auto_ptr< reco::PFBlockCollection > transferBlocks()
Definition: PFBlockAlgo.h:198
list blocks
Definition: gather_cfg.py:90
bool pfjBenchmarkDebug
bool highPtPFCandidate(double ptMin, reco::PFCandidate::ParticleType type=reco::PFCandidate::X) const
returns true if there is a PFCandidate of a given type over a given pT
reco::CaloMETCollection caloMetsCMSSW_
void addParticle(const Particle &ptc)
Definition: EventColin.h:84
PFClusterAlgo clusterAlgoPS_
clustering algorithm for PS
void setRecHitNeigbours(reco::PFRecHit &rh, const std::map< unsigned, unsigned > &detId2index)
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
void findBlocks()
build blocks
Definition: PFBlockAlgo.cc:86
float pileup() const
pileup energy contribution as calculated by algorithm
Definition: ProtoJet.cc:78
edm::Handle< edm::HepMCProduct > MCTruthHandle_
MC truth.
reco::PFDisplacedTrackerVertexCollection pfNuclearTrackerVertex_
T const * product() const
Definition: Handle.h:81
edm::HepMCProduct MCTruth_
void addBlock(const Block &b)
Definition: EventColin.h:116
virtual void readSpecificOptions(const char *file)
virtual ~PFRootEventManager()
destructor
bool doPFJetBenchmark_
PFJet benchmark on/off.
const reco::PFSimParticle & closestParticle(reco::PFTrajectoryPoint::LayerType layer, double eta, double phi, double &peta, double &pphi, double &pe) const
find the closest PFSimParticle to a point (eta,phi) in a given detector
edm::Handle< reco::METCollection > tcMetsHandle_
CMSSW TCMET.
std::auto_ptr< METManager > metManager_
edm::Handle< reco::PFDisplacedTrackerVertexCollection > pfNuclearTrackerVertexHandle_
PFDisplacedVertex.
void setThreshPtBarrel(double thresh)
Definition: PFClusterAlgo.h:95
std::auto_ptr< std::vector< reco::PFCluster > > & clusters()
edm::EventID id() const
Definition: EventBase.h:56
void clear()
Clear the PtrVector.
Definition: PtrVectorBase.h:79
edm::Handle< reco::VertexCollection > primaryVerticesHandle_
reconstructed primary vertices
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:38
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:87
bool useHO_
Use of HO in links with tracks/HCAL and in particle flow reconstruction.
#define begin
Definition: vmac.h:30
double energy() const
rechit energy
Definition: PFRecHit.h:111
size_type size() const
edm::InputTag conversionTag_
void setCleanRBXandHPDs(bool cleanRBXandHPDs)
Activate cleaning of HCAL RBX&#39;s and HPD&#39;s.
bool printSimParticles_
print true particles yes/no
void setS6S2DoubleSpikeBarrel(double cut)
void reconstructCaloJets()
reconstruct calo jets
edm::Handle< reco::PFRecTrackCollection > displacedRecTracksHandle_
edm::Handle< reco::PFRecHitCollection > rechitsPSHandle_
rechits PS
edm::Handle< std::vector< reco::CaloJet > > corrcaloJetsHandle_
CMSSW corrected calo Jets.
edm::Handle< reco::GsfPFRecTrackCollection > convBremGsfrecTracksHandle_
reconstructed secondary GSF tracks
edm::Handle< reco::PFV0Collection > v0Handle_
V0.
void enableDebugging(bool debug)
set hits on which clustering will be performed
Definition: PFClusterAlgo.h:76
static TVector3 VectorEPRtoXYZ(const TVector3 &posepr)
converts a vector (in eta,phi,R) to a vector in (x,y,z)
Definition: Utils.cc:73
void setS4S1CleanEndcap(const std::vector< double > &coeffs)
void fill(const reco::PFCandidateCollection &candCollection, const C &matchedCandCollection)
fill histograms with all particle
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
bool useConvBremGsfTracks_
Use Secondary Gsf Tracks.
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9
static void enable()
enable automatic library loading
std::vector< reco::CaloJet > corrcaloJetsCMSSW_
math::XYZPoint Point
point in the space
Definition: Candidate.h:45
edm::InputTag pfCandidateTag_
void pfCandCompare(int)
compare particle flow
reco::PFRecHitCollection rechitsECAL_
tuple cout
Definition: gather_cfg.py:121
unsigned int nTrajectoryPoints() const
Definition: PFTrack.h:90
double MET1cut
PFMET Benchmark.
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
void setRParam(double aRparam)
int verbosity_
verbosity
reco::SuperClusterCollection ebsc_
superclusters
int nPasses() const
number of passes taken by algorithm
Definition: ProtoJet.cc:80
reco::PFConversionCollection conversion_
dbl *** dir
Definition: mlp_gen.cc:35
PFClusterAlgo clusterAlgoHFHAD_
clustering algorithm for HF, hadronic layer
const std::vector< unsigned > & neighboursIds4() const
Definition: PFRecHit.h:163
void addJetEHT(const Jet &jets)
Definition: EventColin.h:104
void setUseOptimization(bool useKDTreeTrackEcalLinker)
Definition: PFBlockAlgo.cc:66
virtual ParticleType particleId() const
Definition: PFCandidate.h:355
void setMaxPairSize(int aMaxPairSize)
????
void setThreshCleanEndcap(double thresh)
set endcap clean threshold
void setup()
book histograms
edm::InputTag tcMetsTag_
std::vector< reco::PFCandidateElectronExtra > PFCandidateElectronExtraCollection
collection of PFCandidateElectronExtras
std::vector< reco::CaloJet > caloJetsCMSSW_
virtual float pt() const GCC11_FINAL
transverse momentum
void setHistos(TFile *file, TH2F *hB, TH2F *hE)
set endcap clean threshold
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.cc:675
bool JECinCaloMet_
propagate the Jet Energy Corrections to the caloMET on/off
bool fastsim_
Fastsim or fullsim.
reco::METCollection tcMetsCMSSW_
void setPtMin(double aPtMin)
bool useEGElectrons_
Use EGElectrons.
void setAlgo(int algo)
Definition: PFAlgo.h:63
LayerType
Define the different layers where the track can be propagated.
bool useEGPhotons_
Use EGPhotons.
bool isValid() const
Definition: ChainEvent.cc:292
void addCaloTower(const CaloTower &ct)
Definition: EventColin.h:112
void fillRecHitMask(std::vector< bool > &mask, const reco::PFRecHitCollection &rechits) const
rechit mask set to true for rechits inside TCutG
void setParameters(std::vector< double > &DPtovPtCut, std::vector< unsigned > &NHitCut, bool useConvBremPFRecTracks, bool useIterTracking, int nuclearInteractionsPurity, bool useEGPhotons, std::vector< double > &photonSelectionCuts, bool useSuperClusters, bool superClusterMatchByRef)
Definition: PFBlockAlgo.cc:31
bool trackInsideGCut(const reco::PFTrack &track) const
is PFTrack inside cut G ? yes if at least one trajectory point is inside.
bool doCompare_
comparison with pf CMSSW
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9
bool printGenParticles_
print MC truth yes/no
tuple size
Write out results.
edm::Handle< reco::MuonCollection > muonsHandle_
muons
void PreprocessRecTracks(reco::PFRecTrackCollection &rectracks)
preprocess a rectrack vector from a given rectrack branch
void setup()
book histograms
reco::GsfElectronCollection egammaElectrons_
std::vector< unsigned > recHitContrib() const
Definition: PFSimParticle.h:49
tuple minTrackerHits
Definition: align_cfg.py:26
void fillOutEventWithBlocks(const reco::PFBlockCollection &blocks)
fills outEvent with blocks
std::vector< edm::InputTag > rechitsCLEANEDTags_
void reset()
Definition: EventColin.h:12
edm::InputTag trueParticlesTag_
double charge() const
Definition: PFTrack.h:87
FWLiteJetProducer jetMaker_
wrapper to official jet algorithms
bool printRecHits_
print rechits yes/no
int jetAlgoType_
jet algo type
void setElectronExtraRef(const edm::OrphanHandle< reco::PFCandidateElectronExtraCollection > &extrah)
Definition: PFAlgo.cc:3711
edm::Handle< reco::PFRecTrackCollection > recTracksHandle_
reconstructed tracks
Definition: DDAxes.h:10
Block of elements.
Definition: PFBlock.h:30
reco::PFV0Collection v0_
int eventToEntry(int run, int lumi, int event) const