GenericAnalysis.cc

00001 #include "GenericAnalysis.hh"
00002 #include "ConvertData.hh"
00003 #include "BaselineFinder.hh"
00004 #include "SumChannels.hh"
00005 #include "Integrator.hh"
00006 #include "RootWriter.hh"
00007 #include "intarray.hh"
00008 
00009 
00010 #include "TRandom3.h"
00011 
00012 GenericAnalysis::GenericAnalysis() : 
00013   BaseModule(GetDefaultName(), "Doesn't do anything by default; empty module meant to serve as an example module or for testing algorithms")
00014 {
00015   AddDependency<ConvertData>();
00016   AddDependency<BaselineFinder>();
00017   //AddDependency<Integrator>();
00018 
00019   //to add something to be controlled by the config file, use the syntax:
00020   //  ReisterParameter("parameter_name", parameter_variable);
00021 }
00022 
00023 GenericAnalysis::~GenericAnalysis()
00024 { 
00025   //delete stuff here
00026 }
00027 
00028 int GenericAnalysis::Initialize()
00029 {
00030   //initialize histograms or class variables here
00031 
00032   //return something other than zero for error
00033   return 0;
00034 }
00035 
00036 int GenericAnalysis::Finalize()
00037 {
00038   //make sure to close/delete anything opened in Initialize()
00039   
00040   //return something other than zero for error
00041   return 0;
00042 }
00043 
00044 int GenericAnalysis::Process(EventPtr event)
00045 {
00046   EventDataPtr data = event->GetEventData();
00047   //store event-wide results in the 'data' object
00048   //data->generic.push_back(my_result);
00049   
00050   std::vector<ChannelData>::iterator chdata = data->channels.begin();
00051   for( ; chdata != data->channels.end(); chdata++){
00052     //chdata is a pointer to a ChannelData object, looping over all channels
00053  
00054     //double baseline = chdata->baseline.mean;
00055     //if we absolutely need the baseline to proceed, do
00056     // if( ! chdata->baseline.found_baseline) continue;
00057     
00058     //to get access to the channel's waveform, use an intarray object 
00059     //we don't know a priori what the depth of the digitizer is
00060     //int nsamps = chdata->nsamps;
00061     //double* wave = chdata->GetWaveform();
00062     //if you want the integral (make sure to include Integrator as a dependency!) it's in
00063     //chdata->integral_start;
00064     
00065     
00066     //store your channel-specific results in the chdata->generic vector
00067     //chdata->generic.push_back(channel_result);
00068     
00069   }
00070   
00071   //return non-zero in case of error
00072   return 0;
00073 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 20 Jun 2014 for daqman by  doxygen 1.6.1