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)
35 declareInterface<ITRT_SeededSpacePointFinder>(
this);
61 msg(
MSG::FATAL) <<
"Failed to retrieve RegionSelector Service";
68 msg(MSG::ERROR) <<
"Could not get SCT_ID helper !" <<
endmsg;
69 return StatusCode::FAILURE;
75 msg(MSG::ERROR) <<
"Could not get TRT_ID helper !" <<
endmsg;
76 return StatusCode::FAILURE;
103 (
const std::vector<IdentifierHash>& ,
const std::vector<IdentifierHash>& )
const
108 std::list<std::pair<const Trk::SpacePoint*, const Trk::SpacePoint*> >
138 std::list<std::pair<const Trk::SpacePoint*, const Trk::SpacePoint*> > listOfSpacePointPairsBuffer;
141 std::set<IdentifierHash> setOfSCT_Hashes;
147 msg(
MSG::VERBOSE) <<
"Retrieved " << setOfSCT_Hashes.size() <<
" potentially interesting detector elements." <<
endmsg;
150 if ( !
m_useROI || !setOfSCT_Hashes.empty())
153 std::multimap<int,const Trk::SpacePoint*> relevantSpacePoints;
159 msg(
MSG::VERBOSE) <<
"Retrieved " << relevantSpacePoints.size() <<
" potentially interesting SpacePoints" <<
endmsg;
162 combineSpacePoints(relevantSpacePoints, directionTRT, modulTRT, listOfSpacePointPairsBuffer);
168 msg(
MSG::VERBOSE) <<
"------------------------------------------------------------------------------------------" <<
endmsg;
171 msg(
MSG::VERBOSE) <<
" Direction of initial vector: ( " <<
v0.unit().x() <<
", " <<
v0.unit().y() <<
", "<<
v0.unit().z() <<
" ) , phi = "
172 <<
v0.phi() <<
" theta = " <<
v0.theta() <<
" eta = "<<
v0.eta() <<
endmsg;
173 msg(
MSG::VERBOSE) <<
"------------------------------------------------------------------------------------------" <<
endmsg;
175 msg(
MSG::VERBOSE) <<
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " <<
endmsg;
176 for (
auto &
it : listOfSpacePointPairsBuffer)
184 << s1s2.unit().x() <<
", " << s1s2.unit().y() <<
", " << s1s2.unit().z() <<
" ) , phi = "
185 << s1s2.phi() <<
" theta = " << s1s2.theta() <<
" eta = "<< s1s2.eta() <<
endmsg;
186 msg(
MSG::VERBOSE) <<
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " <<
endmsg;
188 msg(
MSG::VERBOSE) <<
"------------------------------------------------------------------------------------------" <<
endmsg;
191 return listOfSpacePointPairsBuffer;
216 std::vector<IdentifierHash> listOfSCT_Hashes;
224 for (
auto listOfSCT_Hashe : listOfSCT_Hashes)
225 setOfSCT_Hashes.insert(listOfSCT_Hashe);
231 std::set<IdentifierHash>& setOfSCT_Hashes,
232 int modulTRT, std::multimap<
int,
252 const std::set<IdentifierHash>::const_iterator endSCT_Hashes = setOfSCT_Hashes.end();
258 if (!prd_to_track_map.
isValid()) {
261 prd_to_track_map_cptr = prd_to_track_map.
cptr();
271 for(; itCont != endCont; ++itCont)
273 bool acceptCollection =
true;
279 acceptCollection = ( idHash.
is_valid() && setOfSCT_Hashes.find( idHash ) != endSCT_Hashes );
282 int SCT_LayerNumber = -99;
283 if (acceptCollection)
288 if ( detRegionIndex == -2 || detRegionIndex == 0 || detRegionIndex == 2 )
291 int detLayerOffset = 1;
292 int detLayerSign = 1;
293 if (detRegionIndex == 0) detLayerOffset = 10;
294 if (detRegionIndex == -2) detLayerSign = -1;
298 SCT_LayerNumber = detLayerSign*(detLayerIndex+detLayerOffset);
303 acceptCollection =
false;
307 if (acceptCollection)
309 if (modulTRT > -14 && modulTRT < 15 )
316 msg(MSG::WARNING) <<
"Received TRTmodul number " << modulTRT <<
endmsg;
317 acceptCollection =
false;
321 if (acceptCollection)
326 for(; itColl != endColl; ++itColl)
327 if ( !prd_to_track_map_cptr
328 || !( prd_to_track_map_cptr->
isUsed(*((*itColl)->clusterList().first))
329 || prd_to_track_map_cptr->
isUsed(*((*itColl)->clusterList().second)) ) )
331 relevantSpacePoints.insert(std::make_pair( SCT_LayerNumber ,*itColl));
332 msg(
MSG::VERBOSE) <<
"Added SpacePoint for layer " << SCT_LayerNumber <<
" at ( "
333 << (*itColl)->globalPosition().x() <<
" , "
334 << (*itColl)->globalPosition().y() <<
" , "
335 << (*itColl)->globalPosition().z() <<
" ) " <<
endmsg;
343 if(spacepointsOverlap.
isValid())
349 for (; itColl != endColl; ++itColl)
352 std::pair<IdentifierHash, IdentifierHash> idHashPair = (*itColl)->elementIdList();
354 || (idHashPair.first.is_valid() && setOfSCT_Hashes.find( idHashPair.first ) != endSCT_Hashes)
355 || (idHashPair.second.is_valid() && setOfSCT_Hashes.find( idHashPair.second ) != endSCT_Hashes) )
359 if(prd_to_track_map_cptr)
367 if(u1 || u2)
continue;
371 Identifier id = (*itColl)->associatedSurface().associatedDetectorElementIdentifier();
375 if ( detRegionIndex == -2 || detRegionIndex == 0 || detRegionIndex == 2 )
377 int detLayerOffset = 1;
378 int detLayerSign = 1;
379 if (detRegionIndex == 0) detLayerOffset = 10;
380 if (detRegionIndex == -2) detLayerSign = -1;
383 relevantSpacePoints.insert(std::make_pair(detLayerSign*(detLayerIndex+detLayerOffset),*itColl));
384 msg(
MSG::VERBOSE) <<
"Added OverlapSpacePoint for layer " << detLayerSign*(detLayerIndex+detLayerOffset) <<
" at ( "
385 << (*itColl)->globalPosition().x() <<
" , "
386 << (*itColl)->globalPosition().y() <<
" , "
387 << (*itColl)->globalPosition().z() <<
" ) " <<
endmsg;
419 std::list<std::pair<const Trk::SpacePoint*, const Trk::SpacePoint*> > &listOfSpacePointPairsBuffer)
const
437 for ( ; itTable != endTable ; ++itTable)
439 msg(
MSG::VERBOSE) <<
" Combining Space Poinst from modules " << itTable->first <<
" and " << itTable->second <<
endmsg;
441 std::pair< std::multimap<int,const Trk::SpacePoint*>::const_iterator,
442 std::multimap<int,const Trk::SpacePoint*>::const_iterator >
443 range1 = relevantSpacePoints.equal_range(itTable->first);
447 std::pair< std::multimap<int,const Trk::SpacePoint*>::const_iterator,
448 std::multimap<int,const Trk::SpacePoint*>::const_iterator >
449 range2 = relevantSpacePoints.equal_range(itTable->second);
453 for ( std::multimap<int,const Trk::SpacePoint*>::const_iterator
it1 = range1.first;
454 it1 != range1.second ; ++
it1 )
455 for ( std::multimap<int,const Trk::SpacePoint*>::const_iterator it2 = range2.first;
456 it2 != range2.second ; ++it2 )
457 if (
pairIsOk(
it1->second,it2->second,directionTRT) )
458 listOfSpacePointPairsBuffer.emplace_back(it2->second,
it1->second);
463 msg(MSG::WARNING) <<
"TRT module not in look-up table --> no SP pairs formed" <<
endmsg;
486 <<
" ) and ( "<<
s2.x() <<
", " <<
s2.y() <<
", " <<
s2.z() <<
" )" <<
endmsg;
489 double t = (
s1.x()-
s2.x() )*(
s1.x()-
s2.x() ) + (
s1.y()-
s2.y() )*(
s1.y()-
s2.y() ) ;
494 msg(
MSG::VERBOSE) <<
" closest approach to beam-pipe at ( "<< perigee.x() <<
", " << perigee.y() <<
", " << perigee.z() <<
" ) transversal: " << perigee.perp()<<
endmsg;
501 double diffPhi= std::abs(s1s2.phi()-
v0.phi());
586 for (
int i = 2;
i<4 ; ++
i)
616 for (
int i = 4 ;
i < 7 ; ++
i )
652 for (
int i = 7 ;
i < 10 ; ++
i)
678 for (
int i = 10 ;
i < 13 ; ++
i )
702 for (
int i = 13 ;
i < 15 ; ++
i )
730 for ( ; itList != endList ; ++itList )
732 int i = itList->first;
733 int j = itList->second;
745 for ( ; itList != endList ; ++itList )
760 out <<
"to be implemented soon..." << std::endl;
768 out <<
"to be implemented soon..." << std::endl;
780 msg(
MSG::VERBOSE) <<
"=====================================================================================================================" <<
endmsg;
782 msg(
MSG::VERBOSE) <<
"---------------------------------------------------------------------------------------------------------------------" <<
endmsg;
783 for (
int i = -14;
i<15 ; ++
i)
788 for ( ; itList != endList ; ++itList )
789 msg(
MSG::VERBOSE) <<
" (" << itList->first <<
", " << itList->second <<
") " ;
794 for ( ; itIndex != endIndex ; ++ itIndex )
797 msg(
MSG::VERBOSE) <<
"...................................................................................................................." <<
endmsg;
800 msg(
MSG::VERBOSE) <<
"=====================================================================================================================" <<
endmsg;
819 msg(MSG::WARNING) <<
" Id not valid "<<
endmsg;
824 if ( detRegionIndex == -1 || detRegionIndex == 1 )
826 else if ( detRegionIndex == -2 || detRegionIndex == 2 )
829 modulNumber *= (detRegionIndex/2) ;
833 msg(MSG::WARNING) <<
"TRT barrel-endcap id not in {-2;-1;1;2}" <<
endmsg;