#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <map>
#include <utility>
#include <sstream>
#include "midas.h"
#include <TH2.h>
#include "TOctalFADCIsland.h"
#include "TOctalFADCBankReader.h"
#include "TGlobalData.h"
#include "TSetupData.h"
#include "TPulseIsland.h"
Go to the source code of this file.
Functions | |
INT | MExpectedIslands_init (void) |
INT | MExpectedIslands (EVENT_HEADER *, void *) |
double | GetClockTickForChannel (string bank_name) |
Variables | |
HNDLE | hDB |
TGlobalData * | gData |
Object to hold data used and produced by modules throughout alcapana stage of analysis. | |
TSetupData * | gSetup |
Hardware information about digitizers and detectors to be used during alcapana stage of analysis. | |
static vector < TOctalFADCBankReader * > | fadc_bank_readers |
static TH2I * | hExpectedNumberOfIslands |
ANA_MODULE | MExpectedIslands_module |
double GetClockTickForChannel | ( | string | bank_name | ) |
INT MExpectedIslands | ( | EVENT_HEADER * | pheader, | |
void * | pevent | |||
) |
This method processes one MIDAS block, producing a vector of TOctalFADCIsland objects from the raw Octal FADC data.
Definition at line 81 of file MExpectedIslands.cpp.
References TGlobalData::fPulseIslandToChannelMap, and hExpectedNumberOfIslands.
00082 { 00083 // Get the event number 00084 int midas_event_number = pheader->serial_number; 00085 00086 // Some typedefs 00087 typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap; 00088 typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair; 00089 typedef map<string, vector<TPulseIsland*> >::iterator map_iterator; 00090 00091 // Fetch a reference to the gData structure that stores a map 00092 // of (bank_name, vector<TPulseIsland*>) pairs 00093 TStringPulseIslandMap& pulse_islands_map = 00094 gData->fPulseIslandToChannelMap; 00095 00096 // Loop over the map and get each bankname, vector pair 00097 for (map_iterator theMapIter = pulse_islands_map.begin(); theMapIter != pulse_islands_map.end(); theMapIter++) 00098 { 00099 std::string bankname = theMapIter->first; 00100 std::vector<TPulseIsland*> thePulses = theMapIter->second; 00101 00102 double pulse_frequency = 65; // Hz 00103 double pulse_period = (1 / pulse_frequency) * 1e3; // ms 00104 double gate_width = 110; // ms 00105 00106 if (thePulses.size() != 0) { 00107 double initial_pulse_time = (*(thePulses.begin()))->GetTimeStamp() * (*(thePulses.begin()))->GetClockTickInNs() * 1e-6; // ms 00108 00109 // Work out how many more pulses we expect for the given pulser period and the given gate width 00110 double remaining_time = gate_width - initial_pulse_time; 00111 int expected_pulses = remaining_time / pulse_period; 00112 00113 // If the initial pulse_time is greater than the pulse period then a pulse should have been seen before now 00114 if (initial_pulse_time > pulse_period) { 00115 expected_pulses += initial_pulse_time / pulse_period; // add the number that were missed at the start 00116 } 00117 // printf("%s: Pulse Period = %f ms\nInitial time stamp: %d\nInitial pulse time: %f ms\nRemaining time: %f ms\nExpected number of pulses = %d\n\n", bankname.c_str(), pulse_period, (*(thePulses.begin()))->GetTimeStamp(), initial_pulse_time, remaining_time, expected_pulses); 00118 00119 // Fill the histogram 00120 hExpectedNumberOfIslands->Fill(bankname.c_str(), midas_event_number, expected_pulses + 1); // extra +1 so that we count the initial pulse 00121 } 00122 else { 00123 hExpectedNumberOfIslands->Fill(bankname.c_str(), midas_event_number, 0); 00124 } 00125 } 00126 return SUCCESS; 00127 }
INT MExpectedIslands_init | ( | ) |
This method initializes histograms.
Definition at line 64 of file MExpectedIslands.cpp.
References hExpectedNumberOfIslands.
00065 { 00066 // This histogram has the pulse counters on the X-axis and the number of pulses on the Y-axis 00067 // One histogram is created for each detector 00068 00069 00070 hExpectedNumberOfIslands = new TH2I("hExpectedNumberOfIslands", "Expected Number of Islands per Channel per Event", 1,0,1, 10000,0,10000); 00071 hExpectedNumberOfIslands->GetXaxis()->SetTitle("Bank Name"); 00072 hExpectedNumberOfIslands->GetYaxis()->SetTitle("MIDAS Event Number"); 00073 hExpectedNumberOfIslands->SetBit(TH1::kCanRebin); 00074 00075 return SUCCESS; 00076 }
vector<TOctalFADCBankReader*> fadc_bank_readers [static] |
Definition at line 45 of file MExpectedIslands.cpp.
HNDLE hDB |
TH2I* hExpectedNumberOfIslands [static] |
Definition at line 46 of file MExpectedIslands.cpp.
Referenced by MExpectedIslands(), and MExpectedIslands_init().
ANA_MODULE MExpectedIslands_module |
{ "MExpectedIslands", "Andrew Edmonds", MExpectedIslands, NULL, NULL, MExpectedIslands_init, NULL, NULL, 0, NULL, }
Definition at line 48 of file MExpectedIslands.cpp.