00001
00002
00003
00004
00005
00040
00041
00042
00043
00044
00045
00046
00047 #include "ElectroWeakAnalysis/WENu/interface/GenPurposeSkimmerData.h"
00048
00049
00050
00051
00052 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00053 #include "DataFormats/TrackReco/interface/Track.h"
00054 #include "DataFormats/PatCandidates/interface/Muon.h"
00055 #include "FWCore/Common/interface/TriggerNames.h"
00056
00057
00058 GenPurposeSkimmerData::GenPurposeSkimmerData(const edm::ParameterSet& ps)
00059
00060 {
00061
00062
00063
00064
00065 outputFile_ = ps.getUntrackedParameter<std::string>("outputfile");
00066
00067
00068 ElectronCollection_=ps.getUntrackedParameter<edm::InputTag>("ElectronCollection");
00069
00070
00071
00072
00073
00074
00075
00076 MetCollectionTag_ = ps.getUntrackedParameter<edm::InputTag>("MetCollectionTag");
00077 mcMetCollectionTag_ = ps.getUntrackedParameter<edm::InputTag>("mcMetCollectionTag");
00078 t1MetCollectionTag_ = ps.getUntrackedParameter<edm::InputTag>("t1MetCollectionTag");
00079 pfMetCollectionTag_ = ps.getUntrackedParameter<edm::InputTag>("pfMetCollectionTag");
00080 tcMetCollectionTag_ = ps.getUntrackedParameter<edm::InputTag>("tcMetCollectionTag");
00081
00082
00083
00084
00085
00086 HLTCollectionE29_= ps.getUntrackedParameter<edm::InputTag>("HLTCollectionE29");
00087 HLTCollectionE31_= ps.getUntrackedParameter<edm::InputTag>("HLTCollectionE31");
00088 HLTTriggerResultsE29_ = ps.getUntrackedParameter<edm::InputTag>("HLTTriggerResultsE29");
00089 HLTTriggerResultsE31_ = ps.getUntrackedParameter<edm::InputTag>("HLTTriggerResultsE31");
00090
00091
00092
00093
00094 ProbeHLTObjMaxDR= ps.getUntrackedParameter<double>("ProbeHLTObjMaxDR",0.2);
00095
00096
00097
00098
00099
00100 BarrelMaxEta = ps.getUntrackedParameter<double>("BarrelMaxEta");
00101 EndcapMinEta = ps.getUntrackedParameter<double>("EndcapMinEta");
00102 EndcapMaxEta = ps.getUntrackedParameter<double>("EndcapMaxEta");
00103
00104 ctfTracksTag_ = ps.getUntrackedParameter<edm::InputTag>("ctfTracksTag");
00105 corHybridsc_ = ps.getUntrackedParameter<edm::InputTag>("corHybridsc");
00106 multi5x5sc_ = ps.getUntrackedParameter<edm::InputTag>("multi5x5sc");
00107
00108 }
00109
00110
00111 GenPurposeSkimmerData::~GenPurposeSkimmerData()
00112 {
00113
00114
00115
00116
00117 }
00118
00119
00120
00121
00122
00123
00124
00125 void
00126 GenPurposeSkimmerData::analyze(const edm::Event& evt, const edm::EventSetup& es)
00127 {
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 edm::Handle<pat::ElectronCollection> pElectrons;
00141
00142 try{
00143 evt.getByLabel(ElectronCollection_, pElectrons);
00144 }
00145 catch (cms::Exception)
00146 {
00147 edm::LogError("")<< "Error! Can't get ElectronCollection by label. ";
00148 }
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00212
00213
00214
00215
00216
00217
00218
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252 edm::Handle<trigger::TriggerEvent> pHLTe29;
00253 evt.getByLabel(HLTCollectionE29_, pHLTe29);
00254 if (not pHLTe29.isValid()){
00255 std::cout << "Error!!! HLT is missing!" << std::endl;
00256 return;
00257 }
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276 edm::Handle<reco::CaloMETCollection> caloMET;
00277 evt.getByLabel(MetCollectionTag_, caloMET);
00278
00279 edm::Handle<pat::METCollection> t1MET;
00280 evt.getByLabel(t1MetCollectionTag_, t1MET);
00281
00282 edm::Handle<pat::METCollection> mcMET;
00283 evt.getByLabel(mcMetCollectionTag_, mcMET);
00284
00285 edm::Handle<reco::METCollection> tcMET;
00286 evt.getByLabel(tcMetCollectionTag_, tcMET);
00287
00288 edm::Handle<reco::PFMETCollection> pfMET;
00289 evt.getByLabel(pfMetCollectionTag_, pfMET);
00290
00291
00292
00293
00294
00295 event_MET = -99.; event_MET_phi = -99.; event_MET_sig = -99.;
00296 event_mcMET = -99.; event_mcMET_phi = -99.; event_mcMET_sig = -99.;
00297 event_tcMET = -99.; event_tcMET_phi = -99.; event_tcMET_sig = -99.;
00298 event_pfMET = -99.; event_pfMET_phi = -99.; event_pfMET_sig = -99.;
00299 event_t1MET = -99.; event_t1MET_phi = -99.; event_t1MET_sig = -99.;
00300
00301
00302
00303
00304 if ( caloMET.isValid() ) {
00305 const reco::CaloMETRef MET(caloMET, 0);
00306 event_MET = MET->et(); event_MET_phi = MET->phi();
00307 event_MET_sig = MET->mEtSig();
00308 }
00309 else {
00310 std::cout << "caloMET not valid: input Tag: " << MetCollectionTag_
00311 << std::endl;
00312 }
00313 if ( tcMET.isValid() ) {
00314 const reco::METRef MET(tcMET, 0);
00315 event_tcMET = MET->et(); event_tcMET_phi = MET->phi();
00316 event_tcMET_sig = MET->mEtSig();
00317 }
00318 if ( pfMET.isValid() ) {
00319 const reco::PFMETRef MET(pfMET, 0);
00320 event_pfMET = MET->et(); event_pfMET_phi = MET->phi();
00321 event_pfMET_sig = MET->mEtSig();
00322 }
00323 if ( t1MET.isValid() ) {
00324 const pat::METRef MET(t1MET, 0);
00325 event_t1MET = MET->et(); event_t1MET_phi = MET->phi();
00326 event_t1MET_sig = MET->mEtSig();
00327 }
00328 if ( mcMET.isValid() ) {
00329 const pat::METRef MET(mcMET, 0);
00330 event_mcMET = MET->et(); event_mcMET_phi = MET->phi();
00331 event_mcMET_sig = MET->mEtSig();
00332 }
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346 edm::Handle<reco::SuperClusterCollection> SC1;
00347 evt.getByLabel(corHybridsc_,SC1);
00348 const reco::SuperClusterCollection *sc1 = SC1.product();
00349
00350
00351
00352 edm::Handle<reco::SuperClusterCollection> SC2;
00353 evt.getByLabel(multi5x5sc_,SC2);
00354 const reco::SuperClusterCollection *sc2 = SC2.product();
00355
00356 const int n1 = sc1->size();
00357 const int n2 = sc2->size();
00358
00359
00360
00361 for (int i=0; i<5; ++i) {
00362 sc_hybrid_et[i] = -9999.;
00363 sc_hybrid_eta[i] = -9999.;
00364 sc_hybrid_phi[i] = -9999.;
00365
00366 sc_multi5x5_et[i] = -9999.;
00367 sc_multi5x5_eta[i] = -9999.;
00368 sc_multi5x5_phi[i] = -9999.;
00369
00370 }
00371
00372 std::vector<double> ETsc1;
00373 std::vector<reco::SuperCluster>::const_iterator sc;
00374 for (sc = sc1->begin(); sc != sc1->end(); ++sc) {
00375 reco::SuperCluster mySc = *sc;
00376 double scEt = mySc.energy()/(cosh(mySc.eta()));
00377 ETsc1.push_back(scEt);
00378
00379 }
00380 int *sorted1 = new int[n1];
00381 double *et1 = new double[n1];
00382 for (int i=0; i<n1; ++i) {
00383 et1[i] = ETsc1[i];
00384 }
00385
00386 TMath::Sort(n1, et1, sorted1, true);
00387
00388 std::vector<double> ETsc2;
00389 for (sc = sc2->begin(); sc != sc2->end(); ++sc) {
00390 reco::SuperCluster mySc = *sc;
00391 double scEt = mySc.energy()/(cosh(mySc.eta()));
00392 ETsc2.push_back(scEt);
00393
00394 }
00395 int *sorted2 = new int[n2];
00396 double *et2 = new double[n2];
00397 for (int i=0; i<n2; ++i) {
00398 et2[i] = ETsc2[i];
00399 }
00400
00401 TMath::Sort(n2, et2, sorted2, true);
00402
00403
00404 for( int probeSc = 0; probeSc < n1; ++probeSc)
00405 {
00406
00407
00408 if (probeSc >= 5) break;
00409
00410 int sc_index = sorted1[probeSc];
00411 std::vector<reco::SuperCluster>::const_iterator
00412 Rprobe = sc1->begin() + sc_index;
00413
00414 reco::SuperCluster sc0 = *Rprobe;
00415
00416 sc_hybrid_et[probeSc] = sc0.energy()/(cosh(sc0.eta()));
00417 sc_hybrid_eta[probeSc] = sc0.eta();
00418 sc_hybrid_phi[probeSc] = sc0.phi();
00419 }
00420
00421 for( int probeSc = 0; probeSc < n2; ++probeSc)
00422 {
00423
00424
00425 if (probeSc >= 5) break;
00426
00427 int sc_index = sorted2[probeSc];
00428 std::vector<reco::SuperCluster>::const_iterator
00429 Rprobe = sc2->begin() + sc_index;
00430
00431 reco::SuperCluster sc0 = *Rprobe;
00432
00433 sc_multi5x5_et[probeSc] = sc0.energy()/(cosh(sc0.eta()));
00434 sc_multi5x5_eta[probeSc] = sc0.eta();
00435 sc_multi5x5_phi[probeSc] = sc0.phi();
00436 }
00437 delete [] sorted1; delete [] sorted2;
00438 delete [] et1; delete [] et2;
00440
00441 edm::Handle<reco::TrackCollection> ctfTracks;
00442 evt.getByLabel(ctfTracksTag_, ctfTracks);
00443 const reco::TrackCollection *ctf = ctfTracks.product();
00444 reco::TrackCollection::const_iterator tr;
00445 const int ntracks = ctf->size();
00446
00447
00448 edm::Handle<reco::BeamSpot> pBeamSpot;
00449 evt.getByLabel("offlineBeamSpot", pBeamSpot);
00450 const reco::BeamSpot *bspot = pBeamSpot.product();
00451 const math::XYZPoint bspotPosition = bspot->position();
00452
00453 for (int i=0; i<20; ++i) {
00454 ctf_track_pt[i] = -9999.;
00455 ctf_track_eta[i] = -9999.;
00456 ctf_track_phi[i] = -9999.;
00457 ctf_track_vx[i] = -9999.; ctf_track_vy[i]=-9999.; ctf_track_vz[i] =-9999.;
00458 ctf_track_tip[i] = -9999.; ctf_track_tip_bs[i] = -9999.;
00459 }
00460
00461 std::vector<double> ETtrack;
00462 for (tr = ctf->begin(); tr != ctf->end(); ++tr) {
00463 reco::Track mySc = *tr;
00464 double scEt = mySc.pt();
00465 ETtrack.push_back(scEt);
00466 }
00467 int *sortedTr = new int[ntracks];
00468 double *etTr = new double[ntracks];
00469 for (int i=0; i<ntracks; ++i) {
00470 etTr[i] = ETtrack[i];
00471 }
00472
00473 TMath::Sort(ntracks, etTr, sortedTr, true);
00474
00475 for( int probeSc = 0; probeSc < ntracks; ++probeSc)
00476 {
00477
00478
00479 if (probeSc >= 20) break;
00480
00481 int sc_index = sortedTr[probeSc];
00482 std::vector<reco::Track>::const_iterator
00483 Rprobe = ctf->begin() + sc_index;
00484
00485 reco::Track sc0 = *Rprobe;
00486
00487 ctf_track_pt[probeSc] = sc0.pt();
00488 ctf_track_eta[probeSc] = sc0.eta();
00489 ctf_track_phi[probeSc] = sc0.phi();
00490 ctf_track_vx[probeSc] = sc0.vx();
00491 ctf_track_vy[probeSc] = sc0.vy();
00492 ctf_track_vz[probeSc] = sc0.vz();
00493 ctf_track_tip[probeSc] = -sc0.dxy();
00494 ctf_track_tip_bs[probeSc] = -sc0.dxy(bspotPosition);
00495 }
00496 delete [] sortedTr; delete [] etTr;
00497
00498
00499 edm::Handle<pat::MuonCollection> pMuons;
00500 evt.getByLabel("selectedLayer1Muons", pMuons);
00501 const pat::MuonCollection *pmuon = pMuons.product();
00502 pat::MuonCollection::const_iterator muon;
00503 const int nmuons = pMuons->size();
00504
00505 for (int i=0; i<4; ++i) {
00506 muon_pt[i] = -9999.;
00507 muon_eta[i] = -9999.;
00508 muon_phi[i] = -9999.;
00509 muon_vx[i] = -9999.; muon_vy[i] = -9999.; muon_vz[i] = -9999.;
00510 muon_tip[i] = -9999.; muon_tip_bs[i] = -9999.;
00511 }
00512
00513 std::vector<double> ETmuons;
00514 for (muon = pmuon->begin(); muon != pmuon->end(); ++muon) {
00515 pat::Muon mySc = *muon;
00516 double scEt = mySc.track()->pt();
00517 ETmuons.push_back(scEt);
00518 }
00519 int *sortedMu = new int[nmuons];
00520 double *etMu = new double[nmuons];
00521 for (int i=0; i<nmuons; ++i) {
00522 etMu[i] = ETmuons[i];
00523 }
00524
00525 TMath::Sort(nmuons, etMu, sortedMu, true);
00526
00527 for( int probeSc = 0; probeSc < nmuons; ++probeSc)
00528 {
00529
00530
00531 if (probeSc >= 4) break;
00532
00533 int sc_index = sortedMu[probeSc];
00534 std::vector<pat::Muon>::const_iterator
00535 Rprobe = pmuon->begin() + sc_index;
00536
00537 pat::Muon sc0 = *Rprobe;
00538
00539 muon_pt[probeSc] = sc0.track()->pt();
00540 muon_eta[probeSc] = sc0.track()->eta();
00541 muon_phi[probeSc] = sc0.track()->phi();
00542 muon_vx[probeSc] = sc0.track()->vx();
00543 muon_vy[probeSc] = sc0.track()->vy();
00544 muon_vz[probeSc] = sc0.track()->vz();
00545 muon_tip[probeSc] = -sc0.track()->dxy();
00546 muon_tip_bs[probeSc] = -sc0.track()->dxy(bspotPosition);
00547 }
00548 delete [] sortedMu; delete [] etMu;
00549
00550 if (n1+n2+ntracks == 0) {
00551 std::cout << "Return: no sc in this event" << std::endl;
00552 return;
00553 }
00554
00555
00557 const int MAX_PROBES = 4;
00558 for(int i =0; i < MAX_PROBES; i++){
00559 probe_ele_eta_for_tree[i] = -99.0;
00560 probe_ele_et_for_tree[i] = -99.0;
00561 probe_ele_phi_for_tree[i] = -99.0;
00562 probe_ele_Xvertex_for_tree[i] = -99.0;
00563 probe_ele_Yvertex_for_tree[i] = -99.0;
00564 probe_ele_Zvertex_for_tree[i] = -99.0;
00565 probe_ele_tip[i] = -999.;
00566
00567 probe_sc_eta_for_tree[i] = -99.0;
00568 probe_sc_et_for_tree[i] = -99.0;
00569 probe_sc_phi_for_tree[i] = -99.0;
00570
00571 probe_charge_for_tree[i] = -99;
00572 probe_sc_pass_fiducial_cut[i] = 0;
00573 probe_classification_index_for_tree[i]=-99;
00574
00575
00576 probe_isolation_value[i] = 999.0;
00577 probe_iso_user[i] = 999.0;
00578 probe_ecal_isolation_value[i] = 999;
00579 probe_ecal_iso_user[i] = 999;
00580 probe_hcal_isolation_value[i] = 999;
00581 probe_hcal_iso_user[i] = 999;
00582
00583 probe_ele_hoe[i] = 999.;
00584 probe_ele_shh[i] = 999.;
00585 probe_ele_sihih[i] = 999.;
00586 probe_ele_dhi[i] = 999.;
00587 probe_ele_dfi[i] = 999.;
00588 probe_ele_eop[i] = 999.;
00589 probe_ele_pin[i] = 999.;
00590 probe_ele_pout[i] = 999.;
00591 probe_ele_e5x5[i] = 999.;
00592 probe_ele_e2x5[i] = 999.;
00593 probe_ele_e1x5[i] = 999.;
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608 }
00609 const pat::ElectronCollection *electrons= pElectrons.product();
00610
00611
00612 elec_number_in_event = electrons->size();
00613
00614
00615
00616
00617 std::vector<pat::ElectronRef> UniqueElectrons;
00618
00619 int index =0;
00620
00621
00622
00623
00624
00625 for(pat::ElectronCollection::const_iterator
00626 elec = electrons->begin(); elec != electrons->end();++elec) {
00627 const pat::ElectronRef electronRef(pElectrons, index);
00628
00629 pat::ElectronCollection::const_iterator BestDuplicate = elec;
00630 int index2 = 0;
00631 for(pat::ElectronCollection::const_iterator
00632 elec2 = electrons->begin();
00633 elec2 != electrons->end(); ++elec2)
00634 {
00635 if(elec != elec2)
00636 {
00637 if( elec->superCluster() == elec2->superCluster())
00638 {
00639 if(fabs(BestDuplicate->eSuperClusterOverP()-1.)
00640 >= fabs(elec2->eSuperClusterOverP()-1.))
00641 {
00642 BestDuplicate = elec2;
00643 }
00644 }
00645 }
00646 ++index2;
00647 }
00648 if(BestDuplicate == elec) UniqueElectrons.push_back(electronRef);
00649 ++index;
00650 }
00651
00652
00653 elec_1_duplicate_removal = UniqueElectrons.size();
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665 std::vector<double> ETs;
00666 std::vector<pat::ElectronRef>::const_iterator elec;
00667 for (elec = UniqueElectrons.begin(); elec != UniqueElectrons.end(); ++elec) {
00668 pat::ElectronRef probeEle;
00669 probeEle = *elec;
00670 double probeEt = probeEle->caloEnergy()/(cosh(probeEle->caloPosition().eta()));
00671 ETs.push_back(probeEt);
00672
00673 }
00674 int *sorted = new int[elec_1_duplicate_removal];
00675 double *et = new double[elec_1_duplicate_removal];
00676
00677 for (int i=0; i<elec_1_duplicate_removal; ++i) {
00678 et[i] = ETs[i];
00679
00680 }
00681
00682 TMath::Sort(elec_1_duplicate_removal, et, sorted, true);
00683
00684
00685 for( int probeIt = 0; probeIt < elec_1_duplicate_removal; ++probeIt)
00686 {
00687
00688
00689 if (probeIt >= MAX_PROBES) break;
00690
00691 int elec_index = sorted[probeIt];
00692 std::vector<pat::ElectronRef>::const_iterator
00693 Rprobe = UniqueElectrons.begin() + elec_index;
00694
00695 pat::ElectronRef probeEle;
00696 probeEle = *Rprobe;
00697 double probeEt = probeEle->caloEnergy()/(cosh(probeEle->caloPosition().eta()));
00698 probe_sc_eta_for_tree[probeIt] = probeEle->caloPosition().eta();
00699 probe_sc_phi_for_tree[probeIt] = probeEle->caloPosition().phi();
00700 probe_sc_et_for_tree[probeIt] = probeEt;
00701
00702 if(fabs(probeEle->caloPosition().eta()) < BarrelMaxEta ||
00703 (fabs(probeEle->caloPosition().eta()) > EndcapMinEta &&
00704 fabs(probeEle->caloPosition().eta()) < EndcapMaxEta)){
00705 probe_sc_pass_fiducial_cut[probeIt] = 1;
00706 }
00707
00708 probe_charge_for_tree[probeIt] = probeEle->charge();
00709 probe_ele_eta_for_tree[probeIt] = probeEle->eta();
00710 probe_ele_et_for_tree[probeIt] = probeEle->et();
00711 probe_ele_phi_for_tree[probeIt] =probeEle->phi();
00712 probe_ele_Xvertex_for_tree[probeIt] =probeEle->vx();
00713 probe_ele_Yvertex_for_tree[probeIt] =probeEle->vy();
00714 probe_ele_Zvertex_for_tree[probeIt] =probeEle->vz();
00715 probe_classification_index_for_tree[probeIt] =
00716 probeEle->classification();
00717 double ProbeTIP = probeEle->gsfTrack()->d0();
00718 probe_ele_tip[probeIt] = ProbeTIP;
00719
00720
00721
00722
00723 probe_isolation_value[probeIt] = probeEle->dr03IsolationVariables().tkSumPt;
00724 probe_ecal_isolation_value[probeIt] = probeEle->dr04IsolationVariables().ecalRecHitSumEt;
00725 probe_hcal_isolation_value[probeIt] =
00726 probeEle->dr04IsolationVariables().hcalDepth1TowerSumEt +
00727 probeEle->dr04IsolationVariables().hcalDepth2TowerSumEt;
00728
00729 probe_iso_user[probeIt] = probeEle->dr04IsolationVariables().tkSumPt;
00730 probe_ecal_iso_user[probeIt] = probeEle->dr03IsolationVariables().ecalRecHitSumEt;
00731 probe_hcal_iso_user[probeIt] =
00732 probeEle->dr03IsolationVariables().hcalDepth1TowerSumEt +
00733 probeEle->dr03IsolationVariables().hcalDepth2TowerSumEt;
00734
00735 double hOverE = probeEle->hadronicOverEm();
00736 double deltaPhiIn = probeEle->deltaPhiSuperClusterTrackAtVtx();
00737 double deltaEtaIn = probeEle->deltaEtaSuperClusterTrackAtVtx();
00738 double eOverP = probeEle->eSuperClusterOverP();
00739 double pin = probeEle->trackMomentumAtVtx().R();
00740 double pout = probeEle->trackMomentumOut().R();
00741 double sigmaee = probeEle->scSigmaEtaEta();
00742 double sigma_IetaIeta = probeEle->scSigmaIEtaIEta();
00743
00744 if( fabs (probeEle->caloPosition().eta()) > 1.479 ) {
00745 sigmaee = sigmaee - 0.02*(fabs(probeEle->caloPosition().eta()) -2.3);
00746 }
00747
00748
00749 double e5x5, e2x5, e1x5;
00750 e5x5 = probeEle->scE5x5();
00751 e1x5 = probeEle->scE1x5();
00752 e2x5 = probeEle->scE2x5Max();
00753
00754
00755 probe_ele_hoe[probeIt] = hOverE;
00756 probe_ele_shh[probeIt] = sigmaee;
00757 probe_ele_sihih[probeIt] = sigma_IetaIeta;
00758 probe_ele_dfi[probeIt] = deltaPhiIn;
00759 probe_ele_dhi[probeIt] = deltaEtaIn;
00760 probe_ele_eop[probeIt] = eOverP;
00761 probe_ele_pin[probeIt] = pin;
00762 probe_ele_pout[probeIt] = pout;
00763 probe_ele_e5x5[probeIt] = e5x5;
00764 probe_ele_e2x5[probeIt] = e2x5;
00765 probe_ele_e1x5[probeIt] = e1x5;
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885 }
00886
00887 probe_tree->Fill();
00888 ++ tree_fills_;
00889 delete [] sorted;
00890 delete [] et;
00891 }
00892
00893
00894
00895 void
00896 GenPurposeSkimmerData::beginJob()
00897 {
00898
00899 TString filename_histo = outputFile_;
00900 histofile = new TFile(filename_histo,"RECREATE");
00901 tree_fills_ = 0;
00902
00903 probe_tree = new TTree("probe_tree","Tree to store probe variables");
00904
00905
00906
00907
00908 probe_tree->Branch("probe_ele_tip",probe_ele_tip,"probe_ele_tip[4]/D");
00909 probe_tree->Branch("probe_ele_vertex_x",probe_ele_Xvertex_for_tree,
00910 "probe_ele_vertex_x[4]/D");
00911 probe_tree->Branch("probe_ele_vertex_y",probe_ele_Yvertex_for_tree,
00912 "probe_ele_vertex_y[4]/D");
00913 probe_tree->Branch("probe_ele_vertex_z",probe_ele_Zvertex_for_tree,
00914 "probe_ele_vertex_z[4]/D");
00915 probe_tree->Branch("probe_sc_eta",probe_sc_eta_for_tree,"probe_sc_eta[4]/D");
00916 probe_tree->Branch("probe_sc_phi",probe_sc_phi_for_tree,"probe_sc_phi[4]/D");
00917 probe_tree->Branch("probe_sc_et",probe_sc_et_for_tree,"probe_sc_et[4]/D");
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933 probe_tree->Branch("probe_charge",probe_charge_for_tree,"probe_charge[4]/I");
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944 probe_tree->Branch("probe_isolation_value",probe_isolation_value, "probe_isolation_value[4]/D");
00945 probe_tree->Branch("probe_ecal_isolation_value",probe_ecal_isolation_value, "probe_ecal_isolation_value[4]/D");
00946 probe_tree->Branch("probe_hcal_isolation_value",probe_hcal_isolation_value,"probe_hcal_isolation_value[4]/D");
00947
00948 probe_tree->Branch("probe_iso_user", probe_iso_user, "probe_iso_user[4]/D");
00949 probe_tree->Branch("probe_ecal_iso_user",probe_ecal_iso_user, "probe_ecal_iso_user[4]/D");
00950 probe_tree->Branch("probe_hcal_iso_user",probe_hcal_iso_user, "probe_hcal_iso_user[4]/D");
00951
00952
00953
00954 probe_tree->Branch("probe_ele_hoe",probe_ele_hoe, "probe_ele_hoe[4]/D");
00955
00956 probe_tree->Branch("probe_ele_sihih",probe_ele_sihih,"probe_ele_sihih[4]/D");
00957 probe_tree->Branch("probe_ele_dfi",probe_ele_dfi, "probe_ele_dfi[4]/D");
00958 probe_tree->Branch("probe_ele_dhi",probe_ele_dhi, "probe_ele_dhi[4]/D");
00959 probe_tree->Branch("probe_ele_eop",probe_ele_eop, "probe_ele_eop[4]/D");
00960 probe_tree->Branch("probe_ele_pin",probe_ele_pin, "probe_ele_pin[4]/D");
00961 probe_tree->Branch("probe_ele_pout",probe_ele_pout, "probe_ele_pout[4]/D");
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975 probe_tree->Branch("elec_1_duplicate_removal",&elec_1_duplicate_removal,"elec_1_duplicate_removal/I");
00976
00977
00978
00979 probe_tree->Branch("event_MET",&event_MET,"event_MET/D");
00980 probe_tree->Branch("event_MET_phi",&event_MET_phi,"event_MET_phi/D");
00981
00982 probe_tree->Branch("event_mcMET",&event_mcMET,"event_mcMET/D");
00983 probe_tree->Branch("event_mcMET_phi",&event_mcMET_phi,"event_mcMET_phi/D");
00984
00985 probe_tree->Branch("event_tcMET",&event_tcMET,"event_tcMET/D");
00986 probe_tree->Branch("event_tcMET_phi",&event_tcMET_phi,"event_tcMET_phi/D");
00987
00988
00989 probe_tree->Branch("event_pfMET",&event_pfMET,"event_pfMET/D");
00990 probe_tree->Branch("event_pfMET_phi",&event_pfMET_phi,"event_pfMET_phi/D");
00991
00992
00993
00994
00995
00996
00997 probe_tree->Branch("event_t1MET", &event_t1MET, "event_t1MET/D");
00998 probe_tree->Branch("event_t1MET_phi", &event_t1MET_phi,"event_t1MET_phi/D");
00999
01000
01001
01002
01003 probe_tree->Branch("sc_hybrid_et", sc_hybrid_et, "sc_hybrid_et[5]/D");
01004 probe_tree->Branch("sc_hybrid_eta", sc_hybrid_eta, "sc_hybrid_eta[5]/D");
01005 probe_tree->Branch("sc_hybrid_phi", sc_hybrid_phi, "sc_hybrid_phi[5]/D");
01006
01007 probe_tree->Branch("sc_multi5x5_et",sc_multi5x5_et, "sc_multi5x5_et[5]/D");
01008 probe_tree->Branch("sc_multi5x5_eta",sc_multi5x5_eta,"sc_multi5x5_eta[5]/D");
01009 probe_tree->Branch("sc_multi5x5_phi",sc_multi5x5_phi,"sc_multi5x5_phi[5]/D");
01010
01011
01012 probe_tree->Branch("ctf_track_pt", ctf_track_pt, "ctf_track_pt[20]/D");
01013 probe_tree->Branch("ctf_track_eta", ctf_track_eta, "ctf_track_eta[20]/D");
01014 probe_tree->Branch("ctf_track_phi", ctf_track_phi, "ctf_track_phi[20]/D");
01015 probe_tree->Branch("ctf_track_vx", ctf_track_vx, "ctf_track_vx[20]/D");
01016 probe_tree->Branch("ctf_track_vy", ctf_track_vy, "ctf_track_vy[20]/D");
01017 probe_tree->Branch("ctf_track_vz", ctf_track_vz, "ctf_track_vz[20]/D");
01018 probe_tree->Branch("ctf_track_tip", ctf_track_tip, "ctf_track_tip[20]/D");
01019 probe_tree->Branch("ctf_track_tip_bs", ctf_track_tip_bs,
01020 "ctf_track_tip_bs[20]/D");
01021
01022 probe_tree->Branch("muon_pt", muon_pt, "muon_pt[4]/D");
01023 probe_tree->Branch("muon_eta", muon_eta, "muon_eta[4]/D");
01024 probe_tree->Branch("muon_phi", muon_phi, "muon_phi[4]/D");
01025 probe_tree->Branch("muon_vx", muon_vx, "muon_vx[4]/D");
01026 probe_tree->Branch("muon_vy", muon_vy, "muon_vy[4]/D");
01027 probe_tree->Branch("muon_vz", muon_vz, "muon_vz[4]/D");
01028 probe_tree->Branch("muon_tip", muon_tip, "muon_tip[4]/D");
01029 probe_tree->Branch("muon_tip_bs", muon_tip_bs, "muon_tip_bs[4]/D");
01030
01031 }
01032
01033
01034 void
01035 GenPurposeSkimmerData::endJob() {
01036
01037 if (tree_fills_ == 0) {
01038 std::cout << "Empty tree: no output..." << std::endl;
01039 return;
01040 }
01041
01042 histofile->Write();
01043 histofile->Close();
01044
01045 }
01046
01047
01048
01049 DEFINE_FWK_MODULE(GenPurposeSkimmerData);