# Get Error after using TrackHeed::TransportDeltaElectron()

**URL:** <https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602>\
**Category:** Garfield++\
**Tags:** root\
**Created:** [March 20, 2024, 1:37pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602 "2024-03-20T13:37:33Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [March 20, 2024, 1:37pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/1 "2024-03-20T13:37:33Z")

</div>

Dear experts

I used `TrackHeed::TraansportDeltaElectron()` to simulated many delta electrons, but after I simulated all particles and try to save them (didn’t use Garfield++ here) I got error:

```auto
void AtomPhotoAbsCS::remove_shell(int nshell): ERROR:

nshell< 0 ||nshell>= qshell
nshell=90155568
FunNameStack: s_init=1 qname=1
  0 void AtomPhotoAbsCS::remove_shell(int nshell) 
File is /group/had/muon/ssun/ICEDUST_master/ICEDUST_externals_source_LFS/GARFIELD/garfield_5.0/Heed/heed++/code/PhotoAbsCS.cpp , line number is 625
spexit_action: the streams will be now flushed
spexit_action: the abort function is called

```

my code looks like:

```auto
TrackHeed fTrackHeed = new TrackHeed();
for(int I=0; I<10000; ++i){
  fTrackHeed->TransportDeltaElectron(xxx);
  //extract electrons information here
  //save to root file here
}

```

is this because electrons will keep increasing in the fTrackHeed object? If so how can I flush (or reset) it? Thank you in advance!

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [March 20, 2024, 1:52pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/2 "2024-03-20T13:52:05Z")

</div>

Hi,  
can you please provide a **minimal working** example?

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [March 20, 2024, 1:55pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/3 "2024-03-20T13:55:13Z")

</div>

I see, I will try to make one, but can you please tell that if the number of clusters will keep increasing if I don’t `delete` TrackHeed object?  
I want to understand what does this error message mean

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [March 20, 2024, 2:00pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/4 "2024-03-20T14:00:11Z")

</div>

Let me give some simple example:

```auto
TrackHeed* fTrack = new TrackHeed();

fTrack->TransportDeltaElectron(x1,y1,z1,t1,e1,dx1,dy1,dz1,num1); //simulate one delta electron
fTrack->TransportDeltaElectron(x2,y2,z2,t2,e2,dx2,dy2,dz2,num2); //simulate another delta electron

```

and my question is: will num2 = num1 + num\_clusters\_of\_deltaElectron2 because I used the same object pointer?

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [March 20, 2024, 2:11pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/5 "2024-03-20T14:11:50Z")

</div>

No, `num1` is the number of electrons produced by the first call to `TransportDeltaElectron`, `num2` is the number of electrons produced by the second call.

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [March 20, 2024, 2:14pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/6 "2024-03-20T14:14:22Z")

</div>

Thank you, emmmmm…then I have no clue of the error I got. So basically I don’t need to recreate `TrackHeed` object at all to simulate different particles, is this correct?

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [March 20, 2024, 2:21pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/7 "2024-03-20T14:21:41Z")

</div>

> [@Crisps](#):
>
> So basically I don’t need to recreate `TrackHeed` object at all to simulate different particles, is this correct?

Correct.

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [March 20, 2024, 2:31pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/8 "2024-03-20T14:31:57Z")

</div>

Thank you! I just found the error message I showed, it appeared not even the place I used Garfield++ but quite after…maybe this is hard to reproduce, can you please briefly tell what does the error message indicate so that I can check my code?

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [March 20, 2024, 2:41pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/9 "2024-03-20T14:41:26Z")

</div>

It’s hard to say; I had a quick look and the function that seems to throw this error is not normally called at all. To debug it further, I would need a minimal working example that reproduces the issue.

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [March 21, 2024, 4:51am UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/10 "2024-03-21T04:51:24Z")

</div>

Sorry I found it only can be reproduced on my app… but I found something wired:  
the app is trying to save some object inherited from `Object`, the error occurred at the saving process which has nothing to do with Heed…  
I used `gdb` to get stack calling information before abort signal, but seems `TClass::GetActualClass()` is calling `Heed::AtomPhotoAbsCS::remove_shell` (#3 and #4 in the debug info) ??? How can this be?

debug info here:

```auto
(gdb) bt
#0 0x00007fffec24f387 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:55
#1 0x00007fffec250a78 in __GI_abort () at abort.c:90
#2 0x00007ffff546f6e6 in Heed::spexit_action (file=...)
    at /group/had/muon/ssun/ICEDUST_master/ICEDUST_externals_source_LFS/GARFIELD/garfield_5.0/Heed/wcpplib/util/FunNameStack.cpp:310
#3 0x00007ffff53c24c1 in Heed::AtomPhotoAbsCS::remove_shell (this=0x49f5780, nshell=77551488)
    at /group/had/muon/ssun/ICEDUST_master/ICEDUST_externals_source_LFS/GARFIELD/garfield_5.0/Heed/heed++/code/PhotoAbsCS.cpp:625
#4 0x00007ffff2e02787 in TClass::GetActualClass (this=this@entry=0xd429a0, object=object@entry=0x49f5780)
    at /group/had/muon/ssun/ICEDUST_master/ICEDUST_externals_source_LFS/ROOT/root_v6.18.00/core/meta/src/TClass.cxx:2535
#5 0x00007ffff242eb2b in TBufferIO::WriteObjectAny (this=0xd26f120, obj=0x49f5780, ptrClass=0xd429a0, cacheReuse=true)
    at /group/had/muon/ssun/ICEDUST_master/ICEDUST_externals_source_LFS/ROOT/root_v6.18.00/io/io/src/TBufferIO.cxx:504
#6 0x00007ffff2dc8eed in operator<< <TObject> (obj=0x49f5780, buf=...)
    at /group/had/muon/ssun/ICEDUST_master/build_externals/root_v6.18.00/include/TBuffer.h:401
#7 TObjArray::Streamer (this=0x49c82a0, b=...)
    at /group/had/muon/ssun/ICEDUST_master/ICEDUST_externals_source_LFS/ROOT/root_v6.18.00/core/cont/src/TObjArray.cxx:486
#8 0x00007ffff2427bb4 in Streamer (onfile_class=0x0, b=..., obj=0x49c82a0, this=0xdac4d0)
    at /group/had/muon/ssun/ICEDUST_master/build_externals/root_v6.18.00/include/TClass.h:570
#9 TBufferFile::WriteObjectClass (this=0xd26f120, actualObjectStart=0x49c82a0, actualClass=0xdac4d0, cacheReuse=<optimized out>)
    at /group/had/muon/ssun/ICEDUST_master/ICEDUST_externals_source_LFS/ROOT/root_v6.18.00/io/io/src/TBufferFile.cxx:2552
#10 0x00007ffff242eb63 in TBufferIO::WriteObjectAny (this=0xd26f120, obj=0x49c82a0, ptrClass=0xdac4d0, cacheReuse=true)
    at /group/had/muon/ssun/ICEDUST_master/ICEDUST_externals_source_LFS/ROOT/root_v6.18.00/io/io/src/TBufferIO.cxx:522
###########more lines not shown here############

```

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [March 21, 2024, 6:22am UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/11 "2024-03-21T06:22:54Z")

</div>

Does your object contain anything related to TrackHeed as a class member?

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [March 21, 2024, 1:31pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/12 "2024-03-21T13:31:57Z")

</div>

No, I didn’t store any TrackHeed objects in root file, and because `TrackHeed` is not inherited from `TObject` I think I won’t be able to do that anyway…

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [March 21, 2024, 1:56pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/13 "2024-03-21T13:56:55Z")

</div>

Also I quickly had a look in `PhotoAbsCS.cpp`, seems nshell is the number of energy level of an atom, but how can I change this value…? I didn’t even use functions from `Heed`, I only used functions of `Garfield::TrackHeed` and I believe `TrackHeed` already extract information from `Heed::particle` so there should be no information left for `Heed::particle`

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [March 21, 2024, 2:22pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/14 "2024-03-21T14:22:35Z")

</div>

To be able to debug this further, I’m afraid you will need to provide a minimal working example that reproduces the problem.

---

<div class="post-metadata">

**Author:** ![mjag](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mjag](https://root-forum.cern.ch/u/mjag)\
**Post date:** [March 21, 2024, 3:19pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/16 "2024-03-21T15:19:56Z")

</div>

Hello, are you trying to save `TrackHeed` class through ROOT I/O? If I were you I’d try to comment out every I/O part of your code and see if the problem persists.  
You wouldn’t want that anyway, since `TrackHeed` is a “tool” class, not a “storage” class.

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [March 21, 2024, 3:34pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/17 "2024-03-21T15:34:07Z")

</div>

Thank you for the reply, the error occurred when `TGeoManager::Write()` is called, but this is nothing to do with `TrackHeed`… I will try to comment out I/O to check the result

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [March 21, 2024, 4:22pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/18 "2024-03-21T16:22:10Z")

</div>

This problem is solved by found a mistake of deleting `TGeoNode` pointer, I mistakenly add `delete node;` in somewhere and caused `node` becomes a dangling pointer. But it turns out this is nothing related to Garfield++, but no one knows what happens if there is a dangling pointer in your app…

Anyway, thank you all for sparing your time to help me!

---

<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:** [April 4, 2024, 4:22pm UTC](https://root-forum.cern.ch/t/get-error-after-using-trackheed-transportdeltaelectron/58602/19 "2024-04-04T16:22:37Z")

</div>

Closed on April 4, 2024, 4:22pm UTC

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