16 input_token_(i_consumes_collector.consumes<
GEMTag::collection_type>(
context.config_.gem_input_)) {}
20 static const int max_delta_roll = 1;
21 static const int max_delta_pad_ge11 = 4;
22 static const int max_delta_pad_ge21 = 4;
30 auto chamber = gem_digis->begin();
31 auto chend = gem_digis->end();
34 auto digi = (*chamber).second.first;
35 auto dend = (*chamber).second.second;
37 for (; digi != dend; ++digi) {
39 bool tp_valid = (*digi).isValid();
46 tpc.emplace_back((*chamber).first, *digi);
51 std::map<std::pair<uint32_t, uint16_t>, std::vector<std::array<uint16_t, 3>>> chamber_copads_map;
53 for (
auto& tp_entry : tpc) {
54 const auto& tp_det_id = tp_entry.tp_.detId<
GEMDetId>();
55 const GEMData& tp_data = tp_entry.tp_.getGEMData();
57 const int tp_region = tp_det_id.region();
58 const int tp_station = tp_det_id.station();
59 const int tp_ring = tp_det_id.ring();
60 const int tp_chamber = tp_det_id.chamber();
61 const int tp_layer = tp_det_id.layer();
63 const uint16_t tp_roll = tp_det_id.roll();
64 const uint16_t tp_pad_lo = tp_data.
pad_low;
65 const uint16_t tp_pad_hi = tp_data.pad_hi;
69 GEMDetId tp_mod_det_id(tp_region, tp_ring, tp_station, 0, tp_chamber, 0);
70 auto key = std::make_pair(tp_mod_det_id.
rawId(), tp_bx);
75 decltype(chamber_copads_map)::mapped_type copads;
76 chamber_copads_map.insert({
key, copads});
77 }
else if (tp_layer == 2) {
80 chamber_copads_map[
key].push_back(copad);
85 for (
auto& tp_entry : tpc) {
86 const auto& tp_det_id = tp_entry.tp_.detId<
GEMDetId>();
87 const GEMData& tp_data = tp_entry.tp_.getGEMData();
89 const int tp_region = tp_det_id.region();
90 const int tp_endcap = (tp_region == -1) ? 2 : tp_region;
91 const int tp_endcap_pm = (tp_endcap == 2) ? -1 : tp_endcap;
92 const int tp_station = tp_det_id.station();
93 const int tp_ring = tp_det_id.ring();
94 const int tp_layer = tp_det_id.layer();
95 const int tp_chamber = tp_det_id.chamber();
97 const int tp_roll = tp_det_id.roll();
98 const int tp_pad = (tp_data.pad_low + tp_data.pad_hi) / 2;
99 const int tp_pad_lo = tp_data.
pad_low;
100 const int tp_pad_hi = tp_data.pad_hi;
105 GEMDetId tp_mod_det_id(tp_region, tp_ring, tp_station, 0, tp_chamber, 0);
106 auto tp_copads_key = std::make_pair(tp_mod_det_id.
rawId(), tp_bx);
107 auto tp_copads = chamber_copads_map.at(tp_copads_key);
110 bool tp_is_substitute =
false;
114 const bool is_ge21 = (tp_station == 2);
116 auto match_fn = [&tp_roll, &tp_pad_lo, &tp_pad_hi, &is_ge21](
const std::array<uint16_t, 3>& elem) {
119 const auto& [c_roll_tmp, c_pad_lo_tmp, c_pad_hi_tmp] = elem;
120 int c_roll_lo =
static_cast<int>(c_roll_tmp) - max_delta_roll;
121 int c_roll_hi =
static_cast<int>(c_roll_tmp) + max_delta_roll;
122 int c_pad_lo =
static_cast<int>(c_pad_lo_tmp) - (is_ge21 ? max_delta_pad_ge21 : max_delta_pad_ge11);
123 int c_pad_hi =
static_cast<int>(c_pad_hi_tmp) + (is_ge21 ? max_delta_pad_ge21 : max_delta_pad_ge11);
126 return (tp_roll <= c_roll_hi) and (tp_roll >= c_roll_lo) and (tp_pad_lo <= c_pad_hi) and
127 (tp_pad_hi >= c_pad_lo);
130 auto match = std::find_if(tp_copads.begin(), tp_copads.end(), match_fn);
132 if (match != tp_copads.end()) {
134 tp_is_substitute =
false;
135 }
else if (tp_copads.empty()) {
137 tp_is_substitute =
true;
142 }
else if (tp_layer == 2) {
150 const int tp_csc_id =
csc::getId(tp_station, tp_ring, tp_chamber);
156 emtf_assert((0 <= tp_subsector) and (tp_subsector <= 2));
159 emtf_assert((1 <= tp_chamber) and (tp_chamber <= 36));
161 emtf_assert(tp_station == 1
or (1 <= tp_roll && tp_roll <= 16));
162 emtf_assert(tp_station != 1
or (1 <= tp_roll && tp_roll <= 8));
164 emtf_assert((tp_station == 1 && 0 <= tp_pad && tp_pad <= 191) || (tp_station != 1));
165 emtf_assert((tp_station == 2 && 0 <= tp_pad && tp_pad <= 383) || (tp_station != 2));
168 tp_entry.info_.bx = tp_bx;
170 tp_entry.info_.endcap = tp_endcap;
171 tp_entry.info_.endcap_pm = tp_endcap_pm;
172 tp_entry.info_.sector = tp_sector;
173 tp_entry.info_.subsector = tp_subsector;
174 tp_entry.info_.station = tp_station;
175 tp_entry.info_.ring = tp_ring;
176 tp_entry.info_.roll = tp_roll;
177 tp_entry.info_.layer = tp_layer;
178 tp_entry.info_.chamber = tp_chamber;
180 tp_entry.info_.csc_id = tp_csc_id;
181 tp_entry.info_.csc_facing = tp_csc_facing;
183 tp_entry.info_.flag_substitute = tp_is_substitute;
185 bx_tpc_map[tp_bx].push_back(tp_entry);
int getId(int ring, int station, int chamber)
int getTriggerSubsector(int station, int chamber)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Container::value_type value_type
const edm::EDGetToken input_token_
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< int, TPCollection > BXTPCMap
key
prepare the HTCondor submission files and eventually submit them
void collect(const edm::Event &, BXTPCMap &) const final
constexpr uint32_t rawId() const
get the raw id
GEMTPCollector(const EMTFContext &, edm::ConsumesCollector &)
int getTriggerSector(int ring, int station, int chamber)
Facing getFaceDirection(int station, int ring, int chamber)
constexpr int kMinTrigSector
constexpr int kMaxTrigSector
std::vector< TPEntry > TPCollection
const EMTFContext & context_
EMTFConfiguration config_