test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Attributes
L1TMuonEndCapTrackProducer Class Reference

#include <L1TMuonEndCapTrackProducer.h>

Inheritance diagram for L1TMuonEndCapTrackProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob ()
 
void endJob ()
 
 L1TMuonEndCapTrackProducer (const PSet &)
 
void produce (edm::Event &, const edm::EventSetup &)
 
 ~L1TMuonEndCapTrackProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Public Attributes

const float ptscale [33]
 

Private Attributes

edm::EDGetTokenT
< CSCCorrelatedLCTDigiCollection
inputTokenCSC
 
PrimitiveConverter primConv_
 
l1t::EmtfPtAssignment ptAssignment_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 49 of file L1TMuonEndCapTrackProducer.h.

Constructor & Destructor Documentation

L1TMuonEndCapTrackProducer::L1TMuonEndCapTrackProducer ( const PSet p)

Definition at line 40 of file L1TMuonEndCapTrackProducer.cc.

References edm::ParameterSet::getParameter().

40  {
41 
42  inputTokenCSC = consumes<CSCCorrelatedLCTDigiCollection>(p.getParameter<edm::InputTag>("CSCInput"));
43 
44  produces<l1t::RegionalMuonCandBxCollection >("EMTF");
45  produces< l1t::EMTFTrackCollection >("EMTF");
46  produces< l1t::EMTFHitCollection >("EMTF");
47  produces< l1t::EMTFTrackExtraCollection >("EMTF");
48  produces< l1t::EMTFHitExtraCollection >("EMTF");
49 
50 }
T getParameter(std::string const &) const
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > inputTokenCSC
L1TMuonEndCapTrackProducer::~L1TMuonEndCapTrackProducer ( )
inline

Definition at line 52 of file L1TMuonEndCapTrackProducer.h.

52 {}

Member Function Documentation

void L1TMuonEndCapTrackProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 542 of file L1TMuonEndCapTrackProducer.cc.

543 {
544 }
void L1TMuonEndCapTrackProducer::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 545 of file L1TMuonEndCapTrackProducer.cc.

546 {
547 }
void L1TMuonEndCapTrackProducer::produce ( edm::Event ev,
const edm::EventSetup es 
)
virtual

Collect Muons from all sectors ////

Make Internal track if //////// //// tracks are found //////////

Implements edm::EDProducer.

Definition at line 53 of file L1TMuonEndCapTrackProducer.cc.

