# TSpectrum2::Bac... ERROR function not yet implemented

**URL:** <https://root-forum.cern.ch/t/tspectrum2-bac-error-function-not-yet-implemented/64427>\
**Category:** ROOT\
**Tags:** hist, root\
**Created:** [November 21, 2025, 10:06am UTC](https://root-forum.cern.ch/t/tspectrum2-bac-error-function-not-yet-implemented/64427 "2025-11-21T10:06:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lshan](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/958977/32.png) [@lshan](https://root-forum.cern.ch/u/lshan)\
**Post date:** [November 21, 2025, 10:06am UTC](https://root-forum.cern.ch/t/tspectrum2-bac-error-function-not-yet-implemented/64427/1 "2025-11-21T10:06:28Z")

</div>

* * *

Dear Experts,

Please pardon a strange question and please give a look when you are free.

The root to use is : /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.30.02-398ae/x86\_64-centos7-gcc11-opt

In the CMakeLists.txt for my module there has been

```auto
find_package(ROOT COMPONENTS Core RIO TreePlayer Spectrum )
….

target_link_libraries( myPack PRIVATE ROOT::Spectrum )

```

In the code, TSpectrum2 is declared and used per event like

```auto
TSpectrum2 * tSpct2 = new TSpectrum2( _maxPeaks ) ;
tSpct2->SetAverageWindow( 5 ) ;
tSpct2->SetDeconIterations( 5 ) ;
Int_t nfound = tSpct2->Search( h2da, 1, “nobackground,col”, 0.1 );
cout <<" #peaks : "<< nfound << endl ;

if ( tSpct2 != 0x0 ) delete tSpct2 ;

```

The code built well and run to the end, but with always zero peaks, and runtime error like

```auto
TSpectrum2::Bac… ERROR function not yet implemented: h=HoughPeaks_Evt2, iter=747067430, option=8}

```

The error came from L157 from doc/v630/TSpectrum2\_8cxx

It’s more strange, from whole of this TSpectrum2.cxx, this TH1 \*Background(…) function was NOT explicitly called in either Search() or SearchHighRes() …

Would experts confirm this Background ERROR will simply lead to null peaks,

or I can ignore that ERROR ?

Or I should re-config my CMakeLists.txt to link/load Spectrum in a better way ?

Many thanks in advance !

Lianyou

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [November 21, 2025, 10:14am UTC](https://root-forum.cern.ch/t/tspectrum2-bac-error-function-not-yet-implemented/64427/2 "2025-11-21T10:14:42Z")

</div>

Welcome to the ROOT Forum!  
Maybe @moneta can help

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [November 21, 2025, 7:20pm UTC](https://root-forum.cern.ch/t/tspectrum2-bac-error-function-not-yet-implemented/64427/3 "2025-11-21T19:20:45Z")

</div>

CMakeLists looks fine.

- Could you retry with ROOT 6.36? It might be an issue with ROOT 6.30
- Could you provide a full running reproducer with some dummy random data?

It’s likely that Background was called in another place, such as ShowPeaks if you are calling that somewhere later or so.

In any case, here a PR fixing the missing function:

> <https://github.com/root-project/root/pull/20479>
>
> \# This Pull request:
> 
> \## Changes or fixes:
> 
> Since it's implemented for the 1…D version, and for the 2D/3D versions you can call it via raw pointers but not directly via TH2 or TH3.
> 
> Functions were marked before as to-do, so no one could be calling them directly since they were already doing nothing and raising error. Hence, function signature and name were adapted to match the 2D and 3D needed parameters. Since these are legacy classes, the code from the implemented 1D version was copy-pasted and adapted, but no code modernization was performed, such as avoiding new/delete etc or clang-formatting.
> 
> Fixes https://root-forum.cern.ch/t/tspectrum2-bac-error-function-not-yet-implemented/64427
> I've been hit myself with this, too.
> 
> \## Checklist:
> 
> \- \[x\] tested changes locally
> \- \[x\] updated the docs (if necessary)

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [December 5, 2025, 7:20pm UTC](https://root-forum.cern.ch/t/tspectrum2-bac-error-function-not-yet-implemented/64427/4 "2025-12-05T19:20:56Z")

</div>

Closed on December 5, 2025, 7:20pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
