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  );
1086  }
1087  catch( std::exception& err ) {
1088  cerr<<"exception setting PFBlockAlgo parameters: "
1089  <<err.what()<<". terminating."<<endl;
1090  delete this;
1091  exit(1);
1092  }
1093 
1094 
1095  bool blockAlgoDebug = false;
1096  options_->GetOpt("blockAlgo", "debug", blockAlgoDebug);
1097  pfBlockAlgo_.setDebug( blockAlgoDebug );
1098 
1099  bool AlgoDebug = false;
1100  options_->GetOpt("PFAlgo", "debug", AlgoDebug);
1101  pfAlgo_.setDebug( AlgoDebug );
1102 
1103  // read PFCluster calibration parameters
1104  boost::shared_ptr<PFEnergyCalibration>
1105  calibration( new PFEnergyCalibration() );
1106  calibration_ = calibration;
1107 
1108  bool usePFSCEleCalib;
1109  std::vector<double> calibPFSCEle_Fbrem_barrel;
1110  std::vector<double> calibPFSCEle_Fbrem_endcap;
1111  std::vector<double> calibPFSCEle_barrel;
1112  std::vector<double> calibPFSCEle_endcap;
1113  options_->GetOpt("particle_flow","usePFSCEleCalib",usePFSCEleCalib);
1114  options_->GetOpt("particle_flow","calibPFSCEle_Fbrem_barrel",calibPFSCEle_Fbrem_barrel);
1115  options_->GetOpt("particle_flow","calibPFSCEle_Fbrem_endcap",calibPFSCEle_Fbrem_endcap);
1116  options_->GetOpt("particle_flow","calibPFSCEle_barrel",calibPFSCEle_barrel);
1117  options_->GetOpt("particle_flow","calibPFSCEle_endcap",calibPFSCEle_endcap);
1118  boost::shared_ptr<PFSCEnergyCalibration>
1119  thePFSCEnergyCalibration (new PFSCEnergyCalibration(calibPFSCEle_Fbrem_barrel,calibPFSCEle_Fbrem_endcap,
1120  calibPFSCEle_barrel,calibPFSCEle_endcap ));
1121 
1122  bool useEGammaSupercluster;
1123  double sumEtEcalIsoForEgammaSC_barrel;
1124  double sumEtEcalIsoForEgammaSC_endcap;
1125  double coneEcalIsoForEgammaSC;
1126  double sumPtTrackIsoForEgammaSC_barrel;
1127  double sumPtTrackIsoForEgammaSC_endcap;
1128  unsigned int nTrackIsoForEgammaSC;
1129  double coneTrackIsoForEgammaSC;
1130  options_->GetOpt("particle_flow","useEGammaSupercluster",useEGammaSupercluster);
1131  options_->GetOpt("particle_flow","sumEtEcalIsoForEgammaSC_barrel",sumEtEcalIsoForEgammaSC_barrel);
1132  options_->GetOpt("particle_flow","sumEtEcalIsoForEgammaSC_endcap",sumEtEcalIsoForEgammaSC_endcap);
1133  options_->GetOpt("particle_flow","coneEcalIsoForEgammaSC",coneEcalIsoForEgammaSC);
1134  options_->GetOpt("particle_flow","sumPtTrackIsoForEgammaSC_barrel",sumPtTrackIsoForEgammaSC_barrel);
1135  options_->GetOpt("particle_flow","sumPtTrackIsoForEgammaSC_endcap",sumPtTrackIsoForEgammaSC_endcap);
1136  options_->GetOpt("particle_flow","nTrackIsoForEgammaSC",nTrackIsoForEgammaSC);
1137  options_->GetOpt("particle_flow","coneTrackIsoForEgammaSC",coneTrackIsoForEgammaSC);
1138  options_->GetOpt("particle_flow","useEGammaElectrons",useEGElectrons_);
1139 
1140  //--ab: get calibration factors for HF:
1141  bool calibHF_use = false;
1142  std::vector<double> calibHF_eta_step;
1143  std::vector<double> calibHF_a_EMonly;
1144  std::vector<double> calibHF_b_HADonly;
1145  std::vector<double> calibHF_a_EMHAD;
1146  std::vector<double> calibHF_b_EMHAD;
1147 
1148  options_->GetOpt("particle_flow","calib_calibHF_use",calibHF_use);
1149  options_->GetOpt("particle_flow","calib_calibHF_eta_step",calibHF_eta_step);
1150  options_->GetOpt("particle_flow","calib_calibHF_a_EMonly",calibHF_a_EMonly);
1151  options_->GetOpt("particle_flow","calib_calibHF_b_HADonly",calibHF_b_HADonly);
1152  options_->GetOpt("particle_flow","calib_calibHF_a_EMHAD",calibHF_a_EMHAD);
1153  options_->GetOpt("particle_flow","calib_calibHF_b_EMHAD",calibHF_b_EMHAD);
1154 
1155  boost::shared_ptr<PFEnergyCalibrationHF> thepfEnergyCalibrationHF
1156  ( new PFEnergyCalibrationHF(calibHF_use,calibHF_eta_step,calibHF_a_EMonly,calibHF_b_HADonly,calibHF_a_EMHAD,calibHF_b_EMHAD) ) ;
1157 
1158  thepfEnergyCalibrationHF_ = thepfEnergyCalibrationHF;
1159 
1160 
1161  //----------------------------------------
1162  double nSigmaECAL = 99999;
1163  options_->GetOpt("particle_flow", "nsigma_ECAL", nSigmaECAL);
1164  double nSigmaHCAL = 99999;
1165  options_->GetOpt("particle_flow", "nsigma_HCAL", nSigmaHCAL);
1166 
1167  try {
1168  pfAlgo_.setParameters( nSigmaECAL, nSigmaHCAL,
1169  calibration, thepfEnergyCalibrationHF_);
1170  }
1171  catch( std::exception& err ) {
1172  cerr<<"exception setting PFAlgo parameters: "
1173  <<err.what()<<". terminating."<<endl;
1174  delete this;
1175  exit(1);
1176  }
1177 
1178  std::vector<double> muonHCAL;
1179  std::vector<double> muonECAL;
1180  std::vector<double> muonHO;
1181  options_->GetOpt("particle_flow", "muon_HCAL", muonHCAL);
1182  options_->GetOpt("particle_flow", "muon_ECAL", muonECAL);
1183  options_->GetOpt("particle_flow", "muon_HO", muonHO);
1184 
1185  assert ( muonHCAL.size() == 2 && muonECAL.size() == 2 && muonHO.size() == 2);
1186 
1187  double nSigmaTRACK = 3.0;
1188  options_->GetOpt("particle_flow", "nsigma_TRACK", nSigmaTRACK);
1189 
1190  double ptError = 1.0;
1191  options_->GetOpt("particle_flow", "pt_error", ptError);
1192 
1193  std::vector<double> factors45;
1194  options_->GetOpt("particle_flow", "factors_45", factors45);
1195  assert ( factors45.size() == 2 );
1196 
1197  edm::ParameterSet iConfig;
1198 
1199 
1200  double maxDPtOPt;
1201  options_->GetOpt("particle_flow", "maxDPtOPt", maxDPtOPt);
1202  iConfig.addParameter<double>("maxDPtOPt",maxDPtOPt);
1203 
1204  int minTrackerHits;
1205  options_->GetOpt("particle_flow", "minTrackerHits", minTrackerHits);
1206  iConfig.addParameter<int>("minTrackerHits",minTrackerHits);
1207 
1208  int minPixelHits;
1209  options_->GetOpt("particle_flow", "minPixelHits", minPixelHits);
1210  iConfig.addParameter<int>("minPixelHits",minPixelHits);
1211 
1213  options_->GetOpt("particle_flow", "trackQuality", trackQuality);
1214  iConfig.addParameter<std::string>("trackQuality",trackQuality);
1215 
1216  double ptErrorScale;
1217  options_->GetOpt("particle_flow", "ptErrorScale", ptErrorScale);
1218  iConfig.addParameter<double>("ptErrorScale",ptErrorScale);
1219 
1220  double eventFractionForCleaning;
1221  options_->GetOpt("particle_flow", "eventFractionForCleaning", eventFractionForCleaning);
1222  iConfig.addParameter<double>("eventFractionForCleaning",eventFractionForCleaning);
1223 
1224  double dzpv;
1225  options_->GetOpt("particle_flow", "dzPV", dzpv);
1226  iConfig.addParameter<double>("dzPV",dzpv);
1227 
1228  bool postMuonCleaning;
1229  options_->GetOpt("particle_flow", "postMuonCleaning", postMuonCleaning);
1230  iConfig.addParameter<bool>("postMuonCleaning",postMuonCleaning);
1231 
1232  double minPtForPostCleaning;
1233  options_->GetOpt("particle_flow", "minPtForPostCleaning", minPtForPostCleaning);
1234  iConfig.addParameter<double>("minPtForPostCleaning",minPtForPostCleaning);
1235 
1236  double eventFactorForCosmics;
1237  options_->GetOpt("particle_flow", "eventFactorForCosmics", eventFactorForCosmics);
1238  iConfig.addParameter<double>("eventFactorForCosmics",eventFactorForCosmics);
1239 
1240  double minSignificanceForCleaning;
1241  options_->GetOpt("particle_flow", "metSignificanceForCleaning", minSignificanceForCleaning);
1242  iConfig.addParameter<double>("metSignificanceForCleaning",minSignificanceForCleaning);
1243 
1244  double minSignificanceForRejection;
1245  options_->GetOpt("particle_flow", "metSignificanceForRejection", minSignificanceForRejection);
1246  iConfig.addParameter<double>("metSignificanceForRejection",minSignificanceForRejection);
1247 
1248  double metFactorForCleaning;
1249  options_->GetOpt("particle_flow", "metFactorForCleaning", metFactorForCleaning);
1250  iConfig.addParameter<double>("metFactorForCleaning",metFactorForCleaning);
1251 
1252  double eventFractionForRejection;
1253  options_->GetOpt("particle_flow", "eventFractionForRejection", eventFractionForRejection);
1254  iConfig.addParameter<double>("eventFractionForRejection",eventFractionForRejection);
1255 
1256  double metFactorForRejection;
1257  options_->GetOpt("particle_flow", "metFactorForRejection", metFactorForRejection);
1258  iConfig.addParameter<double>("metFactorForRejection",metFactorForRejection);
1259 
1260  double metFactorForHighEta;
1261  options_->GetOpt("particle_flow", "metFactorForHighEta", metFactorForHighEta);
1262  iConfig.addParameter<double>("metFactorForHighEta",metFactorForHighEta);
1263 
1264  double ptFactorForHighEta;
1265  options_->GetOpt("particle_flow", "ptFactorForHighEta", ptFactorForHighEta);
1266  iConfig.addParameter<double>("ptFactorForHighEta",ptFactorForHighEta);
1267 
1268 
1269  double metFactorForFakes;
1270  options_->GetOpt("particle_flow", "metFactorForFakes", metFactorForFakes);
1271  iConfig.addParameter<double>("metFactorForFakes",metFactorForFakes);
1272 
1273  double minMomentumForPunchThrough;
1274  options_->GetOpt("particle_flow", "minMomentumForPunchThrough", minMomentumForPunchThrough);
1275  iConfig.addParameter<double>("minMomentumForPunchThrough",minMomentumForPunchThrough);
1276 
1277  double minEnergyForPunchThrough;
1278  options_->GetOpt("particle_flow", "minEnergyForPunchThrough", minEnergyForPunchThrough);
1279  iConfig.addParameter<double>("minEnergyForPunchThrough",minEnergyForPunchThrough);
1280 
1281 
1282  double punchThroughFactor;
1283  options_->GetOpt("particle_flow", "punchThroughFactor", punchThroughFactor);
1284  iConfig.addParameter<double>("punchThroughFactor",punchThroughFactor);
1285 
1286  double punchThroughMETFactor;
1287  options_->GetOpt("particle_flow", "punchThroughMETFactor", punchThroughMETFactor);
1288  iConfig.addParameter<double>("punchThroughMETFactor",punchThroughMETFactor);
1289 
1290 
1291  double cosmicRejectionDistance;
1292  options_->GetOpt("particle_flow", "cosmicRejectionDistance", cosmicRejectionDistance);
1293  iConfig.addParameter<double>("cosmicRejectionDistance",cosmicRejectionDistance);
1294 
1295  try {
1297 }
1298  catch( std::exception& err ) {
1299  cerr<<"exception setting PFAlgo Muon and Fake parameters: "
1300  <<err.what()<<". terminating."<<endl;
1301  delete this;
1302  exit(1);
1303  }
1304 
1305  bool postHFCleaning = true;
1306  options_->GetOpt("particle_flow", "postHFCleaning", postHFCleaning);
1307  double minHFCleaningPt = 5.;
1308  options_->GetOpt("particle_flow", "minHFCleaningPt", minHFCleaningPt);
1309  double minSignificance = 2.5;
1310  options_->GetOpt("particle_flow", "minSignificance", minSignificance);
1311  double maxSignificance = 2.5;
1312  options_->GetOpt("particle_flow", "maxSignificance", maxSignificance);
1313  double minSignificanceReduction = 1.4;
1314  options_->GetOpt("particle_flow", "minSignificanceReduction", minSignificanceReduction);
1315  double maxDeltaPhiPt = 7.0;
1316  options_->GetOpt("particle_flow", "maxDeltaPhiPt", maxDeltaPhiPt);
1317  double minDeltaMet = 0.4;
1318  options_->GetOpt("particle_flow", "minDeltaMet", minDeltaMet);
1319 
1320  // Set post HF cleaning muon parameters
1321  try {
1322  pfAlgo_.setPostHFCleaningParameters(postHFCleaning,
1323  minHFCleaningPt,
1324  minSignificance,
1325  maxSignificance,
1326  minSignificanceReduction,
1327  maxDeltaPhiPt,
1328  minDeltaMet);
1329  }
1330  catch( std::exception& err ) {
1331  cerr<<"exception setting post HF cleaning parameters: "
1332  <<err.what()<<". terminating."<<endl;
1333  delete this;
1334  exit(1);
1335  }
1336 
1337  useAtHLT_ = false;
1338  options_->GetOpt("particle_flow", "useAtHLT", useAtHLT_);
1339  cout<<"use HLT tracking "<<useAtHLT_<<endl;
1340 
1341  useHO_ = true;
1342  options_->GetOpt("particle_flow", "useHO", useHO_);
1343  cout<<"use of HO "<<useHO_<<endl;
1344 
1345 
1346  usePFElectrons_ = false; // set true to use PFElectrons
1347  options_->GetOpt("particle_flow", "usePFElectrons", usePFElectrons_);
1348  cout<<"use PFElectrons "<<usePFElectrons_<<endl;
1349 
1350  if( usePFElectrons_ ) {
1351  // PFElectrons options -----------------------------
1352  double mvaEleCut = -1.; // if = -1. get all the pre-id electrons
1353  options_->GetOpt("particle_flow", "electron_mvaCut", mvaEleCut);
1354 
1355  bool applyCrackCorrections=true;
1356  options_->GetOpt("particle_flow","electron_crackCorrection",applyCrackCorrections);
1357 
1358  string mvaWeightFileEleID = "";
1359  options_->GetOpt("particle_flow", "electronID_mvaWeightFile",
1360  mvaWeightFileEleID);
1361  mvaWeightFileEleID = expand(mvaWeightFileEleID);
1362 
1363  std::string egammaElectronstagname;
1364  options_->GetOpt("particle_flow","egammaElectrons",egammaElectronstagname);
1365  egammaElectronsTag_ = edm::InputTag(egammaElectronstagname);
1366 
1367  //HO in the algorithm or not
1370 
1371  try {
1372  pfAlgo_.setPFEleParameters(mvaEleCut,
1373  mvaWeightFileEleID,
1375  thePFSCEnergyCalibration,
1376  calibration,
1377  sumEtEcalIsoForEgammaSC_barrel,
1378  sumEtEcalIsoForEgammaSC_endcap,
1379  coneEcalIsoForEgammaSC,
1380  sumPtTrackIsoForEgammaSC_barrel,
1381  sumPtTrackIsoForEgammaSC_endcap,
1382  nTrackIsoForEgammaSC,
1383  coneTrackIsoForEgammaSC,
1384  applyCrackCorrections,
1385  usePFSCEleCalib,
1387  useEGammaSupercluster);
1388  }
1389  catch( std::exception& err ) {
1390  cerr<<"exception setting PFAlgo Electron parameters: "
1391  <<err.what()<<". terminating."<<endl;
1392  delete this;
1393  exit(1);
1394  }
1395  }
1396 
1397  bool usePFPhotons = true;
1398  bool useReg=false;
1399  string mvaWeightFileConvID = "";
1400  string mvaWeightFileRegLCEB="";
1401  string mvaWeightFileRegLCEE="";
1402  string mvaWeightFileRegGCEB="";
1403  string mvaWeightFileRegGCEEhr9="";
1404  string mvaWeightFileRegGCEElr9="";
1405  string mvaWeightFileRegRes="";
1406  string X0Map="";
1407  double mvaConvCut=-1.;
1408  double sumPtTrackIsoForPhoton=2.0;
1409  double sumPtTrackIsoSlopeForPhoton=0.001;
1410  options_->GetOpt("particle_flow", "usePFPhotons", usePFPhotons);
1411  options_->GetOpt("particle_flow", "conv_mvaCut", mvaConvCut);
1412  options_->GetOpt("particle_flow", "useReg", useReg);
1413  options_->GetOpt("particle_flow", "convID_mvaWeightFile", mvaWeightFileConvID);
1414  options_->GetOpt("particle_flow", "mvaWeightFileRegLCEB", mvaWeightFileRegLCEB);
1415  options_->GetOpt("particle_flow", "mvaWeightFileRegLCEE", mvaWeightFileRegLCEE);
1416  options_->GetOpt("particle_flow", "mvaWeightFileRegGCEB", mvaWeightFileRegGCEB);
1417  options_->GetOpt("particle_flow", "mvaWeightFileRegGCEEHr9", mvaWeightFileRegGCEEhr9);
1418  options_->GetOpt("particle_flow", "mvaWeightFileRegGCEELr9", mvaWeightFileRegGCEElr9);
1419  options_->GetOpt("particle_flow", "mvaWeightFileRegRes", mvaWeightFileRegRes);
1420  options_->GetOpt("particle_flow", "X0Map", X0Map);
1421  options_->GetOpt("particle_flow","sumPtTrackIsoForPhoton",sumPtTrackIsoForPhoton);
1422  options_->GetOpt("particle_flow","sumPtTrackIsoSlopeForPhoton",sumPtTrackIsoSlopeForPhoton);
1423  // cout<<"use PFPhotons "<<usePFPhotons<<endl;
1424 
1425  if( usePFPhotons ) {
1426  // PFPhoton options -----------------------------
1427  TFile *infile_PFLCEB = new TFile(mvaWeightFileRegLCEB.c_str(),"READ");
1428  TFile *infile_PFLCEE = new TFile(mvaWeightFileRegLCEE.c_str(),"READ");
1429  TFile *infile_PFGCEB = new TFile(mvaWeightFileRegGCEB.c_str(),"READ");
1430  TFile *infile_PFGCEEhR9 = new TFile(mvaWeightFileRegGCEEhr9.c_str(),"READ");
1431  TFile *infile_PFGCEElR9 = new TFile(mvaWeightFileRegGCEElr9.c_str(),"READ");
1432  TFile *infile_PFRes = new TFile(mvaWeightFileRegRes.c_str(),"READ");
1433 
1434  const GBRForest *gbrLCBar = (GBRForest*)infile_PFLCEB->Get("PFLCorrEB");
1435  const GBRForest *gbrLCEnd = (GBRForest*)infile_PFLCEE->Get("PFLCorrEE");
1436  const GBRForest *gbrGCEB = (GBRForest*)infile_PFGCEB->Get("PFGCorrEB");
1437  const GBRForest *gbrGCEEhr9 = (GBRForest*)infile_PFGCEEhR9->Get("PFGCorrEEHr9");
1438  const GBRForest *gbrGCEElr9 = (GBRForest*)infile_PFGCEElR9->Get("PFGCorrEELr9");
1439  const GBRForest *gbrRes = (GBRForest*)infile_PFRes->Get("PFRes");
1440  try {
1442  (usePFPhotons,
1443  mvaWeightFileConvID,
1444  mvaConvCut,
1445  useReg,
1446  X0Map,
1447  calibration,
1448  sumPtTrackIsoForPhoton,
1449  sumPtTrackIsoSlopeForPhoton
1450  );
1451  pfAlgo_.setPFPhotonRegWeights(gbrLCBar, gbrLCEnd,gbrGCEB,
1452  gbrGCEEhr9,gbrGCEElr9,
1453  gbrRes
1454  );
1455 
1456  }
1457  catch( std::exception& err ) {
1458  cerr<<"exception setting PFAlgo Photon parameters: "
1459  <<err.what()<<". terminating."<<endl;
1460  delete this;
1461  exit(1);
1462  }
1463  }
1464 
1465 
1466 
1467  bool rejectTracks_Bad = true;
1468  bool rejectTracks_Step45 = true;
1469  bool usePFConversions = false; // set true to use PFConversions
1470  bool usePFNuclearInteractions = false;
1471  bool usePFV0s = false;
1472 
1473 
1474  double dptRel_DispVtx = 10;
1475 
1476 
1477  options_->GetOpt("particle_flow", "usePFConversions", usePFConversions);
1478  options_->GetOpt("particle_flow", "usePFV0s", usePFV0s);
1479  options_->GetOpt("particle_flow", "usePFNuclearInteractions", usePFNuclearInteractions);
1480  options_->GetOpt("particle_flow", "dptRel_DispVtx", dptRel_DispVtx);
1481 
1482  try {
1483  pfAlgo_.setDisplacedVerticesParameters(rejectTracks_Bad,
1484  rejectTracks_Step45,
1485  usePFNuclearInteractions,
1486  usePFConversions,
1487  usePFV0s,
1488  dptRel_DispVtx);
1489 
1490  }
1491  catch( std::exception& err ) {
1492  cerr<<"exception setting PFAlgo displaced vertex parameters: "
1493  <<err.what()<<". terminating."<<endl;
1494  delete this;
1495  exit(1);
1496  }
1497 
1498  bool bCorrect = false;
1499  bool bCalibPrimary = false;
1500  double dptRel_PrimaryTrack = 0;
1501  double dptRel_MergedTrack = 0;
1502  double ptErrorSecondary = 0;
1503  vector<double> nuclCalibFactors;
1504 
1505  options_->GetOpt("particle_flow", "bCorrect", bCorrect);
1506  options_->GetOpt("particle_flow", "bCalibPrimary", bCalibPrimary);
1507  options_->GetOpt("particle_flow", "dptRel_PrimaryTrack", dptRel_PrimaryTrack);
1508  options_->GetOpt("particle_flow", "dptRel_MergedTrack", dptRel_MergedTrack);
1509  options_->GetOpt("particle_flow", "ptErrorSecondary", ptErrorSecondary);
1510  options_->GetOpt("particle_flow", "nuclCalibFactors", nuclCalibFactors);
1511 
1512  try {
1513  pfAlgo_.setCandConnectorParameters(bCorrect, bCalibPrimary, dptRel_PrimaryTrack, dptRel_MergedTrack, ptErrorSecondary, nuclCalibFactors);
1514  }
1515  catch( std::exception& err ) {
1516  cerr<<"exception setting PFAlgo cand connector parameters: "
1517  <<err.what()<<". terminating."<<endl;
1518  delete this;
1519  exit(1);
1520  }
1521 
1522 
1523 
1524 
1525  int algo = 2;
1526  options_->GetOpt("particle_flow", "algorithm", algo);
1527 
1528  pfAlgo_.setAlgo( algo );
1529  // pfAlgoOther_.setAlgo( 1 );
1530 
1531 
1532  // jets options ---------------------------------
1533 
1534  doJets_ = false;
1535  options_->GetOpt("jets", "on/off", doJets_);
1536 
1537  jetsDebug_ = false;
1538  options_->GetOpt("jets", "debug", jetsDebug_);
1539 
1540  jetAlgoType_=3; //FastJet as Default
1541  options_->GetOpt("jets", "algo", jetAlgoType_);
1542 
1543  double mEtInputCut = 0.5;
1544  options_->GetOpt("jets", "EtInputCut", mEtInputCut);
1545 
1546  double mEInputCut = 0.;
1547  options_->GetOpt("jets", "EInputCut", mEInputCut);
1548 
1549  double seedThreshold = 1.0;
1550  options_->GetOpt("jets", "seedThreshold", seedThreshold);
1551 
1552  double coneRadius = 0.5;
1553  options_->GetOpt("jets", "coneRadius", coneRadius);
1554 
1555  double coneAreaFraction= 1.0;
1556  options_->GetOpt("jets", "coneAreaFraction", coneAreaFraction);
1557 
1558  int maxPairSize=2;
1559  options_->GetOpt("jets", "maxPairSize", maxPairSize);
1560 
1561  int maxIterations=100;
1562  options_->GetOpt("jets", "maxIterations", maxIterations);
1563 
1564  double overlapThreshold = 0.75;
1565  options_->GetOpt("jets", "overlapThreshold", overlapThreshold);
1566 
1567  double ptMin = 10.;
1568  options_->GetOpt("jets", "ptMin", ptMin);
1569 
1570  double rparam = 1.0;
1571  options_->GetOpt("jets", "rParam", rparam);
1572 
1573  jetMaker_.setmEtInputCut (mEtInputCut);
1574  jetMaker_.setmEInputCut(mEInputCut);
1575  jetMaker_.setSeedThreshold(seedThreshold);
1576  jetMaker_.setConeRadius(coneRadius);
1577  jetMaker_.setConeAreaFraction(coneAreaFraction);
1578  jetMaker_.setMaxPairSize(maxPairSize);
1579  jetMaker_.setMaxIterations(maxIterations) ;
1580  jetMaker_.setOverlapThreshold(overlapThreshold) ;
1581  jetMaker_.setPtMin (ptMin);
1582  jetMaker_.setRParam (rparam);
1585  cout <<"Opt: doJets? " << doJets_ <<endl;
1586  cout <<"Opt: jetsDebug " << jetsDebug_ <<endl;
1587  cout <<"Opt: algoType " << jetAlgoType_ <<endl;
1588  cout <<"----------------------------------" << endl;
1589 
1590 
1591  // tau benchmark options ---------------------------------
1592 
1593  doTauBenchmark_ = false;
1594  options_->GetOpt("tau_benchmark", "on/off", doTauBenchmark_);
1595 
1596  if (doTauBenchmark_) {
1597  double coneAngle = 0.5;
1598  options_->GetOpt("tau_benchmark", "cone_angle", coneAngle);
1599 
1600  double seedEt = 0.4;
1601  options_->GetOpt("tau_benchmark", "seed_et", seedEt);
1602 
1603  double coneMerge = 100.0;
1604  options_->GetOpt("tau_benchmark", "cone_merge", coneMerge);
1605 
1606  options_->GetOpt("tau_benchmark", "debug", tauBenchmarkDebug_);
1607 
1608  // cout<<"jets debug "<<jetsDebug_<<endl;
1609 
1610  if( tauBenchmarkDebug_ ) {
1611  cout << "Tau Benchmark Options : ";
1612  cout << "Angle=" << coneAngle << " seedEt=" << seedEt
1613  << " Merge=" << coneMerge << endl;
1614  }
1615 
1616  jetAlgo_.SetConeAngle(coneAngle);
1617  jetAlgo_.SetSeedEt(seedEt);
1618  jetAlgo_.SetConeMerge(coneMerge);
1619  }
1620 
1621 
1622 
1623  // print flags -------------
1624 
1625  printRecHits_ = false;
1626  printRecHitsEMin_ = 0.;
1627  options_->GetOpt("print", "rechits", printRecHits_ );
1628  options_->GetOpt("print", "rechits_emin", printRecHitsEMin_ );
1629 
1630  printClusters_ = false;
1631  printClustersEMin_ = 0.;
1632  options_->GetOpt("print", "clusters", printClusters_ );
1633  options_->GetOpt("print", "clusters_emin", printClustersEMin_ );
1634 
1635  printPFBlocks_ = false;
1636  options_->GetOpt("print", "PFBlocks", printPFBlocks_ );
1637 
1638  printPFCandidates_ = true;
1640  options_->GetOpt("print", "PFCandidates", printPFCandidates_ );
1641  options_->GetOpt("print", "PFCandidates_ptmin", printPFCandidatesPtMin_ );
1642 
1643  printPFJets_ = true;
1644  printPFJetsPtMin_ = 0.;
1645  options_->GetOpt("print", "jets", printPFJets_ );
1646  options_->GetOpt("print", "jets_ptmin", printPFJetsPtMin_ );
1647 
1648  printSimParticles_ = true;
1650  options_->GetOpt("print", "simParticles", printSimParticles_ );
1651  options_->GetOpt("print", "simParticles_ptmin", printSimParticlesPtMin_ );
1652 
1653  printGenParticles_ = true;
1655  options_->GetOpt("print", "genParticles", printGenParticles_ );
1656  options_->GetOpt("print", "genParticles_ptmin", printGenParticlesPtMin_ );
1657 
1658  //MCTruthMatching Tool set to false by default
1659  //can only be used with fastsim and the UnFoldedMode set to true
1660  //when generating the simulated file
1661  printMCTruthMatching_ = false;
1662  options_->GetOpt("print", "mctruthmatching", printMCTruthMatching_ );
1663 
1664 
1665  verbosity_ = VERBOSE;
1666  options_->GetOpt("print", "verbosity", verbosity_ );
1667  cout<<"verbosity : "<<verbosity_<<endl;
1668 
1669 
1670 
1671 
1672 
1673 }
1674 
1675 void PFRootEventManager::connect( const char* infilename ) {
1676 
1677  cout<<"Opening input root files"<<endl;
1678 
1679  options_->GetOpt("root","file", inFileNames_);
1680 
1681 
1682 
1683  try {
1685  }
1686  catch(string& err) {
1687  cout<<err<<endl;
1688  }
1689 
1691 
1692 
1693  if ( !ev_ || !ev_->isValid() ) {
1694  cout << "The rootfile(s) " << endl;
1695  for ( unsigned int ifile=0; ifile<inFileNames_.size(); ++ifile )
1696  std::cout << " - " << inFileNames_[ifile] << std::endl;
1697  cout << " is (are) not valid file(s) to open" << endl;
1698  return;
1699  } else {
1700  cout << "The rootfile(s) : " << endl;
1701  for ( unsigned int ifile=0; ifile<inFileNames_.size(); ++ifile )
1702  std::cout << " - " << inFileNames_[ifile] << std::endl;
1703  cout<<" are opened with " << ev_->size() << " events." <<endl;
1704  }
1705 
1706  // hits branches ----------------------------------------------
1707  std::string rechitsECALtagname;
1708  options_->GetOpt("root","rechits_ECAL_inputTag", rechitsECALtagname);
1709  rechitsECALTag_ = edm::InputTag(rechitsECALtagname);
1710 
1711  std::string rechitsHCALtagname;
1712  options_->GetOpt("root","rechits_HCAL_inputTag", rechitsHCALtagname);
1713  rechitsHCALTag_ = edm::InputTag(rechitsHCALtagname);
1714 
1715  std::string rechitsHOtagname;
1716  options_->GetOpt("root","rechits_HO_inputTag", rechitsHOtagname);
1717  rechitsHOTag_ = edm::InputTag(rechitsHOtagname);
1718 
1719  std::string rechitsHFEMtagname;
1720  options_->GetOpt("root","rechits_HFEM_inputTag", rechitsHFEMtagname);
1721  rechitsHFEMTag_ = edm::InputTag(rechitsHFEMtagname);
1722 
1723  std::string rechitsHFHADtagname;
1724  options_->GetOpt("root","rechits_HFHAD_inputTag", rechitsHFHADtagname);
1725  rechitsHFHADTag_ = edm::InputTag(rechitsHFHADtagname);
1726 
1727  std::vector<string> rechitsCLEANEDtagnames;
1728  options_->GetOpt("root","rechits_CLEANED_inputTags", rechitsCLEANEDtagnames);
1729  for ( unsigned tags = 0; tags<rechitsCLEANEDtagnames.size(); ++tags )
1730  rechitsCLEANEDTags_.push_back(edm::InputTag(rechitsCLEANEDtagnames[tags]));
1731  rechitsCLEANEDV_.resize(rechitsCLEANEDTags_.size());
1733 
1734 
1735  // Tracks branches
1736  std::string rechitsPStagname;
1737  options_->GetOpt("root","rechits_PS_inputTag", rechitsPStagname);
1738  rechitsPSTag_ = edm::InputTag(rechitsPStagname);
1739 
1740  std::string recTrackstagname;
1741  options_->GetOpt("root","recTracks_inputTag", recTrackstagname);
1742  recTracksTag_ = edm::InputTag(recTrackstagname);
1743 
1744  std::string displacedRecTrackstagname;
1745  options_->GetOpt("root","displacedRecTracks_inputTag", displacedRecTrackstagname);
1746  displacedRecTracksTag_ = edm::InputTag(displacedRecTrackstagname);
1747 
1748  std::string primaryVerticestagname;
1749  options_->GetOpt("root","primaryVertices_inputTag", primaryVerticestagname);
1750  primaryVerticesTag_ = edm::InputTag(primaryVerticestagname);
1751 
1752  std::string stdTrackstagname;
1753  options_->GetOpt("root","stdTracks_inputTag", stdTrackstagname);
1754  stdTracksTag_ = edm::InputTag(stdTrackstagname);
1755 
1756  std::string gsfrecTrackstagname;
1757  options_->GetOpt("root","gsfrecTracks_inputTag", gsfrecTrackstagname);
1758  gsfrecTracksTag_ = edm::InputTag(gsfrecTrackstagname);
1759 
1760  useConvBremGsfTracks_ = false;
1761  options_->GetOpt("particle_flow", "useConvBremGsfTracks", useConvBremGsfTracks_);
1762  if ( useConvBremGsfTracks_ ) {
1763  std::string convBremGsfrecTrackstagname;
1764  options_->GetOpt("root","convBremGsfrecTracks_inputTag", convBremGsfrecTrackstagname);
1765  convBremGsfrecTracksTag_ = edm::InputTag(convBremGsfrecTrackstagname);
1766  }
1767 
1768  useConvBremPFRecTracks_ = false;
1769  options_->GetOpt("particle_flow", "useConvBremPFRecTracks", useConvBremPFRecTracks_);
1770 
1771 
1772  // muons branch
1773  std::string muonstagname;
1774  options_->GetOpt("root","muon_inputTag", muonstagname);
1775  muonsTag_ = edm::InputTag(muonstagname);
1776 
1777  // conversion
1778  usePFConversions_=false;
1779  options_->GetOpt("particle_flow", "usePFConversions", usePFConversions_);
1780  if( usePFConversions_ ) {
1781  std::string conversiontagname;
1782  options_->GetOpt("root","conversion_inputTag", conversiontagname);
1783  conversionTag_ = edm::InputTag(conversiontagname);
1784  }
1785 
1786  // V0
1787  usePFV0s_=false;
1788  options_->GetOpt("particle_flow", "usePFV0s", usePFV0s_);
1789  if( usePFV0s_ ) {
1790  std::string v0tagname;
1791  options_->GetOpt("root","V0_inputTag", v0tagname);
1792  v0Tag_ = edm::InputTag(v0tagname);
1793  }
1794 
1795  // Photons
1796  std::string photontagname;
1797  options_->GetOpt("root","Photon_inputTag",photontagname);
1798  photonTag_ = edm::InputTag(photontagname);
1799 
1800  //Displaced Vertices
1802  options_->GetOpt("particle_flow", "usePFNuclearInteractions", usePFNuclearInteractions_);
1804  std::string pfNuclearTrackerVertextagname;
1805  options_->GetOpt("root","PFDisplacedVertex_inputTag", pfNuclearTrackerVertextagname);
1806  pfNuclearTrackerVertexTag_ = edm::InputTag(pfNuclearTrackerVertextagname);
1807  }
1808 
1809  std::string trueParticlestagname;
1810  options_->GetOpt("root","trueParticles_inputTag", trueParticlestagname);
1811  trueParticlesTag_ = edm::InputTag(trueParticlestagname);
1812 
1813  std::string MCTruthtagname;
1814  options_->GetOpt("root","MCTruth_inputTag", MCTruthtagname);
1815  MCTruthTag_ = edm::InputTag(MCTruthtagname);
1816 
1817  std::string caloTowerstagname;
1818  options_->GetOpt("root","caloTowers_inputTag", caloTowerstagname);
1819  caloTowersTag_ = edm::InputTag(caloTowerstagname);
1820 
1821  std::string genJetstagname;
1822  options_->GetOpt("root","genJets_inputTag", genJetstagname);
1823  genJetsTag_ = edm::InputTag(genJetstagname);
1824 
1825 
1826  std::string genParticlesforMETtagname;
1827  options_->GetOpt("root","genParticlesforMET_inputTag", genParticlesforMETtagname);
1828  genParticlesforMETTag_ = edm::InputTag(genParticlesforMETtagname);
1829 
1830  std::string genParticlesforJetstagname;
1831  options_->GetOpt("root","genParticlesforJets_inputTag", genParticlesforJetstagname);
1832  genParticlesforJetsTag_ = edm::InputTag(genParticlesforJetstagname);
1833 
1834  // PF candidates
1835  std::string pfCandidatetagname;
1836  options_->GetOpt("root","particleFlowCand_inputTag", pfCandidatetagname);
1837  pfCandidateTag_ = edm::InputTag(pfCandidatetagname);
1838 
1839  std::string caloJetstagname;
1840  options_->GetOpt("root","CaloJets_inputTag", caloJetstagname);
1841  caloJetsTag_ = edm::InputTag(caloJetstagname);
1842 
1843  std::string corrcaloJetstagname;
1844  options_->GetOpt("root","corrCaloJets_inputTag", corrcaloJetstagname);
1845  corrcaloJetsTag_ = edm::InputTag(corrcaloJetstagname);
1846 
1847  std::string pfJetstagname;
1848  options_->GetOpt("root","PFJets_inputTag", pfJetstagname);
1849  pfJetsTag_ = edm::InputTag(pfJetstagname);
1850 
1851  std::string pfMetstagname;
1852  options_->GetOpt("root","PFMET_inputTag", pfMetstagname);
1853  pfMetsTag_ = edm::InputTag(pfMetstagname);
1854 
1855  std::string caloMetstagname;
1856  options_->GetOpt("root","CaloMET_inputTag", caloMetstagname);
1857  caloMetsTag_ = edm::InputTag(caloMetstagname);
1858 
1859  std::string tcMetstagname;
1860  options_->GetOpt("root","TCMET_inputTag", tcMetstagname);
1861  tcMetsTag_ = edm::InputTag(tcMetstagname);
1862 
1863 }
1864 
1865 
1866 
1867 
1868 
1870 
1871  if(outFile_) {
1872  outFile_->Close();
1873  }
1874 
1875  if(outEvent_) delete outEvent_;
1876 
1877  delete options_;
1878 
1879 }
1880 
1881 
1883 
1885  if(doPFMETBenchmark_) metManager_->write();
1892 
1893  // Addition to have DQM histograms : by S. Dutta
1894  if (doPFDQM_) {
1895  cout << " Writing DQM root file " << endl;
1896  pfJetMonitor_.write();
1897  pfMETMonitor_.write();
1898  dqmFile_->Write();
1899  }
1900  //-----------------------------------------------
1901  if(outFile_) {
1902  outFile_->Write();
1903 // outFile_->cd();
1904 // // write histos here
1905 // cout<<"writing output to "<<outFile_->GetName()<<endl;
1906 // h_deltaETvisible_MCEHT_->Write();
1907 // h_deltaETvisible_MCPF_->Write();
1908 // if(outTree_) outTree_->Write();
1909 // if(doPFCandidateBenchmark_) pfCandidateBenchmark_.write();
1910  }
1911 }
1912 
1913 
1915 
1916  RunsMap::const_iterator iR = mapEventToEntry_.find( run );
1917  if( iR != mapEventToEntry_.end() ) {
1918  LumisMap::const_iterator iL = iR->second.find( lumi );
1919  if( iL != iR->second.end() ) {
1920  EventToEntry::const_iterator iE = iL->second.find( event );
1921  if( iE != iL->second.end() ) {
1922  return iE->second;
1923  }
1924  else {
1925  cout<<"event "<<event<<" not found in run "<<run<<", lumi "<<lumi<<endl;
1926  }
1927  }
1928  else {
1929  cout<<"lumi "<<lumi<<" not found in run "<<run<<endl;
1930  }
1931  }
1932  else{
1933  cout<<"run "<<run<<" not found"<<endl;
1934  }
1935  return -1;
1936 }
1937 
1939 
1940  int entry = eventToEntry(run, lumi, event);
1941  if( entry < 0 ) {
1942  cout<<"event "<<event<<" is not present, sorry."<<endl;
1943  return false;
1944  }
1945  else
1946  return processEntry( entry );
1947 }
1948 
1949 
1951 
1952  reset();
1953 
1954  iEvent_ = entry;
1955 
1956  bool exists = ev_->to(entry);
1957  if ( !exists ) {
1958  std::cout << "Entry " << entry << " does not exist " << std::endl;
1959  return false;
1960  }
1961  const edm::EventBase& iEvent = *ev_;
1962 
1963  if( outEvent_ ) outEvent_->setNumber(entry);
1964 
1965  if(verbosity_ == VERBOSE ||
1966  //entry < 10000 ||
1967  entry < 10 ||
1968  (entry < 100 && entry%10 == 0) ||
1969  (entry < 1000 && entry%100 == 0) ||
1970  entry%1000 == 0 )
1971  cout<<"process entry "<< entry
1972  <<", run "<<iEvent.id().run()
1973  <<", lumi "<<iEvent.id().luminosityBlock()
1974  <<", event:"<<iEvent.id().event()
1975  << endl;
1976 
1977  //ev_->getTFile()->cd();
1978 
1979  bool goodevent = readFromSimulation(entry);
1980 
1981  /*
1982  std::cout << "Rechits cleaned : " << std::endl;
1983  for(unsigned i=0; i<rechitsCLEANED_.size(); i++) {
1984  string seedstatus = " ";
1985  printRecHit(rechitsCLEANED_[i], i, seedstatus.c_str());
1986  }
1987  */
1988 
1989  if(verbosity_ == VERBOSE ) {
1990  cout<<"number of vertices : "<<primaryVertices_.size()<<endl;
1991  cout<<"number of recTracks : "<<recTracks_.size()<<endl;
1992  cout<<"number of gsfrecTracks : "<<gsfrecTracks_.size()<<endl;
1993  cout<<"number of convBremGsfrecTracks : "<<convBremGsfrecTracks_.size()<<endl;
1994  cout<<"number of muons : "<<muons_.size()<<endl;
1995  cout<<"number of displaced vertices : "<<pfNuclearTrackerVertex_.size()<<endl;
1996  cout<<"number of conversions : "<<conversion_.size()<<endl;
1997  cout<<"number of v0 : "<<v0_.size()<<endl;
1998  cout<<"number of stdTracks : "<<stdTracks_.size()<<endl;
1999  cout<<"number of true particles : "<<trueParticles_.size()<<endl;
2000  cout<<"number of ECAL rechits : "<<rechitsECAL_.size()<<endl;
2001  cout<<"number of HCAL rechits : "<<rechitsHCAL_.size()<<endl;
2002  cout<<"number of HO rechits : "<<rechitsHO_.size()<<endl;
2003  cout<<"number of HFEM rechits : "<<rechitsHFEM_.size()<<endl;
2004  cout<<"number of HFHAD rechits : "<<rechitsHFHAD_.size()<<endl;
2005  cout<<"number of HF Cleaned rechits : "<<rechitsCLEANED_.size()<<endl;
2006  cout<<"number of PS rechits : "<<rechitsPS_.size()<<endl;
2007  }
2008 
2009  if( doClustering_ ) {
2010  clustering();
2011 
2012  } else if( verbosity_ == VERBOSE ) {
2013  cout<<"clustering is OFF - clusters come from the input file"<<endl;
2014  }
2015 
2016  if(verbosity_ == VERBOSE ) {
2017  if(clustersECAL_.get() ) {
2018  cout<<"number of ECAL clusters : "<<clustersECAL_->size()<<endl;
2019  }
2020  if(clustersHCAL_.get() ) {
2021  cout<<"number of HCAL clusters : "<<clustersHCAL_->size()<<endl;
2022  }
2023 
2024  if(useHO_ && clustersHO_.get() ) {
2025  cout<<"number of HO clusters : "<<clustersHO_->size()<<endl;
2026  }
2027 
2028  if(clustersHFEM_.get() ) {
2029  cout<<"number of HFEM clusters : "<<clustersHFEM_->size()<<endl;
2030  }
2031  if(clustersHFHAD_.get() ) {
2032  cout<<"number of HFHAD clusters : "<<clustersHFHAD_->size()<<endl;
2033  }
2034  if(clustersPS_.get() ) {
2035  cout<<"number of PS clusters : "<<clustersPS_->size()<<endl;
2036  }
2037  }
2038 
2039  if(doParticleFlow_) {
2040  particleFlow();
2041  if (doCompare_) pfCandCompare(entry);
2042  }
2043 
2044  if(doJets_) {
2048  }
2049 
2050  // call print() in verbose mode
2051  if( verbosity_ == VERBOSE ) print();
2052 
2053  //COLIN the PFJet and PFMET benchmarks are very messy.
2054  //COLIN compare with the filling of the PFCandidateBenchmark, which is one line.
2055 
2056  goodevent = eventAccepted();
2057 
2058  // evaluate PFJet Benchmark
2059  if(doPFJetBenchmark_) { // start PFJet Benchmark
2060 
2062  double resPt = PFJetBenchmark_.resPtMax();
2063  double resChargedHadEnergy = PFJetBenchmark_.resChargedHadEnergyMax();
2064  double resNeutralHadEnergy = PFJetBenchmark_.resNeutralHadEnergyMax();
2065  double resNeutralEmEnergy = PFJetBenchmark_.resNeutralEmEnergyMax();
2066 
2067  if( verbosity_ == VERBOSE ){ //start debug print
2068 
2069  cout << " =====================PFJetBenchmark =================" << endl;
2070  cout<<"Resol Pt max "<<resPt
2071  <<" resChargedHadEnergy Max " << resChargedHadEnergy
2072  <<" resNeutralHadEnergy Max " << resNeutralHadEnergy
2073  << " resNeutralEmEnergy Max "<< resNeutralEmEnergy << endl;
2074  } // end debug print
2075 
2076  // PJ : printout for bad events (selected by the "if")
2077  /*
2078  if ( fabs(resPt) > 0.4 )
2079  std::cout << "'" << iEvent.id().run() << ":" << iEvent.id().event() << "-"
2080  << iEvent.id().run() << ":" << iEvent.id().event() << "'," << std::endl;
2081  */
2082  if ( resPt < -1. ) {
2083  cout << " =====================PFJetBenchmark =================" << endl;
2084  cout<<"process entry "<< entry << endl;
2085  cout<<"Resol Pt max "<<resPt
2086  <<" resChargedHadEnergy Max " << resChargedHadEnergy
2087  <<" resNeutralHadEnergy Max " << resNeutralHadEnergy
2088  << " resNeutralEmEnergy Max "<< resNeutralEmEnergy
2089  << " Jet pt " << genJets_[0].pt() << endl;
2090  // return true;
2091  } else {
2092  // return false;
2093  }
2094  // if (resNeutralEmEnergy>0.5) return true;
2095  // else return false;
2096  }// end PFJet Benchmark
2097 
2098  // Addition to have DQM histograms : by S. Dutta
2099  reco::MET reComputedMet_;
2100  reco::MET computedGenMet_;
2101  //-----------------------------------------------
2102 
2103  //COLIN would be nice to move this long code to a separate function.
2104  // is it necessary to re-set everything at each event??
2105  if(doPFMETBenchmark_) { // start PFMet Benchmark
2106 
2107  // Fill here the various met benchmarks
2108  // pfMET vs GenMET
2109  metManager_->setMET1(&genParticlesCMSSW_);
2110  metManager_->setMET2(&pfMetsCMSSW_[0]);
2111  metManager_->FillHisto("PF");
2112  // cout events in tail
2113  metManager_->coutTailEvents(entry,DeltaMETcut,DeltaPhicut, MET1cut);
2114 
2115  // caloMET vs GenMET
2116  metManager_->setMET2(&caloMetsCMSSW_[0]);
2117  metManager_->FillHisto("Calo");
2118 
2119  if ( doMet_ ) {
2120  // recomputed pfMET vs GenMET
2121  metManager_->setMET2(*pfCandidates_);
2122  metManager_->FillHisto("recompPF");
2123  metManager_->coutTailEvents(entry,DeltaMETcut,DeltaPhicut, MET1cut);
2124  }
2125 
2126  if (JECinCaloMet_)
2127  {
2128  // corrCaloMET vs GenMET
2129  metManager_->setMET2(&caloMetsCMSSW_[0]);
2130  metManager_->propagateJECtoMET2(caloJetsCMSSW_, corrcaloJetsCMSSW_);
2131  metManager_->FillHisto("corrCalo");
2132  }
2133  }// end PFMET Benchmark
2134 
2135  if( goodevent && doPFCandidateBenchmark_ ) {
2137  }
2138 
2139  // Addition to have DQM histograms : by S. Dutta
2140  if( goodevent && doPFDQM_ ) {
2141  float deltaMin, deltaMax;
2142  pfJetMonitor_.fill( pfJets_, genJets_, deltaMin, deltaMax);
2143  if (doPFMETBenchmark_) {
2144  pfMETMonitor_.fillOne( reComputedMet_, computedGenMet_, deltaMin, deltaMax);
2145  }
2146  }
2147  //-----------------------------------------------
2148  // evaluate tau Benchmark
2149  if( goodevent && doTauBenchmark_) { // start tau Benchmark
2150  double deltaEt = 0.;
2151  deltaEt = tauBenchmark( *pfCandidates_ );
2152  if( verbosity_ == VERBOSE ) cout<<"delta E_t ="<<deltaEt <<endl;
2153  // cout<<"delta E_t ="<<deltaEt<<" delta E_t Other ="<<deltaEt1<<endl;
2154 
2155 
2156  // if( deltaEt>0.4 ) {
2157  // cout<<deltaEt<<endl;
2158  // return true;
2159  // }
2160  // else return false;
2161 
2162 
2163  } // end tau Benchmark
2164 
2165  if(goodevent && outTree_)
2166  outTree_->Fill();
2167 
2168  if(calibFile_)
2170 
2171  return goodevent;
2172 
2173 }
2174 
2175 
2176 
2178  // return highPtJet(10);
2179  //return highPtPFCandidate( 10, PFCandidate::h );
2180  return true;
2181 }
2182 
2184  for( unsigned i=0; i<pfJets_.size(); ++i) {
2185  if( pfJets_[i].pt() > ptMin ) return true;
2186  }
2187  return false;
2188 }
2189 
2192  for( unsigned i=0; i<pfCandidates_->size(); ++i) {
2193 
2194  const PFCandidate& pfc = (*pfCandidates_)[i];
2195  if(type!= PFCandidate::X &&
2196  pfc.particleId() != type ) continue;
2197  if( pfc.pt() > ptMin ) return true;
2198  }
2199  return false;
2200 }
2201 
2202 
2204 
2205  if (verbosity_ == VERBOSE ) {
2206  cout <<"start reading from simulation"<<endl;
2207  }
2208 
2209 
2210  // if(!tree_) return false;
2211 
2212  const edm::EventBase& iEvent = *ev_;
2213 
2214 
2215  bool foundstdTracks = iEvent.getByLabel(stdTracksTag_,stdTracksHandle_);
2216  if ( foundstdTracks ) {
2218  // cout << "Found " << stdTracks_.size() << " standard tracks" << endl;
2219  } else {
2220  cerr<<"PFRootEventManager::ProcessEntry : stdTracks Collection not found : "
2221  <<entry << " " << stdTracksTag_<<endl;
2222  }
2223 
2224  bool foundMCTruth = iEvent.getByLabel(MCTruthTag_,MCTruthHandle_);
2225  if ( foundMCTruth ) {
2227  // cout << "Found MC truth" << endl;
2228  } else {
2229  // cerr<<"PFRootEventManager::ProcessEntry : MCTruth Collection not found : "
2230  // <<entry << " " << MCTruthTag_<<endl;
2231  }
2232 
2233  bool foundTP = iEvent.getByLabel(trueParticlesTag_,trueParticlesHandle_);
2234  if ( foundTP ) {
2236  // cout << "Found " << trueParticles_.size() << " true particles" << endl;
2237  } else {
2238  //cerr<<"PFRootEventManager::ProcessEntry : trueParticles Collection not found : "
2239  // <<entry << " " << trueParticlesTag_<<endl;
2240  }
2241 
2242  bool foundECAL = iEvent.getByLabel(rechitsECALTag_,rechitsECALHandle_);
2243  if ( foundECAL ) {
2245  // cout << "Found " << rechitsECAL_.size() << " ECAL rechits" << endl;
2246  } else {
2247  cerr<<"PFRootEventManager::ProcessEntry : rechitsECAL Collection not found : "
2248  <<entry << " " << rechitsECALTag_<<endl;
2249  }
2250 
2251  bool foundHCAL = iEvent.getByLabel(rechitsHCALTag_,rechitsHCALHandle_);
2252  if ( foundHCAL ) {
2254  // cout << "Found " << rechitsHCAL_.size() << " HCAL rechits" << endl;
2255  } else {
2256  cerr<<"PFRootEventManager::ProcessEntry : rechitsHCAL Collection not found : "
2257  <<entry << " " << rechitsHCALTag_<<endl;
2258  }
2259 
2260  if (useHO_) {
2261  bool foundHO = iEvent.getByLabel(rechitsHOTag_,rechitsHOHandle_);
2262  if ( foundHO ) {
2264  // cout << "Found " << rechitsHO_.size() << " HO rechits" << endl;
2265  } else {
2266  cerr<<"PFRootEventManager::ProcessEntry : rechitsHO Collection not found : "
2267  <<entry << " " << rechitsHOTag_<<endl;
2268  }
2269  }
2270 
2271  bool foundHFEM = iEvent.getByLabel(rechitsHFEMTag_,rechitsHFEMHandle_);
2272  if ( foundHFEM ) {
2274  // cout << "Found " << rechitsHFEM_.size() << " HFEM rechits" << endl;
2275  } else {
2276  cerr<<"PFRootEventManager::ProcessEntry : rechitsHFEM Collection not found : "
2277  <<entry << " " << rechitsHFEMTag_<<endl;
2278  }
2279 
2280  bool foundHFHAD = iEvent.getByLabel(rechitsHFHADTag_,rechitsHFHADHandle_);
2281  if ( foundHFHAD ) {
2283  // cout << "Found " << rechitsHFHAD_.size() << " HFHAD rechits" << endl;
2284  } else {
2285  cerr<<"PFRootEventManager::ProcessEntry : rechitsHFHAD Collection not found : "
2286  <<entry << " " << rechitsHFHADTag_<<endl;
2287  }
2288 
2289  for ( unsigned i=0; i<rechitsCLEANEDTags_.size(); ++i ) {
2290  bool foundCLEANED = iEvent.getByLabel(rechitsCLEANEDTags_[i],
2292  if ( foundCLEANED ) {
2294  // cout << "Found " << rechitsCLEANEDV_[i].size() << " CLEANED rechits" << endl;
2295  } else {
2296  cerr<<"PFRootEventManager::ProcessEntry : rechitsCLEANED Collection not found : "
2297  <<entry << " " << rechitsCLEANEDTags_[i]<<endl;
2298  }
2299 
2300  }
2301 
2302  bool foundPS = iEvent.getByLabel(rechitsPSTag_,rechitsPSHandle_);
2303  if ( foundPS ) {
2305  // cout << "Found " << rechitsPS_.size() << " PS rechits" << endl;
2306  } else {
2307  cerr<<"PFRootEventManager::ProcessEntry : rechitsPS Collection not found : "
2308  <<entry << " " << rechitsPSTag_<<endl;
2309  }
2310 
2311  bool foundCT = iEvent.getByLabel(caloTowersTag_,caloTowersHandle_);
2312  if ( foundCT ) {
2314  // cout << "Found " << caloTowers_.size() << " calo Towers" << endl;
2315  } else {
2316  cerr<<"PFRootEventManager::ProcessEntry : caloTowers Collection not found : "
2317  <<entry << " " << caloTowersTag_<<endl;
2318  }
2319 
2320  bool foundPV = iEvent.getByLabel(primaryVerticesTag_,primaryVerticesHandle_);
2321  if ( foundPV ) {
2323  // cout << "Found " << primaryVertices_.size() << " primary vertices" << endl;
2324  } else {
2325  cerr<<"PFRootEventManager::ProcessEntry : primaryVertices Collection not found : "
2326  <<entry << " " << primaryVerticesTag_<<endl;
2327  }
2328 
2329 
2331  if ( foundPFV ) {
2333  // cout << "Found " << pfNuclearTrackerVertex_.size() << " secondary PF vertices" << endl;
2334  } else if ( usePFNuclearInteractions_ ) {
2335  cerr<<"PFRootEventManager::ProcessEntry : pfNuclearTrackerVertex Collection not found : "
2336  <<entry << " " << pfNuclearTrackerVertexTag_<<endl;
2337  }
2338 
2339  bool foundrecTracks = iEvent.getByLabel(recTracksTag_,recTracksHandle_);
2340  if ( foundrecTracks ) {
2342  // cout << "Found " << recTracks_.size() << " PFRecTracks" << endl;
2343  } else {
2344  cerr<<"PFRootEventManager::ProcessEntry : recTracks Collection not found : "
2345  <<entry << " " << recTracksTag_<<endl;
2346  }
2347 
2348  bool founddisplacedRecTracks = iEvent.getByLabel(displacedRecTracksTag_,displacedRecTracksHandle_);
2349  if ( founddisplacedRecTracks ) {
2351  // cout << "Found " << displacedRecTracks_.size() << " PFRecTracks" << endl;
2352  } else {
2353  cerr<<"PFRootEventManager::ProcessEntry : displacedRecTracks Collection not found : "
2354  <<entry << " " << displacedRecTracksTag_<<endl;
2355  }
2356 
2357 
2358  bool foundgsfrecTracks = iEvent.getByLabel(gsfrecTracksTag_,gsfrecTracksHandle_);
2359  if ( foundgsfrecTracks ) {
2361  // cout << "Found " << gsfrecTracks_.size() << " GsfPFRecTracks" << endl;
2362  } else {
2363  cerr<<"PFRootEventManager::ProcessEntry : gsfrecTracks Collection not found : "
2364  <<entry << " " << gsfrecTracksTag_<<endl;
2365  }
2366 
2367  bool foundconvBremGsfrecTracks = iEvent.getByLabel(convBremGsfrecTracksTag_,convBremGsfrecTracksHandle_);
2368  if ( foundconvBremGsfrecTracks ) {
2370  // cout << "Found " << convBremGsfrecTracks_.size() << " ConvBremGsfPFRecTracks" << endl;
2371  } else if ( useConvBremGsfTracks_ ) {
2372  cerr<<"PFRootEventManager::ProcessEntry : convBremGsfrecTracks Collection not found : "
2373  <<entry << " " << convBremGsfrecTracksTag_<<endl;
2374  }
2375 
2376  bool foundmuons = iEvent.getByLabel(muonsTag_,muonsHandle_);
2377  if ( foundmuons ) {
2378  muons_ = *muonsHandle_;
2379  /*
2380  cout << "Found " << muons_.size() << " muons" << endl;
2381  for ( unsigned imu=0; imu<muons_.size(); ++imu ) {
2382  std::cout << " Muon " << imu << ":" << std::endl;
2383  reco::MuonRef muonref( &muons_, imu );
2384  PFMuonAlgo::printMuonProperties(muonref);
2385  }
2386  */
2387  } else {
2388  cerr<<"PFRootEventManager::ProcessEntry : muons Collection not found : "
2389  <<entry << " " << muonsTag_<<endl;
2390  }
2391 
2392  bool foundconversion = iEvent.getByLabel(conversionTag_,conversionHandle_);
2393  if ( foundconversion ) {
2395  // cout << "Found " << conversion_.size() << " conversion" << endl;
2396  } else if ( usePFConversions_ ) {
2397  cerr<<"PFRootEventManager::ProcessEntry : conversion Collection not found : "
2398  <<entry << " " << conversionTag_<<endl;
2399  }
2400 
2401 
2402 
2403  bool foundv0 = iEvent.getByLabel(v0Tag_,v0Handle_);
2404  if ( foundv0 ) {
2405  v0_ = *v0Handle_;
2406  // cout << "Found " << v0_.size() << " v0" << endl;
2407  } else if ( usePFV0s_ ) {
2408  cerr<<"PFRootEventManager::ProcessEntry : v0 Collection not found : "
2409  <<entry << " " << v0Tag_<<endl;
2410  }
2411 
2412  if(useEGPhotons_) {
2413  bool foundPhotons = iEvent.getByLabel(photonTag_,photonHandle_);
2414  if ( foundPhotons) {
2415  photons_ = *photonHandle_;
2416  } else {
2417  cerr <<"PFRootEventManager::ProcessEntry : photon collection not found : "
2418  << entry << " " << photonTag_ << endl;
2419  }
2420  }
2421 
2422  if(useEGElectrons_) {
2423  bool foundElectrons = iEvent.getByLabel(egammaElectronsTag_,egammaElectronHandle_);
2424  if ( foundElectrons) {
2425  // std::cout << " Found collection " << std::endl;
2427  } else
2428  {
2429  cerr <<"PFRootEventManager::ProcessEntry : electron collection not found : "
2430  << entry << " " << egammaElectronsTag_ << endl;
2431  }
2432  }
2433 
2434  bool foundgenJets = iEvent.getByLabel(genJetsTag_,genJetsHandle_);
2435  if ( foundgenJets ) {
2437  // cout << "Found " << genJetsCMSSW_.size() << " genJets" << endl;
2438  } else {
2439  //cerr<<"PFRootEventManager::ProcessEntry : genJets Collection not found : "
2440  // <<entry << " " << genJetsTag_<<endl;
2441  }
2442 
2443  bool foundgenParticlesforJets = iEvent.getByLabel(genParticlesforJetsTag_,genParticlesforJetsHandle_);
2444  if ( foundgenParticlesforJets ) {
2446  // cout << "Found " << genParticlesforJets_.size() << " genParticlesforJets" << endl;
2447  } else {
2448  //cerr<<"PFRootEventManager::ProcessEntry : genParticlesforJets Collection not found : "
2449  // <<entry << " " << genParticlesforJetsTag_<<endl;
2450  }
2451 
2452  bool foundgenParticlesforMET = iEvent.getByLabel(genParticlesforMETTag_,genParticlesforMETHandle_);
2453  if ( foundgenParticlesforMET ) {
2455  // cout << "Found " << genParticlesCMSSW_.size() << " genParticlesforMET" << endl;
2456  } else {
2457  //cerr<<"PFRootEventManager::ProcessEntry : genParticlesforMET Collection not found : "
2458  // <<entry << " " << genParticlesforMETTag_<<endl;
2459  }
2460 
2461  bool foundcaloJets = iEvent.getByLabel(caloJetsTag_,caloJetsHandle_);
2462  if ( foundcaloJets ) {
2464  // cout << "Found " << caloJetsCMSSW_.size() << " caloJets" << endl;
2465  } else {
2466  cerr<<"PFRootEventManager::ProcessEntry : caloJets Collection not found : "
2467  <<entry << " " << caloJetsTag_<<endl;
2468  }
2469 
2470  bool foundcorrcaloJets = iEvent.getByLabel(corrcaloJetsTag_,corrcaloJetsHandle_);
2471  if ( foundcorrcaloJets ) {
2473  // cout << "Found " << corrcaloJetsCMSSW_.size() << " corrcaloJets" << endl;
2474  } else {
2475  //cerr<<"PFRootEventManager::ProcessEntry : corrcaloJets Collection not found : "
2476  // <<entry << " " << corrcaloJetsTag_<<endl;
2477  }
2478 
2479  bool foundpfJets = iEvent.getByLabel(pfJetsTag_,pfJetsHandle_);
2480  if ( foundpfJets ) {
2482  // cout << "Found " << pfJetsCMSSW_.size() << " PFJets" << endl;
2483  } else {
2484  cerr<<"PFRootEventManager::ProcessEntry : PFJets Collection not found : "
2485  <<entry << " " << pfJetsTag_<<endl;
2486  }
2487 
2488  bool foundpfCands = iEvent.getByLabel(pfCandidateTag_,pfCandidateHandle_);
2489  if ( foundpfCands ) {
2491  // cout << "Found " << pfCandCMSSW_.size() << " PFCandidates" << endl;
2492  } else {
2493  cerr<<"PFRootEventManager::ProcessEntry : PFCandidate Collection not found : "
2494  <<entry << " " << pfCandidateTag_<<endl;
2495  }
2496 
2497  bool foundpfMets = iEvent.getByLabel(pfMetsTag_,pfMetsHandle_);
2498  if ( foundpfMets ) {
2500  //cout << "Found " << pfMetsCMSSW_.size() << " PFMets" << endl;
2501  } else {
2502  cerr<<"PFRootEventManager::ProcessEntry : PFMets Collection not found : "
2503  <<entry << " " << pfMetsTag_<<endl;
2504  }
2505 
2506  bool foundtcMets = iEvent.getByLabel(tcMetsTag_,tcMetsHandle_);
2507  if ( foundtcMets ) {
2509  //cout << "Found " << tcMetsCMSSW_.size() << " TCMets" << endl;
2510  } else {
2511  cerr<<"TCRootEventManager::ProcessEntry : TCMets Collection not found : "
2512  <<entry << " " << tcMetsTag_<<endl;
2513  }
2514 
2515  bool foundcaloMets = iEvent.getByLabel(caloMetsTag_,caloMetsHandle_);
2516  if ( foundcaloMets ) {
2518  //cout << "Found " << caloMetsCMSSW_.size() << " CALOMets" << endl;
2519  } else {
2520  cerr<<"CALORootEventManager::ProcessEntry : CALOMets Collection not found : "
2521  <<entry << " " << caloMetsTag_<<endl;
2522  }
2523 
2524  // now can use the tree
2525 
2526  bool goodevent = true;
2527  if(trueParticles_.size() ) {
2528  // this is a filter to select single particle events.
2530  trueParticles_.size() != filterNParticles_ ) {
2531  cout << "PFRootEventManager : event discarded Nparticles="
2532  <<filterNParticles_<< endl;
2533  goodevent = false;
2534  }
2535  if(goodevent && doTauBenchmark_ && filterHadronicTaus_ && !isHadronicTau() ) {
2536  cout << "PFRootEventManager : leptonic tau discarded " << endl;
2537  goodevent = false;
2538  }
2539  if( goodevent && doTauBenchmark_ && !filterTaus_.empty()
2540  && !countChargedAndPhotons() ) {
2541  assert( filterTaus_.size() == 2 );
2542  cout <<"PFRootEventManager : tau discarded: "
2543  <<"number of charged and neutral particles different from "
2544  <<filterTaus_[0]<<","<<filterTaus_[1]<<endl;
2545  goodevent = false;
2546  }
2547 
2548  if(goodevent)
2550 
2551  }
2552 
2553  // if(caloTowersBranch_) {
2554  // if(goodevent)
2555  // fillOutEventWithCaloTowers( caloTowers_ );
2556  // }
2557 
2558  if(rechitsECAL_.size()) {
2560  }
2561  if(rechitsHCAL_.size()) {
2563  }
2564 
2565  if (useHO_) {
2566  if(rechitsHO_.size()) {
2568  }
2569  }
2570 
2571  if(rechitsHFEM_.size()) {
2573  }
2574  if(rechitsHFHAD_.size()) {
2576  }
2577  rechitsCLEANED_.clear();
2578  for ( unsigned i=0; i<rechitsCLEANEDV_.size(); ++i ) {
2579  if(rechitsCLEANEDV_[i].size()) {
2581  for ( unsigned j=0; j<rechitsCLEANEDV_[i].size(); ++j ) {
2582  rechitsCLEANED_.push_back( (rechitsCLEANEDV_[i])[j] );
2583  }
2584  }
2585  }
2586 
2587  if(rechitsPS_.size()) {
2589  }
2590 
2591  /*
2592  if ( recTracks_.size() ) {
2593  PreprocessRecTracks( recTracks_);
2594  }
2595 
2596  if ( displacedRecTracks_.size() ) {
2597  // cout << "preprocessing rec tracks" << endl;
2598  PreprocessRecTracks( displacedRecTracks_);
2599  }
2600 
2601 
2602  if(gsfrecTracks_.size()) {
2603  PreprocessRecTracks( gsfrecTracks_);
2604  }
2605 
2606  if(convBremGsfrecTracks_.size()) {
2607  PreprocessRecTracks( convBremGsfrecTracks_);
2608  }
2609  */
2610 
2611  return goodevent;
2612 }
2613 
2614 
2616 
2617  for ( unsigned i=0; i < trueParticles_.size(); i++) {
2618  const reco::PFSimParticle& ptc = trueParticles_[i];
2619  const std::vector<int>& ptcdaughters = ptc.daughterIds();
2620  if (std::abs(ptc.pdgCode()) == 15) {
2621  for ( unsigned int dapt=0; dapt < ptcdaughters.size(); ++dapt) {
2622 
2623  const reco::PFSimParticle& daughter
2624  = trueParticles_[ptcdaughters[dapt]];
2625 
2626 
2627  int pdgdaugther = daughter.pdgCode();
2628  int abspdgdaughter = std::abs(pdgdaugther);
2629 
2630 
2631  if (abspdgdaughter == 11 ||
2632  abspdgdaughter == 13) {
2633  return false;
2634  }//electron or muons?
2635  }//loop daughter
2636  }//tau
2637  }//loop particles
2638 
2639 
2640  return true;
2641 }
2642 
2643 
2644 
2646 
2647  int nPhoton = 0;
2648  int nCharged = 0;
2649 
2650  for ( unsigned i=0; i < trueParticles_.size(); i++) {
2651  const reco::PFSimParticle& ptc = trueParticles_[i];
2652 
2653  const std::vector<int>& daughters = ptc.daughterIds();
2654 
2655  // if the particle decays before ECAL, we do not want to
2656  // consider it.
2657  if(!daughters.empty() ) continue;
2658 
2659  double charge = ptc.charge();
2660  double pdgCode = ptc.pdgCode();
2661 
2662  if( std::abs(charge)>1e-9)
2663  nCharged++;
2664  else if( pdgCode==22 )
2665  nPhoton++;
2666  }
2667 
2668  // const HepMC::GenEvent* myGenEvent = MCTruth_.GetEvent();
2669  // if(!myGenEvent) {
2670  // cerr<<"impossible to filter on the number of charged and "
2671  // <<"neutral particles without the HepMCProduct. "
2672  // <<"Please check that the branch edmHepMCProduct_*_*_* is found"<<endl;
2673  // exit(1);
2674  // }
2675 
2676  // for ( HepMC::GenEvent::particle_const_iterator
2677  // piter = myGenEvent->particles_begin();
2678  // piter != myGenEvent->particles_end();
2679  // ++piter ) {
2680 
2681  // const HepMC::GenParticle* p = *piter;
2682  // int partId = p->pdg_id();Long64_t lines = T->ReadFile("mon_fichier","i:j:k:x:y:z");
2683 
2684  // // pdgTable_->GetParticle( partId )->Print();
2685 
2686  // int charge = chargeValue(partId);
2687  // cout<<partId <<" "<<charge/3.<<endl;
2688 
2689  // if(charge)
2690  // nCharged++;
2691  // else
2692  // nNeutral++;
2693  // }
2694 
2695  if( nCharged == filterTaus_[0] &&
2696  nPhoton == filterTaus_[1] )
2697  return true;
2698  else
2699  return false;
2700 }
2701 
2702 
2703 
2704 int PFRootEventManager::chargeValue(const int& Id) const {
2705 
2706 
2707  //...Purpose: to give three times the charge for a particle/parton.
2708 
2709  // ID = particle ID
2710  // hepchg = particle charge times 3
2711 
2712  int kqa,kq1,kq2,kq3,kqj,irt,kqx,kqn;
2713  int hepchg;
2714 
2715 
2716  int ichg[109]={-1,2,-1,2,-1,2,-1,2,0,0,-3,0,-3,0,-3,0,
2717  -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,
2718  -3,0,-3,0,-3,0,0,0,0,0,-1,2,-1,2,-1,2,0,0,0,0,
2719  -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};
2720 
2721 
2722  //...Initial values. Simple case of direct readout.
2723  hepchg=0;
2724  kqa=std::abs(Id);
2725  kqn=kqa/1000000000%10;
2726  kqx=kqa/1000000%10;
2727  kq3=kqa/1000%10;
2728  kq2=kqa/100%10;
2729  kq1=kqa/10%10;
2730  kqj=kqa%10;
2731  irt=kqa%10000;
2732 
2733  //...illegal or ion
2734  //...set ion charge to zero - not enough information
2735  if(kqa==0 || kqa >= 10000000) {
2736 
2737  if(kqn==1) {hepchg=0;}
2738  }
2739  //... direct translation
2740  else if(kqa<=100) {hepchg = ichg[kqa-1];}
2741  //... deuteron or tritium
2742  else if(kqa==100 || kqa==101) {hepchg = -3;}
2743  //... alpha or He3
2744  else if(kqa==102 || kqa==104) {hepchg = -6;}
2745  //... KS and KL (and undefined)
2746  else if(kqj == 0) {hepchg = 0;}
2747  //C... direct translation
2748  else if(kqx>0 && irt<100)
2749  {
2750  hepchg = ichg[irt-1];
2751  if(kqa==1000017 || kqa==1000018) {hepchg = 0;}
2752  if(kqa==1000034 || kqa==1000052) {hepchg = 0;}
2753  if(kqa==1000053 || kqa==1000054) {hepchg = 0;}
2754  if(kqa==5100061 || kqa==5100062) {hepchg = 6;}
2755  }
2756  //...Construction from quark content for heavy meson, diquark, baryon.
2757  //...Mesons.
2758  else if(kq3==0)
2759  {
2760  hepchg = ichg[kq2-1]-ichg[kq1-1];
2761  //...Strange or beauty mesons.
2762  if((kq2==3) || (kq2==5)) {hepchg = ichg[kq1-1]-ichg[kq2-1];}
2763  }
2764  else if(kq1 == 0) {
2765  //...Diquarks.
2766  hepchg = ichg[kq3-1] + ichg[kq2-1];
2767  }
2768 
2769  else{
2770  //...Baryons
2771  hepchg = ichg[kq3-1]+ichg[kq2-1]+ichg[kq1-1];
2772  }
2773 
2774  //... fix sign of charge
2775  if(Id<0 && hepchg!=0) {hepchg = -1*hepchg;}
2776 
2777  // cout << hepchg<< endl;
2778  return hepchg;
2779 }
2780 
2781 
2782 
2783 void
2785  /*
2786  for( unsigned i=0; i<recTracks.size(); ++i ) {
2787  recTracks[i].calculatePositionREP();
2788  }
2789  */
2790 }
2791 
2792 void
2794  /*
2795  for( unsigned i=0; i<recTracks.size(); ++i ) {
2796  recTracks[i].calculatePositionREP();
2797  recTracks[i].calculateBremPositionREP();
2798  }
2799  */
2800 }
2801 
2802 
2803 
2804 void
2806  bool findNeighbours) {
2807 
2808 
2809  map<unsigned, unsigned> detId2index;
2810 
2811  for(unsigned i=0; i<rechits.size(); i++) {
2812  rechits[i].calculatePositionREP();
2813 
2814  if(findNeighbours)
2815  detId2index.insert( make_pair(rechits[i].detId(), i) );
2816  }
2817 
2818  if(findNeighbours) {
2819  for(unsigned i=0; i<rechits.size(); i++) {
2820  setRecHitNeigbours( rechits[i], detId2index );
2821  }
2822  }
2823 }
2824 
2825 
2828  const map<unsigned, unsigned>& detId2index ) {
2829 
2830  rh.clearNeighbours();
2831 
2832  vector<unsigned> neighbours4DetId = rh.neighboursIds4();
2833  vector<unsigned> neighbours8DetId = rh.neighboursIds8();
2834 
2835  for( unsigned i=0; i<neighbours4DetId.size(); i++) {
2836  unsigned detId = neighbours4DetId[i];
2837  // cout<<"finding n for detId "<<detId<<endl;
2838  const map<unsigned, unsigned>::const_iterator& it = detId2index.find(detId);
2839 
2840  if(it != detId2index.end() ) {
2841  // cout<<"found n index "<<it->second<<endl;
2842  rh.add4Neighbour( it->second );
2843  }
2844  }
2845 
2846  for( unsigned i=0; i<neighbours8DetId.size(); i++) {
2847  unsigned detId = neighbours8DetId[i];
2848  // cout<<"finding n for detId "<<detId<<endl;
2849  const map<unsigned, unsigned>::const_iterator& it = detId2index.find(detId);
2850 
2851  if(it != detId2index.end() ) {
2852  // cout<<"found n index "<<it->second<<endl;
2853  rh.add8Neighbour( it->second );
2854  }
2855  }
2856 
2857 
2858 }
2859 
2860 
2862 
2863  if (verbosity_ == VERBOSE ) {
2864  cout <<"start clustering"<<endl;
2865  }
2866 
2867  vector<bool> mask;
2868  // ECAL clustering -------------------------------------------
2869 
2870  fillRecHitMask( mask, rechitsECAL_ );
2873 
2874  assert(clustersECAL_.get() );
2875 
2877 
2878  // HCAL clustering -------------------------------------------
2879 
2880  fillRecHitMask( mask, rechitsHCAL_ );
2883 
2885 
2886  // HO clustering -------------------------------------------
2887 
2888  if (useHO_) {
2889  fillRecHitMask( mask, rechitsHO_ );
2890 
2892 
2894 
2896  }
2897 
2898  // HF clustering -------------------------------------------
2899 
2900  fillRecHitMask( mask, rechitsHFEM_ );
2903 
2904  fillRecHitMask( mask, rechitsHFHAD_ );
2907 
2908  // PS clustering -------------------------------------------
2909 
2910  fillRecHitMask( mask, rechitsPS_ );
2913 
2915 
2916 }
2917 
2918 
2919 
2920 void
2922  clusters) {
2923 
2924  if(!outEvent_) return;
2925 
2926  for(unsigned i=0; i<clusters.size(); i++) {
2927  EventColin::Cluster cluster;
2928  cluster.eta = clusters[i].position().Eta();
2929  cluster.phi = clusters[i].position().Phi();
2930  cluster.e = clusters[i].energy();
2931  cluster.layer = clusters[i].layer();
2932  if (!useHO_ && cluster.layer==PFLayer::HCAL_BARREL2) continue;
2933  cluster.type = 1;
2934 
2937  switch( clusters[i].layer() ) {
2938  case PFLayer::ECAL_BARREL:
2939  case PFLayer::ECAL_ENDCAP:
2941  break;
2942  case PFLayer::HCAL_BARREL1:
2943  case PFLayer::HCAL_ENDCAP:
2945  break;
2946 
2947  case PFLayer::HCAL_BARREL2:
2949  break;
2950 
2951  default:
2952  break;
2953  }
2954  if(tpLayer < reco::PFTrajectoryPoint::NLayers) {
2955  try {
2956  double peta = -10;
2957  double phi = -10;
2958  double pe = -10;
2959 
2960  const reco::PFSimParticle& ptc
2961  = closestParticle( tpLayer,
2962  cluster.eta, cluster.phi,
2963  peta, phi, pe );
2964 
2965 
2966  cluster.particle.eta = peta;
2967  cluster.particle.phi = phi;
2968  cluster.particle.e = pe;
2969  cluster.particle.pdgCode = ptc.pdgCode();
2970 
2971 
2972  }
2973  catch( std::exception& err ) {
2974  // cerr<<err.what()<<endl;
2975  }
2976  }
2977 
2978  outEvent_->addCluster(cluster);
2979  }
2980 }
2981 
2982 
2983 void
2985 
2986  if(!outEvent_) return;
2987 
2988  for ( unsigned i=0; i < trueParticles.size(); i++) {
2989 
2990  const reco::PFSimParticle& ptc = trueParticles[i];
2991 
2992  unsigned ntrajpoints = ptc.nTrajectoryPoints();
2993 
2994  if(ptc.daughterIds().empty() ) { // stable
2997 
2998  if(ntrajpoints == 3) {
2999  // old format for PFSimCandidates.
3000  // in this case, the PFSimCandidate which does not decay
3001  // before ECAL has 3 points: initial, ecal entrance, hcal entrance
3002  ecalEntrance = static_cast<reco::PFTrajectoryPoint::LayerType>(1);
3003  }
3004  // else continue; // endcap case we do not care;
3005 
3006  const reco::PFTrajectoryPoint& tpatecal
3007  = ptc.extrapolatedPoint( ecalEntrance );
3008 
3009  EventColin::Particle outptc;
3010  outptc.eta = tpatecal.position().Eta();
3011  outptc.phi = tpatecal.position().Phi();
3012  outptc.e = tpatecal.momentum().E();
3013  outptc.pdgCode = ptc.pdgCode();
3014 
3015 
3016  outEvent_->addParticle(outptc);
3017  }
3018  }
3019 }
3020 
3021 void
3023 
3024  if(!outEvent_) return;
3025 
3026  for ( unsigned i=0; i < pfCandidates.size(); i++) {
3027 
3028  const reco::PFCandidate& candidate = pfCandidates[i];
3029 
3030  EventColin::Particle outptc;
3031  outptc.eta = candidate.eta();
3032  outptc.phi = candidate.phi();
3033  outptc.e = candidate.energy();
3034  outptc.pdgCode = candidate.particleId();
3035 
3036 
3037  outEvent_->addCandidate(outptc);
3038  }
3039 }
3040 
3041 
3042 void
3044 
3045  if(!outEvent_) return;
3046 
3047  for ( unsigned i=0; i < cts.size(); i++) {
3048 
3049  const CaloTower& ct = cts[i];
3050 
3051  EventColin::CaloTower outct;
3052  outct.e = ct.energy();
3053  outct.ee = ct.emEnergy();
3054  outct.eh = ct.hadEnergy();
3055 
3056  outEvent_->addCaloTower( outct );
3057  }
3058 }
3059 
3060 
3061 void
3063  blocks ) {
3064 
3065  if(!outEvent_) return;
3066 
3067  for ( unsigned i=0; i < blocks.size(); i++) {
3068 
3069  // const reco::PFBlock& block = blocks[i];
3070 
3071  EventColin::Block outblock;
3072 
3073  outEvent_->addBlock( outblock );
3074  }
3075 }
3076 
3077 
3078 
3080 
3081  if (verbosity_ == VERBOSE ) {
3082  cout <<"start particle flow"<<endl;
3083  }
3084 
3085 
3086  if( debug_) {
3087  cout<<"PFRootEventManager::particleFlow start"<<endl;
3088  // cout<<"number of elements in memory: "
3089  // <<reco::PFBlockElement::instanceCounter()<<endl;
3090  }
3091 
3092 
3094  edm::ProductID(1) );
3095 
3097  edm::ProductID(77) );
3098 
3100  edm::ProductID(2) );
3101 
3103  edm::ProductID(3) );
3104 
3106  edm::ProductID(21) ); //GMA put this four
3107 
3109  edm::ProductID(31) );
3110 
3112  edm::ProductID(32) );
3113 
3115  edm::ProductID(4) );
3116 
3118  edm::ProductID(5) );
3119 
3121  edm::ProductID(6) );
3122 
3124  edm::ProductID(7) );
3125 
3126 
3127  //recoPFRecTracks_pfNuclearTrackerVertex__TEST.
3128 
3130  edm::ProductID(8) );
3131 
3133  edm::ProductID(9) );
3134 
3135 
3137  edm::ProductID(10) );
3138 
3140  edm::ProductID(11) );
3141 
3143 
3146 
3147 
3148  vector<bool> trackMask;
3149  fillTrackMask( trackMask, recTracks_ );
3150  vector<bool> gsftrackMask;
3151  fillTrackMask( gsftrackMask, gsfrecTracks_ );
3152  vector<bool> ecalMask;
3153  fillClusterMask( ecalMask, *clustersECAL_ );
3154  vector<bool> hcalMask;
3155  fillClusterMask( hcalMask, *clustersHCAL_ );
3156 
3157  vector<bool> scmask;
3158 
3159  vector<bool> hoMask;
3160  if (useHO_) {fillClusterMask( hoMask, *clustersHO_ );}
3161 
3162  vector<bool> hfemMask;
3163  fillClusterMask( hfemMask, *clustersHFEM_ );
3164  vector<bool> hfhadMask;
3165  fillClusterMask( hfhadMask, *clustersHFHAD_ );
3166  vector<bool> psMask;
3167  fillClusterMask( psMask, *clustersPS_ );
3168  vector<bool> photonMask;
3169  fillPhotonMask( photonMask, photons_ );
3170 
3171  if ( !useAtHLT_ )
3172  pfBlockAlgo_.setInput( trackh, gsftrackh, convBremGsftrackh,
3173  muonh, nuclearh, displacedtrackh, convh, v0,
3174  ecalh, hcalh, hoh, hfemh, hfhadh, psh,
3175  photonh, ebsch, eesch, trackMask,gsftrackMask,
3176  ecalMask, hcalMask, hoMask, hfemMask, hfhadMask, psMask,photonMask,scmask );
3177  else
3178  pfBlockAlgo_.setInput( trackh, muonh, ecalh, hcalh, hfemh, hfhadh, psh, hoh,
3179  trackMask, ecalMask, hcalMask, hoMask, psMask);
3180 
3182 
3183  if( debug_) cout<<pfBlockAlgo_<<endl;
3184 
3186 
3188  if(useEGElectrons_)
3190 
3192  // pfAlgoOther_.reconstructParticles( blockh );
3193 
3194  // pfAlgo_.postMuonCleaning(muonsHandle_, *vertexh);
3195 
3196 
3197  if(usePFElectrons_) {
3200  pfAlgo_.setElectronExtraRef(electronExtraProd);
3201  }
3202 
3204 
3205  if( debug_) cout<< pfAlgo_<<endl;
3207  // pfCandidatesOther_ = pfAlgoOther_.transferCandidates();
3208 
3210 
3211  if( debug_) cout<<"PFRootEventManager::particleFlow stop"<<endl;
3212 }
3213 
3215 
3216  /*
3217  cout << "ievt " << entry <<" : PFCandidate : "
3218  << " original size : " << pfCandCMSSW_.size()
3219  << " current size : " << pfCandidates_->size() << endl;
3220  */
3221 
3222  bool differentSize = pfCandCMSSW_.size() != pfCandidates_->size();
3223  if ( differentSize ) {
3224  cout << "+++WARNING+++ PFCandidate size changed for entry "
3225  << entry << " !" << endl
3226  << " - original size : " << pfCandCMSSW_.size() << endl
3227  << " - current size : " << pfCandidates_->size() << endl;
3228  } else {
3229  for(unsigned i=0; i<pfCandidates_->size(); i++) {
3230  double deltaE = (*pfCandidates_)[i].energy()-pfCandCMSSW_[i].energy();
3231  double deltaEta = (*pfCandidates_)[i].eta()-pfCandCMSSW_[i].eta();
3232  double deltaPhi = (*pfCandidates_)[i].phi()-pfCandCMSSW_[i].phi();
3233  if ( fabs(deltaE) > 1E-4 ||
3234  fabs(deltaEta) > 1E-9 ||
3235  fabs(deltaPhi) > 1E-9 ) {
3236  cout << "+++WARNING+++ PFCandidate " << i
3237  << " changed for entry " << entry << " ! " << endl
3238  << " - Original : " << pfCandCMSSW_[i] << endl
3239  << " - Current : " << (*pfCandidates_)[i] << endl
3240  << " DeltaE = : " << deltaE << endl
3241  << " DeltaEta = : " << deltaEta << endl
3242  << " DeltaPhi = : " << deltaPhi << endl << endl;
3243  }
3244  }
3245  }
3246 }
3247 
3248 
3250 
3251  if (verbosity_ == VERBOSE || jetsDebug_) {
3252  cout<<endl;
3253  cout<<"start reconstruct GenJets --- "<<endl;
3254  cout<< " input gen particles for jet: all neutrinos removed ; muons present" << endl;
3255  }
3256 
3257  genJets_.clear();
3259 
3260  if ( !genParticlesforJets_.size() ) return;
3261 
3262  for(unsigned i=0; i<genParticlesforJets_.size(); i++) {
3263 
3264  const reco::GenParticle& genPart = *(genParticlesforJets_[i]);
3265 
3266  // remove all muons/neutrinos for PFJet studies
3267  // if (reco::isNeutrino( genPart ) || reco::isMuon( genPart )) continue;
3268  // remove all neutrinos for PFJet studies
3269  if (reco::isNeutrino( genPart )) continue;
3270  // Work-around a bug in the pythia di-jet gun.
3271  if (std::abs(genPart.pdgId())<7 || std::abs(genPart.pdgId())==21 ) continue;
3272 
3273  if (jetsDebug_ ) {
3274  cout << " #" << i << " PDG code:" << genPart.pdgId()
3275  << " status " << genPart.status()
3276  << ", p/pt/eta/phi: " << genPart.p() << '/' << genPart.pt()
3277  << '/' << genPart.eta() << '/' << genPart.phi() << endl;
3278  }
3279 
3281  }
3282 
3283  vector<ProtoJet> protoJets;
3285 
3286 
3287  // Convert Protojets to GenJets
3288  int ijet = 0;
3289  typedef vector <ProtoJet>::const_iterator IPJ;
3290  for (IPJ ipj = protoJets.begin(); ipj != protoJets.end (); ipj++) {
3291  const ProtoJet& protojet = *ipj;
3292  const ProtoJet::Constituents& constituents = protojet.getTowerList();
3293 
3294  reco::Jet::Point vertex (0,0,0); // do not have true vertex yet, use default
3296  JetMaker::makeSpecific(constituents, &specific);
3297  // constructor without constituents
3298  GenJet newJet (protojet.p4(), vertex, specific);
3299 
3300  // last step is to copy the constituents into the jet (new jet definition since 18X)
3301  // namespace reco {
3302  //class Jet : public CompositeRefBaseCandidate {
3303  // public:
3304  // typedef reco::CandidateBaseRefVector Constituents;
3305 
3306  ProtoJet::Constituents::const_iterator constituent = constituents.begin();
3307  for (; constituent != constituents.end(); ++constituent) {
3308  // find index of this ProtoJet constituent in the overall collection PFconstit
3309  // see class IndexedCandidate in JetRecoTypes.h
3310  uint index = constituent->index();
3311  newJet.addDaughter( genParticlesforJetsPtrs_[index] );
3312  } // end loop on ProtoJet constituents
3313  // last step: copy ProtoJet Variables into Jet
3314  newJet.setJetArea(protojet.jetArea());
3315  newJet.setPileup(protojet.pileup());
3316  newJet.setNPasses(protojet.nPasses());
3317  ++ijet;
3318  if (jetsDebug_ ) cout<<" gen jet "<<ijet<<" "<<newJet.print()<<endl;
3319  genJets_.push_back (newJet);
3320 
3321  } // end loop on protojets iterator IPJ
3322 
3323 }
3324 
3326 
3327  if (verbosity_ == VERBOSE || jetsDebug_ ) {
3328  cout<<endl;
3329  cout<<"start reconstruct CaloJets --- "<<endl;
3330  }
3331  caloJets_.clear();
3333 
3334  for( unsigned i=0; i<caloTowers_.size(); i++) {
3335  reco::CandidatePtr candPtr( &caloTowers_, i );
3336  caloTowersPtrs_.push_back( candPtr );
3337  }
3338 
3340 
3341  if (jetsDebug_ ) {
3342  for(unsigned ipj=0; ipj<caloJets_.size(); ipj++) {
3343  const ProtoJet& protojet = caloJets_[ipj];
3344  cout<<" calo jet "<<ipj<<" "<<protojet.pt() <<endl;
3345  }
3346  }
3347 
3348 }
3349 
3350 
3352 
3353  if (verbosity_ == VERBOSE || jetsDebug_) {
3354  cout<<endl;
3355  cout<<"start reconstruct PF Jets --- "<<endl;
3356  }
3357  pfJets_.clear();
3359 
3360  for( unsigned i=0; i<pfCandidates_->size(); i++) {
3361  reco::CandidatePtr candPtr( pfCandidates_.get(), i );
3362  pfCandidatesPtrs_.push_back( candPtr );
3363  }
3364 
3365  vector<ProtoJet> protoJets;
3367 
3368  // Convert Protojets to PFJets
3369 
3370  int ijet = 0;
3371  typedef vector <ProtoJet>::const_iterator IPJ;
3372  for (IPJ ipj = protoJets.begin(); ipj != protoJets.end (); ipj++) {
3373  const ProtoJet& protojet = *ipj;
3374  const ProtoJet::Constituents& constituents = protojet.getTowerList();
3375 
3376  reco::Jet::Point vertex (0,0,0); // do not have true vertex yet, use default
3378  JetMaker::makeSpecific(constituents, &specific);
3379  // constructor without constituents
3380  PFJet newJet (protojet.p4(), vertex, specific);
3381 
3382  // last step is to copy the constituents into the jet (new jet definition since 18X)
3383  // namespace reco {
3384  //class Jet : public CompositeRefBaseCandidate {
3385  // public:
3386  // typedef reco::CandidateBaseRefVector Constituents;
3387 
3388  ProtoJet::Constituents::const_iterator constituent = constituents.begin();
3389  for (; constituent != constituents.end(); ++constituent) {
3390  // find index of this ProtoJet constituent in the overall collection PFconstit
3391  // see class IndexedCandidate in JetRecoTypes.h
3392  uint index = constituent->index();
3393  newJet.addDaughter(pfCandidatesPtrs_[index]);
3394  } // end loop on ProtoJet constituents
3395  // last step: copy ProtoJet Variables into Jet
3396  newJet.setJetArea(protojet.jetArea());
3397  newJet.setPileup(protojet.pileup());
3398  newJet.setNPasses(protojet.nPasses());
3399  ++ijet;
3400  if (jetsDebug_ ) cout<<" PF jet "<<ijet<<" "<<newJet.print()<<endl;
3401  pfJets_.push_back (newJet);
3402 
3403  } // end loop on protojets iterator IPJ
3404 
3405 }
3406 
3407 void
3409 
3410  // cout<<"!!! Make FWLite Jets "<<endl;
3412  // vector<ProtoJet> output;
3413  jetMaker_.applyCuts (Candidates, &input);
3414  if (jetAlgoType_==1) {// ICone
3416  jetMaker_.makeIterativeConeJets(input, &output);
3417  }
3418  if (jetAlgoType_==2) {// MCone
3419  jetMaker_.makeMidpointJets(input, &output);
3420  }
3421  if (jetAlgoType_==3) {// Fastjet
3422  jetMaker_.makeFastJets(input, &output);
3423  }
3424  if((jetAlgoType_>3)||(jetAlgoType_<0)) {
3425  cout<<"Unknown Jet Algo ! " <<jetAlgoType_ << endl;
3426  }
3427  //if (jetsDebug_) cout<<"Proto Jet Size " <<output.size()<<endl;
3428 
3429 }
3430 
3431 
3432 
3434 double
3436  //std::cout << "building jets from MC particles,"
3437  // << "PF particles and caloTowers" << std::endl;
3438 
3439  //initialize Jets Reconstruction
3440  jetAlgo_.Clear();
3441 
3442  //COLIN The following comment is not really adequate,
3443  // since partTOTMC is not an action..
3444  // one should say what this variable is for.
3445  // see my comment later
3446  //MAKING TRUE PARTICLE JETS
3447 // TLorentzVector partTOTMC;
3448 
3449  // colin: the following is not necessary
3450  // since the lorentz vectors are initialized to 0,0,0,0.
3451  // partTOTMC.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
3452 
3453  //MAKING JETS WITH TAU DAUGHTERS
3454  //Colin: this vector vectPART is not necessary !!
3455  //it was just an efficient copy of trueparticles_.....
3456 // vector<reco::PFSimParticle> vectPART;
3457 // for ( unsigned i=0; i < trueParticles_.size(); i++) {
3458 // const reco::PFSimParticle& ptc = trueParticles_[i];
3459 // vectPART.push_back(ptc);
3460 // }//loop
3461 
3462 
3463  //COLIN one must not loop on trueParticles_ to find taus.
3464  //the code was giving wrong results on non single tau events.
3465 
3466  // first check that this is a single tau event.
3467 
3468  TLorentzVector partTOTMC;
3469  bool tauFound = false;
3470  bool tooManyTaus = false;
3471  if (fastsim_){
3472 
3473  for ( unsigned i=0; i < trueParticles_.size(); i++) {
3474  const reco::PFSimParticle& ptc = trueParticles_[i];
3475  if (std::abs(ptc.pdgCode()) == 15) {
3476  // this is a tau
3477  if( i ) tooManyTaus = true;
3478  else tauFound=true;
3479  }
3480  }
3481 
3482  if(!tauFound || tooManyTaus ) {
3483  // cerr<<"PFRootEventManager::tauBenchmark : not a single tau event"<<endl;
3484  return -9999;
3485  }
3486 
3487  // loop on the daugthers of the tau
3488  const std::vector<int>& ptcdaughters = trueParticles_[0].daughterIds();
3489 
3490  // will contain the sum of the lorentz vectors of the visible daughters
3491  // of the tau.
3492 
3493 
3494  for ( unsigned int dapt=0; dapt < ptcdaughters.size(); ++dapt) {
3495 
3496  const reco::PFTrajectoryPoint& tpatvtx
3497  = trueParticles_[ptcdaughters[dapt]].trajectoryPoint(0);
3498  TLorentzVector partMC;
3499  partMC.SetPxPyPzE(tpatvtx.momentum().Px(),
3500  tpatvtx.momentum().Py(),
3501  tpatvtx.momentum().Pz(),
3502  tpatvtx.momentum().E());
3503 
3504  partTOTMC += partMC;
3505  if (tauBenchmarkDebug_) {
3506  //pdgcode
3507  int pdgcode = trueParticles_[ptcdaughters[dapt]].pdgCode();
3508  cout << pdgcode << endl;
3509  cout << tpatvtx << endl;
3510  cout << partMC.Px() << " " << partMC.Py() << " "
3511  << partMC.Pz() << " " << partMC.E()
3512  << " PT="
3513  << sqrt(partMC.Px()*partMC.Px()+partMC.Py()*partMC.Py())
3514  << endl;
3515  }//debug
3516  }//loop daughter
3517  }else{
3518 
3519  uint itau=0;
3520  const HepMC::GenEvent* myGenEvent = MCTruth_.GetEvent();
3521  for ( HepMC::GenEvent::particle_const_iterator
3522  piter = myGenEvent->particles_begin();
3523  piter != myGenEvent->particles_end();
3524  ++piter ) {
3525 
3526 
3527  if (std::abs((*piter)->pdg_id())==15){
3528  itau++;
3529  tauFound=true;
3530  for ( HepMC::GenVertex::particles_out_const_iterator bp =
3531  (*piter)->end_vertex()->particles_out_const_begin();
3532  bp != (*piter)->end_vertex()->particles_out_const_end(); ++bp ) {
3533  uint nuId=std::abs((*bp)->pdg_id());
3534  bool isNeutrino=(nuId==12)||(nuId==14)||(nuId==16);
3535  if (!isNeutrino){
3536 
3537 
3538  TLorentzVector partMC;
3539  partMC.SetPxPyPzE((*bp)->momentum().x(),
3540  (*bp)->momentum().y(),
3541  (*bp)->momentum().z(),
3542  (*bp)->momentum().e());
3543  partTOTMC += partMC;
3544  }
3545  }
3546  }
3547  }
3548  if (itau>1) tooManyTaus=true;
3549 
3550  if(!tauFound || tooManyTaus ) {
3551  cerr<<"PFRootEventManager::tauBenchmark : not a single tau event"<<endl;
3552  return -9999;
3553  }
3554  }
3555 
3556 
3557  EventColin::Jet jetmc;
3558 
3559  jetmc.eta = partTOTMC.Eta();
3560  jetmc.phi = partTOTMC.Phi();
3561  jetmc.et = partTOTMC.Et();
3562  jetmc.e = partTOTMC.E();
3563 
3564  if(outEvent_) outEvent_->addJetMC( jetmc );
3565 
3566  /*
3567  //MC JETS RECONSTRUCTION (visible energy)
3568  for ( unsigned i=0; i < trueParticles_.size(); i++) {
3569  const reco::PFSimParticle& ptc = trueParticles_[i];
3570  const std::vector<int>& ptcdaughters = ptc.daughterIds();
3571 
3572  //PARTICULE NOT DISINTEGRATING BEFORE ECAL
3573  if(ptcdaughters.size() != 0) continue;
3574 
3575  //TAKE INFO AT VERTEX //////////////////////////////////////////////////
3576  const reco::PFTrajectoryPoint& tpatvtx = ptc.trajectoryPoint(0);
3577  TLorentzVector partMC;
3578  partMC.SetPxPyPzE(tpatvtx.momentum().Px(),
3579  tpatvtx.momentum().Py(),
3580  tpatvtx.momentum().Pz(),
3581  tpatvtx.momentum().E());
3582 
3583  partTOTMC += partMC;
3584  if (tauBenchmarkDebug_) {
3585  //pdgcode
3586  int pdgcode = ptc.pdgCode();
3587  cout << pdgcode << endl;
3588  cout << tpatvtx << endl;
3589  cout << partMC.Px() << " " << partMC.Py() << " "
3590  << partMC.Pz() << " " << partMC.E()
3591  << " PT="
3592  << sqrt(partMC.Px()*partMC.Px()+partMC.Py()*partMC.Py())
3593  << endl;
3594  }//debug?
3595  }//loop true particles
3596  */
3597  if (tauBenchmarkDebug_) {
3598  cout << " ET Vector=" << partTOTMC.Et()
3599  << " " << partTOTMC.Eta()
3600  << " " << partTOTMC.Phi() << endl; cout << endl;
3601  }//debug
3602 
3604  //CALO TOWER JETS (ECAL+HCAL Towers)
3605  //cout << endl;
3606  //cout << "THERE ARE " << caloTowers_.size() << " CALO TOWERS" << endl;
3607 
3608  vector<TLorentzVector> allcalotowers;
3609  // vector<double> allemenergy;
3610  // vector<double> allhadenergy;
3611  double threshCaloTowers = 1E-10;
3612  for ( unsigned int i = 0; i < caloTowers_.size(); ++i) {
3613 
3614  if(caloTowers_[i].energy() < threshCaloTowers) {
3615  // cout<<"skipping calotower"<<endl;
3616  continue;
3617  }
3618 
3619  TLorentzVector caloT;
3620  TVector3 pepr( caloTowers_[i].eta(),
3621  caloTowers_[i].phi(),
3622  caloTowers_[i].energy());
3623  TVector3 pxyz = Utils::VectorEPRtoXYZ( pepr );
3624  caloT.SetPxPyPzE(pxyz.X(),pxyz.Y(),pxyz.Z(),caloTowers_[i].energy());
3625  allcalotowers.push_back(caloT);
3626  // allemenergy.push_back( caloTowers_[i].emEnergy() );
3627  // allhadenergy.push_back( caloTowers_[i].hadEnergy() );
3628  }//loop calo towers
3629  if ( tauBenchmarkDebug_)
3630  cout << " RETRIEVED " << allcalotowers.size()
3631  << " CALOTOWER 4-VECTORS " << endl;
3632 
3633  //ECAL+HCAL tower jets computation
3634  jetAlgo_.Clear();
3635  const vector< PFJetAlgorithm::Jet >& caloTjets
3636  = jetAlgo_.FindJets( &allcalotowers );
3637 
3638  //cout << caloTjets.size() << " CaloTower Jets found" << endl;
3639  double JetEHTETmax = 0.0;
3640  for ( unsigned i = 0; i < caloTjets.size(); i++) {
3641  TLorentzVector jetmom = caloTjets[i].GetMomentum();
3642  double jetcalo_pt = sqrt(jetmom.Px()*jetmom.Px()+jetmom.Py()*jetmom.Py());
3643  double jetcalo_et = jetmom.Et();
3644 
3646  jet.eta = jetmom.Eta();
3647  jet.phi = jetmom.Phi();
3648  jet.et = jetmom.Et();
3649  jet.e = jetmom.E();
3650 
3651  const vector<int>& indexes = caloTjets[i].GetIndexes();
3652  for( unsigned ii=0; ii<indexes.size(); ii++){
3653  jet.ee += caloTowers_[ indexes[ii] ].emEnergy();
3654  jet.eh += caloTowers_[ indexes[ii] ].hadEnergy();
3655  jet.ete += caloTowers_[ indexes[ii] ].emEt();
3656  jet.eth += caloTowers_[ indexes[ii] ].hadEt();
3657  }
3658 
3659  if(outEvent_) outEvent_->addJetEHT( jet );
3660 
3661  if ( tauBenchmarkDebug_) {
3662  cout << " ECAL+HCAL jet : " << caloTjets[i] << endl;
3663  cout << jetmom.Px() << " " << jetmom.Py() << " "
3664  << jetmom.Pz() << " " << jetmom.E()
3665  << " PT=" << jetcalo_pt << endl;
3666  }//debug
3667 
3668  if (jetcalo_et >= JetEHTETmax)
3669  JetEHTETmax = jetcalo_et;
3670  }//loop MCjets
3671 
3673  //PARTICLE FLOW JETS
3674  vector<TLorentzVector> allrecparticles;
3675  // if ( tauBenchmarkDebug_) {
3676  // cout << endl;
3677  // cout << " THERE ARE " << pfBlocks_.size() << " EFLOW BLOCKS" << endl;
3678  // }//debug
3679 
3680  // for ( unsigned iefb = 0; iefb < pfBlocks_.size(); iefb++) {
3681  // const std::vector< PFBlockParticle >& recparticles
3682  // = pfBlocks_[iefb].particles();
3683 
3684 
3685 
3686  for(unsigned i=0; i<candidates.size(); i++) {
3687 
3688  // if (tauBenchmarkDebug_)
3689  // cout << " there are " << recparticles.size()
3690  // << " particle in this block" << endl;
3691 
3692  const reco::PFCandidate& candidate = candidates[i];
3693 
3694  if (tauBenchmarkDebug_) {
3695  cout << i << " " << candidate << endl;
3696  int type = candidate.particleId();
3697  cout << " type= " << type << " " << candidate.charge()
3698  << endl;
3699  }//debug
3700 
3701  const math::XYZTLorentzVector& PFpart = candidate.p4();
3702 
3703  TLorentzVector partRec(PFpart.Px(),
3704  PFpart.Py(),
3705  PFpart.Pz(),
3706  PFpart.E());
3707 
3708  //loading 4-vectors of Rec particles
3709  allrecparticles.push_back( partRec );
3710 
3711  }//loop on candidates
3712 
3713 
3714  if (tauBenchmarkDebug_)
3715  cout << " THERE ARE " << allrecparticles.size()
3716  << " RECONSTRUCTED 4-VECTORS" << endl;
3717 
3718  jetAlgo_.Clear();
3719  const vector< PFJetAlgorithm::Jet >& PFjets
3720  = jetAlgo_.FindJets( &allrecparticles );
3721 
3722  if (tauBenchmarkDebug_)
3723  cout << PFjets.size() << " PF Jets found" << endl;
3724  double JetPFETmax = 0.0;
3725  for ( unsigned i = 0; i < PFjets.size(); i++) {
3726  TLorentzVector jetmom = PFjets[i].GetMomentum();
3727  double jetpf_pt = sqrt(jetmom.Px()*jetmom.Px()+jetmom.Py()*jetmom.Py());
3728  double jetpf_et = jetmom.Et();
3729 
3731  jet.eta = jetmom.Eta();
3732  jet.phi = jetmom.Phi();
3733  jet.et = jetmom.Et();
3734  jet.e = jetmom.E();
3735 
3736  if(outEvent_) outEvent_->addJetPF( jet );
3737 
3738  if (tauBenchmarkDebug_) {
3739  cout <<" Rec jet : "<< PFjets[i] <<endl;
3740  cout << jetmom.Px() << " " << jetmom.Py() << " "
3741  << jetmom.Pz() << " " << jetmom.E()
3742  << " PT=" << jetpf_pt << " eta="<< jetmom.Eta()
3743  << " Phi=" << jetmom.Phi() << endl;
3744  cout << "------------------------------------------------" << endl;
3745  }//debug
3746 
3747  if (jetpf_et >= JetPFETmax)
3748  JetPFETmax = jetpf_et;
3749  }//loop PF jets
3750 
3751  //fill histos
3752 
3753  double deltaEtEHT = JetEHTETmax - partTOTMC.Et();
3754  h_deltaETvisible_MCEHT_->Fill(deltaEtEHT);
3755 
3756  double deltaEt = JetPFETmax - partTOTMC.Et();
3757  h_deltaETvisible_MCPF_ ->Fill(deltaEt);
3758 
3759  if (verbosity_ == VERBOSE ) {
3760  cout << "tau benchmark E_T(PF) - E_T(true) = " << deltaEt << endl;
3761  }
3762 
3763  return deltaEt/partTOTMC.Et();
3764 }//Makejets
3765 
3766 
3767 
3768 
3769 
3770 /*
3771 
3772 void PFRootEventManager::lookForGenParticle(unsigned barcode) {
3773 
3774 const HepMC::GenEvent* event = MCTruth_.GetEvent();
3775 if(!event) {
3776 cerr<<"no GenEvent"<<endl;
3777 return;
3778 }
3779 
3780 const HepMC::GenParticle* particle = event->barcode_to_particle(barcode);
3781 if(!particle) {
3782 cerr<<"no particle with barcode "<<barcode<<endl;
3783 return;
3784 }
3785 
3786 math::XYZTLorentzVector momentum(particle->momentum().px(),
3787 particle->momentum().py(),
3788 particle->momentum().pz(),
3789 particle->momentum().e());
3790 
3791 double eta = momentum.Eta();
3792 double phi = momentum.phi();
3793 
3794 double phisize = 0.05;
3795 double etasize = 0.05;
3796 
3797 double etagate = displayZoomFactor_ * etasize;
3798 double phigate = displayZoomFactor_ * phisize;
3799 
3800 if(displayHist_[EPE]) {
3801 displayHist_[EPE]->GetXaxis()->SetRangeUser(eta-etagate, eta+etagate);
3802 displayHist_[EPE]->GetYaxis()->SetRangeUser(phi-phigate, phi+phigate);
3803 }
3804 if(displayHist_[EPH]) {
3805 displayHist_[EPH]->GetXaxis()->SetRangeUser(eta-etagate, eta+etagate);
3806 displayHist_[EPH]->GetYaxis()->SetRangeUser(phi-phigate, phi+phigate);
3807 }
3808 
3809 updateDisplay();
3810 
3811 }
3812 */
3813 
3814 
3815 
3816 string PFRootEventManager::expand(const string& oldString) const {
3817 
3818  string newString = oldString;
3819 
3820  string dollar = "$";
3821  string slash = "/";
3822 
3823  // protection necessary or segv !!
3824  int dollarPos = newString.find(dollar,0);
3825  if( dollarPos == -1 ) return oldString;
3826 
3827  int lengh = newString.find(slash,0) - newString.find(dollar,0) + 1;
3828  string env_variable =
3829  newString.substr( ( newString.find(dollar,0) + 1 ), lengh -2);
3830  // the env var could be defined between { }
3831  int begin = env_variable.find_first_of("{");
3832  int end = env_variable.find_last_of("}");
3833 
3834  // cout << "var=" << env_variable << begin<<" "<<end<< endl;
3835 
3836 
3837  env_variable = env_variable.substr( begin+1, end-1 );
3838  // cout << "var=" << env_variable <<endl;
3839 
3840 
3841  // cerr<<"call getenv "<<endl;
3842  char* directory = getenv( env_variable.c_str() );
3843 
3844  if(!directory) {
3845  cerr<<"please define environment variable $"<<env_variable<<endl;
3846  delete this;
3847  exit(1);
3848  }
3849  string sdir = directory;
3850  sdir += "/";
3851 
3852  newString.replace( 0, lengh , sdir);
3853 
3854  if (verbosity_ == VERBOSE ) {
3855  cout << "expand " <<oldString<<" to "<< newString << endl;
3856  }
3857 
3858  return newString;
3859 }
3860 
3861 
3862 void
3864 
3865  if(!out) return;
3866  // if (!out.is_open()) return;
3867 
3868  // Use only for one PFSimParticle/GenParticles
3869  const HepMC::GenEvent* myGenEvent = MCTruth_.GetEvent();
3870  if(!myGenEvent) return;
3871  int nGen = 0;
3872  for ( HepMC::GenEvent::particle_const_iterator
3873  piter = myGenEvent->particles_begin();
3874  piter != myGenEvent->particles_end();
3875  ++piter ) nGen++;
3876  int nSim = trueParticles_.size();
3877  if ( nGen != 1 || nSim != 1 ) return;
3878 
3879  // One GenJet
3880  if ( genJets_.size() != 1 ) return;
3881  double true_E = genJets_[0].p();
3882  double true_eta = genJets_[0].eta();
3883  double true_phi = genJets_[0].phi();
3884 
3885  // One particle-flow jet
3886  // if ( pfJets_.size() != 1 ) return;
3887  double rec_ECALEnergy = 0.;
3888  double rec_HCALEnergy = 0.;
3889  double deltaRMin = 999.;
3890  unsigned int theJet = 0;
3891  for ( unsigned int ijet=0; ijet<pfJets_.size(); ++ijet ) {
3892  double rec_ECAL = pfJets_[ijet].neutralEmEnergy();
3893  double rec_HCAL = pfJets_[ijet].neutralHadronEnergy();
3894  double rec_eta = pfJets_[0].eta();
3895  double rec_phi = pfJets_[0].phi();
3896  double deltaR = std::sqrt( (rec_eta-true_eta)*(rec_eta-true_eta)
3897  + (rec_phi-true_phi)*(rec_phi-true_phi) );
3898  if ( deltaR < deltaRMin ) {
3899  deltaRMin = deltaR;
3900  rec_ECALEnergy = rec_ECAL;
3901  rec_HCALEnergy = rec_HCAL;
3902  }
3903  }
3904  if ( deltaRMin > 0.1 ) return;
3905 
3906  std::vector < PFCandidatePtr > constituents = pfJets_[theJet].getPFConstituents ();
3907  double pat_ECALEnergy = 0.;
3908  double pat_HCALEnergy = 0.;
3909  for (unsigned ic = 0; ic < constituents.size (); ++ic) {
3910  if ( constituents[ic]->particleId() < 4 ) continue;
3911  if ( constituents[ic]->particleId() == 4 )
3912  pat_ECALEnergy += constituents[ic]->rawEcalEnergy();
3913  else if ( constituents[ic]->particleId() == 5 )
3914  pat_HCALEnergy += constituents[ic]->rawHcalEnergy();
3915  }
3916 
3917  out << true_eta << " " << true_phi << " " << true_E
3918  << " " << rec_ECALEnergy << " " << rec_HCALEnergy
3919  << " " << pat_ECALEnergy << " " << pat_HCALEnergy
3920  << " " << deltaRMin << std::endl;
3921 }
3922 
3923 void PFRootEventManager::print(ostream& out,int maxNLines ) const {
3924 
3925  if(!out) return;
3926 
3927  //If McTruthMatching print a detailed list
3928  //of matching between simparticles and PFCandidates
3929  //MCTruth Matching vectors.
3930  std::vector< std::list <simMatch> > candSimMatchTrack;
3931  std::vector< std::list <simMatch> > candSimMatchEcal;
3932  if( printMCTruthMatching_){
3934  *pfCandidates_,
3935  candSimMatchTrack,
3936  candSimMatchEcal);
3937  }
3938 
3939 
3940  if( printRecHits_ ) {
3941  out<<"ECAL RecHits ==============================================="<<endl;
3942  printRecHits(rechitsECAL_, clusterAlgoECAL_, out ); out<<endl;
3943  out<<"HCAL RecHits ==============================================="<<endl;
3944  printRecHits(rechitsHCAL_, clusterAlgoHCAL_, out ); out<<endl;
3945  if (useHO_) {
3946  out<<"HO RecHits ================================================="<<endl;
3947  printRecHits(rechitsHO_, clusterAlgoHO_, out ); out<<endl;
3948  }
3949  out<<"HFEM RecHits ==============================================="<<endl;
3950  printRecHits(rechitsHFEM_, clusterAlgoHFEM_, out ); out<<endl;
3951  out<<"HFHAD RecHits =============================================="<<endl;
3952  printRecHits(rechitsHFHAD_, clusterAlgoHFHAD_, out ); out<<endl;
3953  out<<"PS RecHits ================================================="<<endl;
3954  printRecHits(rechitsPS_, clusterAlgoPS_, out ); out<<endl;
3955  }
3956 
3957  if( printClusters_ ) {
3958  out<<"ECAL Clusters ============================================="<<endl;
3959  printClusters( *clustersECAL_, out); out<<endl;
3960  out<<"HCAL Clusters ============================================="<<endl;
3961  printClusters( *clustersHCAL_, out); out<<endl;
3962  if (useHO_) {
3963  out<<"HO Clusters ==============================================="<<endl;
3964  printClusters( *clustersHO_, out); out<<endl;
3965  }
3966  out<<"HFEM Clusters ============================================="<<endl;
3967  printClusters( *clustersHFEM_, out); out<<endl;
3968  out<<"HFHAD Clusters ============================================"<<endl;
3969  printClusters( *clustersHFHAD_, out); out<<endl;
3970  out<<"PS Clusters ============================================="<<endl;
3971  printClusters( *clustersPS_, out); out<<endl;
3972  }
3973  bool printTracks = true;
3974  if( printTracks) {
3975 
3976  }
3977  if( printPFBlocks_ ) {
3978  out<<"Particle Flow Blocks ======================================"<<endl;
3979  for(unsigned i=0; i<pfBlocks_->size(); i++) {
3980  out<<i<<" "<<(*pfBlocks_)[i]<<endl;
3981  }
3982  out<<endl;
3983  }
3984  if(printPFCandidates_) {
3985  out<<"Particle Flow Candidates =================================="<<endl;
3986  double mex = 0.;
3987  double mey = 0.;
3988  for(unsigned i=0; i<pfCandidates_->size(); i++) {
3989  const PFCandidate& pfc = (*pfCandidates_)[i];
3990  mex -= pfc.px();
3991  mey -= pfc.py();
3992  if(pfc.pt()>printPFCandidatesPtMin_)
3993  out<<i<<" " <<(*pfCandidates_)[i]<<endl;
3994  }
3995  out<<endl;
3996  out<< "MEX, MEY, MET ============================================" <<endl
3997  << mex << " " << mey << " " << sqrt(mex*mex+mey*mey);
3998  out<<endl;
3999  out<<endl;
4000 
4001  //print a detailed list of PFSimParticles matching
4002  //the PFCandiates
4004  cout<<"MCTruthMatching Results"<<endl;
4005  for(unsigned icand=0; icand<pfCandidates_->size();
4006  icand++) {
4007  out <<icand<<" " <<(*pfCandidates_)[icand]<<endl;
4008  out << "is matching:" << endl;
4009 
4010  //tracking
4011  ITM it_t = candSimMatchTrack[icand].begin();
4012  ITM itend_t = candSimMatchTrack[icand].end();
4013  for(;it_t!=itend_t;++it_t){
4014  unsigned simid = it_t->second;
4015  out << "\tSimParticle " << trueParticles_[simid]
4016  <<endl;
4017  out << "\t\tthrough Track matching pTrectrack="
4018  << it_t->first << " GeV" << endl;
4019  }//loop simparticles
4020 
4021  ITM it_e = candSimMatchEcal[icand].begin();
4022  ITM itend_e = candSimMatchEcal[icand].end();
4023  for(;it_e!=itend_e;++it_e){
4024  unsigned simid = it_e->second;
4025  out << "\tSimParticle " << trueParticles_[simid]
4026  << endl;
4027  out << "\t\tsimparticle contributing to a total of "
4028  << it_e->first
4029  << " GeV of its ECAL cluster"
4030  << endl;
4031  }//loop simparticles
4032  cout<<"________________"<<endl;
4033  }//loop candidates
4034  }
4035  }
4036  if(printPFJets_) {
4037  out<<"Jets ====================================================="<<endl;
4038  out<<"Particle Flow: "<<endl;
4039  for(unsigned i=0; i<pfJets_.size(); i++) {
4040  if (pfJets_[i].pt() > printPFJetsPtMin_ )
4041  out<<i<<pfJets_[i].print()<<endl;
4042  }
4043  out<<endl;
4044  out<<"Generated: "<<endl;
4045  for(unsigned i=0; i<genJets_.size(); i++) {
4046  if (genJets_[i].pt() > printPFJetsPtMin_ )
4047  out<<i<<genJets_[i].print()<<endl;
4048  // <<" invisible energy = "<<genJets_[i].invisibleEnergy()<<endl;
4049  }
4050  out<<endl;
4051  out<<"Calo: "<<endl;
4052  for(unsigned i=0; i<caloJets_.size(); i++) {
4053  out<<"pt = "<<caloJets_[i].pt()<<endl;
4054  }
4055  out<<endl;
4056  }
4057  if( printSimParticles_ ) {
4058  out<<"Sim Particles ==========================================="<<endl;
4059 
4060  for(unsigned i=0; i<trueParticles_.size(); i++) {
4061  if( trackInsideGCut( trueParticles_[i]) ){
4062 
4063  const reco::PFSimParticle& ptc = trueParticles_[i];
4064 
4065  // get trajectory at start point
4066  const reco::PFTrajectoryPoint& tp0 = ptc.extrapolatedPoint( 0 );
4067 
4068  if(tp0.momentum().pt()>printSimParticlesPtMin_)
4069  out<<"\t"<<trueParticles_[i]<<endl;
4070  }
4071  }
4072 
4073  //print a detailed list of PFSimParticles matching
4074  //the PFCandiates
4075  if(printMCTruthMatching_) {
4076  cout<<"MCTruthMatching Results"<<endl;
4077  for ( unsigned i=0; i < trueParticles_.size(); i++) {
4078  cout << "==== Particle Simulated " << i << endl;
4079  const reco::PFSimParticle& ptc = trueParticles_[i];
4080  out <<i<<" "<<trueParticles_[i]<<endl;
4081 
4082  if(!ptc.daughterIds().empty()){
4083  cout << "Look at the desintegration products" << endl;
4084  cout << endl;
4085  continue;
4086  }
4087 
4088  //TRACKING
4089  if(ptc.rectrackId() != 99999){
4090  cout << "matching pfCandidate (trough tracking): " << endl;
4091  for( unsigned icand=0; icand<pfCandidates_->size()
4092  ; icand++ )
4093  {
4094  ITM it = candSimMatchTrack[icand].begin();
4095  ITM itend = candSimMatchTrack[icand].end();
4096  for(;it!=itend;++it)
4097  if( i == it->second ){
4098  out<<icand<<" "<<(*pfCandidates_)[icand]<<endl;
4099  cout << endl;
4100  }
4101  }//loop candidate
4102  }//trackmatch
4103 
4104  //CALORIMETRY
4105  vector<unsigned> rechitSimIDs
4106  = ptc.recHitContrib();
4107  vector<double> rechitSimFrac
4108  = ptc.recHitContribFrac();
4109  //cout << "Number of rechits contrib =" << rechitSimIDs.size() << endl;
4110  if( !rechitSimIDs.size() ) continue; //no rechit
4111 
4112  cout << "matching pfCandidate (through ECAL): " << endl;
4113 
4114  //look at total ECAL desposition:
4115  double totalEcalE = 0.0;
4116  for(unsigned irh=0; irh<rechitsECAL_.size();++irh)
4117  for ( unsigned isimrh=0; isimrh < rechitSimIDs.size();
4118  isimrh++ )
4119  if(rechitSimIDs[isimrh] == rechitsECAL_[irh].detId())
4120  totalEcalE += (rechitsECAL_[irh].energy()*rechitSimFrac[isimrh]/100.0);
4121  cout << "For info, this particle deposits E=" << totalEcalE
4122  << "(GeV) in the ECAL" << endl;
4123 
4124  for( unsigned icand=0; icand<pfCandidates_->size()
4125  ; icand++ )
4126  {
4127  ITM it = candSimMatchEcal[icand].begin();
4128  ITM itend = candSimMatchEcal[icand].end();
4129  for(;it!=itend;++it)
4130  if( i == it->second )
4131  out<<icand<<" "<<it->first<<"GeV "<<(*pfCandidates_)[icand]<<endl;
4132  }//loop candidate
4133  cout << endl;
4134  }//loop particles
4135  }//mctruthmatching
4136 
4137  }
4138 
4139 
4140  if ( printGenParticles_ ) {
4141  printGenParticles(out,maxNLines);
4142  }
4143 }
4144 
4145 
4146 void
4148  int maxNLines) const {
4149 
4150 
4151  const HepMC::GenEvent* myGenEvent = MCTruth_.GetEvent();
4152  if(!myGenEvent) return;
4153 
4154  out<<"GenParticles ==========================================="<<endl;
4155 
4156  std::cout << "Id Gen Name eta phi pT E Vtx1 "
4157  << " x y z "
4158  << "Moth Vtx2 eta phi R Z Da1 Da2 Ecal?"
4159  << std::endl;
4160 
4161  int nLines = 0;
4162  for ( HepMC::GenEvent::particle_const_iterator
4163  piter = myGenEvent->particles_begin();
4164  piter != myGenEvent->particles_end();
4165  ++piter ) {
4166 
4167  if( nLines == maxNLines) break;
4168  nLines++;
4169 
4170  HepMC::GenParticle* p = *piter;
4171  /* */
4172  int partId = p->pdg_id();
4173 
4174  // We have here a subset of particles only.
4175  // To be filled according to the needs.
4176  /*switch(partId) {
4177  case 1: { name = "d"; break; }
4178  case 2: { name = "u"; break; }
4179  case 3: { name = "s"; break; }
4180  case 4: { name = "c"; break; }
4181  case 5: { name = "b"; break; }
4182  case 6: { name = "t"; break; }
4183  case -1: { name = "~d"; break; }
4184  case -2: { name = "~u"; break; }
4185  case -3: { name = "~s"; break; }
4186  case -4: { name = "~c"; break; }
4187  case -5: { name = "~b"; break; }
4188  case -6: { name = "~t"; break; }
4189  case 11: { name = "e-"; break; }
4190  case -11: { name = "e+"; break; }
4191  case 12: { name = "nu_e"; break; }
4192  case -12: { name = "~nu_e"; break; }
4193  case 13: { name = "mu-"; break; }
4194  case -13: { name = "mu+"; break; }
4195  case 14: { name = "nu_mu"; break; }
4196  case -14: { name = "~nu_mu"; break; }
4197  case 15: { name = "tau-"; break; }
4198  case -15: { name = "tau+"; break; }
4199  case 16: { name = "nu_tau"; break; }
4200  case -16: { name = "~nu_tau"; break; }
4201  case 21: { name = "gluon"; break; }
4202  case 22: { name = "gamma"; break; }
4203  case 23: { name = "Z0"; break; }
4204  case 24: { name = "W+"; break; }
4205  case 25: { name = "H0"; break; }
4206  case -24: { name = "W-"; break; }
4207  case 111: { name = "pi0"; break; }
4208  case 113: { name = "rho0"; break; }
4209  case 223: { name = "omega"; break; }
4210  case 333: { name = "phi"; break; }
4211  case 443: { name = "J/psi"; break; }
4212  case 553: { name = "Upsilon"; break; }
4213  case 130: { name = "K0L"; break; }
4214  case 211: { name = "pi+"; break; }
4215  case -211: { name = "pi-"; break; }
4216  case 213: { name = "rho+"; break; }
4217  case -213: { name = "rho-"; break; }
4218  case 221: { name = "eta"; break; }
4219  case 331: { name = "eta'"; break; }
4220  case 441: { name = "etac"; break; }
4221  case 551: { name = "etab"; break; }
4222  case 310: { name = "K0S"; break; }
4223  case 311: { name = "K0"; break; }
4224  case -311: { name = "Kbar0"; break; }
4225  case 321: { name = "K+"; break; }
4226  case -321: { name = "K-"; break; }
4227  case 411: { name = "D+"; break; }
4228  case -411: { name = "D-"; break; }
4229  case 421: { name = "D0"; break; }
4230  case 431: { name = "Ds_+"; break; }
4231  case -431: { name = "Ds_-"; break; }
4232  case 511: { name = "B0"; break; }
4233  case 521: { name = "B+"; break; }
4234  case -521: { name = "B-"; break; }
4235  case 531: { name = "Bs_0"; break; }
4236  case 541: { name = "Bc_+"; break; }
4237  case -541: { name = "Bc_+"; break; }
4238  case 313: { name = "K*0"; break; }
4239  case -313: { name = "K*bar0"; break; }
4240  case 323: { name = "K*+"; break; }
4241  case -323: { name = "K*-"; break; }
4242  case 413: { name = "D*+"; break; }
4243  case -413: { name = "D*-"; break; }
4244  case 423: { name = "D*0"; break; }
4245  case 513: { name = "B*0"; break; }
4246  case 523: { name = "B*+"; break; }
4247  case -523: { name = "B*-"; break; }
4248  case 533: { name = "B*_s0"; break; }
4249  case 543: { name = "B*_c+"; break; }
4250  case -543: { name = "B*_c-"; break; }
4251  case 1114: { name = "Delta-"; break; }
4252  case -1114: { name = "Deltabar+"; break; }
4253  case -2112: { name = "nbar0"; break; }
4254  case 2112: { name = "n"; break; }
4255  case 2114: { name = "Delta0"; break; }
4256  case -2114: { name = "Deltabar0"; break; }
4257  case 3122: { name = "Lambda0"; break; }
4258  case -3122: { name = "Lambdabar0"; break; }
4259  case 3112: { name = "Sigma-"; break; }
4260  case -3112: { name = "Sigmabar+"; break; }
4261  case 3212: { name = "Sigma0"; break; }
4262  case -3212: { name = "Sigmabar0"; break; }
4263  case 3214: { name = "Sigma*0"; break; }
4264  case -3214: { name = "Sigma*bar0"; break; }
4265  case 3222: { name = "Sigma+"; break; }
4266  case -3222: { name = "Sigmabar-"; break; }
4267  case 2212: { name = "p"; break; }
4268  case -2212: { name = "~p"; break; }
4269  case -2214: { name = "Delta-"; break; }
4270  case 2214: { name = "Delta+"; break; }
4271  case -2224: { name = "Deltabar--"; break; }
4272  case 2224: { name = "Delta++"; break; }
4273  default: {
4274  name = "unknown";
4275  cout << "Unknown code : " << partId << endl;
4276  }
4277  }
4278  */
4279  std::string latexString;
4280  std::string name = getGenParticleName(partId,latexString);
4281 
4282  math::XYZTLorentzVector momentum1(p->momentum().px(),
4283  p->momentum().py(),
4284  p->momentum().pz(),
4285  p->momentum().e() );
4286 
4287  if(momentum1.pt()<printGenParticlesPtMin_) continue;
4288 
4289  int vertexId1 = 0;
4290 
4291  if ( !p->production_vertex() && p->pdg_id() == 2212 ) continue;
4292 
4293  math::XYZVector vertex1;
4294  vertexId1 = -1;
4295 
4296  if(p->production_vertex() ) {
4297  vertex1.SetCoordinates( p->production_vertex()->position().x()/10.,
4298  p->production_vertex()->position().y()/10.,
4299  p->production_vertex()->position().z()/10. );
4300  vertexId1 = p->production_vertex()->barcode();
4301  }
4302 
4303  out.setf(std::ios::fixed, std::ios::floatfield);
4304  out.setf(std::ios::right, std::ios::adjustfield);
4305 
4306  out << std::setw(4) << p->barcode() << " "
4307  << name;
4308 
4309  for(unsigned int k=0;k<11-name.length() && k<12; k++) out << " ";
4310 
4311  double eta = momentum1.eta();
4312  if ( eta > +10. ) eta = +10.;
4313  if ( eta < -10. ) eta = -10.;
4314 
4315  out << std::setw(6) << std::setprecision(2) << eta << " "
4316  << std::setw(6) << std::setprecision(2) << momentum1.phi() << " "
4317  << std::setw(7) << std::setprecision(2) << momentum1.pt() << " "
4318  << std::setw(7) << std::setprecision(2) << momentum1.e() << " "
4319  << std::setw(4) << vertexId1 << " "
4320  << std::setw(6) << std::setprecision(1) << vertex1.x() << " "
4321  << std::setw(6) << std::setprecision(1) << vertex1.y() << " "
4322  << std::setw(6) << std::setprecision(1) << vertex1.z() << " ";
4323 
4324 
4325  if( p->production_vertex() ) {
4326  if ( p->production_vertex()->particles_in_size() ) {
4327  const HepMC::GenParticle* mother =
4328  *(p->production_vertex()->particles_in_const_begin());
4329 
4330  out << std::setw(4) << mother->barcode() << " ";
4331  }
4332  else
4333  out << " " ;
4334  }
4335 
4336  if ( p->end_vertex() ) {
4337  math::XYZTLorentzVector vertex2(p->end_vertex()->position().x()/10.,
4338  p->end_vertex()->position().y()/10.,
4339  p->end_vertex()->position().z()/10.,
4340  p->end_vertex()->position().t()/10.);
4341  int vertexId2 = p->end_vertex()->barcode();
4342 
4343  std::vector<const HepMC::GenParticle*> children;
4344  HepMC::GenVertex::particles_out_const_iterator firstDaughterIt =
4345  p->end_vertex()->particles_out_const_begin();
4346  HepMC::GenVertex::particles_out_const_iterator lastDaughterIt =
4347  p->end_vertex()->particles_out_const_end();
4348  for ( ; firstDaughterIt != lastDaughterIt ; ++firstDaughterIt ) {
4349  children.push_back(*firstDaughterIt);
4350  }
4351 
4352  out << std::setw(4) << vertexId2 << " "
4353  << std::setw(6) << std::setprecision(2) << vertex2.eta() << " "
4354  << std::setw(6) << std::setprecision(2) << vertex2.phi() << " "
4355  << std::setw(5) << std::setprecision(1) << vertex2.pt() << " "
4356  << std::setw(6) << std::setprecision(1) << vertex2.z() << " ";
4357 
4358  for ( unsigned id=0; id<children.size(); ++id )
4359  out << std::setw(4) << children[id]->barcode() << " ";
4360  }
4361  out << std::endl;
4362  }
4363 }
4364 
4365 void PFRootEventManager::printRecHits(const reco::PFRecHitCollection& rechits, const PFClusterAlgo& clusterAlgo, ostream& out) const{
4366 
4367  for(unsigned i=0; i<rechits.size(); i++) {
4368  string seedstatus = " ";
4369  if(clusterAlgo.isSeed(i) )
4370  seedstatus = "SEED";
4371  printRecHit(rechits[i], i, seedstatus.c_str(), out);
4372  }
4373  return;
4374 }
4375 
4377  unsigned index,
4378  const char* seedstatus,
4379  ostream& out) const {
4380 
4381  if(!out) return;
4382  double eta = rh.position().Eta();
4383  double phi = rh.position().Phi();
4384  double energy = rh.energy();
4385 
4386  if(energy<printRecHitsEMin_) return;
4387 
4388  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4389  if( !cutg || cutg->IsInside( eta, phi ) )
4390  out<<index<<"\t"<<seedstatus<<" "<<rh<<endl;
4391 }
4392 
4394  ostream& out ) const {
4395  for(unsigned i=0; i<clusters.size(); i++) {
4396  printCluster(clusters[i], out);
4397  }
4398  return;
4399 }
4400 
4402  ostream& out ) const {
4403 
4404  if(!out) return;
4405 
4406  double eta = cluster.position().Eta();
4407  double phi = cluster.position().Phi();
4408  double energy = cluster.energy();
4409 
4410  if(energy<printClustersEMin_) return;
4411 
4412  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4413  if( !cutg || cutg->IsInside( eta, phi ) )
4414  out<<cluster<<endl;
4415 }
4416 
4418 
4419  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4420  if(!cutg) return true;
4421 
4422  const vector< reco::PFTrajectoryPoint >& points = track.trajectoryPoints();
4423 
4424  for( unsigned i=0; i<points.size(); i++) {
4425  if( ! points[i].isValid() ) continue;
4426 
4427  const math::XYZPoint& pos = points[i].position();
4428  if( cutg->IsInside( pos.Eta(), pos.Phi() ) ) return true;
4429  }
4430 
4431  // no point inside cut
4432  return false;
4433 }
4434 
4435 
4436 void
4439  const {
4440 
4441  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4442  if(!cutg) {
4443  mask.resize( rechits.size(), true);
4444  return;
4445  }
4446 
4447  mask.clear();
4448  mask.reserve( rechits.size() );
4449  for(unsigned i=0; i<rechits.size(); i++) {
4450 
4451  double eta = rechits[i].position().Eta();
4452  double phi = rechits[i].position().Phi();
4453 
4454  if( cutg->IsInside( eta, phi ) )
4455  mask.push_back( true );
4456  else
4457  mask.push_back( false );
4458  }
4459 }
4460 
4461 void
4463  const reco::PFClusterCollection& clusters)
4464  const {
4465 
4466  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4467  if(!cutg) return;
4468 
4469  mask.clear();
4470  mask.reserve( clusters.size() );
4471  for(unsigned i=0; i<clusters.size(); i++) {
4472 
4473  double eta = clusters[i].position().Eta();
4474  double phi = clusters[i].position().Phi();
4475 
4476  if( cutg->IsInside( eta, phi ) )
4477  mask.push_back( true );
4478  else
4479  mask.push_back( false );
4480  }
4481 }
4482 
4483 void
4486  const {
4487 
4488  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4489  if(!cutg) return;
4490 
4491  mask.clear();
4492  mask.reserve( tracks.size() );
4493  for(unsigned i=0; i<tracks.size(); i++) {
4494  if( trackInsideGCut( tracks[i] ) )
4495  mask.push_back( true );
4496  else
4497  mask.push_back( false );
4498  }
4499 }
4500 
4501 void
4504  const {
4505 
4506  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4507  if(!cutg) return;
4508 
4509  mask.clear();
4510  mask.reserve( photons.size() );
4511  for(unsigned i=0; i<photons.size(); i++) {
4512  double eta = photons[i].caloPosition().Eta();
4513  double phi = photons[i].caloPosition().Phi();
4514  if( cutg->IsInside( eta, phi ) )
4515  mask.push_back( true );
4516  else
4517  mask.push_back( false );
4518  }
4519 }
4520 
4521 
4522 void
4525  const {
4526 
4527  TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
4528  if(!cutg) return;
4529 
4530  mask.clear();
4531  mask.reserve( tracks.size() );
4532  for(unsigned i=0; i<tracks.size(); i++) {
4533  if( trackInsideGCut( tracks[i] ) )
4534  mask.push_back( true );
4535  else
4536  mask.push_back( false );
4537  }
4538 }
4539 
4540 
4541 const reco::PFSimParticle&
4543  double eta, double phi,
4544  double& peta, double& pphi, double& pe)
4545  const {
4546 
4547 
4548  if( trueParticles_.empty() ) {
4549  string err = "PFRootEventManager::closestParticle : ";
4550  err += "vector of PFSimParticles is empty";
4551  throw std::length_error( err.c_str() );
4552  }
4553 
4554  double mindist2 = 99999999;
4555  unsigned iClosest=0;
4556  for(unsigned i=0; i<trueParticles_.size(); i++) {
4557 
4558  const reco::PFSimParticle& ptc = trueParticles_[i];
4559 
4560  // protection for old version of the PFSimParticle
4561  // dataformats.
4562  if( layer >= reco::PFTrajectoryPoint::NLayers ||
4563  ptc.nTrajectoryMeasurements() + layer >=
4564  ptc.nTrajectoryPoints() ) {
4565  continue;
4566  }
4567 
4568  const reco::PFTrajectoryPoint& tp
4569  = ptc.extrapolatedPoint( layer );
4570 
4571  peta = tp.position().Eta();
4572  pphi = tp.position().Phi();
4573  pe = tp.momentum().E();
4574 
4575  double deta = peta - eta;
4576  double dphi = pphi - phi;
4577 
4578  double dist2 = deta*deta + dphi*dphi;
4579 
4580  if(dist2<mindist2) {
4581  mindist2 = dist2;
4582  iClosest = i;
4583  }
4584  }
4585 
4586  return trueParticles_[iClosest];
4587 }
4588 
4589 
4590 
4591 //-----------------------------------------------------------
4592 void
4594 
4595  cout<<"CMSSW Gen jets : size = " << genJetsCMSSW_.size() << endl;
4596  for ( unsigned i = 0; i < genJetsCMSSW_.size(); i++) {
4597  cout<<"Gen jet Et : " << genJetsCMSSW_[i].et() << endl;
4598  }
4599  cout<<"CMSSW PF jets : size = " << pfJetsCMSSW_.size() << endl;
4600  for ( unsigned i = 0; i < pfJetsCMSSW_.size(); i++) {
4601  cout<<"PF jet Et : " << pfJetsCMSSW_[i].et() << endl;
4602  }
4603  cout<<"CMSSW Calo jets : size = " << caloJetsCMSSW_.size() << endl;
4604  for ( unsigned i = 0; i < caloJetsCMSSW_.size(); i++) {
4605  cout<<"Calo jet Et : " << caloJetsCMSSW_[i].et() << endl;
4606  }
4607 }
4608 //________________________________________________________________
4610 {
4611  std::string name;
4612  switch(partId) {
4613  case 1: { name = "d";latexString="d"; break; }
4614  case 2: { name = "u";latexString="u";break; }
4615  case 3: { name = "s";latexString="s" ;break; }
4616  case 4: { name = "c";latexString="c" ; break; }
4617  case 5: { name = "b";latexString="b" ; break; }
4618  case 6: { name = "t";latexString="t" ; break; }
4619  case -1: { name = "~d";latexString="#bar{d}" ; break; }
4620  case -2: { name = "~u";latexString="#bar{u}" ; break; }
4621  case -3: { name = "~s";latexString="#bar{s}" ; break; }
4622  case -4: { name = "~c";latexString="#bar{c}" ; break; }
4623  case -5: { name = "~b";latexString="#bar{b}" ; break; }
4624  case -6: { name = "~t";latexString="#bar{t}" ; break; }
4625  case 11: { name = "e-";latexString=name ; break; }
4626  case -11: { name = "e+";latexString=name ; break; }
4627  case 12: { name = "nu_e";latexString="#nu_{e}" ; break; }
4628  case -12: { name = "~nu_e";latexString="#bar{#nu}_{e}" ; break; }
4629  case 13: { name = "mu-";latexString="#mu-" ; break; }
4630  case -13: { name = "mu+";latexString="#mu+" ; break; }
4631  case 14: { name = "nu_mu";latexString="#nu_{mu}" ; break; }
4632  case -14: { name = "~nu_mu";latexString="#bar{#nu}_{#mu}"; break; }
4633  case 15: { name = "tau-";latexString="#tau^{-}" ; break; }
4634  case -15: { name = "tau+";latexString="#tau^{+}" ; break; }
4635  case 16: { name = "nu_tau";latexString="#nu_{#tau}" ; break; }
4636  case -16: { name = "~nu_tau";latexString="#bar{#nu}_{#tau}"; break; }
4637  case 21: { name = "gluon";latexString= name; break; }
4638  case 22: { name = "gamma";latexString= "#gamma"; break; }
4639  case 23: { name = "Z0";latexString="Z^{0}" ; break; }
4640  case 24: { name = "W+";latexString="W^{+}" ; break; }
4641  case 25: { name = "H0";latexString=name ; break; }
4642  case -24: { name = "W-";latexString="W^{-}" ; break; }
4643  case 111: { name = "pi0";latexString="#pi^{0}" ; break; }
4644  case 113: { name = "rho0";latexString="#rho^{0}" ; break; }
4645  case 223: { name = "omega";latexString="#omega" ; break; }
4646  case 333: { name = "phi";latexString= "#phi"; break; }
4647  case 443: { name = "J/psi";latexString="J/#psi" ; break; }
4648  case 553: { name = "Upsilon";latexString="#Upsilon" ; break; }
4649  case 130: { name = "K0L";latexString=name ; break; }
4650  case 211: { name = "pi+";latexString="#pi^{+}" ; break; }
4651  case -211: { name = "pi-";latexString="#pi^{-}" ; break; }
4652  case 213: { name = "rho+";latexString="#rho^{+}" ; break; }
4653  case -213: { name = "rho-";latexString="#rho^{-}" ; break; }
4654  case 221: { name = "eta";latexString="#eta" ; break; }
4655  case 331: { name = "eta'";latexString="#eta'" ; break; }
4656  case 441: { name = "etac";latexString="#eta_{c}" ; break; }
4657  case 551: { name = "etab";latexString= "#eta_{b}"; break; }
4658  case 310: { name = "K0S";latexString=name ; break; }
4659  case 311: { name = "K0";latexString="K^{0}" ; break; }
4660  case -311: { name = "Kbar0";latexString="#bar{#Kappa}^{0}" ; break; }
4661  case 321: { name = "K+";latexString= "K^{+}"; break; }
4662  case -321: { name = "K-";latexString="K^{-}"; break; }
4663  case 411: { name = "D+";latexString="D^{+}" ; break; }
4664  case -411: { name = "D-";latexString="D^{-}"; break; }
4665  case 421: { name = "D0";latexString="D^{0}" ; break; }
4666  case -421: { name = "D0-bar";latexString="#overline{D^{0}}" ; break; }
4667  case 423: { name = "D*0";latexString="D^{*0}" ; break; }
4668  case -423: { name = "D*0-bar";latexString="#overline{D^{*0}}" ; break; }
4669  case 431: { name = "Ds_+";latexString="Ds_{+}" ; break; }
4670  case -431: { name = "Ds_-";latexString="Ds_{-}" ; break; }
4671  case 511: { name = "B0";latexString= name; break; }
4672  case 521: { name = "B+";latexString="B^{+}" ; break; }
4673  case -521: { name = "B-";latexString="B^{-}" ; break; }
4674  case 531: { name = "Bs_0";latexString="Bs_{0}" ; break; }
4675  case -531: { name = "anti-Bs_0";latexString="#overline{Bs_{0}}" ; break; }
4676  case 541: { name = "Bc_+";latexString="Bc_{+}" ; break; }
4677  case -541: { name = "Bc_+";latexString="Bc_{+}" ; break; }
4678  case 313: { name = "K*0";latexString="K^{*0}" ; break; }
4679  case -313: { name = "K*bar0";latexString="#bar{K}^{*0}" ; break; }
4680  case 323: { name = "K*+";latexString="#K^{*+}"; break; }
4681  case -323: { name = "K*-";latexString="#K^{*-}" ; break; }
4682  case 413: { name = "D*+";latexString= "D^{*+}"; break; }
4683  case -413: { name = "D*-";latexString= "D^{*-}" ; break; }
4684 
4685  case 433: { name = "Ds*+";latexString="D_{s}^{*+}" ; break; }
4686  case -433: { name = "Ds*-";latexString="B_{S}{*-}" ; break; }
4687 
4688  case 513: { name = "B*0";latexString="B^{*0}" ; break; }
4689  case -513: { name = "anti-B*0";latexString="#overline{B^{*0}}" ; break; }
4690  case 523: { name = "B*+";latexString="B^{*+}" ; break; }
4691  case -523: { name = "B*-";latexString="B^{*-}" ; break; }
4692 
4693  case 533: { name = "B*_s0";latexString="B^{*}_{s0}" ; break; }
4694  case -533 : {name="anti-B_s0"; latexString= "#overline{B_{s}^{0}}";break; }
4695 
4696  case 543: { name = "B*_c+";latexString= "B^{*}_{c+}"; break; }
4697  case -543: { name = "B*_c-";latexString= "B^{*}_{c-}"; break; }
4698  case 1114: { name = "Delta-";latexString="#Delta^{-}" ; break; }
4699  case -1114: { name = "Deltabar+";latexString="#bar{#Delta}^{+}" ; break; }
4700  case -2112: { name = "nbar0";latexString="{bar}n^{0}" ; break; }
4701  case 2112: { name = "n"; latexString=name ;break;}
4702  case 2114: { name = "Delta0"; latexString="#Delta^{0}" ;break; }
4703  case -2114: { name = "Deltabar0"; latexString="#bar{#Delta}^{0}" ;break; }
4704  case 3122: { name = "Lambda0";latexString= "#Lambda^{0}"; break; }
4705  case -3122: { name = "Lambdabar0";latexString="#bar{#Lambda}^{0}" ; break; }
4706  case 3112: { name = "Sigma-"; latexString="#Sigma" ;break; }
4707  case -3112: { name = "Sigmabar+"; latexString="#bar{#Sigma}^{+}" ;break; }
4708  case 3114: { name = "Sigma*-"; latexString="#Sigma^{*}" ;break; }
4709  case -3114: { name = "Sigmabar*+"; latexString="#bar{#Sigma}^{*+}" ;break; }
4710 
4711 
4712  case 3212: { name = "Sigma0";latexString="#Sigma^{0}" ; break; }
4713  case -3212: { name = "Sigmabar0";latexString="#bar{#Sigma}^{0}" ; break; }
4714  case 3214: { name = "Sigma*0"; latexString="#Sigma^{*0}" ;break; }
4715  case -3214: { name = "Sigma*bar0";latexString="#bar{#Sigma}^{*0}" ; break; }
4716  case 3222: { name = "Sigma+"; latexString="#Sigma^{+}" ;break; }
4717  case -3222: { name = "Sigmabar-"; latexString="#bar{#Sigma}^{-}";break; }
4718  case 3224: { name = "Sigma*+"; latexString="#Sigma^{*+}" ;break; }
4719  case -3224: { name = "Sigmabar*-"; latexString="#bar{#Sigma}^{*-}";break; }
4720 
4721  case 2212: { name = "p";latexString=name ; break; }
4722  case -2212: { name = "~p";latexString="#bar{p}" ; break; }
4723  case -2214: { name = "Delta-";latexString="#Delta^{-}" ; break; }
4724  case 2214: { name = "Delta+";latexString="#Delta^{+}" ; break; }
4725  case -2224: { name = "Deltabar--"; latexString="#bar{#Delta}^{--}" ;break; }
4726  case 2224: { name = "Delta++"; latexString= "#Delta^{++}";break; }
4727 
4728  case 3312: { name = "Xi-"; latexString= "#Xi^{-}";break; }
4729  case -3312: { name = "Xi+"; latexString= "#Xi^{+}";break; }
4730  case 3314: { name = "Xi*-"; latexString= "#Xi^{*-}";break; }
4731  case -3314: { name = "Xi*+"; latexString= "#Xi^{*+}";break; }
4732 
4733  case 3322: { name = "Xi0"; latexString= "#Xi^{0}";break; }
4734  case -3322: { name = "anti-Xi0"; latexString= "#overline{Xi^{0}}";break; }
4735  case 3324: { name = "Xi*0"; latexString= "#Xi^{*0}";break; }
4736  case -3324: { name = "anti-Xi*0"; latexString= "#overline{Xi^{*0}}";break; }
4737 
4738  case 3334: { name = "Omega-"; latexString= "#Omega^{-}";break; }
4739  case -3334: { name = "anti-Omega+"; latexString= "#Omega^{+}";break; }
4740 
4741  case 4122: { name = "Lambda_c+"; latexString= "#Lambda_{c}^{+}";break; }
4742  case -4122: { name = "Lambda_c-"; latexString= "#Lambda_{c}^{-}";break; }
4743  case 4222: { name = "Sigma_c++"; latexString= "#Sigma_{c}^{++}";break; }
4744  case -4222: { name = "Sigma_c--"; latexString= "#Sigma_{c}^{--}";break; }
4745 
4746 
4747  case 92 : {name="String"; latexString= "String";break; }
4748 
4749  case 2101 : {name="ud_0"; latexString= "ud_{0}";break; }
4750  case -2101 : {name="anti-ud_0"; latexString= "#overline{ud}_{0}";break; }
4751  case 2103 : {name="ud_1"; latexString= "ud_{1}";break; }
4752  case -2103 : {name="anti-ud_1"; latexString= "#overline{ud}_{1}";break; }
4753  case 2203 : {name="uu_1"; latexString= "uu_{1}";break; }
4754  case -2203 : {name="anti-uu_1"; latexString= "#overline{uu}_{1}";break; }
4755  case 3303 : {name="ss_1"; latexString= "#overline{ss}_{1}";break; }
4756  case 3101 : {name="sd_0"; latexString= "sd_{0}";break; }
4757  case -3101 : {name="anti-sd_0"; latexString= "#overline{sd}_{0}";break; }
4758  case 3103 : {name="sd_1"; latexString= "sd_{1}";break; }
4759  case -3103 : {name="anti-sd_1"; latexString= "#overline{sd}_{1}";break; }
4760 
4761  case 20213 : {name="a_1+"; latexString= "a_{1}^{+}";break; }
4762  case -20213 : {name="a_1-"; latexString= "a_{1}^{-}";break; }
4763 
4764  default:
4765  {
4766  name = "unknown";
4767  cout << "Unknown code : " << partId << endl;
4768  break;
4769  }
4770 
4771 
4772  }
4773  return name;
4774 
4775 }
4776 
4777 //_____________________________________________________________________________
4779  const reco::PFCandidateCollection& candidates,
4780  std::vector< std::list <simMatch> >& candSimMatchTrack,
4781  std::vector< std::list <simMatch> >& candSimMatchEcal) const
4782 {
4783 
4784  if(!out) return;
4785  out << endl;
4786  out << "Running Monte Carlo Truth Matching Tool" << endl;
4787  out << endl;
4788 
4789  //resize matching vectors
4790  candSimMatchTrack.resize(candidates.size());
4791  candSimMatchEcal.resize(candidates.size());
4792 
4793  for(unsigned i=0; i<candidates.size(); i++) {
4794  const reco::PFCandidate& pfCand = candidates[i];
4795 
4796  //Matching with ECAL clusters
4797  if (verbosity_ == VERBOSE ) {
4798  out <<i<<" " <<(*pfCandidates_)[i]<<endl;
4799  out << "is matching:" << endl;
4800  }
4801 
4802  PFCandidate::ElementsInBlocks eleInBlocks
4803  = pfCand.elementsInBlocks();
4804 
4805  for(unsigned iel=0; iel<eleInBlocks.size(); ++iel) {
4806  PFBlockRef blockRef = eleInBlocks[iel].first;
4807  unsigned indexInBlock = eleInBlocks[iel].second;
4808 
4809  //Retrieving elements of the block
4810  const reco::PFBlock& blockh
4811  = *blockRef;
4813  elements_h = blockh.elements();
4814 
4816  = elements_h[ indexInBlock ].type();
4817 // cout <<"(" << blockRef.key() << "|" <<indexInBlock <<"|"
4818 // << elements_h[ indexInBlock ].type() << ")," << endl;
4819 
4820  //TRACK=================================
4821  if(type == reco::PFBlockElement::TRACK){
4822  const reco::PFRecTrackRef trackref
4823  = elements_h[ indexInBlock ].trackRefPF();
4824  assert( !trackref.isNull() );
4825  const reco::PFRecTrack& track = *trackref;
4826  const reco::TrackRef trkREF = track.trackRef();
4827  unsigned rtrkID = track.trackId();
4828 
4829  //looking for the matching charged simulated particle:
4830  for ( unsigned isim=0; isim < trueParticles_.size(); isim++) {
4831  const reco::PFSimParticle& ptc = trueParticles_[isim];
4832  unsigned trackIDM = ptc.rectrackId();
4833  if(trackIDM != 99999
4834  && trackIDM == rtrkID){
4835 
4836  if (verbosity_ == VERBOSE )
4837  out << "\tSimParticle " << isim
4838  << " through Track matching pTrectrack="
4839  << trkREF->pt() << " GeV" << endl;
4840 
4841  //store info
4842  std::pair<double, unsigned> simtrackmatch
4843  = make_pair(trkREF->pt(),trackIDM);
4844  candSimMatchTrack[i].push_back(simtrackmatch);
4845  }//match
4846  }//loop simparticles
4847 
4848  }//TRACK
4849 
4850  //ECAL=================================
4851  if(type == reco::PFBlockElement::ECAL)
4852  {
4853  const reco::PFClusterRef clusterref
4854  = elements_h[ indexInBlock ].clusterRef();
4855  assert( !clusterref.isNull() );
4856  const reco::PFCluster& cluster = *clusterref;
4857 
4858  const std::vector< reco::PFRecHitFraction >&
4859  fracs = cluster.recHitFractions();
4860 
4861 // cout << "This is an ecal cluster of energy "
4862 // << cluster.energy() << endl;
4863  vector<unsigned> simpID;
4864  vector<double> simpEC(trueParticles_.size(),0.0);
4865  vector<unsigned> simpCN(trueParticles_.size(),0);
4866  for(unsigned int rhit = 0; rhit < fracs.size(); ++rhit){
4867 
4868  const reco::PFRecHitRef& rh = fracs[rhit].recHitRef();
4869  if(rh.isNull()) continue;
4870  const reco::PFRecHit& rechit_cluster = *rh;
4871 // cout << rhit << " ID=" << rechit_cluster.detId()
4872 // << " E=" << rechit_cluster.energy()
4873 // << " fraction=" << fracs[rhit].fraction() << " ";
4874 
4875  //loop on sim particules
4876 // cout << "coming from sim particles: ";
4877  for ( unsigned isim=0; isim < trueParticles_.size(); isim++) {
4878  const reco::PFSimParticle& ptc = trueParticles_[isim];
4879 
4880  vector<unsigned> rechitSimIDs
4881  = ptc.recHitContrib();
4882  vector<double> rechitSimFrac
4883  = ptc.recHitContribFrac();
4884  //cout << "Number of rechits contrib =" << rechitSimIDs.size() << endl;
4885  if( !rechitSimIDs.size() ) continue; //no rechit
4886 
4887  for ( unsigned isimrh=0; isimrh < rechitSimIDs.size(); isimrh++) {
4888  if( rechitSimIDs[isimrh] == rechit_cluster.detId() ){
4889 
4890  bool takenalready = false;
4891  for(unsigned iss = 0; iss < simpID.size(); ++iss)
4892  if(simpID[iss] == isim) takenalready = true;
4893  if(!takenalready) simpID.push_back(isim);
4894 
4895  simpEC[isim] +=
4896  ((rechit_cluster.energy()*rechitSimFrac[isimrh])/100.0)
4897  *fracs[rhit].fraction();
4898 
4899  simpCN[isim]++; //counting rechits
4900 
4901 // cout << isim << " with contribution of ="
4902 // << rechitSimFrac[isimrh] << "%, ";
4903  }//match rechit
4904  }//loop sim rechit
4905  }//loop sim particules
4906 // cout << endl;
4907  }//loop cand rechit
4908 
4909  for(unsigned is=0; is < simpID.size(); ++is)
4910  {
4911  double frac_of_cluster
4912  = (simpEC[simpID[is]]/cluster.energy())*100.0;
4913 
4914  //store info
4915  std::pair<double, unsigned> simecalmatch
4916  = make_pair(simpEC[simpID[is]],simpID[is]);
4917  candSimMatchEcal[i].push_back(simecalmatch);
4918 
4919  if (verbosity_ == VERBOSE ) {
4920  out << "\tSimParticle " << simpID[is]
4921  << " through ECAL matching Epfcluster="
4922  << cluster.energy()
4923  << " GeV with N=" << simpCN[simpID[is]]
4924  << " rechits in common "
4925  << endl;
4926  out << "\t\tsimparticle contributing to a total of "
4927  << simpEC[simpID[is]]
4928  << " GeV of this cluster ("
4929  << frac_of_cluster << "%) "
4930  << endl;
4931  }
4932  }//loop particle matched
4933  }//ECAL clusters
4934 
4935  }//loop elements
4936 
4937  if (verbosity_ == VERBOSE )
4938  cout << "==============================================================="
4939  << endl;
4940 
4941  }//loop pfCandidates_
4942 
4943  if (verbosity_ == VERBOSE ){
4944 
4945  cout << "=================================================================="
4946  << endl;
4947  cout << "SimParticles" << endl;
4948 
4949  //loop simulated particles
4950  for ( unsigned i=0; i < trueParticles_.size(); i++) {
4951  cout << "==== Particle Simulated " << i << endl;
4952  const reco::PFSimParticle& ptc = trueParticles_[i];
4953  out <<i<<" "<<trueParticles_[i]<<endl;
4954 
4955  if(!ptc.daughterIds().empty()){
4956  cout << "Look at the desintegration products" << endl;
4957  cout << endl;
4958  continue;
4959  }
4960 
4961  //TRACKING
4962  if(ptc.rectrackId() != 99999){
4963  cout << "matching pfCandidate (trough tracking): " << endl;
4964  for( unsigned icand=0; icand<candidates.size(); icand++ )
4965  {
4966  ITM it = candSimMatchTrack[icand].begin();
4967  ITM itend = candSimMatchTrack[icand].end();
4968  for(;it!=itend;++it)
4969  if( i == it->second ){
4970  out<<icand<<" "<<(*pfCandidates_)[icand]<<endl;
4971  cout << endl;
4972  }
4973  }//loop candidate
4974  }//trackmatch
4975 
4976 
4977  //CALORIMETRY
4978  vector<unsigned> rechitSimIDs
4979  = ptc.recHitContrib();
4980  vector<double> rechitSimFrac
4981  = ptc.recHitContribFrac();
4982  //cout << "Number of rechits contrib =" << rechitSimIDs.size() << endl;
4983  if( !rechitSimIDs.size() ) continue; //no rechit
4984 
4985  cout << "matching pfCandidate (through ECAL): " << endl;
4986 
4987  //look at total ECAL desposition:
4988  double totalEcalE = 0.0;
4989  for(unsigned irh=0; irh<rechitsECAL_.size();++irh)
4990  for ( unsigned isimrh=0; isimrh < rechitSimIDs.size();
4991  isimrh++ )
4992  if(rechitSimIDs[isimrh] == rechitsECAL_[irh].detId())
4993  totalEcalE += (rechitsECAL_[irh].energy()*rechitSimFrac[isimrh]/100.0);
4994  cout << "For info, this particle deposits E=" << totalEcalE
4995  << "(GeV) in the ECAL" << endl;
4996 
4997  for( unsigned icand=0; icand<candidates.size(); icand++ )
4998  {
4999  ITM it = candSimMatchEcal[icand].begin();
5000  ITM itend = candSimMatchEcal[icand].end();
5001  for(;it!=itend;++it)
5002  if( i == it->second )
5003  out<<icand<<" "<<it->first<<"GeV "<<(*pfCandidates_)[icand]<<endl;
5004  }//loop candidate
5005  cout << endl;
5006  }//loop particles
5007  }//verbose
5008 
5009 }//mctruthmatching
5010 //_____________________________________________________________________________
5011 
5013 PFRootEventManager::stringToTag(const std::vector< std::string >& tagname) {
5014 
5015  if ( tagname.size() == 1 )
5016  return edm::InputTag(tagname[0]);
5017 
5018  else if ( tagname.size() == 2 )
5019  return edm::InputTag(tagname[0], tagname[1]);
5020 
5021  else if ( tagname.size() == 3 )
5022  return tagname[2] == '*' ?
5023  edm::InputTag(tagname[0], tagname[1]) :
5024  edm::InputTag(tagname[0], tagname[1], tagname[2]);
5025  else {
5026  cout << "Invalid tag name with " << tagname.size() << " strings "<< endl;
5027  return edm::InputTag();
5028  }
5029 
5030 }
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
Definition: PFClusterAlgo.h:69
edm::InputTag MCTruthTag_
std::auto_ptr< reco::PFCandidateCollection > transferCandidates()
Definition: PFAlgo.h:203
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:123
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
Definition: PFClusterAlgo.h:89
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:58
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:40
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:230
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
Definition: PFClusterAlgo.h:99
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:42
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:104
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:65
void setHOTag(bool ho)
Definition: PFBlockAlgo.h:202
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:71
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:137
edm::Handle< reco::PFMETCollection > pfMetsHandle_
CMSSW PF MET.
void reconstructParticles(const reco::PFBlockHandle &blockHandle)
Definition: PFAlgo.cc:343
tuple lumi
Definition: fjr2json.py:35
const math::XYZPoint & position() const
cartesian position (x, y, z)
void setS6S2DoubleSpikeEndcap(double cut)
Definition: PFClusterAlgo.h:90
fwlite::ChainEvent * ev_
NEW: input event.
std::vector< InputItem > InputCollection
Definition: JetRecoTypes.h:62
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:181
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:67
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:49
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
#define abs(x)
Definition: mlp_lapack.h:159
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:3365
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:282
void fillOutEventWithCaloTowers(const CaloTowerCollection &cts)
fills outEvent with calo towers
void setThreshBarrel(double thresh)
setters -------------------------------------------------——
Definition: PFClusterAlgo.h:61
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:99
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:95
void setPFVertexParameters(bool useVertex, const reco::VertexCollection *primaryVertices)
Definition: PFAlgo.cc:300
void setEGElectronCollection(const reco::GsfElectronCollection &egelectrons)
Definition: PFAlgo.cc:3253
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:22
void applyCuts(const reco::CandidatePtrVector &Candidates, JetReco::InputCollection *input)
void particleFlow()
performs particle flow
std::vector< ElementInBlock > ElementsInBlocks
Definition: PFCandidate.h:360
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:157
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.
bool GetOpt(const char *tag, const char *key, std::vector< T > &values) const
reads a vector of T
Definition: IO.h:106
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.h:365
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:66
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:30
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
Definition: PFClusterAlgo.h:81
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
Algorithm for particle flow clustering.
Definition: PFClusterAlgo.h:31
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:64
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:79
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:75
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
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
void setDebug(bool debug)
sets debug printout flag
Definition: PFBlockAlgo.h:183
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:62
void setNNeighbours(int n)
set number of neighbours for
Definition: PFClusterAlgo.h:96
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:217
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
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:25
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)
Definition: PFClusterAlgo.h:70
reco::PFCandidateCollection pfCandCMSSW_
#define end
Definition: vmac.h:38
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)
Definition: PFClusterAlgo.h:82
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:265
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)
Definition: PFClusterAlgo.h:78
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:73
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
Definition: PFClusterAlgo.h:77
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
Definition: PFClusterAlgo.h:73
void setHOTag(bool ho)
Definition: PFAlgo.h:60
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:80
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:21
void setParameters(std::vector< double > &DPtovPtCut, std::vector< unsigned > &NHitCut, bool useConvBremPFRecTracks, bool useIterTracking, int nuclearInteractionsPurity, bool useEGPhotons, std::vector< double > &photonSelectionCuts, bool useSuperClusters)
Definition: PFBlockAlgo.cc:31
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_
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:31
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:13
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:51
reco::TrackCollection stdTracks_
std::auto_ptr< reco::PFBlockCollection > transferBlocks()
Definition: PFBlockAlgo.h:195
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:84
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:74
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:62
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:35
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:86
bool useHO_
Use of HO in links with tracks/HCAL and in particle flow reconstruction.
#define begin
Definition: vmac.h:31
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)
Definition: PFClusterAlgo.h:74
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:45
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)
Definition: PFClusterAlgo.h:86
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:64
virtual ParticleType particleId() const
Definition: PFCandidate.h:347
void setMaxPairSize(int aMaxPairSize)
????
void setThreshCleanEndcap(double thresh)
set endcap clean threshold
Definition: PFClusterAlgo.h:85
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
Definition: PFClusterAlgo.h:93
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:61
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
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 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 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:384
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:3470
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