Correlations of TPI timestamps with timestamps in muSc. More...
Functions | |
INT | MDQ_muScTDiff_init (void) |
INT | MDQ_muScTDiff (EVENT_HEADER *, void *) |
INT | MDQ_muScTDiff_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. | |
map< std::string, TH1F * > | DQ_muScTDiff_histograms_map |
Map of bank name to time stamp correlation with muSc TPI time stamps. The muSc histogram exists but is empty. | |
map< std::string, TH1F * > | DQ_muScTDiff_histograms_normalised_map |
Same as DQ_muScTDiff_histograms_map, but normalized to number of muon hits according to TDC. | |
map< std::string, TH1F * > | DQ_muScTDiff_histograms_with_time_shift_map |
Same as DQ_muScTDiff_histograms_map, except each TPI's time stamp has had the expected timing correlation peak subtracted off. If correct, the peak should be at zero in these plots. | |
float | axis_limit = 50000 |
TH1F * | hDQ_TDCCheck_muSc |
Coount of number of muSc hits in a run in the TDC. | |
ANA_MODULE | MDQ_muScTDiff_module |
Correlations of TPI timestamps with timestamps in muSc.
Creates a number of histograms. The muSc histogram exists but remains unfilled.
INT MDQ_muScTDiff | ( | EVENT_HEADER * | pheader, | |
void * | pevent | |||
) |
This method fills the histograms
Definition at line 172 of file MDQ_muScTDiff.cpp.
References axis_limit, DQ_muScTDiff_histograms_map, DQ_muScTDiff_histograms_normalised_map, DQ_muScTDiff_histograms_with_time_shift_map, TGlobalData::fPulseIslandToChannelMap, TSetupData::GetBankName(), TSetupData::GetDetectorName(), TSetupData::GetTimeShift(), and TSetupData::Instance().
00173 { 00174 // Get the event number 00175 int midas_event_number = pheader->serial_number; 00176 00177 // Some typedefs 00178 typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap; 00179 typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair; 00180 typedef map<string, vector<TPulseIsland*> >::iterator map_iterator; 00181 00182 // Fetch a reference to the gData structure that stores a map 00183 // of (bank_name, vector<TPulseIsland*>) pairs 00184 TStringPulseIslandMap& pulse_islands_map = 00185 gData->fPulseIslandToChannelMap; 00186 00187 // Get the muSc pulses 00188 std::string muSc_bankname = gSetup->GetBankName("muSc"); 00189 std::vector<TPulseIsland*> theMuScPulses = pulse_islands_map[muSc_bankname]; 00190 00191 // Loop over the map and get each bankname, vector pair 00192 for (map_iterator mapIter = pulse_islands_map.begin(); mapIter != pulse_islands_map.end(); ++mapIter) 00193 { 00194 std::string bankname = mapIter->first; 00195 std::string detname = gSetup->GetDetectorName(bankname); 00196 00197 // Don't bother comparing muSc to muSc 00198 if (detname == "muSc") 00199 continue; 00200 00201 std::vector<TPulseIsland*> thePulses = mapIter->second; 00202 00203 // Make sure the histograms exist (put here so that it find() only called once per detector) 00204 if (DQ_muScTDiff_histograms_map.find(bankname) != DQ_muScTDiff_histograms_map.end()) { 00205 00206 // Get the histograms before looping through all the pulses 00207 TH1F* hDQ_muScTDiff = DQ_muScTDiff_histograms_map[bankname]; 00208 TH1F* hDQ_muScTDiff_Norm = DQ_muScTDiff_histograms_normalised_map[bankname]; 00209 TH1F* hDQ_muScTDiff_TimeShift = DQ_muScTDiff_histograms_with_time_shift_map[bankname]; 00210 double time_shift = TSetupData::Instance()->GetTimeShift(bankname); 00211 00212 // Loop over the muSc pulses 00213 for (std::vector<TPulseIsland*>::iterator muScPulseIter = theMuScPulses.begin(); muScPulseIter != theMuScPulses.end(); ++muScPulseIter) { 00214 00215 // Loop over the TPulseIslands and plot the histogram 00216 for (std::vector<TPulseIsland*>::iterator pulseIter = thePulses.begin(); pulseIter != thePulses.end(); ++pulseIter) { 00217 00218 // Get the pulse times for the muSc pulse and the detector pulse 00219 double muSc_time = (*muScPulseIter)->GetPulseTime(); 00220 double det_time = (*pulseIter)->GetPulseTime(); 00221 double tdiff = muSc_time - det_time; 00222 00223 // The pulses should be time-ordered so if the tdiff goes outside of the axis range, then we can just skip to the next muSc pulse 00224 if (std::fabs(tdiff) > 2*axis_limit) 00225 break; 00226 00227 // Fill the histogram 00228 hDQ_muScTDiff->Fill(tdiff); 00229 hDQ_muScTDiff_Norm->Fill(tdiff); 00230 hDQ_muScTDiff_TimeShift->Fill(tdiff+time_shift); 00231 } 00232 } 00233 } 00234 } 00235 return SUCCESS; 00236 }
INT MDQ_muScTDiff_eor | ( | INT | run_number | ) |
This method does any last minute things to the histograms at the end of the run
Definition at line 142 of file MDQ_muScTDiff.cpp.
References DQ_muScTDiff_histograms_normalised_map, TGlobalData::fPulseIslandToChannelMap, TSetupData::GetDetectorName(), and hDQ_TDCCheck_muSc.
00142 { 00143 00144 // Some typedefs 00145 typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap; 00146 typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair; 00147 typedef map<string, vector<TPulseIsland*> >::iterator map_iterator; 00148 00149 // Fetch a reference to the gData structure that stores a map 00150 // of (bank_name, vector<TPulseIsland*>) pairs 00151 TStringPulseIslandMap& pulse_islands_map = 00152 gData->fPulseIslandToChannelMap; 00153 00154 // Loop over the map and get each bankname, vector pair 00155 for (map_iterator mapIter = pulse_islands_map.begin(); mapIter != pulse_islands_map.end(); ++mapIter) { 00156 00157 std::string bankname = mapIter->first; 00158 std::string detname = gSetup->GetDetectorName(bankname); 00159 00160 if (DQ_muScTDiff_histograms_normalised_map.find(bankname) != DQ_muScTDiff_histograms_normalised_map.end()) { 00161 00162 // Normalise to the muSc hits 00163 DQ_muScTDiff_histograms_normalised_map[bankname]->Scale(1./hDQ_TDCCheck_muSc->GetEntries()); 00164 } 00165 } 00166 00167 return SUCCESS; 00168 }
INT MDQ_muScTDiff_init | ( | ) |
This method initializes histograms.
Definition at line 89 of file MDQ_muScTDiff.cpp.
References axis_limit, DQ_muScTDiff_histograms_map, DQ_muScTDiff_histograms_normalised_map, DQ_muScTDiff_histograms_with_time_shift_map, TSetupData::fBankToDetectorMap, and TSetupData::GetDetectorName().
00090 { 00091 // See if the DataQuality_LowLevel/ directory already exists 00092 if (!gDirectory->Cd("DataQuality_LowLevel")) { 00093 00094 std::string dir_name("DataQuality_LowLevel/"); 00095 gDirectory->mkdir(dir_name.c_str()); 00096 gDirectory->Cd(dir_name.c_str()); 00097 } 00098 00099 // Create a histogram for each detector 00100 std::map<std::string, std::string> bank_to_detector_map = gSetup->fBankToDetectorMap; 00101 for(std::map<std::string, std::string>::iterator mapIter = bank_to_detector_map.begin(); 00102 mapIter != bank_to_detector_map.end(); mapIter++) { 00103 00104 std::string bankname = mapIter->first; 00105 std::string detname = gSetup->GetDetectorName(bankname); 00106 00107 // hDQ_muScTDiff_[DetName]_[BankName] 00108 std::string histname = "hDQ_muScTDiff_" + detname + "_" + bankname; 00109 std::string histtitle = "Time differences between muSc and " + detname; 00110 TH1F* hDQ_Histogram = new TH1F(histname.c_str(), histtitle.c_str(), 20000, -axis_limit, axis_limit); 00111 std::string axislabel = "Time Difference (muSc - " + detname + ") [ns]"; 00112 hDQ_Histogram->GetXaxis()->SetTitle(axislabel.c_str()); 00113 hDQ_Histogram->GetYaxis()->SetTitle("Number of TPulseIslands"); 00114 DQ_muScTDiff_histograms_map[bankname] = hDQ_Histogram; 00115 00116 // The normalised histogram 00117 std::string normhistname = histname + "_normalised"; 00118 std::string normhisttitle = histtitle + " (normalised)"; 00119 TH1F* hDQ_Histogram_Normalised = new TH1F(normhistname.c_str(), normhisttitle.c_str(), 20000, -axis_limit, axis_limit); 00120 hDQ_Histogram_Normalised->GetXaxis()->SetTitle(axislabel.c_str()); 00121 std::string yaxislabel = hDQ_Histogram->GetYaxis()->GetTitle(); 00122 yaxislabel += " per TDC muSc Hit"; 00123 hDQ_Histogram_Normalised->GetYaxis()->SetTitle(yaxislabel.c_str()); 00124 DQ_muScTDiff_histograms_normalised_map[bankname] = hDQ_Histogram_Normalised; 00125 00126 // The histogram with the time shifts 00127 std::string timeshift_histname = histname + "_with-time-shift"; 00128 std::string timeshift_histtitle = histtitle + " (with time shift)"; 00129 TH1F* hDQ_Histogram_TimeShift = new TH1F(timeshift_histname.c_str(), timeshift_histtitle.c_str(), 20000, -axis_limit, axis_limit); 00130 hDQ_Histogram_TimeShift->GetXaxis()->SetTitle(axislabel.c_str()); 00131 yaxislabel = hDQ_Histogram->GetYaxis()->GetTitle(); 00132 hDQ_Histogram_Normalised->GetYaxis()->SetTitle(yaxislabel.c_str()); 00133 DQ_muScTDiff_histograms_with_time_shift_map[bankname] = hDQ_Histogram_TimeShift; 00134 } 00135 00136 gDirectory->Cd("/MidasHists/"); 00137 return SUCCESS; 00138 }
float axis_limit = 50000 |
Definition at line 69 of file MDQ_muScTDiff.cpp.
Referenced by MDQ_muScTDiff(), and MDQ_muScTDiff_init().
Map of bank name to time stamp correlation with muSc TPI time stamps. The muSc histogram exists but is empty.
Definition at line 66 of file MDQ_muScTDiff.cpp.
Referenced by MDQ_muScTDiff(), and MDQ_muScTDiff_init().
Same as DQ_muScTDiff_histograms_map, but normalized to number of muon hits according to TDC.
Definition at line 67 of file MDQ_muScTDiff.cpp.
Referenced by MDQ_muScTDiff(), MDQ_muScTDiff_eor(), and MDQ_muScTDiff_init().
Same as DQ_muScTDiff_histograms_map, except each TPI's time stamp has had the expected timing correlation peak subtracted off. If correct, the peak should be at zero in these plots.
Definition at line 68 of file MDQ_muScTDiff.cpp.
Referenced by MDQ_muScTDiff(), and MDQ_muScTDiff_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_muScTDiff_module |
{ "MDQ_muScTDiff", "Andrew Edmonds", MDQ_muScTDiff, NULL, MDQ_muScTDiff_eor, MDQ_muScTDiff_init, NULL, NULL, 0, NULL, }
Definition at line 73 of file MDQ_muScTDiff.cpp.