29 std::cout <<
"CSC \t Number of CSC Segments in this event = " << allCSCSegments->size() << std::endl;
31 auto _ThePoints = std::make_unique<RPCRecHitCollection>();
34 if (allCSCSegments->size() == 0) {
36 std::cout <<
"CSC 0 segments skiping event" << std::endl;
38 std::map<CSCDetId, int> CSCSegmentsCounter;
41 int segmentsInThisEventInTheEndcap = 0;
43 for (segment = allCSCSegments->begin(); segment != allCSCSegments->end(); ++segment) {
44 CSCSegmentsCounter[segment->cscDetId()]++;
45 segmentsInThisEventInTheEndcap++;
49 std::cout <<
"CSC \t loop over all the CSCSegments " << std::endl;
50 for (segment = allCSCSegments->begin(); segment != allCSCSegments->end(); ++segment) {
51 CSCDetId CSCId = segment->cscDetId();
54 std::cout <<
"CSC \t \t This Segment is in Chamber id: " << CSCId << std::endl;
56 std::cout <<
"CSC \t \t Number of segments in this CSC = " << CSCSegmentsCounter[CSCId] << std::endl;
58 std::cout <<
"CSC \t \t Is the only one in this CSC? is not ind the ring 1 or station 4? Are there more than 2 "
59 "segments in the event?"
62 if (CSCSegmentsCounter[CSCId] == 1 && CSCId.
station() != 4 && CSCId.
ring() != 1 && allCSCSegments->size() >= 2) {
64 std::cout <<
"CSC \t \t yes" << std::endl;
65 int cscEndCap = CSCId.
endcap();
66 int cscStation = CSCId.
station();
67 int cscRing = CSCId.
ring();
71 int rpcRing = cscRing;
74 int rpcStation = cscStation;
75 int rpcSegment = CSCId.
chamber();
77 LocalPoint segmentPosition = segment->localPosition();
78 LocalVector segmentDirection = segment->localDirection();
79 float dz = segmentDirection.
z();
82 std::cout <<
"CSC \t \t \t Information about the segment"
83 <<
"RecHits =" << segment->nRecHits() <<
"Angle =" << acos(
dz) * 180 / 3.1415926 << std::endl;
86 std::cout <<
"CSC \t \t Is a good Segment? dim = 4, 4 <= nRecHits <= 10 Incident angle int range 45 < "
87 << acos(
dz) * 180 / 3.1415926 <<
" < 135? " << std::endl;
89 if ((segment->dimension() == 4) && (segment->nRecHits() <= 10 && segment->nRecHits() >= 4)) {
94 std::cout <<
"CSC \t \t yes" << std::endl;
96 std::cout <<
"CSC \t \t CSC Segment Dimension " << segment->dimension() << std::endl;
98 float Xo = segmentPosition.
x();
99 float Yo = segmentPosition.
y();
100 float Zo = segmentPosition.
z();
101 float dx = segmentDirection.
x();
102 float dy = segmentDirection.
y();
103 float dz = segmentDirection.
z();
106 std::cout <<
"Creating the CSCIndex" << std::endl;
109 std::cout <<
"Getting the Rolls for the given index" << std::endl;
110 std::set<RPCDetId> rollsForThisCSC = cscMap->
getRolls(theindex);
112 std::cout <<
"CSC \t \t Getting chamber from Geometry" << std::endl;
115 std::cout <<
"CSC \t \t Getting ID from Chamber" << std::endl;
119 std::cout <<
"CSC \t \t Number of rolls for this CSC = " << rollsForThisCSC.size() << std::endl;
122 std::cout <<
"CSC \t \t Printing The Id" << TheId << std::endl;
124 if (rpcRing != 1 && rpcStation != 4) {
126 assert(!rollsForThisCSC.empty());
129 std::cout <<
"CSC \t \t Loop over all the rolls asociated to this CSC" << std::endl;
130 for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisCSC.begin(); iteraRoll != rollsForThisCSC.end();
132 const RPCRoll* rollasociated = rpcGeo->
roll(*iteraRoll);
136 std::cout <<
"CSC \t \t \t We are in the roll getting the surface" << rpcId << std::endl;
140 std::cout <<
"CSC \t \t \t RollID: " << rpcId << std::endl;
143 std::cout <<
"CSC \t \t \t Doing the extrapolation to this roll" << std::endl;
145 std::cout <<
"CSC \t \t \t CSC Segment Direction in CSCLocal " << segmentDirection << std::endl;
147 std::cout <<
"CSC \t \t \t CSC Segment Point in CSCLocal " << segmentPosition << std::endl;
151 std::cout <<
"CSC \t \t \t Center (0,0,0) of the Roll in Global" << CenterPointRollGlobal << std::endl;
154 std::cout <<
"CSC \t \t \t Center (0,0,0) of the CSC in Global" << CenterPointCSCGlobal << std::endl;
156 TheChamber->
toGlobal(segmentPosition);
158 std::cout <<
"CSC \t \t \t Segment Position in Global" << segmentPositionInGlobal << std::endl;
165 (CenterPointRollGlobal.
barePhi() < 0) ? rpcphi = 2 * 3.141592 + CenterPointRollGlobal.
barePhi()
166 : rpcphi = CenterPointRollGlobal.
barePhi();
168 (CenterPointCSCGlobal.
barePhi() < 0) ? cscphi = 2 * 3.1415926536 + CenterPointCSCGlobal.
barePhi()
169 : cscphi = CenterPointCSCGlobal.
barePhi();
171 float df = fabs(cscphi - rpcphi);
172 float dr = fabs(CenterPointRollGlobal.
perp() - CenterPointCSCGlobal.
perp());
173 float diffz = CenterPointRollGlobal.
z() - CenterPointCSCGlobal.
z();
174 float dfg =
df * 180. / 3.14159265;
177 std::cout <<
"CSC \t \t \t z of RPC=" << CenterPointRollGlobal.
z() <<
"z of CSC"
178 << CenterPointCSCGlobal.
z() <<
" dfg=" << dfg << std::endl;
182 if (
dr > 200. || fabs(
dz) > 55. || dfg > 1.) {
186 <<
" Chamber= " << CSCId.
chamber() <<
" cscphi=" << cscphi * 180 / 3.14159265
187 <<
"\t RPC Station= " << rpcId.
station() <<
" ring= " << rpcId.
ring() <<
" segment =-> "
188 << rpcsrv.segment() <<
" rollphi=" << rpcphi * 180 / 3.14159265 <<
"\t dfg=" << dfg
189 <<
" dz=" << diffz <<
" dr=" <<
dr << std::endl;
193 float D = CenterRollinCSCFrame.
z();
195 float X = Xo +
dx *
D /
dz;
196 float Y = Yo +
dy *
D /
dz;
200 dynamic_cast<const TrapezoidalStripTopology*>(&(rollasociated->
topology()));
203 std::cout <<
"CSC \t \t \t xmin of this Roll " <<
xmin <<
"cm" << std::endl;
206 std::cout <<
"CSC \t \t \t xmax of this Roll " <<
xmax <<
"cm" << std::endl;
207 float rsize = fabs(
xmax.x() -
xmin.x());
209 std::cout <<
"CSC \t \t \t Roll Size " << rsize <<
"cm" << std::endl;
211 float stripw = top_->
pitch();
214 std::cout <<
"CSC \t \t \t Strip Lenght " << stripl <<
"cm" << std::endl;
216 std::cout <<
"CSC \t \t \t Strip Width " << stripw <<
"cm" << std::endl;
219 std::cout <<
"CSC \t \t \t X Predicted in CSCLocal= " <<
X <<
"cm" << std::endl;
221 std::cout <<
"CSC \t \t \t Y Predicted in CSCLocal= " <<
Y <<
"cm" << std::endl;
223 std::cout <<
"CSC \t \t \t Z Predicted in CSCLocal= " <<
Z <<
"cm" << std::endl;
225 float extrapolatedDistance =
sqrt((
X - Xo) * (
X - Xo) + (
Y - Yo) * (
Y - Yo) + (
Z - Zo) * (
Z - Zo));
228 std::cout <<
"CSC \t \t \t Is the distance of extrapolation less than MaxD? =" << extrapolatedDistance
230 <<
" MaxD=" <<
MaxD <<
"cm" << std::endl;
232 if (extrapolatedDistance <=
MaxD) {
234 std::cout <<
"CSC \t \t \t yes" << std::endl;
238 std::cout <<
"CSC \t \t \t Point ExtraPolated in Global" << GlobalPointExtrapolated << std::endl;
240 LocalPoint PointExtrapolatedRPCFrame = RPCSurface.toLocal(GlobalPointExtrapolated);
243 std::cout <<
"CSC \t \t \t Point Extrapolated in RPCLocal" << PointExtrapolatedRPCFrame << std::endl;
245 std::cout <<
"CSC \t \t \t Corner of the Roll = (" << rsize * eyr <<
"," << stripl * eyr <<
")"
248 std::cout <<
"CSC \t \t \t Info About the Point Extrapolated in X Abs ("
249 << fabs(PointExtrapolatedRPCFrame.
x()) <<
"," << fabs(PointExtrapolatedRPCFrame.
y()) <<
","
250 << fabs(PointExtrapolatedRPCFrame.
z()) <<
")" << std::endl;
252 std::cout <<
"CSC \t \t \t dz=" << fabs(PointExtrapolatedRPCFrame.
z())
253 <<
" dx=" << fabs(PointExtrapolatedRPCFrame.
x())
254 <<
" dy=" << fabs(PointExtrapolatedRPCFrame.
y()) << std::endl;
257 std::cout <<
"CSC \t \t \t Does the extrapolation go inside this roll????" << std::endl;
259 if (fabs(PointExtrapolatedRPCFrame.
z()) < 1. && fabs(PointExtrapolatedRPCFrame.
x()) < rsize * eyr &&
260 fabs(PointExtrapolatedRPCFrame.
y()) < stripl * eyr) {
262 std::cout <<
"CSC \t \t \t \t yes" << std::endl;
264 std::cout <<
"CSC \t \t \t \t Creating the RecHit" << std::endl;
265 RPCRecHit RPCPoint(rpcId, 0, PointExtrapolatedRPCFrame);
267 std::cout <<
"CSC \t \t \t \t Clearing the vector" << std::endl;
268 RPCPointVector.
clear();
270 std::cout <<
"CSC \t \t \t \t Pushing back" << std::endl;
273 std::cout <<
"CSC \t \t \t \t Putting the vector" << std::endl;
274 _ThePoints->put(rpcId, RPCPointVector.
begin(), RPCPointVector.
end());