Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <memory>
00023
00024
00025
00026 #include "DQM/Physics/src/EwkDQM.h"
00027 #include "FWCore/Framework/interface/Frameworkfwd.h"
00028 #include "FWCore/Framework/interface/EDAnalyzer.h"
00029 #include "FWCore/ServiceRegistry/interface/Service.h"
00030 #include "DataFormats/Candidate/interface/Candidate.h"
00031 #include "DataFormats/Common/interface/Handle.h"
00032 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00033 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00034 #include "DataFormats/Math/interface/LorentzVector.h"
00035 #include "TLorentzVector.h"
00036 #include "TMath.h"
00037 #include <string>
00038 #include <cmath>
00039 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00040 #include "TH1.h"
00041 #include "DQMServices/Core/interface/DQMStore.h"
00042 #include "DQMServices/Core/interface/MonitorElement.h"
00043 #include "FWCore/Framework/interface/Event.h"
00044 #include "FWCore/Framework/interface/EventSetup.h"
00045 #include "FWCore/Framework/interface/MakerMacros.h"
00046 #include <iostream>
00047 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00048 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00049
00050 using namespace std;
00051 using namespace edm;
00052 using namespace reco;
00053
00054
00055 class DQMStore;
00056 class MonitorElement;
00057
00058 std::string prefixME_;
00059
00060 class
00061 EcalZmassTask:
00062 public
00063 edm::EDAnalyzer
00064 {
00065 public:
00066 explicit
00067 EcalZmassTask (const edm::ParameterSet &);
00068 ~
00069 EcalZmassTask ();
00070
00071 static void
00072 fillDescriptions (edm::ConfigurationDescriptions & descriptions);
00073
00074 private:
00075 virtual void
00076 beginJob ();
00077 virtual void
00078 analyze (const edm::Event &, const edm::EventSetup &);
00079 virtual void
00080 endJob ();
00081
00082 virtual void
00083 beginRun (edm::Run const &, edm::EventSetup const &);
00084 virtual void
00085 endRun (edm::Run const &, edm::EventSetup const &);
00086 virtual void
00087 beginLuminosityBlock (edm::LuminosityBlock const &,
00088 edm::EventSetup const &);
00089 virtual void
00090 endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &);
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 edm::InputTag
00109 theElectronCollectionLabel;
00110
00111 MonitorElement *
00112 h_ee_invMass_EB;
00113 MonitorElement *
00114 h_ee_invMass_EE;
00115 MonitorElement *
00116 h_ee_invMass_BB;
00117 MonitorElement *
00118 h_ee_invMass;
00119 MonitorElement *
00120 h_e1_et;
00121 MonitorElement *
00122 h_e2_et;
00123 MonitorElement *
00124 h_e1_eta;
00125 MonitorElement *
00126 h_e2_eta;
00127 MonitorElement *
00128 h_e1_phi;
00129 MonitorElement *
00130 h_e2_phi;
00131 MonitorElement *
00132 h_95_ee_invMass_EB;
00133 MonitorElement *
00134 h_95_ee_invMass_EE;
00135 MonitorElement *
00136 h_95_ee_invMass_BB;
00137
00138 };
00139
00140 EcalZmassTask::EcalZmassTask (const edm::ParameterSet & parameters)
00141 {
00142 prefixME_ = parameters.getUntrackedParameter < string > ("prefixME", "");
00143 theElectronCollectionLabel =
00144 parameters.getParameter < InputTag > ("electronCollection");
00145
00146 }
00147
00148
00149
00150 EcalZmassTask::~EcalZmassTask ()
00151 {
00152
00153
00154
00155
00156 }
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166 void
00167 EcalZmassTask::analyze (const edm::Event & iEvent,
00168 const edm::EventSetup & iSetup)
00169 {
00170
00171 LogTrace (logTraceName) << "Analysis of event # ";
00172
00173 using namespace edm;
00174 Handle < GsfElectronCollection > electronCollection;
00175 iEvent.getByLabel (theElectronCollectionLabel, electronCollection);
00176 if (!electronCollection.isValid ())
00177 return;
00178
00179
00180 Handle < reco::GsfTrackCollection > gsftracks_h;
00181 iEvent.getByLabel ("electronGsfTracks", gsftracks_h);
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
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223 bool isBarrelElectrons;
00224 bool isEndcapElectrons;
00225 bool isIsolatedBarrel;
00226 bool isIDBarrel;
00227 bool isConvertedBarrel;
00228 bool isIsolatedEndcap;
00229 bool isIDEndcap;
00230 bool isConvertedEndcap;
00231
00232 int elIsAccepted=0;
00233 int elIsAcceptedEB=0;
00234 int elIsAcceptedEE=0;
00235
00236 std::vector<TLorentzVector> LV;
00237
00238 for (reco::GsfElectronCollection::const_iterator recoElectron =
00239 electronCollection->begin ();
00240 recoElectron != electronCollection->end (); recoElectron++)
00241 {
00242
00243 if (recoElectron->et () <= 25)
00244 continue;
00245
00246
00247 double IsoTrk = (recoElectron->dr03TkSumPt () / recoElectron->et ());
00248 double IsoEcal =
00249 (recoElectron->dr03EcalRecHitSumEt () / recoElectron->et ());
00250 double IsoHcal =
00251 (recoElectron->dr03HcalTowerSumEt () / recoElectron->et ());
00252 double HE = (recoElectron->hcalOverEcal ());
00253
00254
00255
00256 float DeltaPhiTkClu = recoElectron->deltaPhiSuperClusterTrackAtVtx ();
00257 float DeltaEtaTkClu = recoElectron->deltaEtaSuperClusterTrackAtVtx ();
00258 float sigmaIeIe = recoElectron->sigmaIetaIeta ();
00259
00260
00261
00262 float Dcot = recoElectron->convDcot ();
00263 float Dist = recoElectron->convDist ();
00264 int NumberOfExpectedInnerHits =
00265 recoElectron->gsfTrack ()->trackerExpectedHitsInner ().
00266 numberOfHits ();
00267
00268
00269
00270 isBarrelElectrons = false;
00271 isEndcapElectrons = false;
00272 isIsolatedBarrel = false;
00273 isIDBarrel = false;
00274 isConvertedBarrel = false;
00275 isIsolatedEndcap = false;
00276 isIDEndcap = false;
00277 isConvertedEndcap = false;
00278
00279
00280
00281
00282 if (fabs (recoElectron->eta ()) <= 1.4442)
00283 {
00284
00285
00286 if (IsoTrk < 0.09 && IsoEcal < 0.07 && IsoHcal < 0.10)
00287 {
00288 isIsolatedBarrel = true;
00289 }
00290
00291
00292 if (fabs (DeltaEtaTkClu) < 0.004 && fabs (DeltaPhiTkClu) < 0.06
00293 && sigmaIeIe < 0.01 && HE < 0.04)
00294 {
00295 isIDBarrel = true;
00296 }
00297
00298
00299 if ((fabs (Dist) >= 0.02 || fabs (Dcot) >= 0.02)
00300 && NumberOfExpectedInnerHits <= 1.0)
00301 {
00302 isConvertedBarrel = true;
00303 }
00304 }
00305
00306 if (isIsolatedBarrel && isIDBarrel && isConvertedBarrel) {
00307 elIsAccepted++;
00308 elIsAcceptedEB++;
00309 TLorentzVector b_e2(recoElectron->momentum ().x (),recoElectron->momentum ().y (),recoElectron->momentum ().z (), recoElectron->p ());
00310 LV.push_back(b_e2);
00311 }
00312
00313
00314
00315 if (fabs (recoElectron->eta ()) >= 1.5660
00316 && fabs (recoElectron->eta ()) <= 2.5000)
00317 {
00318
00319
00320 if (IsoTrk < 0.04 && IsoEcal < 0.05 && IsoHcal < 0.025)
00321 {
00322 isIsolatedEndcap = true;
00323 }
00324
00325
00326 if (fabs (DeltaEtaTkClu) < 0.007 && fabs (DeltaPhiTkClu) < 0.03
00327 && sigmaIeIe < 0.031 && HE < 0.15)
00328 {
00329 isIDEndcap = true;
00330 }
00331
00332
00333 if ((fabs (Dcot) > 0.02 || fabs (Dist) > 0.02)
00334 && NumberOfExpectedInnerHits <= 1.0)
00335 {
00336 isConvertedEndcap = true;
00337 }
00338 }
00339 if (isIsolatedEndcap && isIDEndcap && isConvertedEndcap) {
00340 elIsAccepted++;
00341 elIsAcceptedEE++;
00342 TLorentzVector e_e2(recoElectron->momentum ().x (),recoElectron->momentum ().y (),recoElectron->momentum ().z (), recoElectron->p ());
00343 LV.push_back(e_e2);
00344 }
00345
00346 }
00347
00348
00349
00350 if (elIsAccepted>1){
00351 double e_ee_invMass=0;
00352 if (elIsAccepted>2) cout<<"WARNING: In this events we have more than two electrons accpeted!!!!!!!"<<endl;
00353 if (LV.size()==2){
00354 TLorentzVector e_pair = LV[0] + LV[1];
00355 e_ee_invMass = e_pair.M ();
00356 }
00357
00358 if (elIsAcceptedEB==2){
00359 h_ee_invMass_BB->Fill(e_ee_invMass);
00360 }
00361 if (elIsAcceptedEE==2){
00362 h_ee_invMass_EE->Fill(e_ee_invMass);
00363 }
00364 if (elIsAcceptedEB==1 && elIsAcceptedEE==1){
00365 h_ee_invMass_EB->Fill(e_ee_invMass);
00366 }
00367
00368 LV.clear();
00369
00370 }
00371 }
00372
00373 #ifdef THIS_IS_AN_EVENT_EXAMPLE
00374 Handle < ExampleData > pIn;
00375 iEvent.getByLabel ("example", pIn);
00376 #endif
00377
00378 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
00379 ESHandle < SetupData > pSetup;
00380 iSetup.get < SetupRecord > ().get (pSetup);
00381 #endif
00382
00383
00384
00385
00386 void
00387 EcalZmassTask::beginJob ()
00388 {
00389
00390 DQMStore *theDbe;
00391 std::string logTraceName;
00392
00393 logTraceName = "EwkAnalyzer";
00394
00395 h_ee_invMass_EB = 0;
00396 h_ee_invMass_EE = 0;
00397 h_ee_invMass_BB = 0;
00398
00399
00400 LogTrace (logTraceName) << "Parameters initialization";
00401 theDbe = Service < DQMStore > ().operator-> ();
00402
00403 if (theDbe != 0)
00404 {
00405 theDbe->setCurrentFolder (prefixME_ + "/Zmass");
00406
00407
00408 h_ee_invMass_EB =
00409 theDbe->book1D ("Z peak - WP80 EB-EE",
00410 "Z peak - WP80 EB-EE;InvMass (GeV)", 60, 60.0, 120.0);
00411 h_ee_invMass_EE =
00412 theDbe->book1D ("Z peak - WP80 EE-EE",
00413 "Z peak - WP80 EE-EE;InvMass (Gev)", 60, 60.0, 120.0);
00414 h_ee_invMass_BB =
00415 theDbe->book1D ("Z peak - WP80 EB-EB",
00416 "Z peak - WP80 EB-EB;InvMass (Gev)", 60, 60.0, 120.0);
00417
00418
00419
00420
00421
00422
00423
00424 }
00425 }
00426
00427
00428 void
00429 EcalZmassTask::endJob ()
00430 {
00431 }
00432
00433
00434 void
00435 EcalZmassTask::beginRun (edm::Run const &, edm::EventSetup const &)
00436 {
00437
00438 }
00439
00440
00441 void
00442 EcalZmassTask::endRun (edm::Run const &, edm::EventSetup const &)
00443 {
00444 }
00445
00446
00447 void
00448 EcalZmassTask::beginLuminosityBlock (edm::LuminosityBlock const &,
00449 edm::EventSetup const &)
00450 {
00451 }
00452
00453
00454 void
00455 EcalZmassTask::endLuminosityBlock (edm::LuminosityBlock const &,
00456 edm::EventSetup const &)
00457 {
00458 }
00459
00460
00461 void
00462 EcalZmassTask::fillDescriptions (edm::
00463 ConfigurationDescriptions & descriptions)
00464 {
00465
00466
00467 edm::ParameterSetDescription desc;
00468 desc.setUnknown ();
00469 descriptions.addDefault (desc);
00470 }
00471
00472
00473 DEFINE_FWK_MODULE (EcalZmassTask);