Last active
August 29, 2015 14:04
-
-
Save pgjones/63d0ad234f599981a469 to your computer and use it in GitHub Desktop.
This is a workflow to load zdab, convert to RAT::DS (root) and then in a separate script plot the results.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To run this open ROOT and do | |
// .L PlotCAEN.cc+ | |
// PlotCAEN( "output_filename.root", 10 ); | |
// where the number is the event id you'd like to view the waveforms of | |
#include <RAT/DU/DSReader.hh> | |
#include <RAT/DS/Entry.hh> | |
#include <RAT/DS/Digitiser.hh> | |
#include <TCanvas.h> | |
#include <TGraph.h> | |
void PlotCAEN( const char* fileName, size_t eventID ) | |
{ | |
RAT::DU::DSReader dsReader( fileName ); | |
const RAT::DS::Entry& rDS = dsReader.GetEntry( eventID ); | |
if( rDS.GetEVCount() == 0 ) // No events to plot | |
return; | |
TCanvas* c1 = new TCanvas(); | |
c1->Divide(4, 4); | |
const Digitiser& digitiser = rDS.GetEV( iEV ).GetDigitiser(); | |
for( size_t iWaveform = 0; iWaveform < 8; iWaveform++ ) // There are 8 possible CAEN channels | |
{ | |
if( !digitiser.ExistsWaveform( iWaveform ) ) // Not all of which are used | |
continue; | |
c1->cd( iWaveform + 1 ); | |
TGraph* graph = new TGraph(); | |
std::vector<UShort_t> waveform = digitiser.GetWaveform( iWaveform ); | |
for( size_t iSample = 0; iSample < waveform.size(); iSample++ ) | |
graph->SetPoint( iSample, iSample, waveform.at( iSample ) ); | |
graph->Draw("AL*"); | |
} | |
c1->cd(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To run this simply do | |
# rat zdab2root.mac -I input_filename.zdab -O output_filename.zdab | |
/PhysicsList/OmitAll true | |
/run/initialize | |
##########EVENT LOOP############ | |
/rat/proclast outroot | |
##########EVENT LOOP############ | |
/rat/inzdab/read_default | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment