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
 

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 45 of file L1TMuonEndCapTrackProducer.h.

Constructor & Destructor Documentation

L1TMuonEndCapTrackProducer::L1TMuonEndCapTrackProducer ( const PSet p)

Definition at line 38 of file L1TMuonEndCapTrackProducer.cc.

References edm::ParameterSet::getParameter().

38  {
39 
40  inputTokenCSC = consumes<CSCCorrelatedLCTDigiCollection>(p.getParameter<edm::InputTag>("CSCInput"));
41 
42  produces<l1t::RegionalMuonCandBxCollection >("EMTF");
43 }
T getParameter(std::string const &) const
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > inputTokenCSC
L1TMuonEndCapTrackProducer::~L1TMuonEndCapTrackProducer ( )
inline

Definition at line 48 of file L1TMuonEndCapTrackProducer.h.

48 {}

Member Function Documentation

void L1TMuonEndCapTrackProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 369 of file L1TMuonEndCapTrackProducer.cc.

370 {
371 
372 }
void L1TMuonEndCapTrackProducer::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 373 of file L1TMuonEndCapTrackProducer.cc.

374 {
375 
376 }
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 46 of file L1TMuonEndCapTrackProducer.cc.

References funct::A, L1TMuon::InternalTrack::addStub(), BestTracks(), CalcDeltas(), CalculatePt(), RecoTauCleanerPlugins::charge, DeleteDuplicatePatterns(), L1TMuon::InternalTrack::deltas, Reference_intrackfit_cff::endcap, eta, edm::Event::getByToken(), getCharge(), GroupBX(), h, i, j, dqm-mbProfile::log, MakeRegionalCand(), Reference_intrackfit_cff::ME13, alignBH_cfg::mode, NUM_SECTORS, GenerateHcalLaserBadRunList::out, Patterns(), L1TMuon::InternalTrack::phi, phi(), PhiMatching(), L1TMuon::InternalTrack::phis, PrimConv(), L1TMuon::InternalTrack::pt, edm::Event::put(), L1TMuon::InternalTrack::rank, relativeConstraints::ring, edm::second(), L1TMuon::InternalTrack::setType(), SortSect(), relativeConstraints::station, funct::tan(), L1TMuon::InternalTrack::theta, theta(), L1TMuon::InternalTrack::thetas, triggerSector(), and Zones().