References funct::A, L1TMuon::InternalTrack::addStub(), BestTracks(), l1t::calc_eta_from_theta_rad(), l1t::calc_phi_glob_deg(), l1t::calc_phi_glob_deg_hit(), l1t::calc_phi_glob_rad(), l1t::calc_phi_glob_rad_hit(), l1t::calc_phi_loc_deg(), l1t::calc_phi_loc_rad(), l1t::calc_sector_from_index(), l1t::calc_sector_GMT(), l1t::calc_theta_deg_from_int(), l1t::calc_theta_rad_from_int(), CalcDeltas(), l1t::EMTFHit::Chamber(), RecoTauCleanerPlugins::charge, l1t::EMTFTrackExtra::CreateEMTFTrack(), DeleteDuplicatePatterns(), L1TMuon::InternalTrack::deltas, l1t::EMTFHit::Endcap(), l1t::EMTFTrack::Endcap(), eta, l1t::EMTFTrackExtra::First_BX(), edm::Event::getByToken(), getCharge(), GroupBX(), h, l1t::RegionalMuonCand::hwEta(), l1t::RegionalMuonCand::hwPhi(), l1t::RegionalMuonCand::hwPt(), l1t::RegionalMuonCand::hwQual(), i, l1t::EMTFHitExtra::ImportCSCCorrelatedLCTDigi(), l1t::EMTFHit::ImportCSCDetId(), l1t::EMTFTrack::ImportPtLUT(), j, MakeRegionalCand(), Reference_intrackfit_cff::ME13, alignBH_cfg::mode, l1t::EMTFTrack::Mode(), NUM_SECTORS, GenerateHcalLaserBadRunList::out, Patterns(), L1TMuon::InternalTrack::phi, phi(), l1t::EMTFTrack::Phi_loc_deg(), l1t::EMTFTrack::Phi_loc_int(), l1t::EMTFTrack::Phi_loc_rad(), PhiMatching(), L1TMuon::InternalTrack::phis, Geom::pi(), L1TMuon::InternalTrack::pt, l1t::EMTFTrack::Pt_LUT_addr(), l1t::EMTFTrackExtra::push_HitExtra(), l1t::EMTFTrackExtra::push_HitExtraIndex(), edm::Event::put(), l1t::EMTFTrackExtra::Rank(), L1TMuon::InternalTrack::rank, relativeConstraints::ring, l1t::EMTFHit::Ring(), edm::second(), l1t::EMTFHit::Sector(), l1t::EMTFTrack::Sector(), l1t::EMTFHit::Sector_index(), l1t::EMTFTrack::set_bx(), l1t::EMTFTrack::set_charge(), l1t::EMTFTrack::set_charge_GMT(), l1t::EMTFTrack::set_endcap(), l1t::EMTFTrack::set_eta(), l1t::EMTFTrack::set_eta_GMT(), l1t::EMTFTrackExtra::set_first_bx(), l1t::EMTFTrackExtra::set_isGMT(), l1t::EMTFTrack::set_mode(), l1t::EMTFHit::set_neighbor(), l1t::EMTFTrack::set_phi_glob_deg(), l1t::EMTFTrack::set_phi_glob_rad(), l1t::EMTFTrack::set_phi_GMT(), l1t::EMTFTrack::set_phi_loc_deg(), l1t::EMTFTrack::set_phi_loc_int(), l1t::EMTFTrack::set_phi_loc_rad(), l1t::EMTFTrackExtra::set_phis(), l1t::EMTFTrack::set_pt(), l1t::EMTFTrack::set_pt_GMT(), l1t::EMTFTrack::set_pt_LUT_addr(), l1t::EMTFTrackExtra::set_pt_XML(), l1t::EMTFTrack::set_quality(), l1t::EMTFTrackExtra::set_rank(), l1t::EMTFHit::set_ring(), l1t::EMTFTrackExtra::set_second_bx(), l1t::EMTFTrack::set_sector(), l1t::EMTFTrack::set_sector_GMT(), l1t::EMTFTrack::set_sector_index(), l1t::EMTFTrackExtra::set_straightness(), l1t::EMTFTrackExtra::set_theta_deg(), l1t::EMTFTrackExtra::set_theta_int(), l1t::EMTFTrackExtra::set_theta_rad(), l1t::EMTFTrackExtra::set_thetas(), L1TMuon::InternalTrack::setType(), SortSect(), relativeConstraints::station, l1t::EMTFHit::Station(), l1t::EMTFHit::Strip(), L1TMuon::InternalTrack::theta, theta(), L1TMuon::InternalTrack::thetas, and Zones().

