CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
DiElectronVertexValidation Class Reference

#include <Alignment/OfflineValidation/plugins/DiElectronVertexValidation.cc>

Inheritance diagram for DiElectronVertexValidation:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 DiElectronVertexValidation (const edm::ParameterSet &)
 
 ~DiElectronVertexValidation () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
bool passLooseSelection (const reco::GsfElectron &electron)
 

Private Attributes

edm::ParameterSet CosPhi3DConfiguration_
 
DiLeptonHelp::PlotsVsKinematics CosPhi3DPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
 
edm::ParameterSet CosPhiConfiguration_
 
DiLeptonHelp::PlotsVsKinematics CosPhiPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
 
edm::ParameterSet DiMuMassConfiguration_
 
edm::EDGetTokenT
< reco::GsfElectronCollection
electronsToken_
 
edm::EDGetTokenT
< reco::GsfTrackCollection
gsfTracksToken_
 
TH1I * hClosestVtxIndex_
 
TH1F * hCosPhi3D_
 
TH1F * hCosPhi_
 
TH1F * hCutFlow_
 
TH1F * hGSF0Eta_
 
TH1F * hGSF0Pt_
 
TH1F * hGSF1Eta_
 
TH1F * hGSF1Pt_
 
TH1F * hGSFMult_
 
TH1F * hGSFMultAftPt_
 
TH1F * hInvMass_
 
TH1F * hSVDist3D_
 
TH1F * hSVDist3DSig_
 
TH1F * hSVDist_
 
TH1F * hSVDistSig_
 
TH1F * hSVProb_
 
TH1F * hTrackInvMass_
 
float maxSVdist_
 
DiLeptonHelp::Counts myCounts
 
std::vector< double > pTthresholds_
 
const edm::ESGetToken
< TransientTrackBuilder,
TransientTrackRecord
ttbESToken_
 
edm::EDGetTokenT
< reco::VertexCollection
vertexToken_
 
edm::ParameterSet VtxDist3DConfiguration_
 
DiLeptonHelp::PlotsVsKinematics VtxDist3DPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
 
edm::ParameterSet VtxDist3DSigConfiguration_
 
DiLeptonHelp::PlotsVsKinematics VtxDist3DSigPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
 
edm::ParameterSet VtxDistConfiguration_
 
DiLeptonHelp::PlotsVsKinematics VtxDistPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
 
edm::ParameterSet VtxDistSigConfiguration_
 
DiLeptonHelp::PlotsVsKinematics VtxDistSigPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
 
edm::ParameterSet VtxProbConfiguration_
 
DiLeptonHelp::PlotsVsKinematics VtxProbPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
 
DiLeptonHelp::PlotsVsKinematics ZMassPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 67 of file DiElectronVertexValidation.cc.

Constructor & Destructor Documentation

DiElectronVertexValidation::DiElectronVertexValidation ( const edm::ParameterSet iConfig)
explicit

Definition at line 143 of file DiElectronVertexValidation.cc.

References TFileService::kSharedResource, maxSVdist_, and pTthresholds_.

144  : pTthresholds_(iConfig.getParameter<std::vector<double>>("pTThresholds")),
145  maxSVdist_(iConfig.getParameter<double>("maxSVdist")),
146  CosPhiConfiguration_(iConfig.getParameter<edm::ParameterSet>("CosPhiConfig")),
147  CosPhi3DConfiguration_(iConfig.getParameter<edm::ParameterSet>("CosPhi3DConfig")),
148  VtxProbConfiguration_(iConfig.getParameter<edm::ParameterSet>("VtxProbConfig")),
149  VtxDistConfiguration_(iConfig.getParameter<edm::ParameterSet>("VtxDistConfig")),
150  VtxDist3DConfiguration_(iConfig.getParameter<edm::ParameterSet>("VtxDist3DConfig")),
151  VtxDistSigConfiguration_(iConfig.getParameter<edm::ParameterSet>("VtxDistSigConfig")),
152  VtxDist3DSigConfiguration_(iConfig.getParameter<edm::ParameterSet>("VtxDist3DSigConfig")),
153  DiMuMassConfiguration_(iConfig.getParameter<edm::ParameterSet>("DiMuMassConfig")),
154  ttbESToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))),
155  electronsToken_(consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("electrons"))),
156  gsfTracksToken_(consumes<reco::GsfTrackCollection>(iConfig.getParameter<edm::InputTag>("gsfTracks"))),
157  vertexToken_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertices"))) {
158  usesResource(TFileService::kSharedResource);
159 
160  // sort the vector of thresholds
161  std::sort(pTthresholds_.begin(), pTthresholds_.end(), [](const double& lhs, const double& rhs) { return lhs > rhs; });
162 
163  edm::LogInfo("DiElectronVertexValidation") << __FUNCTION__;
164  for (const auto& thr : pTthresholds_) {
165  edm::LogInfo("DiElectronVertexValidation") << " Threshold: " << thr << " ";
166  }
167  edm::LogInfo("DiElectronVertexValidation") << "Max SV distance: " << maxSVdist_ << " ";
168 }
static const std::string kSharedResource
Definition: TFileService.h:76
edm::EDGetTokenT< reco::GsfElectronCollection > electronsToken_
Log< level::Info, false > LogInfo
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttbESToken_
edm::EDGetTokenT< reco::GsfTrackCollection > gsfTracksToken_
DiElectronVertexValidation::~DiElectronVertexValidation ( )
overridedefault

