src/data_quality/MDQ_MuPC.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <map>
#include <utility>
#include "midas.h"
#include <TH1.h>
#include <TH2.h>
#include <TDirectory.h>
#include "TGlobalData.h"
#include "TSetupData.h"

Go to the source code of this file.

Functions

INT MDQ_MuPC_init (void)
INT MDQ_MuPC_BOR (INT run_number)
INT MDQ_MuPC_EOR (INT run_number)
INT MDQ_MuPC (EVENT_HEADER *, void *)

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.
static TH2 * hDQ_MuPC_XvsT
static TH2 * hDQ_MuPC_YvsT
static TH2 * hDQ_MuPC_XvsY_Total
static TH2 * hDQ_MuPC_XvsY_ExclHotWires
static TH2 * hDQ_MuPC_XvsY_Fraction
static int n_total_clusters
ANA_MODULE MDQ_MuPC_module

Function Documentation

INT MDQ_MuPC ( EVENT_HEADER *  pheader,
void *  pevent 
)

This method processes one MIDAS block, producing a vector of TOctalFADCIsland objects from the raw Octal FADC data.

Definition at line 157 of file MDQ_MuPC.cpp.

References hDQ_MuPC_XvsT, hDQ_MuPC_XvsY_ExclHotWires, hDQ_MuPC_XvsY_Fraction, hDQ_MuPC_XvsY_Total, hDQ_MuPC_YvsT, and n_total_clusters.

00158 {
00159   // Get the event number
00160   int midas_event_number = pheader->serial_number;
00161 
00162   // Get the MPC1 bank and get a pointer to the raw data
00163   double* raw; // points at the raw data
00164 
00165   int bankSize = bk_locate(pevent,"MPC1",&raw);
00166 
00167   bankSize = bankSize*sizeof(DWORD)/sizeof(double);
00168 
00169   double timestamp = 0.;
00170   double wire_number_x = 0.;
00171   double wire_number_y = 0.;
00172 
00173   for (int i=0; i<bankSize; i+=3){
00174 
00175     wire_number_x = 0.;
00176     wire_number_x = (double)*(raw+i);
00177 
00178     wire_number_y = 0.;
00179     wire_number_y = (double)*(raw+i+1);
00180 
00181     timestamp = 0.;
00182     timestamp = (double)*(raw+i+2);
00183 
00184     if (wire_number_y>1 && (wire_number_y<22)) hDQ_MuPC_XvsY_ExclHotWires->Fill(wire_number_x,wire_number_y);
00185 
00186     hDQ_MuPC_XvsY_Total->Fill(wire_number_x,wire_number_y);
00187     hDQ_MuPC_XvsY_Fraction->Fill(wire_number_x,wire_number_y);
00188     hDQ_MuPC_XvsT->Fill(timestamp,wire_number_x);
00189     hDQ_MuPC_YvsT->Fill(timestamp,wire_number_y);
00190 
00191     //printf("index %d out of %d, x wire %f y wire %f tstamp %f\n",i,bankSize,wire_number_x,wire_number_y,timestamp);
00192 
00193     n_total_clusters++;
00194 
00195   }
00196 
00197   return SUCCESS;
00198 }

INT MDQ_MuPC_BOR ( INT  run_number  ) 

This method executes at the start of each run

Definition at line 147 of file MDQ_MuPC.cpp.

00148 {
00149   //n_total_midas_events = 1;
00150   
00151   return SUCCESS;
00152 }

INT MDQ_MuPC_EOR ( INT  run_number  ) 

Definition at line 200 of file MDQ_MuPC.cpp.

References hDQ_MuPC_XvsY_Fraction, and n_total_clusters.

00201 {
00202 
00203   hDQ_MuPC_XvsY_Fraction->Scale(1.0 / (double)n_total_clusters);
00204 
00205   return SUCCESS;
00206 }

INT MDQ_MuPC_init (  ) 

This method initializes histograms.

Definition at line 68 of file MDQ_MuPC.cpp.

References hDB, hDQ_MuPC_XvsT, hDQ_MuPC_XvsY_ExclHotWires, hDQ_MuPC_XvsY_Fraction, hDQ_MuPC_XvsY_Total, and hDQ_MuPC_YvsT.

