Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimTrack to muon SimHit matching classes in Muon Validation code #26249

Merged
merged 12 commits into from Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion Validation/MuonHits/BuildFile.xml
Expand Up @@ -10,7 +10,12 @@
<use name="Geometry/CSCGeometry"/>
<use name="Geometry/DTGeometry"/>
<use name="Geometry/RPCGeometry"/>
<use name="Geometry/GEMGeometry"/>
<use name="Geometry/Records"/>
<use name="SimDataFormats/TrackingHit"/>
<use name="SimDataFormats/Vertex"/>
<use name="root"/>
<use name="clhep"/>
<flags EDM_PLUGIN="1"/>
<export>
<lib name="1"/>
</export>
79 changes: 79 additions & 0 deletions Validation/MuonHits/interface/CSCSimHitMatcher.h
@@ -0,0 +1,79 @@
#ifndef Validation_MuonHits_CSCSimHitMatcher_h
#define Validation_MuonHits_CSCSimHitMatcher_h

/**\class CSCSimHitMatcher

Description: Matching of CSC SimHit to SimTrack

Author: Sven Dildick (TAMU), Tao Huang (TAMU)
*/

#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Validation/MuonHits/interface/MuonSimHitMatcher.h"

class CSCSimHitMatcher : public MuonSimHitMatcher {
public:
// constructor
CSCSimHitMatcher(const edm::ParameterSet& iPS, edm::ConsumesCollector&& iC);

// destructor
~CSCSimHitMatcher() {}

// initialize the event
void init(const edm::Event& e, const edm::EventSetup& eventSetup);

// do the matching
void match(const SimTrack& t, const SimVertex& v);

// partitions' detIds with SimHits
std::set<unsigned int> detIds(int type = MuonHitHelper::CSC_ALL) const;

// chamber detIds with SimHits
std::set<unsigned int> chamberIds(int type = MuonHitHelper::CSC_ALL) const;

// CSC station detIds with SimHits
std::set<unsigned int> chamberIdsStation(int station) const;

// was there a hit in a particular CSC station?
bool hitStation(int, int) const;

// number of stations with hits in at least X layers
int nStations(int nl = 4) const;

// #layers with hits
int nLayersWithHitsInChamber(unsigned int) const;

// How many CSC chambers with minimum number of layer with simhits did this
// simtrack get?
int nCoincidenceChambers(int min_n_layers = 4) const;

// calculated the fitted position in a given layer for CSC simhits in a
// chamber
GlobalPoint simHitPositionKeyLayer(unsigned int chamberid) const;

// local bending in a CSC chamber
float LocalBendingInChamber(unsigned int detid) const;

// calculate average strip number for a provided collection of simhits
float simHitsMeanStrip(const edm::PSimHitContainer& sim_hits) const;

// calculate average wg number for a provided collection of simhits (for CSC)
float simHitsMeanWG(const edm::PSimHitContainer& sim_hits) const;

void chamberIdsToString(const std::set<unsigned int>& set) const;

// calculate the average position at the second station
GlobalPoint simHitsMeanPositionStation(int n) const;

std::set<int> hitStripsInDetId(unsigned int, int margin_n_strips = 0) const;
std::set<int> hitWiregroupsInDetId(unsigned int, int margin_n_wg = 0) const;

void camberIdsToString(const std::set<unsigned int>&) const;

private:
void matchSimHitsToSimTrack();

edm::ESHandle<CSCGeometry> csc_geom_;
};

#endif
82 changes: 82 additions & 0 deletions Validation/MuonHits/interface/DTSimHitMatcher.h
@@ -0,0 +1,82 @@
#ifndef Validation_MuonHits_DTSimHitMatcher_h
#define Validation_MuonHits_DTSimHitMatcher_h

/**\class DTSimHitMatcher

Description: Matching of DT SimHit to SimTrack

Author: Sven Dildick (TAMU), Tao Huang (TAMU)
*/

#include "Geometry/DTGeometry/interface/DTGeometry.h"
#include "Validation/MuonHits/interface/MuonSimHitMatcher.h"

