# Expected Expression error

**URL:** <https://root-forum.cern.ch/t/expected-expression-error/60643>\
**Category:** Newbie\
**Created:** [August 29, 2024, 8:36am UTC](https://root-forum.cern.ch/t/expected-expression-error/60643 "2024-08-29T08:36:25Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![amishgog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amishgog/32/34940_2.png) [@amishgog](https://root-forum.cern.ch/u/amishgog)\
**Post date:** [August 29, 2024, 8:36am UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/1 "2024-08-29T08:36:26Z")

</div>

Hey,

I am encountering a very surprising error in my ROOT code. I have attached the error and C++ file.

Appreciate any help on this.

```auto
input_line_29:3:1: error: expected expression
;}
^
Error in <TRint::HandleTermInput()>: std::runtime_error caught:
RDataFrame: An error occurred during just-in-time compilation. The lines above might indicate the cause of the crash
 All RDF objects that have not run an event loop yet should be considered in an invalid state.

```

```auto
#include "ROOT/RDataFrame.hxx"
#include "TFile.h"
#include "TCut.h"
#include <vector>
#include <iostream>

void make_RawTuples_data(TString Input, TString OutputBase)
{
	ROOT::EnableImplicitMT(); // Allow for multi threading and parallel processing
	Input += "/Tuple_*.root";

	// Putting all the data in RDataFrame
	ROOT::RDataFrame df("XYZ/DecayTree", Input);

	cout << "Input path: " << Input << endl;

	TString outputFileName = "../root/data_";

	outputFileName += OutputBase + "_RawTuples.root"; // Defining the output root file format

	// Define the first stage of trigger cuts for B meson
	TString cut_l0 = "( B_L0HadronDecision_TOS==1 || B_L0Global_TIS==1 ) && ";
	TString cut_h1 = "( B_Hlt1TrackMVADecision_TOS==1 || B_Hlt1TwoTrackMVADecision_TOS==1 || B_Hlt1TrackAllL0Decision_TOS ==1 ) && ";
	TString cut_h2 = "( B_Hlt2Topo2BodyBBDTDecision_TOS==1 || B_Hlt2Topo3BodyBBDTDecision_TOS==1 || B_Hlt2Topo4BodyBBDTDecision_TOS==1 || B_Hlt2Topo2BodyDecision_TOS==1 || B_Hlt2Topo3BodyDecision_TOS==1 || B_Hlt2Topo4BodyDecision_TOS==1) &&";
	TString cut_trg = cut_l0 + cut_h1 + cut_h2;

	// This cut has ben added in the precut step
	// TString cut_mass = "( D_M<2000 && D_DIRA_ORIVX>0 )";

	TString cut_data;
	cut_data += cut_trg;
	//cut_data += cut_mass;

	cout << "Output file name: " << outputFileName << endl;

	df.Filter(cut_data.Data()).Snapshot("DecayTree", outputFileName.Data());	
}

```

I am using 2 bash files also to run the cpp file but I doubt that they have an error.

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [August 29, 2024, 9:57am UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/2 "2024-08-29T09:57:50Z")

</div>

Hi @amishgog,  
thanks for reaching out! Can you provide the full error output please?  
Cheers,  
Monica

---

<div class="post-metadata">

**Author:** ![amishgog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amishgog/32/34940_2.png) [@amishgog](https://root-forum.cern.ch/u/amishgog)\
**Post date:** [August 29, 2024, 10:02am UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/3 "2024-08-29T10:02:19Z")

</div>

Hey Monica,

That is the full error.

```auto
array_samples=("2011_MU" "2011_MD" "2012_MU" "2012_MD" "2015_MU" "2015_MD" "2016_MU" "2016_MD" "2017_MU" "2017_MD" "2018_MU" "2018_MD")

numyear=${#array_year[@]}
nummode=${#array_samples[@]}

lb-conda default root -l --web=off -b << EOF
.L make_RawTuples_data.C+
EOF

for((ii=0;ii<$nummode;ii++))
do 
#========================================================================
#========================================================================

Input1="${array_year[$ii]}"
Input2="${array_samples[$ii]}"
echo "------------------------"
echo "Submit ${Input1} ${Input2}"
./parse_make_RawTuples_data.sh ${Input1} ${Input2} 

echo ""
#========================================================================
#========================================================================
done 

rm *.d
rm *.pcm
rm *.so

```

This is one bash file and

```auto
Input=${1}
Output=${2}

echo "------------------------"
echo "Cleaning ${Input}"
echo "Cleaning ${Output}"

lb-conda default root -l --web=off -b << EOF
.L make_RawTuples_data_C.so
make_RawTuples_data("${Input}", "${Output}")
EOF
echo "Done ${Input}"
echo "Done ${Output}"

```

This is the other bash file

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [August 29, 2024, 11:25am UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/4 "2024-08-29T11:25:13Z")

</div>

Ok, could you then provide your input file so I can reproduce?

---

<div class="post-metadata">

**Author:** ![amishgog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amishgog/32/34940_2.png) [@amishgog](https://root-forum.cern.ch/u/amishgog)\
**Post date:** [August 29, 2024, 11:29am UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/5 "2024-08-29T11:29:20Z")

</div>

I am actually working on a cluster at EPFL so I won’t be able to send you the files.

I think the problem maybe with JIT. I found this very old issue but it was resolved [[DF] Wrong regex substitution when generating code to jit · Issue #11002 · root-project/root · GitHub](https://github.com/root-project/root/issues/11002)

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [August 29, 2024, 11:32am UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/6 "2024-08-29T11:32:07Z")

</div>

There probably is a typo in your expression… what if you use only one of the cuts?

---

<div class="post-metadata">

**Author:** ![amishgog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amishgog/32/34940_2.png) [@amishgog](https://root-forum.cern.ch/u/amishgog)\
**Post date:** [August 29, 2024, 11:32am UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/7 "2024-08-29T11:32:10Z")

</div>

Let me check

---

<div class="post-metadata">

**Author:** ![amishgog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amishgog/32/34940_2.png) [@amishgog](https://root-forum.cern.ch/u/amishgog)\
**Post date:** [August 29, 2024, 11:35am UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/8 "2024-08-29T11:35:20Z")

</div>

Nope, still the same error.

---

<div class="post-metadata">

**Author:** ![amishgog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amishgog/32/34940_2.png) [@amishgog](https://root-forum.cern.ch/u/amishgog)\
**Post date:** [August 29, 2024, 11:37am UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/9 "2024-08-29T11:37:29Z")

</div>

Its not a wildcard expression issue as well, since I checked by hardcoding the input filename as well

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [August 29, 2024, 11:50am UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/10 "2024-08-29T11:50:30Z")

</div>

What ROOT version are you using? Are you able to isolate the error, i.e. to reproduce it on some input data without using your bash scripts? If you could replicate your error on dummy data you can upload I could help you better

---

<div class="post-metadata">

**Author:** ![amishgog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amishgog/32/34940_2.png) [@amishgog](https://root-forum.cern.ch/u/amishgog)\
**Post date:** [August 29, 2024, 12:18pm UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/11 "2024-08-29T12:18:56Z")

</div>

ROOT version is 6.32.02

Unfortunately even one of the Raw tuples is too big to upload here and I don’t have any dummy data.

---

<div class="post-metadata">

**Author:** ![amishgog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amishgog/32/34940_2.png) [@amishgog](https://root-forum.cern.ch/u/amishgog)\
**Post date:** [August 29, 2024, 12:24pm UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/12 "2024-08-29T12:24:38Z")

</div>

I uploaded one of the files in cern box maybe you can access it from there:

[https://cernbox.cern.ch/s/zAgvUSP2tJBLAEM](https://cernbox.cern.ch/s/zAgvUSP2tJBLAEM)

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [August 29, 2024, 12:34pm UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/13 "2024-08-29T12:34:31Z")

</div>

I downloaded the file, but I don’t see any dataset `XYZ/DecayTree`. This is the content:

```auto
TFile** Tuple_92.root	Gaudi Trees
 TFile* Tuple_92.root	Gaudi Trees
  KEY: TDirectoryFile	B2Dpppi;1	B2Dpppi
  KEY: TDirectoryFile	GetIntegratedLuminosity;1	GetIntegratedLuminosity

```

---

<div class="post-metadata">

**Author:** ![amishgog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amishgog/32/34940_2.png) [@amishgog](https://root-forum.cern.ch/u/amishgog)\
**Post date:** [August 29, 2024, 12:40pm UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/14 "2024-08-29T12:40:51Z")

</div>

Ahh my apologies yes the DecayTree is “B2Dpppi/DecayTree”

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [August 29, 2024, 12:50pm UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/15 "2024-08-29T12:50:08Z")

</div>

The problem is that you have an extra `&&` at the end of `cut_h2`, if you remove it it will execute smoothly

---

<div class="post-metadata">

**Author:** ![amishgog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amishgog/32/34940_2.png) [@amishgog](https://root-forum.cern.ch/u/amishgog)\
**Post date:** [August 29, 2024, 12:54pm UTC](https://root-forum.cern.ch/t/expected-expression-error/60643/16 "2024-08-29T12:54:08Z")

</div>

Oh wow. I have totally missed that. Thank you so much for all the help Monica. Spent too much time on this than I should have 🙂
