|
|
Go to the documentation of this file.
2 #include "TGraphErrors.h"
43 for (
const auto&
id :
detIds(0)) {
64 if (
h.trackId() != track_id)
66 int pdgid =
h.particleType();
82 std::set<unsigned int>
result;
84 const auto&
id =
p.first;
96 std::set<unsigned int>
result;
98 const auto&
id =
p.first;
110 set<int> layers_with_hits;
113 layers_with_hits.insert(idd.layer());
115 return layers_with_hits.size();
127 if (st == 1 and ri == 4) {
136 else if (st == 1 and ri == 1) {
163 float phi_layer1 = -10;
164 float phi_layer6 = 10;
174 if (!hits1a.empty() and !hits1b.empty())
175 phi_layer1 = (gp1a.phi() + gp1b.
phi()) / 2.0;
176 else if (!hits1a.empty())
177 phi_layer1 = gp1a.phi();
178 else if (!hits1b.empty())
179 phi_layer1 = gp1b.
phi();
188 if (!hits6a.empty() and !hits6b.empty())
189 phi_layer6 = (gp6a.phi() + gp6b.
phi()) / 2.0;
190 else if (!hits6a.empty())
191 phi_layer6 = gp6a.phi();
192 else if (!hits6b.empty())
193 phi_layer6 = gp6b.
phi();
199 phi_layer1 = gp1.phi();
204 phi_layer6 = gp6.phi();
206 return deltaPhi(phi_layer6, phi_layer1);
215 if (sim_hits.empty())
223 const float HALF_STRIP_ERROR = 0.288675;
225 for (
const auto&
h : sim_hits) {
227 const auto&
d =
h.detUnitId();
228 float s = dynamic_cast<const CSCGeometry*>(
geometry_)->layer(
d)->geometry()->strip(lp);
232 xe.push_back(
float(0));
233 ye.push_back(2 * HALF_STRIP_ERROR);
238 std::unique_ptr<TGraphErrors> gr(
new TGraphErrors(
x.size(), &
x[0], &
y[0], &xe[0], &ye[0]));
239 std::unique_ptr<TF1>
fit(
new TF1(
"fit",
"pol1", -3, 4));
240 gr->Fit(
"fit",
"EMQ");
242 intercept =
fit->GetParameter(0);
247 if (sim_hits.empty())
252 for (
const auto&
h : sim_hits) {
255 const auto&
d =
h.detUnitId();
256 s = dynamic_cast<const CSCGeometry*>(
geometry_)->layer(
d)->geometry()->strip(lp);
268 if (sim_hits.empty())
273 for (
const auto&
h : sim_hits) {
276 const auto&
d =
h.detUnitId();
278 const auto& layerG(dynamic_cast<const CSCGeometry*>(
geometry_)->layer(
d)->
geometry());
279 int nearestWire(layerG->nearestWire(lp));
281 s = layerG->wireGroup(nearestWire);
294 int max_nstrips = dynamic_cast<const CSCGeometry*>(
geometry_)->layer(
id)->geometry()->numberOfStrips();
297 int central_strip = dynamic_cast<const CSCGeometry*>(
geometry_)->layer(
id)->geometry()->nearestStrip(lp);
298 int smin = central_strip - margin_n_strips;
299 smin = (smin > 0) ? smin : 1;
300 int smax = central_strip + margin_n_strips;
301 smax = (smax <= max_nstrips) ? smax : max_nstrips;
302 for (
int ss = smin;
ss <= smax; ++
ss)
312 int max_n_wg = dynamic_cast<const CSCGeometry*>(
geometry_)->layer(
id)->geometry()->numberOfWireGroups();
315 const auto& layer_geo = dynamic_cast<const CSCGeometry*>(
geometry_)->layer(
id)->geometry();
316 int central_wg = layer_geo->wireGroup(layer_geo->nearestWire(lp));
317 int wg_min = central_wg - margin_n_wg;
318 wg_min = (wg_min > 0) ? wg_min : 1;
319 int wg_max = central_wg + margin_n_wg;
320 wg_max = (wg_max <= max_n_wg) ? wg_max : max_n_wg;
321 for (
int wg = wg_min; wg <= wg_max; ++wg)
330 for (
const auto&
id : chamber_ids) {
338 for (
const auto&
p : set) {
340 edm::LogInfo(
"CSCSimHitMatcher") <<
" " << detId <<
"\n";
float simHitsMeanStrip(const edm::PSimHitContainer &sim_hits) const
const TrackingGeometry * geometry()
float LocalBendingInChamber(unsigned int detid) const
const TrackingGeometry * geometry_
std::set< int > hitWiregroupsInDetId(unsigned int, int margin_n_wg=0) const
std::map< unsigned int, edm::PSimHitContainer > detid_to_hits_
GlobalPoint simHitsMeanPosition(const edm::PSimHitContainer &sim_hits) const
Log< level::Info, false > LogInfo
std::set< int > hitStripsInDetId(unsigned int, int margin_n_strips=0) const
edm::PSimHitContainer simHits_
std::set< unsigned int > detIds(int type=MuonHitHelper::CSC_ALL) const
edm::ParameterSet simHitPSet_
std::vector< unsigned > track_ids_
void fitHitsInChamber(unsigned int detid, float &mean, float &slope) const
void match(const SimTrack &t, const SimVertex &v)
do the matching
void match(const SimTrack &t, const SimVertex &v)
do the matching
void matchSimHitsToSimTrack()
int nStations(int nl=4) const
std::map< unsigned int, edm::PSimHitContainer > chamber_to_hits_
edm::EDGetTokenT< edm::PSimHitContainer > simHitInput_
int nCoincidenceChambers(int min_n_layers=4) const
bool getData(T &iHolder) const
std::set< unsigned int > chamberIdsStation(int station) const
float simHitsMeanWG(const edm::PSimHitContainer &sim_hits) const
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
constexpr uint32_t rawId() const
get the raw id
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geomToken_
bool hitStation(int, int) const
CSCSimHitMatcher(const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
T getParameter(std::string const &) const
const edm::PSimHitContainer & hitsInChamber(unsigned int) const
Abs< T >::type abs(const T &t)
std::vector< PSimHit > PSimHitContainer
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
initialize the event
static int toCSCType(int st, int ri)
static const double slope[3]
edm::PSimHitContainer hits_
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
initialize the event
std::set< unsigned int > chamberIds(int type=MuonHitHelper::CSC_ALL) const
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers....
Geom::Phi< T > phi() const
ParameterSet const & getParameterSet(std::string const &) const
int nLayersWithHitsInChamber(unsigned int) const
void chamberIdsToString(const std::set< unsigned int > &set) const