2 #include "TGraphErrors.h" 4 #include "TMinuitMinimizer.h" 20 TMinuitMinimizer::UseStaticMinuit(
false);
48 for (
const auto&
id :
detIds(0)) {
69 if (
h.trackId() != track_id)
71 int pdgid =
h.particleType();
87 std::set<unsigned int>
result;
89 const auto&
id =
p.first;
101 std::set<unsigned int>
result;
103 const auto&
id =
p.first;
115 set<int> layers_with_hits;
118 layers_with_hits.insert(idd.layer());
120 return layers_with_hits.size();
132 if (st == 1 and ri == 4) {
136 if (nl1a + nl1b < nlayers)
141 else if (st == 1 and ri == 1) {
145 if (nl1a + nl1b < nlayers)
168 float phi_layer1 = -10;
169 float phi_layer6 = 10;
179 if (!hits1a.empty() and !hits1b.empty())
180 phi_layer1 = (gp1a.phi() + gp1b.
phi()) / 2.0;
181 else if (!hits1a.empty())
182 phi_layer1 = gp1a.phi();
183 else if (!hits1b.empty())
184 phi_layer1 = gp1b.
phi();
193 if (!hits6a.empty() and !hits6b.empty())
194 phi_layer6 = (gp6a.phi() + gp6b.
phi()) / 2.0;
195 else if (!hits6a.empty())
196 phi_layer6 = gp6a.phi();
197 else if (!hits6b.empty())
198 phi_layer6 = gp6b.
phi();
204 phi_layer1 = gp1.phi();
209 phi_layer6 = gp6.phi();
211 return deltaPhi(phi_layer6, phi_layer1);
220 if (sim_hits.empty())
228 const float HALF_STRIP_ERROR = 0.288675;
230 for (
const auto&
h : sim_hits) {
232 const auto&
d =
h.detUnitId();
237 xe.push_back(
float(0));
238 ye.push_back(2 * HALF_STRIP_ERROR);
243 std::unique_ptr<TGraphErrors> gr(
new TGraphErrors(
x.size(), &
x[0], &
y[0], &xe[0], &ye[0]));
244 TF1
fit(
"fit",
"pol1", -3, 4);
245 gr->Fit(&
fit,
"EMQN");
247 intercept =
fit.GetParameter(0);
252 if (sim_hits.empty())
257 for (
const auto&
h : sim_hits) {
260 const auto&
d =
h.detUnitId();
273 if (sim_hits.empty())
278 for (
const auto&
h : sim_hits) {
281 const auto&
d =
h.detUnitId();
284 int nearestWire(layerG->nearestWire(lp));
286 s = layerG->wireGroup(nearestWire);
303 int smin = central_strip - margin_n_strips;
304 smin = (smin > 0) ? smin : 1;
305 int smax = central_strip + margin_n_strips;
306 smax = (smax <= max_nstrips) ? smax : max_nstrips;
307 for (
int ss = smin;
ss <= smax; ++
ss)
321 int central_wg = layer_geo->wireGroup(layer_geo->nearestWire(lp));
322 int wg_min = central_wg - margin_n_wg;
323 wg_min = (wg_min > 0) ? wg_min : 1;
324 int wg_max = central_wg + margin_n_wg;
325 wg_max = (wg_max <= max_n_wg) ? wg_max : max_n_wg;
326 for (
int wg = wg_min; wg <= wg_max; ++wg)
335 for (
const auto&
id : chamber_ids) {
343 for (
const auto&
p :
set) {
360 result.insert(p4.begin(), p4.end());
const edm::PSimHitContainer & hitsInChamber(unsigned int) const
static int toCSCType(int st, int ri)
T getParameter(std::string const &) const
const TrackingGeometry * geometry_
edm::PSimHitContainer hits_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void match(const SimTrack &t, const SimVertex &v)
do the matching
std::map< unsigned int, edm::PSimHitContainer > detid_to_hits_
GlobalPoint simHitsMeanPosition(const edm::PSimHitContainer &sim_hits) const
int nCoincidenceChambers(int min_n_layers=4) const
Geom::Phi< T > phi() const
static const double slope[3]
void matchSimHitsToSimTrack()
float simHitsMeanWG(const edm::PSimHitContainer &sim_hits) const
int nStations(int nl=4) const
ParameterSet const & getParameterSet(std::string const &) const
std::set< unsigned int > chamberIdsStation(int station) const
CSCSimHitMatcher(const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geomToken_
bool hitStation(int, int) const
std::vector< unsigned > track_ids_
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
initialize the event
int nLayersWithHitsInChamber(unsigned int) const
edm::PSimHitContainer simHits_
void chamberIdsToString(const std::set< unsigned int > &set) const
edm::ParameterSet simHitPSet_
std::set< unsigned int > chamberIds(int type=MuonHitHelper::CSC_ALL) const
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
std::map< unsigned int, edm::PSimHitContainer > chamber_to_hits_
Abs< T >::type abs(const T &t)
float simHitsMeanStrip(const edm::PSimHitContainer &sim_hits) const
float LocalBendingInChamber(unsigned int detid) const
std::set< int > hitWiregroupsInDetId(unsigned int, int margin_n_wg=0) const
Log< level::Info, false > LogInfo
constexpr uint32_t rawId() const
get the raw id
std::set< int > hitStripsInDetId(unsigned int, int margin_n_strips=0) const
void match(const SimTrack &t, const SimVertex &v)
do the matching
edm::EDGetTokenT< edm::PSimHitContainer > simHitInput_
std::set< unsigned int > detIds(int type=MuonHitHelper::CSC_ALL) const
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers.hcal.doNoise = False simEcalUnsuppressedDigis.doNoise = False mix.digitizers.ecal.doNoise = False simEcalUnsuppressedDigis.doESNoise = False simSiPixelDigis.AddNoise = False mix.digitizers.pixel.AddNoise = False simSiStripDigis.Noise = False mix.digitizers.strip.AddNoise = False
std::vector< PSimHit > PSimHitContainer
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
initialize the event
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const TrackingGeometry * geometry()
void fitHitsInChamber(unsigned int detid, float &mean, float &slope) const