AlcapDAQ  1
Functions | Variables
MShortPulseTimes.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <map>
#include <utility>
#include <sstream>
#include "midas.h"
#include <TH1.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 MShortPulseTimes_init (void)
 
INT MShortPulseTimes (EVENT_HEADER *, void *)
 
vector< string > GetAllBankNames ()
 
double GetClockTickForChannel (string bank_name)
 

Variables

string testname = "CaenCh0"
 
HNDLE hDB
 
TGlobalDatagData
 
TSetupDatagSetup
 
static vector
< TOctalFADCBankReader * > 
fadc_bank_readers
 
static std::map< std::string,
TH1 * > 
time_short_pulse_histogram_map
 
static std::map< std::string,
TH1 * > 
time_nshort_pulse_histogram_map
 
ANA_MODULE MShortPulseTimes_module
 

Function Documentation

vector<string> GetAllBankNames ( )
double GetClockTickForChannel ( string  bank_name)
INT MShortPulseTimes ( 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 109 of file MShortPulseTimes.cpp.

References TGlobalData::fPulseIslandToChannelMap, TSetupData::GetDetectorName(), printf(), and SUCCESS.

110 {
111  // Get the event number
112  int midas_event_number = pheader->serial_number;
113 
114  // Some typedefs
115  typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap;
116  typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair;
117  typedef map<string, vector<TPulseIsland*> >::iterator map_iterator;
118 
119  // Fetch a reference to the gData structure that stores a map
120  // of (bank_name, vector<TPulseIsland*>) pairs
121  TStringPulseIslandMap& pulse_islands_map =
123 
124  // Loop over the map and get each bankname, vector pair
125  for (map_iterator theMapIter = pulse_islands_map.begin(); theMapIter != pulse_islands_map.end(); theMapIter++)
126  {
127  std::string bankname = theMapIter->first;
128  std::vector<TPulseIsland*> thePulses = theMapIter->second;
129 
130  // Loop over the TPulseIslands and plot the histogram
131  for (std::vector<TPulseIsland*>::iterator thePulseIter = thePulses.begin(); thePulseIter != thePulses.end(); thePulseIter++) {
132  if (gSetup->GetDetectorName(theMapIter->first)=="CDG0" && ((*thePulseIter)->GetSamples().size()>0)) printf("\nfound caen\n");
133 
134  //samples = (*thePulseIter)->GetSamples();
135  if ((*thePulseIter)->GetSamples().size()==4) time_short_pulse_histogram_map[bankname]->Fill((*thePulseIter)->GetPulseTime());
136  else time_nshort_pulse_histogram_map[bankname]->Fill((*thePulseIter)->GetPulseTime());
137 
138  }
139 
140  }
141  return SUCCESS;
142 }
INT MShortPulseTimes_init ( )

This method initializes histograms.

Definition at line 68 of file MShortPulseTimes.cpp.

References TSetupData::fBankToDetectorMap, TSetupData::GetDetectorName(), and SUCCESS.

69 {
70  // This histogram has the pulse times on the X-axis and the number of pulses on the Y-axis
71  // One histogram is created for each detector
72  // This uses the TH1::kCanRebin mechanism to expand automatically to the
73  // number of FADC banks.
74 
75  std::map<std::string, std::string> bank_to_detector_map = gSetup->fBankToDetectorMap;
76  for(std::map<std::string, std::string>::iterator mapIter = bank_to_detector_map.begin();
77  mapIter != bank_to_detector_map.end(); mapIter++) {
78 
79  std::string detname = gSetup->GetDetectorName(mapIter->first);
80  std::string histname = "h" + detname + "_ShortPulseTimes";
81  std::string histtitle = "Plot of the short pulse times for the " + detname + " detector";
82  TH1D* hShortPulseTime = new TH1D(histname.c_str(),histtitle.c_str(),240,0,120e6);
83  hShortPulseTime->GetXaxis()->SetTitle("Pulse time (ns)");
84  hShortPulseTime->GetXaxis()->CenterTitle(1);
85  hShortPulseTime->GetYaxis()->SetTitle("Number of 4-sample pulses");
86  hShortPulseTime->GetYaxis()->CenterTitle(1);
87  //hShortPulseTime->SetBit(TH1::kCanRebin);
88 
89  std::string histname2 = "h" + detname + "_NonShortPulseTimes";
90  std::string histtitle2 = "Plot of the non-short pulse times for the " + detname + " detector";
91  TH1D* hNonShortPulseTime = new TH1D(histname2.c_str(),histtitle2.c_str(),240,0,120e6);
92  hNonShortPulseTime->GetXaxis()->SetTitle("Pulse time (ns)");
93  hNonShortPulseTime->GetXaxis()->CenterTitle(1);
94  hNonShortPulseTime->GetYaxis()->SetTitle("Number of all other pulses");
95  hNonShortPulseTime->GetYaxis()->CenterTitle(1);
96  //hNonShortPulseTime->SetBit(TH1::kCanRebin);
97 
98  time_short_pulse_histogram_map[mapIter->first] = hShortPulseTime;
99  time_nshort_pulse_histogram_map[mapIter->first] = hNonShortPulseTime;
100 
101  }
102 
103  return SUCCESS;
104 }

Variable Documentation

vector<TOctalFADCBankReader*> fadc_bank_readers
static

Definition at line 47 of file MShortPulseTimes.cpp.

TGlobalData* gData

Definition at line 54 of file analyzer.cpp.

TSetupData* gSetup

Definition at line 55 of file analyzer.cpp.

HNDLE hDB

Definition at line 11 of file mucap_compress.cpp.

ANA_MODULE MShortPulseTimes_module
Initial value:
=
{
"MShortPulseTimes",
"Joe Grange",
NULL,
NULL,
NULL,
NULL,
0,
NULL,
}

Definition at line 52 of file MShortPulseTimes.cpp.

string testname = "CaenCh0"

Definition at line 42 of file MShortPulseTimes.cpp.

std::map<std::string, TH1*> time_nshort_pulse_histogram_map
static

Definition at line 50 of file MShortPulseTimes.cpp.

std::map<std::string, TH1*> time_short_pulse_histogram_map
static

Definition at line 49 of file MShortPulseTimes.cpp.