58 std::vector<GEMCSCSegment>
GEMCSCSegAlgoRR::run(
const std::map<uint32_t, const CSCLayer*>& csclayermap,
const std::map<uint32_t, const GEMEtaPartition*>& gemrollmap,
59 const std::vector<const CSCSegment*>& cscsegments,
const std::vector<const GEMRecHit*>& gemrechits)
72 edm::LogVerbatim(
"GEMCSCSegAlgoRR") <<
"[GEMCSCSegAlgoRR::run] cached the csclayermap and the gemrollmap";
75 std::stringstream csclayermapss; csclayermapss<<
"[GEMCSCSegAlgoRR::run] :: csclayermap :: elements ["<<std::endl;
78 csclayermapss<<
"[CSC DetId "<<mapIt->first<<
" ="<<
CSCDetId(mapIt->first)<<
", CSC Layer "<<mapIt->second<<
" ="<<(mapIt->second)->
id()<<
"],"<<std::endl;
80 csclayermapss<<
"]"<<std::endl;
86 std::stringstream gemetapartmapss; gemetapartmapss<<
"[GEMCSCSegAlgoRR::run] :: gemetapartmap :: elements ["<<std::endl;
89 gemetapartmapss<<
"[GEM DetId "<<mapIt->first<<
" ="<<
GEMDetId(mapIt->first)<<
", GEM EtaPart "<<mapIt->second<<
"],"<<std::endl;
91 gemetapartmapss<<
"]"<<std::endl;
92 std::string gemetapartmapstr = gemetapartmapss.str();
97 std::vector<GEMCSCSegment> segmentvectorfinal;
98 std::vector<GEMCSCSegment> segmentvectorchamber;
99 std::vector<GEMCSCSegment> segmentvectorfromfit;
100 std::vector<const TrackingRecHit*> chainedRecHits;
116 for(std::vector<const CSCSegment*>::const_iterator cscSegIt = cscsegments.begin(); cscSegIt != cscsegments.end(); ++cscSegIt)
125 if(chainedRecHits.size() > (*cscSegIt)->specificRecHits().size())
127 segmentvectorfromfit = this->
buildSegments(*cscSegIt, chainedRecHits);
133 std::vector<const GEMRecHit*> gemRecHits_noGEMrh;
134 GEMCSCSegment tmp(*cscSegIt, gemRecHits_noGEMrh, (*cscSegIt)->localPosition(), (*cscSegIt)->localDirection(), (*cscSegIt)->parametersError(), (*cscSegIt)->chi2());
135 segmentvectorfromfit.push_back(
tmp);
138 segmentvectorchamber.insert( segmentvectorchamber.end(), segmentvectorfromfit.begin(), segmentvectorfromfit.end() );
139 segmentvectorfromfit.clear();
143 segmentvectorfinal.insert( segmentvectorfinal.end(), segmentvectorchamber.begin(), segmentvectorchamber.end() );
144 segmentvectorchamber.clear();
145 edm::LogVerbatim(
"GEMCSCSegAlgoRR") <<
"[GEMCSCSegAlgoRR::run] GEMCSC Segments fitted or wrapped, size of vector = "<<segmentvectorfinal.size();
146 return segmentvectorfinal;
160 std::vector<const TrackingRecHit*> chainedRecHits;
172 for (
auto crh = cscrhs.begin(); crh!= cscrhs.end(); crh++)
174 chainedRecHits.push_back(crh->clone());
178 std::vector<const TrackingRecHit*>::const_iterator trhIt = chainedRecHits.begin();
180 if(trhIt == chainedRecHits.end()) {
181 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::chainHitsToSegm] CSC segment has zero rechits ... end function here";
182 return chainedRecHits;
187 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::chainHitsToSegm] CSC rechit ID was not found back in the CSCLayerMap ... end function here";
188 return chainedRecHits;
193 if(gemrechits.size()!=0)
195 float Dphi_min_l1 = 999;
196 float Dphi_min_l2 = 999;
197 float Dtheta_min_l1 = 999;
198 float Dtheta_min_l2 = 999;
200 std::vector<const GEMRecHit*>::const_iterator grhIt = gemrechits.begin();
206 for(grhIt = gemrechits.begin(); grhIt != gemrechits.end(); ++grhIt)
214 auto rhLP_inSegmRef = cscChamber->
toLocal(rhGP);
217 float xe, ye, ze = 0.0;
220 xe = segLP.
x()+segLD.x()*rhLP_inSegmRef.z()/segLD.z();
221 ye = segLP.y()+segLD.y()*rhLP_inSegmRef.z()/segLD.z();
222 ze = rhLP_inSegmRef.z();
229 auto rhGP_fromSegmRef = cscChamber->
toGlobal(rhLP_inSegmRef);
230 float phi_rh = rhGP_fromSegmRef.
phi();
231 float theta_rh = rhGP_fromSegmRef.theta();
233 auto extrPoinGP_fromSegmRef = cscChamber->
toGlobal(extrPoint);
234 float phi_ext = extrPoinGP_fromSegmRef.
phi();
235 float theta_ext = extrPoinGP_fromSegmRef.theta();
239 if ((*grhIt)->gemId().layer()==1)
241 float Dphi_l1 = fabs(phi_ext-phi_rh);
242 float Dtheta_l1 = fabs(theta_ext-theta_rh);
243 if (Dphi_l1 <= Dphi_min_l1)
245 Dphi_min_l1 = Dphi_l1;
246 Dtheta_min_l1 = Dtheta_l1;
247 gemrh_min_l1 = *grhIt;
252 if ((*grhIt)->gemId().layer()==2)
254 float Dphi_l2 = fabs(phi_ext-phi_rh);
255 float Dtheta_l2 = fabs(theta_ext-theta_rh);
256 if (Dphi_l2 <= Dphi_min_l2)
258 Dphi_min_l2 = Dphi_l2;
259 Dtheta_min_l2 = Dtheta_l2;
260 gemrh_min_l2 = *grhIt;
271 if(phiRequirementOK_l1 && thetaRequirementOK_l1 && gemrh_min_l1!=0)
273 chainedRecHits.push_back(gemrh_min_l1->
clone());
277 if(phiRequirementOK_l2 && thetaRequirementOK_l2 && gemrh_min_l2!=0)
279 chainedRecHits.push_back(gemrh_min_l2->
clone());
283 return chainedRecHits;
296 std::vector<GEMCSCSegment> gemcscsegmentvector;
297 std::vector<const GEMRecHit*> gemrechits;
302 return gemcscsegmentvector;
306 for(std::vector<const TrackingRecHit*>::const_iterator trhIt = rechits.begin(); trhIt!=rechits.end(); ++trhIt)
322 edm::LogVerbatim(
"GEMCSCSegAlgoRR") <<
"[GEMCSCSegAlgoRR::buildSegments] fit done, will now try to make GEMCSC Segment from CSC Segment in "<<cscsegment->
cscDetId()
323 <<
" made of "<<cscsegment->
specificRecHits().size()<<
" rechits and with chi2 = "<<cscsegment->
chi2()<<
" and with "<<gemrechits.size()<<
" GEM RecHits";
326 GEMCSCSegment tmp(cscsegment, gemrechits, protoIntercept, protoDirection, protoErrors, protoChi2);
328 edm::LogVerbatim(
"GEMCSCSegAlgoRR") <<
"[GEMCSCSegAlgoRR::buildSegments] GEMCSC Segment made";
329 gemcscsegmentvector.push_back(tmp);
330 return gemcscsegmentvector;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
bool preClustering_useChaining
virtual GEMRecHit * clone() const
CSCDetId cscDetId() const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
unsigned int minHitsPerSegment
LocalVector localdir() const
AlgebraicSymMatrix covarianceMatrix(void)
U second(std::pair< T, U > const &p)
LocalPoint localPosition() const
LocalVector localDirection() const
Local direction.
std::vector< GEMCSCSegment > buildSegments(const CSCSegment *cscsegment, const std::vector< const TrackingRecHit * > &rechits)
std::map< uint32_t, const GEMEtaPartition * > theGEMEtaParts_
const std::vector< CSCRecHit2D > & specificRecHits() const
~GEMCSCSegAlgoRR()
Destructor.
std::vector< const TrackingRecHit * > chainHitsToSegm(const CSCSegment *cscsegment, const std::vector< const GEMRecHit * > &gemrechits)
Utility functions.
bool debug
Configuration parameters.
GEMCSCSegAlgoRR(const edm::ParameterSet &ps)
Constructor.
std::vector< std::vector< double > > tmp
double chi2() const
Chi2 of the segment fit.
std::map< uint32_t, const CSCLayer * > theCSCLayers_
CLHEP::HepSymMatrix AlgebraicSymMatrix
std::vector< GEMCSCSegment > run(const std::map< uint32_t, const CSCLayer * > &csclayermap, const std::map< uint32_t, const GEMEtaPartition * > &gemrollmap, const std::vector< const CSCSegment * > &cscsegments, const std::vector< const GEMRecHit * > &gemrechits)
LocalPoint intercept() const
const CSCChamber * chamber() const