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