Member Function Documentation

void DiElectronVertexValidation::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 177 of file DiElectronVertexValidation.cc.

References funct::abs(), RecoTauCleanerPlugins::charge, cmToum, CosPhi3DPlots, CosPhiPlots, counter, HLT_FULL_cff::deltaR, HLT_FULL_cff::distance, metsig::electron, electronsToken_, emass2, PVValHelper::eta, DiLeptonHelp::Counts::eventsAfterDist, DiLeptonHelp::Counts::eventsAfterEta, DiLeptonHelp::Counts::eventsAfterMult, DiLeptonHelp::Counts::eventsAfterPt, DiLeptonHelp::Counts::eventsAfterVtx, DiLeptonHelp::Counts::eventsTotal, DiLeptonHelp::PlotsVsKinematics::fillPlots(), edm::Event::get(), edm::EventSetup::getData(), edm::Event::getHandle(), gsfTracksToken_, hClosestVtxIndex_, hCosPhi3D_, hCosPhi_, hGSF0Eta_, hGSF0Pt_, hGSF1Eta_, hGSF1Pt_, hGSFMult_, hGSFMultAftPt_, hInvMass_, hSVDist3D_, hSVDist3DSig_, hSVDist_, hSVDistSig_, hSVProb_, hTrackInvMass_, mps_fire::i, SiStripPI::max, maxSVdist_, myCounts, passLooseSelection(), DiDispStaMuonMonitor_cfi::pt, pTthresholds_, mathSSE::sqrt(), HLT_FULL_cff::track, ttbESToken_, KalmanVertexFitter::vertex(), vertexToken_, beam_dqm_sourceclient-live_cfg::vertices, VtxDist3DPlots, VtxDist3DSigPlots, VtxDistPlots, VtxDistSigPlots, VtxProbPlots, and ZMassPlots.

