MDQ_IslandTimestamp
[Low Level Data Quality Checks]

Histograms the timestamps from each MIDAS event for each detector. More...

Functions

INT MDQ_IslandTimestamp_init (void)
INT MDQ_IslandTimestamp (EVENT_HEADER *, void *)
INT MDQ_IslandTimestamp_eor (INT)

Variables

HNDLE hDB
TGlobalDatagData
 Object to hold data used and produced by modules throughout alcapana stage of analysis.
TSetupDatagSetup
 Hardware information about digitizers and detectors to be used during alcapana stage of analysis.
map< std::string, TH1F * > DQ_IslandTimestamp_histograms_map
 Map of bank name to histogram of time stamps within a MIDAS event.
map< std::string, TH1F * > DQ_IslandTimestamp_histograms_normalised_map
 Same as DQ_IslandTimestamp_histograms_map, but vertical axis is normalised 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_IslandTimestamp_module

Detailed Description

Histograms the timestamps from each MIDAS event for each detector.

Author:
Andrew Edmonds

Creates a number of histograms.


Function Documentation

INT MDQ_IslandTimestamp ( EVENT_HEADER *  pheader,
void *  pevent 
)

This method fills the histograms

Definition at line 156 of file MDQ_IslandTimestamp.cpp.

References DQ_IslandTimestamp_histograms_map, DQ_IslandTimestamp_histograms_normalised_map, TGlobalData::fPulseIslandToChannelMap, and TSetupData::GetDetectorName().

00157 {
00158         // Get the event number
00159         int midas_event_number = pheader->serial_number;
00160 
00161         // Some typedefs
00162         typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap;
00163         typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair;
00164         typedef map<string, vector<TPulseIsland*> >::iterator map_iterator;
00165 
00166         // Fetch a reference to the gData structure that stores a map
00167         // of (bank_name, vector<TPulseIsland*>) pairs
00168         TStringPulseIslandMap& pulse_islands_map =
00169                 gData->fPulseIslandToChannelMap;
00170 
00171         // Loop over the map and get each bankname, vector pair
00172         for (map_iterator mapIter = pulse_islands_map.begin(); mapIter != pulse_islands_map.end(); ++mapIter) 
00173         {
00174           std::string bankname = mapIter->first;
00175           std::string detname = gSetup->GetDetectorName(bankname);
00176           std::vector<TPulseIsland*> thePulses = mapIter->second;
00177 
00178           // Get the histograms before looping through the pulses
00179           TH1F* hDQ_IslandTimestamp = DQ_IslandTimestamp_histograms_map[bankname];
00180           TH1F* hDQ_IslandTimestamp_Norm = DQ_IslandTimestamp_histograms_normalised_map[bankname];
00181                         
00182           // Loop over the TPulseIslands and plot the histogram
00183           for (std::vector<TPulseIsland*>::iterator pulseIter = thePulses.begin(); pulseIter != thePulses.end(); ++pulseIter) {
00184 
00185             // Make sure the histograms exist and then fill them
00186             if (DQ_IslandTimestamp_histograms_map.find(bankname) != DQ_IslandTimestamp_histograms_map.end()) {
00187               int time_stamp = (*pulseIter)->GetTimeStamp();
00188               double clock_tick_in_ns = (*pulseIter)->GetClockTickInNs();
00189               double block_time = time_stamp * clock_tick_in_ns;
00190 
00191               hDQ_IslandTimestamp->Fill(block_time);
00192               hDQ_IslandTimestamp_Norm->Fill(block_time);
00193             }
00194           }
00195         }
00196         return SUCCESS;
00197 }

INT MDQ_IslandTimestamp_eor ( INT  run_number  ) 

This method does any last minute things to the histograms at the end of the run

Definition at line 127 of file MDQ_IslandTimestamp.cpp.

References DQ_IslandTimestamp_histograms_normalised_map, TGlobalData::fPulseIslandToChannelMap, TSetupData::GetDetectorName(), and hDQ_TDCCheck_muSc.

00127                                             {
00128 
00129   // Some typedefs
00130   typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap;
00131   typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair;
00132   typedef map<string, vector<TPulseIsland*> >::iterator map_iterator;
00133   
00134   // Fetch a reference to the gData structure that stores a map
00135   // of (bank_name, vector<TPulseIsland*>) pairs
00136   TStringPulseIslandMap& pulse_islands_map =
00137     gData->fPulseIslandToChannelMap;
00138 
00139   // Loop over the map and get each bankname, vector pair
00140   for (map_iterator mapIter = pulse_islands_map.begin(); mapIter != pulse_islands_map.end(); ++mapIter) {
00141 
00142     std::string bankname = mapIter->first;
00143     std::string detname = gSetup->GetDetectorName(bankname);
00144       
00145     // Make sure the histograms exist and then fill them
00146     if (DQ_IslandTimestamp_histograms_normalised_map.find(bankname) != DQ_IslandTimestamp_histograms_normalised_map.end()) {
00147       DQ_IslandTimestamp_histograms_normalised_map[bankname]->Scale(1./hDQ_TDCCheck_muSc->GetEntries());
00148     }
00149   }
00150 
00151   return SUCCESS;
00152 }

