56 const std::vector<std::string>
names_;
75 : ttBits_{iConfig.
getParameter<std::vector<unsigned>>(
"bitNumbers")},
76 names_{iConfig.getParameter<std::vector<std::string>>(
"bitNames")},
77 theCoincidence_{iConfig.getParameter<
double>(
"coincidence")},
78 theResolution_{iConfig.getParameter<
double>(
"resolution")},
79 theHitsToken_{consumes<CrossingFrame<PSimHit>>(iConfig.getParameter<
edm::InputTag>(
"theHits"))},
80 thePutToken_{produces<L1GtTechnicalTriggerRecord>()} {}
93 std::vector<L1GtTechnicalTrigger> ttVec(
ttBits_.size());
98 if (!cf.failedToGet()) {
99 std::vector<float> EnergyBX(32);
100 std::vector<float> EnergyBXMinusDt(32);
102 for (
int c = 0;
c < 32; ++
c) {
104 EnergyBXMinusDt[
c] = 0;
110 LogDebug(
"BSCTrig") <<
" ----------------new event ---with " << theBSCHitContainer.size() <<
" hits in the BSC";
113 for (
auto itHit = theBSCHitContainer.begin(); itHit != theBSCHitContainer.end(); ++itHit) {
114 float zh = itHit->entryPoint().z() / 10;
115 int id =
getBSCNum(itHit->detUnitId(), zh);
118 float t = itHit->timeOfFlight();
121 float rh =
sqrt(itHit->entryPoint().x() * itHit->entryPoint().x() +
122 itHit->entryPoint().y() * itHit->entryPoint().y()) /
124 LogTrace(
"BSCTrig") <<
" BSC Num " <<
id <<
" z=" << zh <<
" isZplus=" <<
isZplus(
id)
125 <<
" Hit DetId=" <<
getBSCNum(
id, zh) <<
" r=" << rh <<
" isInner=" <<
isInner(
id);
126 LogTrace(
"BSCTrig") <<
" Hit time=" <<
t <<
" accepted range=[" << dt2 <<
"," << dt1 <<
"] from a " 127 <<
abs(itHit->particleType()) <<
" with energy " << itHit->energyLoss();
129 if (fabs(
t) > dt1 || fabs(
t) < dt2)
132 EnergyBX[
id] += itHit->energyLoss();
134 EnergyBXMinusDt[
id] += itHit->energyLoss();
138 int ZMinnerBX = 0, ZMouterBX = 0;
139 int ZPinnerBX = 0, ZPouterBX = 0;
140 int ZMinnerBXMinusDt = 0, ZMouterBXMinusDt = 0;
141 int ZPinnerBXMinusDt = 0, ZPouterBXMinusDt = 0;
143 constexpr
float MipFraction = 0.5;
144 constexpr
float MipEnergy = 0.0027;
145 constexpr
float theThreshold = MipFraction * MipEnergy;
146 for (
unsigned int ipad = 0; ipad < 32; ipad++) {
148 LogTrace(
"BSCTrig") <<
" EnergyBX[" << ipad <<
"]=" << EnergyBX[ipad];
150 if (EnergyBX[ipad] > theThreshold) {
164 if (EnergyBXMinusDt[ipad] > theThreshold) {
180 LogTrace(
"BSCTrig") <<
" Zplus I=" << ZPinnerBX <<
" Zminus I=" << ZMinnerBX <<
" Zplus O=" << ZPouterBX
181 <<
" Zminus O=" << ZMouterBX;
185 if (ZPinnerBX >= 1 && ZMinnerBX >= 1)
189 if (ZPinnerBX >= 2 && ZMinnerBX >= 2)
193 if (ZPinnerBX + ZMinnerBX + ZPouterBX + ZMouterBX >= 1)
197 if (ZPinnerBX == 8 && ZMinnerBX == 8)
202 if (ZPinnerBX >= 1 && ZMinnerBXMinusDt >= 1)
206 if (ZPouterBX >= 1 && ZMouterBXMinusDt >= 1)
210 if (ZMinnerBX >= 1 && ZPinnerBXMinusDt >= 1)
214 if (ZMouterBX >= 1 && ZPouterBXMinusDt >= 1)
219 if (ZPinnerBX + ZPouterBX >= 1 && ZMinnerBX + ZMouterBX >= 1)
223 if (ZPinnerBX + ZPouterBX >= 2 && ZMinnerBX + ZMouterBX >= 2)
234 for (
unsigned i = 0;
i <
ttBits_.size(); ++
i) {
267 output.setGtTechnicalTrigger(ttVec);
275 int det = (
id & 24) >> 3;
277 LogTrace(
"BSCTrig") <<
"id=" <<
id <<
" zside=" <<
zside <<
" det=" << det <<
" station=" <<
station;
281 BSCNum = 32 + (
id & 1) + (
zside << 1);
283 BSCNum = (
id & 15) + (
zside << 4);
BSCTrigger(const edm::ParameterSet &)
bool isInner(int id) const
T getParameter(std::string const &) const
const edm::EDPutTokenT< L1GtTechnicalTriggerRecord > thePutToken_
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< CrossingFrame< PSimHit > > theHitsToken_
const double theCoincidence_
const double theResolution_
const std::vector< unsigned > ttBits_
int getBSCNum(int id, float z) const
Abs< T >::type abs(const T &t)
const std::vector< std::string > names_
bool isZplus(int id) const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override