177  {
178  using namespace edm;
179 
181 
182  std::vector<const reco::GsfElectron*> myGoodGsfElectrons;
183 
184  int totGsfCounter = 0;
185  for (const auto& gsfEle : iEvent.get(electronsToken_)) {
186  totGsfCounter++;
187  if (gsfEle.pt() > pTthresholds_[1] && passLooseSelection(gsfEle)) {
188  myGoodGsfElectrons.emplace_back(&gsfEle);
189  }
190  }
191 
192  hGSFMult_->Fill(totGsfCounter);
193 
194  std::sort(myGoodGsfElectrons.begin(),
195  myGoodGsfElectrons.end(),
196  [](const reco::GsfElectron*& lhs, const reco::GsfElectron*& rhs) { return lhs->pt() > rhs->pt(); });
197 
198  hGSFMultAftPt_->Fill(myGoodGsfElectrons.size());
199 
200  // reject if there's no Z
201  if (myGoodGsfElectrons.size() < 2)
202  return;
203 
205 
206  if ((myGoodGsfElectrons[0]->pt()) < pTthresholds_[0] || (myGoodGsfElectrons[1]->pt() < pTthresholds_[1]))
207  return;
208 
210 
211  if (myGoodGsfElectrons[0]->charge() * myGoodGsfElectrons[1]->charge() > 0)
212  return;
213 
214  if (std::max(std::abs(myGoodGsfElectrons[0]->eta()), std::abs(myGoodGsfElectrons[1]->eta())) > 2.4)
215  return;
216 
218 
219  const auto& ele1 = myGoodGsfElectrons[1]->p4();
220  const auto& ele0 = myGoodGsfElectrons[0]->p4();
221  const auto& mother = ele1 + ele0;
222 
223  float invMass = mother.M();
224  hInvMass_->Fill(invMass);
225 
226  // just copy the top two muons
227  std::vector<const reco::GsfElectron*> theZElectronVector;
228  theZElectronVector.reserve(2);
229  theZElectronVector.emplace_back(myGoodGsfElectrons[1]);
230  theZElectronVector.emplace_back(myGoodGsfElectrons[0]);
231 
232  // do the matching of Z muons with inner tracks
233 
234  std::vector<const reco::GsfTrack*> myGoodGsfTracks;
235 
236  unsigned int i = 0;
237  for (const auto& electron : theZElectronVector) {
238  i++;
239  float minD = 1000.;
240  const reco::GsfTrack* theMatch = nullptr;
241  for (const auto& track : iEvent.get(gsfTracksToken_)) {
242  float D = ::deltaR(electron->gsfTrack()->eta(), electron->gsfTrack()->phi(), track.eta(), track.phi());
243  if (D < minD) {
244  minD = D;
245  theMatch = &track;
246  }
247  }
248  myGoodGsfTracks.emplace_back(theMatch);
249  }
250 
251  hGSF0Pt_->Fill(myGoodGsfTracks[0]->pt());
252  hGSF0Eta_->Fill(myGoodGsfTracks[0]->eta());
253  hGSF1Pt_->Fill(myGoodGsfTracks[1]->pt());
254  hGSF1Eta_->Fill(myGoodGsfTracks[1]->eta());
255 
256  const TransientTrackBuilder* theB = &iSetup.getData(ttbESToken_);
257  TransientVertex aTransVtx;
258  std::vector<reco::TransientTrack> tks;
259 
260  std::vector<const reco::GsfTrack*> myTracks;
261  myTracks.emplace_back(myGoodGsfTracks[0]);
262  myTracks.emplace_back(myGoodGsfTracks[1]);
263 
264  if (myTracks.size() != 2)
265  return;
266 
267  const auto& e1 = myTracks[1]->momentum();
268  const auto& e0 = myTracks[0]->momentum();
269  const auto& ditrack = e1 + e0;
270 
271  const auto& tplus = myTracks[0]->charge() > 0 ? myTracks[0] : myTracks[1];
272  const auto& tminus = myTracks[0]->charge() < 0 ? myTracks[0] : myTracks[1];
273 
274  TLorentzVector p4_tplus(tplus->px(), tplus->py(), tplus->pz(), sqrt((tplus->p() * tplus->p()) + emass2));
275  TLorentzVector p4_tminus(tminus->px(), tminus->py(), tminus->pz(), sqrt((tminus->p() * tminus->p()) + emass2));
276 
277  // creat the pair of TLorentVectors used to make the plos
278  std::pair<TLorentzVector, TLorentzVector> tktk_p4 = std::make_pair(p4_tplus, p4_tminus);
279 
280  const auto& Zp4 = p4_tplus + p4_tminus;
281  float track_invMass = Zp4.M();
282  hTrackInvMass_->Fill(track_invMass);
283 
284  // fill the z->mm mass plots
285  ZMassPlots.fillPlots(track_invMass, tktk_p4);
286 
287  math::XYZPoint ZpT(ditrack.x(), ditrack.y(), 0);
288  math::XYZPoint Zp(ditrack.x(), ditrack.y(), ditrack.z());
289 
290  for (const auto& track : myTracks) {
291  reco::TransientTrack trajectory = theB->build(track);
292  tks.push_back(trajectory);
293  }
294 
295  KalmanVertexFitter kalman(true);
296  aTransVtx = kalman.vertex(tks);
297 
298  double SVProb = TMath::Prob(aTransVtx.totalChiSquared(), (int)aTransVtx.degreesOfFreedom());
299  hSVProb_->Fill(SVProb);
300 
301  if (!aTransVtx.isValid())
302  return;
303 
305 
306  // fill the VtxProb plots
307  VtxProbPlots.fillPlots(SVProb, tktk_p4);
308 
309  // get collection of reconstructed vertices from event
311 
312  math::XYZPoint mainVtx(0, 0, 0);
313  reco::Vertex TheMainVtx; // = vertexHandle.product()->front();
314 
315  VertexDistanceXY vertTool;
316  VertexDistance3D vertTool3D;
317 
318  if (vertexHandle.isValid()) {
319  const reco::VertexCollection* vertices = vertexHandle.product();
320  float minD = 9999.;
321  int closestVtxIndex = 0;
322  int counter = 0;
323  for (const auto& vtx : *vertices) {
324  double dist3D = vertTool3D.distance(aTransVtx, vtx).value();
325  if (dist3D < minD) {
326  minD = dist3D;
327  closestVtxIndex = counter;
328  }
329  counter++;
330  }
331  if ((*vertices).at(closestVtxIndex).isValid()) {
332  hClosestVtxIndex_->Fill(closestVtxIndex);
333  TheMainVtx = (*vertices).at(closestVtxIndex);
334  mainVtx.SetXYZ(TheMainVtx.position().x(), TheMainVtx.position().y(), TheMainVtx.position().z());
335  }
336  }
337 
338  const math::XYZPoint myVertex(aTransVtx.position().x(), aTransVtx.position().y(), aTransVtx.position().z());
339  const math::XYZPoint deltaVtx(mainVtx.x() - myVertex.x(), mainVtx.y() - myVertex.y(), mainVtx.z() - myVertex.z());
340 
341  if (TheMainVtx.isValid()) {
342  // Z Vertex distance in the xy plane
343  double distance = vertTool.distance(aTransVtx, TheMainVtx).value();
344  double dist_err = vertTool.distance(aTransVtx, TheMainVtx).error();
345 
346  hSVDist_->Fill(distance * cmToum);
347  hSVDistSig_->Fill(distance / dist_err);
348 
349  // fill the VtxDist plots
350  VtxDistPlots.fillPlots(distance * cmToum, tktk_p4);
351 
352  // fill the VtxDisSig plots
353  VtxDistSigPlots.fillPlots(distance / dist_err, tktk_p4);
354 
355  // Z Vertex distance in 3D
356  double distance3D = vertTool3D.distance(aTransVtx, TheMainVtx).value();
357  double dist3D_err = vertTool3D.distance(aTransVtx, TheMainVtx).error();
358 
359  hSVDist3D_->Fill(distance3D * cmToum);
360  hSVDist3DSig_->Fill(distance3D / dist3D_err);
361 
362  // fill the VtxDist3D plots
363  VtxDist3DPlots.fillPlots(distance3D * cmToum, tktk_p4);
364 
365  // fill the VtxDisSig plots
366  VtxDist3DSigPlots.fillPlots(distance3D / dist3D_err, tktk_p4);
367 
368  // cut on the PV - SV distance
369  if (distance * cmToum < maxSVdist_) {
371 
372  double cosphi = (ZpT.x() * deltaVtx.x() + ZpT.y() * deltaVtx.y()) /
373  (sqrt(ZpT.x() * ZpT.x() + ZpT.y() * ZpT.y()) *
374  sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y()));
375 
376  double cosphi3D = (Zp.x() * deltaVtx.x() + Zp.y() * deltaVtx.y() + Zp.z() * deltaVtx.z()) /
377  (sqrt(Zp.x() * Zp.x() + Zp.y() * Zp.y() + Zp.z() * Zp.z()) *
378  sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y() + deltaVtx.z() * deltaVtx.z()));
379 
380  hCosPhi_->Fill(cosphi);
381  hCosPhi3D_->Fill(cosphi3D);
382 
383  // fill the cosphi plots
384  CosPhiPlots.fillPlots(cosphi, tktk_p4);
385 
386  // fill the VtxDisSig plots
387  CosPhi3DPlots.fillPlots(cosphi3D, tktk_p4);
388  }
389  }
390 }
DiLeptonHelp::PlotsVsKinematics CosPhiPlots
static constexpr float emass2
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
DiLeptonHelp::PlotsVsKinematics VtxDist3DPlots
DiLeptonHelp::PlotsVsKinematics CosPhi3DPlots
DiLeptonHelp::PlotsVsKinematics VtxDistSigPlots
DiLeptonHelp::PlotsVsKinematics VtxProbPlots
bool getData(T &iHolder) const
Definition: EventSetup.h:122
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
bool passLooseSelection(const reco::GsfElectron &electron)
edm::EDGetTokenT< reco::GsfElectronCollection > electronsToken_
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
DiLeptonHelp::PlotsVsKinematics VtxDist3DSigPlots
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
static std::atomic< unsigned int > counter
void fillPlots(const float val, const std::pair< TLorentzVector, TLorentzVector > &momenta)
static constexpr float cmToum
DiLeptonHelp::PlotsVsKinematics VtxDistPlots
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttbESToken_
DiLeptonHelp::PlotsVsKinematics ZMassPlots
edm::EDGetTokenT< reco::GsfTrackCollection > gsfTracksToken_
void DiElectronVertexValidation::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 415 of file DiElectronVertexValidation.cc.

References DiLeptonHelp::PlotsVsKinematics::bookFromPSet(), CosPhi3DConfiguration_, CosPhi3DPlots, CosPhiConfiguration_, CosPhiPlots, DiMuMassConfiguration_, compareTotals::fs, hClosestVtxIndex_, hCosPhi3D_, hCosPhi_, hCutFlow_, hGSF0Eta_, hGSF0Pt_, hGSF1Eta_, hGSF1Pt_, hGSFMult_, hGSFMultAftPt_, hInvMass_, hSVDist3D_, hSVDist3DSig_, hSVDist_, hSVDistSig_, hSVProb_, hTrackInvMass_, mps_fire::i, TFileService::make(), TFileService::mkdir(), myCounts, names, AlCaHLTBitMon_QueryRunRegistry::string, VtxDist3DConfiguration_, VtxDist3DPlots, VtxDist3DSigConfiguration_, VtxDist3DSigPlots, VtxDistConfiguration_, VtxDistPlots, VtxDistSigConfiguration_, VtxDistSigPlots, VtxProbConfiguration_, VtxProbPlots, DiLeptonHelp::Counts::zeroAll(), and ZMassPlots.

415  {
416  // please remove this method if not needed
418 
419  // clang-format off
420  TH1F::SetDefaultSumw2(kTRUE);
421 
422  hGSFMult_= fs->make<TH1F>("GSFMult", ";# gsf tracks;N. events", 20, 0., 20.);
423  hGSFMultAftPt_= fs->make<TH1F>("GSFMultAftPt", ";# gsf tracks;N. events", 20, 0., 20.);
424  hGSF0Pt_= fs->make<TH1F>("GSF0Pt", ";leading GSF track p_{T};N. GSF tracks", 100, 0., 100.);
425  hGSF0Eta_= fs->make<TH1F>("GSF0Eta", ";leading GSF track #eta;N. GSF tracks", 50, -2.5, 2.5);
426  hGSF1Pt_= fs->make<TH1F>("GSF1Pt", ";sub-leading GSF track p_{T};N. GSF tracks", 100, 0., 100.);
427  hGSF1Eta_= fs->make<TH1F>("GSF1Eta", ";sub-leading GSF track #eta;N. GSF tracks", 50, -2.5, 2.5);
428 
429  hSVProb_ = fs->make<TH1F>("VtxProb", ";ZV vertex probability;N(e^{+}e^{-} pairs)", 100, 0., 1.);
430 
431  hSVDist_ = fs->make<TH1F>("VtxDist", ";PV-ZV xy distance [#mum];N(e^{+}e^{-} pairs)", 100, 0., 1000.);
432  hSVDistSig_ = fs->make<TH1F>("VtxDistSig", ";PV-ZV xy distance signficance;N(e^{+}e^{-} pairs)", 100, 0., 5.);
433 
434  hSVDist3D_ = fs->make<TH1F>("VtxDist3D", ";PV-ZV 3D distance [#mum];N(e^{+}e^{-} pairs)", 100, 0., 1000.);
435  hSVDist3DSig_ = fs->make<TH1F>("VtxDist3DSig", ";PV-ZV 3D distance signficance;N(e^{+}e^{-} pairs)", 100, 0., 5.);
436 
437  hCosPhi_ = fs->make<TH1F>("CosPhi", ";cos(#phi_{xy});N(ee pairs)", 50, -1., 1.);
438  hCosPhi3D_ = fs->make<TH1F>("CosPhi3D", ";cos(#phi_{3D});N(ee pairs)", 50, -1., 1.);
439  hTrackInvMass_ = fs->make<TH1F>("TkTkInvMass", ";M(tk,tk) [GeV];N(tk tk pairs)", 70., 50., 120.);
440  hInvMass_ = fs->make<TH1F>("InvMass", ";M(#mu#mu) [GeV];N(#mu#mu pairs)", 70., 50., 120.);
441 
442  hClosestVtxIndex_ = fs->make<TH1I>("ClosestVtxIndex", ";closest vertex index;N(tk tk pairs)", 20, -0.5, 19.5);
443 
444  // 2D Maps
445 
446  TFileDirectory dirCosPhi = fs->mkdir("CosPhiPlots");
448 
449  TFileDirectory dirCosPhi3D = fs->mkdir("CosPhi3DPlots");
451 
452  TFileDirectory dirVtxProb = fs->mkdir("VtxProbPlots");
454 
455  TFileDirectory dirVtxDist = fs->mkdir("VtxDistPlots");
457 
458  TFileDirectory dirVtxDist3D = fs->mkdir("VtxDist3DPlots");
460 
461  TFileDirectory dirVtxDistSig = fs->mkdir("VtxDistSigPlots");
463 
464  TFileDirectory dirVtxDist3DSig = fs->mkdir("VtxDist3DSigPlots");
466 
467  TFileDirectory dirInvariantMass = fs->mkdir("InvariantMassPlots");
469 
470  // cut flow
471 
472  hCutFlow_ = fs->make<TH1F>("hCutFlow","cut flow;cut step;events left",6,-0.5,5.5);
473  std::string names[6]={"Total","Mult.",">pT","<eta","hasVtx","VtxDist"};
474  for(unsigned int i=0;i<6;i++){
475  hCutFlow_->GetXaxis()->SetBinLabel(i+1,names[i].c_str());
476  }
477 
478  myCounts.zeroAll();
479 }
DiLeptonHelp::PlotsVsKinematics CosPhiPlots
DiLeptonHelp::PlotsVsKinematics VtxDist3DPlots
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
DiLeptonHelp::PlotsVsKinematics CosPhi3DPlots
DiLeptonHelp::PlotsVsKinematics VtxDistSigPlots
DiLeptonHelp::PlotsVsKinematics VtxProbPlots
const std::string names[nVars_]
DiLeptonHelp::PlotsVsKinematics VtxDist3DSigPlots
void bookFromPSet(const TFileDirectory &fs, const edm::ParameterSet &hpar)
DiLeptonHelp::PlotsVsKinematics VtxDistPlots
DiLeptonHelp::PlotsVsKinematics ZMassPlots
void DiElectronVertexValidation::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 482 of file DiElectronVertexValidation.cc.

