test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GenPurposeSkimmerData.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: GenPurposeSkimmerData
4 // Class: GenPurposeSkimmerData
5 //
40 //
41 // Original Author: Nikolaos Rompotis
42 // Created: Thu Oct 16 17:11:55 CEST 2008
43 //
44 //
45 
47 
48 //
49 //
50 //
52 //
53 //
55 
56 {
57 //
58 // I N P U T P A R A M E T E R S
59 //
60  // output file name
61  outputFile_ = ps.getUntrackedParameter<std::string>("outputfile");
62  //
63  // Electron Collection
64  ElectronCollectionToken_=consumes<pat::ElectronCollection>(ps.getUntrackedParameter<edm::InputTag>("ElectronCollection"));
65  //
66  // MC:
67  //MCCollection_ = ps.getUntrackedParameter<edm::InputTag>("MCCollection");
68  //MCCollectionToken_ = consumes<reco::GenParticleCollection>(MCCollection_);
69  //MCMatch_Deta_ = ps.getUntrackedParameter<double>("MCMatch_Deta",0.1);
70  //MCMatch_Dphi_ = ps.getUntrackedParameter<double>("MCMatch_Dphi",0.35);
71  //
72  // MET Collections:
73  MetCollectionTag_ = ps.getUntrackedParameter<edm::InputTag>("MetCollectionTag");
74  MetCollectionToken_ = consumes<reco::CaloMETCollection>(MetCollectionTag_);
75  mcMetCollectionToken_ = consumes<pat::METCollection>(ps.getUntrackedParameter<edm::InputTag>("mcMetCollectionTag"));
76  t1MetCollectionToken_ = consumes<pat::METCollection>(ps.getUntrackedParameter<edm::InputTag>("t1MetCollectionTag"));
77  pfMetCollectionToken_ = consumes<reco::PFMETCollection>(ps.getUntrackedParameter<edm::InputTag>("pfMetCollectionTag"));
78  tcMetCollectionToken_ = consumes<reco::METCollection>(ps.getUntrackedParameter<edm::InputTag>("tcMetCollectionTag"));
79  // genMetCollectionToken_ = consumes<reco::GenMETCollection>(ps.getUntrackedParameter<edm::InputTag>("genMetCollectionTag"));
80  //
81  // HLT parameters:
82  // allow info for 2 paths and 2 filters
83  // ---------------------------------------------------------------------------
84  HLTCollectionE29_= ps.getUntrackedParameter<edm::InputTag>("HLTCollectionE29");
85  HLTCollectionE29Token_ = consumes<trigger::TriggerEvent>(HLTCollectionE29_);
86  HLTCollectionE31_= ps.getUntrackedParameter<edm::InputTag>("HLTCollectionE31");
87  HLTCollectionE31Token_ = consumes<trigger::TriggerEvent>(HLTCollectionE31_);
88  HLTTriggerResultsE29_ = ps.getUntrackedParameter<edm::InputTag>("HLTTriggerResultsE29");
89  HLTTriggerResultsE29Token_ = consumes<edm::TriggerResults>(HLTTriggerResultsE29_);
90  HLTTriggerResultsE31_ = ps.getUntrackedParameter<edm::InputTag>("HLTTriggerResultsE31");
91  HLTTriggerResultsE31Token_ = consumes<edm::TriggerResults>(HLTTriggerResultsE31_);
92  //HLTPath_ = ps.getUntrackedParameter<std::string>("HLTPath","HLT_Ele15_LW_L1R");
93  //HLTFilterType_ =ps.getUntrackedParameter<edm::InputTag>("HLTFilterType");
94  //
95  // matching HLT objects to electrons
96  ProbeHLTObjMaxDR= ps.getUntrackedParameter<double>("ProbeHLTObjMaxDR",0.2);
97  //
98  // ----------------------------------------------------------------------------
99  //
100  // detector geometry
101  //
102  BarrelMaxEta = ps.getUntrackedParameter<double>("BarrelMaxEta");
103  EndcapMinEta = ps.getUntrackedParameter<double>("EndcapMinEta");
104  EndcapMaxEta = ps.getUntrackedParameter<double>("EndcapMaxEta");
105  //
106  ctfTracksToken_ = consumes<reco::TrackCollection>(ps.getUntrackedParameter<edm::InputTag>("ctfTracksTag"));
107  corHybridscToken_ = consumes<reco::SuperClusterCollection>(ps.getUntrackedParameter<edm::InputTag>("corHybridsc"));
108  multi5x5scToken_ = consumes<reco::SuperClusterCollection>(ps.getUntrackedParameter<edm::InputTag>("multi5x5sc"));
109  offlineBeamSpotToken_ = consumes<reco::BeamSpot>(edm::InputTag("offlineBeamSpot"));
110  pMuonsToken_ = consumes<pat::MuonCollection>(edm::InputTag("selectedLayer1Muons"));
111 
112 }
113 
114 
116 {
117 
118  // do anything here that needs to be done at desctruction time
119  // (e.g. close files, deallocate resources etc.)
120 
121 }
122 
123 
124 //
125 // member functions
126 //
127 
128 // ------------ method called to for each event ------------
129 void
131 {
132  // MC Collection ------------------------------------------------
133 
134  // edm::Handle<reco::GenParticleCollection> pGenPart;
135  // evt.getByToken(MCCollectionToken_, pGenPart);
136  // if ( not pGenPart.isValid() ) {
137  // std::cout <<"Error! Can't get "<<MCCollection_.label() << std::endl;
138  // return;
139  // }
140 
141  // const reco::GenParticleCollection *McCand = pGenPart.product();
142 
143  // GsF Electron Collection ---------------------------------------
145 
146  try{
147  evt.getByToken(ElectronCollectionToken_, pElectrons);
148  }
149  catch (cms::Exception)
150  {
151  edm::LogError("")<< "Error! Can't get ElectronCollection by label. ";
152  }
153  // ***********************************************************************
154  // check which trigger has accepted the event ****************************
155  // ***********************************************************************
156  //
157  // path allocation: first 10 paths belong to the low lum menu, the rest
158  // in the high lum one
159  //
160  // Low Luminosity Menu (8e29)
161  //
162  /*
163  edm::Handle<edm::TriggerResults> HLTResultsE29;
164  evt.getByToken(HLTTriggerResultsE29Token_, HLTResultsE29);
165  if (not HLTResultsE29.isValid()) {
166  std::cout << "HLT Results with label: " << HLTTriggerResultsE29_
167  << " not found" << std::endl;
168  return;
169  }
170  //
171  edm::Handle<trigger::TriggerEvent> pHLTe29;
172  evt.getByToken(HLTCollectionE29Token_, pHLTe29);
173  if (not pHLTe29.isValid()) {
174  std::cout << "HLT Results with label: " << HLTCollectionE29_
175  << " not found" << std::endl;
176  return;
177  }
178  //
179  int sum = 0;
180  //
181  for (int iT=0; iT<10; ++iT) {
182  event_HLTPath[iT] = 0;
183  numberOfHLTFilterObjects[iT] =0;
184  //
185  const edm::TriggerNames & triggerNames = evt.triggerNames(*HLTResultsE29);
186  unsigned int trigger_size = HLTResultsE29->size();
187  unsigned int trigger_position = triggerNames.triggerIndex(HLTPath_[iT]);
188  if (trigger_position < trigger_size )
189  event_HLTPath[iT] = (int) HLTResultsE29->accept(trigger_position);
190  //
191  numberOfHLTFilterObjects[iT] = 0;
192  // check explicitly that the filter is there
193  const int nF(pHLTe29->sizeFilters());
194  const int filterInd = pHLTe29->filterIndex(HLTFilterType_[iT]);
195  if (nF != filterInd) {
196  const trigger::Vids& VIDS (pHLTe29->filterIds(filterInd));
197  const trigger::Keys& KEYS(pHLTe29->filterKeys(filterInd));
198  const int nI(VIDS.size());
199  const int nK(KEYS.size());
200  numberOfHLTFilterObjects[iT] = (nI>nK)? nI:nK;
201  }
202  //if (iT==2) // HLT_Ele15_LW_L1R only this trigger is required
203  sum += numberOfHLTFilterObjects[iT];
204  }
205  //
206  // High Luminosity Menu (1e31) DISABLED - only low lumi level
207  //
208  edm::Handle<edm::TriggerResults> HLTResultsE31;
209  evt.getByToken(HLTTriggerResultsE31Token_, HLTResultsE31);
210  if (not HLTResultsE31.isValid()) {
211  std::cout << "HLT Results with label: " << HLTTriggerResultsE31_
212  << " not found" << std::endl;
213  return;
214  }
216  edm::Handle<trigger::TriggerEvent> pHLTe31;
217  evt.getByToken(HLTCollectionE31Token_, pHLTe31);
218  if (not pHLTe31.isValid()) {
219  std::cout << "HLT Results with label: " << HLTCollectionE31_
220  << " not found" << std::endl;
221  return;
222  }
224  for (int iT=10; iT<25; ++iT) {
225  event_HLTPath[iT] = 0;
226  numberOfHLTFilterObjects[iT] =0;
227  //
228  const edm::TriggerNames & triggerNames = evt.triggerNames(*HLTResultsE31);
229  unsigned int trigger_size = HLTResultsE31->size();
230  unsigned int trigger_position = triggerNames.triggerIndex(HLTPath_[iT]);
231  if (trigger_position < trigger_size )
232  event_HLTPath[iT] = (int) HLTResultsE31->accept(trigger_position);
233  //
234  numberOfHLTFilterObjects[iT] = 0;
235  // check explicitly that the filter is there
236  const int nF(pHLTe31->sizeFilters());
237  const int filterInd = pHLTe31->filterIndex(HLTFilterType_[iT]);
238  if (nF != filterInd) {
239  const trigger::Vids& VIDS (pHLTe31->filterIds(filterInd));
240  const trigger::Keys& KEYS(pHLTe31->filterKeys(filterInd));
241  const int nI(VIDS.size());
242  const int nK(KEYS.size());
243  numberOfHLTFilterObjects[iT] = (nI>nK)? nI:nK;
244  }
245  // not needed
246  sum += numberOfHLTFilterObjects[iT];
247  }
248  if (sum == 0) {
249  //std::cout << "No trigger found in this event..." << std::endl;
250  return;
251  }
252  */
253  //std::cout << "HLT objects: #" << sum << std::endl;
254  // print out the triggers that exist in this event
255  // comment this out if you want to see the names of the existing triggers
257  evt.getByToken(HLTCollectionE29Token_, pHLTe29);
258  if (not pHLTe29.isValid()){
259  std::cout << "Error!!! HLT is missing!" << std::endl;
260  return;
261  } /*
262  else {
263  // check explicitly that the filter is there
264  const int nF(pHLTe29->sizeFilters());
265  for (int filterInd=0; filterInd< nF; ++filterInd) {
266  const trigger::Vids& VIDS (pHLTe29->filterIds(filterInd));
267  const trigger::Keys& KEYS(pHLTe29->filterKeys(filterInd));
268  const int nI(VIDS.size());
269  const int nK(KEYS.size());
270  int nObjects = (nI>nK)? nI:nK;
271  const edm::InputTag filterTag = pHLTe29->filterTag(filterInd);
272  std::cout << "Found filter with name " << filterTag
273  << " and #objects: #" << nObjects << std::endl;
274  }
275  }
276  */
277  // *********************************************************************
278  // MET Collections:
279  //
281  evt.getByToken(MetCollectionToken_, caloMET);
282  //
284  evt.getByToken(t1MetCollectionToken_, t1MET);
285  //
287  evt.getByToken(mcMetCollectionToken_, mcMET);
288  //
290  evt.getByToken(tcMetCollectionToken_, tcMET);
291  //
293  evt.getByToken(pfMetCollectionToken_, pfMET);
294  //
295  // edm::Handle<reco::GenMETCollection> genMET;
296  // evt.getByToken(genMetCollectionToken_, genMET);
297  //
298  // initialize the MET variables ........................................
299  event_MET = -99.; event_MET_phi = -99.; event_MET_sig = -99.;
300  event_mcMET = -99.; event_mcMET_phi = -99.; event_mcMET_sig = -99.;
301  event_tcMET = -99.; event_tcMET_phi = -99.; event_tcMET_sig = -99.;
302  event_pfMET = -99.; event_pfMET_phi = -99.; event_pfMET_sig = -99.;
303  event_t1MET = -99.; event_t1MET_phi = -99.; event_t1MET_sig = -99.;
304  //
305  //event_genMET = -99.; event_genMET_phi= -99.; event_genMET_sig = -99.;
306  //
307  // get the values, if they are available
308  if ( caloMET.isValid() ) {
309  const reco::CaloMETRef MET(caloMET, 0);
310  event_MET = MET->et(); event_MET_phi = MET->phi();
311  event_MET_sig = MET->mEtSig();
312  }
313  else {
314  std::cout << "caloMET not valid: input Tag: " << MetCollectionTag_
315  << std::endl;
316  }
317  if ( tcMET.isValid() ) {
318  const reco::METRef MET(tcMET, 0);
319  event_tcMET = MET->et(); event_tcMET_phi = MET->phi();
320  event_tcMET_sig = MET->mEtSig();
321  }
322  if ( pfMET.isValid() ) {
323  const reco::PFMETRef MET(pfMET, 0);
324  event_pfMET = MET->et(); event_pfMET_phi = MET->phi();
325  event_pfMET_sig = MET->mEtSig();
326  }
327  if ( t1MET.isValid() ) {
328  const pat::METRef MET(t1MET, 0);
329  event_t1MET = MET->et(); event_t1MET_phi = MET->phi();
330  event_t1MET_sig = MET->mEtSig();
331  }
332  if ( mcMET.isValid() ) {
333  const pat::METRef MET(mcMET, 0);
334  event_mcMET = MET->et(); event_mcMET_phi = MET->phi();
335  event_mcMET_sig = MET->mEtSig();
336  }
337 
338  // if ( genMET.isValid() ) {
339  // const reco::GenMETRef MET(genMET, 0);
340  // event_genMET = MET->et(); event_genMET_phi = MET->phi();
341  // event_genMET_sig = MET->mEtSig();
342  // }
343 
344  // std::cout << "t1MET: " << event_t1MET << " twikiT1MET: "
345  // << event_twikiT1MET << ", calo="<<event_MET << std::endl;
346  //
347  // some supercluster collections ...........................................
348  // correcyedHybridSuperClusters
350  evt.getByToken(corHybridscToken_,SC1);
351  const reco::SuperClusterCollection *sc1 = SC1.product();
352  // multi5x5SuperClustersWithPreshower
354  evt.getByToken(multi5x5scToken_,SC2);
355  const reco::SuperClusterCollection *sc2 = SC2.product();
356  //
357  const int n1 = sc1->size();
358  const int n2 = sc2->size();
359  //std::cout << "SC found: hybrid: " << n1 << ", multi5x5: "
360  // << n2 << std::endl;
361  // keep details of the 5 highest ET superclusters
362  for (int i=0; i<5; ++i) {
363  sc_hybrid_et[i] = -9999.;
364  sc_hybrid_eta[i] = -9999.;
365  sc_hybrid_phi[i] = -9999.;
366  //
367  sc_multi5x5_et[i] = -9999.;
368  sc_multi5x5_eta[i] = -9999.;
369  sc_multi5x5_phi[i] = -9999.;
370  //
371  }
372  // sort the energies of the first sc
373  std::vector<double> ETsc1;
374  std::vector<reco::SuperCluster>::const_iterator sc;
375  for (sc = sc1->begin(); sc != sc1->end(); ++sc) {
376  reco::SuperCluster mySc = *sc;
377  double scEt = mySc.energy()/(cosh(mySc.eta()));
378  ETsc1.push_back(scEt);
379 
380  }
381  int *sorted1 = new int[n1];
382  double *et1 = new double[n1];
383  for (int i=0; i<n1; ++i) {
384  et1[i] = ETsc1[i];
385  }
386  // array sorted now has the indices of the highest ET electrons
387  TMath::Sort(n1, et1, sorted1, true);
388  // .........................................................................
389  std::vector<double> ETsc2;
390  for (sc = sc2->begin(); sc != sc2->end(); ++sc) {
391  reco::SuperCluster mySc = *sc;
392  double scEt = mySc.energy()/(cosh(mySc.eta()));
393  ETsc2.push_back(scEt);
394 
395  }
396  int *sorted2 = new int[n2];
397  double *et2 = new double[n2];
398  for (int i=0; i<n2; ++i) {
399  et2[i] = ETsc2[i];
400  }
401  // array sorted now has the indices of the highest ET electrons
402  TMath::Sort(n2, et2, sorted2, true);
403  //
404  //
405  for( int probeSc = 0; probeSc < n1; ++probeSc)
406  {
407  //std::cout<<"sorted["<< probeIt<< "]=" << sorted[probeIt] << std::endl;
408  // break if you have more than the appropriate number of electrons
409  if (probeSc >= 5) break;
410  //
411  int sc_index = sorted1[probeSc];
412  std::vector<reco::SuperCluster>::const_iterator
413  Rprobe = sc1->begin() + sc_index;
414  //
415  reco::SuperCluster sc0 = *Rprobe;
416  // now keep the relevant stuff:
417  sc_hybrid_et[probeSc] = sc0.energy()/(cosh(sc0.eta()));
418  sc_hybrid_eta[probeSc] = sc0.eta();
419  sc_hybrid_phi[probeSc] = sc0.phi();
420  }
421  // .........................................................................
422  for( int probeSc = 0; probeSc < n2; ++probeSc)
423  {
424  //std::cout<<"sorted["<< probeIt<< "]=" << sorted[probeIt] << std::endl;
425  // break if you have more than the appropriate number of electrons
426  if (probeSc >= 5) break;
427  //
428  int sc_index = sorted2[probeSc];
429  std::vector<reco::SuperCluster>::const_iterator
430  Rprobe = sc2->begin() + sc_index;
431  //
432  reco::SuperCluster sc0 = *Rprobe;
433  // now keep the relevant stuff:
434  sc_multi5x5_et[probeSc] = sc0.energy()/(cosh(sc0.eta()));
435  sc_multi5x5_eta[probeSc] = sc0.eta();
436  sc_multi5x5_phi[probeSc] = sc0.phi();
437  }
438  delete [] sorted1; delete [] sorted2;
439  delete [] et1; delete [] et2;
441  // edm::InputTag ctfTracksTag("generalTracks", "", InputTagEnding_);
443  evt.getByToken(ctfTracksToken_, ctfTracks);
444  const reco::TrackCollection *ctf = ctfTracks.product();
445  reco::TrackCollection::const_iterator tr;
446  const int ntracks = ctf->size();
447  //
448  // get the beam spot for the parameter of the track
449  edm::Handle<reco::BeamSpot> pBeamSpot;
450  evt.getByToken(offlineBeamSpotToken_, pBeamSpot);
451  const reco::BeamSpot *bspot = pBeamSpot.product();
452  const math::XYZPoint bspotPosition = bspot->position();
453  //
454  for (int i=0; i<20; ++i) {
455  ctf_track_pt[i] = -9999.;
456  ctf_track_eta[i] = -9999.;
457  ctf_track_phi[i] = -9999.;
458  ctf_track_vx[i] = -9999.; ctf_track_vy[i]=-9999.; ctf_track_vz[i] =-9999.;
459  ctf_track_tip[i] = -9999.; ctf_track_tip_bs[i] = -9999.;
460  }
461  //
462  std::vector<double> ETtrack;
463  for (tr = ctf->begin(); tr != ctf->end(); ++tr) {
464  reco::Track mySc = *tr;
465  double scEt = mySc.pt();
466  ETtrack.push_back(scEt);
467  }
468  int *sortedTr = new int[ntracks];
469  double *etTr = new double[ntracks];
470  for (int i=0; i<ntracks; ++i) {
471  etTr[i] = ETtrack[i];
472  }
473  // array sorted now has the indices of the highest ET electrons
474  TMath::Sort(ntracks, etTr, sortedTr, true);
475  //
476  for( int probeSc = 0; probeSc < ntracks; ++probeSc)
477  {
478  //std::cout<<"sorted["<< probeIt<< "]=" << sorted[probeIt] << std::endl;
479  // break if you have more than the appropriate number of electrons
480  if (probeSc >= 20) break;
481  //
482  int sc_index = sortedTr[probeSc];
483  std::vector<reco::Track>::const_iterator
484  Rprobe = ctf->begin() + sc_index;
485  //
486  reco::Track sc0 = *Rprobe;
487  // now keep the relevant stuff:
488  ctf_track_pt[probeSc] = sc0.pt();
489  ctf_track_eta[probeSc] = sc0.eta();
490  ctf_track_phi[probeSc] = sc0.phi();
491  ctf_track_vx[probeSc] = sc0.vx();
492  ctf_track_vy[probeSc] = sc0.vy();
493  ctf_track_vz[probeSc] = sc0.vz();
494  ctf_track_tip[probeSc] = -sc0.dxy();
495  ctf_track_tip_bs[probeSc] = -sc0.dxy(bspotPosition);
496  }
497  delete [] sortedTr; delete [] etTr;
498  //
499  // keep 4 of the selectedLayer1Muons for reference
501  evt.getByToken(pMuonsToken_, pMuons);
502  const pat::MuonCollection *pmuon = pMuons.product();
503  pat::MuonCollection::const_iterator muon;
504  const int nmuons = pMuons->size();
505  //
506  for (int i=0; i<4; ++i) {
507  muon_pt[i] = -9999.;
508  muon_eta[i] = -9999.;
509  muon_phi[i] = -9999.;
510  muon_vx[i] = -9999.; muon_vy[i] = -9999.; muon_vz[i] = -9999.;
511  muon_tip[i] = -9999.; muon_tip_bs[i] = -9999.;
512  }
513  //
514  std::vector<double> ETmuons;
515  for (muon = pmuon->begin(); muon != pmuon->end(); ++muon) {
516  pat::Muon mySc = *muon;
517  double scEt = mySc.track()->pt();
518  ETmuons.push_back(scEt);
519  }
520  int *sortedMu = new int[nmuons];
521  double *etMu = new double[nmuons];
522  for (int i=0; i<nmuons; ++i) {
523  etMu[i] = ETmuons[i];
524  }
525  // array sorted now has the indices of the highest ET electrons
526  TMath::Sort(nmuons, etMu, sortedMu, true);
527  //
528  for( int probeSc = 0; probeSc < nmuons; ++probeSc)
529  {
530  //std::cout<<"sorted["<< probeIt<< "]=" << sorted[probeIt] << std::endl;
531  // break if you have more than the appropriate number of electrons
532  if (probeSc >= 4) break;
533  //
534  int sc_index = sortedMu[probeSc];
535  std::vector<pat::Muon>::const_iterator
536  Rprobe = pmuon->begin() + sc_index;
537  //
538  pat::Muon sc0 = *Rprobe;
539  // now keep the relevant stuff:
540  muon_pt[probeSc] = sc0.track()->pt();
541  muon_eta[probeSc] = sc0.track()->eta();
542  muon_phi[probeSc] = sc0.track()->phi();
543  muon_vx[probeSc] = sc0.track()->vx();
544  muon_vy[probeSc] = sc0.track()->vy();
545  muon_vz[probeSc] = sc0.track()->vz();
546  muon_tip[probeSc] = -sc0.track()->dxy();
547  muon_tip_bs[probeSc] = -sc0.track()->dxy(bspotPosition);
548  }
549  delete [] sortedMu; delete [] etMu;
550  //
551  if (n1+n2+ntracks == 0) {
552  std::cout << "Return: no sc in this event" << std::endl;
553  return;
554  }
555  // /////////////////////////////////////////////////////////////////////////
556  // electron details
558  const int MAX_PROBES = 4;
559  for(int i =0; i < MAX_PROBES; i++){
560  probe_ele_eta_for_tree[i] = -99.0;
561  probe_ele_et_for_tree[i] = -99.0;
562  probe_ele_phi_for_tree[i] = -99.0;
563  probe_ele_Xvertex_for_tree[i] = -99.0;
564  probe_ele_Yvertex_for_tree[i] = -99.0;
565  probe_ele_Zvertex_for_tree[i] = -99.0;
566  probe_ele_tip[i] = -999.;
567 
568  probe_sc_eta_for_tree[i] = -99.0;
569  probe_sc_et_for_tree[i] = -99.0;
570  probe_sc_phi_for_tree[i] = -99.0;
571 
572  probe_charge_for_tree[i] = -99;
575  //
576  // probe isolation values ............
577  probe_isolation_value[i] = 999.0;
578  probe_iso_user[i] = 999.0;
580  probe_ecal_iso_user[i] = 999;
582  probe_hcal_iso_user[i] = 999;
583 
584  probe_ele_hoe[i] = 999.;
585  probe_ele_shh[i] = 999.;
586  probe_ele_sihih[i] = 999.;
587  probe_ele_dhi[i] = 999.;
588  probe_ele_dfi[i] = 999.;
589  probe_ele_eop[i] = 999.;
590  probe_ele_pin[i] = 999.;
591  probe_ele_pout[i] = 999.;
592  probe_ele_e5x5[i] = 999.;
593  probe_ele_e2x5[i] = 999.;
594  probe_ele_e1x5[i] = 999.;
595 
596  //
597  //
598  //for (int j=0; j<25; ++j) {
599  // probe_pass_trigger_cut[i][j]=0;
600  //}
601  //probe_hlt_matched_dr[i]=0;
602  //probe_mc_matched[i] = 0;
603  //probe_mc_matched_deta[i] = 999.;
604  //probe_mc_matched_dphi[i] = 999.;
605  //probe_mc_matched_denergy[i] = 999.;
606  //probe_mc_matched_mother[i] = 999;
607  //
608  //
609  }
610  const pat::ElectronCollection *electrons= pElectrons.product();
611 
612 
613  elec_number_in_event = electrons->size();
614  //std::cout << "In this event " << elec_number_in_event <<
615  // " electrons were found" << std::endl;
616  // if (elec_number_in_event == 0) return;
617 
618  std::vector<pat::ElectronRef> UniqueElectrons;
619  // edm::LogInfo("") << "Starting loop over electrons.";
620  int index =0;
621  //***********************************************************************
622  // NEW METHOD by D WARDROPE implemented 26.05.08 ************************
623  //************* DUPLICATE ****** REMOVAL *******************************
624  // 02.06.08: due to a bug in the hybrid algorithm that affects detid ****
625  // we change detid matching to superCluster ref matching ******
626  for(pat::ElectronCollection::const_iterator
627  elec = electrons->begin(); elec != electrons->end();++elec) {
628  const pat::ElectronRef electronRef(pElectrons, index);
629  //Remove duplicate electrons which share a supercluster
630  pat::ElectronCollection::const_iterator BestDuplicate = elec;
631  int index2 = 0;
632  for(pat::ElectronCollection::const_iterator
633  elec2 = electrons->begin();
634  elec2 != electrons->end(); ++elec2)
635  {
636  if(elec != elec2)
637  {
638  if( elec->superCluster() == elec2->superCluster())
639  {
640  if(fabs(BestDuplicate->eSuperClusterOverP()-1.)
641  >= fabs(elec2->eSuperClusterOverP()-1.))
642  {
643  BestDuplicate = elec2;
644  }
645  }
646  }
647  ++index2;
648  }
649  if(BestDuplicate == elec) UniqueElectrons.push_back(electronRef);
650  ++index;
651  }
652  //
653  // debugging: store electrons after duplicate removal
654  elec_1_duplicate_removal = UniqueElectrons.size();
655  //std::cout << "In this event there are " << elec_1_duplicate_removal
656  // << " electrons" << std::endl;
657  //
658  //
659  // duplicate removal is done now:
660  // the electron collection is in UniqueElectrons
661  //
662  // run over probes - now probe electrons and store
663  //
664  // the electron collection is now
665  // vector<reco::PixelMatchGsfElectronRef> UniqueElectrons
666  std::vector<double> ETs;
667  std::vector<pat::ElectronRef>::const_iterator elec;
668  for (elec = UniqueElectrons.begin(); elec != UniqueElectrons.end(); ++elec) {
669  pat::ElectronRef probeEle;
670  probeEle = *elec;
671  double probeEt = probeEle->caloEnergy()/(cosh(probeEle->caloPosition().eta()));
672  ETs.push_back(probeEt);
673 
674  }
675  int *sorted = new int[elec_1_duplicate_removal];
676  double *et = new double[elec_1_duplicate_removal];
677  //std::cout << "Elecs: " << elec_1_duplicate_removal << std::endl;
678  for (int i=0; i<elec_1_duplicate_removal; ++i) {
679  et[i] = ETs[i];
680  //std::cout << "et["<< i << "]=" << et[i] << std::endl;
681  }
682  // array sorted now has the indices of the highest ET electrons
683  TMath::Sort(elec_1_duplicate_removal, et, sorted, true);
684  //
685  //
686  for( int probeIt = 0; probeIt < elec_1_duplicate_removal; ++probeIt)
687  {
688  //std::cout<<"sorted["<< probeIt<< "]=" << sorted[probeIt] << std::endl;
689  // break if you have more than the appropriate number of electrons
690  if (probeIt >= MAX_PROBES) break;
691  //
692  int elec_index = sorted[probeIt];
693  std::vector<pat::ElectronRef>::const_iterator
694  Rprobe = UniqueElectrons.begin() + elec_index;
695  //
696  pat::ElectronRef probeEle;
697  probeEle = *Rprobe;
698  double probeEt = probeEle->caloEnergy()/(cosh(probeEle->caloPosition().eta()));
699  probe_sc_eta_for_tree[probeIt] = probeEle->caloPosition().eta();
700  probe_sc_phi_for_tree[probeIt] = probeEle->caloPosition().phi();
701  probe_sc_et_for_tree[probeIt] = probeEt;
702  // fiducial cut ...............................
703  if(fabs(probeEle->caloPosition().eta()) < BarrelMaxEta ||
704  (fabs(probeEle->caloPosition().eta()) > EndcapMinEta &&
705  fabs(probeEle->caloPosition().eta()) < EndcapMaxEta)){
706  probe_sc_pass_fiducial_cut[probeIt] = 1;
707  }
708  //
709  probe_charge_for_tree[probeIt] = probeEle->charge();
710  probe_ele_eta_for_tree[probeIt] = probeEle->eta();
711  probe_ele_et_for_tree[probeIt] = probeEle->et();
712  probe_ele_phi_for_tree[probeIt] =probeEle->phi();
713  probe_ele_Xvertex_for_tree[probeIt] =probeEle->vx();
714  probe_ele_Yvertex_for_tree[probeIt] =probeEle->vy();
715  probe_ele_Zvertex_for_tree[probeIt] =probeEle->vz();
717  probeEle->classification();
718  double ProbeTIP = probeEle->gsfTrack()->d0();
719  probe_ele_tip[probeIt] = ProbeTIP;
720  // isolation ..................................
721  // these are the default values: trk 03, ecal, hcal 04
722  // I know that there is a more direct way, but in this way it
723  // is clearer what you get each time :P
724  probe_isolation_value[probeIt] = probeEle->dr03IsolationVariables().tkSumPt;
725  probe_ecal_isolation_value[probeIt] = probeEle->dr04IsolationVariables().ecalRecHitSumEt;
726  probe_hcal_isolation_value[probeIt] =
727  probeEle->dr04IsolationVariables().hcalDepth1TowerSumEt +
728  probeEle->dr04IsolationVariables().hcalDepth2TowerSumEt;
729  // one extra isos:
730  probe_iso_user[probeIt] = probeEle->dr04IsolationVariables().tkSumPt;
731  probe_ecal_iso_user[probeIt] = probeEle->dr03IsolationVariables().ecalRecHitSumEt;
732  probe_hcal_iso_user[probeIt] =
733  probeEle->dr03IsolationVariables().hcalDepth1TowerSumEt +
734  probeEle->dr03IsolationVariables().hcalDepth2TowerSumEt;
735  // ele id variables
736  double hOverE = probeEle->hadronicOverEm();
737  double deltaPhiIn = probeEle->deltaPhiSuperClusterTrackAtVtx();
738  double deltaEtaIn = probeEle->deltaEtaSuperClusterTrackAtVtx();
739  double eOverP = probeEle->eSuperClusterOverP();
740  double pin = probeEle->trackMomentumAtVtx().R();
741  double pout = probeEle->trackMomentumOut().R();
742  double sigmaee = probeEle->scSigmaEtaEta();
743  double sigma_IetaIeta = probeEle->scSigmaIEtaIEta();
744  // correct if in endcaps
745  if( fabs (probeEle->caloPosition().eta()) > 1.479 ) {
746  sigmaee = sigmaee - 0.02*(fabs(probeEle->caloPosition().eta()) -2.3);
747  }
748  //
749  //double e5x5, e2x5Right, e2x5Left, e2x5Top, e2x5Bottom, e1x5;
750  double e5x5, e2x5, e1x5;
751  e5x5 = probeEle->scE5x5();
752  e1x5 = probeEle->scE1x5();
753  e2x5 = probeEle->scE2x5Max();
754  //
755  // electron ID variables
756  probe_ele_hoe[probeIt] = hOverE;
757  probe_ele_shh[probeIt] = sigmaee;
758  probe_ele_sihih[probeIt] = sigma_IetaIeta;
759  probe_ele_dfi[probeIt] = deltaPhiIn;
760  probe_ele_dhi[probeIt] = deltaEtaIn;
761  probe_ele_eop[probeIt] = eOverP;
762  probe_ele_pin[probeIt] = pin;
763  probe_ele_pout[probeIt] = pout;
764  probe_ele_e5x5[probeIt] = e5x5;
765  probe_ele_e2x5[probeIt] = e2x5;
766  probe_ele_e1x5[probeIt] = e1x5;
767 
768  //
769  // HLT filter ------------------------------------------------------
770  //
771  //
772  // low luminosity filters
773  /*************************************************************
774  for (int filterNum=0; filterNum<10; ++filterNum) {
775  int trigger_int_probe = 0;
776 
777  //double hlt_matched_dr = -1.;
778  const int nF(pHLTe29->sizeFilters());
779  //
780  // default (tag) trigger filter
781  //
782  // find how many relevant
783  const int iF = pHLTe29->filterIndex(HLTFilterType_[filterNum]);
784  // loop over these objects to see whether they match
785  const trigger::TriggerObjectCollection& TOC(pHLTe29->getObjects());
786  if (nF != iF) {
787  // find how many objects there are
788  const trigger::Keys& KEYS(pHLTe29->filterKeys(iF));
789  const int nK(KEYS.size());
790  for (int iTrig = 0;iTrig <nK; ++iTrig ) {
791  const trigger::TriggerObject& TO(TOC[KEYS[iTrig]]);
792  //std::cout << "--> filter: "<< HLTFilterType_[filterNum] <<" TO id: " << TO.id() << std::endl;
793  // this is better to be left out: HLT matching is with an HLT object
794  // and we don't care what this object is
795  //if (abs(TO.id())==11 ) { // demand it to be an electron
796  double dr_ele_HLT =
797  reco::deltaR(probeEle->eta(), probeEle->phi(), TO.eta(), TO.phi());
798  if (fabs(dr_ele_HLT) < ProbeHLTObjMaxDR) {++trigger_int_probe;
799  //hlt_matched_dr = dr_ele_HLT;
800  }
801  //}
802  }
803  }
804  //
805  if(trigger_int_probe>0) probe_pass_trigger_cut[probeIt][filterNum] = 1;
806  //probe_hlt_matched_dr[probeIt] = hlt_matched_dr;
807  }
808  // high lumi filters
809  for (int filterNum=10; filterNum<25; ++filterNum) {
810  int trigger_int_probe = 0;
811 
812  //double hlt_matched_dr = -1.;
813  const int nF(pHLTe31->sizeFilters());
814  //
815  // default (tag) trigger filter
816  //
817  // find how many relevant
818  const int iF = pHLTe31->filterIndex(HLTFilterType_[filterNum]);
819  // loop over these objects to see whether they match
820  const trigger::TriggerObjectCollection& TOC(pHLTe31->getObjects());
821  if (nF != iF) {
822  // find how many objects there are
823  const trigger::Keys& KEYS(pHLTe31->filterKeys(iF));
824  const int nK(KEYS.size());
825  for (int iTrig = 0;iTrig <nK; ++iTrig ) {
826  const trigger::TriggerObject& TO(TOC[KEYS[iTrig]]);
827  //if (abs(TO.id())==11 ) { // demand it to be an electron
828  double dr_ele_HLT =
829  reco::deltaR(probeEle->eta(), probeEle->phi(), TO.eta(), TO.phi());
830  if (fabs(dr_ele_HLT) < ProbeHLTObjMaxDR) {++trigger_int_probe;
831  //hlt_matched_dr = dr_ele_HLT;
832  }
833  }
834  }
835 
836  //
837  if(trigger_int_probe>0) probe_pass_trigger_cut[probeIt][filterNum] = 1;
838  //probe_hlt_matched_dr[probeIt] = hlt_matched_dr;
839  }
840  ******************************************/
841  // ------------------------------------------------------------------
842  //
843  // MC Matching ......................................................
844  // check whether these electrons are matched to a MC electron
845  /*
846  int mc_index = 0;
847  int matched = 0; int mother_id = 999;
848  double deta_matched = 999.; double dphi_matched = 999.;
849  double denergy_matched = 999.;
850  for(reco::GenParticleCollection::const_iterator McParticle =
851  McCand->begin(); McParticle != McCand->end(); ++McParticle)
852  {
853  // check only for electrons
854  if(abs(McParticle->pdgId())==11 && McParticle->status()==1) {
855  mc_index++;
856  // check whether it matches a gsf electron
857  double deta = McParticle->eta() - probeEle->eta();
858  double dphi = McParticle->phi() - probeEle->phi();
859  if ( fabs(deta) < MCMatch_Deta_ && fabs(dphi) < MCMatch_Dphi_){
860  ++matched;
861  deta_matched = deta; dphi_matched = dphi;
862  denergy_matched = McParticle->energy() - probeEle->caloEnergy();
863  // find the mother of the MC electron
864  const reco::Candidate *mum;
865  bool mother_finder = true;
866  if (abs(McParticle->mother()->pdgId()) != 11)
867  mum = McParticle->mother();
868  else if (abs(McParticle->mother()->mother()->pdgId())!= 11)
869  mum = McParticle->mother()->mother();
870  else {
871  edm::LogInfo("info") << "Going too far to find the mum";
872  mother_finder = false;
873  }
874  if (mother_finder) {
875  mother_id = mum->pdgId();
876  }
877  }
878  }
879  }
880  probe_mc_matched[probeIt] = matched;
881  probe_mc_matched_deta[probeIt] = deta_matched;
882  probe_mc_matched_dphi[probeIt] = dphi_matched;
883  probe_mc_matched_denergy[probeIt] = denergy_matched;
884  probe_mc_matched_mother[probeIt] = mother_id;
885  */
886  }
887 
888  probe_tree->Fill();
889  ++ tree_fills_;
890  delete [] sorted;
891  delete [] et;
892 }
893 
894 
895 // ------------ method called once each job just before starting event loop --
896 void
898 {
899  //std::cout << "In beginJob()" << std::endl;
900  TString filename_histo = outputFile_;
901  histofile = new TFile(filename_histo,"RECREATE");
902  tree_fills_ = 0;
903 
904  probe_tree = new TTree("probe_tree","Tree to store probe variables");
905 
906  //probe_tree->Branch("probe_ele_eta",probe_ele_eta_for_tree,"probe_ele_eta[4]/D");
907  //probe_tree->Branch("probe_ele_phi",probe_ele_phi_for_tree,"probe_ele_phi[4]/D");
908  //probe_tree->Branch("probe_ele_et",probe_ele_et_for_tree,"probe_ele_et[4]/D");
909  probe_tree->Branch("probe_ele_tip",probe_ele_tip,"probe_ele_tip[4]/D");
910  probe_tree->Branch("probe_ele_vertex_x",probe_ele_Xvertex_for_tree,
911  "probe_ele_vertex_x[4]/D");
912  probe_tree->Branch("probe_ele_vertex_y",probe_ele_Yvertex_for_tree,
913  "probe_ele_vertex_y[4]/D");
914  probe_tree->Branch("probe_ele_vertex_z",probe_ele_Zvertex_for_tree,
915  "probe_ele_vertex_z[4]/D");
916  probe_tree->Branch("probe_sc_eta",probe_sc_eta_for_tree,"probe_sc_eta[4]/D");
917  probe_tree->Branch("probe_sc_phi",probe_sc_phi_for_tree,"probe_sc_phi[4]/D");
918  probe_tree->Branch("probe_sc_et",probe_sc_et_for_tree,"probe_sc_et[4]/D");
919 
920  // trigger related variables
921  //probe_tree->Branch("probe_trigger_cut",probe_pass_trigger_cut,"probe_trigger_cut[4][25]/I");
922  //probe_tree->Branch("probe_hlt_matched_dr", probe_hlt_matched_dr,"probe_hlt_matched_dr[4]/D");
923  // mc matching to electrons
924  // probe_tree->Branch("probe_mc_matched",probe_mc_matched,"probe_mc_matched[4]/I");
925  //probe_tree->Branch("probe_mc_matched_deta",probe_mc_matched_deta,
926  // "probe_mc_matched_deta[4]/D");
927  //probe_tree->Branch("probe_mc_matched_dphi",probe_mc_matched_dphi,
928  // "probe_mc_matched_dphi[4]/D");
929  //probe_tree->Branch("probe_mc_matched_denergy",probe_mc_matched_denergy,
930  // "probe_mc_matched_denergy[4]/D");
931  //probe_tree->Branch("probe_mc_matched_mother",probe_mc_matched_mother,
932  // "probe_mc_matched_mother[4]/I");
933  //
934  probe_tree->Branch("probe_charge",probe_charge_for_tree,"probe_charge[4]/I");
935  //probe_tree->Branch("probe_sc_fiducial_cut",probe_sc_pass_fiducial_cut,
936  // "probe_sc_fiducial_cut[4]/I");
937 
938 
939 
940  //probe_tree->Branch("probe_classification",
941  // probe_classification_index_for_tree,"probe_classification[4]/I");
942  //
943  // Isolation related variables ........................................
944  //
945  probe_tree->Branch("probe_isolation_value",probe_isolation_value, "probe_isolation_value[4]/D");
946  probe_tree->Branch("probe_ecal_isolation_value",probe_ecal_isolation_value, "probe_ecal_isolation_value[4]/D");
947  probe_tree->Branch("probe_hcal_isolation_value",probe_hcal_isolation_value,"probe_hcal_isolation_value[4]/D");
948  //
949  probe_tree->Branch("probe_iso_user", probe_iso_user, "probe_iso_user[4]/D");
950  probe_tree->Branch("probe_ecal_iso_user",probe_ecal_iso_user, "probe_ecal_iso_user[4]/D");
951  probe_tree->Branch("probe_hcal_iso_user",probe_hcal_iso_user, "probe_hcal_iso_user[4]/D");
952 
953  //......................................................................
954  // Electron ID Related variables .......................................
955  probe_tree->Branch("probe_ele_hoe",probe_ele_hoe, "probe_ele_hoe[4]/D");
956  //probe_tree->Branch("probe_ele_shh",probe_ele_shh, "probe_ele_shh[4]/D");
957  probe_tree->Branch("probe_ele_sihih",probe_ele_sihih,"probe_ele_sihih[4]/D");
958  probe_tree->Branch("probe_ele_dfi",probe_ele_dfi, "probe_ele_dfi[4]/D");
959  probe_tree->Branch("probe_ele_dhi",probe_ele_dhi, "probe_ele_dhi[4]/D");
960  probe_tree->Branch("probe_ele_eop",probe_ele_eop, "probe_ele_eop[4]/D");
961  probe_tree->Branch("probe_ele_pin",probe_ele_pin, "probe_ele_pin[4]/D");
962  probe_tree->Branch("probe_ele_pout",probe_ele_pout, "probe_ele_pout[4]/D");
963  // probe_tree->Branch("probe_ele_e5x5",probe_ele_e5x5, "probe_ele_e5x5[4]/D");
964  //probe_tree->Branch("probe_ele_e2x5",probe_ele_e2x5, "probe_ele_e2x5[4]/D");
965  //probe_tree->Branch("probe_ele_e1x5",probe_ele_e1x5, "probe_ele_e1x5[4]/D");
966 
967  //.......................................................................
968  //
969  // each entry for each trigger path
970  //probe_tree->Branch("event_HLTPath",event_HLTPath,"event_HLTPath[25]/I");
971  //probe_tree->Branch("numberOfHLTFilterObjects", numberOfHLTFilterObjects,
972  // "numberOfHLTFilterObjects[25]/I");
973  //
974  // debugging info:
975  //probe_tree->Branch("elec_number_in_event",&elec_number_in_event,"elec_number_in_event/I");
976  probe_tree->Branch("elec_1_duplicate_removal",&elec_1_duplicate_removal,"elec_1_duplicate_removal/I");
977  //
978 
979  // Missing ET in the event
980  probe_tree->Branch("event_MET",&event_MET,"event_MET/D");
981  probe_tree->Branch("event_MET_phi",&event_MET_phi,"event_MET_phi/D");
982  // probe_tree->Branch("event_MET_sig",&event_MET_sig,"event_MET_sig/D");
983  probe_tree->Branch("event_mcMET",&event_mcMET,"event_mcMET/D");
984  probe_tree->Branch("event_mcMET_phi",&event_mcMET_phi,"event_mcMET_phi/D");
985  //
986  probe_tree->Branch("event_tcMET",&event_tcMET,"event_tcMET/D");
987  probe_tree->Branch("event_tcMET_phi",&event_tcMET_phi,"event_tcMET_phi/D");
988  // probe_tree->Branch("event_tcMET_sig",&event_tcMET_sig,"event_tcMET_sig/D");
989 
990  probe_tree->Branch("event_pfMET",&event_pfMET,"event_pfMET/D");
991  probe_tree->Branch("event_pfMET_phi",&event_pfMET_phi,"event_pfMET_phi/D");
992  // probe_tree->Branch("event_pfMET_sig",&event_pfMET_sig,"event_pfMET_sig/D");
993 
994  // probe_tree->Branch("event_genMET",&event_genMET,"event_genMET/D");
995  // probe_tree->Branch("event_genMET_phi",&event_genMET_phi, "event_genMET_phi/D");
996  // probe_tree->Branch("event_genMET_sig",&event_genMET_sig, "event_genMET_sig/D");
997  //..... type 1 corrected MET
998  probe_tree->Branch("event_t1MET", &event_t1MET, "event_t1MET/D");
999  probe_tree->Branch("event_t1MET_phi", &event_t1MET_phi,"event_t1MET_phi/D");
1000  //probe_tree->Branch("event_t1MET_sig",&event_t1MET_sig,"event_t1MET_sig/D");
1001 
1002  //
1003  // some sc related variables
1004  probe_tree->Branch("sc_hybrid_et", sc_hybrid_et, "sc_hybrid_et[5]/D");
1005  probe_tree->Branch("sc_hybrid_eta", sc_hybrid_eta, "sc_hybrid_eta[5]/D");
1006  probe_tree->Branch("sc_hybrid_phi", sc_hybrid_phi, "sc_hybrid_phi[5]/D");
1007  //
1008  probe_tree->Branch("sc_multi5x5_et",sc_multi5x5_et, "sc_multi5x5_et[5]/D");
1009  probe_tree->Branch("sc_multi5x5_eta",sc_multi5x5_eta,"sc_multi5x5_eta[5]/D");
1010  probe_tree->Branch("sc_multi5x5_phi",sc_multi5x5_phi,"sc_multi5x5_phi[5]/D");
1011  // /////////////////////////////////////////////////////////////////////////
1012  // general tracks in the event: keep 20 tracks
1013  probe_tree->Branch("ctf_track_pt", ctf_track_pt, "ctf_track_pt[20]/D");
1014  probe_tree->Branch("ctf_track_eta", ctf_track_eta, "ctf_track_eta[20]/D");
1015  probe_tree->Branch("ctf_track_phi", ctf_track_phi, "ctf_track_phi[20]/D");
1016  probe_tree->Branch("ctf_track_vx", ctf_track_vx, "ctf_track_vx[20]/D");
1017  probe_tree->Branch("ctf_track_vy", ctf_track_vy, "ctf_track_vy[20]/D");
1018  probe_tree->Branch("ctf_track_vz", ctf_track_vz, "ctf_track_vz[20]/D");
1019  probe_tree->Branch("ctf_track_tip", ctf_track_tip, "ctf_track_tip[20]/D");
1020  probe_tree->Branch("ctf_track_tip_bs", ctf_track_tip_bs,
1021  "ctf_track_tip_bs[20]/D");
1022  //
1023  probe_tree->Branch("muon_pt", muon_pt, "muon_pt[4]/D");
1024  probe_tree->Branch("muon_eta", muon_eta, "muon_eta[4]/D");
1025  probe_tree->Branch("muon_phi", muon_phi, "muon_phi[4]/D");
1026  probe_tree->Branch("muon_vx", muon_vx, "muon_vx[4]/D");
1027  probe_tree->Branch("muon_vy", muon_vy, "muon_vy[4]/D");
1028  probe_tree->Branch("muon_vz", muon_vz, "muon_vz[4]/D");
1029  probe_tree->Branch("muon_tip", muon_tip, "muon_tip[4]/D");
1030  probe_tree->Branch("muon_tip_bs", muon_tip_bs, "muon_tip_bs[4]/D");
1031 
1032 }
1033 
1034 // ------------ method called once each job just after ending the event loop -
1035 void
1037  //std::cout << "In endJob()" << std::endl;
1038  if (tree_fills_ == 0) {
1039  std::cout << "Empty tree: no output..." << std::endl;
1040  return;
1041  }
1042  //probe_tree->Print();
1043  histofile->Write();
1044  histofile->Close();
1045 
1046 }
1047 
1048 
1049 //define this as a plug-in
edm::EDGetTokenT< pat::MuonCollection > pMuonsToken_
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< trigger::TriggerEvent > HLTCollectionE31Token_
edm::EDGetTokenT< reco::CaloMETCollection > MetCollectionToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:137
edm::EDGetTokenT< edm::TriggerResults > HLTTriggerResultsE29Token_
tuple pfMET
Definition: pfMET_cfi.py:7
edm::EDGetTokenT< reco::METCollection > tcMetCollectionToken_
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:161
edm::EDGetTokenT< pat::ElectronCollection > ElectronCollectionToken_
edm::EDGetTokenT< reco::SuperClusterCollection > corHybridscToken_
GenPurposeSkimmerData(const edm::ParameterSet &)
edm::EDGetTokenT< reco::TrackCollection > ctfTracksToken_
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:139
std::vector< Electron > ElectronCollection
Definition: Electron.h:37
edm::EDGetTokenT< reco::SuperClusterCollection > multi5x5scToken_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
double pt() const
track transverse momentum
Definition: TrackBase.h:129
double energy() const
cluster energy
Definition: CaloCluster.h:120
bool isValid() const
Definition: HandleBase.h:76
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:145
edm::EDGetTokenT< reco::BeamSpot > offlineBeamSpotToken_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
T const * product() const
Definition: Handle.h:81
std::vector< Muon > MuonCollection
Definition: Muon.h:34
edm::EDGetTokenT< edm::TriggerResults > HLTTriggerResultsE31Token_
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:143
edm::EDGetTokenT< reco::PFMETCollection > pfMetCollectionToken_
edm::EDGetTokenT< trigger::TriggerEvent > HLTCollectionE29Token_
tuple cout
Definition: gather_cfg.py:121
const Point & position() const
position
Definition: BeamSpot.h:62
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:164
virtual void analyze(const edm::Event &, const edm::EventSetup &)
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:119
Analysis-level muon class.
Definition: Muon.h:50
edm::EDGetTokenT< pat::METCollection > t1MetCollectionToken_
reco::TrackRef track() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.cc:149
edm::EDGetTokenT< pat::METCollection > mcMetCollectionToken_
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:141