13 : debug_(
pset.getUntrackedParameter<
bool>(
"debug")),
14 minx_match_2digis_(
pset.getParameter<double>(
"minx_match_2digis")) {
16 LogDebug(
"MuonPathConfirmator") <<
"MuonPathConfirmator: constructor";
27 while (ifin3.good()) {
32 int wh, st, se, maxdrift;
39 while (ifind.good()) {
40 ifind >> wh >> st >> se >> maxdrift;
47 LogDebug(
"MuonPathConfirmator") <<
"MuonPathAnalyzer: destructor";
56 std::vector<cmsdt::metaPrimitive> inMetaPrimitives,
58 std::vector<cmsdt::metaPrimitive> &outMetaPrimitives) {
60 LogDebug(
"MuonPathConfirmator") <<
"MuonPathConfirmator: run";
63 if (!inMetaPrimitives.empty()) {
64 int dum_sl_rawid = inMetaPrimitives[0].rawId;
70 for (
auto &mp : inMetaPrimitives) {
71 analyze(mp, dtdigis, outMetaPrimitives);
77 LogDebug(
"MuonPathConfirmator") <<
"MuonPathConfirmator::initialiase";
82 LogDebug(
"MuonPathConfirmator") <<
"MuonPathConfirmator: finish";
91 std::vector<cmsdt::metaPrimitive> &outMetaPrimitives) {
92 int dum_sl_rawid = mp.
rawId;
101 bool isSL1 = (mp.
rawId == sl1Id.rawId());
102 bool isSL3 = (mp.
rawId == sl3Id.rawId());
103 if (!isSL1 && !isSL3)
104 outMetaPrimitives.emplace_back(mp);
115 int matched_digis = 0;
124 for (
const auto &dtLayerId_It : *dtdigis) {
125 const DTLayerId dtLId = dtLayerId_It.first;
128 bool hitFromSL1 = (dtSLId.rawId() == sl1Id.rawId());
129 bool hitFromSL3 = (dtSLId.rawId() == sl3Id.rawId());
130 if (!(hitFromSL1 || hitFromSL3))
134 if (isSL1 != hitFromSL1) {
135 for (
auto digiIt = (dtLayerId_It.second).first; digiIt != (dtLayerId_It.second).
second; ++digiIt) {
136 if ((*digiIt).time() < mp.
t0)
139 int ly = dtLId.
layer() - 1;
153 int position_in_layer = position_prec + (1 - 2 * (
int)hitFromSL1) * slope_x_halfchamb;
155 position_in_layer -= slope_x_3semicells;
157 position_in_layer -= slope_x_1semicell;
159 position_in_layer += slope_x_1semicell;
161 position_in_layer += slope_x_3semicells;
164 if (
std::abs(position_in_layer - hit_position_left) <
std::abs(position_in_layer - hit_position)) {
166 hit_position = hit_position_left;
168 if (
std::abs(position_in_layer - hit_position) < minx) {
173 if (dtLId.
layer() != best_layer) {
174 minx =
std::abs(position_in_layer - hit_position);
175 next_wire = best_wire;
177 next_layer = best_layer;
181 best_wire = (*digiIt).wire() - 1;
182 best_tdc = (*digiIt).time();
183 best_layer = dtLId.
layer();
186 }
else if ((
std::abs(position_in_layer - hit_position) >= minx) &&
187 (
std::abs(position_in_layer - hit_position) < min2x)) {
189 if (dtLId.
layer() == best_layer)
198 min2x =
std::abs(position_in_layer - hit_position);
199 next_wire = (*digiIt).wire() - 1;
200 next_tdc = (*digiIt).time();
201 next_layer = dtLId.
layer();
208 std::vector<int> wi_c(4, -1), tdc_c(4, -1), lat_c(4, -1);
209 if (matched_digis >= 2 and best_layer != -1 and next_layer != -1) {
214 wi_c[next_layer - 1] = next_wire;
215 tdc_c[next_layer - 1] = next_tdc;
216 lat_c[next_layer - 1] = next_lat;
218 wi_c[best_layer - 1] = best_wire;
219 tdc_c[best_layer - 1] = best_tdc;
220 lat_c[best_layer - 1] = best_lat;
224 {mp.
rawId, mp.
t0, mp.
x, mp.
tanPhi, mp.
phi, mp.
phiB, mp.
phi_cmssw, mp.
phiB_cmssw, mp.
chi2, new_quality,
225 mp.
wi1, mp.
tdc1, mp.
lat1, mp.
wi2, mp.
tdc2, mp.
lat2, mp.
wi3, mp.
tdc3, mp.
lat3, mp.
wi4,
226 mp.
tdc4, mp.
lat4, wi_c[0], tdc_c[0], lat_c[0], wi_c[1], tdc_c[1], lat_c[1], wi_c[2], tdc_c[2],
227 lat_c[2], wi_c[3], tdc_c[3], lat_c[3], -1}));
229 outMetaPrimitives.emplace_back(
231 mp.
phiB_cmssw, mp.
chi2, new_quality, wi_c[0], tdc_c[0], lat_c[0], wi_c[1],
232 tdc_c[1], lat_c[1], wi_c[2], tdc_c[2], lat_c[2], wi_c[3], tdc_c[3],
int station() const
Return the station number.
edm::FileInPath maxdrift_filename_
void initialise(const edm::EventSetup &iEventSetup)
int superLayer() const
Return the superlayer number.
double minx_match_2digis_
void run(edm::Event &iEvent, const edm::EventSetup &iEventSetup, std::vector< cmsdt::metaPrimitive > inMetaPrimitives, edm::Handle< DTDigiCollection > dtdigis, std::vector< cmsdt::metaPrimitive > &outMetaPrimitives)
std::string fullPath() const
edm::FileInPath shift_filename_
void analyze(cmsdt::metaPrimitive mp, edm::Handle< DTDigiCollection > dtdigis, std::vector< cmsdt::metaPrimitive > &outMetaPrimitives)
constexpr int CELL_SEMILENGTH
U second(std::pair< T, U > const &p)
int maxdriftinfo_[5][4][14]
constexpr int SL1_CELLS_OFFSET
MuonPathConfirmator(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
Abs< T >::type abs(const T &t)
std::map< int, float > shiftinfo_
constexpr int TIME_TO_TDC_COUNTS
constexpr uint32_t rawId() const
get the raw id
constexpr int LHC_CLK_FREQ
int layer() const
Return the layer number.
int wheel() const
Return the wheel number.
static unsigned int const shift