13 std::vector<RecHitProcessor::CppfItem>& CppfVec1,
15 const int MaxClusterSize
25 for ( TrackingGeometry::DetContainer::const_iterator iDet = rpcGeom->
dets().begin(); iDet < rpcGeom->
dets().end(); iDet++ ) {
28 if (dynamic_cast<const RPCChamber*>( *iDet ) ==
nullptr )
continue;
30 auto chamb =
dynamic_cast<const RPCChamber*
>( *iDet );
32 std::vector<const RPCRoll*> rolls = (chamb->rolls());
35 for(
auto& iRoll : rolls){
41 typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
42 rangeRecHits recHitCollection = recHits->get(rpcId);
50 int rawId = rpcId.
rawId();
52 int Bx = rechit_it->BunchX();
53 int isValid = rechit_it->isValid();
54 int firststrip = rechit_it->firstClusterStrip();
55 int clustersize = rechit_it->clusterSize();
64 int rechitstrip = firststrip;
68 if (clustersize % 2 == 0) medium = 0.5*(clustersize);
69 else medium = 0.5*(clustersize-1);
70 rechitstrip += medium;
73 if(clustersize > MaxClusterSize)
continue;
82 if ((global_phi > 15.) && (global_phi <= 16.3)) {
86 else if ((global_phi > 16.3) && (global_phi <= 53.)) {
90 else if ((global_phi > 53.) && (global_phi <= 75.)) {
95 else if ((global_phi > 75.) && (global_phi <= 76.3)) {
99 else if ((global_phi > 76.3) && (global_phi <= 113.)) {
103 else if ((global_phi > 113.) && (global_phi <= 135.)) {
109 else if ((global_phi > 135.) && (global_phi <= 136.3)) {
113 else if ((global_phi > 136.3) && (global_phi <= 173.)) {
117 else if ((global_phi > 173.) && (global_phi <= 180.)) {
122 else if ((global_phi < -165.) && (global_phi >= -180.)) {
127 else if ((global_phi > -165.) && (global_phi <= -163.7)) {
131 else if ((global_phi > -163.7) && (global_phi <= -127.)) {
135 else if ((global_phi > -127.) && (global_phi <= -105.)) {
140 else if ((global_phi > -105.) && (global_phi <= -103.7)) {
144 else if ((global_phi > -103.7) && (global_phi <= -67.)) {
148 else if ((global_phi > -67.) && (global_phi <= -45.)) {
153 else if ((global_phi > -45.) && (global_phi <= -43.7)) {
157 else if ((global_phi > -43.7) && (global_phi <= -7.)) {
161 else if ((global_phi > -7.) && (global_phi <= 15.)) {
172 double EMTFLink1 = 0.;
173 double EMTFLink2 = 0.;
175 std::vector<RecHitProcessor::CppfItem>::iterator cppf1;
176 std::vector<RecHitProcessor::CppfItem>::iterator cppf;
177 for(cppf1 = CppfVec1.begin(); cppf1 != CppfVec1.end(); cppf1++){
182 if(((*cppf1).rawId == rawId) && ((*cppf1).strip == rechitstrip)){
184 int old_strip = (*cppf1).strip;
188 if(cppf1 != CppfVec1.begin())
189 before = (*(cppf1-2)).
strip;
191 else if (cppf1 == CppfVec1.begin())
192 before = (*cppf1).strip;
194 if(cppf1 != CppfVec1.end())
195 after = (*(cppf1+2)).
strip;
197 else if (cppf1 == CppfVec1.end())
198 after = (*cppf1).strip;
202 if(clustersize == 2){
205 if(before < after) cppf=(cppf1-1);
206 else if (before > after) cppf=(cppf1+1);
208 else if(firststrip > 1){
209 if(before < after) cppf=(cppf1+1);
210 else if (before > after) cppf=(cppf1-1);
216 std::shared_ptr<l1t::CPPFDigi> MainVariables1(
new l1t::CPPFDigi(rpcId, Bx , (*cppf).int_phi, (*cppf).int_theta, isValid, (*cppf).lb, (*cppf).halfchannel, EMTFsector1, EMTFLink1, old_strip, clustersize, global_phi, global_theta));
217 std::shared_ptr<l1t::CPPFDigi> MainVariables2(
new l1t::CPPFDigi(rpcId, Bx , (*cppf).int_phi, (*cppf).int_theta, isValid, (*cppf).lb, (*cppf).halfchannel, EMTFsector2, EMTFLink2, old_strip, clustersize, global_phi, global_theta));
219 if ((EMTFsector1 > 0) && (EMTFsector2 == 0)){
220 cppfDigis.push_back(*MainVariables1.get());
222 else if ((EMTFsector1 > 0) && (EMTFsector2 > 0)){
223 cppfDigis.push_back(*MainVariables1.get());
224 cppfDigis.push_back(*MainVariables2.get());
226 else if ((EMTFsector1 == 0) && (EMTFsector2 == 0)) {
233 std::shared_ptr<l1t::CPPFDigi> MainVariables1(
new l1t::CPPFDigi(rpcId, Bx , (*cppf).int_phi, (*cppf).int_theta, isValid, (*cppf).lb, (*cppf).halfchannel, EMTFsector1, EMTFLink1, old_strip, clustersize, global_phi, global_theta));
234 std::shared_ptr<l1t::CPPFDigi> MainVariables2(
new l1t::CPPFDigi(rpcId, Bx , (*cppf).int_phi, (*cppf).int_theta, isValid, (*cppf).lb, (*cppf).halfchannel, EMTFsector2, EMTFLink2, old_strip, clustersize, global_phi, global_theta));
235 if ((EMTFsector1 > 0) && (EMTFsector2 == 0)){
236 cppfDigis.push_back(*MainVariables1.get());
238 else if ((EMTFsector1 > 0) && (EMTFsector2 > 0)){
239 cppfDigis.push_back(*MainVariables1.get());
240 cppfDigis.push_back(*MainVariables2.get());
242 else if ((EMTFsector1 == 0) && (EMTFsector2 == 0)) {
272 for ( TrackingGeometry::DetContainer::const_iterator iDet = rpcGeom->
dets().begin(); iDet < rpcGeom->
dets().end(); iDet++ ) {
275 if (dynamic_cast<const RPCChamber*>( *iDet ) ==
nullptr )
continue;
277 auto chamb =
dynamic_cast<const RPCChamber*
>( *iDet );
278 std::vector<const RPCRoll*> rolls = (chamb->rolls());
281 for(
auto& iRoll : rolls){
285 typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
286 rangeRecHits recHitCollection = recHits->get(rpcId);
293 int region = rpcId.
region();
295 int Bx = rechit_it->BunchX();
296 int isValid = rechit_it->isValid();
297 int firststrip = rechit_it->firstClusterStrip();
298 int clustersize = rechit_it->clusterSize();
309 int int_theta = (region == -1 ? 180. * 32. / 36.5 : 0.)
310 + (
float)region * global_theta * 32. / 36.5
314 if(global_theta < 8.5) int_theta = 0;
315 if(global_theta > 45.) int_theta = 31;
317 else if(region == -1) {
318 if(global_theta < 135.) int_theta = 31;
319 if(global_theta > 171.5) int_theta = 0;
323 double local_phi = 0.;
328 if ((global_phi > 15.) && (global_phi <= 16.3)) {
329 local_phi = global_phi-15.;
333 else if ((global_phi > 16.3) && (global_phi <= 53.)) {
334 local_phi = global_phi-15.;
338 else if ((global_phi > 53.) && (global_phi <= 75.)) {
339 local_phi = global_phi-15.;
344 else if ((global_phi > 75.) && (global_phi <= 76.3)) {
345 local_phi = global_phi-15.;
349 else if ((global_phi > 76.3) && (global_phi <= 113.)) {
350 local_phi = global_phi-75.;
354 else if ((global_phi > 113.) && (global_phi <= 135.)) {
355 local_phi = global_phi-75.;
361 else if ((global_phi > 135.) && (global_phi <= 136.3)) {
362 local_phi = global_phi-75.;
366 else if ((global_phi > 136.3) && (global_phi <= 173.)) {
367 local_phi = global_phi-135.;
371 else if ((global_phi > 173.) && (global_phi <= 180.)) {
372 local_phi = global_phi-135.;
377 else if ((global_phi < -165.) && (global_phi >= -180.)) {
378 local_phi = global_phi+225.;
383 else if ((global_phi > -165.) && (global_phi <= -163.7)) {
384 local_phi = global_phi+225.;
388 else if ((global_phi > -163.7) && (global_phi <= -127.)) {
389 local_phi = global_phi+165.;
393 else if ((global_phi > -127.) && (global_phi <= -105.)) {
394 local_phi = global_phi+165.;
399 else if ((global_phi > -105.) && (global_phi <= -103.7)) {
400 local_phi = global_phi+165.;
404 else if ((global_phi > -103.7) && (global_phi <= -67.)) {
405 local_phi = global_phi+105.;
409 else if ((global_phi > -67.) && (global_phi <= -45.)) {
410 local_phi = global_phi+105.;
415 else if ((global_phi > -45.) && (global_phi <= -43.7)) {
416 local_phi = global_phi+105.;
420 else if ((global_phi > -43.7) && (global_phi <= -7.)) {
421 local_phi = global_phi+45.;
425 else if ((global_phi > -7.) && (global_phi <= 15.)) {
426 local_phi = global_phi+45.;
431 int int_phi =
int((local_phi + 22.0 )*15. + .5);
433 double EMTFLink1 = 0.;
434 double EMTFLink2 = 0.;
436 double halfchannel = 0.;
439 if (isValid == 0) int_phi = 2047;
441 assert(0 <= int_phi && int_phi < 1250);
442 assert(0 <= int_theta && int_theta < 32);
444 std::shared_ptr<l1t::CPPFDigi> MainVariables1(
new l1t::CPPFDigi(rpcId, Bx , int_phi, int_theta, isValid, lb, halfchannel, EMTFsector1, EMTFLink1, firststrip, clustersize, global_phi, global_theta));
445 std::shared_ptr<l1t::CPPFDigi> MainVariables2(
new l1t::CPPFDigi(rpcId, Bx , int_phi, int_theta, isValid, lb, halfchannel, EMTFsector2, EMTFLink2, firststrip, clustersize, global_phi, global_theta));
446 if(int_theta == 31)
continue;
447 if ((EMTFsector1 > 0) && (EMTFsector2 == 0)){
448 cppfDigis.push_back(*MainVariables1.get());
450 if ((EMTFsector1 > 0) && (EMTFsector2 > 0)){
451 cppfDigis.push_back(*MainVariables1.get());
452 cppfDigis.push_back(*MainVariables2.get());
454 if ((EMTFsector1 == 0) && (EMTFsector2 == 0)){
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Geom::Phi< T > phi() const
constexpr uint32_t rawId() const
get the raw id
const Plane & surface() const
The nominal surface of the GeomDet.
Geom::Theta< T > theta() const
void processLook(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::EDGetToken &recHitToken, std::vector< RecHitProcessor::CppfItem > &CppfVec1, l1t::CPPFDigiCollection &cppfDigis, const int MaxClusterSize) const
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
void process(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::EDGetToken &recHitToken, l1t::CPPFDigiCollection &cppfDigis) const
double rad_to_deg(double rad)
std::vector< CPPFDigi > CPPFDigiCollection
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.