25 std::map <std::pair<int, int>,
int> chamber_repetitions;
26 chamber_repetitions.clear();
28 for ( TrackingGeometry::DetContainer::const_iterator iDet = rpcGeom->
dets().begin(); iDet < rpcGeom->
dets().end(); iDet++ ) {
31 if (dynamic_cast<const RPCChamber*>( *iDet ) ==
nullptr )
continue;
33 auto chamb =
dynamic_cast<const RPCChamber*
>( *iDet );
35 std::vector<const RPCRoll*> rolls = (chamb->rolls());
38 for(
auto& iRoll : rolls){
44 typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
45 rangeRecHits recHitCollection = recHits->get(rpcId);
51 int rawId = rpcId.
rawId();
54 int Bx = rechit_it->BunchX();
55 int isValid = rechit_it->isValid();
56 int firststrip = rechit_it->firstClusterStrip();
57 int clustersize = rechit_it->clusterSize();
66 int rechitstrip = firststrip;
70 if (clustersize % 2 == 0) medium = 0.5*(clustersize);
71 else medium = 0.5*(clustersize-1);
72 rechitstrip += medium;
75 if(clustersize > MaxClusterSize)
continue;
85 (ring == 1 && station > 1) ? nsub = 3 : nsub = 6;
90 if ((global_phi > 15.) && (global_phi <= 16.3)) {
94 else if ((global_phi > 16.3) && (global_phi <= 53.)) {
98 else if ((global_phi > 53.) && (global_phi <= 75.)) {
103 else if ((global_phi > 75.) && (global_phi <= 76.3)) {
107 else if ((global_phi > 76.3) && (global_phi <= 113.)) {
111 else if ((global_phi > 113.) && (global_phi <= 135.)) {
117 else if ((global_phi > 135.) && (global_phi <= 136.3)) {
121 else if ((global_phi > 136.3) && (global_phi <= 173.)) {
125 else if ((global_phi > 173.) && (global_phi <= 180.)) {
130 else if ((global_phi < -165.) && (global_phi >= -180.)) {
135 else if ((global_phi > -165.) && (global_phi <= -163.7)) {
139 else if ((global_phi > -163.7) && (global_phi <= -127.)) {
143 else if ((global_phi > -127.) && (global_phi <= -105.)) {
148 else if ((global_phi > -105.) && (global_phi <= -103.7)) {
152 else if ((global_phi > -103.7) && (global_phi <= -67.)) {
156 else if ((global_phi > -67.) && (global_phi <= -45.)) {
161 else if ((global_phi > -45.) && (global_phi <= -43.7)) {
165 else if ((global_phi > -43.7) && (global_phi <= -7.)) {
169 else if ((global_phi > -7.) && (global_phi <= 15.)) {
180 double EMTFLink1 = 0.;
181 double EMTFLink2 = 0.;
183 std::vector<RecHitProcessor::CppfItem>::iterator cppf1;
184 std::vector<RecHitProcessor::CppfItem>::iterator cppf;
185 for(cppf1 = CppfVec1.begin(); cppf1 != CppfVec1.end(); cppf1++){
190 if(((*cppf1).rawId == rawId) && ((*cppf1).strip == rechitstrip)){
192 int old_strip = (*cppf1).strip;
196 if(cppf1 != CppfVec1.begin())
197 before = (*(cppf1-2)).
strip;
199 else if (cppf1 == CppfVec1.begin())
200 before = (*cppf1).strip;
202 if(cppf1 != CppfVec1.end())
203 after = (*(cppf1+2)).
strip;
205 else if (cppf1 == CppfVec1.end())
206 after = (*cppf1).strip;
210 if(clustersize == 2){
213 if(before < after) cppf=(cppf1-1);
214 else if (before > after) cppf=(cppf1+1);
216 else if(firststrip > 1){
217 if(before < after) cppf=(cppf1+1);
218 else if (before > after) cppf=(cppf1-1);
223 std::pair<int, int> temporal;
224 temporal = std::make_pair (station, chamberID);
227 std::map<std::pair<int, int>,
int>::iterator it;
228 it = chamber_repetitions.find(temporal);
232 if(it == chamber_repetitions.end()){
233 chamber_repetitions[temporal] = 1;
235 else if((it != chamber_repetitions.end()) && (chamber_repetitions[temporal] == 1)){
236 chamber_repetitions[temporal] = 2;
238 else if((it != chamber_repetitions.end()) && (chamber_repetitions[temporal] == 2)){
249 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));
250 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));
252 if ((EMTFsector1 > 0) && (EMTFsector2 == 0)){
253 cppfDigis.push_back(*MainVariables1.get());
255 else if ((EMTFsector1 > 0) && (EMTFsector2 > 0)){
256 cppfDigis.push_back(*MainVariables1.get());
257 cppfDigis.push_back(*MainVariables2.get());
259 else if ((EMTFsector1 == 0) && (EMTFsector2 == 0)) {
266 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));
267 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));
268 if ((EMTFsector1 > 0) && (EMTFsector2 == 0)){
269 cppfDigis.push_back(*MainVariables1.get());
271 else if ((EMTFsector1 > 0) && (EMTFsector2 > 0)){
272 cppfDigis.push_back(*MainVariables1.get());
273 cppfDigis.push_back(*MainVariables2.get());
275 else if ((EMTFsector1 == 0) && (EMTFsector2 == 0)) {
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Geom::Phi< T > phi() const
const Plane & surface() const
The nominal surface of the GeomDet.
Geom::Theta< T > theta() const
uint32_t rawId() const
get the raw id
CSCDetId chamberID(const CSCDetId &cscDetId)
takes layer ID, converts to chamber ID, switching ME1A to ME11
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
double rad_to_deg(double rad)
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.