References DiLeptonHelp::Counts::eventsAfterDist, DiLeptonHelp::Counts::eventsAfterEta, DiLeptonHelp::Counts::eventsAfterMult, DiLeptonHelp::Counts::eventsAfterPt, DiLeptonHelp::Counts::eventsAfterVtx, DiLeptonHelp::Counts::eventsTotal, hCutFlow_, myCounts, and DiLeptonHelp::Counts::printCounts().

Referenced by o2olib.O2ORunMgr::executeJob().

482  {
484 
485  hCutFlow_->SetBinContent(1,myCounts.eventsTotal);
486  hCutFlow_->SetBinContent(2,myCounts.eventsAfterMult);
487  hCutFlow_->SetBinContent(3,myCounts.eventsAfterPt);
488  hCutFlow_->SetBinContent(4,myCounts.eventsAfterEta);
489  hCutFlow_->SetBinContent(5,myCounts.eventsAfterVtx);
490  hCutFlow_->SetBinContent(6,myCounts.eventsAfterDist);
491 }
void DiElectronVertexValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 494 of file DiElectronVertexValidation.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

494  {
496  desc.add<edm::InputTag>("gsfTracks",edm::InputTag("electronGsfTracks"));
497  desc.add<edm::InputTag>("vertices", edm::InputTag("offlinePrimaryVertices"));
498  desc.add<edm::InputTag>("electrons", edm::InputTag("gedGsfElectrons"));
499  desc.add<std::vector<double>>("pTThresholds", {25., 15.});
500  desc.add<double>("maxSVdist", 50.);
501 
502  {
503  edm::ParameterSetDescription psDiMuMass;
504  psDiMuMass.add<std::string>("name", "DiMuMass");
505  psDiMuMass.add<std::string>("title", "M(#mu#mu)");
506  psDiMuMass.add<std::string>("yUnits", "[GeV]");
507  psDiMuMass.add<int>("NxBins", 24);
508  psDiMuMass.add<int>("NyBins", 50);
509  psDiMuMass.add<double>("ymin", 70.);
510  psDiMuMass.add<double>("ymax", 120.);
511  desc.add<edm::ParameterSetDescription>("DiMuMassConfig", psDiMuMass);
512  }
513  {
515  psCosPhi.add<std::string>("name", "CosPhi");
516  psCosPhi.add<std::string>("title", "cos(#phi_{xy})");
517  psCosPhi.add<std::string>("yUnits", "");
518  psCosPhi.add<int>("NxBins", 50);
519  psCosPhi.add<int>("NyBins", 50);
520  psCosPhi.add<double>("ymin", -1.);
521  psCosPhi.add<double>("ymax", 1.);
522  desc.add<edm::ParameterSetDescription>("CosPhiConfig", psCosPhi);
523  }
524  {
525  edm::ParameterSetDescription psCosPhi3D;
526  psCosPhi3D.add<std::string>("name", "CosPhi3D");
527  psCosPhi3D.add<std::string>("title", "cos(#phi_{3D})");
528  psCosPhi3D.add<std::string>("yUnits", "");
529  psCosPhi3D.add<int>("NxBins", 50);
530  psCosPhi3D.add<int>("NyBins", 50);
531  psCosPhi3D.add<double>("ymin", -1.);
532  psCosPhi3D.add<double>("ymax", 1.);
533  desc.add<edm::ParameterSetDescription>("CosPhi3DConfig", psCosPhi3D);
534  }
535  {
537  psVtxProb.add<std::string>("name", "VtxProb");
538  psVtxProb.add<std::string>("title", "Prob(#chi^{2}_{SV})");
539  psVtxProb.add<std::string>("yUnits", "");
540  psVtxProb.add<int>("NxBins", 50);
541  psVtxProb.add<int>("NyBins", 50);
542  psVtxProb.add<double>("ymin", 0);
543  psVtxProb.add<double>("ymax", 1.);
544  desc.add<edm::ParameterSetDescription>("VtxProbConfig", psVtxProb);
545  }
546  {
548  psVtxDist.add<std::string>("name", "VtxDist");
549  psVtxDist.add<std::string>("title", "d_{xy}(PV,SV)");
550  psVtxDist.add<std::string>("yUnits", "[#mum]");
551  psVtxDist.add<int>("NxBins", 50);
552  psVtxDist.add<int>("NyBins", 100);
553  psVtxDist.add<double>("ymin", 0);
554  psVtxDist.add<double>("ymax", 300.);
555  desc.add<edm::ParameterSetDescription>("VtxDistConfig", psVtxDist);
556  }
557  {
558  edm::ParameterSetDescription psVtxDist3D;
559  psVtxDist3D.add<std::string>("name", "VtxDist3D");
560  psVtxDist3D.add<std::string>("title", "d_{3D}(PV,SV)");
561  psVtxDist3D.add<std::string>("yUnits", "[#mum]");
562  psVtxDist3D.add<int>("NxBins", 50);
563  psVtxDist3D.add<int>("NyBins", 250);
564  psVtxDist3D.add<double>("ymin", 0);
565  psVtxDist3D.add<double>("ymax", 500.);
566  desc.add<edm::ParameterSetDescription>("VtxDist3DConfig", psVtxDist3D);
567  }
568  {
569  edm::ParameterSetDescription psVtxDistSig;
570  psVtxDistSig.add<std::string>("name", "VtxDistSig");
571  psVtxDistSig.add<std::string>("title", "d_{xy}(PV,SV)/#sigma_{dxy}(PV,SV)");
572  psVtxDistSig.add<std::string>("yUnits", "");
573  psVtxDistSig.add<int>("NxBins", 50);
574  psVtxDistSig.add<int>("NyBins", 100);
575  psVtxDistSig.add<double>("ymin", 0);
576  psVtxDistSig.add<double>("ymax", 5.);
577  desc.add<edm::ParameterSetDescription>("VtxDistSigConfig", psVtxDistSig);
578  }
579  {
580  edm::ParameterSetDescription psVtxDist3DSig;
581  psVtxDist3DSig.add<std::string>("name", "VtxDist3DSig");
582  psVtxDist3DSig.add<std::string>("title", "d_{3D}(PV,SV)/#sigma_{d3D}(PV,SV)");
583  psVtxDist3DSig.add<std::string>("yUnits", "");
584  psVtxDist3DSig.add<int>("NxBins", 50);
585  psVtxDist3DSig.add<int>("NyBins", 100);
586  psVtxDist3DSig.add<double>("ymin", 0);
587  psVtxDist3DSig.add<double>("ymax", 5.);
588  desc.add<edm::ParameterSetDescription>("VtxDist3DSigConfig", psVtxDist3DSig);
589  }
590 
591  descriptions.addWithDefaultLabel(desc);
592 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool DiElectronVertexValidation::passLooseSelection ( const reco::GsfElectron electron)
private

Definition at line 392 of file DiElectronVertexValidation.cc.

References Reference_intrackfit_cff::barrel, reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::ecalEnergy(), Reference_intrackfit_cff::endcap, reco::GsfElectron::eSuperClusterOverP(), reco::GsfElectron::full5x5_sigmaIetaIeta(), reco::GsfElectron::gsfTrack(), reco::GsfElectron::hadronicOverEm(), reco::HitPattern::MISSING_INNER_HITS, l1ParticleFlow_cff::resol, and reco::GsfElectron::superCluster().

Referenced by analyze().

392  {
393  float dEtaln = fabs(el.deltaEtaSuperClusterTrackAtVtx());
394  float dPhiln = fabs(el.deltaPhiSuperClusterTrackAtVtx());
395  float sigmaletaleta = el.full5x5_sigmaIetaIeta();
396  float hem = el.hadronicOverEm();
397  double resol = fabs((1 / el.ecalEnergy()) - (el.eSuperClusterOverP() / el.ecalEnergy()));
398  double mHits = el.gsfTrack()->hitPattern().numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS);
399  bool barrel = (fabs(el.superCluster()->eta()) <= 1.479);
400  bool endcap = (!barrel && fabs(el.superCluster()->eta()) < 2.5);
401 
402  // loose electron ID
403 
404  if (barrel && dEtaln < 0.00477 && dPhiln < 0.222 && sigmaletaleta < 0.011 && hem < 0.298 && resol < 0.241 &&
405  mHits <= 1)
406  return true;
407  if (endcap && dEtaln < 0.00868 && dPhiln < 0.213 && sigmaletaleta < 0.0314 && hem < 0.101 && resol < 0.14 &&
408  mHits <= 1)
409  return true;
410 
411  return false;
412 }

Member Data Documentation

edm::ParameterSet DiElectronVertexValidation::CosPhi3DConfiguration_
private

Definition at line 88 of file DiElectronVertexValidation.cc.

Referenced by beginJob().

DiLeptonHelp::PlotsVsKinematics DiElectronVertexValidation::CosPhi3DPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
private

Definition at line 124 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

edm::ParameterSet DiElectronVertexValidation::CosPhiConfiguration_
private

Definition at line 87 of file DiElectronVertexValidation.cc.

Referenced by beginJob().

DiLeptonHelp::PlotsVsKinematics DiElectronVertexValidation::CosPhiPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
private

Definition at line 123 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

edm::ParameterSet DiElectronVertexValidation::DiMuMassConfiguration_
private

Definition at line 94 of file DiElectronVertexValidation.cc.

Referenced by beginJob().

edm::EDGetTokenT<reco::GsfElectronCollection> DiElectronVertexValidation::electronsToken_
private

Definition at line 98 of file DiElectronVertexValidation.cc.

Referenced by analyze().

edm::EDGetTokenT<reco::GsfTrackCollection> DiElectronVertexValidation::gsfTracksToken_
private

Definition at line 100 of file DiElectronVertexValidation.cc.

Referenced by analyze().

TH1I* DiElectronVertexValidation::hClosestVtxIndex_
private

