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);
248 slope = fit.GetParameter(1);
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);
300 for (
const auto&
h : simhits) {
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)
318 for (
const auto&
h : simhits) {
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) {
345 edm::LogInfo(
"CSCSimHitMatcher") <<
" " << detId <<
"\n";
357 result.insert(
p1.begin(),
p1.end());
358 result.insert(
p2.begin(),
p2.end());
359 result.insert(p3.begin(), p3.end());
360 result.insert(p4.begin(), p4.end());
366 result.insert(
p1.begin(),
p1.end());
367 result.insert(
p2.begin(),
p2.end());
373 result.insert(
p1.begin(),
p1.end());
374 result.insert(
p2.begin(),
p2.end());
380 result.insert(
p1.begin(),
p1.end());
381 result.insert(
p2.begin(),
p2.end());
static int toCSCType(int st, int ri)
const TrackingGeometry * geometry_
edm::PSimHitContainer hits_
void match(const SimTrack &t, const SimVertex &v)
do the matching
uint16_t *__restrict__ id
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::map< unsigned int, edm::PSimHitContainer > detid_to_hits_
std::set< unsigned int > detIds(int type=MuonHitHelper::CSC_ALL) const
static const double slope[3]
void matchSimHitsToSimTrack()
Geom::Phi< T > phi() const
constexpr uint32_t rawId() const
get the raw id
float LocalBendingInChamber(unsigned int detid) const
float simHitsMeanStrip(const edm::PSimHitContainer &sim_hits) const
CSCSimHitMatcher(const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geomToken_
int nStations(int nl=4) const
std::vector< unsigned > track_ids_
constexpr std::array< uint8_t, layerIndexSize > layer
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
initialize the event
bool getData(T &iHolder) const
std::set< int > hitWiregroupsInDetId(unsigned int, int margin_n_wg=0) const
GlobalPoint simHitsMeanPosition(const edm::PSimHitContainer &sim_hits) const
std::set< int > hitStripsInDetId(unsigned int, int margin_n_strips=0) const
edm::PSimHitContainer simHits_
edm::ParameterSet simHitPSet_
float simHitsMeanWG(const edm::PSimHitContainer &sim_hits) const
tuple 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
int nCoincidenceChambers(int min_n_layers=4) const
std::map< unsigned int, edm::PSimHitContainer > chamber_to_hits_
Abs< T >::type abs(const T &t)
std::set< unsigned int > chamberIds(int type=MuonHitHelper::CSC_ALL) const
Log< level::Info, false > LogInfo
ParameterSet const & getParameterSet(std::string const &) const
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
int nLayersWithHitsInChamber(unsigned int) const
T getParameter(std::string const &) const
void match(const SimTrack &t, const SimVertex &v)
do the matching
edm::EDGetTokenT< edm::PSimHitContainer > simHitInput_
void chamberIdsToString(const std::set< unsigned int > &set) const
const math::XYZTLorentzVectorD & momentum() const
void fitHitsInChamber(unsigned int detid, float &mean, float &slope) const
std::vector< PSimHit > PSimHitContainer
std::set< unsigned int > chamberIdsStation(int station) const
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
initialize the event
bool hitStation(int, int) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const edm::PSimHitContainer & hitsInChamber(unsigned int) const
const TrackingGeometry * geometry()