Plots number of TPIs in each detector per MIDAS event with different normalizations. More...
Functions | |
INT | MDQ_IslandCounter_init (void) |
INT | MDQ_IslandCounter (EVENT_HEADER *, void *) |
INT | MDQ_IslandCounter_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. | |
TH1F * | hDQ_TDCCheck_muSc |
Coount of number of muSc hits in a run in the TDC. | |
map< std::string, TH1F * > | DQ_IslandCounter_histograms_map |
Maps bank name to histogram of number of TPIs in MIDAS event. | |
map< std::string, TH1F * > | DQ_IslandCounter_histograms_normalised_map |
Same as DQ_IslandCounter_histograms_map, but normalized vertical axis to muon count according to TDC. | |
map< std::string, TH1F * > | DQ_IslandCounter_histograms_both_axes_normalised_map |
Same as DQ_IslandCounter_histograms_normalised_map, but additionally horizontal axis is normalized in the same way. | |
ANA_MODULE | MDQ_IslandCounter_module |
Plots number of TPIs in each detector per MIDAS event with different normalizations.
Creates several plots.
INT MDQ_IslandCounter | ( | EVENT_HEADER * | pheader, | |
void * | pevent | |||
) |
This method fills the histograms
Definition at line 178 of file MDQ_IslandCounter.cpp.
References DQ_IslandCounter_histograms_map, DQ_IslandCounter_histograms_normalised_map, TGlobalData::fPulseIslandToChannelMap, and TSetupData::GetDetectorName().
00179 { 00180 // Get the event number 00181 int midas_event_number = pheader->serial_number; 00182 00183 // Some typedefs 00184 typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap; 00185 typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair; 00186 typedef map<string, vector<TPulseIsland*> >::iterator map_iterator; 00187 00188 // Fetch a reference to the gData structure that stores a map 00189 // of (bank_name, vector<TPulseIsland*>) pairs 00190 TStringPulseIslandMap& pulse_islands_map = 00191 gData->fPulseIslandToChannelMap; 00192 00193 // Loop over the map and get each bankname, vector pair 00194 for (map_iterator mapIter = pulse_islands_map.begin(); mapIter != pulse_islands_map.end(); ++mapIter) 00195 { 00196 std::string bankname = mapIter->first; 00197 std::string detname = gSetup->GetDetectorName(bankname); 00198 std::vector<TPulseIsland*> thePulses = mapIter->second; 00199 00200 // Make sure the histograms exist and then fill them 00201 if (DQ_IslandCounter_histograms_map.find(bankname) != DQ_IslandCounter_histograms_map.end()) { 00202 int n_pulse_islands = thePulses.size(); 00203 00204 DQ_IslandCounter_histograms_map[bankname]->Fill(n_pulse_islands); 00205 DQ_IslandCounter_histograms_normalised_map[bankname]->Fill(n_pulse_islands); 00206 } 00207 } 00208 return SUCCESS; 00209 }
INT MDQ_IslandCounter_eor | ( | INT | run_number | ) |
This method does any last minute things to the histograms at the end of the run
Definition at line 138 of file MDQ_IslandCounter.cpp.
References DQ_IslandCounter_histograms_both_axes_normalised_map, DQ_IslandCounter_histograms_normalised_map, TGlobalData::fPulseIslandToChannelMap, TSetupData::GetDetectorName(), and hDQ_TDCCheck_muSc.
00138 { 00139 00140 // Some typedefs 00141 typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap; 00142 typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair; 00143 typedef map<string, vector<TPulseIsland*> >::iterator map_iterator; 00144 00145 // Fetch a reference to the gData structure that stores a map 00146 // of (bank_name, vector<TPulseIsland*>) pairs 00147 TStringPulseIslandMap& pulse_islands_map = 00148 gData->fPulseIslandToChannelMap; 00149 00150 // Loop over the map and get each bankname, vector pair 00151 for (map_iterator mapIter = pulse_islands_map.begin(); mapIter != pulse_islands_map.end(); ++mapIter) { 00152 00153 std::string bankname = mapIter->first; 00154 std::string detname = gSetup->GetDetectorName(bankname); 00155 00156 // Make sure the histograms exist and then fill them 00157 if (DQ_IslandCounter_histograms_normalised_map.find(bankname) != DQ_IslandCounter_histograms_normalised_map.end()) { 00158 00159 TH1F* normalised_histogram = DQ_IslandCounter_histograms_normalised_map[bankname]; 00160 normalised_histogram->Scale(1./hDQ_TDCCheck_muSc->GetEntries()); 00161 00162 // to get the normalised x-axis we need to go through and fill a second histogram 00163 TH1F* both_axes_normalised_histogram = DQ_IslandCounter_histograms_both_axes_normalised_map[bankname]; 00164 for (int iBin = 1; iBin < normalised_histogram->GetNbinsX(); ++iBin) { 00165 double normalised_histogram_bin_content = normalised_histogram->GetBinContent(iBin); 00166 double normalised_histogram_bin_center = normalised_histogram->GetBinCenter(iBin); 00167 both_axes_normalised_histogram->Fill(normalised_histogram_bin_center / hDQ_TDCCheck_muSc->GetEntries(), normalised_histogram_bin_content); 00168 } 00169 } 00170 } 00171 00172 return SUCCESS; 00173 }
INT MDQ_IslandCounter_init | ( | ) |
This method initializes histograms.
Definition at line 86 of file MDQ_IslandCounter.cpp.
References DQ_IslandCounter_histograms_both_axes_normalised_map, DQ_IslandCounter_histograms_map, DQ_IslandCounter_histograms_normalised_map, TSetupData::fBankToDetectorMap, and TSetupData::GetDetectorName().
00087 { 00088 // See if the DataQuality_LowLevel/ directory already exists 00089 if (!gDirectory->Cd("DataQuality_LowLevel")) { 00090 00091 std::string dir_name("DataQuality_LowLevel/"); 00092 gDirectory->mkdir(dir_name.c_str()); 00093 gDirectory->Cd(dir_name.c_str()); 00094 } 00095 00096 // Create a histogram for each detector 00097 std::map<std::string, std::string> bank_to_detector_map = gSetup->fBankToDetectorMap; 00098 for(std::map<std::string, std::string>::iterator mapIter = bank_to_detector_map.begin(); 00099 mapIter != bank_to_detector_map.end(); mapIter++) { 00100 00101 std::string bankname = mapIter->first; 00102 std::string detname = gSetup->GetDetectorName(bankname); 00103 00104 // hDQ_IslandCounter_[DetName]_[BankName] 00105 std::string histname = "hDQ_IslandCounter_" + detname + "_" + bankname; 00106 std::string histtitle = "Distribution of the number of islands per event in " + detname; 00107 TH1F* hDQ_Histogram = new TH1F(histname.c_str(), histtitle.c_str(), 3500, 0, 3500); 00108 hDQ_Histogram->GetXaxis()->SetTitle("Number of TPulseIslands"); 00109 hDQ_Histogram->GetYaxis()->SetTitle("Number of Events"); 00110 DQ_IslandCounter_histograms_map[bankname] = hDQ_Histogram; 00111 00112 // The normalised histogram 00113 histname += "_normalised"; 00114 histtitle += " (normalised)"; 00115 TH1F* hDQ_Histogram_Normalised = new TH1F(histname.c_str(), histtitle.c_str(), 3500,0,3500); 00116 hDQ_Histogram_Normalised->GetXaxis()->SetTitle("Number of TPulseIslands"); 00117 std::string yaxislabel = hDQ_Histogram->GetYaxis()->GetTitle(); 00118 yaxislabel += " per TDC muSc Hit"; 00119 hDQ_Histogram_Normalised->GetYaxis()->SetTitle(yaxislabel.c_str()); 00120 DQ_IslandCounter_histograms_normalised_map[bankname] = hDQ_Histogram_Normalised; 00121 00122 histname += "_both_axes_normalised"; 00123 histtitle += " (both axes normalised)"; 00124 TH1F* hDQ_Histogram_Both_Axes_Normalised = new TH1F(histname.c_str(), histtitle.c_str(), 3500,0,0.0035); 00125 hDQ_Histogram_Both_Axes_Normalised->GetXaxis()->SetTitle("Number of TPulseIslands per muSc TDC Hit"); 00126 yaxislabel = hDQ_Histogram->GetYaxis()->GetTitle(); 00127 yaxislabel += " per TDC muSc Hit"; 00128 hDQ_Histogram_Both_Axes_Normalised->GetYaxis()->SetTitle(yaxislabel.c_str()); 00129 DQ_IslandCounter_histograms_both_axes_normalised_map[bankname] = hDQ_Histogram_Both_Axes_Normalised; 00130 } 00131 00132 gDirectory->Cd("/MidasHists/"); 00133 return SUCCESS; 00134 }
Same as DQ_IslandCounter_histograms_normalised_map, but additionally horizontal axis is normalized in the same way.
Definition at line 68 of file MDQ_IslandCounter.cpp.
Referenced by MDQ_IslandCounter_eor(), and MDQ_IslandCounter_init().
Maps bank name to histogram of number of TPIs in MIDAS event.
Definition at line 66 of file MDQ_IslandCounter.cpp.
Referenced by MDQ_IslandCounter(), and MDQ_IslandCounter_init().
Same as DQ_IslandCounter_histograms_map, but normalized vertical axis to muon count according to TDC.
Definition at line 67 of file MDQ_IslandCounter.cpp.
Referenced by MDQ_IslandCounter(), MDQ_IslandCounter_eor(), and MDQ_IslandCounter_init().
Object to hold data used and produced by modules throughout alcapana stage of analysis.
Definition at line 76 of file analyzer.cpp.
Hardware information about digitizers and detectors to be used during alcapana stage of analysis.
Definition at line 80 of file analyzer.cpp.
HNDLE hDB |
TH1F* hDQ_TDCCheck_muSc |
Coount of number of muSc hits in a run in the TDC.
Definition at line 84 of file MDQ_TDCCheck.cpp.
ANA_MODULE MDQ_IslandCounter_module |
{ "MDQ_IslandCounter", "Andrew Edmonds", MDQ_IslandCounter, NULL, MDQ_IslandCounter_eor, MDQ_IslandCounter_init, NULL, NULL, 0, NULL, }
Definition at line 70 of file MDQ_IslandCounter.cpp.