CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
QualityCutsAnalyzer Class Reference
Inheritance diagram for QualityCutsAnalyzer:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  histogram_element_t
 
class  histogram_t
 

Public Member Functions

 QualityCutsAnalyzer (const edm::ParameterSet &)
 
 ~QualityCutsAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::vector< std::vector< histogram_element_t > > histogram_data_t
 
typedef std::vector< int > vint
 
typedef std::vector< std::string > vstring
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
void LoopOverJetTracksAssociation (const edm::ESHandle< TransientTrackBuilder > &, const edm::Handle< reco::VertexCollection > &, const edm::Handle< reco::JetTracksAssociationCollection > &)
 

Private Attributes

TrackClassifier classifier_
 
histogram_data_t histogram_data_
 
const edm::EDGetTokenT< reco::JetTracksAssociationCollectionjtaToken_
 
double maximumChiSquared_
 
int minimumNumberOfHits_
 
int minimumNumberOfPixelHits_
 
double minimumTransverseMomentum_
 
std::string rootFile_
 
reco::TrackBase::TrackQuality trackQuality_
 
const edm::EDGetTokenT< edm::View< reco::Track > > trkToken_
 
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecordttrkToken_
 
bool useAllQualities_
 
const edm::EDGetTokenT< reco::VertexCollectionvtxToken_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 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

Definition at line 36 of file QualityCutsAnalyzer.cc.

Member Typedef Documentation

◆ histogram_data_t

typedef std::vector<std::vector<histogram_element_t> > QualityCutsAnalyzer::histogram_data_t
private

Definition at line 106 of file QualityCutsAnalyzer.cc.

◆ vint

typedef std::vector<int> QualityCutsAnalyzer::vint
private

Definition at line 52 of file QualityCutsAnalyzer.cc.

◆ vstring

typedef std::vector<std::string> QualityCutsAnalyzer::vstring
private

Definition at line 53 of file QualityCutsAnalyzer.cc.

Constructor & Destructor Documentation

◆ QualityCutsAnalyzer()

QualityCutsAnalyzer::QualityCutsAnalyzer ( const edm::ParameterSet config)
explicit

Definition at line 204 of file QualityCutsAnalyzer.cc.

References gather_cfg::cout, createfilelist::int, maximumChiSquared_, minimumNumberOfHits_, minimumNumberOfPixelHits_, minimumTransverseMomentum_, reco::TrackBase::qualityByName(), rootFile_, AlCaHLTBitMon_QueryRunRegistry::string, trackQuality_, HcalDetIdTransform::transform(), and useAllQualities_.

205  : ttrkToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))),
206  trkToken_(consumes<edm::View<reco::Track>>(config.getUntrackedParameter<edm::InputTag>("trackProducer"))),
207  vtxToken_(consumes<reco::VertexCollection>(config.getUntrackedParameter<edm::InputTag>("primaryVertexProducer"))),
208  jtaToken_(consumes<reco::JetTracksAssociationCollection>(
209  config.getUntrackedParameter<edm::InputTag>("jetTracksAssociation"))),
211  rootFile_ = config.getUntrackedParameter<std::string>("rootFile");
212 
213  minimumNumberOfHits_ = config.getUntrackedParameter<int>("minimumNumberOfHits");
214  minimumNumberOfPixelHits_ = config.getUntrackedParameter<int>("minimumNumberOfPixelHits");
215  minimumTransverseMomentum_ = config.getUntrackedParameter<double>("minimumTransverseMomentum");
216  maximumChiSquared_ = config.getUntrackedParameter<double>("maximumChiSquared");
217 
218  std::string trackQualityType = config.getUntrackedParameter<std::string>("trackQualityClass"); // used
219  trackQuality_ = reco::TrackBase::qualityByName(trackQualityType);
220  useAllQualities_ = false;
221 
223  trackQualityType.begin(), trackQualityType.end(), trackQualityType.begin(), (int (*)(int))std::tolower);
224  if (trackQualityType == "any") {
225  std::cout << "Using any" << std::endl;
226  useAllQualities_ = true;
227  }
228 }
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > jtaToken_
reco::TrackBase::TrackQuality trackQuality_
TrackClassifier classifier_
Definition: config.py:1
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttrkToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const edm::EDGetTokenT< edm::View< reco::Track > > trkToken_
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
const edm::EDGetTokenT< reco::VertexCollection > vtxToken_
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ ~QualityCutsAnalyzer()

QualityCutsAnalyzer::~QualityCutsAnalyzer ( )
overridedefault

Member Function Documentation

◆ analyze()

void QualityCutsAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 235 of file QualityCutsAnalyzer.cc.

References classifier_, HLT_2023v12_cff::jetTracks, jtaToken_, LoopOverJetTracksAssociation(), TrackClassifier::newEvent(), singleTopDQM_cfi::setup, JetHT_cfg::trackCollection, trkToken_, ttrkToken_, and vtxToken_.

235  {
236  // Track collection
238  event.getByToken(trkToken_, trackCollection);
239  // Primary vertex
240  edm::Handle<reco::VertexCollection> primaryVertexCollection;
241  event.getByToken(vtxToken_, primaryVertexCollection);
242  // Jet to tracks associator
244  event.getByToken(jtaToken_, jetTracks);
245  // Trasient track builder
246  const edm::ESHandle<TransientTrackBuilder> TTbuilder = setup.getHandle(ttrkToken_);
247 
248  // Setting up event information for the track categories.
250 
251  LoopOverJetTracksAssociation(TTbuilder, primaryVertexCollection, jetTracks);
252 }
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > jtaToken_
void LoopOverJetTracksAssociation(const edm::ESHandle< TransientTrackBuilder > &, const edm::Handle< reco::VertexCollection > &, const edm::Handle< reco::JetTracksAssociationCollection > &)
TrackClassifier classifier_
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttrkToken_
const edm::EDGetTokenT< edm::View< reco::Track > > trkToken_
void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
trackCollection
Definition: JetHT_cfg.py:51
const edm::EDGetTokenT< reco::VertexCollection > vtxToken_
Definition: event.py:1

◆ beginJob()

void QualityCutsAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 256 of file QualityCutsAnalyzer.cc.

References histogram_data_.

256 { histogram_data_.resize(6); }
histogram_data_t histogram_data_

◆ endJob()

void QualityCutsAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 260 of file QualityCutsAnalyzer.cc.

References geometryDiff::file, QualityCutsAnalyzer::histogram_t::Fill(), histogram_data_, mps_fire::i, dqmiolumiharvest::j, rootFile_, AlCaHLTBitMon_QueryRunRegistry::string, and QualityCutsAnalyzer::histogram_t::Write().

260  {
261  TFile file(rootFile_.c_str(), "RECREATE");
262  file.cd();
263 
264  // saving the histograms
265  for (std::size_t i = 0; i < 6; i++) {
266  std::string particle;
267  if (i == 0)
268  particle = std::string("B_tracks");
269  else if (i == 1)
270  particle = std::string("C_tracks");
271  else if (i == 2)
272  particle = std::string("nonB_tracks");
273  else if (i == 3)
274  particle = std::string("displaced_tracks");
275  else if (i == 4)
276  particle = std::string("bad_tracks");
277  else
278  particle = std::string("fake_tracks");
279 
280  histogram_t histogram(particle);
281 
282  for (std::size_t j = 0; j < histogram_data_[i].size(); j++)
283  histogram.Fill(histogram_data_[i][j]);
284 
285  histogram.Write();
286  }
287 
288  file.Flush();
289 }
histogram_data_t histogram_data_

◆ LoopOverJetTracksAssociation()

void QualityCutsAnalyzer::LoopOverJetTracksAssociation ( const edm::ESHandle< TransientTrackBuilder > &  TTbuilder,
const edm::Handle< reco::VertexCollection > &  primaryVertexProducer_,
const edm::Handle< reco::JetTracksAssociationCollection > &  jetTracksAssociation 
)
private

Definition at line 291 of file QualityCutsAnalyzer.cc.

