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