TTree::LoadTree
would return -2 and the entry should be entirely skipped.
@pcanal There is no “external event loop”. Just “t ->Draw(...)
”, so the question is what will happen in this method.
@faca87 So, you now have several “suspicious” entries, which you need to inspect carefully (i.e., the main tree “t” and the corresponding entries in the friend “te” tree).
See ROOT: tree/treeplayer/src/TTreePlayer.cxx Source File line 2293
What should I do?
@pcanal So, from this piece of code, I assume such entries will automatically be “rejected” / “dumped”.
Actually, do you maybe know how to print “friend columns” here:
t->Scan("*", "..."); // prints only "t" columns but we also need the corresponding "te" columns
Actually, do you maybe know how to print “friend columns” here:
You have to explicitly name them (the wildcard implementation looks only in the main tree).
@faca87 So, you need something like this:
t->Scan("B1Scintparticles.ScintParticleID:B1ScintOutparticles.ScintOutParticleID:B1Scintparticles.ScintParticleKinEn:B1ScintOutparticles.ScintOutParticleKinEn:B1Scintparticles.ScintParticleTrackEvenID:B1ScintOutparticles.ScintOutParticleTrackEventID:B1Scintparticles.ScintParticleEventID:B1ScintOutparticles.ScintOutParticleEventID:B1Scintparticles.ScintParticleParentID:B1ScintOutparticles.ScintOutParticleParentID:B1Scintparticles.ScintParticleTrackID:B1ScintOutparticles.ScintOutParticleTrackID", "B1Scintparticles.ScintParticleKinEn - B1ScintOutparticles.ScintOutParticleKinEn < -0.5");
Actually. maybe this works better (entry numbers come from your previous “Scan” output):
std::cout << "\n"; t->GetEntry(58282); t->Show(); te->Show();
std::cout << "\n"; t->GetEntry(75258); t->Show(); te->Show();
std::cout << "\n"; t->GetEntry(129681); t->Show(); te->Show();
std::cout << "\n"; t->GetEntry(134897); t->Show(); te->Show();
std::cout << "\n"; t->GetEntry(142955); t->Show(); te->Show();
In particular, carefully inspect tree “expressions” that you use for the index:
Hello @Wile_E_Coyote this is the print of these lines
r
oot [0] .x deltakinene.cpp
TFile** B1/B1-build/B1.root
TFile* B1/B1-build/B1.root
KEY: TTree B1EventVariables;1 Relesed_energy
KEY: TTree B1Exitparticles;1 Exit_targets
KEY: TTree B1Enteringparticles;1 Entering_targets
KEY: TTree B1Enterinregengparticles;1 Entering_regen
KEY: TTree B1EnterinPhotonregengparticles;1 Entering_photon_regen
KEY: TTree B1Exitregengparticles;1 Exit_regen
KEY: TTree B1Scintparticles;1 Ent_scint
KEY: TTree B1Dummyparticles;1 Ent_Dummy
KEY: TTree B1ParticleNotInteracting;1 Part_not_inter
KEY: TTree B1ScintSecCreated;1 Sec_crated
KEY: TTree B1ScintOutparticles;1 Ent_scint
************************************************************************************************************************************************************************************************************************************************************************
* Row * ScintPart * ScintPart * ScintPart * ScintPart * ScintPart * ScintPart * ScintPart * ScintPart * ScintPart * ScintDire * ScintDire * ScintDire * ScintPart * ScintPart * ScintPart * ScintPart * ScintPart * ScintPart * ScintPart * ScintPart * ScintPart *
************************************************************************************************************************************************************************************************************************************************************************
* 58282 * -11 * 0.2168374 * -0.497504 * -0.818652 * -0.286874 * 0.0803287 * -0.046046 * 0.1277309 * 0.5182913 * -96.62228 * -11.81035 * -292.8133 * -0.257852 * -0.424300 * -0.148684 * 1.0477402 * 1.2337446 * 6 * 233462618 * 2 * 1.534e+09 *
* 75258 * 11 * 0.5303339 * -0.364324 * 0.5221898 * -0.771093 * -0.212416 * -0.168336 * 0.4262683 * 0.9073335 * -118.7749 * -3.204063 * -283.6374 * -0.330563 * 0.4738003 * -0.699639 * 0.4413877 * -0.595264 * 5 * 314832492 * 2 * 1.299e+09 *
* 129681 * 11 * 0.2277688 * -0.145147 * 0.6590383 * -0.737970 * 0.1472122 * 0.0978483 * 0.1308536 * 0.5335334 * -117.6213 * 9.5662456 * -284.1152 * -0.077440 * 0.3516190 * -0.393732 * 0.1942052 * -0.728957 * 2 * 536567457 * 1 * -30345499 *
* 134897 * 11 * 0.1320172 * -0.331957 * 0.4768878 * -0.813868 * 0.1476853 * 0.0608789 * -0.300019 * 0.3903201 * -142.6222 * -19.92751 * -278.9924 * -0.129569 * 0.1861389 * -0.317669 * 0.3872769 * -0.530025 * 2 * 560809324 * 1 * -1.83e+09 *
* 142955 * 11 * 0.3659767 * -0.056925 * 0.7544665 * -0.653865 * -0.003181 * 0.0015342 * -299.1784 * 0.7127176 * -102.2086 * 9.7672174 * -290.4993 * -0.040571 * 0.5377216 * -0.466021 * 0.0868410 * -0.856709 * 2 * 596205684 * 1 * -79477014 *
************************************************************************************************************************************************************************************************************************************************************************
==> 5 selected entries
======> EVENT:58282
ScintParticleID = -11
ScintParticleKinEn = 0.216837
ScintParticleMomDir.x = -0.497505
ScintParticleMomDir.y = -0.818652
ScintParticleMomDir.z = -0.286875
ScintParticleVert.x = 0.0803287
ScintParticleVert.y = -0.046046
ScintParticleVert.z = 0.127731
ScintParticleTotMom = 0.518291
ScintDirection.x = -96.6223
ScintDirection.y = -11.8104
ScintDirection.z = -292.813
ScintParticleMom.x = -0.257852
ScintParticleMom.y = -0.4243
ScintParticleMom.z = -0.148685
ScintParticleAng.x = 1.04774
ScintParticleAng.y = 1.23374
ScintParticleTrackID = 6
ScintParticleEventID = 2.33463e+08
ScintParticleParentID = 2
ScintParticleTrackEvenID = 1.53438e+09
======> EVENT:56622
ScintOutParticleID = -11
ScintOutParticleKinEn = 1.09888
ScintOutParticleMomDir.x = 0.7488
ScintOutParticleMomDir.y = 0.0420661
ScintOutParticleMomDir.z = 0.661459
ScintOutParticleVert.x = 0.0803287
ScintOutParticleVert.y = -0.046046
ScintOutParticleVert.z = 0.127731
ScintOutParticleTotMom = 1.52662
ScintOutDirection.x = -94.7846
ScintOutDirection.y = 4.2501
ScintOutDirection.z = -294.158
ScintOutParticleMom.x = 1.14314
ScintOutParticleMom.y = 0.0642191
ScintOutParticleMom.z = 1.0098
ScintOutParticleAng.x = 0.847252
ScintOutParticleAng.y = 0.0635104
ScintOutParticleTrackID = 6
ScintOutParticleEventID = 2.33463e+08
ScintOutParticleParentID = 2
ScintOutParticleTrackEventID = 1.53438e+09
======> EVENT:75258
ScintParticleID = 11
ScintParticleKinEn = 0.530334
ScintParticleMomDir.x = -0.364324
ScintParticleMomDir.y = 0.52219
ScintParticleMomDir.z = -0.771094
ScintParticleVert.x = -0.212416
ScintParticleVert.y = -0.168337
ScintParticleVert.z = 0.426268
ScintParticleTotMom = 0.907334
ScintDirection.x = -118.775
ScintDirection.y = -3.20406
ScintDirection.z = -283.637
ScintParticleMom.x = -0.330563
ScintParticleMom.y = 0.4738
ScintParticleMom.z = -0.699639
ScintParticleAng.x = 0.441388
ScintParticleAng.y = -0.595264
ScintParticleTrackID = 5
ScintParticleEventID = 3.14832e+08
ScintParticleParentID = 2
ScintParticleTrackEvenID = 1.29988e+09
======> EVENT:73045
ScintOutParticleID = 11
ScintOutParticleKinEn = 1.03426
ScintOutParticleMomDir.x = -0.51303
ScintOutParticleMomDir.y = 0.562441
ScintOutParticleMomDir.z = 0.648429
ScintOutParticleVert.x = -0.212416
ScintOutParticleVert.y = -0.168337
ScintOutParticleVert.z = 0.426268
ScintOutParticleTotMom = 1.45833
ScintOutDirection.x = -104.965
ScintOutDirection.y = -18.9706
ScintOutDirection.z = -289.358
ScintOutParticleMom.x = -0.748165
ScintOutParticleMom.y = 0.820222
ScintOutParticleMom.z = 0.94562
ScintOutParticleAng.x = -0.669346
ScintOutParticleAng.y = 0.714504
ScintOutParticleTrackID = 5
ScintOutParticleEventID = 3.14832e+08
ScintOutParticleParentID = 2
ScintOutParticleTrackEventID = 1.29988e+09
======> EVENT:129681
ScintParticleID = 11
ScintParticleKinEn = 0.227769
ScintParticleMomDir.x = -0.145147
ScintParticleMomDir.y = 0.659038
ScintParticleMomDir.z = -0.737971
ScintParticleVert.x = 0.147212
ScintParticleVert.y = 0.0978483
ScintParticleVert.z = 0.130854
ScintParticleTotMom = 0.533533
ScintDirection.x = -117.621
ScintDirection.y = 9.56625
ScintDirection.z = -284.115
ScintParticleMom.x = -0.0774409
ScintParticleMom.y = 0.351619
ScintParticleMom.z = -0.393732
ScintParticleAng.x = 0.194205
ScintParticleAng.y = -0.728957
ScintParticleTrackID = 2
ScintParticleEventID = 5.36567e+08
ScintParticleParentID = 1
ScintParticleTrackEvenID = -3.03455e+08
======> EVENT:121499
ScintOutParticleID = 11
ScintOutParticleKinEn = 0.783508
ScintOutParticleMomDir.x = 0.262339
ScintOutParticleMomDir.y = 0.881681
ScintOutParticleMomDir.z = -0.392196
ScintOutParticleVert.x = 0.147212
ScintOutParticleVert.y = 0.0978483
ScintOutParticleVert.z = 0.130854
ScintOutParticleTotMom = 1.18938
ScintOutDirection.x = -118.74
ScintOutDirection.y = -8.71132
ScintOutDirection.z = -283.652
ScintOutParticleMom.x = 0.312021
ScintOutParticleMom.y = 1.04865
ScintOutParticleMom.z = -0.46647
ScintOutParticleAng.x = -0.589545
ScintOutParticleAng.y = -1.15225
ScintOutParticleTrackID = 2
ScintOutParticleEventID = 5.36567e+08
ScintOutParticleParentID = 1
ScintOutParticleTrackEventID = -3.03455e+08
======> EVENT:134897
ScintParticleID = 11
ScintParticleKinEn = 0.132017
ScintParticleMomDir.x = -0.331957
ScintParticleMomDir.y = 0.476888
ScintParticleMomDir.z = -0.813869
ScintParticleVert.x = 0.147685
ScintParticleVert.y = 0.060879
ScintParticleVert.z = -0.30002
ScintParticleTotMom = 0.39032
ScintDirection.x = -142.622
ScintDirection.y = -19.9275
ScintDirection.z = -278.992
ScintParticleMom.x = -0.12957
ScintParticleMom.y = 0.186139
ScintParticleMom.z = -0.317669
ScintParticleAng.x = 0.387277
ScintParticleAng.y = -0.530026
ScintParticleTrackID = 2
ScintParticleEventID = 5.60809e+08
ScintParticleParentID = 1
ScintParticleTrackEvenID = -1.83139e+09
======> EVENT:126894
ScintOutParticleID = 11
ScintOutParticleKinEn = 0.646364
ScintOutParticleMomDir.x = -0.150265
ScintOutParticleMomDir.y = 0.981525
ScintOutParticleMomDir.z = 0.11844
ScintOutParticleVert.x = 0.147685
ScintOutParticleVert.y = 0.060879
ScintOutParticleVert.z = -0.30002
ScintOutParticleTotMom = 1.03844
ScintOutDirection.x = -141.915
ScintOutDirection.y = -21.1893
ScintOutDirection.z = -279.465
ScintOutParticleMom.x = -0.156042
ScintOutParticleMom.y = 1.01926
ScintOutParticleMom.z = 0.122994
ScintOutParticleAng.x = -0.903287
ScintOutParticleAng.y = 1.45071
ScintOutParticleTrackID = 2
ScintOutParticleEventID = 5.60809e+08
ScintOutParticleParentID = 1
ScintOutParticleTrackEventID = -1.83139e+09
======> EVENT:142955
ScintParticleID = 11
ScintParticleKinEn = 0.365977
ScintParticleMomDir.x = -0.0569255
ScintParticleMomDir.y = 0.754467
ScintParticleMomDir.z = -0.653865
ScintParticleVert.x = -0.00318105
ScintParticleVert.y = 0.0015343
ScintParticleVert.z = -299.178
ScintParticleTotMom = 0.712718
ScintDirection.x = -102.209
ScintDirection.y = 9.76722
ScintDirection.z = -290.499
ScintParticleMom.x = -0.0405718
ScintParticleMom.y = 0.537722
ScintParticleMom.z = -0.466021
ScintParticleAng.x = 0.0868411
ScintParticleAng.y = -0.85671
ScintParticleTrackID = 2
ScintParticleEventID = 5.96206e+08
ScintParticleParentID = 1
ScintParticleTrackEvenID = -7.9477e+08
======> EVENT:134691
ScintOutParticleID = 11
ScintOutParticleKinEn = 0.93347
ScintOutParticleMomDir.x = 0.63973
ScintOutParticleMomDir.y = 0.675871
ScintOutParticleMomDir.z = 0.365984
ScintOutParticleVert.x = -0.00318105
ScintOutParticleVert.y = 0.0015343
ScintOutParticleVert.z = -299.178
ScintOutParticleTotMom = 1.35106
ScintOutDirection.x = -110.998
ScintOutDirection.y = -10.5611
ScintOutDirection.z = -286.859
ScintOutParticleMom.x = 0.864315
ScintOutParticleMom.y = 0.913143
ScintOutParticleMom.z = 0.494468
ScintOutParticleAng.x = 1.05115
ScintOutParticleAng.y = 1.0745
ScintOutParticleTrackID = 2
ScintOutParticleEventID = 5.96206e+08
ScintOutParticleParentID = 1
ScintOutParticleTrackEventID = -7.9477e+08
I notice that most of them have a negative value of ScintOutParticleTrackEventID that is impossibile because in GEANT4 both the trackID and the eventID are defined using a counter starting from 0…
Try with:
te->BuildIndex("ScintParticleEventID", "ScintParticleTrackID * 1000 + ScintParticleParentID");
Unfortunately, as I wrote here
I get negative values also using
te->BuildIndex("ScintParticleEventID", "ScintParticleTrackID * 1000 + ScintParticleParentID");
Anyway, by this message:
I understand that branches should have integer values…
I simulated 6.2510^8 primary particles that is a number close to 2.110^9…so maybe the number of tracks is >2.1*10^9…could it be the reason of the problem?
Well, “6.25e8 < 2.1e9
”, so using “ScintParticleEventID
” as the “major” parameter should be fine.
Well, you will need to inspect these entries:
t->Scan("B1Scintparticles.ScintParticleID:B1ScintOutparticles.ScintOutParticleID:B1Scintparticles.ScintParticleKinEn:B1ScintOutparticles.ScintOutParticleKinEn:B1Scintparticles.ScintParticleEventID:B1ScintOutparticles.ScintOutParticleEventID:B1Scintparticles.ScintParticleParentID:B1ScintOutparticles.ScintOutParticleParentID:B1Scintparticles.ScintParticleTrackID:B1ScintOutparticles.ScintOutParticleTrackID", "B1Scintparticles.ScintParticleKinEn - B1ScintOutparticles.ScintOutParticleKinEn < -0.5");
This is the print
************************************************************************************************************************************
* Row * B1Scintpa * B1ScintOu * B1Scintpa * B1ScintOu * B1Scintpa * B1ScintOu * B1Scintpa * B1ScintOu * B1Scintpa * B1ScintOu *
************************************************************************************************************************************
* 58282 * -11 * -11 * 0.2168374 * 1.0988756 * 1.534e+09 * 1.534e+09 * 2 * 2 * 6 * 6 *
* 75258 * 11 * 11 * 0.5303339 * 1.0342621 * 1.299e+09 * 1.299e+09 * 2 * 2 * 5 * 5 *
* 129681 * 11 * 11 * 0.2277688 * 0.7835079 * -30345499 * -30345499 * 1 * 1 * 2 * 2 *
* 134897 * 11 * 11 * 0.1320172 * 0.6463635 * -1.83e+09 * -1.83e+09 * 1 * 1 * 2 * 2 *
* 142955 * 11 * 11 * 0.3659767 * 0.9334695 * -79477014 * -79477014 * 1 * 1 * 2 * 2 *
************************************************************************************************************************************
==> 5 selected entries
So you seem to get exactly the same events with the new “index” as with the old one.
That means that you now need to inspect these entries and find out why Geant4 gave you such results.
BTW. In the new “Scan” string, instead of “B1Scintparticles.ScintParticleTrackEvenID:B1ScintOutparticles.ScintOutParticleTrackEventID
”, I wanted to show “B1Scintparticles.ScintParticleEventID:B1ScintOutparticles.ScintOutParticleEventID
”.
Sorry for the late reply …
then I will try to check what happen by Geant!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.