class DTSimHitMatcher : public MuonSimHitMatcher {
public:
// constructor
DTSimHitMatcher(const edm::ParameterSet& iPS, edm::ConsumesCollector&& iC);

// destructor
~DTSimHitMatcher() {}

// initialize the event
void init(const edm::Event& e, const edm::EventSetup& eventSetup);

// do the matching
void match(const SimTrack& t, const SimVertex& v);

// partitions' detIds with SimHits
std::set<unsigned int> detIds(int type = MuonHitHelper::DT_ALL) const;

// chamber detIds with SimHits
std::set<unsigned int> chamberIds(int type = MuonHitHelper::DT_ALL) const;

// DT station detIds with SimHits
std::set<unsigned int> chamberIdsStation(int station) const;

// DT layer detIds with SimHits
std::set<unsigned int> layerIds() const;

// DT super layer detIds with SimHits
std::set<unsigned int> superlayerIds() const;

// was there a hit in a particular DT/CSC station?
bool hitStation(int, int, int) const;

// number of stations with hits in at least X layers
int nStations(int nsl = 1, int nl = 3) const;

// access to DT hits
int nCellsWithHitsInLayer(unsigned int) const;
int nLayersWithHitsInSuperLayer(unsigned int) const;
int nSuperLayersWithHitsInChamber(unsigned int) const;
int nLayersWithHitsInChamber(unsigned int) const;
const edm::PSimHitContainer& hitsInLayer(unsigned int) const;
const edm::PSimHitContainer& hitsInSuperLayer(unsigned int) const;
const edm::PSimHitContainer& hitsInChamber(unsigned int) const;

// calculate average wg number for a provided collection of simhits
float simHitsMeanWire(const edm::PSimHitContainer& sim_hits) const;

// calculate the average position at the second station
GlobalPoint simHitsMeanPositionStation(int n) const;

std::set<unsigned int> hitWiresInDTLayerId(
unsigned int, int margin_n_wires = 0) const; // DT
std::set<unsigned int> hitWiresInDTSuperLayerId(
unsigned int, int margin_n_wires = 0) const; // DT
std::set<unsigned int> hitWiresInDTChamberId(
unsigned int, int margin_n_wires = 0) const; // DT

void dtChamberIdsToString(const std::set<unsigned int>&) const;

private:
void matchSimHitsToSimTrack();

std::map<unsigned int, edm::PSimHitContainer> layer_to_hits_;
std::map<unsigned int, edm::PSimHitContainer> superlayer_to_hits_;

edm::ESHandle<DTGeometry> dt_geom_;
};

#endif
90 changes: 90 additions & 0 deletions Validation/MuonHits/interface/GEMSimHitMatcher.h
@@ -0,0 +1,90 @@
#ifndef Validation_MuonHits_GEMSimHitMatcher_h
#define Validation_MuonHits_GEMSimHitMatcher_h

/**\class GEMSimHitMatcher

Description: Matching of GEM SimHit to SimTrack

Author: Sven Dildick (TAMU), Tao Huang (TAMU)
*/

#include "Geometry/GEMGeometry/interface/GEMGeometry.h"
#include "Validation/MuonHits/interface/MuonSimHitMatcher.h"

