18 input_token_(i_consumes_collector.consumes<
CSCTag::collection_type>(
context.config_.csc_input_)) {}
27 auto chamber = csc_digis->begin();
28 auto chend = csc_digis->end();
31 auto digi = (*chamber).second.first;
32 auto dend = (*chamber).second.second;
34 for (; digi != dend; ++digi) {
35 tpc.emplace_back((*chamber).first, *digi);
40 std::map<std::pair<uint32_t, uint16_t>, std::vector<uint16_t> > chamber_wires_map;
42 for (
auto& tp_entry : tpc) {
43 const auto& tp_det_id = tp_entry.tp_.detId<
CSCDetId>();
45 const CSCData& tp_data = tp_entry.tp_.getCSCData();
47 const int tp_wire = tp_data.keywire;
49 auto key = std::make_pair(tp_det_id.rawId(), tp_bx);
50 auto res = chamber_wires_map.find(
key);
52 if (
res == chamber_wires_map.end()) {
54 chamber_wires_map[
key].push_back(tp_wire);
58 bool wire_found =
false;
60 auto& chamber_wires =
res->second;
62 for (
const auto& a_wire : chamber_wires) {
64 if (a_wire == tp_wire) {
72 chamber_wires.push_back(tp_wire);
78 for (
auto& tp_entry : tpc) {
79 const auto& tp_det_id = tp_entry.tp_.detId<
CSCDetId>();
80 const CSCData& tp_data = tp_entry.tp_.getCSCData();
82 const int tp_endcap = tp_det_id.endcap();
83 const int tp_endcap_pm = (tp_endcap == 2) ? -1 : tp_endcap;
84 const int tp_sector = tp_det_id.triggerSector();
85 const int tp_station = tp_det_id.station();
86 const int tp_ring = tp_det_id.ring();
87 const int tp_chamber = tp_det_id.chamber();
88 const int tp_layer = tp_det_id.layer();
90 const int tp_csc_id = tp_data.
cscID;
95 int tp_wire1 = tp_data.keywire;
98 auto tp_wire_key = std::make_pair(tp_det_id.rawId(), tp_bx);
99 const auto& tp_wires = chamber_wires_map.at(tp_wire_key);
101 emtf_assert((!tp_wires.empty()) && (tp_wires.size() <= 2));
103 if (tp_wires.size() > 1) {
104 tp_wire1 = tp_wires.at(0);
105 tp_wire2 = tp_wires.at(1);
118 emtf_assert((0 <= tp_subsector) and (tp_subsector <= 2));
126 emtf_assert(0 < tp_data.quality && tp_data.quality < max_quality);
131 if (!(tp_data.strip < max_strip)) {
132 edm::LogWarning(
"L1TEMTFpp") <<
"Found error in LCT strip: " << tp_data.strip <<
" (allowed range: 0-" 133 << max_strip - 1 <<
").";
136 <<
"From endcap " << tp_endcap <<
", sector " << tp_sector <<
", station " << tp_station <<
", ring " 137 << tp_ring <<
", cscid " << tp_csc_id
138 <<
". (Note that this LCT may be reported multiple times. See source code for explanations.)";
143 if (!(tp_data.keywire < max_wire)) {
144 edm::LogWarning(
"L1TEMTFpp") <<
"Found error in LCT wire: " << tp_data.keywire <<
" (allowed range: 0-" 145 << max_wire - 1 <<
").";
148 <<
"From endcap " << tp_endcap <<
", sector " << tp_sector <<
", station " << tp_station <<
", ring " 149 << tp_ring <<
", cscid " << tp_csc_id
150 <<
". (Note that this LCT may be reported multiple times. See source code for explanations.)";
155 if (!(tp_data.valid ==
true)) {
156 edm::LogWarning(
"L1TEMTFpp") <<
"Found error in LCT valid: " << tp_data.valid <<
" (allowed value: 1).";
159 <<
"From endcap " << tp_endcap <<
", sector " << tp_sector <<
", station " << tp_station <<
", ring " 160 << tp_ring <<
", cscid " << tp_csc_id
161 <<
". (Note that this LCT may be reported multiple times. See source code for explanations.)";
166 if (!(tp_data.pattern < max_pattern)) {
167 edm::LogWarning(
"L1TEMTFpp") <<
"Found error in LCT pattern: " << tp_data.pattern <<
" (allowed range: 0-" 168 << max_pattern - 1 <<
").";
171 <<
"From endcap " << tp_endcap <<
", sector " << tp_sector <<
", station " << tp_station <<
", ring " 172 << tp_ring <<
", cscid " << tp_csc_id
173 <<
". (Note that this LCT may be reported multiple times. See source code for explanations.)";
178 if (!(0 < tp_data.quality && tp_data.quality < max_quality)) {
179 edm::LogWarning(
"L1TEMTFpp") <<
"Found error in LCT quality: " << tp_data.quality <<
" (allowed range: 1-" 180 << max_quality - 1 <<
").";
183 <<
"From endcap " << tp_endcap <<
", sector " << tp_sector <<
", station " << tp_station <<
", ring " 184 << tp_ring <<
", cscid " << tp_csc_id
185 <<
". (Note that this LCT may be reported multiple times. See source code for explanations.)";
191 tp_entry.info_.bx = tp_bx;
193 tp_entry.info_.endcap = tp_endcap;
194 tp_entry.info_.endcap_pm = tp_endcap_pm;
195 tp_entry.info_.sector = tp_sector;
196 tp_entry.info_.subsector = tp_subsector;
197 tp_entry.info_.station = tp_station;
198 tp_entry.info_.ring = tp_ring;
199 tp_entry.info_.chamber = tp_chamber;
200 tp_entry.info_.layer = tp_layer;
202 tp_entry.info_.csc_id = tp_csc_id;
203 tp_entry.info_.csc_facing = tp_face_dir;
204 tp_entry.info_.csc_first_wire = tp_wire1;
205 tp_entry.info_.csc_second_wire = tp_wire2;
207 bx_tpc_map[tp_bx].push_back(tp_entry);
std::pair< int, int > getMaxPatternAndQuality(int station, int ring)
int getTriggerSubsector(int station, int chamber)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const EMTFContext & context_
CSCTPCollector(const EMTFContext &, edm::ConsumesCollector &)
void collect(const edm::Event &, BXTPCMap &) const final
const edm::EDGetToken input_token_
std::pair< int, int > getMaxStripAndWire(int station, int ring)
std::map< int, TPCollection > BXTPCMap
key
prepare the HTCondor submission files and eventually submit them
Facing getFaceDirection(int station, int ring, int chamber)
constexpr int kMinTrigSector
constexpr int kMaxTrigSector
Log< level::Warning, false > LogWarning
std::vector< TPEntry > TPCollection
EMTFConfiguration config_