00069 {
00070   // See if the DataQuality_LowLevel/ directory already exists
00071   if (!gDirectory->Cd("DataQuality_LowLevel")) {
00072     
00073     std::string dir_name("DataQuality_LowLevel/");
00074     gDirectory->mkdir(dir_name.c_str());
00075     gDirectory->Cd(dir_name.c_str());
00076   }
00077 
00078   // Get run number
00079   char key_name[80];
00080   int size,run_number;
00081   sprintf(key_name, "Runinfo/Run number");
00082   size=sizeof(int);
00083   db_get_value(hDB,0,key_name, &run_number, &size, TID_INT,1);
00084 
00085   // Create the histograms
00086   hDQ_MuPC_XvsT = new TH2F(
00087     "hDQ_MuPC_XvsT",
00088     Form("X wire vs MIDAS block time, run %d",run_number),
00089     1000,-10000000, 120000000, 24, 0.5, (24+0.5));
00090 
00091   //hDQ_MuPC_XvsT->SetBit(TH1::kCanRebin);
00092   hDQ_MuPC_XvsT->GetXaxis()->SetTitle("time (ns)");
00093   hDQ_MuPC_XvsT->GetXaxis()->CenterTitle(1);
00094   hDQ_MuPC_XvsT->GetYaxis()->SetTitle("X wire hit");
00095   hDQ_MuPC_XvsT->GetYaxis()->CenterTitle(1);
00096 
00097   hDQ_MuPC_YvsT = new TH2F(
00098     "hDQ_MuPC_YvsT",
00099     Form("X wire vs MIDAS block time, run %d",run_number),
00100     1000,-10000000, 120000000, 24, 0.5, (24+0.5));
00101 
00102   //hDQ_MuPC_YvsT->SetBit(TH1::kCanRebin);
00103   hDQ_MuPC_YvsT->GetXaxis()->SetTitle("time (ns)");
00104   hDQ_MuPC_YvsT->GetXaxis()->CenterTitle(1);
00105   hDQ_MuPC_YvsT->GetYaxis()->SetTitle("Y wire hit");
00106   hDQ_MuPC_YvsT->GetYaxis()->CenterTitle(1);
00107  
00108   hDQ_MuPC_XvsY_Total = new TH2F(
00109     "hDQ_MuPC_XvsY_Total",
00110     Form("X wire vs Y wire, each cluster and run %d",run_number),
00111     24, 0.5, (24+0.5), 24, 0.5, (24+0.5));
00112 
00113   hDQ_MuPC_XvsY_Total->GetXaxis()->SetTitle("X wire hit");
00114   hDQ_MuPC_XvsY_Total->GetXaxis()->CenterTitle(1);
00115   hDQ_MuPC_XvsY_Total->GetYaxis()->SetTitle("Y wire hit");
00116   hDQ_MuPC_XvsY_Total->GetYaxis()->CenterTitle(1);
00117 
00118   hDQ_MuPC_XvsY_ExclHotWires = new TH2F(
00119     "hDQ_MuPC_XvsY_ExclHotWires",
00120     Form("X wire vs Y wire, each cluster and run %d",run_number),
00121     24, 0.5, (24+0.5), 24, 0.5, (24+0.5));
00122 
00123   hDQ_MuPC_XvsY_ExclHotWires->GetXaxis()->SetTitle("X wire hit");
00124   hDQ_MuPC_XvsY_ExclHotWires->GetXaxis()->CenterTitle(1);
00125   hDQ_MuPC_XvsY_ExclHotWires->GetYaxis()->SetTitle("Y wire hit");
00126   hDQ_MuPC_XvsY_ExclHotWires->GetYaxis()->CenterTitle(1);
00127 
00128   hDQ_MuPC_XvsY_Fraction = new TH2F(
00129     "hDQ_MuPC_XvsY_Fraction",
00130     Form("Fraction of cluster position in X wire vs Y wire, run %d",run_number),
00131     24, 0.5, (24+0.5), 24, 0.5, (24+0.5));
00132 
00133   //hDQ_MuPC_XvsY_Fraction->SetBit(TH1::kCanRebin);
00134   hDQ_MuPC_XvsY_Fraction->GetXaxis()->SetTitle("X wire hit");
00135   hDQ_MuPC_XvsY_Fraction->GetXaxis()->CenterTitle(1);
00136   hDQ_MuPC_XvsY_Fraction->GetYaxis()->SetTitle("Y wire hit");
00137   hDQ_MuPC_XvsY_Fraction->GetYaxis()->CenterTitle(1);
00138 
00139   gDirectory->Cd("/MidasHists/");
00140 
00141   return SUCCESS;
00142 }


Variable Documentation

HNDLE hDB
TH2* hDQ_MuPC_XvsT [static]

Definition at line 45 of file MDQ_MuPC.cpp.

Referenced by MDQ_MuPC(), and MDQ_MuPC_init().

Definition at line 48 of file MDQ_MuPC.cpp.

Referenced by MDQ_MuPC(), and MDQ_MuPC_init().

TH2* hDQ_MuPC_XvsY_Fraction [static]

Definition at line 49 of file MDQ_MuPC.cpp.

Referenced by MDQ_MuPC(), MDQ_MuPC_EOR(), and MDQ_MuPC_init().

TH2* hDQ_MuPC_XvsY_Total [static]

Definition at line 47 of file MDQ_MuPC.cpp.

Referenced by MDQ_MuPC(), and MDQ_MuPC_init().

TH2* hDQ_MuPC_YvsT [static]

Definition at line 46 of file MDQ_MuPC.cpp.

Referenced by MDQ_MuPC(), and MDQ_MuPC_init().

ANA_MODULE MDQ_MuPC_module
Initial value:
{
  "MDQ_MuPC",        
  "Joe Grange",              
  MDQ_MuPC,          
  MDQ_MuPC_BOR,      
  MDQ_MuPC_EOR,      
  MDQ_MuPC_init,     
  NULL,                          
  NULL,                          
  0,                             
  NULL,                          
}

Definition at line 52 of file MDQ_MuPC.cpp.

int n_total_clusters [static]

Definition at line 50 of file MDQ_MuPC.cpp.

Referenced by MDQ_MuPC(), and MDQ_MuPC_EOR().


Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1