CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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)
 

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::JetTracksAssociationCollection
jtaToken_
 
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,
TransientTrackRecord
ttrkToken_
 
bool useAllQualities_
 
const edm::EDGetTokenT
< reco::VertexCollection
vtxToken_
 

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 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

Definition at line 36 of file QualityCutsAnalyzer.cc.

Member Typedef Documentation

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

Definition at line 106 of file QualityCutsAnalyzer.cc.

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

Definition at line 52 of file QualityCutsAnalyzer.cc.

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

Definition at line 53 of file QualityCutsAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 204 of file QualityCutsAnalyzer.cc.

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

205  : ttrkToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))),
207  vtxToken_(consumes<reco::VertexCollection>(config.getUntrackedParameter<edm::InputTag>("primaryVertexProducer"))),
208  jtaToken_(consumes<reco::JetTracksAssociationCollection>(
209  config.getUntrackedParameter<edm::InputTag>("jetTracksAssociation"))),
210  classifier_(config, consumesCollector()) {
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 }
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > jtaToken_
reco::TrackBase::TrackQuality trackQuality_
TrackClassifier classifier_
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_
tuple cout
Definition: gather_cfg.py:144
unsigned transform(const HcalDetId &id, unsigned transformCode)
QualityCutsAnalyzer::~QualityCutsAnalyzer ( )
overridedefault

Member Function Documentation

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_, edm::EventSetup::getHandle(), HLT_FULL_cff::jetTracks, jtaToken_, LoopOverJetTracksAssociation(), TrackClassifier::newEvent(), HLT_FULL_cff::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
247 
248  // Setting up event information for the track categories.
249  classifier_.newEvent(event, setup);
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)
tuple trackCollection
const edm::EDGetTokenT< reco::VertexCollection > vtxToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
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_
void QualityCutsAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 260 of file QualityCutsAnalyzer.cc.

References mergeVDriftHistosByStation::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_
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, TransientTrackBuilder::build(), TrackCategories::BWeakDecay, HLT_FULL_cff::chi2, classifier_, TrackCategories::CWeakDecay, d0, PVValHelper::dz, alignCSCRings::e, TrackClassifier::evaluate(), TrackCategories::Fake, histogram_data_, mps_fire::i, TrackCategories::is(), IPTools::jetTrackDistance(), HLT_FULL_cff::jetTracks, maximumChiSquared_, minimumNumberOfHits_, minimumNumberOfPixelHits_, minimumTransverseMomentum_, AlCaHLTBitMon_ParallelJobs::p, TrackCategories::PrimaryVertex, edm::Handle< T >::product(), edm::ESHandle< class >::product(), DiDispStaMuonMonitor_cfi::pt, push_back(), MetAnalyzer::pv(), quality, IPTools::signedDecayLength3D(), IPTools::signedImpactParameter3D(), IPTools::signedTransverseImpactParameter(), PrimaryVertexSorter< ParticlesCollection >::sortedList(), HLT_FULL_cff::track, trackQuality_, tracks, useAllQualities_, and reco::Vertex::z().

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_
uint32_t const *__restrict__ Quality * quality
std::pair< bool, Measurement1D > signedTransverseImpactParameter(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:57
std::pair< bool, Measurement1D > signedDecayLength3D(const TrajectoryStateOnSurface &state, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:105
reco::TransientTrack build(const reco::Track *p) const
std::vector< reco::Vertex > sortedList(const reco::VertexCollection &primaryVertex) const
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
auto const & tracks
cannot be loose
TrackClassifier classifier_
std::pair< double, Measurement1D > jetTrackDistance(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:206
TrackClassifier const & evaluate(reco::TrackBaseRef const &)
Classify the RecoTrack in categories.
double z() const
z coordinate
Definition: Vertex.h:133
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
bool is(Category category) const
Returns track flag for a given category.
static constexpr float d0
T const * product() const
Definition: Handle.h:70
T const * product() const
Definition: ESHandle.h:86
deadvectors[0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
histogram_data_t histogram_data_

Member Data Documentation

TrackClassifier QualityCutsAnalyzer::classifier_
private

Definition at line 198 of file QualityCutsAnalyzer.cc.

Referenced by analyze(), and LoopOverJetTracksAssociation().

histogram_data_t QualityCutsAnalyzer::histogram_data_
private

Definition at line 107 of file QualityCutsAnalyzer.cc.

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

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

Definition at line 50 of file QualityCutsAnalyzer.cc.

Referenced by analyze().

double QualityCutsAnalyzer::maximumChiSquared_
private

Definition at line 58 of file QualityCutsAnalyzer.cc.

Referenced by LoopOverJetTracksAssociation(), and QualityCutsAnalyzer().

int QualityCutsAnalyzer::minimumNumberOfHits_
private

Definition at line 57 of file QualityCutsAnalyzer.cc.

Referenced by LoopOverJetTracksAssociation(), and QualityCutsAnalyzer().

int QualityCutsAnalyzer::minimumNumberOfPixelHits_
private

Definition at line 57 of file QualityCutsAnalyzer.cc.

Referenced by LoopOverJetTracksAssociation(), and QualityCutsAnalyzer().

double QualityCutsAnalyzer::minimumTransverseMomentum_
private

Definition at line 58 of file QualityCutsAnalyzer.cc.

Referenced by LoopOverJetTracksAssociation(), and QualityCutsAnalyzer().

std::string QualityCutsAnalyzer::rootFile_
private

Definition at line 55 of file QualityCutsAnalyzer.cc.

Referenced by endJob(), and QualityCutsAnalyzer().

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

Definition at line 61 of file QualityCutsAnalyzer.cc.

Referenced by LoopOverJetTracksAssociation(), and QualityCutsAnalyzer().

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

Definition at line 48 of file QualityCutsAnalyzer.cc.

Referenced by analyze().

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

Definition at line 47 of file QualityCutsAnalyzer.cc.

Referenced by analyze().

bool QualityCutsAnalyzer::useAllQualities_
private

Definition at line 60 of file QualityCutsAnalyzer.cc.

Referenced by LoopOverJetTracksAssociation(), and QualityCutsAnalyzer().

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

Definition at line 49 of file QualityCutsAnalyzer.cc.

Referenced by analyze().