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