Skip to content

Commit

Permalink
Missing input safeguard (#16)
Browse files Browse the repository at this point in the history
* quit if there is no input

* quit if there is no input

* quit if there is no input

* quit if there is no input
  • Loading branch information
pinkenburg authored Oct 9, 2024
1 parent efed415 commit 836f17d
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 10 deletions.
18 changes: 16 additions & 2 deletions run2auau/TriggerProduction/Fun4All_Prdf_Combiner.C
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
in->SetPoolDepth(50);
in->Resync(true);

int NumInputs = 0;
//in->Verbosity(2);
// this one is the reference
ifstream infile(gl1input);
Expand All @@ -102,6 +103,7 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
gl1->LastEvent(lastevent);
gl1->AddListFile(gl1input);
in->registerTriggerInput(gl1, InputManagerType::GL1);
NumInputs++;
}
infile.open(mbdinput);
if (infile.is_open())
Expand All @@ -113,6 +115,7 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
mbd->SkipToEvent(firstevent);
mbd->AddListFile(mbdinput);
in->registerTriggerInput(mbd, InputManagerType::MBD);
NumInputs++;
}

infile.open(zdcinput);
Expand All @@ -125,6 +128,7 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
zdc->SkipToEvent(firstevent);
zdc->AddListFile(zdcinput);
in->registerTriggerInput(zdc, InputManagerType::ZDC);
NumInputs++;
}

infile.open(ll1input);
Expand All @@ -137,6 +141,7 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
ll1->SkipToEvent(firstevent);
ll1->AddListFile(ll1input);
in->registerTriggerInput(ll1, InputManagerType::LL1);
NumInputs++;
}
int inpt = 0;
for (auto iter : hcalinfile)
Expand All @@ -152,9 +157,10 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
hcal->enable_ddump(DDUMP);
hcal->SkipToEvent(firstevent);
in->registerTriggerInput(hcal, InputManagerType::HCAL);
inpt++;
}
inpt++;
}
NumInputs += inpt;

inpt = 0;
for (auto iter : cemcinfile)
Expand All @@ -171,8 +177,16 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
cemc->enable_ddump(DDUMP);
cemc->SkipToEvent(firstevent);
in->registerTriggerInput(cemc, InputManagerType::CEMC);
inpt++;
}
inpt++;
}
NumInputs += inpt;

// if there is no input manager this macro will still run - so just quit here
if (NumInputs == 0)
{
std::cout << "no file lists no input manager registered, quitting" << std::endl;
gSystem->Exit(1);
}

se->registerInputManager(in);
Expand Down
20 changes: 17 additions & 3 deletions run2auau/cosmics/Fun4All_Stream_Combiner.C
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ void Fun4All_Stream_Combiner(int nEvents = 100,
Fun4AllStreamingInputManager *in = new Fun4AllStreamingInputManager("Comb");
// in->Verbosity(2);
// create and register input managers
int NumInputs = 0;
int i = 0;

for (auto iter : gl1_infile)
Expand All @@ -150,9 +151,9 @@ void Fun4All_Stream_Combiner(int nEvents = 100,
i++;
}
}
i = 0;

NumInputs += i;

i = 0;
for (auto iter : intt_infile)
{
if (isGood(iter))
Expand All @@ -166,6 +167,8 @@ void Fun4All_Stream_Combiner(int nEvents = 100,
i++;
}
}
NumInputs += i;

i = 0;
for (auto iter : mvtx_infile)
{
Expand All @@ -180,6 +183,8 @@ void Fun4All_Stream_Combiner(int nEvents = 100,
i++;
}
}
NumInputs += i;

i = 0;
for (auto iter : tpc_infile)
{
Expand All @@ -195,8 +200,9 @@ void Fun4All_Stream_Combiner(int nEvents = 100,
i++;
}
}
i = 0;
NumInputs += i;

i = 0;
for (auto iter : tpot_infile)
{
if (isGood(iter))
Expand All @@ -211,6 +217,14 @@ void Fun4All_Stream_Combiner(int nEvents = 100,
i++;
}
}
NumInputs += i;

// if there is no input manager this macro will still run - so just quit here
if (NumInputs == 0)
{
std::cout << "no file lists no input manager registered, quitting" << std::endl;
gSystem->Exit(1);
}

