Plots TPI rate in each bank per MIDAS event. More...
Functions | |
INT | MDQ_IslandRate_init (void) |
INT | MDQ_IslandRate (EVENT_HEADER *, void *) |
INT | MDQ_IslandRate_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_IslandRate |
The rate of each bank averaged over the run. | |
TH1F * | hDQ_IslandRate_normalised |
Same as hDQ_IslandRate, but vertical axis is scaled to number of muon hits according to TDC. | |
TH1F * | hDQ_TDCCheck_muSc |
Coount of number of muSc hits in a run in the TDC. | |
ANA_MODULE | MDQ_IslandRate_module |
Plots TPI rate in each bank per MIDAS event.
Creates hDQ_IslandRate, which records rates of TPI in each enabled bank averaged over the run.
INT MDQ_IslandRate | ( | EVENT_HEADER * | pheader, | |
void * | pevent | |||
) |
This method fills the histograms
Definition at line 171 of file MDQ_IslandRate.cpp.
References TGlobalData::fPulseIslandToChannelMap, TSetupData::GetDetectorName(), hDQ_IslandRate, and hDQ_IslandRate_normalised.
00172 { 00173 // Get the event number 00174 int midas_event_number = pheader->serial_number; 00175 00176 // Some typedefs 00177 typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap; 00178 typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair; 00179 typedef map<string, vector<TPulseIsland*> >::iterator map_iterator; 00180 00181 // Fetch a reference to the gData structure that stores a map 00182 // of (bank_name, vector<TPulseIsland*>) pairs 00183 TStringPulseIslandMap& pulse_islands_map = 00184 gData->fPulseIslandToChannelMap; 00185 00186 // Loop over the map and get each bankname, vector pair 00187 for (map_iterator mapIter = pulse_islands_map.begin(); mapIter != pulse_islands_map.end(); ++mapIter) 00188 { 00189 std::string bankname = mapIter->first; 00190 std::vector<TPulseIsland*> thePulses = mapIter->second; 00191 std::string detname = gSetup->GetDetectorName(bankname); 00192 00193 std::string binname = detname + "(" + bankname + ")"; 00194 00195 hDQ_IslandRate->Fill(binname.c_str(), thePulses.size()); // keep a count of the total number of TPIs 00196 hDQ_IslandRate_normalised->Fill(binname.c_str(), thePulses.size()); // keep a count of the total number of TPIs 00197 } 00198 return SUCCESS; 00199 }
INT MDQ_IslandRate_eor | ( | INT | run_number | ) |
This method does any last minute things to the histograms at the end of the run
Definition at line 114 of file MDQ_IslandRate.cpp.
References hDB, hDQ_IslandRate, hDQ_IslandRate_normalised, and hDQ_TDCCheck_muSc.
00114 { 00115 00116 // Get the run duration to scale the histogram 00117 HNDLE hDB, hKey; 00118 char keyName[200]; 00119 00120 if(cm_get_experiment_database(&hDB, NULL) != CM_SUCCESS){ 00121 printf("Warning: Could not connect to ODB database!\n"); 00122 return false; 00123 } 00124 00125 sprintf(keyName, "/Runinfo/Start time binary"); 00126 if(db_find_key(hDB,0,keyName, &hKey) != SUCCESS){ 00127 printf("Warning: Could not find key %s\n", keyName); 00128 return false; 00129 } 00130 KEY start_time_key; 00131 if(db_get_key(hDB, hKey, &start_time_key) != DB_SUCCESS){ 00132 printf("Warning: Could not find key %s\n", keyName); 00133 return false; 00134 } 00135 DWORD StartTimes[start_time_key.num_values]; 00136 int size = sizeof(StartTimes); 00137 if(db_get_value(hDB, 0, keyName, StartTimes, &size, TID_DWORD, 0) != DB_SUCCESS){ 00138 printf("Warning: Could not retrieve values for key %s\n", keyName); 00139 return false; 00140 } 00141 00142 sprintf(keyName, "/Runinfo/Stop time binary"); 00143 if(db_find_key(hDB,0,keyName, &hKey) != SUCCESS){ 00144 printf("Warning: Could not find key %s\n", keyName); 00145 return false; 00146 } 00147 KEY stop_time_key; 00148 if(db_get_key(hDB, hKey, &stop_time_key) != DB_SUCCESS){ 00149 printf("Warning: Could not find key %s\n", keyName); 00150 return false; 00151 } 00152 DWORD StopTimes[stop_time_key.num_values]; 00153 size = sizeof(StopTimes); 00154 if(db_get_value(hDB, 0, keyName, StopTimes, &size, TID_DWORD, 0) != DB_SUCCESS){ 00155 printf("Warning: Could not retrieve values for key %s\n", keyName); 00156 return false; 00157 } 00158 00159 int duration = StopTimes[0] - StartTimes[0]; // length of run in seconds (checked against run #2600) 00160 00161 hDQ_IslandRate->Scale(1.0/duration); 00162 hDQ_IslandRate_normalised->Scale(1.0/duration); 00163 00164 hDQ_IslandRate_normalised->Scale(1.0/hDQ_TDCCheck_muSc->GetEntries()); // also normalise to the number of muSc hits in the TDC 00165 00166 return SUCCESS; 00167 }
INT MDQ_IslandRate_init | ( | ) |
This method initializes histograms.
Definition at line 80 of file MDQ_IslandRate.cpp.
References hDQ_IslandRate, and hDQ_IslandRate_normalised.
00081 { 00082 // See if the DataQuality_LowLevel/ directory already exists 00083 if (!gDirectory->Cd("DataQuality_LowLevel")) { 00084 00085 std::string dir_name("DataQuality_LowLevel/"); 00086 gDirectory->mkdir(dir_name.c_str()); 00087 gDirectory->Cd(dir_name.c_str()); 00088 } 00089 00090 // hDQ_IslandRate 00091 std::string histname = "hDQ_IslandRate"; 00092 std::string histtitle = "The total island rate in each channel"; 00093 hDQ_IslandRate = new TH1F(histname.c_str(), histtitle.c_str(), 1,0,1); 00094 hDQ_IslandRate->GetXaxis()->SetTitle("Detector (Bank)"); 00095 hDQ_IslandRate->GetYaxis()->SetTitle("Island Rate [TPI per second]"); 00096 hDQ_IslandRate->SetBit(TH1::kCanRebin); 00097 00098 // The normalised histogram 00099 histname += "_normalised"; 00100 histtitle += " (normalised)"; 00101 hDQ_IslandRate_normalised = new TH1F(histname.c_str(), histtitle.c_str(), 1,0,1); 00102 hDQ_IslandRate_normalised->GetXaxis()->SetTitle("Detector (Bank)"); 00103 std::string yaxislabel = hDQ_IslandRate->GetYaxis()->GetTitle(); 00104 yaxislabel += " per TDC muSc Hit"; 00105 hDQ_IslandRate_normalised->GetYaxis()->SetTitle(yaxislabel.c_str()); 00106 00107 00108 gDirectory->Cd("/MidasHists/"); 00109 return SUCCESS; 00110 }
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 |
The rate of each bank averaged over the run.
Definition at line 59 of file MDQ_IslandRate.cpp.
Referenced by MDQ_IslandRate(), MDQ_IslandRate_eor(), and MDQ_IslandRate_init().
Same as hDQ_IslandRate, but vertical axis is scaled to number of muon hits according to TDC.
Definition at line 60 of file MDQ_IslandRate.cpp.
Referenced by MDQ_IslandRate(), MDQ_IslandRate_eor(), and MDQ_IslandRate_init().
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_IslandRate_module |
{ "MDQ_IslandRate", "Andrew Edmonds", MDQ_IslandRate, NULL, MDQ_IslandRate_eor, MDQ_IslandRate_init, NULL, NULL, 0, NULL, }
Definition at line 64 of file MDQ_IslandRate.cpp.