INT MDQ_IslandTimestamp_init (  ) 

This method initializes histograms.

Definition at line 79 of file MDQ_IslandTimestamp.cpp.

References DQ_IslandTimestamp_histograms_map, DQ_IslandTimestamp_histograms_normalised_map, TSetupData::fBankToDetectorMap, TSetupData::GetClockTick(), and TSetupData::GetDetectorName().

00080 {
00081   // See if the DataQuality_LowLevel/ directory already exists
00082   if (!gDirectory->Cd("DataQuality_LowLevel")) {
00083     
00084     std::string dir_name("DataQuality_LowLevel/");
00085     gDirectory->mkdir(dir_name.c_str());
00086     gDirectory->Cd(dir_name.c_str());
00087   }
00088 
00089   // Create a histogram for each detector
00090   std::map<std::string, std::string> bank_to_detector_map = gSetup->fBankToDetectorMap;
00091   for(std::map<std::string, std::string>::iterator mapIter = bank_to_detector_map.begin(); 
00092       mapIter != bank_to_detector_map.end(); mapIter++) { 
00093 
00094     std::string bankname = mapIter->first;
00095     std::string detname = gSetup->GetDetectorName(bankname);
00096 
00097     double bin_width = gSetup->GetClockTick(bankname) * 1000;
00098     double bin_max = 120e6;
00099     int n_bins = bin_max / bin_width;
00100 
00101     // hDQ_IslandTimestamp_[DetName]_[BankName]
00102     std::string histname = "hDQ_IslandTimestamp_" + detname + "_" + bankname;
00103     std::string histtitle = "Distribution of time stamps in " + detname;
00104     TH1F* hDQ_Histogram = new TH1F(histname.c_str(), histtitle.c_str(), n_bins, 0, bin_max);
00105     hDQ_Histogram->GetXaxis()->SetTitle("Time Stamp [ns]");
00106     hDQ_Histogram->GetYaxis()->SetTitle("Number of TPulseIslands");
00107     DQ_IslandTimestamp_histograms_map[bankname] = hDQ_Histogram;
00108 
00109     // The normalised histogram
00110     histname += "_normalised";
00111     histtitle += " (normalised)";
00112     TH1F* hDQ_Histogram_Normalised = new TH1F(histname.c_str(), histtitle.c_str(), n_bins,0,bin_max);
00113     hDQ_Histogram_Normalised->GetXaxis()->SetTitle("Time Stamp [ns]");
00114     std::string yaxislabel = hDQ_Histogram->GetYaxis()->GetTitle();
00115     yaxislabel += " per TDC muSc Hit";
00116     hDQ_Histogram_Normalised->GetYaxis()->SetTitle(yaxislabel.c_str());
00117     DQ_IslandTimestamp_histograms_normalised_map[bankname] = hDQ_Histogram_Normalised;
00118   }
00119 
00120   gDirectory->Cd("/MidasHists/");
00121   return SUCCESS;
00122 }


Variable Documentation

Map of bank name to histogram of time stamps within a MIDAS event.

Definition at line 58 of file MDQ_IslandTimestamp.cpp.

Referenced by MDQ_IslandTimestamp(), and MDQ_IslandTimestamp_init().

Same as DQ_IslandTimestamp_histograms_map, but vertical axis is normalised to number of muon hits according to TDC.

Definition at line 59 of file MDQ_IslandTimestamp.cpp.

Referenced by MDQ_IslandTimestamp(), MDQ_IslandTimestamp_eor(), and MDQ_IslandTimestamp_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

Coount of number of muSc hits in a run in the TDC.

Definition at line 84 of file MDQ_TDCCheck.cpp.

Initial value:
{
        "MDQ_IslandTimestamp",                    
        "Andrew Edmonds",              
        MDQ_IslandTimestamp,                      
        NULL,                          
        MDQ_IslandTimestamp_eor,                          
        MDQ_IslandTimestamp_init,                 
        NULL,                          
        NULL,                          
        0,                             
        NULL,                          
}

Definition at line 63 of file MDQ_IslandTimestamp.cpp.


Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1