References TrackCategories::Bad, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::begin(), TransientTrackBuilder::build(), TrackCategories::BWeakDecay, nano_mu_local_reco_cff::chi2, classifier_, TrackCategories::CWeakDecay, d0, PVValHelper::dz, MillePedeFileConverter_cfg::e, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::end(), TrackClassifier::evaluate(), TrackCategories::Fake, histogram_data_, hfClusterShapes_cfi::hits, mps_fire::i, TrackCategories::is(), IPTools::jetTrackDistance(), HLT_2023v12_cff::jetTracks, maximumChiSquared_, minimumNumberOfHits_, minimumNumberOfPixelHits_, minimumTransverseMomentum_, AlCaHLTBitMon_ParallelJobs::p, InitialStepPreSplitting_cff::pixelHits, TrackCategories::PrimaryVertex, edm::Handle< T >::product(), edm::ESHandle< T >::product(), DiDispStaMuonMonitor_cfi::pt, push_back(), MetAnalyzer::pv(), FSQDQM_cfi::pvs, quality, IPTools::signedDecayLength3D(), IPTools::signedImpactParameter3D(), IPTools::signedTransverseImpactParameter(), HLT_2023v12_cff::track, trackQuality_, pwdgSkimBPark_cfi::tracks, useAllQualities_, and HltBtagValidation_cff::Vertex.

Referenced by analyze().

