12 #define NUM_SECTORS 12
16 #include "L1Trigger/CSCTrackFinder/test/src/RefTrack.h"
35 using namespace L1TMuon;
42 produces<l1t::RegionalMuonCandBxCollection >(
"EMTF");
62 std::vector<TriggerPrimitive> tester;
72 std::vector<TriggerPrimitive>
out;
74 auto chamber = MDC->begin();
75 auto chend = MDC->end();
76 for( ; chamber != chend; ++chamber ) {
77 auto digi = (*chamber).second.first;
78 auto dend = (*chamber).second.second;
79 for( ; digi != dend; ++digi ) {
94 auto tp = out.cbegin();
95 auto tpend = out.cend();
97 for( ; tp != tpend; ++tp ) {
98 if(tp->subsystem() == 1)
102 tester.push_back(*tp);
112 for(
int SectIndex=0;SectIndex<
NUM_SECTORS;SectIndex++){
121 std::vector<ConvertedHit> ConvHits =
PrimConv(tester,SectIndex);
122 CHits[SectIndex] = ConvHits;
146 std::vector<std::vector<ConvertedHit>> GroupedHits =
GroupBX(ConvHits);
153 std::vector<ZonesOutput> Zout =
Zones(GroupedHits);
162 std::vector<PatternOutput> Pout =
Patterns(Zout);
185 MO[SectIndex] = Mout;
193 std::vector<std::vector<DeltaOutput>> Dout =
CalcDeltas(Mout);
203 PTracks[SectIndex] = Bout;
214 std::vector<BTrack> AllTracks;
218 for(
int j=0;
j<36;
j++){
221 if(PTemp[
j/3][
j%3].
phi)
222 AllTracks.push_back(PTemp[
j/3][
j%3]);
233 std::vector<l1t::RegionalMuonCand> tester1;
234 std::vector<std::pair<int,l1t::RegionalMuonCand>> holder;
236 for(
unsigned int fbest=0;fbest<AllTracks.size();fbest++){
238 if(AllTracks[fbest].
phi){
243 tempTrack.
phi = AllTracks[fbest].phi;
244 tempTrack.
theta = AllTracks[fbest].theta;
245 tempTrack.
rank = AllTracks[fbest].winner.Rank();
246 tempTrack.
deltas = AllTracks[fbest].deltas;
247 std::vector<int> ps, ts;
252 int me1address = 0, me2address = 0, CombAddress = 0,
mode = 0;
253 int ebx = 20, sebx = 20;
254 int phis[4] = {-99,-99,-99,-99};
256 for(std::vector<ConvertedHit>::iterator
A = AllTracks[fbest].AHits.begin();
A != AllTracks[fbest].AHits.end();
A++){
258 if(
A->Phi() != -999){
261 int id =
A->TP().getCSCData().cscID;
262 int trknm =
A->TP().getCSCData().trknmb;
264 phis[station-1] =
A->Phi();
267 if(
A->TP().getCSCData().bx < ebx){
269 ebx =
A->TP().getCSCData().bx;
271 else if(
A->TP().getCSCData().bx < sebx){
272 sebx =
A->TP().getCSCData().bx;
276 ps.push_back(
A->Phi());
277 ts.push_back(
A->Theta());
282 case 1:
mode |= 8;
break;
283 case 2:
mode |= 4;
break;
284 case 3:
mode |= 2;
break;
285 case 4:
mode |= 1;
break;
293 if(station == 1 &&
id > 3 &&
id < 7){
296 if(
A->TP().detId<
CSCDetId>().chamber()%6 > 2)
301 me1address += 3*(sub - 1);
303 me1address |= trknm-1;
307 if(station == 2 &&
id > 3){
311 me2address = me2address<<1;
312 me2address |= trknm-1;
324 tempTrack.
pt = xmlpt*1.4;
327 CombAddress = (me2address<<4) | me1address;
332 charge,
mode,CombAddress,sector);
335 float theta_angle = (AllTracks[fbest].theta*0.2851562 + 8.5)*(3.14159265359/180);
336 float eta = (-1)*
log(
tan(theta_angle/2));
337 std::pair<int,l1t::RegionalMuonCand> outPair(sebx,outCand);
339 if(!ME13 && fabs(eta) > 1.1)
340 holder.push_back(outPair);
344 OutputCands->setBXRange(-2,2);
346 for(
int sect=0;sect<12;sect++){
348 for(
unsigned int h=0;
h<holder.size();
h++){
350 int bx = holder[
h].first - 6;
351 int sector = holder[
h].second.processor();
352 if(holder[
h].
second.trackFinderType() == 3)
356 OutputCands->push_back(bx,holder[
h].
second);
364 ev.
put( OutputCands,
"EMTF");
T getParameter(std::string const &) const
SortingOutput SortSect(PatternOutput Pout)
L1TMuonEndCapTrackProducer(const PSet &)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
l1t::RegionalMuonCand MakeRegionalCand(float pt, int phi, int theta, int sign, int quality, int trackaddress, int sector)
Geom::Theta< T > theta() const
void setType(unsigned type)
MatchingOutput PhiMatching(SortingOutput Sout)
std::vector< int > thetas
std::vector< PatternOutput > Patterns(std::vector< ZonesOutput > Zones)
U second(std::pair< T, U > const &p)
void addStub(const TriggerPrimitive &stub)
float CalculatePt(L1TMuon::InternalTrack track, const edm::EventSetup &es)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Tan< T >::type tan(const T &t)
void produce(edm::Event &, const edm::EventSetup &)
std::vector< std::vector< int > > deltas
int getCharge(int phi1, int phi2, int phi3, int phi4, int mode)
std::vector< ConvertedHit > PrimConv(std::vector< TriggerPrimitive > TriggPrim, int SectIndex)
Geom::Phi< T > phi() const
std::vector< BTrack > BestTracks(std::vector< std::vector< DeltaOutput >> Dout)
std::vector< std::vector< DeltaOutput > > CalcDeltas(MatchingOutput Mout)
PatternOutput DeleteDuplicatePatterns(std::vector< PatternOutput > Pout)
int phi
TEMPORARY ADDITION by G. Brown ///.
std::vector< std::vector< ConvertedHit > > GroupBX(std::vector< ConvertedHit > ConvHits)
std::vector< ZonesOutput > Zones(std::vector< std::vector< ConvertedHit >> Hits)
Int_t triggerSector(Int_t station, Int_t ring, Int_t chamber) const