Skip to content

Commit

Permalink
Add make_ntuples bash function
Browse files Browse the repository at this point in the history
  • Loading branch information
forthommel committed Aug 12, 2015
1 parent 90247d1 commit 67d54bb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
7 changes: 4 additions & 3 deletions change_hv_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ int main(int argc, char *argv[]) {
try { vme->AddHVModule(0x500000, 0xc); } catch (Exception& e) { e.Dump(); }
NIM::HVModuleN470* hv = vme->GetHVModule();
cout << "module id=" << hv->GetModuleId() << endl;
hv->ReadMonitoringValues().Dump();
/*hv->SetChannelV0(0, 2400);
hv->SetChannelI0(0, 500);*/
//hv->ReadMonitoringValues().Dump();
hv->SetChannelV0(0, 2400);
//hv->SetChannelI0(0, 500);
hv->ReadChannelValues(0).Dump();
hv->ReadChannelValues(3).Dump();

} catch (Exception& e) {
e.Dump();
Expand Down
13 changes: 13 additions & 0 deletions scripts/make_ntuples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

if [ -z "$1" ] ; then
echo "Usage: "$0" <run_id> <board_id>"
exit
fi
if [ -z "$2" ] ; then
echo "Usage: "$0" <run_id> <board_id>"
exit
fi

python $PPS_BASE_PATH/scripts/run_over_all_files.py $1 $2 && hadd -f "run"$1"_board"$2".root" $PPS_DATA_PATH/events_$1_*_board$2.root

5 changes: 3 additions & 2 deletions test/gastof_occupancy_vs_run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int main(int argc, char* argv[]) {
DIR* dir; struct dirent* ent;
cout << "Search in directory: " << getenv("PPS_DATA_PATH") << endl;
VME::TDCMeasurement m; VME::TDCEvent e;
int num_triggers = 0;
int num_triggers;
for (int sp=0; sp<1000000; sp++) { // we loop over all spills
search1.str(""); search1 << "events_" << run_id << "_" << sp << "_";
bool file_found = false; string filename;
Expand All @@ -42,6 +42,7 @@ int main(int argc, char* argv[]) {
cout << "Opening file " << file.str() << endl;
try {
FileReader f(file.str());
num_triggers = 0;
while (true) {
if (!f.GetNextEvent(&e)) break;
if (e.GetType()==VME::TDCEvent::GlobalHeader) num_triggers++;
Expand All @@ -52,7 +53,7 @@ int main(int argc, char* argv[]) {
} catch (Exception& e) { cout << "prout" << endl; e.Dump(); }
}
cout << "num events = " << occ->Grid()->GetSumOfWeights() << endl;
cout << "num triggers = " << num_triggers << endl;
cout << "num triggers = " << (num_triggers-trigger_start) << endl;
occ->Grid()->SetMaximum(0.15);
occ->Grid()->Scale(1./(num_triggers-trigger_start));
occ->SetRunInfo(board_id, run_id, 0, Form("Triggers %d-%d", trigger_start, trigger_stop));
Expand Down
2 changes: 1 addition & 1 deletion test/quartic_occupancy_vs_run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int main(int argc, char* argv[]) {
} catch (Exception& e) { e.Dump(); }
}
cout << "num events = " << occ->Grid()->GetSumOfWeights() << endl;
cout << "num triggers = " << num_triggers << endl;
cout << "num triggers = " << (num_triggers-trigger_start) << endl;
occ->Grid()->SetMaximum(0.15);
occ->Grid()->Scale(1./(num_triggers-trigger_start));
occ->SetRunInfo(board_id, run_id, 0, Form("Triggers %d-%d", trigger_start, trigger_stop));
Expand Down

0 comments on commit 67d54bb

Please sign in to comment.