31 m_rpcDigis = inrpcDigis;
43 BxToHit(): m_hits{} {}
45 static bool outOfRange(
int iBX) {
46 return (iBX > max_rpc_bx
or iBX < min_rpc_bx);
50 return m_hits[iBX-min_rpc_bx];
53 size_t size()
const {
return m_hits.size(); }
62 std::vector<L1MuDTChambPhDigi> l1ttma_out;
63 std::vector<L1MuDTChambPhDigi> l1ttma_hits_out;
65 std::vector<rpc_hit> vrpc_hit_layer1, vrpc_hit_layer2, vrpc_hit_st3, vrpc_hit_st4;
70 for(
auto digi = (*chamber).second.first ; digi != (*chamber).second.second; ++digi ) {
71 if(detid.
region()!=0 )
continue;
72 if(BxToHit::outOfRange(digi->bx()))
continue;
73 if(detid.
layer()==1) vrpc_hit_layer1.push_back({digi->bx(), detid.station(), detid.sector(), detid.ring(), detid, digi->strip(), detid.roll(), detid.layer()});
74 if(detid.
station()==3) vrpc_hit_st3.push_back({digi->bx(), detid.station(), detid.sector(), detid.ring(), detid, digi->strip(), detid.roll(), detid.layer()});
75 if(detid.
layer()==2) vrpc_hit_layer2.push_back({digi->bx(), detid.station(), detid.sector(), detid.ring(), detid, digi->strip(), detid.roll(), detid.layer()});
76 if(detid.
station()==4) vrpc_hit_st4.push_back({digi->bx(), detid.station(), detid.sector(), detid.ring(), detid, digi->strip(), detid.roll(), detid.layer()});
80 vector<int> vcluster_size ;
84 std::map<RPCHitCleaner::detId_Ext, int>
hits;
88 int strip_n1 = -10000;
90 if(detid.
region()!=0 )
continue;
91 for(
auto digi = (*chamber).second.first ; digi != (*chamber).second.second; ++digi ){
92 if(fabs(digi->bx())>3 )
continue;
95 if(
abs(digi->strip()-strip_n1)!=1 || digi->bx()!=bx_n1){
96 if(itr!=0)vcluster_size.push_back(cluster_size);
105 hits[
tmp] = cluster_id;
107 strip_n1 = digi->strip();
111 vcluster_size.push_back(cluster_size);
115 for(
int wh=-2; wh<=2; wh++){
116 for(
int sec=1; sec<=12; sec++){
117 for(
int st=1; st<=4; st++){
119 std::vector<int> delta_phib;
120 bool found_hits =
false;
121 std::vector<int> rpc2dt_phi, rpc2dt_phib;
125 for(
unsigned int l1=0; l1<vrpc_hit_layer1.size(); l1++){
128 phi1 = radialAngle(vrpc_hit_layer1[l1].detid, c, vrpc_hit_layer1[l1].
strip) ;
129 if(vcluster_size[
id]==2 && itr1==0) {
133 if(vcluster_size[
id]==2 && itr1==1 ) {
135 phi1 = phi1 + (radialAngle(vrpc_hit_layer1[l1-1].detid, c, vrpc_hit_layer1[l1-1].strip));
139 for(
unsigned int l2=0; l2<vrpc_hit_layer2.size(); l2++){
140 if(vrpc_hit_layer1[l1].
station!=st || vrpc_hit_layer2[l2].
station!=st )
continue;
141 if(vrpc_hit_layer1[l1].sector!=sec || vrpc_hit_layer2[l2].sector!=sec )
continue;
142 if(vrpc_hit_layer1[l1].
wheel!=wh || vrpc_hit_layer2[l2].
wheel!=wh )
continue;
143 if(vrpc_hit_layer1[l1].bx!=vrpc_hit_layer2[l2].bx )
continue;
147 if(vcluster_size[
id]==2 && itr2==0) {
153 phi2 = radialAngle(vrpc_hit_layer2[l2].detid, c, vrpc_hit_layer2[l2].strip) ;
154 if(vcluster_size[
id]==2 && itr2==1) {
156 phi2 = phi2 + (radialAngle(vrpc_hit_layer2[l2-1].detid, c, vrpc_hit_layer2[l2-1].strip));
159 int average = ( (phi1 + phi2)/2 )<<2;
160 rpc2dt_phi.push_back(average);
165 int xin = localXX((phi1<<2), 1, vrpc_hit_layer1[l1].
station );
166 int xout = localXX((phi2<<2), 2, vrpc_hit_layer2[l2].station);
167 if(vcluster_size[
id]==2 && itr2==1) {
168 int phi1_n1 = radialAngle(vrpc_hit_layer1[l1-1].detid, c, vrpc_hit_layer1[l1-1].strip);
169 int phi2_n1 = radialAngle(vrpc_hit_layer2[l2-1].detid, c, vrpc_hit_layer2[l2-1].strip);
170 xin += localXX((phi1_n1<<2), 1, vrpc_hit_layer1[l1].station );
171 xout += localXX((phi2_n1<<2), 2, vrpc_hit_layer2[l2].station );
176 int phi_b = bendingAngle(xin,xout,average);
178 rpc2dt_phib.push_back(phi_b);
180 delta_phib.push_back(
abs(phi_b));
182 rpcbx = vrpc_hit_layer1[l1].bx;
187 int min_index =
std::distance(delta_phib.begin(), std::min_element(delta_phib.begin(), delta_phib.end())) + 0;
189 l1ttma_out.emplace_back( rpcbx, wh, sec-1, st, rpc2dt_phi[min_index], rpc2dt_phib[min_index], 3, 0, 0, 2);
195 for(
unsigned int l1=0; l1<vrpc_hit_layer1.size(); l1++){
196 if(vrpc_hit_layer1[l1].
station!=st || st>2 || vrpc_hit_layer1[l1].sector!=sec || vrpc_hit_layer1[l1].
wheel!=wh)
continue;
200 if(vcluster_size[
id]==2 && itr1==0) {
204 int phi2 = radialAngle(vrpc_hit_layer1[l1].detid, c, vrpc_hit_layer1[l1].
strip);
206 if(vcluster_size[
id]==2 && itr1==1 ) {
208 phi2 = phi2 + (radialAngle(vrpc_hit_layer1[l1-1].detid, c, vrpc_hit_layer1[l1-1].strip)<<2);
212 l1ttma_hits_out.emplace_back(vrpc_hit_layer1[l1].bx, wh, sec-1, st, phi2, 0, 3, hit[vrpc_hit_layer1[l1].bx], 0, 2);
213 hit[vrpc_hit_layer1[l1].bx]++;
216 for(
unsigned int l2=0; l2<vrpc_hit_layer2.size(); l2++){
217 if(vrpc_hit_layer2[l2].
station!=st || st>2 || vrpc_hit_layer2[l2].sector!=sec || vrpc_hit_layer2[l2].
wheel!=wh)
continue;
221 if(vcluster_size[
id]==2 && itr1==0) {
225 int phi2 = radialAngle(vrpc_hit_layer2[l2].detid, c, vrpc_hit_layer2[l2].
strip);
227 if(vcluster_size[
id]==2 && itr1==1) {
229 phi2 = phi2 + (radialAngle(vrpc_hit_layer2[l2-1].detid, c, vrpc_hit_layer2[l2-1].strip)<<2);
232 l1ttma_hits_out.emplace_back( vrpc_hit_layer2[l2].bx, wh, sec-1, st, phi2, 0, 3, hit[vrpc_hit_layer2[l2].bx] , 0, 2);
233 hit[vrpc_hit_layer2[l2].bx]++;
238 for(
unsigned int l1=0; l1<vrpc_hit_st3.size(); l1++){
239 if(st!=3 || vrpc_hit_st3[l1].
station!=3 || vrpc_hit_st3[l1].
wheel!=wh || vrpc_hit_st3[l1].sector!=sec)
continue;
243 if(vcluster_size[
id]==2 && itr1==0) {
247 int phi2 = radialAngle(vrpc_hit_st3[l1].detid, c, vrpc_hit_st3[l1].
strip);
249 if(vcluster_size[
id]==2 && itr1==1) {
251 phi2 = phi2 + (radialAngle(vrpc_hit_st3[l1-1].detid, c, vrpc_hit_st3[l1-1].strip)<<2);
254 l1ttma_hits_out.emplace_back( vrpc_hit_st3[l1].bx, wh, sec-1, st, phi2, 0, 3, hit[vrpc_hit_st3[l1].bx], 0, 2);
255 hit[vrpc_hit_st3[l1].bx]++;
260 for(
unsigned int l1=0; l1<vrpc_hit_st4.size(); l1++){
261 if(st!=4 || vrpc_hit_st4[l1].
station!=4 || vrpc_hit_st4[l1].
wheel!=wh || vrpc_hit_st4[l1].sector!=sec)
continue;
265 if(vcluster_size[
id]==2 && itr1==0) {
269 int phi2 = radialAngle(vrpc_hit_st4[l1].detid, c, vrpc_hit_st4[l1].
strip);
271 if(vcluster_size[
id]==2 && itr1==1) {
273 phi2 = phi2 + (radialAngle(vrpc_hit_st4[l1-1].detid, c, vrpc_hit_st4[l1-1].strip)<<2);
276 l1ttma_hits_out.emplace_back(vrpc_hit_st4[l1].bx, wh, sec-1, st, phi2, 0, 3, hit[vrpc_hit_st4[l1].bx] , 0, 2);
277 hit[vrpc_hit_st4[l1].bx]++;
286 m_rpcdt_translated.setContainer(l1ttma_out);
288 m_rpchitsdt_translated.setContainer(l1ttma_hits_out);
304 double globalphi = stripPosition.
phi();
305 int sector = (roll->
id()).sector();
306 if ( sector == 1) radialAngle =
int( globalphi*1024 );
308 if ( globalphi >= 0) radialAngle =
int( (globalphi-(sector-1)*
Geom::pi()/6.)*1024 );
309 else radialAngle =
int( (globalphi+(13-sector)*
Geom::pi()/6.)*1024 );
324 float phip1cm = p1cmPRG.
phi();
325 float phim1cm = m1cmPRG.
phi();
326 int direction = (phip1cm-phim1cm)/
abs(phip1cm-phim1cm);
334 int atanv = (
int)(atan((xout-xin)/34.6) * 512);
335 if(atanv>512)
return 512;
336 int rvalue = atanv - phi/8;
342 double R[2][2] = {{410.0,444.8},{492.7,527.3}};
343 double rvalue = R[station-1][layer-1]*
tan(phi/4096.);
LocalPoint centreOfStrip(int strip) const
Point3DBase< Scalar, LocalTag > LocalPoint
static int bendingAngle(int, int, int)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
T operator[](int i) const
void run(const edm::EventSetup &c)
static int radialAngle(RPCDetId, const edm::EventSetup &, int)
function - will be replaced by LUTs(?)
std::vector< std::vector< double > > tmp
static int localXX(int, int, int)
RPCtoDTTranslator(RPCDigiCollection inrpcDigis)
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
static int localX(RPCDetId, const edm::EventSetup &, int)
function - will be replaced by LUTs(?)