Histograms the TPI amplitudes for each detector. Creates a number of amplitude plots, where the amplitude is in units of ADC counts. More...
Functions | |
INT | MDQ_Amplitude_init (void) |
INT | MDQ_Amplitude (EVENT_HEADER *, void *) |
INT | MDQ_Amplitude_eor (INT) |
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. | |
TDirectory * | gManaHistsDir |
TFile * | gManaOutputFile |
TApplication * | manaApp |
TROOT * | gROOT |
map< std::string, TH1F * > | DQ_Amplitude_histograms_map |
Map of bank name to histogram of amplitudes for the TPIs of a given MIDAS event. | |
map< std::string, TH1F * > | DQ_Amplitude_histograms_normalised_map |
Same as DQ_Amplitude_histograms_map but normalized to number of muons according to TDC. | |
map< std::string, TH1F * > | DQ_Amplitude_histograms_ped_sub_map |
Same as DQ_Amplitude_histograms_map but the amplitudes have the pedestal (according to ODB) subtracted off. | |
TH1F * | hDQ_TDCCheck_muSc |
Coount of number of muSc hits in a run in the TDC. | |
ANA_MODULE | MDQ_Amplitude_module |
Histograms the TPI amplitudes for each detector. Creates a number of amplitude plots, where the amplitude is in units of ADC counts.
INT MDQ_Amplitude | ( | EVENT_HEADER * | pheader, | |
void * | pevent | |||
) |
This method fills the histograms
Definition at line 183 of file MDQ_Amplitude.cpp.
References DQ_Amplitude_histograms_map, DQ_Amplitude_histograms_normalised_map, DQ_Amplitude_histograms_ped_sub_map, TGlobalData::fPulseIslandToChannelMap, and TSetupData::GetDetectorName().
00184 { 00185 // Some typedefs 00186 typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap; 00187 typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair; 00188 typedef map<string, vector<TPulseIsland*> >::iterator map_iterator; 00189 00190 // Fetch a reference to the gData structure that stores a map 00191 // of (bank_name, vector<TPulseIsland*>) pairs 00192 TStringPulseIslandMap& pulse_islands_map = gData->fPulseIslandToChannelMap; 00193 00194 // Loop over the map and get each bankname, vector pair 00195 for (map_iterator mapIter = pulse_islands_map.begin(); 00196 mapIter != pulse_islands_map.end(); ++mapIter) 00197 { 00198 std::string bankname = mapIter->first; 00199 std::string detname = gSetup->GetDetectorName(bankname); 00200 std::vector<TPulseIsland*> thePulses = mapIter->second; 00201 00202 // Get the histograms first 00203 TH1F* hDQ_Amplitude = DQ_Amplitude_histograms_map[bankname]; 00204 TH1F* hDQ_Amplitude_Norm = DQ_Amplitude_histograms_normalised_map[bankname]; 00205 TH1F* hDQ_Amplitude_PedSub = DQ_Amplitude_histograms_ped_sub_map[bankname]; 00206 // Loop over the TPulseIslands and plot the histogram 00207 for (std::vector<TPulseIsland*>::iterator pulseIter = thePulses.begin(); 00208 pulseIter != thePulses.end(); ++pulseIter) { 00209 // Make sure the histograms exist and then fill them 00210 if (DQ_Amplitude_histograms_map.find(bankname) != 00211 DQ_Amplitude_histograms_map.end()) 00212 { 00213 /* bool underflow = false; 00214 const std::vector<int>& theSamples = (*pulseIter)->GetSamples(); 00215 for (std::vector<int>::const_iterator sampleIter = theSamples.begin(); 00216 sampleIter != theSamples.end(); ++sampleIter) 00217 { 00218 if (*sampleIter == 4096) 00219 underflow == true; 00220 } 00221 if (!underflow) 00222 { 00223 int amplitude = (*pulseIter)->GetPulseHeight(); 00224 DQ_Amplitude_histograms_map[bankname]->Fill(amplitude); 00225 } 00226 */ 00227 const std::vector<int>& theSamples = (*pulseIter)->GetSamples(); 00228 int peak_sample = (*pulseIter)->GetPeakSample(); 00229 hDQ_Amplitude->Fill(theSamples.at(peak_sample)); 00230 hDQ_Amplitude_Norm->Fill(theSamples.at(peak_sample)); 00231 00232 int amplitude = (*pulseIter)->GetPulseHeight(); 00233 hDQ_Amplitude_PedSub->Fill(amplitude); 00234 00235 } 00236 } 00237 } 00238 return SUCCESS; 00239 }
INT MDQ_Amplitude_eor | ( | INT | run_number | ) |
This method does any last minute things to the histograms at the end of the run
Definition at line 154 of file MDQ_Amplitude.cpp.
References DQ_Amplitude_histograms_normalised_map, TGlobalData::fPulseIslandToChannelMap, TSetupData::GetDetectorName(), and hDQ_TDCCheck_muSc.
00154 { 00155 00156 // Some typedefs 00157 typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap; 00158 typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair; 00159 typedef map<string, vector<TPulseIsland*> >::iterator map_iterator; 00160 00161 // Fetch a reference to the gData structure that stores a map 00162 // of (bank_name, vector<TPulseIsland*>) pairs 00163 TStringPulseIslandMap& pulse_islands_map = 00164 gData->fPulseIslandToChannelMap; 00165 00166 // Loop over the map and get each bankname, vector pair 00167 for (map_iterator mapIter = pulse_islands_map.begin(); mapIter != pulse_islands_map.end(); ++mapIter) { 00168 00169 std::string bankname = mapIter->first; 00170 std::string detname = gSetup->GetDetectorName(bankname); 00171 00172 // Make sure the histograms exist and then fill them 00173 if (DQ_Amplitude_histograms_normalised_map.find(bankname) != DQ_Amplitude_histograms_normalised_map.end()) { 00174 DQ_Amplitude_histograms_normalised_map[bankname]->Scale(1./hDQ_TDCCheck_muSc->GetEntries()); 00175 } 00176 } 00177 00178 return SUCCESS; 00179 }
INT MDQ_Amplitude_init | ( | ) |
This method initializes histograms.
Definition at line 97 of file MDQ_Amplitude.cpp.
References DQ_Amplitude_histograms_map, DQ_Amplitude_histograms_normalised_map, DQ_Amplitude_histograms_ped_sub_map, TSetupData::fBankToDetectorMap, TSetupData::GetDetectorName(), and TSetupData::GetNBits().
00098 { 00099 // See if the DataQuality_LowLevel/ directory already exists 00100 if (!gDirectory->Cd("DataQuality_LowLevel")) { 00101 00102 std::string dir_name("DataQuality_LowLevel/"); 00103 gDirectory->mkdir(dir_name.c_str()); 00104 gDirectory->Cd(dir_name.c_str()); 00105 } 00106 00107 // Create a histogram for each detector 00108 std::map<std::string, std::string> Bank2DetMap = gSetup->fBankToDetectorMap; 00109 00110 typedef std::map<std::string, std::string>::iterator String2StringMapIter; 00111 00112 for(String2StringMapIter mapIter = Bank2DetMap.begin(); 00113 mapIter != Bank2DetMap.end(); mapIter++) { 00114 00115 std::string bankname = mapIter->first; 00116 std::string detname = gSetup->GetDetectorName(bankname); 00117 int n_bits = gSetup->GetNBits(bankname); 00118 int max_adc_value = std::pow(2, n_bits); 00119 00120 // hDQ_Amplitude_[DetName]_[BankName] 00121 std::string histname = "hDQ_Amplitude_" + detname + "_" + bankname; 00122 std::string histtitle = "Amplitude of Pulses in " + detname; 00123 TH1F* hDQ_Histogram = new TH1F(histname.c_str(), histtitle.c_str(), 00124 max_adc_value, 0, max_adc_value); 00125 hDQ_Histogram->GetXaxis()->SetTitle("Amplitude [adc]"); 00126 hDQ_Histogram->GetYaxis()->SetTitle("Counts"); 00127 DQ_Amplitude_histograms_map[bankname] = hDQ_Histogram; 00128 00129 // The normalised histogram 00130 std::string normhistname = histname + "_normalised"; 00131 std::string normhisttitle = histtitle + " (normalised)"; 00132 TH1F* hDQ_Histogram_Normalised = new TH1F(normhistname.c_str(), normhisttitle.c_str(), max_adc_value,0,max_adc_value); 00133 hDQ_Histogram_Normalised->GetXaxis()->SetTitle("Amplitude [adc]"); 00134 std::string yaxislabel = hDQ_Histogram->GetYaxis()->GetTitle(); 00135 yaxislabel += " per TDC muSc Hit"; 00136 hDQ_Histogram_Normalised->GetYaxis()->SetTitle(yaxislabel.c_str()); 00137 DQ_Amplitude_histograms_normalised_map[bankname] = hDQ_Histogram_Normalised; 00138 00139 // The pedestal subtracted histogram 00140 std::string pedsubhistname = histname + "_ped_sub"; 00141 std::string pedsubhisttitle = histtitle + " (pedestal subtracted)"; 00142 TH1F* hDQ_Histogram_PedSub = new TH1F(pedsubhistname.c_str(), pedsubhisttitle.c_str(), 2*max_adc_value,-max_adc_value,max_adc_value); // make sure we see any negative amplitudes 00143 hDQ_Histogram_PedSub->GetXaxis()->SetTitle("Amplitude [adc]"); 00144 hDQ_Histogram_PedSub->GetYaxis()->SetTitle("Counts"); 00145 DQ_Amplitude_histograms_ped_sub_map[bankname] = hDQ_Histogram_PedSub; 00146 } 00147 00148 gDirectory->Cd("/MidasHists/"); 00149 return SUCCESS; 00150 }
Map of bank name to histogram of amplitudes for the TPIs of a given MIDAS event.
Definition at line 75 of file MDQ_Amplitude.cpp.
Referenced by MDQ_Amplitude(), and MDQ_Amplitude_init().
Same as DQ_Amplitude_histograms_map but normalized to number of muons according to TDC.
Definition at line 76 of file MDQ_Amplitude.cpp.
Referenced by MDQ_Amplitude(), MDQ_Amplitude_eor(), and MDQ_Amplitude_init().
Same as DQ_Amplitude_histograms_map but the amplitudes have the pedestal (according to ODB) subtracted off.
Definition at line 77 of file MDQ_Amplitude.cpp.
Referenced by MDQ_Amplitude(), and MDQ_Amplitude_init().
Object to hold data used and produced by modules throughout alcapana stage of analysis.
Definition at line 76 of file analyzer.cpp.
TDirectory* gManaHistsDir |
TFile* gManaOutputFile |
TROOT* gROOT |
Hardware information about digitizers and detectors to be used during alcapana stage of analysis.
Definition at line 80 of file analyzer.cpp.
HNDLE hDB |
Coount of number of muSc hits in a run in the TDC.
Definition at line 84 of file MDQ_TDCCheck.cpp.
Referenced by MDQ_Amplitude_eor(), MDQ_IslandCounter_eor(), MDQ_IslandLength_eor(), MDQ_IslandRate_eor(), MDQ_IslandTimestamp_eor(), MDQ_muScTDiff_eor(), MDQ_TDCCheck(), and MDQ_TDCCheck_init().
TApplication* manaApp |
ANA_MODULE MDQ_Amplitude_module |
{ "MDQ_Amplitude", "Nam Tran", MDQ_Amplitude, NULL, MDQ_Amplitude_eor, MDQ_Amplitude_init, NULL, NULL, 0, NULL, }
Definition at line 81 of file MDQ_Amplitude.cpp.