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 37 of file L1TMuonEndCapTrackProducer.cc.

References edm::ParameterSet::getParameter().

37  {
38 
39  inputTokenCSC = consumes<CSCCorrelatedLCTDigiCollection>(p.getParameter<edm::InputTag>("CSCInput"));
40 
41  produces<l1t::RegionalMuonCandBxCollection >("EMTF");
42 }
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 347 of file L1TMuonEndCapTrackProducer.cc.

348 {
349 
350 }
void L1TMuonEndCapTrackProducer::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 351 of file L1TMuonEndCapTrackProducer.cc.

352 {
353 
354 }
void L1TMuonEndCapTrackProducer::produce ( edm::Event ev,
const edm::EventSetup es 
)
virtual

Sorting through all sectors //// to find 4 best muons ////

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

Implements edm::EDProducer.

Definition at line 45 of file L1TMuonEndCapTrackProducer.cc.

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

46  {
47 
48  //bool verbose = false;
49 
50 
51  //std::cout<<"Start Upgraded Track Finder Producer::::: event = "<<ev.id().event()<<"\n\n";
52 
53  //fprintf (write,"12345\n"); //<-- part of printing text file to send verilog code, not needed if George's package is included
54 
55 
56  //std::auto_ptr<L1TMuon::InternalTrackCollection> FoundTracks (new L1TMuon::InternalTrackCollection);
57  std::auto_ptr<l1t::RegionalMuonCandBxCollection > OutputCands (new l1t::RegionalMuonCandBxCollection);
58 
59  std::vector<BTrack> PTracks[NUM_SECTORS];
60 
61  std::vector<TriggerPrimitive> tester;
62  //std::vector<InternalTrack> FoundTracks;
63 
64 
68 
70  ev.getByToken(inputTokenCSC, MDC);
71  std::vector<TriggerPrimitive> out;
72 
73  auto chamber = MDC->begin();
74  auto chend = MDC->end();
75  for( ; chamber != chend; ++chamber ) {
76  auto digi = (*chamber).second.first;
77  auto dend = (*chamber).second.second;
78  for( ; digi != dend; ++digi ) {
79  out.push_back(TriggerPrimitive((*chamber).first,*digi));
80  }
81  }
82 
83 
87 
88  // auto tpsrc = _tpinputs.cbegin();
89  //auto tpend = _tpinputs.cend();
90  // for( ; tpsrc != tpend; ++tpsrc ) {
91  // edm::Handle<TriggerPrimitiveCollection> tps;
92  // ev.getByLabel(*tpsrc,tps);
93  auto tp = out.cbegin();
94  auto tpend = out.cend();
95 
96  for( ; tp != tpend; ++tp ) {
97  if(tp->subsystem() == 1)
98  {
99  //TriggerPrimitiveRef tpref(out,tp - out.cbegin());
100 
101  tester.push_back(*tp);
102 
103  //if(verbose) std::cout<<"\ntrigger prim found station:"<<tp->detId<CSCDetId>().station()<<std::endl;
104  }
105 
106  }
107  //}
108  std::vector<ConvertedHit> CHits[NUM_SECTORS];
110 
111 for(int SectIndex=0;SectIndex<NUM_SECTORS;SectIndex++){//perform TF on all 12 sectors
112 
113 
114 
118 
119 
120  std::vector<ConvertedHit> ConvHits = PrimConv(tester,SectIndex);
121  CHits[SectIndex] = ConvHits;
122 
123 
126  //for(std::vector<ConvertedHit>::iterator h = ConvHits.begin();h != ConvHits.end();h++){
127 
128  //if((h->Id()) > 9){h->SetId(h->Id() - 9);h->SetStrip(h->Strip() + 128);}
129  //fprintf (write,"0 1 1 %d %d\n",h->Sub(),h->Station());
130  //fprintf (write,"1 %d %d %d\n",h->Quality(),h->Pattern(),h->Wire());
131  //fprintf (write,"%d 0 %d\n",h->Id(),h->Strip());
132  //}
135 
136 
137 
143 
144 
145  std::vector<std::vector<ConvertedHit>> GroupedHits = GroupBX(ConvHits);
146 
147 
151 
152  std::vector<ZonesOutput> Zout = Zones(GroupedHits);
153 
154 
159 
160 
161  std::vector<PatternOutput> Pout = Patterns(Zout);
162 
164 
165  //PrintQuality(Test.detected);
166 
167 
172 
173 
174  SortingOutput Sout = SortSect(Test);
175 
176 
181 
182 
183  MatchingOutput Mout = PhiMatching(Sout);
184  MO[SectIndex] = Mout;
185 
190 
191 
192  std::vector<std::vector<DeltaOutput>> Dout = CalcDeltas(Mout);
193 
194 
199 
200 
201  std::vector<BTrack> Bout = BestTracks(Dout);
202  PTracks[SectIndex] = Bout;
203 
204 
205 
206  }
207 
212 
213 
214  BTrack FourBest[4];//ok
215  std::vector<BTrack> PTemp[NUM_SECTORS];
216  for (int i=0; i<NUM_SECTORS; i++) PTemp[i] = PTracks[i];
217 
218  int windex[4] = {-1,-1,-1,-1};
219 
220 
221 
222  for(int i=0;i<4;i++){
223 
224  for(int j=0;j<36;j++){
225 
226 
227  if(!PTemp[j/3][j%3].phi)//no track
228  continue;
229 
230  if((windex[0] == j) || (windex[1] == j) || (windex[2] == j) || (windex[3] == j))//already picked
231  continue;
232 
233  if(PTracks[j/3][j%3].winner.Rank() > FourBest[i].winner.Rank()){
234 
235  FourBest[i] = PTemp[j/3][j%3];
236  windex[i] = j;
237 
238  }
239 
240  }
241 }
242 
247 
248  for(int fbest=0;fbest<4;fbest++){
249 
250  if(FourBest[fbest].phi){
251 
252 
253  InternalTrack tempTrack;
254  tempTrack.setType(2);
255  tempTrack.phi = FourBest[fbest].phi;
256  tempTrack.theta = FourBest[fbest].theta;
257  tempTrack.rank = FourBest[fbest].winner.Rank();
258  tempTrack.deltas = FourBest[fbest].deltas;
259  std::vector<int> ps, ts;
260 
261 
262  int sector = -1;
263  bool ME13 = false;
264  int me1address = 0, me2address = 0, CombAddress = 0, mode = 0;
265 
266  for(std::vector<ConvertedHit>::iterator A = FourBest[fbest].AHits.begin();A != FourBest[fbest].AHits.end();A++){
267 
268  if(A->Phi() != -999){
269 
270  int station = A->TP().detId<CSCDetId>().station();
271  int id = A->TP().getCSCData().cscID;
272  int trknm = A->TP().getCSCData().trknmb;
273 
274  tempTrack.addStub(A->TP());
275  ps.push_back(A->Phi());
276  ts.push_back(A->Theta());
277  sector = (A->TP().detId<CSCDetId>().endcap() -1)*6 + A->TP().detId<CSCDetId>().triggerSector() - 1;
278  //std::cout<<"Q: "<<A->Quality()<<", keywire: "<<A->Wire()<<", strip: "<<A->Strip()<<std::endl;
279 
280  switch(station){
281  case 1: mode |= 8;break;
282  case 2: mode |= 4;break;
283  case 3: mode |= 2;break;
284  case 4: mode |= 1;break;
285  default: mode |= 0;
286  }
287 
288 
289  if(A->TP().detId<CSCDetId>().station() == 1 && A->TP().detId<CSCDetId>().ring() == 3)
290  ME13 = true;
291 
292  if(station == 1 && id > 3 && id < 7){
293 
294  int sub = 2;
295  if(A->TP().detId<CSCDetId>().chamber()%6 > 2)
296  sub = 1;
297 
298  me1address = id;
299  me1address -= 3;
300  me1address += 3*(sub - 1);
301  me1address = id<<1;//
302  me1address |= trknm-1;
303 
304  }
305 
306  if(station == 2 && id > 3){
307 
308  me2address = id;
309  me2address -= 3;
310  me2address = me2address<<1;
311  me2address |= trknm-1;
312 
313  }
314 
315 
316  }
317 
318  }
319  tempTrack.phis = ps;
320  tempTrack.thetas = ts;
321 
322  float xmlpt = CalculatePt(tempTrack,es);
323  tempTrack.pt = xmlpt*1.4;
324  //FoundTracks->push_back(tempTrack);
325 
326  CombAddress = (me2address<<4) | me1address;
327 
328 
329  l1t::RegionalMuonCand outCand = MakeRegionalCand(xmlpt*1.4,FourBest[fbest].phi,FourBest[fbest].theta,
330  CombAddress,mode,1,sector);
331  // NOTE: assuming that all candidates come from the central BX:
332  int bx = 0;
333  float theta_angle = (FourBest[fbest].theta*0.2851562 + 8.5)*(3.14159265359/180);
334  float eta = (-1)*log(tan(theta_angle/2));
335  if(!ME13 && fabs(eta) > 1.1)
336  OutputCands->push_back(bx, outCand);
337  }
338  }
339 
340 
341 //ev.put( FoundTracks, "DataITC");
342 ev.put( OutputCands, "EMTF");
343  //std::cout<<"End Upgraded Track Finder Prducer:::::::::::::::::::::::::::\n:::::::::::::::::::::::::::::::::::::::::::::::::\n\n";
344 
345 }//analyzer
int i
Definition: DBlmapReader.cc:9
SortingOutput SortSect(PatternOutput Pout)
Definition: SortSector.h:11
int Rank()
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)
Winner winner
MatchingOutput PhiMatching(SortingOutput Sout)
Definition: Matching.h:12
std::vector< int > thetas
std::vector< PatternOutput > Patterns(std::vector< ZonesOutput > Zones)
std::vector< std::vector< int > > deltas
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
std::vector< ConvertedHit > AHits
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
int j
Definition: DBlmapReader.cc:9
std::vector< std::vector< int > > deltas
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:42
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.