17 #include "GaudiKernel/MsgStream.h"
18 #include "CLHEP/Vector/ThreeVector.h"
19 #include "CLHEP/Units/SystemOfUnits.h"
32 (
const std::string&
t,
const std::string&
n,
const IInterface*
p)
37 m_directionPhiCut(0.05),
42 declareInterface<ITRT_SeededSpacePointFinder>(
this);
74 msg(
MSG::FATAL) <<
"Failed to retrieve RegionSelector Service";
81 msg(MSG::ERROR) <<
"Could not get SCT_ID helper !" <<
endmsg;
82 return StatusCode::FAILURE;
88 msg(MSG::ERROR) <<
"Could not get TRT_ID helper !" <<
endmsg;
89 return StatusCode::FAILURE;
116 (
const std::vector<IdentifierHash>& ,
const std::vector<IdentifierHash>& )
const
121 std::list<std::pair<const Trk::SpacePoint*, const Trk::SpacePoint*> >
151 std::list<std::pair<const Trk::SpacePoint*, const Trk::SpacePoint*> > listOfSpacePointPairsBuffer;
154 std::set<IdentifierHash> setOfSCT_Hashes;
160 msg(
MSG::VERBOSE) <<
"Retrieved " << setOfSCT_Hashes.size() <<
" potentially interesting detector elements." <<
endmsg;
163 if ( !
m_useROI || !setOfSCT_Hashes.empty())
166 std::multimap<int,const Trk::SpacePoint*> relevantSpacePoints;
172 msg(
MSG::VERBOSE) <<
"Retrieved " << relevantSpacePoints.size() <<
" potentially interesting SpacePoints" <<
endmsg;
175 combineSpacePoints(relevantSpacePoints, directionTRT, modulTRT, listOfSpacePointPairsBuffer);
181 msg(
MSG::VERBOSE) <<
"------------------------------------------------------------------------------------------" <<
endmsg;
184 msg(
MSG::VERBOSE) <<
" Direction of initial vector: ( " <<
v0.unit().x() <<
", " <<
v0.unit().y() <<
", "<<
v0.unit().z() <<
" ) , phi = "
185 <<
v0.phi() <<
" theta = " <<
v0.theta() <<
" eta = "<<
v0.eta() <<
endmsg;
186 msg(
MSG::VERBOSE) <<
"------------------------------------------------------------------------------------------" <<
endmsg;
188 msg(
MSG::VERBOSE) <<
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " <<
endmsg;
189 for (
auto &
it : listOfSpacePointPairsBuffer)
197 << s1s2.unit().x() <<
", " << s1s2.unit().y() <<
", " << s1s2.unit().z() <<
" ) , phi = "
198 << s1s2.phi() <<
" theta = " << s1s2.theta() <<
" eta = "<< s1s2.eta() <<
endmsg;
199 msg(
MSG::VERBOSE) <<
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " <<
endmsg;
201 msg(
MSG::VERBOSE) <<
"------------------------------------------------------------------------------------------" <<
endmsg;
204 return listOfSpacePointPairsBuffer;
229 std::vector<IdentifierHash> listOfSCT_Hashes;
237 for (
auto listOfSCT_Hashe : listOfSCT_Hashes)
238 setOfSCT_Hashes.insert(listOfSCT_Hashe);
244 std::set<IdentifierHash>& setOfSCT_Hashes,
245 int modulTRT, std::multimap<
int,
265 const std::set<IdentifierHash>::const_iterator endSCT_Hashes = setOfSCT_Hashes.end();
271 if (!prd_to_track_map.
isValid()) {
274 prd_to_track_map_cptr = prd_to_track_map.
cptr();
284 for(; itCont != endCont; ++itCont)
286 bool acceptCollection =
true;
292 acceptCollection = ( idHash.
is_valid() && setOfSCT_Hashes.find( idHash ) != endSCT_Hashes );
295 int SCT_LayerNumber = -99;
296 if (acceptCollection)
301 if ( detRegionIndex == -2 || detRegionIndex == 0 || detRegionIndex == 2 )
304 int detLayerOffset = 1;
305 int detLayerSign = 1;
306 if (detRegionIndex == 0) detLayerOffset = 10;
307 if (detRegionIndex == -2) detLayerSign = -1;
311 SCT_LayerNumber = detLayerSign*(detLayerIndex+detLayerOffset);
316 acceptCollection =
false;
320 if (acceptCollection)
322 if (modulTRT > -14 && modulTRT < 15 )
329 msg(MSG::WARNING) <<
"Received TRTmodul number " << modulTRT <<
endmsg;
330 acceptCollection =
false;
334 if (acceptCollection)
339 for(; itColl != endColl; ++itColl)
340 if ( !prd_to_track_map_cptr
341 || !( prd_to_track_map_cptr->
isUsed(*((*itColl)->clusterList().first))
342 || prd_to_track_map_cptr->
isUsed(*((*itColl)->clusterList().second)) ) )
344 relevantSpacePoints.insert(std::make_pair( SCT_LayerNumber ,*itColl));
345 msg(
MSG::VERBOSE) <<
"Added SpacePoint for layer " << SCT_LayerNumber <<
" at ( "
346 << (*itColl)->globalPosition().x() <<
" , "
347 << (*itColl)->globalPosition().y() <<
" , "
348 << (*itColl)->globalPosition().z() <<
" ) " <<
endmsg;
356 if(spacepointsOverlap.
isValid())
362 for (; itColl != endColl; ++itColl)
365 std::pair<IdentifierHash, IdentifierHash> idHashPair = (*itColl)->elementIdList();
367 || (idHashPair.first.is_valid() && setOfSCT_Hashes.find( idHashPair.first ) != endSCT_Hashes)
368 || (idHashPair.second.is_valid() && setOfSCT_Hashes.find( idHashPair.second ) != endSCT_Hashes) )
372 if(prd_to_track_map_cptr)
377 u1=prd_to_track_map->
isUsed(*p1);
379 u2=prd_to_track_map->
isUsed(*p2);
380 if(u1 || u2)
continue;
384 Identifier id = (*itColl)->associatedSurface().associatedDetectorElementIdentifier();
388 if ( detRegionIndex == -2 || detRegionIndex == 0 || detRegionIndex == 2 )
390 int detLayerOffset = 1;
391 int detLayerSign = 1;
392 if (detRegionIndex == 0) detLayerOffset = 10;
393 if (detRegionIndex == -2) detLayerSign = -1;
396 relevantSpacePoints.insert(std::make_pair(detLayerSign*(detLayerIndex+detLayerOffset),*itColl));
397 msg(
MSG::VERBOSE) <<
"Added OverlapSpacePoint for layer " << detLayerSign*(detLayerIndex+detLayerOffset) <<
" at ( "
398 << (*itColl)->globalPosition().x() <<
" , "
399 << (*itColl)->globalPosition().y() <<
" , "
400 << (*itColl)->globalPosition().z() <<
" ) " <<
endmsg;
432 std::list<std::pair<const Trk::SpacePoint*, const Trk::SpacePoint*> > &listOfSpacePointPairsBuffer)
const
450 for ( ; itTable != endTable ; ++itTable)
452 msg(
MSG::VERBOSE) <<
" Combining Space Poinst from modules " << itTable->first <<
" and " << itTable->second <<
endmsg;
454 std::pair< std::multimap<int,const Trk::SpacePoint*>::const_iterator,
455 std::multimap<int,const Trk::SpacePoint*>::const_iterator >
456 range1 = relevantSpacePoints.equal_range(itTable->first);
460 std::pair< std::multimap<int,const Trk::SpacePoint*>::const_iterator,
461 std::multimap<int,const Trk::SpacePoint*>::const_iterator >
462 range2 = relevantSpacePoints.equal_range(itTable->second);
466 for ( std::multimap<int,const Trk::SpacePoint*>::const_iterator
it1 = range1.first;
467 it1 != range1.second ; ++
it1 )
468 for ( std::multimap<int,const Trk::SpacePoint*>::const_iterator it2 = range2.first;
469 it2 != range2.second ; ++it2 )
470 if (
pairIsOk(
it1->second,it2->second,directionTRT) )
471 listOfSpacePointPairsBuffer.emplace_back(it2->second,
it1->second);
476 msg(MSG::WARNING) <<
"TRT module not in look-up table --> no SP pairs formed" <<
endmsg;
499 <<
" ) and ( "<<
s2.x() <<
", " <<
s2.y() <<
", " <<
s2.z() <<
" )" <<
endmsg;
502 double t = (
s1.x()-
s2.x() )*(
s1.x()-
s2.x() ) + (
s1.y()-
s2.y() )*(
s1.y()-
s2.y() ) ;
507 msg(
MSG::VERBOSE) <<
" closest approach to beam-pipe at ( "<< perigee.x() <<
", " << perigee.y() <<
", " << perigee.z() <<
" ) transversal: " << perigee.perp()<<
endmsg;
514 double diffPhi= std::abs(s1s2.phi()-
v0.phi());
599 for (
int i = 2;
i<4 ; ++
i)
629 for (
int i = 4 ;
i < 7 ; ++
i )
665 for (
int i = 7 ;
i < 10 ; ++
i)
691 for (
int i = 10 ;
i < 13 ; ++
i )
715 for (
int i = 13 ;
i < 15 ; ++
i )
743 for ( ; itList != endList ; ++itList )
745 int i = itList->first;
746 int j = itList->second;
758 for ( ; itList != endList ; ++itList )
773 out <<
"to be implemented soon..." << std::endl;
781 out <<
"to be implemented soon..." << std::endl;
793 msg(
MSG::VERBOSE) <<
"=====================================================================================================================" <<
endmsg;
795 msg(
MSG::VERBOSE) <<
"---------------------------------------------------------------------------------------------------------------------" <<
endmsg;
796 for (
int i = -14;
i<15 ; ++
i)
801 for ( ; itList != endList ; ++itList )
802 msg(
MSG::VERBOSE) <<
" (" << itList->first <<
", " << itList->second <<
") " ;
807 for ( ; itIndex != endIndex ; ++ itIndex )
810 msg(
MSG::VERBOSE) <<
"...................................................................................................................." <<
endmsg;
813 msg(
MSG::VERBOSE) <<
"=====================================================================================================================" <<
endmsg;
832 msg(MSG::WARNING) <<
" Id not valid "<<
endmsg;
837 if ( detRegionIndex == -1 || detRegionIndex == 1 )
839 else if ( detRegionIndex == -2 || detRegionIndex == 2 )
842 modulNumber *= (detRegionIndex/2) ;
846 msg(MSG::WARNING) <<
"TRT barrel-endcap id not in {-2;-1;1;2}" <<
endmsg;