Stores fraction of run time that data was being taken. Creates hDQ_DAQLivetime. More...
Functions | |
INT | MDQ_DAQLivetime_init (void) |
INT | MDQ_DAQLivetime (EVENT_HEADER *, void *) |
INT | MDQ_DAQLivetime_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_DAQLivetime |
Plots the livetime of the DAQ, calculated from the sum of event times by the total run time. | |
ANA_MODULE | MDQ_DAQLivetime_module |
Stores fraction of run time that data was being taken. Creates hDQ_DAQLivetime.
Assumes every events is 110ms. Multiplies 110 ms by number of MIDAS events, then divides by run time according to ODB. Creates hDQ_DAQLivetime.
INT MDQ_DAQLivetime | ( | EVENT_HEADER * | pheader, | |
void * | pevent | |||
) |
This method fills the histograms
Definition at line 152 of file MDQ_DAQLivetime.cpp.
References hDQ_DAQLivetime.
00153 { 00154 // Get the event number 00155 int midas_event_number = pheader->serial_number; 00156 00157 // Some typedefs 00158 typedef map<string, vector<TPulseIsland*> > TStringPulseIslandMap; 00159 typedef pair<string, vector<TPulseIsland*> > TStringPulseIslandPair; 00160 typedef map<string, vector<TPulseIsland*> >::iterator map_iterator; 00161 00162 // Add an event 00163 double gate_length = 110; // ms 00164 gate_length /= 1000; // convert to seconds since that is what the duration of the run will be calculated in 00165 hDQ_DAQLivetime->Fill(1,gate_length); 00166 return SUCCESS; 00167 }
INT MDQ_DAQLivetime_eor | ( | INT | run_number | ) |
This method does any last minute things to the histograms at the end of the run
Definition at line 98 of file MDQ_DAQLivetime.cpp.
References hDB, and hDQ_DAQLivetime.
00098 { 00099 00100 // Get the run duration to scale the histogram 00101 HNDLE hDB, hKey; 00102 char keyName[200]; 00103 00104 if(cm_get_experiment_database(&hDB, NULL) != CM_SUCCESS){ 00105 printf("Warning: Could not connect to ODB database!\n"); 00106 return false; 00107 } 00108 00109 sprintf(keyName, "/Runinfo/Start time binary"); 00110 if(db_find_key(hDB,0,keyName, &hKey) != SUCCESS){ 00111 printf("Warning: Could not find key %s\n", keyName); 00112 return false; 00113 } 00114 KEY start_time_key; 00115 if(db_get_key(hDB, hKey, &start_time_key) != DB_SUCCESS){ 00116 printf("Warning: Could not find key %s\n", keyName); 00117 return false; 00118 } 00119 DWORD StartTimes[start_time_key.num_values]; 00120 int size = sizeof(StartTimes); 00121 if(db_get_value(hDB, 0, keyName, StartTimes, &size, TID_DWORD, 0) != DB_SUCCESS){ 00122 printf("Warning: Could not retrieve values for key %s\n", keyName); 00123 return false; 00124 } 00125 00126 sprintf(keyName, "/Runinfo/Stop time binary"); 00127 if(db_find_key(hDB,0,keyName, &hKey) != SUCCESS){ 00128 printf("Warning: Could not find key %s\n", keyName); 00129 return false; 00130 } 00131 KEY stop_time_key; 00132 if(db_get_key(hDB, hKey, &stop_time_key) != DB_SUCCESS){ 00133 printf("Warning: Could not find key %s\n", keyName); 00134 return false; 00135 } 00136 DWORD StopTimes[stop_time_key.num_values]; 00137 size = sizeof(StopTimes); 00138 if(db_get_value(hDB, 0, keyName, StopTimes, &size, TID_DWORD, 0) != DB_SUCCESS){ 00139 printf("Warning: Could not retrieve values for key %s\n", keyName); 00140 return false; 00141 } 00142 00143 int duration = StopTimes[0] - StartTimes[0]; // length of run in seconds (checked against run #2600) 00144 00145 hDQ_DAQLivetime->Scale(1.0/duration); 00146 00147 return SUCCESS; 00148 }
INT MDQ_DAQLivetime_init | ( | ) |
This method initializes histograms.
Definition at line 74 of file MDQ_DAQLivetime.cpp.
References hDQ_DAQLivetime.
00075 { 00076 // See if the DataQuality_LowLevel/ directory already exists 00077 if (!gDirectory->Cd("DataQuality_LowLevel")) { 00078 00079 std::string dir_name("DataQuality_LowLevel/"); 00080 gDirectory->mkdir(dir_name.c_str()); 00081 gDirectory->Cd(dir_name.c_str()); 00082 } 00083 00084 // hDQ_DAQLivetime 00085 std::string histname = "hDQ_DAQLivetime"; 00086 std::string histtitle = "DAQ Livetime of the Run"; 00087 hDQ_DAQLivetime = new TH1F(histname.c_str(), histtitle.c_str(), 3,0,3); 00088 hDQ_DAQLivetime->GetXaxis()->SetTitle(""); 00089 hDQ_DAQLivetime->GetYaxis()->SetTitle("DAQ Livetime"); 00090 00091 00092 gDirectory->Cd("/MidasHists/"); 00093 return SUCCESS; 00094 }
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 |
Plots the livetime of the DAQ, calculated from the sum of event times by the total run time.
Definition at line 56 of file MDQ_DAQLivetime.cpp.
Referenced by MDQ_DAQLivetime(), MDQ_DAQLivetime_eor(), and MDQ_DAQLivetime_init().
ANA_MODULE MDQ_DAQLivetime_module |
{ "MDQ_DAQLivetime", "Andrew Edmonds", MDQ_DAQLivetime, NULL, MDQ_DAQLivetime_eor, MDQ_DAQLivetime_init, NULL, NULL, 0, NULL, }
Definition at line 58 of file MDQ_DAQLivetime.cpp.