47  {
48 
49  //bool verbose = false;
50 
51 
52  //std::cout<<"Start Upgraded Track Finder Producer::::: event = "<<ev.id().event()<<"\n\n";
53 
54  //fprintf (write,"12345\n"); //<-- part of printing text file to send verilog code, not needed if George's package is included
55 
56 
57  //std::auto_ptr<L1TMuon::InternalTrackCollection> FoundTracks (new L1TMuon::InternalTrackCollection);
58  std::auto_ptr<l1t::RegionalMuonCandBxCollection > OutputCands (new l1t::RegionalMuonCandBxCollection);
59 
60  std::vector<BTrack> PTracks[NUM_SECTORS];
61 
62  std::vector<TriggerPrimitive> tester;
63  //std::vector<InternalTrack> FoundTracks;
64 
65 
69 
71  ev.getByToken(inputTokenCSC, MDC);
72  std::vector<TriggerPrimitive> out;
73 
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 ) {
80  out.push_back(TriggerPrimitive((*chamber).first,*digi));
81  }
82  }
83 
84 
88 
89  // auto tpsrc = _tpinputs.cbegin();
90  //auto tpend = _tpinputs.cend();
91  // for( ; tpsrc != tpend; ++tpsrc ) {
92  // edm::Handle<TriggerPrimitiveCollection> tps;
93  // ev.getByLabel(*tpsrc,tps);
94  auto tp = out.cbegin();
95  auto tpend = out.cend();
96 
97  for( ; tp != tpend; ++tp ) {
98  if(tp->subsystem() == 1)
99  {
100  //TriggerPrimitiveRef tpref(out,tp - out.cbegin());
101 
102  tester.push_back(*tp);
103 
104  //std::cout<<"\ntrigger prim found station:"<<tp->detId<CSCDetId>().station()<<std::endl;
105  }
106 
107  }
108  //}
109  std::vector<ConvertedHit> CHits[NUM_SECTORS];
111 
112 for(int SectIndex=0;SectIndex<NUM_SECTORS;SectIndex++){//perform TF on all 12 sectors
113 
114 
115 
119 
120 
121  std::vector<ConvertedHit> ConvHits = PrimConv(tester,SectIndex);
122  CHits[SectIndex] = ConvHits;
123 
124 
127  //for(std::vector<ConvertedHit>::iterator h = ConvHits.begin();h != ConvHits.end();h++){
128 
129  //if((h->Id()) > 9){h->SetId(h->Id() - 9);h->SetStrip(h->Strip() + 128);}
130  //fprintf (write,"0 1 1 %d %d\n",h->Sub(),h->Station());
131  //fprintf (write,"1 %d %d %d\n",h->Quality(),h->Pattern(),h->Wire());
132  //fprintf (write,"%d 0 %d\n",h->Id(),h->Strip());
133  //}
136 
137 
138 
144 
145 
146  std::vector<std::vector<ConvertedHit>> GroupedHits = GroupBX(ConvHits);
147 
148 
152 
153  std::vector<ZonesOutput> Zout = Zones(GroupedHits);
154 
155 
160 
161 
162  std::vector<PatternOutput> Pout = Patterns(Zout);
163 
165 
166  //PrintQuality(Test.detected);
167 
168 
173 
174 
175  SortingOutput Sout = SortSect(Test);
176 
177 
182 
183 
184  MatchingOutput Mout = PhiMatching(Sout);
185  MO[SectIndex] = Mout;
186 
191 
192 
193  std::vector<std::vector<DeltaOutput>> Dout = CalcDeltas(Mout);
194 
195 
200 
201 
202  std::vector<BTrack> Bout = BestTracks(Dout);
203  PTracks[SectIndex] = Bout;
204 
205 
206 
207  }
208 
212 
213  std::vector<BTrack> PTemp[NUM_SECTORS];
214  std::vector<BTrack> AllTracks;
215  for (int i=0; i<NUM_SECTORS; i++) PTemp[i] = PTracks[i];
216 
217 
218  for(int j=0;j<36;j++){
219 
220 
221  if(PTemp[j/3][j%3].phi)//no track
222  AllTracks.push_back(PTemp[j/3][j%3]);
223 
224 
225 
226  }
227 
232 
233  std::vector<l1t::RegionalMuonCand> tester1;
234  std::vector<std::pair<int,l1t::RegionalMuonCand>> holder;
235 
236  for(unsigned int fbest=0;fbest<AllTracks.size();fbest++){
237 
238  if(AllTracks[fbest].phi){
239 
240 
241  InternalTrack tempTrack;
242  tempTrack.setType(2);
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;
248 
249 
250  int sector = -1;
251  bool ME13 = false;
252  int me1address = 0, me2address = 0, CombAddress = 0, mode = 0;
253  int ebx = 20, sebx = 20;
254  int phis[4] = {-99,-99,-99,-99};
255 
256  for(std::vector<ConvertedHit>::iterator A = AllTracks[fbest].AHits.begin();A != AllTracks[fbest].AHits.end();A++){
257 
258  if(A->Phi() != -999){
259 
260  int station = A->TP().detId<CSCDetId>().station();
261  int id = A->TP().getCSCData().cscID;
262  int trknm = A->TP().getCSCData().trknmb;//A->TP().getCSCData().bx
263 
264  phis[station-1] = A->Phi();
265 
266 
267  if(A->TP().getCSCData().bx < ebx){
268  sebx = ebx;
269  ebx = A->TP().getCSCData().bx;
270  }
271  else if(A->TP().getCSCData().bx < sebx){
272  sebx = A->TP().getCSCData().bx;
273  }
274 
275  tempTrack.addStub(A->TP());
276  ps.push_back(A->Phi());
277  ts.push_back(A->Theta());
278  sector = (A->TP().detId<CSCDetId>().endcap() -1)*6 + A->TP().detId<CSCDetId>().triggerSector() - 1;
279  //std::cout<<"Q: "<<A->Quality()<<", keywire: "<<A->Wire()<<", strip: "<<A->Strip()<<std::endl;
280 
281  switch(station){
282  case 1: mode |= 8;break;
283  case 2: mode |= 4;break;
284  case 3: mode |= 2;break;
285  case 4: mode |= 1;break;
286  default: mode |= 0;
287  }
288 
289 
290  if(A->TP().detId<CSCDetId>().station() == 1 && A->TP().detId<CSCDetId>().ring() == 3)
291  ME13 = true;
292 
293  if(station == 1 && id > 3 && id < 7){
294 
295  int sub = 2;
296  if(A->TP().detId<CSCDetId>().chamber()%6 > 2)
297  sub = 1;
298 
299  me1address = id;
300  me1address -= 3;
301  me1address += 3*(sub - 1);
302  me1address = id<<1;//
303  me1address |= trknm-1;
304 
305  }
306 
307  if(station == 2 && id > 3){
308 
309  me2address = id;
310  me2address -= 3;
311  me2address = me2address<<1;
312  me2address |= trknm-1;
313 
314  }
315 
316 
317  }
318 
319  }
320  tempTrack.phis = ps;
321  tempTrack.thetas = ts;
322 
323  float xmlpt = CalculatePt(tempTrack,es);
324  tempTrack.pt = xmlpt*1.4;
325  //FoundTracks->push_back(tempTrack);
326 
327  CombAddress = (me2address<<4) | me1address;
328 
329  int charge = getCharge(phis[0],phis[1],phis[2],phis[3],mode);
330 
331  l1t::RegionalMuonCand outCand = MakeRegionalCand(xmlpt*1.4,AllTracks[fbest].phi,AllTracks[fbest].theta,
332  charge,mode,CombAddress,sector);
333  // NOTE: assuming that all candidates come from the central BX:
334  //int bx = 0;
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);
338 
339  if(!ME13 && fabs(eta) > 1.1)
340  holder.push_back(outPair);
341  }
342  }
343 
344 OutputCands->setBXRange(-2,2);
345 
346 for(int sect=0;sect<12;sect++){
347 
348  for(unsigned int h=0;h<holder.size();h++){
349 
350  int bx = holder[h].first - 6;
351  int sector = holder[h].second.processor();
352  if(holder[h].second.trackFinderType() == 3)
353  sector += 6;
354 
355  if(sector == sect){
356  OutputCands->push_back(bx,holder[h].second);
357  }
358 
359  }
360 }
361 
362 
363 //ev.put( FoundTracks, "DataITC");
364 ev.put( OutputCands, "EMTF");
365  //std::cout<<"End Upgraded Track Finder Prducer:::::::::::::::::::::::::::\n:::::::::::::::::::::::::::::::::::::::::::::::::\n\n";
366 
367 }//analyzer
int i
Definition: DBlmapReader.cc:9
SortingOutput SortSect(PatternOutput Pout)
Definition: SortSector.h:11
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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)
Definition: Matching.h:12
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)
Definition: PtAssignment.h:958
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > inputTokenCSC
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
int j
Definition: DBlmapReader.cc:9
std::vector< std::vector< int > > deltas
int getCharge(int phi1, int phi2, int phi3, int phi4, int mode)
std::vector< int > phis
std::vector< ConvertedHit > PrimConv(std::vector< TriggerPrimitive > TriggPrim, int SectIndex)
std::vector< BTrack > BestTracks(std::vector< std::vector< DeltaOutput >> Dout)
Definition: BestTracks.h:13
#define NUM_SECTORS
std::vector< std::vector< DeltaOutput > > CalcDeltas(MatchingOutput Mout)
Definition: Deltas.h:280
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
std::vector< ZonesOutput > Zones(std::vector< std::vector< ConvertedHit >> Hits)
Definition: ZoneCreation.h:39
Int_t triggerSector(Int_t station, Int_t ring, Int_t chamber) const

Member Data Documentation

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

Definition at line 81 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 72 of file L1TMuonEndCapTrackProducer.h.