Definition at line 118 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hCosPhi3D_
private

Definition at line 115 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hCosPhi_
private

Definition at line 114 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hCutFlow_
private

Definition at line 119 of file DiElectronVertexValidation.cc.

Referenced by beginJob(), and endJob().

TH1F* DiElectronVertexValidation::hGSF0Eta_
private

Definition at line 108 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hGSF0Pt_
private

Definition at line 107 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hGSF1Eta_
private

Definition at line 110 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hGSF1Pt_
private

Definition at line 109 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hGSFMult_
private

Definition at line 105 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hGSFMultAftPt_
private

Definition at line 106 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hInvMass_
private

Definition at line 117 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hSVDist3D_
private

Definition at line 112 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hSVDist3DSig_
private

Definition at line 113 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hSVDist_
private

Definition at line 104 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hSVDistSig_
private

Definition at line 111 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hSVProb_
private

Definition at line 103 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

TH1F* DiElectronVertexValidation::hTrackInvMass_
private

Definition at line 116 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

float DiElectronVertexValidation::maxSVdist_
private

Definition at line 83 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and DiElectronVertexValidation().

DiLeptonHelp::Counts DiElectronVertexValidation::myCounts
private

Definition at line 81 of file DiElectronVertexValidation.cc.

Referenced by analyze(), beginJob(), and endJob().

