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 bool duplicate = false;
00630 pat::ElectronCollection::const_iterator BestDuplicate = elec;
00631 int index2 = 0;
00632 for(pat::ElectronCollection::const_iterator
00633 elec2 = electrons->begin();
00634 elec2 != electrons->end(); ++elec2)
00635 {
00636 if(elec != elec2)
00637 {
00638 if( elec->superCluster() == elec2->superCluster())
00639 {
00640 duplicate = true;
00641 if(fabs(BestDuplicate->eSuperClusterOverP()-1.)
00642 >= fabs(elec2->eSuperClusterOverP()-1.))
00643 {
00644 BestDuplicate = elec2;
00645 }
00646 }
00647 }
00648 ++index2;
00649 }
00650 if(BestDuplicate == elec) UniqueElectrons.push_back(electronRef);
00651 ++index;
00652 }
00653
00654
00655 elec_1_duplicate_removal = UniqueElectrons.size();
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667 std::vector<double> ETs;
00668 std::vector<pat::ElectronRef>::const_iterator elec;
00669 for (elec = UniqueElectrons.begin(); elec != UniqueElectrons.end(); ++elec) {
00670 pat::ElectronRef probeEle;
00671 probeEle = *elec;
00672 double probeEt = probeEle->caloEnergy()/(cosh(probeEle->caloPosition().eta()));
00673 ETs.push_back(probeEt);
00674
00675 }
00676 int *sorted = new int[elec_1_duplicate_removal];
00677 double *et = new double[elec_1_duplicate_removal];
00678
00679 for (int i=0; i<elec_1_duplicate_removal; ++i) {
00680 et[i] = ETs[i];
00681
00682 }
00683
00684 TMath::Sort(elec_1_duplicate_removal, et, sorted, true);
00685
00686
00687 for( int probeIt = 0; probeIt < elec_1_duplicate_removal; ++probeIt)
00688 {
00689
00690
00691 if (probeIt >= MAX_PROBES) break;
00692
00693 int elec_index = sorted[probeIt];
00694 std::vector<pat::ElectronRef>::const_iterator
00695 Rprobe = UniqueElectrons.begin() + elec_index;
00696
00697 pat::ElectronRef probeEle;
00698 probeEle = *Rprobe;
00699 double probeEt = probeEle->caloEnergy()/(cosh(probeEle->caloPosition().eta()));
00700 probe_sc_eta_for_tree[probeIt] = probeEle->caloPosition().eta();
00701 probe_sc_phi_for_tree[probeIt] = probeEle->caloPosition().phi();
00702 probe_sc_et_for_tree[probeIt] = probeEt;
00703
00704 if(fabs(probeEle->caloPosition().eta()) < BarrelMaxEta ||
00705 (fabs(probeEle->caloPosition().eta()) > EndcapMinEta &&
00706 fabs(probeEle->caloPosition().eta()) < EndcapMaxEta)){
00707 probe_sc_pass_fiducial_cut[probeIt] = 1;
00708 }
00709
00710 probe_charge_for_tree[probeIt] = probeEle->charge();
00711 probe_ele_eta_for_tree[probeIt] = probeEle->eta();
00712 probe_ele_et_for_tree[probeIt] = probeEle->et();
00713 probe_ele_phi_for_tree[probeIt] =probeEle->phi();
00714 probe_ele_Xvertex_for_tree[probeIt] =probeEle->vx();
00715 probe_ele_Yvertex_for_tree[probeIt] =probeEle->vy();
00716 probe_ele_Zvertex_for_tree[probeIt] =probeEle->vz();
00717 probe_classification_index_for_tree[probeIt] =
00718 probeEle->classification();
00719 double ProbeTIP = probeEle->gsfTrack()->d0();
00720 probe_ele_tip[probeIt] = ProbeTIP;
00721
00722
00723
00724
00725 probe_isolation_value[probeIt] = probeEle->dr03IsolationVariables().tkSumPt;
00726 probe_ecal_isolation_value[probeIt] = probeEle->dr04IsolationVariables().ecalRecHitSumEt;
00727 probe_hcal_isolation_value[probeIt] =
00728 probeEle->dr04IsolationVariables().hcalDepth1TowerSumEt +
00729 probeEle->dr04IsolationVariables().hcalDepth2TowerSumEt;
00730
00731 probe_iso_user[probeIt] = probeEle->dr04IsolationVariables().tkSumPt;
00732 probe_ecal_iso_user[probeIt] = probeEle->dr03IsolationVariables().ecalRecHitSumEt;
00733 probe_hcal_iso_user[probeIt] =
00734 probeEle->dr03IsolationVariables().hcalDepth1TowerSumEt +
00735 probeEle->dr03IsolationVariables().hcalDepth2TowerSumEt;
00736
00737 double hOverE = probeEle->hadronicOverEm();
00738 double deltaPhiIn = probeEle->deltaPhiSuperClusterTrackAtVtx();
00739 double deltaEtaIn = probeEle->deltaEtaSuperClusterTrackAtVtx();
00740 double eOverP = probeEle->eSuperClusterOverP();
00741 double pin = probeEle->trackMomentumAtVtx().R();
00742 double pout = probeEle->trackMomentumOut().R();
00743 double sigmaee = probeEle->scSigmaEtaEta();
00744 double sigma_IetaIeta = probeEle->scSigmaIEtaIEta();
00745
00746 if( fabs (probeEle->caloPosition().eta()) > 1.479 ) {
00747 sigmaee = sigmaee - 0.02*(fabs(probeEle->caloPosition().eta()) -2.3);
00748 }
00749
00750
00751 double e5x5, e2x5, e1x5;
00752 e5x5 = probeEle->scE5x5();
00753 e1x5 = probeEle->scE1x5();
00754 e2x5 = probeEle->scE2x5Max();
00755
00756
00757 probe_ele_hoe[probeIt] = hOverE;
00758 probe_ele_shh[probeIt] = sigmaee;
00759 probe_ele_sihih[probeIt] = sigma_IetaIeta;
00760 probe_ele_dfi[probeIt] = deltaPhiIn;
00761 probe_ele_dhi[probeIt] = deltaEtaIn;
00762 probe_ele_eop[probeIt] = eOverP;
00763 probe_ele_pin[probeIt] = pin;
00764 probe_ele_pout[probeIt] = pout;
00765 probe_ele_e5x5[probeIt] = e5x5;
00766 probe_ele_e2x5[probeIt] = e2x5;
00767 probe_ele_e1x5[probeIt] = e1x5;
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 }
00888
00889 probe_tree->Fill();
00890 ++ tree_fills_;
00891 delete [] sorted;
00892 delete [] et;
00893 }
00894
00895
00896
00897 void
00898 GenPurposeSkimmerData::beginJob()
00899 {
00900
00901 TString filename_histo = outputFile_;
00902 histofile = new TFile(filename_histo,"RECREATE");
00903 tree_fills_ = 0;
00904
00905 probe_tree = new TTree("probe_tree","Tree to store probe variables");
00906
00907
00908
00909
00910 probe_tree->Branch("probe_ele_tip",probe_ele_tip,"probe_ele_tip[4]/D");
00911 probe_tree->Branch("probe_ele_vertex_x",probe_ele_Xvertex_for_tree,
00912 "probe_ele_vertex_x[4]/D");
00913 probe_tree->Branch("probe_ele_vertex_y",probe_ele_Yvertex_for_tree,
00914 "probe_ele_vertex_y[4]/D");
00915 probe_tree->Branch("probe_ele_vertex_z",probe_ele_Zvertex_for_tree,
00916 "probe_ele_vertex_z[4]/D");
00917 probe_tree->Branch("probe_sc_eta",probe_sc_eta_for_tree,"probe_sc_eta[4]/D");
00918 probe_tree->Branch("probe_sc_phi",probe_sc_phi_for_tree,"probe_sc_phi[4]/D");
00919 probe_tree->Branch("probe_sc_et",probe_sc_et_for_tree,"probe_sc_et[4]/D");
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935 probe_tree->Branch("probe_charge",probe_charge_for_tree,"probe_charge[4]/I");
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946 probe_tree->Branch("probe_isolation_value",probe_isolation_value, "probe_isolation_value[4]/D");
00947 probe_tree->Branch("probe_ecal_isolation_value",probe_ecal_isolation_value, "probe_ecal_isolation_value[4]/D");
00948 probe_tree->Branch("probe_hcal_isolation_value",probe_hcal_isolation_value,"probe_hcal_isolation_value[4]/D");
00949
00950 probe_tree->Branch("probe_iso_user", probe_iso_user, "probe_iso_user[4]/D");
00951 probe_tree->Branch("probe_ecal_iso_user",probe_ecal_iso_user, "probe_ecal_iso_user[4]/D");
00952 probe_tree->Branch("probe_hcal_iso_user",probe_hcal_iso_user, "probe_hcal_iso_user[4]/D");
00953
00954
00955
00956 probe_tree->Branch("probe_ele_hoe",probe_ele_hoe, "probe_ele_hoe[4]/D");
00957
00958 probe_tree->Branch("probe_ele_sihih",probe_ele_sihih,"probe_ele_sihih[4]/D");
00959 probe_tree->Branch("probe_ele_dfi",probe_ele_dfi, "probe_ele_dfi[4]/D");
00960 probe_tree->Branch("probe_ele_dhi",probe_ele_dhi, "probe_ele_dhi[4]/D");
00961 probe_tree->Branch("probe_ele_eop",probe_ele_eop, "probe_ele_eop[4]/D");
00962 probe_tree->Branch("probe_ele_pin",probe_ele_pin, "probe_ele_pin[4]/D");
00963 probe_tree->Branch("probe_ele_pout",probe_ele_pout, "probe_ele_pout[4]/D");
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977 probe_tree->Branch("elec_1_duplicate_removal",&elec_1_duplicate_removal,"elec_1_duplicate_removal/I");
00978
00979
00980
00981 probe_tree->Branch("event_MET",&event_MET,"event_MET/D");
00982 probe_tree->Branch("event_MET_phi",&event_MET_phi,"event_MET_phi/D");
00983
00984 probe_tree->Branch("event_mcMET",&event_mcMET,"event_mcMET/D");
00985 probe_tree->Branch("event_mcMET_phi",&event_mcMET_phi,"event_mcMET_phi/D");
00986
00987 probe_tree->Branch("event_tcMET",&event_tcMET,"event_tcMET/D");
00988 probe_tree->Branch("event_tcMET_phi",&event_tcMET_phi,"event_tcMET_phi/D");
00989
00990
00991 probe_tree->Branch("event_pfMET",&event_pfMET,"event_pfMET/D");
00992 probe_tree->Branch("event_pfMET_phi",&event_pfMET_phi,"event_pfMET_phi/D");
00993
00994
00995
00996
00997
00998
00999 probe_tree->Branch("event_t1MET", &event_t1MET, "event_t1MET/D");
01000 probe_tree->Branch("event_t1MET_phi", &event_t1MET_phi,"event_t1MET_phi/D");
01001
01002
01003
01004
01005 probe_tree->Branch("sc_hybrid_et", sc_hybrid_et, "sc_hybrid_et[5]/D");
01006 probe_tree->Branch("sc_hybrid_eta", sc_hybrid_eta, "sc_hybrid_eta[5]/D");
01007 probe_tree->Branch("sc_hybrid_phi", sc_hybrid_phi, "sc_hybrid_phi[5]/D");
01008
01009 probe_tree->Branch("sc_multi5x5_et",sc_multi5x5_et, "sc_multi5x5_et[5]/D");
01010 probe_tree->Branch("sc_multi5x5_eta",sc_multi5x5_eta,"sc_multi5x5_eta[5]/D");
01011 probe_tree->Branch("sc_multi5x5_phi",sc_multi5x5_phi,"sc_multi5x5_phi[5]/D");
01012
01013
01014 probe_tree->Branch("ctf_track_pt", ctf_track_pt, "ctf_track_pt[20]/D");
01015 probe_tree->Branch("ctf_track_eta", ctf_track_eta, "ctf_track_eta[20]/D");
01016 probe_tree->Branch("ctf_track_phi", ctf_track_phi, "ctf_track_phi[20]/D");
01017 probe_tree->Branch("ctf_track_vx", ctf_track_vx, "ctf_track_vx[20]/D");
01018 probe_tree->Branch("ctf_track_vy", ctf_track_vy, "ctf_track_vy[20]/D");
01019 probe_tree->Branch("ctf_track_vz", ctf_track_vz, "ctf_track_vz[20]/D");
01020 probe_tree->Branch("ctf_track_tip", ctf_track_tip, "ctf_track_tip[20]/D");
01021 probe_tree->Branch("ctf_track_tip_bs", ctf_track_tip_bs,
01022 "ctf_track_tip_bs[20]/D");
01023
01024 probe_tree->Branch("muon_pt", muon_pt, "muon_pt[4]/D");
01025 probe_tree->Branch("muon_eta", muon_eta, "muon_eta[4]/D");
01026 probe_tree->Branch("muon_phi", muon_phi, "muon_phi[4]/D");
01027 probe_tree->Branch("muon_vx", muon_vx, "muon_vx[4]/D");
01028 probe_tree->Branch("muon_vy", muon_vy, "muon_vy[4]/D");
01029 probe_tree->Branch("muon_vz", muon_vz, "muon_vz[4]/D");
01030 probe_tree->Branch("muon_tip", muon_tip, "muon_tip[4]/D");
01031 probe_tree->Branch("muon_tip_bs", muon_tip_bs, "muon_tip_bs[4]/D");
01032
01033 }
01034
01035
01036 void
01037 GenPurposeSkimmerData::endJob() {
01038
01039 if (tree_fills_ == 0) {
01040 std::cout << "Empty tree: no output..." << std::endl;
01041 return;
01042 }
01043
01044 histofile->Write();
01045 histofile->Close();
01046
01047 }
01048
01049
01050
01051 DEFINE_FWK_MODULE(GenPurposeSkimmerData);