54  {
55 
56  //bool verbose = false;
57 
58  //fprintf (write,"12345\n"); //<-- part of printing text file to send verilog code, not needed if George's package is included
59 
60 
61  //std::auto_ptr<L1TMuon::InternalTrackCollection> FoundTracks (new L1TMuon::InternalTrackCollection);
62  std::auto_ptr<l1t::RegionalMuonCandBxCollection > OutputCands (new l1t::RegionalMuonCandBxCollection);
63  std::auto_ptr<l1t::EMTFTrackCollection> OutTracks (new l1t::EMTFTrackCollection);
64  std::auto_ptr<l1t::EMTFHitCollection> OutHits (new l1t::EMTFHitCollection);
65  std::auto_ptr<l1t::EMTFTrackExtraCollection> OutputTracks (new l1t::EMTFTrackExtraCollection);
66  std::auto_ptr<l1t::EMTFHitExtraCollection> OutputHits (new l1t::EMTFHitExtraCollection);
67 
68  std::vector<BTrack> PTracks[NUM_SECTORS];
69 
70  std::vector<TriggerPrimitive> tester;
71  //std::vector<InternalTrack> FoundTracks;
72 
73 
77 
79  ev.getByToken(inputTokenCSC, MDC);
80  std::vector<TriggerPrimitive> out;
81 
82  auto chamber = MDC->begin();
83  auto chend = MDC->end();
84  for( ; chamber != chend; ++chamber ) {
85  auto digi = (*chamber).second.first;
86  auto dend = (*chamber).second.second;
87  for( ; digi != dend; ++digi ) {
88  out.push_back(TriggerPrimitive((*chamber).first,*digi));
89  l1t::EMTFHitExtra thisHit;
90  thisHit.ImportCSCDetId( (*chamber).first );
91  thisHit.ImportCSCCorrelatedLCTDigi( *digi );
92  if (thisHit.Station() == 1 && thisHit.Ring() == 1 && thisHit.Strip() > 127) thisHit.set_ring(4);
93  thisHit.set_neighbor(0);
94  OutputHits->push_back( thisHit );
95  if ( ((thisHit.Ring() != 1 || thisHit.Station() == 1) && (thisHit.Chamber() % 6 == 2)) ||
96  ((thisHit.Ring() == 1 && thisHit.Station() > 1) && (thisHit.Chamber() % 3 == 1)) ) {
97  l1t::EMTFHitExtra neighborHit = thisHit;
98  neighborHit.set_neighbor(1);
99  OutputHits->push_back( neighborHit );
100  }
101  }
102  }
103 
104 
108 
109  // auto tpsrc = _tpinputs.cbegin();
110  //auto tpend = _tpinputs.cend();
111  // for( ; tpsrc != tpend; ++tpsrc ) {
112  // edm::Handle<TriggerPrimitiveCollection> tps;
113  // ev.getByLabel(*tpsrc,tps);
114  auto tp = out.cbegin();
115  auto tpend = out.cend();
116 
117  for( ; tp != tpend; ++tp ) {
118  if(tp->subsystem() == 1)
119  {
120  //TriggerPrimitiveRef tpref(out,tp - out.cbegin());
121 
122  tester.push_back(*tp);
123 
124  //std::cout<<"\ntrigger prim found station:"<<tp->detId<CSCDetId>().station()<<std::endl;
125  }
126 
127  }
128  //}
129  std::vector<ConvertedHit> CHits[NUM_SECTORS];
131 
132 for(int SectIndex=0;SectIndex<NUM_SECTORS;SectIndex++){//perform TF on all 12 sectors
133 
134 
135 
139 
140 
141  std::vector<ConvertedHit> ConvHits = primConv_.convert(tester,SectIndex);
142  CHits[SectIndex] = ConvHits;
143 
144  // Fill OutputHits with ConvertedHit information
145  for (uint iCHit = 0; iCHit < ConvHits.size(); iCHit++) {
146  // bool isMatched = false;
147 
148  for (uint iHit = 0; iHit < OutputHits->size(); iHit++) {
149  if ( ConvHits.at(iCHit).Station() == OutputHits->at(iHit).Station() &&
150  ( ConvHits.at(iCHit).Id() == OutputHits->at(iHit).CSC_ID() ||
151  ConvHits.at(iCHit).Id() == ( (OutputHits->at(iHit).Ring() != 4) // Account for either ME1/1a
152  ? OutputHits->at(iHit).CSC_ID() // CSC ID numbering convention
153  : OutputHits->at(iHit).CSC_ID() + 9 ) ) &&
154  ConvHits.at(iCHit).Wire() == OutputHits->at(iHit).Wire() &&
155  ConvHits.at(iCHit).Strip() == OutputHits->at(iHit).Strip() &&
156  ConvHits.at(iCHit).BX() - 6 == OutputHits->at(iHit).BX() &&
157  ConvHits.at(iCHit).IsNeighbor() == OutputHits->at(iHit).Neighbor() ) {
158  // isMatched = true;
159  OutputHits->at(iHit).set_neighbor ( ConvHits.at(iCHit).IsNeighbor());
160  OutputHits->at(iHit).set_sector_index( ConvHits.at(iCHit).SectorIndex() );
161  OutputHits->at(iHit).set_zone_hit ( ConvHits.at(iCHit).Zhit() );
162  OutputHits->at(iHit).set_phi_hit ( ConvHits.at(iCHit).Ph_hit() );
163  OutputHits->at(iHit).set_phi_z_val ( ConvHits.at(iCHit).Phzvl() );
164  OutputHits->at(iHit).set_phi_loc_int ( ConvHits.at(iCHit).Phi() );
165  OutputHits->at(iHit).set_theta_int ( ConvHits.at(iCHit).Theta() );
166 
167  OutputHits->at(iHit).SetZoneContribution ( ConvHits.at(iCHit).ZoneContribution() );
168  OutputHits->at(iHit).set_phi_loc_deg ( l1t::calc_phi_loc_deg( OutputHits->at(iHit).Phi_loc_int() ) );
169  OutputHits->at(iHit).set_phi_loc_rad ( l1t::calc_phi_loc_rad( OutputHits->at(iHit).Phi_loc_int() ) );
170  OutputHits->at(iHit).set_phi_glob_deg ( l1t::calc_phi_glob_deg_hit( OutputHits->at(iHit).Phi_loc_deg(), OutputHits->at(iHit).Sector_index() ) );
171  OutputHits->at(iHit).set_phi_glob_rad ( l1t::calc_phi_glob_rad_hit( OutputHits->at(iHit).Phi_loc_rad(), OutputHits->at(iHit).Sector_index() ) );
172  OutputHits->at(iHit).set_theta_deg ( l1t::calc_theta_deg_from_int( OutputHits->at(iHit).Theta_int() ) );
173  OutputHits->at(iHit).set_theta_rad ( l1t::calc_theta_rad_from_int( OutputHits->at(iHit).Theta_int() ) );
174  OutputHits->at(iHit).set_eta( l1t::calc_eta_from_theta_rad( OutputHits->at(iHit).Theta_rad() ) * OutputHits->at(iHit).Endcap() );
175 
176  OutHits->push_back( OutputHits->at(iHit).CreateEMTFHit() );
177  }
178  } // End loop: for (uint iHit = 0; iHit < OutputHits->size(); iHit++)
179 
180  // if (isMatched == false) {
181  // std::cout << "***********************************************" << std::endl;
182  // std::cout << "Unmatched ConvHit in event " << ev.id().event() << ", SectIndex " << SectIndex << std::endl;
183  // std::cout << "ConvHit: station = " << ConvHits.at(iCHit).Station() << ", CSC ID = " << ConvHits.at(iCHit).Id()
184  // << ", sector index = " << ConvHits.at(iCHit).SectorIndex() << ", subsector = " << ConvHits.at(iCHit).Sub()
185  // << ", wire = " << ConvHits.at(iCHit).Wire() << ", strip = " << ConvHits.at(iCHit).Strip()
186  // << ", BX = " << ConvHits.at(iCHit).BX() << ", neighbor = " << ConvHits.at(iCHit).IsNeighbor() << std::endl;
187 
188  // for (uint iHit = 0; iHit < OutputHits->size(); iHit++) {
189  // std::cout << "EMTFHitExtra: station = " << OutputHits->at(iHit).Station() << ", CSC ID = " << OutputHits->at(iHit).CSC_ID()
190  // << ", sector index = " << OutputHits->at(iHit).Sector_index() << ", subsector = " << OutputHits->at(iHit).Subsector()
191  // << ", wire = " << OutputHits->at(iHit).Wire() << ", strip = " << OutputHits->at(iHit).Strip()
192  // << ", BX = " << OutputHits->at(iHit).BX() << ", neighbor = " << OutputHits->at(iHit).Neighbor()
193  // << ", chamber = " << OutputHits->at(iHit).Chamber() << ", ring = " << OutputHits->at(iHit).Ring()
194  // << ", endcap = " << OutputHits->at(iHit).Endcap() << ", sector = " << OutputHits->at(iHit).Sector() << std::endl;
195  // }
196  // }
197 
198  } // End loop: for (uint iCHit = 0; iCHit < ConvHits.size(); iCHit++)
199 
200 
203  //for(std::vector<ConvertedHit>::iterator h = ConvHits.begin();h != ConvHits.end();h++){
204 
205  //if((h->Id()) > 9){h->SetId(h->Id() - 9);h->SetStrip(h->Strip() + 128);}
206  //fprintf (write,"0 1 1 %d %d\n",h->Sub(),h->Station());
207  //fprintf (write,"1 %d %d %d\n",h->Quality(),h->Pattern(),h->Wire());
208  //fprintf (write,"%d 0 %d\n",h->Id(),h->Strip());
209  //}
212 
213 
214 
220 
221  std::vector<std::vector<ConvertedHit>> GroupedHits = GroupBX(ConvHits);
222 
223 
227 
228  std::vector<ZonesOutput> Zout = Zones(GroupedHits);
229 
230 
235 
236 
237  std::vector<PatternOutput> Pout = Patterns(Zout);
238 
240 
241  //PrintQuality(Test.detected);
242 
243 
248 
249  SortingOutput Sout = SortSect(Test);
250 
251 
256 
257  MatchingOutput Mout = PhiMatching(Sout);
258  MO[SectIndex] = Mout;
259 
264 
265  std::vector<std::vector<DeltaOutput>> Dout = CalcDeltas(Mout);
266 
267 
272 
273  std::vector<BTrack> Bout = BestTracks(Dout);
274  PTracks[SectIndex] = Bout;
275 
276 
277  } // End loop: for(int SectIndex=0;SectIndex<NUM_SECTORS;SectIndex++)
278 
279 
283 
284  std::vector<BTrack> PTemp[NUM_SECTORS];
285  std::vector<BTrack> AllTracks;
286  for (int i=0; i<NUM_SECTORS; i++) PTemp[i] = PTracks[i];
287 
288 
289  for(int j=0;j<36;j++){
290 
291 
292  if(PTemp[j/3][j%3].phi)//no track
293  AllTracks.push_back(PTemp[j/3][j%3]);
294 
295 
296 
297  }
298 
303 
304  std::vector<l1t::RegionalMuonCand> tester1;
305  std::vector<std::pair<int,l1t::RegionalMuonCand>> holder;
306 
307  for(unsigned int fbest=0;fbest<AllTracks.size();fbest++){
308 
309  if(AllTracks[fbest].phi){
310 
311  InternalTrack tempTrack;
312  tempTrack.setType(2);
313  tempTrack.phi = AllTracks[fbest].phi;
314  tempTrack.theta = AllTracks[fbest].theta;
315  tempTrack.rank = AllTracks[fbest].winner.Rank();
316  tempTrack.deltas = AllTracks[fbest].deltas;
317  std::vector<int> ps, ts;
318 
319  l1t::EMTFTrackExtra thisTrack;
320  thisTrack.set_phi_loc_int ( AllTracks[fbest].phi );
321  thisTrack.set_theta_int ( AllTracks[fbest].theta );
322  thisTrack.set_rank ( AllTracks[fbest].winner.Rank() );
323  // thisTrack.set_deltas ( AllTracks[fbest].deltas );
324  int tempStraightness = 0;
325  int tempRank = thisTrack.Rank();
326  if (tempRank & 64)
327  tempStraightness |= 4;
328  if (tempRank & 16)
329  tempStraightness |= 2;
330  if (tempRank & 4)
331  tempStraightness |= 1;
332  thisTrack.set_straightness ( tempStraightness );
333 
334 
335  int sector = -1;
336  bool ME13 = false;
337  int me1address = 0, me2address = 0, CombAddress = 0, mode_uncorr = 0;
338  int ebx = 20, sebx = 20;
339  int phis[4] = {-99,-99,-99,-99};
340 
341  for(std::vector<ConvertedHit>::iterator A = AllTracks[fbest].AHits.begin();A != AllTracks[fbest].AHits.end();A++){
342 
343  if(A->Phi() != -999){
344 
345  l1t::EMTFHitExtra thisHit;
346  // thisHit.ImportCSCDetId( A->TP().detId<CSCDetId>() );
347 
348  for (uint iHit = 0; iHit < OutputHits->size(); iHit++) {
349  if ( A->TP().detId<CSCDetId>().station() == OutputHits->at(iHit).Station() and
350  A->TP().getCSCData().cscID == OutputHits->at(iHit).CSC_ID() and
351  A->Wire() == OutputHits->at(iHit).Wire() and
352  A->Strip() == OutputHits->at(iHit).Strip() and
353  A->TP().getCSCData().bx - 6 == OutputHits->at(iHit).BX() ) {
354  thisHit = OutputHits->at(iHit);
355  thisTrack.push_HitExtraIndex(iHit);
356  thisTrack.push_HitExtra(thisHit); // Done before theta windows are applied ... how can we do it after? - AWB 29.04.16
357  break;
358  }
359  }
360  thisTrack.set_endcap ( thisHit.Endcap() );
361  thisTrack.set_sector_index ( thisHit.Sector_index() );
362  thisTrack.set_sector ( l1t::calc_sector_from_index( thisHit.Sector_index() ) );
363  thisTrack.set_sector_GMT ( l1t::calc_sector_GMT( thisHit.Sector() ) );
364 
365  int station = A->TP().detId<CSCDetId>().station();
366  int id = A->TP().getCSCData().cscID;
367  int trknm = A->TP().getCSCData().trknmb;
368 
369  phis[station-1] = A->Phi();
370 
371 
372  if(A->TP().getCSCData().bx < ebx){
373  sebx = ebx;
374  ebx = A->TP().getCSCData().bx;
375  }
376  else if(A->TP().getCSCData().bx < sebx){
377  sebx = A->TP().getCSCData().bx;
378  }
379 
380  tempTrack.addStub(A->TP());
381  ps.push_back(A->Phi());
382  ts.push_back(A->Theta());
383 
384  sector = A->SectorIndex();//(A->TP().detId<CSCDetId>().endcap() -1)*6 + A->TP().detId<CSCDetId>().triggerSector() - 1;
385  //std::cout<<"Q: "<<A->Quality()<<", keywire: "<<A->Wire()<<", strip: "<<A->Strip()<<std::endl;
386 
387  switch(station){
388  case 1: mode_uncorr |= 8;break;
389  case 2: mode_uncorr |= 4;break;
390  case 3: mode_uncorr |= 2;break;
391  case 4: mode_uncorr |= 1;break;
392  default: mode_uncorr |= 0;
393  }
394 
395 
396  if(A->TP().detId<CSCDetId>().station() == 1 && A->TP().detId<CSCDetId>().ring() == 3)
397  ME13 = true;
398 
399  if(station == 1 && id > 3 && id < 7){
400 
401  int sub = 2;
402  if(A->TP().detId<CSCDetId>().chamber()%6 > 2)
403  sub = 1;
404 
405  me1address = id;
406  me1address -= 3;
407  me1address += 3*(sub - 1);
408  me1address = id<<1;//
409  me1address |= trknm-1;
410 
411  }
412 
413  if(station == 2 && id > 3){
414 
415  me2address = id;
416  me2address -= 3;
417  me2address = me2address<<1;
418  me2address |= trknm-1;
419 
420  }
421 
422 
423  }
424 
425  }
426 
427  int mode = 0;
428  if(tempTrack.rank & 32)
429  mode |= 8;
430  if(tempTrack.rank & 8)
431  mode |= 4;
432  if(tempTrack.rank & 2)
433  mode |= 2;
434  if(tempTrack.rank & 1)
435  mode |= 1;
436 
437  tempTrack.phis = ps;
438  tempTrack.thetas = ts;
439 
440  // // Before Mulhearn cleanup, May 11
441  // unsigned long xmlpt_address = 0;
442  // float xmlpt = CalculatePt(tempTrack, es, mode, &xmlpt_address);
443 
444  // After Mulhearn cleanup, May 11
445  unsigned long xmlpt_address = ptAssignment_.calculateAddress(tempTrack, es, mode);
446  float xmlpt = ptAssignment_.calculatePt(xmlpt_address);
447 
448  tempTrack.pt = xmlpt*1.4;
449  //FoundTracks->push_back(tempTrack);
450 
451  CombAddress = (me2address<<4) | me1address;
452 
453  int charge = getCharge(phis[0],phis[1],phis[2],phis[3],mode);
454 
455  l1t::RegionalMuonCand outCand = MakeRegionalCand(xmlpt*1.4,AllTracks[fbest].phi,AllTracks[fbest].theta,
456  charge,mode,CombAddress,sector);
457 
458  float theta_angle = l1t::calc_theta_rad_from_int( AllTracks[fbest].theta );
459  float eta = l1t::calc_eta_from_theta_rad( theta_angle );
460 
461  thisTrack.set_phi_loc_deg ( l1t::calc_phi_loc_deg( thisTrack.Phi_loc_int() ) );
462  thisTrack.set_phi_loc_rad ( l1t::calc_phi_loc_rad( thisTrack.Phi_loc_int() ) );
463  thisTrack.set_phi_glob_deg ( l1t::calc_phi_glob_deg( thisTrack.Phi_loc_deg(), thisTrack.Sector() ) );
464  thisTrack.set_phi_glob_rad ( l1t::calc_phi_glob_rad( thisTrack.Phi_loc_rad(), thisTrack.Sector() ) );
465  thisTrack.set_quality ( outCand.hwQual());
466  thisTrack.set_mode ( mode );
467  thisTrack.set_first_bx ( ebx - 6 );
468  thisTrack.set_second_bx ( sebx - 6 );
469  thisTrack.set_bx ( thisTrack.First_BX() );
470  thisTrack.set_phis ( ps );
471  thisTrack.set_thetas ( ts );
472  thisTrack.set_pt ( xmlpt*1.4 );
473  thisTrack.set_pt_XML ( xmlpt );
474  thisTrack.set_pt_LUT_addr( xmlpt_address );
475  thisTrack.set_charge ( (charge == 1) ? -1 : 1 ); // uGMT uses opposite of physical charge (to match pdgID)
476  thisTrack.set_charge_GMT ( charge );
477  thisTrack.set_theta_rad ( theta_angle );
478  thisTrack.set_theta_deg ( theta_angle * 180/Geom::pi() );
479  thisTrack.set_eta ( eta * thisTrack.Endcap() );
480  thisTrack.set_pt_GMT ( outCand.hwPt() );
481  thisTrack.set_phi_GMT ( outCand.hwPhi() );
482  thisTrack.set_eta_GMT ( outCand.hwEta() );
483 
484  thisTrack.ImportPtLUT ( thisTrack.Mode(), thisTrack.Pt_LUT_addr() );
485 
486  // thisTrack.phi_loc_rad(); // Need to implement - AWB 04.04.16
487  // thisTrack.phi_glob_rad(); // Need to implement - AWB 04.04.16
488 
489  // // Optimal emulator configuration - AWB 29.03.16
490  // std::pair<int,l1t::RegionalMuonCand> outPair(sebx,outCand);
491 
492  // Actual setting in firmware - AWB 12.04.16
493  std::pair<int,l1t::RegionalMuonCand> outPair(ebx,outCand);
494 
495  if(!ME13 && fabs(eta) > 1.1) {
496  // // Extra debugging output - AWB 29.03.16
497  // std::cout << "Input: eBX = " << ebx << ", seBX = " << sebx << ", pt = " << xmlpt*1.4
498  // << ", phi = " << AllTracks[fbest].phi << ", eta = " << eta
499  // << ", theta = " << AllTracks[fbest].theta << ", sign = " << 1
500  // << ", quality = " << mode << ", trackaddress = " << 1
501  // << ", sector = " << sector << std::endl;
502  // std::cout << "Output: BX = " << ebx << ", hwPt = " << outCand.hwPt() << ", hwPhi = " << outCand.hwPhi()
503  // << ", hwEta = " << outCand.hwEta() << ", hwSign = " << outCand.hwSign()
504  // << ", hwQual = " << outCand.hwQual() << ", link = " << outCand.link()
505  // << ", processor = " << outCand.processor()
506  // << ", trackFinderType = " << outCand.trackFinderType() << std::endl;
507  holder.push_back(outPair);
508  thisTrack.set_isGMT( 1 );
509  }
510  OutputTracks->push_back( thisTrack );
511  OutTracks->push_back( thisTrack.CreateEMTFTrack() );
512  }
513  }
514 
515 OutputCands->setBXRange(-2,2);
516 
517 for(int sect=0;sect<12;sect++){
518 
519  for(unsigned int h=0;h<holder.size();h++){
520 
521  int bx = holder[h].first - 6;
522  int sector = holder[h].second.processor();
523  if(holder[h].second.trackFinderType() == 3)
524  sector += 6;
525 
526  if(sector == sect){
527  OutputCands->push_back(bx,holder[h].second);
528  }
529 
530  }
531 }
532 
533 
534 //ev.put( FoundTracks, "DataITC");
535 ev.put( OutputCands, "EMTF");
536  ev.put( OutputHits, "EMTF");
537  ev.put( OutputTracks, "EMTF");
538  //std::cout<<"End Upgraded Track Finder Prducer:::::::::::::::::::::::::::\n:::::::::::::::::::::::::::::::::::::::::::::::::\n\n";
539 
540 }//analyzer
void set_mode(int bits)
Definition: EMTFTrack.h:52
std::vector< EMTFHitExtra > EMTFHitExtraCollection
Definition: EMTFHitExtra.h:94
void set_pt_GMT(int bits)
Definition: EMTFTrack.h:57
void set_neighbor(int bits)
Definition: EMTFHit.h:57
void set_phi_GMT(int bits)
Definition: EMTFTrack.h:65
int i
Definition: DBlmapReader.cc:9
float Phi_loc_rad() const
Definition: EMTFTrack.h:112
int Sector_index() const
Definition: EMTFHit.h:77
void set_bx(int bits)
Definition: EMTFTrack.h:55
SortingOutput SortSect(PatternOutput Pout)
Definition: SortSector.h:11
void set_quality(int bits)
Definition: EMTFTrack.h:54
void set_phi_loc_int(int bits)
Definition: EMTFTrack.h:62
void set_straightness(int bits)
int Strip() const
Definition: EMTFHit.h:84
void set_sector(int bits)
Definition: EMTFTrack.h:49
int Endcap() const
Definition: EMTFTrack.h:96
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
float calc_phi_glob_rad_hit(float loc, int sect_ind)
Definition: EMTFHitTools.h:22
float Phi_loc_deg() const
Definition: EMTFTrack.h:111
void push_HitExtra(EMTFHitExtra bits)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
float calc_phi_loc_rad(int bits)
float calc_theta_deg_from_int(int _theta_int)
Definition: EMTFHitTools.h:16
void set_charge_GMT(int bits)
Definition: EMTFTrack.h:69
void set_charge(int bits)
Definition: EMTFTrack.h:68
int Sector() const
Definition: EMTFTrack.h:97
Geom::Theta< T > theta() const
void setType(unsigned type)
float calculatePt(unsigned long Address)
int First_BX() const
MatchingOutput PhiMatching(SortingOutput Sout)
Definition: Matching.h:12
void set_first_bx(int bits)
std::vector< int > thetas
void set_pt_LUT_addr(unsigned long bits)
Definition: EMTFTrack.h:58
void set_ring(int bits)
Definition: EMTFHit.h:51
int Chamber() const
Definition: EMTFHit.h:79
int calc_sector_GMT(int _sector)
std::vector< PatternOutput > Patterns(std::vector< ZonesOutput > Zones)
U second(std::pair< T, U > const &p)
const int hwQual() const
Get quality code.
void set_pt(float val)
Definition: EMTFTrack.h:56
int calc_sector_from_index(int index)
int Sector() const
Definition: EMTFHit.h:76
void addStub(const TriggerPrimitive &stub)
void ImportPtLUT(int _mode, unsigned long _address)
void push_HitExtraIndex(uint bits)
float calc_phi_loc_deg(int bits)
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > inputTokenCSC
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
int Phi_loc_int() const
Definition: EMTFTrack.h:110
float calc_eta_from_theta_rad(float _theta_rad)
Definition: EMTFHitTools.h:18
void set_theta_deg(float val)
std::vector< EMTFHit > EMTFHitCollection
Definition: EMTFHit.h:130
void set_sector_index(int bits)
Definition: EMTFTrack.h:51
unsigned long calculateAddress(L1TMuon::InternalTrack track, const edm::EventSetup &es, int mode)
l1t::RegionalMuonCand MakeRegionalCand(float pt, int phi, int theta, int sign, int mode, int trackaddress, int sector)
int j
Definition: DBlmapReader.cc:9
std::vector< std::vector< int > > deltas
const int hwEta() const
Get compressed eta (returned int * 0.010875 = eta)
int Ring() const
Definition: EMTFHit.h:75
void set_isGMT(int bits)
void set_thetas(std::vector< int > _thetas)
void set_rank(int bits)
const int hwPhi() const
Get compressed local phi (returned int * 2*pi/576 = local phi in rad)
int getCharge(int phi1, int phi2, int phi3, int phi4, int mode)
void set_theta_int(int bits)
float calc_theta_rad_from_int(int _theta_int)
Definition: EMTFHitTools.h:17
void set_phi_glob_rad(float val)
Definition: EMTFTrack.h:67
void set_eta_GMT(int bits)
Definition: EMTFTrack.h:60
std::vector< int > phis
void ImportCSCDetId(const CSCDetId &_detId)
Definition: EMTFHitTools.cc:21
void set_eta(float val)
Definition: EMTFTrack.h:59
int Station() const
Definition: EMTFHit.h:74
unsigned long Pt_LUT_addr() const
Definition: EMTFTrack.h:106
void set_theta_rad(float val)
float calc_phi_glob_rad(float loc, int sect)
void set_endcap(int bits)
Definition: EMTFTrack.h:48
std::vector< ConvertedHit > convert(std::vector< TriggerPrimitive > TriggPrim, int SectIndex)
float calc_phi_glob_deg_hit(float loc, int sect_ind)
Definition: EMTFHitTools.h:19
void set_pt_XML(float val)
void set_phi_loc_rad(float val)
Definition: EMTFTrack.h:64
std::vector< BTrack > BestTracks(std::vector< std::vector< DeltaOutput >> Dout)
Definition: BestTracks.h:13
const int hwPt() const
Get compressed pT (returned int * 0.5 = pT (GeV))
int Mode() const
Definition: EMTFTrack.h:100
#define NUM_SECTORS
void set_sector_GMT(int bits)
Definition: EMTFTrack.h:50
EMTFTrack CreateEMTFTrack()
std::vector< std::vector< DeltaOutput > > CalcDeltas(MatchingOutput Mout)
Definition: Deltas.h:280
int Endcap() const
Definition: EMTFHit.h:73
void ImportCSCCorrelatedLCTDigi(const CSCCorrelatedLCTDigi &_digi)
Definition: EMTFHitTools.cc:69
std::vector< EMTFTrack > EMTFTrackCollection
Definition: EMTFTrack.h:201
PatternOutput DeleteDuplicatePatterns(std::vector< PatternOutput > Pout)
Definition: BXAnalyzer.h:40
int phi
TEMPORARY ADDITION by G. Brown ///.
std::vector< std::vector< ConvertedHit > > GroupBX(std::vector< ConvertedHit > ConvHits)
Definition: BXAnalyzer.h:14
float calc_phi_glob_deg(float loc, int sect)
constexpr double pi()
Definition: Pi.h:31
std::vector< EMTFTrackExtra > EMTFTrackExtraCollection
void set_phi_loc_deg(float val)
Definition: EMTFTrack.h:63
void set_second_bx(int bits)
std::vector< ZonesOutput > Zones(std::vector< std::vector< ConvertedHit >> Hits)
Definition: ZoneCreation.h:39
void set_phis(std::vector< int > _phis)
void set_phi_glob_deg(float val)
Definition: EMTFTrack.h:66

Member Data Documentation

edm::EDGetTokenT<CSCCorrelatedLCTDigiCollection> L1TMuonEndCapTrackProducer::inputTokenCSC
private

Definition at line 87 of file L1TMuonEndCapTrackProducer.h.

PrimitiveConverter L1TMuonEndCapTrackProducer::primConv_
private

Definition at line 85 of file L1TMuonEndCapTrackProducer.h.

l1t::EmtfPtAssignment L1TMuonEndCapTrackProducer::ptAssignment_
private

Definition at line 88 of file L1TMuonEndCapTrackProducer.h.

const float L1TMuonEndCapTrackProducer::ptscale[33]
Initial value:
= {
-1., 0.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0,
4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 12.0, 14.0,
16.0, 18.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0,
50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 120.0, 140.0, 1.E6 }

Definition at line 77 of file L1TMuonEndCapTrackProducer.h.