Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RefitProcessor crashes with default (-1) InitialTrackState option #60

Open
dudarboh opened this issue Jun 13, 2022 · 2 comments
Open

RefitProcessor crashes with default (-1) InitialTrackState option #60

dudarboh opened this issue Jun 13, 2022 · 2 comments

Comments

@dudarboh
Copy link
Member

#Issue
As title says
RefitProcessor crashes with uncaught exception using default (-1) InitialTrackState option.

#Reproduce

source /cvmfs/ilc.desy.de/sw/x86_64_gcc82_centos7/v02-02-03/init_ilcsoft.sh

steering file:

<marlin>
    <constants>
    </constants>

    <global>
		<parameter name="LCIOInputFiles">
            /pnfs/desy.de/ilc/prod/ilc/mc-2020/ild/rec/250-SetA/2f_hadronic_eL_pR/ILD_l5_o1_v02/v02-02/00015161/000/rv02-02.sv02-02.mILD_l5_o1_v02.E250-SetA.I500010.P2f_z_h.eL.pR.n000_052.d_rec_00015161_219.slcio
        </parameter>
		<parameter name="MaxRecordNumber" value="0" />
        <parameter name="SkipNEvents" value="0" />
        <parameter name="SupressCheck" value="false" />
		<parameter name="AllowToModifyEvent" value="false" />

	</global>

	<execute>
        <processor name="InitDD4hep" />
        <processor name="MyTestRefitProcessorProton" />
	</execute>

    <processor name="InitDD4hep" type="InitializeDD4hep">
        <parameter name="DD4hepXMLFile" type="string">
            /cvmfs/ilc.desy.de/sw/x86_64_gcc82_centos7/v02-02/lcgeo/v00-16-06/ILD/compact/ILD_l5_o1_v02/ILD_l5_o1_v02.xml
        </parameter>
    </processor>

    <processor name="MyTestRefitProcessorProton" type="RefitProcessor">
      <!--RefitProcessor refits an input track collection, producing a new collection of tracks. Proton mass hypothesis-->
      <!--Use Energy Loss in Fit-->
      <parameter name="EnergyLossOn" type="bool">true</parameter>
      <!--Fit direction: -1: backward [default], +1: forward-->
      <parameter name="FitDirection" type="int">-1</parameter>
      <!--Value used for the initial d0 variance of the trackfit-->
      <parameter name="InitialTrackErrorD0" type="float">1e+06</parameter>
      <!--Value used for the initial omega variance of the trackfit-->
      <parameter name="InitialTrackErrorOmega" type="float">0.00001</parameter>
      <!--Value used for the initial phi0 variance of the trackfit-->
      <parameter name="InitialTrackErrorPhi0" type="float">100</parameter>
      <!--Value used for the initial tanL variance of the trackfit-->
      <parameter name="InitialTrackErrorTanL" type="float">100</parameter>
      <!--Value used for the initial z0 variance of the trackfit-->
      <parameter name="InitialTrackErrorZ0" type="float">1e+06</parameter>
      <!--TrackState to use for initialization of the fit: -1: refit from hits [default], 1: AtIP, 2: AtFirstHit, 3: AtLastHit, 4:AtCalo-->
      <parameter name="InitialTrackState" type="int">-1</parameter>
      <!--Name of the input track collection-->
      <parameter name="InputTrackCollectionName" type="string" lcioInType="Track">MarlinTrkTracks</parameter>
      <!--Name of the MCParticle-Track Relations collection for input tracks-->
      <parameter name="InputTrackRelCollection" type="string" lcioInType="LCRelation" />
      <!--Maximum Chi-squared value allowed when assigning a hit to a track-->
      <!--  <parameter name="MaxChi2PerHit" type="float">100 </parameter>-->
      <!--Use MultipleScattering in Fit-->
      <!--  <parameter name="MultipleScatteringOn" type="bool">true </parameter>-->
      <!--Name of the output track collection-->
      <parameter name="OutputTrackCollectionName" type="string" lcioOutType="Track">MarlinTrkTracksProton</parameter>
      <!--Name of the MCParticle-Track Relations collection for output tracks-->
      <parameter name="OutputTrackRelCollection" type="string" lcioOutType="LCRelation">MarlinTrkTracksProtonMCP</parameter>
      <!--particle mass that is used in the fit - default is the pion mass: 0.13957018 )-->
      <parameter name="ParticleMass" type="double">0.93828</parameter>
      <!--Smooth All Mesurement Sites in Fit-->
      <!--  <parameter name="SmoothOn" type="bool">false </parameter>-->
      <!--Name of the track fitting system to be used (KalTest, DDKalTest, aidaTT, ... )-->
      <parameter name="TrackSystemName" type="string">DDKalTest</parameter>
      <!--verbosity level of this processor ("DEBUG0-4,MESSAGE0-4,WARNING0-4,ERROR0-4,SILENT")-->
      <!-- <parameter name="Verbosity" type="string">MESSAGE</parameter> -->
    </processor>
</marlin>

Output:

[ DEBUG4 "MyTestRefitProcessorProton"] MarlinTrk::createFit ndof_added = 462
[ DEBUG5 "MyTestRefitProcessorProton"] MarlinTrk::createFit : null pointer for pre_fit given - will fall back  to default initialisation ...
Error in <operator()>: Request row(1) outside matrix range of 0 - 1
[ ERROR "MyTestRefitProcessorProton"] RefitProcessor::processEvent: EVENT: << 20401 >> exception caught and rethown. Track = 0x16182660
[ DEBUG2 "MyTestRefitProcessorProton"]   **** MarlinDDKalTest::includeEnergyLoss( 1 ) called 
[ DEBUG2 "MyTestRefitProcessorProton"]   **** MarlinDDKalTest::includeMultipleScattering( 1 ) called 
 ***********************************************
 A runtime error occured - (uncaught exception):
      MarlinTrk::Exception: Track fit cannot be initialised from 1 Dimensional hits. Use method MarlinDDKalTestTrack::initialise( bool fitDirection )
 Marlin will have to be terminated, sorry.
 ***********************************************
@dudarboh
Copy link
Member Author

I think this can be fixed if one uses
createFinalisedLCIOTrack( ..., const EVENT::FloatVec& initial_cov_for_prefit, ...)`
it constructs pre-fit automatically ensuring that there are enough 3D hits to reconstruct it.

instead of currently used:
createFinalisedLCIOTrack(..., EVENT::TrackState* pre_fit, ...)

Which immediately calls
int fit_status = createFit(hit_list, marlinTrk, pre_fit, bfield_z, fit_direction, maxChi2Increment);
even if the pre_fit is a nullptr.

@dudarboh
Copy link
Member Author

It was actually intentionally changed in the refit processor a while ago here:
3a6683d?diff=unified

@gaede do you recall the reason for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant