Plots information from the TDC, most importantly muSc, muScA, and muPC data. More...
Functions | |
INT | MDQ_TDCCheck_init (void) |
INT | MDQ_TDCCheck (EVENT_HEADER *, void *) |
INT | MDQ_TDCCheck_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. | |
TH1F * | hDQ_TDCCheck_muScA |
Count of number of muScA hits in a run in the TDC. | |
TH1F * | hDQ_TDCCheck_muPC |
Count of muPC hits during the run. | |
TH1F * | hDQ_TDCCheck_Unknown |
Count of unknown TDC parameters during a run. | |
TH1F * | hDQ_TDCCheck_muSc_time |
Time distribution of muon hits in TDC. | |
TH1F * | hDQ_TDCCheck_muSc_rate |
Rate of muSc hits in TDC averaged over the run. | |
TH1F * | hDQ_TDCCheck_TDiff |
Timing correlation between muSc hits in digitizer in ns and muon hits in TDC (units?). | |
ANA_MODULE | MDQ_TDCCheck_module |
Plots information from the TDC, most importantly muSc, muScA, and muPC data.
A number of TDC plots are created. There is a count of muSc, muScA, and muPC hits. The muSc time is also plotted (this is in addition to the timing we get from the digitizer the muSc is plugged into). A timing correlation plot is made between the timing of the digitizer and the TDC. And finally all unknown parameters from the TDC are counted up.
INT MDQ_TDCCheck | ( | EVENT_HEADER * | pheader, | |
void * | pevent | |||
) |
This method fills the histograms
Definition at line 209 of file MDQ_TDCCheck.cpp.
References TGlobalData::fPulseIslandToChannelMap, TSetupData::GetBankName(), hDQ_TDCCheck_muPC, hDQ_TDCCheck_muSc, hDQ_TDCCheck_muSc_rate, hDQ_TDCCheck_muSc_time, hDQ_TDCCheck_muScA, hDQ_TDCCheck_TDiff, and hDQ_TDCCheck_Unknown.
00210 { 00211 // Get the event number 00212 int midas_event_number = pheader->serial_number; 00213 00214 // Some typedefs 00215 typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap; 00216 typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair; 00217 typedef map<string, vector<TPulseIsland*> >::iterator map_iterator; 00218 00219 // Fetch a reference to the gData structure that stores a map 00220 // of (bank_name, vector<TPulseIsland*>) pairs 00221 TStringPulseIslandMap& pulse_islands_map = 00222 gData->fPulseIslandToChannelMap; 00223 00224 // Get a pointer to the hit data in the TDC 00225 // NB copied and modified from MMuSCAnalysisC.cpp 00226 channel_hit *hit_bank; 00227 int hit_bank_size = bk_locate(pevent, "HITS", (DWORD *) &hit_bank); 00228 hit_bank_size = hit_bank_size * sizeof(DWORD) / sizeof(channel_hit); 00229 00230 // At the moment just loop through the hits and print the information 00231 // Parameter values have been obtained from MMuSCAnalysisMQL.cpp and MMuPC1AnalysisMQL.cpp 00232 for (int i = 0; i < hit_bank_size; ++i) { 00233 if (hit_bank[i].parameter == 6011) { 00234 // printf("muSC hit! Hit #%d: time = %f, parameter = %d\n", i, hit_bank[i].time, hit_bank[i].parameter); 00235 hDQ_TDCCheck_muSc->Fill(1); 00236 hDQ_TDCCheck_muSc_time->Fill(hit_bank[i].time); 00237 hDQ_TDCCheck_muSc_rate->Fill(1); 00238 00239 // Plot the time difference between the time as given by the TDC and as given by the BU CAEN 00240 std::string detname = "muSc"; 00241 std::string bankname = gSetup->GetBankName(detname); 00242 std::vector<TPulseIsland*> theMuScPulses = pulse_islands_map[bankname]; 00243 00244 // Loop over the TPulseIslands and plot the histogram 00245 for (std::vector<TPulseIsland*>::iterator pulseIter = theMuScPulses.begin(); pulseIter != theMuScPulses.end(); ++pulseIter) { 00246 00247 // Get the timestamp of the TPI in ns 00248 int time_stamp = (*pulseIter)->GetTimeStamp(); 00249 double clock_tick_in_ns = (*pulseIter)->GetClockTickInNs(); 00250 double block_time = time_stamp * clock_tick_in_ns; 00251 00252 hDQ_TDCCheck_TDiff->Fill(block_time - hit_bank[i].time); 00253 } 00254 } 00255 00256 else if (hit_bank[i].parameter == 6002) 00257 // printf("muSCA hit! Hit #%d: time = %f, parameter = %d\n", i, hit_bank[i].time, hit_bank[i].parameter); 00258 hDQ_TDCCheck_muScA->Fill(1); 00259 00260 else if (hit_bank[i].parameter >= 4001 && hit_bank[i].parameter <= 4074) 00261 // printf("muPC hit! Hit #%d: time = %f, parameter = %d\n", i, hit_bank[i].time, hit_bank[i].parameter); 00262 hDQ_TDCCheck_muPC->Fill(1); 00263 else 00264 // printf("Unknown hit! Hit #%d: time = %f, parameter = %d\n", i, hit_bank[i].time, hit_bank[i].parameter); 00265 hDQ_TDCCheck_Unknown->Fill(hit_bank[i].parameter); 00266 } 00267 00268 return SUCCESS; 00269 }
INT MDQ_TDCCheck_eor | ( | INT | run_number | ) |
This method does any last minute things to the histograms at the end of the run
Definition at line 155 of file MDQ_TDCCheck.cpp.
References hDB, and hDQ_TDCCheck_muSc_rate.
00155 { 00156 00157 // Get the run duration to scale the histogram 00158 HNDLE hDB, hKey; 00159 char keyName[200]; 00160 00161 if(cm_get_experiment_database(&hDB, NULL) != CM_SUCCESS){ 00162 printf("Warning: Could not connect to ODB database!\n"); 00163 return false; 00164 } 00165 00166 sprintf(keyName, "/Runinfo/Start time binary"); 00167 if(db_find_key(hDB,0,keyName, &hKey) != SUCCESS){ 00168 printf("Warning: Could not find key %s\n", keyName); 00169 return false; 00170 } 00171 KEY start_time_key; 00172 if(db_get_key(hDB, hKey, &start_time_key) != DB_SUCCESS){ 00173 printf("Warning: Could not find key %s\n", keyName); 00174 return false; 00175 } 00176 DWORD StartTimes[start_time_key.num_values]; 00177 int size = sizeof(StartTimes); 00178 if(db_get_value(hDB, 0, keyName, StartTimes, &size, TID_DWORD, 0) != DB_SUCCESS){ 00179 printf("Warning: Could not retrieve values for key %s\n", keyName); 00180 return false; 00181 } 00182 00183 sprintf(keyName, "/Runinfo/Stop time binary"); 00184 if(db_find_key(hDB,0,keyName, &hKey) != SUCCESS){ 00185 printf("Warning: Could not find key %s\n", keyName); 00186 return false; 00187 } 00188 KEY stop_time_key; 00189 if(db_get_key(hDB, hKey, &stop_time_key) != DB_SUCCESS){ 00190 printf("Warning: Could not find key %s\n", keyName); 00191 return false; 00192 } 00193 DWORD StopTimes[stop_time_key.num_values]; 00194 size = sizeof(StopTimes); 00195 if(db_get_value(hDB, 0, keyName, StopTimes, &size, TID_DWORD, 0) != DB_SUCCESS){ 00196 printf("Warning: Could not retrieve values for key %s\n", keyName); 00197 return false; 00198 } 00199 00200 int duration = StopTimes[0] - StartTimes[0]; // length of run in seconds (checked against run #2600) 00201 00202 hDQ_TDCCheck_muSc_rate->Scale(1.0/duration); 00203 00204 return SUCCESS; 00205 }
INT MDQ_TDCCheck_init | ( | ) |
This method initializes histograms.
Definition at line 110 of file MDQ_TDCCheck.cpp.
References hDQ_TDCCheck_muPC, hDQ_TDCCheck_muSc, hDQ_TDCCheck_muSc_rate, hDQ_TDCCheck_muSc_time, hDQ_TDCCheck_muScA, hDQ_TDCCheck_TDiff, and hDQ_TDCCheck_Unknown.
00111 { 00112 // See if the DataQuality_LowLevel/ directory already exists 00113 if (!gDirectory->Cd("DataQuality_LowLevel")) { 00114 00115 std::string dir_name("DataQuality_LowLevel/"); 00116 gDirectory->mkdir(dir_name.c_str()); 00117 gDirectory->Cd(dir_name.c_str()); 00118 } 00119 00120 // Create some histograms 00121 hDQ_TDCCheck_muSc = new TH1F("hDQ_TDCCheck_muSc", "Number of Hits in TDC (muSc)", 3,0,3); 00122 hDQ_TDCCheck_muSc->GetXaxis()->SetTitle("muSc"); 00123 hDQ_TDCCheck_muSc->GetYaxis()->SetTitle("Number of Hits"); 00124 00125 hDQ_TDCCheck_muScA = new TH1F("hDQ_TDCCheck_muScA", "Number of Hits in TDC (muScA)", 3,0,3); 00126 hDQ_TDCCheck_muScA->GetXaxis()->SetTitle("muScA"); 00127 hDQ_TDCCheck_muScA->GetYaxis()->SetTitle("Number of Hits"); 00128 00129 hDQ_TDCCheck_muPC = new TH1F("hDQ_TDCCheck_muPC", "Number of Hits in TDC (muPC)", 3,0,3); 00130 hDQ_TDCCheck_muPC->GetXaxis()->SetTitle("muPC"); 00131 hDQ_TDCCheck_muPC->GetYaxis()->SetTitle("Number of Hits"); 00132 00133 hDQ_TDCCheck_Unknown = new TH1F("hDQ_TDCCheck_Unknown", "Number of Hits in TDC (Unknown)", 7000,0,7000); 00134 hDQ_TDCCheck_Unknown->GetXaxis()->SetTitle("TDC Parameter"); 00135 hDQ_TDCCheck_Unknown->GetYaxis()->SetTitle("Number of Hits"); 00136 00137 hDQ_TDCCheck_muSc_time = new TH1F("hDQ_TDCCheck_muSc_time", "Time of TDC Hits in muSc", 1200,0,120e6); 00138 hDQ_TDCCheck_muSc_time->GetXaxis()->SetTitle("Time of muSc Hit [ns]"); 00139 hDQ_TDCCheck_muSc_time->GetYaxis()->SetTitle("Number of Hits"); 00140 00141 hDQ_TDCCheck_muSc_rate = new TH1F("hDQ_TDCCheck_muSc_rate", "Rate of TDC Hits in muSc", 3,0,3); 00142 hDQ_TDCCheck_muSc_rate->GetXaxis()->SetTitle("muSc"); 00143 hDQ_TDCCheck_muSc_rate->GetYaxis()->SetTitle("Rate of muSc Hit [s^-1]"); 00144 00145 hDQ_TDCCheck_TDiff = new TH1F("hDQ_TDCCheck_TDiff", "Time difference between muSc hit in TDC and BU", 10000,-5000,5000); 00146 hDQ_TDCCheck_TDiff->GetXaxis()->SetTitle("Time Difference of muSc Hits (BU CAEN - TDC)"); 00147 hDQ_TDCCheck_TDiff->GetYaxis()->SetTitle("Number of Hits"); 00148 00149 gDirectory->Cd("/MidasHists/"); 00150 return SUCCESS; 00151 }
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 |
Count of muPC hits during the run.
Definition at line 86 of file MDQ_TDCCheck.cpp.
Referenced by MDQ_TDCCheck(), and MDQ_TDCCheck_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.
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().
Rate of muSc hits in TDC averaged over the run.
Definition at line 90 of file MDQ_TDCCheck.cpp.
Referenced by MDQ_TDCCheck(), MDQ_TDCCheck_eor(), and MDQ_TDCCheck_init().
Time distribution of muon hits in TDC.
Definition at line 89 of file MDQ_TDCCheck.cpp.
Referenced by MDQ_TDCCheck(), and MDQ_TDCCheck_init().
Count of number of muScA hits in a run in the TDC.
Definition at line 85 of file MDQ_TDCCheck.cpp.
Referenced by MDQ_TDCCheck(), and MDQ_TDCCheck_init().
Timing correlation between muSc hits in digitizer in ns and muon hits in TDC (units?).
Definition at line 91 of file MDQ_TDCCheck.cpp.
Referenced by MDQ_TDCCheck(), and MDQ_TDCCheck_init().
Count of unknown TDC parameters during a run.
Definition at line 87 of file MDQ_TDCCheck.cpp.
Referenced by MDQ_TDCCheck(), and MDQ_TDCCheck_init().
ANA_MODULE MDQ_TDCCheck_module |
{ "MDQ_TDCCheck", "Andrew Edmonds", MDQ_TDCCheck, NULL, MDQ_TDCCheck_eor, MDQ_TDCCheck_init, NULL, NULL, 0, NULL, }
Definition at line 94 of file MDQ_TDCCheck.cpp.