294  {
295  const TransientTrackBuilder *bproduct = TTbuilder.product();
296 
297  // getting the primary vertex
298  // use first pv of the collection
300 
301  if (!primaryVertexProducer_->empty()) {
303  std::vector<reco::Vertex> sortedList = pvs.sortedList(*(primaryVertexProducer_.product()));
304  pv = (sortedList.front());
305  } else { // create a dummy PV
306  // cout << "NO PV FOUND" << endl;
308  e(0, 0) = 0.0015 * 0.0015;
309  e(1, 1) = 0.0015 * 0.0015;
310  e(2, 2) = 15. * 15.;
311  reco::Vertex::Point p(0, 0, 0);
312  pv = reco::Vertex(p, e, 1, 1, 1);
313  }
314 
315  reco::JetTracksAssociationCollection::const_iterator it = jetTracksAssociation->begin();
316 
317  int i = 0;
318 
319  for (; it != jetTracksAssociation->end(); it++, i++) {
320  // get jetTracks object
321  reco::JetTracksAssociationRef jetTracks(jetTracksAssociation, i);
322 
323  double pvZ = pv.z();
324  GlobalVector direction(jetTracks->first->px(), jetTracks->first->py(), jetTracks->first->pz());
325 
326  // get the tracks associated to the jet
328  for (std::size_t index = 0; index < tracks.size(); index++) {
330 
331  double pt = tracks[index]->pt();
332  double chi2 = tracks[index]->normalizedChi2();
333  int hits = tracks[index]->hitPattern().numberOfValidHits();
334  int pixelHits = tracks[index]->hitPattern().numberOfValidPixelHits();
335 
338  continue;
339 
340  const reco::TransientTrack transientTrack = bproduct->build(&(*tracks[index]));
341  double dta = -IPTools::jetTrackDistance(transientTrack, direction, pv).second.value();
342  double sdl = IPTools::signedDecayLength3D(transientTrack, direction, pv).second.value();
343  double ips = IPTools::signedImpactParameter3D(transientTrack, direction, pv).second.value();
344  double d0 = IPTools::signedTransverseImpactParameter(transientTrack, direction, pv).second.value();
345  double dz = tracks[index]->dz() - pvZ;
346 
347  // Classify the reco track;
349 
350  // Check for the different categories
352  histogram_data_[5].push_back(histogram_element_t(sdl, dta, d0, dz, ips, pt, chi2, hits, pixelHits));
354  histogram_data_[0].push_back(histogram_element_t(sdl, dta, d0, dz, ips, pt, chi2, hits, pixelHits));
356  histogram_data_[4].push_back(histogram_element_t(sdl, dta, d0, dz, ips, pt, chi2, hits, pixelHits));
358  histogram_data_[3].push_back(histogram_element_t(sdl, dta, d0, dz, ips, pt, chi2, hits, pixelHits));
360  histogram_data_[1].push_back(histogram_element_t(sdl, dta, d0, dz, ips, pt, chi2, hits, pixelHits));
361  else
362  histogram_data_[2].push_back(histogram_element_t(sdl, dta, d0, dz, ips, pt, chi2, hits, pixelHits));
363  }
364  }
365 }
transient_vector_type::const_iterator const_iterator
reco::TrackBase::TrackQuality trackQuality_
std::pair< bool, Measurement1D > signedTransverseImpactParameter(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:57
T const * product() const
Definition: Handle.h:70
std::pair< bool, Measurement1D > signedDecayLength3D(const TrajectoryStateOnSurface &state, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:105
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
std::pair< bool, Measurement1D > signedImpactParameter3D(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:81
const_iterator begin() const
TrackClassifier classifier_
std::pair< double, Measurement1D > jetTrackDistance(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:206
reco::TransientTrack build(const reco::Track *p) const
string quality
T const * product() const
Definition: ESHandle.h:86
bool is(Category category) const
Returns track flag for a given category.
def pv(vc)
Definition: MetAnalyzer.py:7
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
const_iterator end() const
static constexpr float d0
TrackClassifier const & evaluate(reco::TrackBaseRef const &)
Classify the RecoTrack in categories.
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
histogram_data_t histogram_data_

Member Data Documentation

◆ classifier_

TrackClassifier QualityCutsAnalyzer::classifier_
private

Definition at line 198 of file QualityCutsAnalyzer.cc.

Referenced by analyze(), and LoopOverJetTracksAssociation().

◆ histogram_data_

histogram_data_t QualityCutsAnalyzer::histogram_data_
private

Definition at line 107 of file QualityCutsAnalyzer.cc.

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

◆ jtaToken_

const edm::EDGetTokenT<reco::JetTracksAssociationCollection> QualityCutsAnalyzer::jtaToken_
private

Definition at line 50 of file QualityCutsAnalyzer.cc.

Referenced by analyze().

◆ maximumChiSquared_

double QualityCutsAnalyzer::maximumChiSquared_
private

Definition at line 58 of file QualityCutsAnalyzer.cc.

Referenced by LoopOverJetTracksAssociation(), and QualityCutsAnalyzer().

◆ minimumNumberOfHits_

int QualityCutsAnalyzer::minimumNumberOfHits_
private

Definition at line 57 of file QualityCutsAnalyzer.cc.

Referenced by LoopOverJetTracksAssociation(), and QualityCutsAnalyzer().

◆ minimumNumberOfPixelHits_

int QualityCutsAnalyzer::minimumNumberOfPixelHits_
private

Definition at line 57 of file QualityCutsAnalyzer.cc.

Referenced by LoopOverJetTracksAssociation(), and QualityCutsAnalyzer().

◆ minimumTransverseMomentum_

double QualityCutsAnalyzer::minimumTransverseMomentum_
private

Definition at line 58 of file QualityCutsAnalyzer.cc.

Referenced by LoopOverJetTracksAssociation(), and QualityCutsAnalyzer().

◆ rootFile_

std::string QualityCutsAnalyzer::rootFile_
private

Definition at line 55 of file QualityCutsAnalyzer.cc.

Referenced by endJob(), and QualityCutsAnalyzer().

◆ trackQuality_

reco::TrackBase::TrackQuality QualityCutsAnalyzer::trackQuality_
private

Definition at line 61 of file QualityCutsAnalyzer.cc.

Referenced by LoopOverJetTracksAssociation(), and QualityCutsAnalyzer().

◆ trkToken_

const edm::EDGetTokenT<edm::View<reco::Track> > QualityCutsAnalyzer::trkToken_
private

Definition at line 48 of file QualityCutsAnalyzer.cc.

Referenced by analyze().

◆ ttrkToken_

const edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> QualityCutsAnalyzer::ttrkToken_
private

Definition at line 47 of file QualityCutsAnalyzer.cc.

Referenced by analyze().

◆ useAllQualities_

bool QualityCutsAnalyzer::useAllQualities_
private

Definition at line 60 of file QualityCutsAnalyzer.cc.

Referenced by LoopOverJetTracksAssociation(), and QualityCutsAnalyzer().

◆ vtxToken_

const edm::EDGetTokenT<reco::VertexCollection> QualityCutsAnalyzer::vtxToken_
private

Definition at line 49 of file QualityCutsAnalyzer.cc.

Referenced by analyze().