class GEMSimHitMatcher : public MuonSimHitMatcher {
public:
// constructor
GEMSimHitMatcher(const edm::ParameterSet& iPS, edm::ConsumesCollector&& iC);

// destructor
~GEMSimHitMatcher() {}

// initialize the event
void init(const edm::Event& e, const edm::EventSetup& eventSetup);

// do the matching
void match(const SimTrack& t, const SimVertex& v);

// partitions' detIds with SimHits
std::set<unsigned int> detIds(int gem_type = MuonHitHelper::GEM_ALL) const;

// chamber detIds with SimHits
std::set<unsigned int> chamberIds(
int gem_type = MuonHitHelper::GEM_ALL) const;

// GEM detid's with hits in 2 layers of coincidence pads
// those are layer==1 only detid's
std::set<unsigned int> detIdsCoincidences() const;

// GEM superchamber detIds with SimHits
std::set<unsigned int> superChamberIds() const;

// GEM superchamber detIds with SimHits 2 layers of coincidence pads
std::set<unsigned int> superChamberIdsCoincidences() const;

// simhits from a particular superchamber
const edm::PSimHitContainer& hitsInSuperChamber(unsigned int) const;

// was there a hit in a particular station?
bool hitStation(int, int) const;

// number of stations with hits in at least X layers
int nStations(int nl = 2) const;

// #layers with hits
int nLayersWithHitsInSuperChamber(unsigned int) const;

// How many pads with simhits in GEM did this simtrack get?
int nPadsWithHits() const;

// How many coincidence pads with simhits in GEM did this simtrack get?
int nCoincidencePadsWithHits() const;

// transverse position in GEM
float simHitsGEMCentralPosition(const edm::PSimHitContainer& sim_hits) const;

// calculate average strip number for a provided collection of simhits
float simHitsMeanStrip(const edm::PSimHitContainer& sim_hits) const;

std::set<int> hitStripsInDetId(unsigned int, int margin_n_strips = 0) const;
std::set<int> hitPadsInDetId(unsigned int) const;
std::set<int> hitCoPadsInDetId(unsigned int) const;

// what unique partitions numbers were hit by this simtrack?
std::set<int> hitPartitions() const;

private:
void matchSimHitsToSimTrack();

edm::ESHandle<GEMGeometry> gem_geom_;

std::map<unsigned int, edm::PSimHitContainer> superchamber_to_hits_;

// detids with hits in pads
std::map<unsigned int, std::set<int> > detids_to_pads_;

// detids with hits in 2-layer pad coincidences
std::map<unsigned int, std::set<int> > detids_to_copads_;
};

#endif
77 changes: 77 additions & 0 deletions Validation/MuonHits/interface/ME0SimHitMatcher.h
@@ -0,0 +1,77 @@
#ifndef Validation_MuonHits_ME0SimHitMatcher_h
#define Validation_MuonHits_ME0SimHitMatcher_h

/**\class ME0SimHitMatcher

Description: Matching of ME0 SimHit to SimTrack

Author: Sven Dildick (TAMU), Tao Huang (TAMU)
*/

#include "Geometry/GEMGeometry/interface/ME0Geometry.h"
#include "Validation/MuonHits/interface/MuonSimHitMatcher.h"

class ME0SimHitMatcher : public MuonSimHitMatcher {
public:
// constructor
ME0SimHitMatcher(const edm::ParameterSet& iPS, edm::ConsumesCollector&& iC);

// destructor
~ME0SimHitMatcher() {}

// initialize the event
void init(const edm::Event& e, const edm::EventSetup& eventSetup);

// do the matching
void match(const SimTrack& t, const SimVertex& v);

// partitions' detIds with SimHits
std::set<unsigned int> detIds() const;

// chamber detIds with SimHits
std::set<unsigned int> chamberIds() const;

// ME0 superchamber detIds with SimHits
std::set<unsigned int> superChamberIds() const;

// simhits from a particular partition, chamber
const edm::PSimHitContainer& hitsInSuperChamber(unsigned int) const;

// #layers with hits
int nLayersWithHitsInSuperChamber(unsigned int) const;

// ME0 superchamber detIds with SimHits >=4 layers of coincidence pads
std::set<unsigned int> superChamberIdsCoincidences(
int min_n_layers = 4) const;

// How many ME0 chambers with minimum number of layer with simhits did this
// simtrack get?
int nCoincidenceChambers(int min_n_layers = 4) const;

// calculate average strip for a provided collection of simhits
float simHitsMeanStrip(const edm::PSimHitContainer& sim_hits) const;

std::set<int> hitStripsInDetId(unsigned int, int margin_n_strips = 0) const;
std::set<int> hitPadsInDetId(unsigned int) const;

// what unique partitions numbers were hit by this simtrack?
std::set<int> hitPartitions() const;

// How many pads with simhits in ME0 did this simtrack get?
int nPadsWithHits() const;

private:
void matchSimHitsToSimTrack();

edm::ESHandle<ME0Geometry> me0_geom_;

// detids with hits in pads
std::map<unsigned int, std::set<int> > detids_to_pads_;

// detids with hits in 2-layer pad coincidences
std::map<unsigned int, std::set<int> > detids_to_copads_;

std::map<unsigned int, edm::PSimHitContainer> superChamber_to_hits_;
};

#endif