CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
Matching.h File Reference
#include "L1Trigger/L1TMuonEndCap/interface/EmulatorClasses.h"
#include "L1Trigger/L1TMuonEndCap/interface/PhiMemoryImage.h"

Go to the source code of this file.

Functions

MatchingOutput PhiMatching (SortingOutput Sout)
 

Function Documentation

MatchingOutput PhiMatching ( SortingOutput  Sout)

Definition at line 12 of file Matching.h.

References gather_cfg::cout, SortingOutput::Hits(), i, convertSQLitetoXML_cfg::output, AlCaHLTBitMon_ParallelJobs::p, colinearityKinematic::Phi, createTree::pp, lumiQueryAPI::q, ConvertedHit::SetNull(), MatchingOutput::SetValues(), align::Strip, groupFilesInBlocks::tt, w, SortingOutput::Winners(), and detailsBasic3DVector::z.

Referenced by L1TMuonEndCapTrackProducer::produce().

12  {
13 
14  bool verbose = false;
15 
16  std::vector<ConvertedHit> Thits = Sout.Hits();
17  std::vector<std::vector<Winner>> Winners = Sout.Winners();
18  std::vector<int> segment (4,0);
19  int phdiff[4] = {15,15,8,8};
20 
24  ConvertedHit tt; tt.SetNull();
25  std::vector<ConvertedHit> p (4,tt);std::vector<std::vector<ConvertedHit>> pp (3,p);
26  PhOutput ph_output (4,pp);
27 
28 
29  std::vector<ConvertedHit> q (2,tt);
30  std::vector<std::vector<ConvertedHit>> qq (4,q);std::vector<std::vector<std::vector<ConvertedHit>>> qqq (3,qq);
31  ThOutput th_output (4,qqq);
35 
36 
37 
38  for(int z=0;z<4;z++){//zone loop
39 
40  for(int w=0;w<3;w++){//winner loop
41 
42  if(Winners[z][w].Rank()){//is there a winner present?
43 
44  if(verbose) std::cout<<"\n\nWinner position-"<<Winners[z][w].Strip()<<". Zone = "<<z<<std::endl;
45 
46  for(std::vector<ConvertedHit>::iterator i = Thits.begin();i != Thits.end();i++){//Possible associated hits
47 
48  //int id = i->Id();
49 
50  if(verbose) std::cout<<"strip = "<<i->Strip()<<", keywire = "<<i->Wire()<<" and zhit-"<<i->Zhit()<<std:: endl;
51 
52  // Unused variable
53  /* bool inzone = 0;///Is the converted hit in the zone we're looking at now? */
54  /* for(std::vector<int>::iterator znc = i->ZoneContribution().begin();znc != i->ZoneContribution().end();znc++){ */
55  /* if((*znc) == z) */
56  /* inzone = 1;//yes */
57  /* } */
58 
62  int setstation = i->Station() - 1;
63  //bool one = ((z == 3) && (i->Station() > 1)); //Zone 3 is handled differently so we
64  //bool two = ((z == 3) && (i->Station() == 1) && (id > 3)); //have this conditions here
65  bool setphi = 0;
66  //if(one || two)
67  // setstation++;
68 
69  if(verbose)
70  std::cout<<"setstation = "<<setstation<<std::endl;
71 
72  if((fabs((Winners[z][w].Strip()) - i->Zhit()) <= phdiff[setstation]) ){//is close to winner keystrip and in same zone?
73 
74  if(ph_output[z][w][setstation].Phi() == -999){//has this already been set? no
75 
76  if(verbose) std::cout<<"hasn't been set"<<std::endl;
77 
78  ph_output[z][w][setstation] = (*i);
79 
80  if(verbose) std::cout<<"set with strip-"<<i->Strip()<<", and wire-"<<i->Wire()<<std::endl;
81  setphi = true;
82  }
83  else{//if yes, find absolute difference between zhit of each hit and keystrip
84 
85  if(verbose) std::cout<<"has already been set"<<std::endl;
86 
87  int d1 = fabs(ph_output[z][w][setstation].Zhit() - Winners[z][w].Strip());
88  int d2 = fabs(i->Zhit() - Winners[z][w].Strip());
89 
90  if(d2 < d1){//if new hit is closer then replace phi
91 
92  if(verbose) std::cout<<"this is closer strip-"<<i->Strip()<<", and wire-"<<i->Wire()<<std::endl;
93 
94  ph_output[z][w][setstation] = (*i);
95 
96  setphi = true;
97 
98  }
99 
100  }
101 
102 
106 
107  if(setphi)//only set if phi was also set
108  th_output[z][w][setstation][0] = (*i);
109 
110  if((th_output[z][w][setstation][0].Theta() != -999) && (th_output[z][w][setstation][0].Id() == i->Id()))//if same chamber take as well
111  th_output[z][w][setstation][1] = (*i);
112 
113 
114  }
115  }
116 
117 
118  }
119 
120  }
121  }
122 
124  output.SetValues(th_output,ph_output,Thits,Winners,segment);
125 
126  return output;
127 }
int i
Definition: DBlmapReader.cc:9
const double w
Definition: UKUtility.cc:23
tuple pp
Definition: createTree.py:15
float float float z
std::vector< std::vector< Winner > > Winners()
void SetValues(ThOutput th_output, PhOutput ph_output, std::vector< ConvertedHit > hits, std::vector< std::vector< Winner >> winners, std::vector< int > segment)
std::vector< std::vector< std::vector< std::vector< ConvertedHit > > > > ThOutput
std::vector< std::vector< std::vector< ConvertedHit > > > PhOutput
tuple cout
Definition: gather_cfg.py:145
std::vector< ConvertedHit > Hits()