I recreated the simulation and know the positions I get are within bounds. There seemed to be a problem with that simulation in particular
index 230 event ID: 557222 Y pos in vol: 284.113 E dep in vol: 13804.4
index 232 event ID: 562909 Y pos in vol: 311.478 E dep in vol: 11182.2
index 233 event ID: 563658 Y pos in vol: 298.302 E dep in vol: 10847.8
index 240 event ID: 570929 Y pos in vol: 290.13 E dep in vol: 9695.85
index 241 event ID: 571037 Y pos in vol: 309.686 E dep in vol: 10210.2
index 242 event ID: 574147 Y pos in vol: 275 E dep in vol: 10642.3
index 243 event ID: 582437 Y pos in vol: 298.091 E dep in vol: 10438.4
index 244 event ID: 587826 Y pos in vol: 275 E dep in vol: 8815.01
index 245 event ID: 597219 Y pos in vol: 317.53 E dep in vol: 10213.8
index 247 event ID: 597973 Y pos in vol: 136.503 E dep in vol: 0.00212024
Error in <TBasket::Streamer>: The value of fNbytes is incorrect (-698) ; trying to recover by setting it to zero
Error in <TBranchElement::GetBasket>: File: /home/lobis/gitlab/IAXOD0-REST/simulations_data/cosmic_muons/analysis/RUN_ArIso_wall-4000-n1M_lobis_v2.11_0.root at byte:242690348, branch:fTrack.fTrack_ID, entry:248, badread=1, nerrors=1, basketnumber=84
index 248 event ID: 597973 Y pos in vol: 136.503 E dep in vol: 0.00212024
Error in <TBasket::Streamer>: The value of fNbytes is incorrect (-698) ; trying to recover by setting it to zero
Error in <TBranchElement::GetBasket>: File: /home/lobis/gitlab/IAXOD0-REST/simulations_data/cosmic_muons/analysis/RUN_ArIso_wall-4000-n1M_lobis_v2.11_0.root at byte:242690348, branch:fTrack.fTrack_ID, entry:249, badread=1, nerrors=2, basketnumber=84
index 249 event ID: 598317 Y pos in vol: 136.503 E dep in vol: 12646.1
Error in <TBasket::Streamer>: The value of fNbytes is incorrect (-698) ; trying to recover by setting it to zero
Error in <TBranchElement::GetBasket>: File: /home/lobis/gitlab/IAXOD0-REST/simulations_data/cosmic_muons/analysis/RUN_ArIso_wall-4000-n1M_lobis_v2.11_0.root at byte:242690348, branch:fTrack.fTrack_ID, entry:250, badread=1, nerrors=3, basketnumber=84
index 250 event ID: 599164 Y pos in vol: 136.503 E dep in vol: 10376.8
Error in <TBasket::Streamer>: The value of fNbytes is incorrect (-698) ; trying to recover by setting it to zero
Error in <TBranchElement::GetBasket>: File: /home/lobis/gitlab/IAXOD0-REST/simulations_data/cosmic_muons/analysis/RUN_ArIso_wall-4000-n1M_lobis_v2.11_0.root at byte:242690348, branch:fTrack.fTrack_ID, entry:251, badread=1, nerrors=4, basketnumber=84
index 251 event ID: 601480 Y pos in vol: 136.503 E dep in vol: 10079.5
Error in <TBasket::Streamer>: The value of fNbytes is incorrect (-698) ; trying to recover by setting it to zero
Error in <TBranchElement::GetBasket>: File: /home/lobis/gitlab/IAXOD0-REST/simulations_data/cosmic_muons/analysis/RUN_ArIso_wall-4000-n1M_lobis_v2.11_0.root at byte:242690348, branch:fTrack.fTrack_ID, entry:252, badread=1, nerrors=5, basketnumber=84
index 252 event ID: 606522 Y pos in vol: 136.503 E dep in vol: 9295.68
Error in <TBasket::Streamer>: The value of fNbytes is incorrect (-698) ; trying to recover by setting it to zero
Error in <TBranchElement::GetBasket>: File: /home/lobis/gitlab/IAXOD0-REST/simulations_data/cosmic_muons/analysis/RUN_ArIso_wall-4000-n1M_lobis_v2.11_0.root at byte:242690348, branch:fTrack.fTrack_ID, entry:253, badread=1, nerrors=6, basketnumber=84
index 253 event ID: 611994 Y pos in vol: 136.503 E dep in vol: 10376.9
Error in <TBasket::Streamer>: The value of fNbytes is incorrect (-698) ; trying to recover by setting it to zero
Error in <TBranchElement::GetBasket>: File: /home/lobis/gitlab/IAXOD0-REST/simulations_data/cosmic_muons/analysis/RUN_ArIso_wall-4000-n1M_lobis_v2.11_0.root at byte:242690348, branch:fTrack.fTrack_ID, entry:254, badread=1, nerrors=7, basketnumber=84
index 254 event ID: 615212 Y pos in vol: 136.503 E dep in vol: 11288.2
index 255 event ID: 616544 Y pos in vol: 275 E dep in vol: 9238.07
index 256 event ID: 624029 Y pos in vol: 313.25 E dep in vol: 29103
index 258 event ID: 625022 Y pos in vol: 322.503 E dep in vol: 13056
index 259 event ID: 625104 Y pos in vol: 315.214 E dep in vol: 18948.1
index 261 event ID: 628843 Y pos in vol: 275 E dep in vol: 9026.73
index 263 event ID: 633895 Y pos in vol: 276.991 E dep in vol: 19360.4
index 264 event ID: 634105 Y pos in vol: 309.346 E dep in vol: 20156
index 266 event ID: 638497 Y pos in vol: 324.144 E dep in vol: 12532.1
index 269 event ID: 646914 Y pos in vol: 320.688 E dep in vol: 11394.7
index 270 event ID: 653180 Y pos in vol: 315.507 E dep in vol: 12576.6
index 271 event ID: 670345 Y pos in vol: 279.878 E dep in vol: 10855.3
index 272 event ID: 670409 Y pos in vol: 316.106 E dep in vol: 11258.6
index 273 event ID: 674354 Y pos in vol: 276.775 E dep in vol: 11943.6
When iterating over the events I got this warning which I assumed was normal but I guess its a sign that the file got corrupted somehow. The correct simulation was produced with a newer version of REST than the corrupted one so I assume if there was some problem in the code it got fixed by some commit, or maybe its just bad luck.
Anyway after repeating the simulation I got all my first positions in volume within correct values.
However there is something that still puzzles me:
The veto is a rectangular prism situated at y=300 with a width of 50 so compatible y values would be 275-325. I have checked and I got all the y component of the first position in volume within this value but I have seen that instead of getting y’s very close to 325 (muons enter from the top of the veto) I get a more or less uniform distribution of values within 275 and 325, I get many values at exactly 275.
I have checked manually one of this events and I can visually see that the first position where energy was deposited in the veto is close to 325, so I have no idea why I get back the value 275.