se->registerInputManager(in);
// StreamingCheck *scheck = new StreamingCheck();
Expand Down
18 changes: 16 additions & 2 deletions run2pp/TriggerProduction/Fun4All_Prdf_Combiner.C
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
in->SetPoolDepth(50);
in->Resync(true);

int NumInputs = 0;
//in->Verbosity(2);
// this one is the reference
ifstream infile(gl1input);
Expand All @@ -102,6 +103,7 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
gl1->LastEvent(lastevent);
gl1->AddListFile(gl1input);
in->registerTriggerInput(gl1, InputManagerType::GL1);
NumInputs++;
}
infile.open(mbdinput);
if (infile.is_open())
Expand All @@ -113,6 +115,7 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
mbd->SkipToEvent(firstevent);
mbd->AddListFile(mbdinput);
in->registerTriggerInput(mbd, InputManagerType::MBD);
NumInputs++;
}

infile.open(zdcinput);
Expand All @@ -125,6 +128,7 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
zdc->SkipToEvent(firstevent);
zdc->AddListFile(zdcinput);
in->registerTriggerInput(zdc, InputManagerType::ZDC);
NumInputs++;
}

infile.open(ll1input);
Expand All @@ -137,6 +141,7 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
ll1->SkipToEvent(firstevent);
ll1->AddListFile(ll1input);
in->registerTriggerInput(ll1, InputManagerType::LL1);
NumInputs++;
}
int inpt = 0;
for (auto iter : hcalinfile)
Expand All @@ -152,9 +157,10 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
hcal->enable_ddump(DDUMP);
hcal->SkipToEvent(firstevent);
in->registerTriggerInput(hcal, InputManagerType::HCAL);
inpt++;
}
inpt++;
}
NumInputs += inpt;

inpt = 0;
for (auto iter : cemcinfile)
Expand All @@ -171,8 +177,16 @@ void Fun4All_Prdf_Combiner(int nEvents = 0,
cemc->enable_ddump(DDUMP);
cemc->SkipToEvent(firstevent);
in->registerTriggerInput(cemc, InputManagerType::CEMC);
inpt++;
}
inpt++;
}
NumInputs += inpt;

// if there is no input manager this macro will still run - so just quit here
if (NumInputs == 0)
{
std::cout << "no file lists no input manager registered, quitting" << std::endl;
gSystem->Exit(1);
}

se->registerInputManager(in);
Expand Down
19 changes: 16 additions & 3 deletions run2pp/cosmics/Fun4All_Stream_Combiner.C
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ void Fun4All_Stream_Combiner(int nEvents = 100,
Fun4AllStreamingInputManager *in = new Fun4AllStreamingInputManager("Comb");
// in->Verbosity(2);
// create and register input managers
int NumInputs = 0;
int i = 0;

for (auto iter : gl1_infile)
Expand All @@ -150,9 +151,9 @@ void Fun4All_Stream_Combiner(int nEvents = 100,
i++;
}
}
i = 0;

NumInputs += i;

i = 0;
for (auto iter : intt_infile)
{
if (isGood(iter))
Expand All @@ -166,6 +167,8 @@ void Fun4All_Stream_Combiner(int nEvents = 100,
i++;
}
}
NumInputs += i;

i = 0;
for (auto iter : mvtx_infile)
{
Expand All @@ -180,6 +183,8 @@ void Fun4All_Stream_Combiner(int nEvents = 100,
i++;
}
}
NumInputs += i;

i = 0;
for (auto iter : tpc_infile)
{
Expand All @@ -195,8 +200,9 @@ void Fun4All_Stream_Combiner(int nEvents = 100,
i++;
}
}
i = 0;
NumInputs += i;

i = 0;
for (auto iter : tpot_infile)
{
if (isGood(iter))
Expand All @@ -211,7 +217,14 @@ void Fun4All_Stream_Combiner(int nEvents = 100,
i++;
}
}
NumInputs += i;

// if there is no input manager this macro will still run - so just quit here
if (NumInputs == 0)
{
std::cout << "no file lists no input manager registered, quitting" << std::endl;
gSystem->Exit(1);
}
se->registerInputManager(in);
// StreamingCheck *scheck = new StreamingCheck();
// scheck->SetTpcBcoRange(130);
Expand Down

0 comments on commit 836f17d

Please sign in to comment.