std::vector<double> DiElectronVertexValidation::pTthresholds_
private

Definition at line 82 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and DiElectronVertexValidation().

const edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> DiElectronVertexValidation::ttbESToken_
private

Definition at line 96 of file DiElectronVertexValidation.cc.

Referenced by analyze().

edm::EDGetTokenT<reco::VertexCollection> DiElectronVertexValidation::vertexToken_
private

Definition at line 101 of file DiElectronVertexValidation.cc.

Referenced by analyze().

edm::ParameterSet DiElectronVertexValidation::VtxDist3DConfiguration_
private

Definition at line 91 of file DiElectronVertexValidation.cc.

Referenced by beginJob().

DiLeptonHelp::PlotsVsKinematics DiElectronVertexValidation::VtxDist3DPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
private

Definition at line 127 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

edm::ParameterSet DiElectronVertexValidation::VtxDist3DSigConfiguration_
private

Definition at line 93 of file DiElectronVertexValidation.cc.

Referenced by beginJob().

DiLeptonHelp::PlotsVsKinematics DiElectronVertexValidation::VtxDist3DSigPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
private

Definition at line 129 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

edm::ParameterSet DiElectronVertexValidation::VtxDistConfiguration_
private

Definition at line 90 of file DiElectronVertexValidation.cc.

Referenced by beginJob().

DiLeptonHelp::PlotsVsKinematics DiElectronVertexValidation::VtxDistPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
private

Definition at line 126 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

edm::ParameterSet DiElectronVertexValidation::VtxDistSigConfiguration_
private

Definition at line 92 of file DiElectronVertexValidation.cc.

Referenced by beginJob().

DiLeptonHelp::PlotsVsKinematics DiElectronVertexValidation::VtxDistSigPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
private

Definition at line 128 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

edm::ParameterSet DiElectronVertexValidation::VtxProbConfiguration_
private

Definition at line 89 of file DiElectronVertexValidation.cc.

Referenced by beginJob().

DiLeptonHelp::PlotsVsKinematics DiElectronVertexValidation::VtxProbPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
private

Definition at line 125 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().

DiLeptonHelp::PlotsVsKinematics DiElectronVertexValidation::ZMassPlots = DiLeptonHelp::PlotsVsKinematics(DiLeptonHelp::EE)
private

Definition at line 130 of file DiElectronVertexValidation.cc.

Referenced by analyze(), and beginJob().