35 (
const std::string&
t,
const std::string&
n,
const IInterface*
p)
50 return StatusCode::FAILURE;
58 return StatusCode::FAILURE;
66 return StatusCode::FAILURE;
77 return StatusCode::FAILURE;
103 return StatusCode::SUCCESS;
136 for (
int i=0;
i<
n; ++
i) s1.append(
" ");
139 std::string fieldmode[9] ={
"NoField" ,
"ConstantField",
"SolenoidalField",
140 "ToroidalField" ,
"Grid3DField" ,
"RealisticField" ,
141 "UndefinedField",
"AthenaField" ,
"?????" };
144 if (mode<0 || mode>8 )
mode = 8;
146 n = 62-fieldmode[
mode].size();
148 for (
int i=0;
i<
n; ++
i)
s3.append(
" ");
153 for (
int i=0;
i<
n; ++
i)
s4.append(
" ");
158 for (
int i=0;
i<
n; ++
i) s5.append(
" ");
163 for (
int i=0;
i<
n; ++
i) s7.append(
" ");
168 for (
int i=0;
i<
n; ++
i) s8.append(
" ");
171 out<<
"|----------------------------------------------------------------------"
172 <<
"-------------------|"
180 out<<
"| Tool for propagation | "<<
m_proptool .type()<<s1<<std::endl;
182 out<<
"| Tool for rio on track | "<<
m_riocreator .type()<<s5<<std::endl;
183 out<<
"| Magnetic field mode | "<<fieldmode[
mode] <<
s3<<std::endl;
184 out<<
"|----------------------------------------------------------------------"
185 <<
"-------------------|"
196 out<<
"|---------------------------------------------------------------------|"
198 out<<
"| Min pT of track (MeV) | "<<std::setw(12)<<std::setprecision(5)<<
data.pTmin()
200 out<<
"| Max Xi2 for cluster | "<<std::setw(12)<<std::setprecision(5)<<
data.xi2max()
202 out<<
"| Max Xi2 for outlayer | "<<std::setw(12)<<std::setprecision(5)<<
data.xi2maxNoAdd()
204 out<<
"| Max Xi2 for link | "<<std::setw(12)<<std::setprecision(5)<<
data.xi2maxlink()
206 out<<
"| Min number of clusters | "<<std::setw(12)<<
data.nclusmin()
208 out<<
"| Min number of wclusters | "<<std::setw(12)<<
data.nwclusmin()
210 out<<
"| Max number holes | "<<std::setw(12)<<
data.nholesmax()
212 out<<
"| Max holes gap | "<<std::setw(12)<<
data.dholesmax()
214 out<<
"| Use PRD to track assoc.?| "<<std::setw(12)<<(
data.PRDtoTrackMap() ?
"yes" :
"no ")
216 out<<
"|---------------------------------------------------------------------|"
218 out<<
"| Number input seeds | "<<std::setw(12)<<
data.inputseeds()
220 out<<
"| Number accepted seeds | "<<std::setw(12)<<
data.goodseeds()
222 out<<
"| Number initial tracks | "<<std::setw(12)<<
data.inittracks()
224 out<<
"| Number wrong DE roads | "<<std::setw(12)<<
data.roadbug()
226 out<<
"| Number output tracks | "<<std::setw(12)<<
data.findtracks()
228 out<<
"|---------------------------------------------------------------------|"
243 data.inputseeds() = 0;
244 data.goodseeds() = 0;
245 data.inittracks() = 0;
246 data.findtracks() = 0;
252 data.setCosmicTrack(0);
258 if (fieldCondObj ==
nullptr) {
259 std::string
msg =
"InDet::SiCombinatorialTrackFinder_xk::newEvent: Failed to retrieve AtlasFieldCacheCondObj with key " +
m_fieldCondObjInputKey.
key();
260 throw(std::runtime_error(
msg));
262 data.setFieldCondObj(fieldCondObj);
273 if (not
data.isInitialized()) {
276 if(!Cuts.
getIntCut (
"UseAssociationTool" ,useasso )) useasso = 0;
277 data.tools().setAssociation(useasso);
289 data.setHeavyIon(
false);
290 data.setCosmicTrack(0);
293 data.setCosmicTrack(1);
295 data.setHeavyIon(
true);
322 const std::vector<const Trk::SpacePoint*>& Sp,
323 const std::vector<Amg::Vector3D>& Gp,
324 std::vector<const InDetDD::SiDetectorElement*>& DE,
326 const EventContext& ctx)
const
331 data.statistic().fill(
false);
334 data.tools().setBremNoise(
false,
false);
336 data.tracks().erase(
data.tracks().begin(),
data.tracks().end());
340 return data.tracks();
345 std::multimap<const Trk::PrepRawData*, const Trk::Track*>
PT;
352 data.statistic()[
FT] =
true;
353 if( !
data.flagToReturnFailedTrack() )
return data.tracks();
357 data.trajectory().sortStep();
364 data.tracks().push_back(
t);
367 if (!
data.tools().multiTrack() ||
368 data.simpleTrack() ||
370 data.cosmicTrack() ||
371 data.trajectory().pTfirst() <
data.tools().pTmin())
return data.tracks();
376 data.tracks().push_back(
t);
378 return data.tracks();
388 const std::vector<const Trk::SpacePoint*>& Sp,
389 const std::vector<Amg::Vector3D>& Gp,
390 std::vector<const InDetDD::SiDetectorElement*>& DE,
391 std::multimap<const Trk::PrepRawData*, const Trk::Track*>&
PT,
392 const EventContext& ctx)
const
397 data.tools().setBremNoise(
false,
false);
398 data.tracks().erase(
data.tracks().begin(),
data.tracks().end());
400 data.statistic().fill(
false);
403 return data.tracks();
408 data.statistic()[
FT] =
true;
409 if( !
data.flagToReturnFailedTrack() || std::abs(
data.resultCode()) < SiCombinatorialTrackFinderData_xk::ResultCodeThreshold::RecoverableForDisTrk )
return data.tracks();
411 if (!
data.trajectory().isNewTrack(
PT))
414 return data.tracks();
416 data.trajectory().sortStep();
418 if(
data.useFastTracking()) {
419 if(!
data.trajectory().filterWithPreciseClustersError(ctx)) {
421 return data.tracks();
428 if (
t==
nullptr)
return data.tracks();
432 data.tracks().push_back(
t);
434 if (!
data.tools().multiTrack() ||
435 data.simpleTrack() ||
437 data.cosmicTrack() ||
438 data.trajectory().pTfirst() <
data.tools().pTmin())
return data.tracks();
443 data.tracks().push_back(
t);
445 return data.tracks();
456 const std::vector<const Trk::SpacePoint*>& Sp,
457 const std::vector<Amg::Vector3D>& Gp,
458 std::vector<const InDetDD::SiDetectorElement*>& DE,
459 std::multimap<const Trk::PrepRawData*, const Trk::Track*>&
PT,
460 bool isCaloCompatible,
461 const EventContext& ctx)
const
466 data.statistic().fill(
false);
471 if (
data.tools().multiTrack()) mult = 1;
472 double Xi2m =
data.tools().xi2multi();
474 data.tools().setBremNoise(
false,
true);
475 data.tracks().erase(
data.tracks().begin(),
data.tracks().end());
479 return data.tracks();
486 Q =
data.trajectory().isNewTrack(
PT);
491 data.trajectory().sortStep();
498 data.tools().setMultiTracks(0, Xi2m);
500 data.trackinfo() = oldinfo;
501 data.tools().setMultiTracks(mult,Xi2m);
503 if (
t==
nullptr)
return data.tracks();
506 data.tracks().push_back(
t);
507 na =
data.trajectory().nclusters();
508 if (na >=12 && !
data.trajectory().nclustersNoAdd())
return data.tracks();
510 if (
data.trajectory().pTfirst() <
data.pTminBrem())
return data.tracks();
512 if ((*Sp.begin())->clusterList().second)
return data.tracks();
518 data.tools().setBremNoise(
true,
true);
522 data.statistic()[
FT] =
true;
523 return data.tracks();
528 int nb =
data.trajectory().nclusters();
529 if (
nb <= na)
return data.tracks();
531 data.trajectory().sortStep();
533 if(
data.useFastTracking()) {
534 if(!
data.trajectory().filterWithPreciseClustersError(ctx)) {
536 return data.tracks();
547 data.tools().setMultiTracks(0, Xi2m);
549 data.trackinfo() = oldinfo;
550 data.tools().setMultiTracks(mult, Xi2m);
552 if (
t==
nullptr)
return data.tracks();
556 data.tracks().push_back(
t);
557 return data.tracks();
567 const std::vector<const Trk::SpacePoint*>& Sp,
568 const EventContext& ctx)
const
570 std::vector<const InDet::SiCluster*> Cl;
571 std::vector<const InDetDD::SiDetectorElement*> DE;
574 std::vector<const InDet::SiDetElementBoundaryLink_xk*> DEL;
576 return data.trajectory().pTseed(Tp,Cl,DEL,ctx);
586 const std::vector<const Trk::SpacePoint*>& Sp,
587 const std::vector<Amg::Vector3D>& Gp,
588 std::vector<const InDetDD::SiDetectorElement*>& DE,
589 std::multimap<const Trk::PrepRawData*,const Trk::Track*>&
PT,
590 const EventContext& ctx)
const
596 std::vector<const InDet::SiDetElementBoundaryLink_xk*> DEL;
606 REPORT_ERROR (StatusCode::FAILURE)<<
"Unable to dereference pix container, handle not valid";
610 p_pixcontainer = pixcontainer.
ptr();
611 data.setPixContainer(p_pixcontainer);
620 REPORT_ERROR (StatusCode::FAILURE)<<
"Unable to dereference sct container, handle not valid";
624 p_sctcontainer = sctcontainer.
ptr();
625 data.setSctContainer(p_sctcontainer);
629 std::vector<const InDet::SiCluster*> Cl;
630 bool isTwoPointSeed =
false;
641 if (Sp.size()==2) isTwoPointSeed =
true;
644 else if (Gp.size() > 2) {
645 if (!
data.trajectory().globalPositionsToClusters(p_pixcontainer, p_sctcontainer, Gp, DEL,
PT, Cl))
return TwoCluster;
648 if (!
data.trajectory().trackParametersToClusters(p_pixcontainer, p_sctcontainer, Tp, DEL,
PT, Cl, ctx))
return TwoCluster;
655 bool Q =
data.trajectory().initialize(
m_usePIX,
m_useSCT, p_pixcontainer, p_sctcontainer, Tp, Cl, DEL, Qr,ctx);
659 if (!Q && Sp.size() < 2 && Gp.size() > 3) {
663 if (!
data.trajectory().trackParametersToClusters(p_pixcontainer, p_sctcontainer, Tp, DEL,
PT, Cl,ctx))
return TwoCluster;
681 bool pixseed =
data.trajectory().isLastPixel();
684 if (!
data.useFastTracking() and
data.simpleTrack()) itmax = 10;
685 if (
data.heavyIon()) itmax = 50;
688 bool toReturnFailedTrack =
data.flagToReturnFailedTrack();
689 if( toReturnFailedTrack )
data.setResultCode(SiCombinatorialTrackFinderData_xk::ResultCode::Unrecoverable);
693 if (!
data.trajectory().forwardExtension (
false,itmax,ctx))
return CantFindTrk;
694 if (!
data.trajectory().backwardSmoother (
false,ctx) )
return CantFindTrk;
695 if (!
data.trajectory().backwardExtension(itmax,ctx) )
return CantFindTrk;
696 if (
data.isITkGeometry() &&
697 (
data.trajectory().nclusters() <
data.nclusmin() ||
701 if(!
data.useFastTracking() &&
data.trajectory().difference() > 0){
702 if (!
data.trajectory().forwardFilter(ctx)) {
703 if( toReturnFailedTrack ) {
704 data.setResultCode(SiCombinatorialTrackFinderData_xk::ResultCode::PixSeedDiffKFFwd);
711 if (!
data.trajectory().backwardSmoother (
false,ctx) ) {
712 if( toReturnFailedTrack ) {
713 data.setResultCode(SiCombinatorialTrackFinderData_xk::ResultCode::PixSeedDiffKFBwd);
721 int na =
data.trajectory().nclustersNoAdd();
723 if (
data.trajectory().nclusters()+na <
data.nclusmin() ||
724 data.trajectory().ndf() <
data.nwclusmin()) {
725 if( toReturnFailedTrack ) {
726 data.setResultCode(SiCombinatorialTrackFinderData_xk::ResultCode::PixSeedNCluster);
736 if (!
data.trajectory().backwardSmoother(isTwoPointSeed,ctx) )
return CantFindTrk;
737 if (!
data.trajectory().backwardExtension(itmax,ctx) )
return CantFindTrk;
738 if (!
data.trajectory().forwardExtension(
true,itmax,ctx))
return CantFindTrk;
741 int na =
data.trajectory().nclustersNoAdd();
742 if (
data.trajectory().nclusters()+na <
data.nclusmin() ||
745 if (!
data.trajectory().backwardSmoother(
false,ctx) )
return CantFindTrk;
748 na =
data.trajectory().nclustersNoAdd();
749 if (
data.trajectory().nclusters()+na <
data.nclusmin() ||
750 data.trajectory().ndf() <
data.nwclusmin()) {
751 if( toReturnFailedTrack ) {
752 data.setResultCode(SiCombinatorialTrackFinderData_xk::ResultCode::MixSeedNCluster);
760 if (
data.trajectory().difference() > 0) {
761 if (!
data.trajectory().forwardFilter(ctx)) {
762 if( toReturnFailedTrack ) {
763 data.setResultCode(SiCombinatorialTrackFinderData_xk::ResultCode::MixSeedDiffKFFwd);
769 if (!
data.trajectory().backwardSmoother (
false, ctx)) {
770 if( toReturnFailedTrack ) {
771 data.setResultCode(SiCombinatorialTrackFinderData_xk::ResultCode::MixSeedDiffKFBwd);
782 if( toReturnFailedTrack ) {
783 data.setResultCode(SiCombinatorialTrackFinderData_xk::ResultCode::Quality);
790 if (
data.trajectory().pTfirst () <
data.pTmin () &&
791 data.trajectory().nclusters() <
data.nclusmin()) {
792 if( toReturnFailedTrack ) {
800 if (
data.trajectory().nclusters() <
data.nclusminb() ||
801 data.trajectory().ndf () <
data.nwclusmin()) {
802 if( toReturnFailedTrack ) {
803 data.setResultCode(SiCombinatorialTrackFinderData_xk::ResultCode::NCluster);
812 data.trajectory().updateHoleSearchResult();
813 if (!
data.trajectory().getHoleSearchResult().passPatternHoleCut) {
814 if( toReturnFailedTrack ) {
815 data.setResultCode(SiCombinatorialTrackFinderData_xk::ResultCode::HoleCut);
823 if( toReturnFailedTrack ) {
824 if(
data.resultCode() != SiCombinatorialTrackFinderData_xk::ResultCode::Unrecoverable ) {
828 data.setResultCode(SiCombinatorialTrackFinderData_xk::ResultCode::Success);
851 if (!
data.simpleTrack()) {
854 std::make_unique<Trk::TrackStates>(
855 data.trajectory().convertToTrackStateOnSurface(
856 data.cosmicTrack())),
857 data.trajectory().convertToFitQuality());
863 if (!
data.flagToReturnFailedTrack()) {
866 std::make_unique<Trk::TrackStates>(
867 data.trajectory().convertToSimpleTrackStateOnSurface(
868 data.cosmicTrack(), ctx)),
869 data.trajectory().convertToFitQuality());
873 std::make_unique<Trk::TrackStates>(
875 .convertToSimpleTrackStateOnSurfaceForDisTrackTrigger(
876 data.cosmicTrack(), ctx)),
877 data.trajectory().convertToFitQuality());
887 auto tsos = std::make_unique<Trk::TrackStates>(
888 data.trajectory().convertToNextTrackStateOnSurface());
914 data.trajectory().convertToFitQuality());
935 (
const std::vector<const Trk::SpacePoint*>& Sp, std::vector<const InDet::SiCluster*>& Sc, std::optional<std::reference_wrapper<std::vector<const InDetDD::SiDetectorElement*>>> DE)
937 Sc.reserve(Sp.size());
950 p =
s->clusterList().second;
965 DE->get().reserve(Sc.size());
967 for (; cluster != endClusters; ++cluster) {
971 nextCluster = cluster;
973 for (; nextCluster != endClusters; ++nextCluster) {
974 if (de == (*nextCluster)->detectorElement()){
979 DE->get().push_back(de);
990 (std::vector<const InDetDD::SiDetectorElement*> & DE,
991 std::vector<const InDet::SiDetElementBoundaryLink_xk*>& DEL,
992 const EventContext& ctx)
const
998 boundaryPixel = *boundaryPixelHandle;
999 if (boundaryPixel==
nullptr) {
1005 boundarySCT = *boundarySCTHandle;
1006 if (boundarySCT==
nullptr) {
1011 DEL.reserve(DE.size());
1014 if (
d->isPixel() && boundaryPixel && id < boundaryPixel->
size()) DEL.push_back(&(*boundaryPixel)[
id]);
1015 else if (
d->isSCT() && boundarySCT && id < boundarySCT->
size()) DEL.push_back(&(*boundarySCT)[
id]);
1030 if (!Cuts.
getIntCut(
"CosmicTrack" , intCut)) intCut = 0;
1031 data.setCosmicTrack(intCut);
1033 if (!Cuts.
getIntCut(
"MinNumberOfClusters" , intCut)) intCut = 7;
1034 data.setNclusmin(intCut);
1038 if (!Cuts.
getIntCut(
"MinNumberOfWClusters", intCut)) intCut = 7;
1039 data.setNwclusmin(intCut);
1041 if (!Cuts.
getIntCut(
"MaxNumberOfHoles" , intCut)) intCut = 2;
1042 if(!
data.cosmicTrack() && intCut>2) intCut = 2;
1043 data.setNholesmax(intCut);
1045 if (!Cuts.
getIntCut(
"MaxHolesGap" , intCut)) intCut = 2;
1046 if(!
data.cosmicTrack() && intCut>2) intCut = 2;
1047 if(intCut >
data.nholesmax()) intCut =
data.nholesmax();
1048 data.setDholesmax(intCut);
1050 data.tools().setHolesClusters(
data.nholesmax(),
data.dholesmax(),
1053 if (!Cuts.
getIntCut(
"UseAssociationTool" , intCut)) intCut = 0;
1054 data.tools().setAssociation(intCut);
1056 if (!Cuts.
getIntCut(
"SimpleTrack" , intCut)) intCut = 0;
1057 data.setSimpleTrack(
bool(intCut));
1061 double doubleCut = 0.;
1063 if (!Cuts.
getDoubleCut(
"pTmin" , doubleCut)) doubleCut = 500.;
1064 data.setPTmin(doubleCut);
1066 if (!Cuts.
getDoubleCut(
"pTminBrem" , doubleCut)) doubleCut = 1000.;
1067 data.setPTminBrem(doubleCut);
1069 if (!Cuts.
getDoubleCut(
"MaxXi2forCluster" , doubleCut)) doubleCut = 9.;
1070 data.setXi2max(doubleCut);
1072 if (!Cuts.
getDoubleCut(
"MaxXi2forOutlier" , doubleCut)) doubleCut = 25.;
1073 if (!
data.cosmicTrack() && doubleCut > 25.) doubleCut = 25.;
1074 if (doubleCut <=
data.xi2max()) doubleCut =
data.xi2max()+5.;
1075 data.setXi2maxNoAdd(doubleCut);
1077 if (!Cuts.
getDoubleCut(
"MaxXi2forSearch" , doubleCut)) doubleCut = 100.;
1078 data.setXi2maxlink(doubleCut);
1080 data.tools().setXi2pTmin(
data.xi2max(),
data.xi2maxNoAdd(),
1083 if (!Cuts.
getIntCut (
"doMultiTracksProd", intCut)) intCut = 0;
1084 if (!Cuts.
getDoubleCut(
"MaxXi2MultiTracks", doubleCut)) doubleCut = 7.;
1085 if (!
data.cosmicTrack() && doubleCut > 7.) doubleCut = 7.;
1086 data.tools().setMultiTracks(intCut, doubleCut);
1088 data.trajectory().setParameters();
1097 if (fieldCondObj ==
nullptr) {
1098 std::string
msg =
"InDet::SiCombinatorialTrackFinder_xk::initializeCombinatorialData: Failed to retrieve AtlasFieldCacheCondObj with key " +
m_fieldCondObjInputKey.
key();
1099 throw(std::runtime_error(
msg));
1101 data.setFieldCondObj(fieldCondObj);
1113 data.setPixelDetectorElementStatus( pixelDetElStatus.
cptr() );
1117 data.setSCTDetectorElementStatus( sctDetElStatus.
cptr() );