NCDataQualityModule Class Reference

Job module to extract and combine DQ plots from uDSTs. More...

#include <NCDataQualityModule.h>

Inheritance diagram for NCDataQualityModule:
JobCModule

List of all members.

Public Member Functions

 NCDataQualityModule ()
 ~NCDataQualityModule ()
virtual const RegistryDefaultConfig () const
virtual void Config (const Registry &r)
virtual void EndJob ()

Protected Member Functions

void FindUncertainty (double value, double &uncertaintyLow, double &uncertaintyHigh)
void CombineDataQualityPlots (Detector::Detector_t det, unsigned int datamc)
void DrawDataQualityPlots ()
void DrawNearDataQualityPlots ()
void DrawFarDataQualityPlots ()
void SetPOTValues ()
void DrawStabilityPlots (Detector::Detector_t detector)
void DrawEventRatePlots (Detector::Detector_t detector)
void DrawVertexPlots (Detector::Detector_t detector, std::vector< double > &x, std::vector< double > &y)
void DrawFarTimingPlots ()
void DrawNearSpectra (std::vector< NCDataQualityPlot * > &spectra, TString nccc)
void DrawNearEventsPerPOT ()
TString GetFileTypeString (Detector::Detector_t det, unsigned int datamc)
void MarkPrelim (double x, double y)
NCDataQualityPlotGetDQPlot (unsigned int dist, unsigned int nccc, unsigned int datamc, Detector::Detector_t det, unsigned int intensity=kDQNominalIntensity)
NCDataQualityPlotCreateDQPlot (unsigned int dist, unsigned int nccc, unsigned int datamc, Detector::Detector_t det, unsigned int intensity)
void GetNDSectionGraphs (Detector::Detector_t det, int datamc, std::map< int, TGraphErrors * > &spectra, std::map< int, TGraphErrors * > &ratios)
void FillDoubleRatios (std::map< int, TGraphErrors * > &nums, std::map< int, TGraphErrors * > &denoms, std::map< int, TGraphErrors * > &dblratios)
void DrawStabilityPlot (Detector::Detector_t det, TString longName, std::map< int, TGraphErrors * > &spectra, std::map< int, TGraphErrors * > &spectraMC, std::map< int, TGraphErrors * > &dblratios, int minplot, int maxplot, std::map< int, TString > &names)

Protected Attributes

NCDataQualityPlotfDQPlots [kDQNumCombinations]
 This is the the array that GetDQPlot looks in.
TString fDataMCPath
 path to uDST for data and MC files
std::vector< BeamType::BeamType_tfBeamIndex
std::vector
< NC::RunUtil::ERunType
fRunsToUse
 <index of beams to use
std::vector< double > fMonthlyNDPOT
bool fUseMCAsData
 use the MC as data for testing purposes
bool fUseMockData
 are you using mock data for the data?
TString fMockDataSet
 MDC run number designation.
double fNearPOTTotal
 total exposure in near detector data
double fFarPOTTotal
 total exposure in far detector data
int fNMCFilesNear
 Number of near MC uDSTs used.
int fNMCFilesFar
 Number of far MC uDSTs used.
bool fUseCC
bool fUseNC
int fFileLimitNearData
int fFileLimitFarData
int fFileLimitNearMC
int fFileLimitFarMC
int fMockDataSubRun
bool fScaleNearExposures
double fFarExposureScaleVal
TString fFileName
std::vector< double > fFarVtxX
std::vector< double > fFarVtxY
std::vector< double > fFarVtxXNC
std::vector< double > fFarVtxYNC
std::vector< double > fNearVtxX
std::vector< double > fNearVtxY
std::vector
< NCDataQualityPlot2D * > 
fDQNearData2DTotal
std::vector
< NCDataQualityPlot2D * > 
fDQNearData2DCC
std::vector
< NCDataQualityPlot2D * > 
fDQNearData2DNC
std::vector< NCDataQualityPlot * > fMonthlySpectraNDNC
std::vector< NCDataQualityPlot * > fMonthlySpectraNDCC

Private Member Functions

NCDataQualityModuleoperator= (const NCDataQualityModule &)
 NCDataQualityModule (const NCDataQualityModule &)

Detailed Description

Job module to extract and combine DQ plots from uDSTs.

Definition at line 30 of file NCDataQualityModule.h.


Constructor & Destructor Documentation

NCDataQualityModule::NCDataQualityModule (  ) 

Definition at line 45 of file NCDataQualityModule.cxx.

References fDQNearData2DCC, fDQNearData2DNC, fDQNearData2DTotal, fDQPlots, kDQ2DNumDists, kDQNumCombinations, and n.

00045                                         :
00046   fNearPOTTotal(-1), fFarPOTTotal(-1),
00047   fNMCFilesNear(0), fNMCFilesFar(0)
00048 
00049 {
00050   for(int n = 0; n < kDQNumCombinations; ++n) fDQPlots[n] = 0;
00051 
00052   for(int k = 0; k < kDQ2DNumDists; ++k){
00053     fDQNearData2DTotal.push_back(new NCDataQualityPlot2D(k, "NearDataTotal"));
00054     fDQNearData2DNC.push_back(new NCDataQualityPlot2D(k, "NearDataNC"));
00055     fDQNearData2DCC.push_back(new NCDataQualityPlot2D(k, "NearDataCC"));
00056   }
00057 }

NCDataQualityModule::~NCDataQualityModule (  ) 

Definition at line 59 of file NCDataQualityModule.cxx.

References fDQPlots, kDQNumCombinations, and n.

00060 {
00061   for(int n = 0; n < kDQNumCombinations; ++n)
00062     if(fDQPlots[n]) delete fDQPlots[n];
00063 }

NCDataQualityModule::NCDataQualityModule ( const NCDataQualityModule  )  [private]

Member Function Documentation

void NCDataQualityModule::CombineDataQualityPlots ( Detector::Detector_t  det,
unsigned int  datamc 
) [protected]

Definition at line 274 of file NCDataQualityModule.cxx.

References NCDataQualityPlot::Add(), bfld::AsString(), fBeamIndex, fDataMCPath, fDQNearData2DCC, fDQNearData2DNC, fDQNearData2DTotal, fFarVtxX, fFarVtxY, files, NC::RunUtil::FindRunType(), fMonthlyNDPOT, fMonthlySpectraNDCC, fMonthlySpectraNDNC, fNearVtxX, fNearVtxY, fNMCFilesFar, fNMCFilesNear, fRunsToUse, GetDQPlot(), GetFileTypeString(), kDQ2DNumDists, kDQCC, kDQEnergy, kDQLowIntensity, kDQMC, kDQMCOsc, kDQNC, kDQNominalIntensity, kDQNumDists, kDQTotal, kDQVars, kDQVars2D, Detector::kFar, Msg::kInfo, Detector::kNear, MSG, n, DQDef2D::name, and DQDef::name.

Referenced by EndJob().

00276 {
00277   // Need a special suffix for oscillated MC
00278   TString suffix = (datamc == kDQMCOsc) ? "Osc" : "";
00279 
00280   static bool firstTimeNear=true;
00281   static bool firstTimeFar=true;
00282 
00283   TString fileType = GetFileTypeString(det, datamc);
00284 
00285   MSG("NCDataQualityModule", Msg::kInfo) << "fDataMCPath = " << fDataMCPath << endl;
00286 
00287   TString detName = (det == Detector::kFar) ? "far" : "near";
00288 
00289   TString totalName = "MCTotal"+suffix;
00290   TString ncName = "MCNC"+suffix;
00291   TString ccName = "MCCC"+suffix;
00292   TString name = "";
00293 
00294   //Now loop over the BeamType::AsString values and fill the
00295   //data and mc chains
00296   typedef std::vector<BeamType::BeamType_t>::iterator it_t;
00297   for(it_t beamIter = fBeamIndex.begin(); beamIter != fBeamIndex.end(); ++beamIter){
00298     BeamType::BeamType_t bType = *beamIter;
00299     TString beamType = BeamType::AsString(bType);
00300 
00301     //the files for different beam configurations are in uDST/LXXXzYYYi
00302     //directories.  that is directories named for the beam type
00303     TSystemDirectory dataDir(beamType, fDataMCPath+beamType+"/");
00304 
00305     MSG("NCDataQualityModule", Msg::kInfo) << "Adding DQ plots from "
00306                                             << (fDataMCPath+beamType)
00307                                             << endl;
00308 
00309     TList* files = dataDir.GetListOfFiles();
00310     assert(files);
00311 
00312     //Loop over files in dataDir
00313     for(int de = 0; de < files->GetEntries(); ++de) {
00314       //Do nothing for "." and ".." entries
00315       TString fileName = files->At(de)->GetName();
00316       if(fileName == "." || fileName == "..") continue;
00317 
00318       if(fileName.Contains(beamType)
00319          && fileName.Contains("strip")
00320          && fileName.Contains(detName)
00321          && fileName.Contains(fileType)){
00322 
00323         if (datamc==kDQMC) {
00324           if (det==Detector::kNear && firstTimeNear) ++fNMCFilesNear;
00325           if (det==Detector::kFar && firstTimeFar) ++fNMCFilesFar;
00326         }
00327         TFile tf(fileName);
00328 
00329         const NC::RunUtil::ERunType runType = NC::RunUtil::FindRunType(fileName);
00330         if(fileType.Contains("data") || fileType.Contains("blind")){
00331           totalName = "DataTotal";
00332           ncName = "DataNC";
00333           ccName = "DataCC";
00334 
00335           bool inRunsToUse = false;
00336           for(unsigned int n = 0; n < fRunsToUse.size(); ++n)
00337             if(fRunsToUse[n] == runType) inRunsToUse = true;
00338           if(!inRunsToUse) continue;
00339 
00340           TGraph* graph = (TGraph*)(tf.Get("DataQuality/vertexXY"));
00341           if(det == Detector::kFar && graph){
00342             for(int p = 0; p < graph->GetN(); ++p){
00343               double x, y;
00344               graph->GetPoint(p, x, y);
00345               fFarVtxX.push_back(x);
00346               fFarVtxY.push_back(y);
00347             }
00348           }
00349           if(det == Detector::kNear && graph){
00350             for(int p = 0; p < graph->GetN(); ++p){
00351               double x, y;
00352               graph->GetPoint(p, x, y);
00353               fNearVtxX.push_back(x);
00354               fNearVtxY.push_back(y);
00355             }
00356           }
00357           for(int i = 0; i < kDQ2DNumDists && det == Detector::kNear; ++i){
00358             NCDataQualityPlot2D* hist2D;
00359             hist2D = (NCDataQualityPlot2D*)(tf.Get("DataQuality/"+kDQVars2D[i].name+totalName));
00360             fDQNearData2DTotal[i]->Add(hist2D);
00361             hist2D = (NCDataQualityPlot2D*)(tf.Get("DataQuality/"+kDQVars2D[i].name+ncName));
00362             fDQNearData2DNC[i]->Add(hist2D);
00363             hist2D = (NCDataQualityPlot2D*)(tf.Get("DataQuality/"+kDQVars2D[i].name+ccName));
00364             fDQNearData2DCC[i]->Add(hist2D);
00365           }
00366         }//end if data
00367 
00368         MSG("NCDataQualityModule", Msg::kInfo) << "  " << fileName
00369                                                 << " -> " << totalName << " "
00370                                                 << ncName << " " << ccName << endl;
00371 
00372         //get each histogram out of the file and add it to the total
00373         for(int i = 0; i < kDQNumDists; ++i){
00374           NCDataQualityPlot* hist;
00375 
00376           hist = (NCDataQualityPlot*)(tf.Get("DataQuality/"+kDQVars[i].name+totalName));
00377           GetDQPlot(i, kDQTotal, datamc, det, kDQNominalIntensity)->Add(hist);
00378           hist = (NCDataQualityPlot*)(tf.Get("DataQuality/"+kDQVars[i].name+ncName));
00379           GetDQPlot(i, kDQNC, datamc, det, kDQNominalIntensity)->Add(hist);
00380           hist = (NCDataQualityPlot*)(tf.Get("DataQuality/"+kDQVars[i].name+ccName));
00381           GetDQPlot(i, kDQCC, datamc, det, kDQNominalIntensity)->Add(hist);
00382 
00383           if( fileType.Contains("data") || fileType.Contains("blind") ){
00384             hist = (NCDataQualityPlot*)(tf.Get("LowIntensity/"+kDQVars[i].name+totalName+"LowIntensity"));
00385             GetDQPlot(i, kDQTotal, datamc, det, kDQLowIntensity)->Add(hist);
00386             hist = (NCDataQualityPlot*)(tf.Get("LowIntensity/"+kDQVars[i].name+ncName+"LowIntensity"));
00387             GetDQPlot(i, kDQNC, datamc, det, kDQLowIntensity)->Add(hist);
00388             hist = (NCDataQualityPlot*)(tf.Get("LowIntensity/"+kDQVars[i].name+ccName+"LowIntensity"));
00389             GetDQPlot(i, kDQCC, datamc, det, kDQLowIntensity)->Add(hist);
00390           }
00391 
00392           if(i == kDQEnergy
00393              && det == Detector::kNear
00394              && fileName.Contains("data")){
00395             hist = (NCDataQualityPlot*)(tf.Get("DataQuality/"+kDQVars[i].name+ncName));
00396             hist->SetDirectory(0);
00397             name = fileName;
00398             name.Remove(0, 20);
00399             name.Remove(7, 17);
00400             fMonthlySpectraNDNC.push_back(hist);
00401             fMonthlySpectraNDNC[fMonthlySpectraNDNC.size()-1]->SetName(name+"NC");
00402             //scale the histogram to 1e19 POT
00403             const double pot = ((TH1F*)tf.Get("dataPOT"))->Integral();
00404             fMonthlyNDPOT.push_back(pot);
00405             MSG("NCDataQualityModule", Msg::kInfo) << "  " << pot << " POT added to " << name << endl;
00406 
00407             hist = (NCDataQualityPlot*)(tf.Get("DataQuality/"+kDQVars[i].name+ccName));
00408             hist->SetDirectory(0);
00409             name = fileName;
00410             name.Remove(0, 20);
00411             name.Remove(7, 17);
00412             fMonthlySpectraNDCC.push_back(hist);
00413           }//end if ND data
00414 
00415         }
00416       }//end if the right detector and beam type
00417     }//end loop over files in directory
00418     delete files;
00419   }//end loop over beam index vector
00420 
00421   if (datamc==kDQMC && det==Detector::kNear) firstTimeNear=false;
00422   if (datamc==kDQMC && det==Detector::kFar)  firstTimeFar=false;
00423 }

void NCDataQualityModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 99 of file NCDataQualityModule.cxx.

References NCType::BeamListFromString(), fBeamIndex, fDataMCPath, fFileLimitFarData, fFileLimitFarMC, fFileLimitNearData, fFileLimitNearMC, fFileName, fMockDataSet, fMockDataSubRun, fRunsToUse, fScaleNearExposures, fUseCC, fUseMCAsData, fUseMockData, fUseNC, Registry::Get(), gSystem(), n, and NC::Utility::ParseNumberList().

00100 {
00101   int         tmpb;
00102   int         tmpi;
00103   const char* tmps;
00104 
00105   if (r.Get("DataMCPath",            tmps)){
00106     //for some reason the TSystemDirectory constructor cant resolve
00107     //environmental variables, so just take care of it here
00108     int pos = 0;
00109     TString temp = tmps;
00110     if(temp.Contains("$")){
00111       pos = temp.Index("/");
00112       temp.Resize(pos);
00113       temp.Remove(TString::kLeading, '$');
00114       fDataMCPath                  = tmps;
00115       fDataMCPath.Replace(0, pos, gSystem->Getenv(temp));
00116     }
00117     else fDataMCPath = temp;
00118   }
00119 
00120   if(r.Get("UseMCAsData",           tmpb)) fUseMCAsData         = tmpb;
00121   if(r.Get("UseCCEvents",           tmpb)) fUseCC               = tmpb;
00122   if(r.Get("UseNCEvents",           tmpb)) fUseNC               = tmpb;
00123   if(r.Get("UseMockData",           tmpb)) fUseMockData         = tmpb;
00124   if(r.Get("MockDataSet",           tmps)) fMockDataSet         = tmps;
00125 
00126   if(r.Get("RunsToUse",             tmps)){
00127     fRunsToUse.clear();
00128     vector<int> runs = NC::Utility::ParseNumberList(tmps);
00129     for(unsigned int n = 0; n < runs.size(); ++n)
00130       fRunsToUse.push_back(NC::RunUtil::ERunType(runs[n]));
00131   }
00132 
00133   if(r.Get("FileLimitNearData",     tmpi)) fFileLimitNearData   = tmpi;
00134   if(r.Get("FileLimitFarData",      tmpi)) fFileLimitFarData    = tmpi;
00135   if(r.Get("FileLimitNearMC",       tmpi)) fFileLimitNearMC     = tmpi;
00136   if(r.Get("FileLimitFarMC",        tmpi)) fFileLimitFarMC      = tmpi;
00137   if(r.Get("MockDataSubRun",        tmpi)) fMockDataSubRun      = tmpi;
00138   if(r.Get("ScaleNearExposures",    tmpb)) fScaleNearExposures  = tmpb;
00139   if(r.Get("FileName",              tmps)) fFileName            = tmps;
00140 
00141   if (r.Get("BeamType",              tmps))
00142     fBeamIndex = NCType::BeamListFromString(tmps);
00143 }

NCDataQualityPlot * NCDataQualityModule::CreateDQPlot ( unsigned int  dist,
unsigned int  nccc,
unsigned int  datamc,
Detector::Detector_t  det,
unsigned int  intensity 
) [protected]

Definition at line 252 of file NCDataQualityModule.cxx.

References bfld::AsString(), kDQCC, kDQData, kDQLowIntensity, kDQMCOsc, kDQNC, and kDQTotal.

Referenced by GetDQPlot().

00257 {
00258   TString suffix = Detector::AsString(det);
00259   suffix += (datamc == kDQData) ? "Data" : "MC";
00260   if(nccc == kDQNC) suffix += "NC";
00261   if(nccc == kDQCC) suffix += "CC";
00262   if(nccc == kDQTotal) suffix += "Total";
00263 
00264   if(intense == kDQLowIntensity) suffix += "LowIntensity";
00265   if(datamc == kDQMCOsc) suffix += "Osc";
00266 
00267   NCDataQualityPlot* ret = new NCDataQualityPlot(dist, suffix);
00268   // Otherwise we end up owned by someone who goes out of scope -> bad things
00269   ret->SetDirectory(0);
00270   return ret;
00271 }

const Registry & NCDataQualityModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 66 of file NCDataQualityModule.cxx.

References Plot::Format(), NC::RunUtil::kMaxRun, Registry::LockValues(), n, Registry::Set(), and Registry::UnLockValues().

00067 {
00068   static Registry r;
00069 
00070   r.UnLockValues();
00071 
00072   r.Set("DataMCPath",          "dataFiles/*.root");
00073   r.Set("UseMCAsData",         false);
00074   r.Set("UseCCEvents",         true);
00075   r.Set("UseNCEvents",         true);
00076   r.Set("UseMockData",         false);
00077   r.Set("MockDataSet",         "F21910001");
00078 
00079   TString runsToUse;
00080   for(int n = 0; n <= NC::RunUtil::kMaxRun; ++n)
00081     runsToUse += TString::Format("%d ", n);
00082   r.Set("RunsToUse",              runsToUse);
00083 
00084   r.Set("BeamType",            "L010z185i");
00085   r.Set("FileLimitNearData",   1000000000);
00086   r.Set("FileLimitFarData",    10000);
00087   r.Set("FileLimitNearMC",     1000000000);
00088   r.Set("FileLimitFarMC",      10000);
00089   r.Set("MockDataSubRun",      0);
00090   r.Set("ScaleNearExposures",  false);
00091   r.Set("FileName",            "dqplots.root");
00092 
00093   r.LockValues();
00094   return r;
00095 }

void NCDataQualityModule::DrawDataQualityPlots (  )  [protected]

Definition at line 170 of file NCDataQualityModule.cxx.

References DrawFarDataQualityPlots(), and DrawNearDataQualityPlots().

Referenced by EndJob().

00171 {
00172   // get a pointer to the current directory
00173   // this is one of the output files
00174   TDirectory* saveDir = gDirectory;
00175 
00176   //loop over the data quality histograms
00177   //make folders for data/mc and subfolders for near/far
00178   TDirectory* dir = saveDir->mkdir("DataQuality", "DataQuality");
00179   dir->cd();
00180 
00181   TDirectory* near = dir->mkdir("NearDetector", "NearDetector");
00182   TDirectory* far = dir->mkdir("FarDetector", "FarDetector");
00183 
00184   near->cd();
00185   DrawNearDataQualityPlots();
00186 
00187   far->cd();
00188   DrawFarDataQualityPlots();
00189 
00190   saveDir->cd();
00191 }

void NCDataQualityModule::DrawEventRatePlots ( Detector::Detector_t  detector  )  [protected]

Definition at line 1320 of file NCDataQualityModule.cxx.

References bfld::AsString(), MuELoss::e, FindUncertainty(), GetDQPlot(), kDQCC, kDQData, kDQEventsVsTime, kDQNC, kDQPOTVsTime, kDQTotal, Detector::kFar, and MarkPrelim().

Referenced by DrawFarDataQualityPlots(), and DrawNearDataQualityPlots().

01321 {
01322   TString detstr = Detector::AsString(det);
01323 
01324   //make event rate vs time plot
01325   vector<double> date;
01326   vector<double> dateCC;
01327   vector<double> dateNC;
01328   vector<double> pot;
01329   vector<double> tot;
01330   vector<double> nc;
01331   vector<double> cc;
01332   vector<double> rateTot;
01333   vector<double> rateNC;
01334   vector<double> rateCC;
01335 
01336   NCDataQualityPlot* potHist = GetDQPlot(kDQPOTVsTime, kDQTotal, kDQData, det);
01337 
01338   TH1F *forceAxis = new TH1F("forceAxis", ";;Events/10^{18} POT",
01339                              potHist->GetNbinsX(),
01340                              potHist->GetXaxis()->GetXmin(),
01341                              potHist->GetXaxis()->GetXmax());
01342   forceAxis->GetYaxis()->CenterTitle();
01343 
01344   TH1F *sumPOT = new TH1F("sumPOT", "",
01345                           potHist->GetNbinsX(),
01346                           potHist->GetXaxis()->GetXmin(),
01347                           potHist->GetXaxis()->GetXmax());
01348   TH1F *sumTot = new TH1F("sumTot", "",
01349                           potHist->GetNbinsX(),
01350                           potHist->GetXaxis()->GetXmin(),
01351                           potHist->GetXaxis()->GetXmax());
01352   TH1F *sumNC = new TH1F("sumNC", "",
01353                           potHist->GetNbinsX(),
01354                           potHist->GetXaxis()->GetXmin(),
01355                           potHist->GetXaxis()->GetXmax());
01356   TH1F *sumCC = new TH1F("sumCC", "",
01357                          potHist->GetNbinsX(),
01358                          potHist->GetXaxis()->GetXmin(),
01359                          potHist->GetXaxis()->GetXmax());
01360   /*
01361   TH1F *shutDown = new TH1F("shutDown", "",
01362                             potHist->GetNbinsX(),
01363                             potHist->GetXaxis()->GetXmin(),
01364                             potHist->GetXaxis()->GetXmax());
01365   TH1F *shutDownRate = new TH1F("shutDownRate", "",
01366                                 potHist->GetNbinsX(),
01367                                 potHist->GetXaxis()->GetXmin(),
01368                                 potHist->GetXaxis()->GetXmax());
01369   */
01370 
01371   for(int i = 0; i < potHist->GetNbinsX(); ++i){
01372     sumPOT->GetXaxis()->SetBinLabel(i+1, potHist->GetXaxis()->GetBinLabel(i+1));
01373     sumTot->GetXaxis()->SetBinLabel(i+1, potHist->GetXaxis()->GetBinLabel(i+1));
01374     sumNC->GetXaxis()->SetBinLabel(i+1, potHist->GetXaxis()->GetBinLabel(i+1));
01375     sumCC->GetXaxis()->SetBinLabel(i+1, potHist->GetXaxis()->GetBinLabel(i+1));
01376     forceAxis->GetXaxis()->SetBinLabel(i+1, potHist->GetXaxis()->GetBinLabel(i+1));
01377 
01378     if(potHist->GetBinContent(i+1) > 0.){
01379       date.push_back(potHist->GetBinCenter(i+1));
01380       dateCC.push_back(0.1+potHist->GetBinCenter(i+1));
01381       dateNC.push_back(-0.1+potHist->GetBinCenter(i+1));
01382       pot.push_back(1.e-6*potHist->GetBinContent(i+1));
01383       tot.push_back(GetDQPlot(kDQEventsVsTime, kDQTotal, kDQData, det)->GetBinContent(i+1));
01384       nc.push_back(GetDQPlot(kDQEventsVsTime, kDQNC, kDQData, det)->GetBinContent(i+1));
01385       cc.push_back(GetDQPlot(kDQEventsVsTime, kDQCC, kDQData, det)->GetBinContent(i+1));
01386 
01387       //fix June 2005 count by hand
01388       if(i == 1 && det == Detector::kFar) pot[pot.size()-1] += 2.56;
01389 
01390       rateTot.push_back(tot[tot.size()-1]/pot[pot.size()-1]);
01391       rateNC.push_back(nc[nc.size()-1]/pot[pot.size()-1]);
01392       rateCC.push_back(cc[cc.size()-1]/pot[pot.size()-1]);
01393 
01394       for(int j = i; j < potHist->GetNbinsX(); ++j){
01395         sumPOT->Fill(j+0.5, pot[pot.size()-1]);
01396         sumTot->Fill(j+0.5, tot[pot.size()-1]);
01397         sumNC->Fill(j+0.5, nc[pot.size()-1]);
01398         sumCC->Fill(j+0.5, cc[pot.size()-1]);
01399       }
01400 
01401     }//end if pot in the month
01402     else{
01403       sumPOT->SetBinContent(i+1, sumPOT->GetBinContent(i));
01404       sumTot->SetBinContent(i+1, sumTot->GetBinContent(i));
01405       sumNC->SetBinContent(i+1, sumNC->GetBinContent(i));
01406       sumCC->SetBinContent(i+1, sumCC->GetBinContent(i));
01407     }
01408   }
01409 
01410   //make graphs of the rates
01411   TGraphAsymmErrors *totGr = new TGraphAsymmErrors(rateTot.size(), &date[0], &rateTot[0]);
01412   TGraphAsymmErrors *ncGr = new TGraphAsymmErrors(rateNC.size(), &dateNC[0], &rateNC[0]);
01413   TGraphAsymmErrors *ccGr = new TGraphAsymmErrors(rateCC.size(), &dateCC[0], &rateCC[0]);
01414 
01415 //   TF1 *mean = new TF1("mean"+detector, "pol0");
01416 //   ncGr->Fit(mean, "Q0");
01417 //   TLine *meanLine = new TLine(date[0], mean->GetParameter(0), date[rateNC.size()-1], mean->GetParameter(0));
01418 //   meanLine->SetLineColor(2);
01419 //   meanLine->SetLineWidth(2);
01420 
01421   totGr->SetName("totGr");
01422   ncGr->SetName("ncGr");
01423   ccGr->SetName("ccGr");
01424 
01425   //set the errors for the rates
01426   for (unsigned int i = 0; i < rateTot.size(); ++i){
01427     double low, high;
01428 
01429     FindUncertainty(tot[i], low, high);
01430     if(tot[i] > 0) totGr->SetPointError(i, 0, 0, low/pot[i], high/pot[i]);
01431 
01432     FindUncertainty(nc[i], low, high);
01433     if(nc[i] > 0) ncGr->SetPointError(i, 0, 0, low/pot[i], high/pot[i]);
01434 
01435     FindUncertainty(cc[i], low, high);
01436     if(cc[i] > 0) ccGr->SetPointError(i, 0, 0, low/pot[i], high/pot[i]);
01437   }
01438 
01439   TLatex *latex = new TLatex();
01440   latex->SetName("ShutDown");
01441   latex->SetTextSize(0.05);
01442   latex->SetTextColor(4);
01443 
01444   // Box to draw shaded region for shutdown
01445   const int startShutdown=10, endShutdown=16;
01446   TBox* shutdownBox=new TBox;
01447   shutdownBox->SetLineWidth(0);
01448   shutdownBox->SetFillColor(15);
01449   shutdownBox->SetFillStyle(3005);
01450   // Line for start of shutdown
01451   TLine* shutdownLine1=new TLine;
01452   TLine* shutdownLine2=new TLine;
01453   shutdownLine1->SetLineWidth(2);
01454   shutdownLine1->SetLineColor(15);
01455   shutdownLine2->SetLineWidth(2);
01456   shutdownLine2->SetLineColor(15);
01457 
01458   TCanvas *canv = new TCanvas(detstr+"RateCanv", "farRateCanv");
01459   forceAxis->SetMaximum(3.);
01460   forceAxis->GetXaxis()->LabelsOption("v");
01461   forceAxis->Draw();
01462   canv->Update();
01463   cout << "rate plot: ymax=" << gPad->GetUymax() << endl;
01464   shutdownBox->DrawBox(startShutdown, 0, endShutdown, gPad->GetUymax());
01465   shutdownLine1->DrawLine(startShutdown, 0, startShutdown, gPad->GetUymax());
01466   shutdownLine2->DrawLine(endShutdown, 0, endShutdown, gPad->GetUymax());
01467 
01468   //totGr->Draw("pe1same");
01469   ncGr->Draw("pe1same");
01470   //meanLine->Draw();
01471   //ccGr->Draw("pe1same");
01472   /*
01473   for(int i = 11; i < 17; ++i) shutDownRate->SetBinContent(i, 3.);
01474   shutDownRate->Draw("same");
01475   */
01476 
01477   latex->DrawLatex(11, forceAxis->GetMaximum()*0.5, "Shut Down");
01478 
01479   MarkPrelim(forceAxis->GetXaxis()->GetXmax()*0.1, forceAxis->GetMaximum()*0.8);
01480 
01481   TLegend *leg = new TLegend(0.5, 0.5, 0.8, 0.8);
01482   leg->SetBorderSize(0);
01483   leg->SetFillStyle(0);
01484   //leg->AddEntry(totGr, detector+" Detector Data", "p");
01485   leg->AddEntry(ncGr, "Far Detector NC Events", "lp");
01486   //leg->AddEntry(ccGr, "Charged Current Events", "p");
01487   leg->Draw();
01488 
01489   gDirectory->Append(canv);
01490 
01491   TCanvas *canv1 = new TCanvas(detstr + "SummedEvents", "Events");
01492   sumNC->GetYaxis()->SetRangeUser(0.1, 400);
01493   sumNC->GetYaxis()->SetLabelSize(0.);
01494   sumNC->GetYaxis()->SetTitleSize(0.);
01495   sumNC->GetYaxis()->SetTickLength(0.);
01496   sumNC->GetXaxis()->LabelsOption("v");
01497   // Draw it now to set the coord system for the shutdown objects
01498   sumNC->Draw();
01499   canv1->Update();
01500   /*
01501   for(int i = 11; i < 17; ++i) shutDown->SetBinContent(i, 400);
01502   shutDown->Draw("same");
01503   */
01504   cout << "summed plot: ymax=" << gPad->GetUymax() << endl;
01505   shutdownBox->DrawBox(startShutdown, 0, endShutdown, gPad->GetUymax());
01506   shutdownLine1->DrawLine(startShutdown, 0, startShutdown, gPad->GetUymax());
01507   shutdownLine2->DrawLine(endShutdown, 0, endShutdown, gPad->GetUymax());
01508 
01509   // Draw it again to make it appear on top of the shutdown objects
01510   sumNC->Draw("same");
01511   latex->DrawLatex(11, sumNC->GetMaximum()*0.5, "Shut Down");
01512 
01513   //sumTot->Draw("same");
01514   //sumCC->Draw("same");
01515 
01516   sumPOT->Scale(1.2);
01517   sumPOT->Draw("same");
01518   TGaxis *potAxis = new TGaxis(sumTot->GetXaxis()->GetXmax(), 0.,
01519                                sumTot->GetXaxis()->GetXmax(), 400,
01520                                // Yay for magic unexplained numbers
01521                                0., 3.33, 506, "+L");
01522   potAxis->SetTitle("POT (#times 10^{20})");
01523   potAxis->SetLabelSize(0.04);
01524   potAxis->SetLabelFont(42);
01525   potAxis->SetTitleFont(42);
01526   potAxis->SetTitleSize(0.055);
01527   potAxis->SetTitleOffset(0.65);
01528   potAxis->CenterTitle();
01529   potAxis->SetLineWidth(2);
01530   potAxis->SetLineColor(2);
01531   potAxis->SetTextColor(2);
01532   potAxis->SetLabelColor(2);
01533   potAxis->Draw();
01534 
01535   TGaxis *eventAxis = new TGaxis(sumTot->GetXaxis()->GetXmin(), 0.,
01536                                  sumTot->GetXaxis()->GetXmin(), 400,
01537                                  0., 400, 506, "");
01538   eventAxis->SetTitle("Events");
01539   eventAxis->SetLabelSize(0.04);
01540   eventAxis->SetLabelFont(42);
01541   eventAxis->SetTitleFont(42);
01542   eventAxis->SetTitleSize(0.055);
01543   eventAxis->SetTitleOffset(0.65);
01544   eventAxis->CenterTitle();
01545   eventAxis->SetLineWidth(2);
01546   eventAxis->Draw();
01547 
01548   MarkPrelim(sumNC->GetXaxis()->GetXmax()*0.1, sumNC->GetMaximum()*0.8);
01549 
01550   TLegend *leg2 = new TLegend(0.5, 0.5, 0.8, 0.8);
01551   leg2->SetBorderSize(0);
01552   leg2->SetFillStyle(0);
01553   leg2->AddEntry(sumPOT, "Protons on Target", "l");
01554   //leg2->AddEntry(sumTot, "Total "+detector+" Detector Events", "l");
01555   leg2->AddEntry(sumNC, detstr+" Detector NC Events", "l");
01556   //leg2->AddEntry(sumCC, "Charged Current Events", "l");
01557   leg2->Draw();
01558 
01559   gDirectory->Append(canv1);
01560 }

void NCDataQualityModule::DrawFarDataQualityPlots (  )  [protected]

Definition at line 470 of file NCDataQualityModule.cxx.

References DrawEventRatePlots(), DrawFarTimingPlots(), DrawVertexPlots(), fFarPOTTotal, fFarVtxX, fFarVtxY, fNMCFilesFar, fUseCC, fUseNC, GetDQPlot(), kDQCC, kDQData, kDQEventLength, kDQMC, kDQMCOsc, kDQNC, kDQNumDists, kDQNumTracks, kDQPulseHeight, kDQRadialSqrVtx, kDQTotal, kDQTotalStrips, kDQTrackExtension, Detector::kFar, Msg::kInfo, NCType::kPotMC, MarkPrelim(), and MSG.

Referenced by DrawDataQualityPlots().

00471 {
00472   MSG("NCDataQualityModule", Msg::kInfo) << "far pot - " << fFarPOTTotal
00473                                          << " in " << fNMCFilesFar << " MC uDSTs"
00474                                          << endl;
00475 
00476 
00477   for(int dist = 0; dist < kDQNumDists; ++dist){
00478     GetDQPlot(dist, kDQTotal, kDQData, Detector::kFar)->Write();
00479     GetDQPlot(dist, kDQCC, kDQData, Detector::kFar)->Write();
00480     GetDQPlot(dist, kDQNC, kDQData, Detector::kFar)->Write();
00481 
00482 //     fDQFarDataTotalLowIntensity[dist]->Write();
00483 //     fDQFarDataCCLowIntensity[dist]->Write();
00484 //     fDQFarDataNCLowIntensity[dist]->Write();
00485 
00486     double scaleFactor=fFarPOTTotal/(fNMCFilesFar*kPotMC);
00487     GetDQPlot(dist, kDQTotal, kDQMC, Detector::kFar)->Scale(scaleFactor);
00488     GetDQPlot(dist, kDQNC, kDQMC, Detector::kFar)->Scale(scaleFactor);
00489     GetDQPlot(dist, kDQCC, kDQMC, Detector::kFar)->Scale(scaleFactor);
00490 
00491     GetDQPlot(dist, kDQTotal, kDQMCOsc, Detector::kFar)->Scale(scaleFactor);
00492     GetDQPlot(dist, kDQNC, kDQMCOsc, Detector::kFar)->Scale(scaleFactor);
00493     GetDQPlot(dist, kDQCC, kDQMCOsc, Detector::kFar)->Scale(scaleFactor);
00494 
00495     GetDQPlot(dist, kDQTotal, kDQMC, Detector::kFar)->Write();
00496 //     GetDQPlot(dist, kDQCC, kDQMC, Detector::kFar)->Write();
00497 //     GetDQPlot(dist, kDQNC, kDQMC, Detector::kFar)->Write();
00498 
00499     GetDQPlot(dist, kDQTotal, kDQMCOsc, Detector::kFar)->Write();
00500 //     GetDQPlot(dist, kDQCC, kDQMCOsc, Detector::kFar)->Write();
00501     GetDQPlot(dist, kDQNC, kDQMCOsc, Detector::kFar)->Write();
00502 
00503     TString canvName = GetDQPlot(dist, kDQTotal, kDQData, Detector::kFar)->GetName();
00504     int index = canvName.Index("Data");
00505     canvName.Remove(index, 4);
00506     canvName += "Canv";
00507     TCanvas *canv = new TCanvas(canvName, canvName, 150, 10, 900, 600);
00508     TLegend *leg = new TLegend(0.75, 0.75, 0.95, 0.95);
00509     leg->SetBorderSize(0);
00510     leg->SetFillStyle(0);
00511 
00512     GetDQPlot(dist, kDQTotal, kDQData, Detector::kFar)->Draw("pe");
00513 
00514     GetDQPlot(dist, kDQTotal, kDQMC, Detector::kFar)->Draw("same ][");
00515     GetDQPlot(dist, kDQTotal, kDQMCOsc, Detector::kFar)->Draw("same ][");
00516 
00517     leg->AddEntry(GetDQPlot(dist, kDQTotal, kDQData, Detector::kFar), "Far Detector Data", "lp");
00518     leg->AddEntry(GetDQPlot(dist, kDQTotal, kDQMC, Detector::kFar), "Monte Carlo Total", "l");
00519     leg->AddEntry(GetDQPlot(dist, kDQTotal, kDQMCOsc, Detector::kFar), "Monte Carlo Total - Oscillated", "l");
00520 
00521     leg->Draw();
00522     MarkPrelim(GetDQPlot(dist, kDQTotal, kDQData, Detector::kFar)->GetXaxis()->GetXmax()*0.1,
00523                GetDQPlot(dist, kDQTotal, kDQData, Detector::kFar)->GetMaximum()*0.8);
00524 
00525     gDirectory->Append(canv);
00526 
00527     //canvas for NC-like events
00528     if(fUseNC){
00529       canvName = GetDQPlot(dist, kDQTotal, kDQData, Detector::kFar)->GetName();
00530       index = canvName.Index("Data");
00531       canvName.Remove(index, 4);
00532       canvName += "NCCanv";
00533       TCanvas *canvNC = new TCanvas(canvName, canvName, 150, 10, 900, 600);
00534       TLegend *leg1 = new TLegend(0.75, 0.75, 0.95, 0.95);
00535       leg1->SetBorderSize(0);
00536       leg1->SetFillStyle(0);
00537 
00538       // total strips, r2, pulse height, z
00539       TString extraDrawOpt("");
00540       if (dist==kDQTotalStrips  || dist==kDQPulseHeight ||
00541           dist==kDQRadialSqrVtx)
00542         extraDrawOpt="][";
00543       GetDQPlot(dist, kDQNC, kDQMC, Detector::kFar)->Draw(extraDrawOpt);
00544       GetDQPlot(dist, kDQNC, kDQMCOsc, Detector::kFar)->Draw(extraDrawOpt+"same");
00545       GetDQPlot(dist, kDQNC, kDQData, Detector::kFar)->Draw("pe same");
00546 
00547       leg1->AddEntry(GetDQPlot(dist, kDQNC, kDQData, Detector::kFar), "Far Detector Data - NC", "p");
00548       leg1->AddEntry(GetDQPlot(dist, kDQNC, kDQMC, Detector::kFar), "Monte Carlo", "l");
00549       leg1->AddEntry(GetDQPlot(dist, kDQNC, kDQMCOsc, Detector::kFar), "Monte Carlo - Oscillated ", "l");
00550 
00551       leg1->Draw();
00552       MarkPrelim(GetDQPlot(dist, kDQNC, kDQMC, Detector::kFar)->GetXaxis()->GetXmax()*0.1,
00553                  GetDQPlot(dist, kDQNC, kDQMC, Detector::kFar)->GetMaximum()*0.8);
00554 
00555       gDirectory->Append(canvNC);
00556     }
00557     if(fUseCC){
00558       canvName = GetDQPlot(dist, kDQTotal, kDQData, Detector::kFar)->GetName();
00559       index = canvName.Index("Data");
00560       canvName.Remove(index, 4);
00561       canvName += "CCCanv";
00562       TCanvas *canvCC = new TCanvas(canvName, canvName, 150, 10, 900, 600);
00563       TLegend *leg2 = new TLegend(0.75, 0.75, 0.95, 0.95);
00564       leg2->SetBorderSize(0);
00565       leg2->SetFillStyle(0);
00566 
00567       GetDQPlot(dist, kDQCC, kDQMC, Detector::kFar)->Draw();
00568       GetDQPlot(dist, kDQCC, kDQData, Detector::kFar)->Draw("pe1same");
00569       GetDQPlot(dist, kDQCC, kDQMCOsc, Detector::kFar)->Draw("same");
00570       leg2->AddEntry(GetDQPlot(dist, kDQCC, kDQData, Detector::kFar), "Far Detector Data - CC", "p");
00571       leg2->AddEntry(GetDQPlot(dist, kDQCC, kDQMC, Detector::kFar), "Monte Carlo", "l");
00572       leg2->AddEntry(GetDQPlot(dist, kDQCC, kDQMCOsc, Detector::kFar), "Monte Carlo - Oscillated", "l");
00573 
00574       leg2->Draw();
00575       MarkPrelim(GetDQPlot(dist, kDQCC, kDQMC, Detector::kFar)->GetXaxis()->GetXmax()*0.1,
00576                  GetDQPlot(dist, kDQCC, kDQMC, Detector::kFar)->GetMaximum()*0.8);
00577 
00578       gDirectory->Append(canvCC);
00579     }
00580 
00581   }//end loop over dists
00582 
00583   //make plot for executive summary
00584   TString canvName = "cutsDistsFar";
00585   TCanvas *canv1 = new TCanvas(canvName, canvName, 150, 10, 900, 600);
00586   TLegend *leg3 = new TLegend(0.5, 0.6, 0.9, 0.9);
00587   leg3->SetBorderSize(0);
00588   leg3->SetFillStyle(0);
00589   leg3->AddEntry(GetDQPlot(kDQEventLength, kDQTotal, kDQData, Detector::kFar), "Far Detector Data", "lp");
00590   leg3->AddEntry(GetDQPlot(kDQEventLength, kDQTotal, kDQMCOsc, Detector::kFar), "Oscillated Monte Carlo", "l");
00591 
00592   TPad *pad1 = new TPad("pad1", "", 0.0, 0.5, 0.5, 1.0);
00593   TPad *pad2 = new TPad("pad2", "", 0.5, 0.5, 1.0, 1.0);
00594   TPad *pad3 = new TPad("pad3", "", 0.0, 0.0, 0.5, 0.5);
00595   TPad *pad4 = new TPad("pad4", "", 0.5, 0.0, 1.0, 0.5);
00596 
00597   double maxl = 220.;
00598   double maxt = 750.;
00599   double maxe = 50.;
00600 
00601   // the systematic uncertainty bands for the 3.18e20 analysis
00602   const double elup[50] = {12.663, 12.075,  6.993,  4.237,  3.683,
00603                            3.620,  3.587,  3.354,  2.932,  2.334,
00604                            1.873,  1.454,  1.185,  0.989,  0.863,
00605                            0.761,  0.684,  0.632,  0.581,  0.517,
00606                            0.473,  0.425,  0.398,  0.271,  0.192,
00607                            0.218,  0.300,  0.280,  0.252,  0.250,
00608                            0.217,  0.213,  0.191,  0.182,  0.165,
00609                            0.149,  0.140,  0.124,  0.111,  0.107,
00610                            0.095,  0.091,  0.083,  0.077,  0.067,
00611                            0.061,  0.056,  0.051,  0.015,  0.000};
00612   const double eldw[50] = {12.663, 12.075,  6.993,  4.237,  3.683,
00613                            3.620,  3.587,  3.354,  2.932,  2.334,
00614                            1.873,  1.454,  1.185,  0.989,  0.863,
00615                            0.761,  0.684,  0.632,  0.581,  0.517,
00616                            0.473,  0.425,  0.398,  0.271,  0.192,
00617                            0.218,  0.300,  0.280,  0.252,  0.250,
00618                            0.217,  0.213,  0.191,  0.182,  0.165,
00619                            0.149,  0.140,  0.124,  0.111,  0.107,
00620                            0.095,  0.091,  0.083,  0.077,  0.067,
00621                            0.061,  0.056,  0.051,  0.015,  0.000};
00622 
00623   const double ntup[50] = {14.531, 51.069,  1.360,  0.001,  0.000,
00624                            0.000,  0.000,  0.000,  0.000,  0.000,
00625                            0.000,  0.000,  0.000,  0.000,  0.000,
00626                            0.000,  0.000,  0.000,  0.000,  0.000,
00627                            0.000,  0.000,  0.000,  0.000,  0.000,
00628                            0.000,  0.000,  0.000,  0.000,  0.000,
00629                            0.000,  0.000,  0.000,  0.000,  0.000,
00630                            0.000,  0.000,  0.000,  0.000,  0.000,
00631                            0.000,  0.000,  0.000,  0.000,  0.000,
00632                            0.000,  0.000,  0.000,  0.000,  0.000};
00633   const double ntdw[50] = {14.531, 51.069,  1.360,  0.001,  0.000,
00634                            0.000,  0.000,  0.000,  0.000,  0.000,
00635                            0.000,  0.000,  0.000,  0.000,  0.000,
00636                            0.000,  0.000,  0.000,  0.000,  0.000,
00637                            0.000,  0.000,  0.000,  0.000,  0.000,
00638                            0.000,  0.000,  0.000,  0.000,  0.000,
00639                            0.000,  0.000,  0.000,  0.000,  0.000,
00640                            0.000,  0.000,  0.000,  0.000,  0.000,
00641                            0.000,  0.000,  0.000,  0.000,  0.000,
00642                            0.000,  0.000,  0.000,  0.000,  0.000};
00643 
00644   const double teup[50] = { 0.001,  0.000,  0.001,  0.001,  0.001,
00645                             0.001,  0.002,  0.002,  0.002,  0.003,
00646                             0.003,  0.004,  0.005,  0.010,  0.012,
00647                             0.019,  0.023,  0.037,  0.062,  0.087,
00648                             0.131,  0.203,  0.303,  0.455,  0.642,
00649                             0.903,  1.219,  1.554,  1.806,  1.896,
00650                             1.707,  1.152,  1.152,  1.030,  0.862,
00651                             0.439,  0.385,  0.359,  0.342,  0.326,
00652                             0.317,  0.313,  0.312,  0.299,  0.297,
00653                             0.303,  0.303,  0.302,  0.290,  0.292};
00654   const double tedw[50] = { 0.001,  0.000,  0.001,  0.001,  0.001,
00655                             0.001,  0.002,  0.002,  0.002,  0.003,
00656                             0.003,  0.004,  0.005,  0.010,  0.012,
00657                             0.019,  0.023,  0.037,  0.062,  0.087,
00658                             0.131,  0.203,  0.303,  0.455,  0.642,
00659                             0.903,  1.219,  1.554,  1.806,  1.896,
00660                             1.707,  1.152,  1.152,  1.030,  0.862,
00661                             0.439,  0.385,  0.359,  0.342,  0.326,
00662                             0.317,  0.313,  0.312,  0.299,  0.297,
00663                             0.303,  0.303,  0.302,  0.290,  0.292};
00664 
00665   vector<TGraphAsymmErrors *> errors;
00666   errors.push_back(new TGraphAsymmErrors(GetDQPlot(kDQEventLength, kDQTotal, kDQData, Detector::kFar)->GetNbinsX()));
00667   errors.push_back(new TGraphAsymmErrors(GetDQPlot(kDQNumTracks, kDQTotal, kDQData, Detector::kFar)->GetNbinsX()));
00668   errors.push_back(new TGraphAsymmErrors(GetDQPlot(kDQTrackExtension, kDQTotal, kDQData, Detector::kFar)->GetNbinsX()));
00669 
00670   errors[0]->SetName("eventLengthErrGr");
00671   errors[1]->SetName("numTracksErrGr");
00672   errors[2]->SetName("trackExtensionErrGr");
00673 
00674   for(int i = 0; i < 3; ++i){
00675     const double *eup = elup;
00676     const double *edw = eldw;
00677     if(i == 1){
00678       eup = ntup;
00679       edw = ntdw;
00680     }
00681     if(i == 2){
00682       eup = teup;
00683       edw = tedw;
00684     }
00685     for(int j = 0; j < errors[i]->GetN(); ++j){
00686       errors[i]->SetPoint(j,
00687                           GetDQPlot(3+i, kDQTotal, kDQMCOsc, Detector::kFar)->GetBinCenter(j+1),
00688                           GetDQPlot(3+i, kDQTotal, kDQMCOsc, Detector::kFar)->GetBinContent(j+1));
00689       errors[i]->SetPointError(j,
00690                                0.5*GetDQPlot(3+i, kDQTotal, kDQMC, Detector::kFar)->GetBinWidth(j+1),
00691                                0.5*GetDQPlot(3+i, kDQTotal, kDQMC, Detector::kFar)->GetBinWidth(j+1),
00692                                edw[j], eup[j]);
00693     }
00694   }//end loop to fill error graphs
00695 
00696   TLine *linePlanes = new TLine(60., 0, 60., maxl);
00697   TLine *lineTracks = new TLine(1., 0, 1., maxt);
00698   TLine *lineExtension = new TLine(5., 0, 5., maxe);
00699   TArrow *arrowPlanes = new TArrow(60., 0.75*maxl, 40., 0.75*maxl, 0.02, "|>");
00700   TArrow *arrowTracks = new TArrow(1., 0.75*maxt, 0.5, 0.75*maxt, 0.02, "|>");
00701   TArrow *arrowExtension = new TArrow(5., 0.9*maxe, 0., 0.9*maxe, 0.02, "|>");
00702 
00703 
00704   linePlanes->SetLineWidth(2);
00705   lineTracks->SetLineWidth(2);
00706   lineExtension->SetLineWidth(2);
00707   linePlanes->SetLineColor(4);
00708   lineTracks->SetLineColor(4);
00709   lineExtension->SetLineColor(4);
00710 
00711   arrowPlanes->SetLineWidth(2);
00712   arrowTracks->SetLineWidth(2);
00713   arrowExtension->SetLineWidth(2);
00714   arrowPlanes->SetLineColor(4);
00715   arrowTracks->SetLineColor(4);
00716   arrowExtension->SetLineColor(4);
00717   arrowPlanes->SetFillColor(4);
00718   arrowTracks->SetFillColor(4);
00719   arrowExtension->SetFillColor(4);
00720 
00721   GetDQPlot(kDQEventLength, kDQTotal, kDQMCOsc, Detector::kFar)->SetMaximum(maxl);
00722   GetDQPlot(kDQNumTracks, kDQTotal, kDQMCOsc, Detector::kFar)->SetMaximum(maxt);
00723   GetDQPlot(kDQTrackExtension, kDQTotal, kDQMCOsc, Detector::kFar)->SetMaximum(maxe);
00724 
00725   pad1->Draw();
00726   pad2->Draw();
00727   pad3->Draw();
00728   pad4->Draw();
00729 
00730   TCanvas* cEvtLength=new TCanvas("event_length_far", "event length far");
00731   GetDQPlot(kDQEventLength, kDQTotal, kDQMCOsc, Detector::kFar)->GetXaxis()->SetRangeUser(0., 100.);
00732   GetDQPlot(kDQEventLength, kDQTotal, kDQMCOsc, Detector::kFar)->GetYaxis()->SetRangeUser(0., maxl);
00733   GetDQPlot(kDQEventLength, kDQTotal, kDQMCOsc, Detector::kFar)->Draw("][");
00734   errors[0]->Draw("2");
00735   GetDQPlot(kDQEventLength, kDQTotal, kDQData, Detector::kFar)->Draw("pe1same");
00736   GetDQPlot(kDQEventLength, kDQCC, kDQMCOsc, Detector::kFar)->Draw("same");
00737   linePlanes->Draw();
00738   arrowPlanes->Draw();
00739   //MarkPrelim(GetDQPlot(kDQEventLength, kDQTotal, kDQMC, Detector::kFar)->GetXaxis()->GetXmax()*0.1, maxl*0.8);
00740   leg3->Draw();
00741   gDirectory->Append(cEvtLength);
00742 
00743   TCanvas* cNumTracks=new TCanvas("num_tracks_far", "num tracks far");
00744   GetDQPlot(kDQNumTracks, kDQTotal, kDQMCOsc, Detector::kFar)->GetXaxis()->SetRangeUser(0., 3.);
00745   GetDQPlot(kDQNumTracks, kDQTotal, kDQMCOsc, Detector::kFar)->Draw("][");
00746   errors[1]->Draw("2");
00747   GetDQPlot(kDQNumTracks, kDQTotal, kDQData, Detector::kFar)->Draw("pe1same");
00748   GetDQPlot(kDQNumTracks, kDQCC, kDQMCOsc, Detector::kFar)->Draw("same");
00749   linePlanes->Draw();
00750   lineTracks->Draw();
00751   arrowTracks->Draw();
00752   leg3->Draw();
00753   //MarkPrelim(GetDQPlot(kDQNumTracks, kDQTotal, kDQMC, Detector::kFar)->GetXaxis()->GetXmax()*0.1, maxt*0.8);
00754   gDirectory->Append(cNumTracks);
00755 
00756   //pad3->cd();
00757   TCanvas* cTrkExt=new TCanvas("trk_ext_far", "track extension far");
00758   GetDQPlot(kDQTrackExtension, kDQTotal, kDQMCOsc, Detector::kFar)->GetXaxis()->SetRangeUser(-12., 20.);
00759   GetDQPlot(kDQTrackExtension, kDQTotal, kDQMCOsc, Detector::kFar)->Draw("][");
00760   errors[2]->Draw("2");
00761   GetDQPlot(kDQTrackExtension, kDQTotal, kDQData, Detector::kFar)->Draw("pe1same");
00762   GetDQPlot(kDQTrackExtension, kDQCC, kDQMCOsc, Detector::kFar)->Draw("same");
00763   linePlanes->Draw();
00764   lineExtension->Draw();
00765   arrowExtension->Draw();
00766   leg3->Draw();
00767   //MarkPrelim(GetDQPlot(kDQTrackExtension, kDQTotal, kDQMC, Detector::kFar)->GetXaxis()->GetXmax()*0.1, maxe*0.8);
00768   gDirectory->Append(cTrkExt);
00769 
00770 
00771   pad4->cd();
00772   leg3->Draw();
00773 
00774   gDirectory->Append(canv1);
00775 
00776   DrawVertexPlots(Detector::kFar, fFarVtxX, fFarVtxY);
00777   //DrawVertexPlots(Detector::kFar, fFarVtxXNC, fFarVtxYNC, "NC");
00778   DrawEventRatePlots(Detector::kFar);
00779   DrawFarTimingPlots();
00780 }

void NCDataQualityModule::DrawFarTimingPlots (  )  [protected]

Definition at line 447 of file NCDataQualityModule.cxx.

References GetDQPlot(), kDQCC, kDQData, kDQDeltaTSpill, kDQNC, kDQTotal, Detector::kFar, and MarkPrelim().

Referenced by DrawFarDataQualityPlots().

00448 {
00449   //make a canvas for the event locations
00450   TCanvas* canv3 = new TCanvas("eventSpillTimeCanv", "eventSpillTimeCanv", 150, 10, 900, 600);
00451 
00452   GetDQPlot(kDQDeltaTSpill, kDQTotal, kDQData, Detector::kFar)->Draw();
00453   GetDQPlot(kDQDeltaTSpill, kDQCC, kDQData, Detector::kFar)->Draw("same");
00454   GetDQPlot(kDQDeltaTSpill, kDQNC, kDQData, Detector::kFar)->Draw("same");
00455 
00456   TLegend* leg = new TLegend(0.5, 0.5, 0.8, 0.8);
00457   leg->SetBorderSize(0);
00458   leg->SetFillStyle(0);
00459   leg->AddEntry(GetDQPlot(kDQDeltaTSpill, kDQTotal, kDQData, Detector::kFar), "Far Detector Data", "l");
00460   leg->AddEntry(GetDQPlot(kDQDeltaTSpill, kDQNC, kDQData, Detector::kFar), "NC-like", "l");
00461   leg->AddEntry(GetDQPlot(kDQDeltaTSpill, kDQCC, kDQData, Detector::kFar), "CC-like", "l");
00462   leg->Draw();
00463 
00464   MarkPrelim(-20, 50);
00465 
00466   gDirectory->Append(canv3);
00467 }

void NCDataQualityModule::DrawNearDataQualityPlots (  )  [protected]

Values For the 3.18e20 analysis

Definition at line 783 of file NCDataQualityModule.cxx.

References DrawEventRatePlots(), DrawNearEventsPerPOT(), DrawNearSpectra(), DrawStabilityPlots(), MuELoss::e, fMonthlySpectraNDCC, fMonthlySpectraNDNC, fNearPOTTotal, fNMCFilesNear, fUseCC, fUseNC, GetDQPlot(), kDQCC, kDQData, kDQEventLength, kDQMC, kDQNC, kDQNumDists, kDQNumTracks, kDQTotal, kDQTrackExtension, Msg::kInfo, Detector::kNear, NCType::kPotMC, MarkPrelim(), and MSG.

Referenced by DrawDataQualityPlots().

00784 {
00785   MSG("NCDataQualityModule", Msg::kInfo) << "near pot - " << fNearPOTTotal
00786                                          << " in " << fNMCFilesNear << " MC uDSTs"
00787                                          << endl;
00788 
00789   for(int dist = 0; dist < kDQNumDists; ++dist){
00790 
00791     GetDQPlot(dist, kDQTotal, kDQData, Detector::kNear)->Write();
00792     GetDQPlot(dist, kDQCC, kDQData, Detector::kNear)->Write();
00793     GetDQPlot(dist, kDQNC, kDQData, Detector::kNear)->Write();
00794 
00795 //     fDQNearDataTotalLowIntensity[dist]->Write();
00796 //     fDQNearDataCCLowIntensity[dist]->Write();
00797 //     fDQNearDataNCLowIntensity[dist]->Write();
00798 
00799     double scaleFactor=fNearPOTTotal/(fNMCFilesNear*kPotMC);
00800     GetDQPlot(dist, kDQTotal, kDQMC, Detector::kNear)->Scale(scaleFactor);
00801     GetDQPlot(dist, kDQCC, kDQMC, Detector::kNear)->Scale(scaleFactor);
00802     GetDQPlot(dist, kDQNC, kDQMC, Detector::kNear)->Scale(scaleFactor);
00803 
00804     GetDQPlot(dist, kDQTotal, kDQMC, Detector::kNear)->Write();
00805     GetDQPlot(dist, kDQCC, kDQMC, Detector::kNear)->Write();
00806     GetDQPlot(dist, kDQNC, kDQMC, Detector::kNear)->Write();
00807 
00808     TString canvName = GetDQPlot(dist, kDQTotal, kDQData, Detector::kNear)->GetName();
00809     int index = canvName.Index("Data");
00810     canvName.Remove(index, 4);
00811     canvName += "Canv";
00812     TCanvas *canv = new TCanvas(canvName, canvName, 150, 10, 900, 600);
00813     TLegend *leg = new TLegend(0.75, 0.75, 0.95, 0.95);
00814     leg->SetBorderSize(0);
00815     leg->SetFillStyle(0);
00816 
00817     GetDQPlot(dist, kDQTotal, kDQData, Detector::kNear)->Draw("pe1");
00818     GetDQPlot(dist, kDQTotal, kDQMC, Detector::kNear)->Draw("same");
00819     leg->AddEntry(GetDQPlot(dist, kDQTotal, kDQData, Detector::kNear), "Near Detector Data Total", "lp");
00820     leg->AddEntry(GetDQPlot(dist, kDQTotal, kDQMC, Detector::kNear), "MC Total", "l");
00821     if(fUseCC){
00822       GetDQPlot(dist, kDQCC, kDQData, Detector::kNear)->Draw("pe1same");
00823       GetDQPlot(dist, kDQCC, kDQMC, Detector::kNear)->Draw("same");
00824       leg->AddEntry(GetDQPlot(dist, kDQCC, kDQData, Detector::kNear), "Data CC", "p");
00825       leg->AddEntry(GetDQPlot(dist, kDQCC, kDQMC, Detector::kNear), "MC CC", "l");
00826     }
00827     if(fUseNC){
00828       GetDQPlot(dist, kDQNC, kDQData, Detector::kNear)->Draw("pe1same");
00829       GetDQPlot(dist, kDQNC, kDQMC, Detector::kNear)->Draw("same");
00830       leg->AddEntry(GetDQPlot(dist, kDQNC, kDQData, Detector::kNear), "Data NC", "p");
00831       leg->AddEntry(GetDQPlot(dist, kDQNC, kDQMC, Detector::kNear), "MC NC", "l");
00832     }
00833 
00834     MarkPrelim(GetDQPlot(dist, kDQTotal, kDQData, Detector::kNear)->GetXaxis()->GetXmax()*0.1,
00835                GetDQPlot(dist, kDQTotal, kDQData, Detector::kNear)->GetMaximum()*0.8);
00836     leg->Draw();
00837 
00838     gDirectory->Append(canv);
00839 
00840   }//end loop over dists
00841 
00842   double maxl = 1.25e-5*TMath::Max(GetDQPlot(kDQEventLength, kDQTotal, kDQData, Detector::kNear)->GetMaximum(),
00843                                    GetDQPlot(kDQEventLength, kDQTotal, kDQMC, Detector::kNear)->GetMaximum());
00844   double maxt = 1.25e-6*TMath::Max(GetDQPlot(kDQNumTracks, kDQTotal, kDQData, Detector::kNear)->GetMaximum(),
00845                                    GetDQPlot(kDQNumTracks, kDQTotal, kDQMC, Detector::kNear)->GetMaximum());
00846   double maxe = 1.25e-5*TMath::Max(GetDQPlot(kDQTrackExtension, kDQTotal, kDQData, Detector::kNear)->GetMaximum(),
00847                                    GetDQPlot(kDQTrackExtension, kDQTotal, kDQMC, Detector::kNear)->GetMaximum());
00848 
00849   GetDQPlot(kDQEventLength, kDQTotal, kDQData, Detector::kNear)->Scale(1.e-5);
00850   GetDQPlot(kDQNumTracks, kDQTotal, kDQData, Detector::kNear)->Scale(1.e-6);
00851   GetDQPlot(kDQTrackExtension, kDQTotal, kDQData, Detector::kNear)->Scale(1.e-5);
00852   GetDQPlot(kDQEventLength, kDQTotal, kDQMC, Detector::kNear)->Scale(1.e-5);
00853   GetDQPlot(kDQNumTracks, kDQTotal, kDQMC, Detector::kNear)->Scale(1.e-6);
00854   GetDQPlot(kDQTrackExtension, kDQTotal, kDQMC, Detector::kNear)->Scale(1.e-5);
00855   GetDQPlot(kDQEventLength, kDQCC, kDQMC, Detector::kNear)->Scale(1.e-5);
00856   GetDQPlot(kDQNumTracks, kDQCC, kDQMC, Detector::kNear)->Scale(1.e-6);
00857   GetDQPlot(kDQTrackExtension, kDQCC, kDQMC, Detector::kNear)->Scale(1.e-5);
00858 
00859   GetDQPlot(kDQEventLength, kDQTotal, kDQMC, Detector::kNear)->SetYTitle("Events (#times 10^{5})");
00860   GetDQPlot(kDQNumTracks, kDQTotal, kDQMC, Detector::kNear)->SetYTitle("Events (#times 10^{6})");
00861   GetDQPlot(kDQTrackExtension, kDQTotal, kDQMC, Detector::kNear)->SetYTitle("Events (#times 10^{5})");
00862 
00863   for(int i = 0; i < GetDQPlot(kDQEventLength, kDQTotal, kDQData, Detector::kNear)->GetNbinsX(); ++i)
00864     GetDQPlot(kDQEventLength, kDQTotal, kDQData, Detector::kNear)->SetBinError(i+1, 1.e-5*GetDQPlot(kDQEventLength, kDQTotal, kDQData, Detector::kNear)->GetBinError(i+1));
00865 
00866   for(int i = 0; i < GetDQPlot(kDQNumTracks, kDQTotal, kDQData, Detector::kNear)->GetNbinsX(); ++i)
00867     GetDQPlot(kDQNumTracks, kDQTotal, kDQData, Detector::kNear)->SetBinError(i+1, 1.e-6*GetDQPlot(kDQNumTracks, kDQTotal, kDQData, Detector::kNear)->GetBinError(i+1));
00868 
00869   for(int i = 0; i < GetDQPlot(kDQTrackExtension, kDQTotal, kDQData, Detector::kNear)->GetNbinsX(); ++i)
00870     GetDQPlot(kDQTrackExtension, kDQTotal, kDQData, Detector::kNear)->SetBinError(i+1, 1.e-5*GetDQPlot(kDQTrackExtension, kDQTotal, kDQData, Detector::kNear)->GetBinError(i+1));
00871 
00872   GetDQPlot(kDQEventLength, kDQTotal, kDQMC, Detector::kNear)->SetMaximum(maxl);
00873   GetDQPlot(kDQNumTracks, kDQTotal, kDQMC, Detector::kNear)->SetMaximum(maxt);
00874   GetDQPlot(kDQTrackExtension, kDQTotal, kDQMC, Detector::kNear)->SetMaximum(maxe);
00875 
00876   //make systematic uncertainty bands
00877 
00878   // PRL error bands
00879   /*
00880   double ntup[10] = {40.8293, 191.342, 3.78054, 0.006273,   0,
00881                      0,       0,       0,       0,          0};
00882   double ntdw[10] = {37.008,  176.92,  3.57563, 0.00626988, 0,
00883                      0,       0,       0,       0,          0};
00884   double elup[50] = {45.5608, 42.911,  22.1133, 16.5154,  15.9571,
00885                      15.5643, 14.4027, 12.1637,  9.53502,  6.89265,
00886                       5.043,    3.751,  2.97245, 2.43231,  2.05496,
00887                       1.81841,  1.6544, 1.60072, 1.50199,  1.6308,
00888                       3.53188,  3.8482, 3.38007, 2.90701,  2.43652,
00889                       0.76347,  0,      0,       0.0004,   0,
00890                      0,0,0,0,0,
00891                      0,0,0,0,0,
00892                      0,0,0,0,0,
00893                      0,0,0,0,0};
00894   double eldw[50] = {40.4698, 38.8774, 20.4271, 15.2912, 14.9715,
00895                      14.8539, 13.8931, 11.8686,  9.36871, 6.74724,
00896                       4.90361, 3.62665, 2.84216, 2.29516, 1.92361,
00897                       1.6975,  1.53832, 1.48231, 1.39802, 1.51276,
00898                       3.26844, 3.54244, 3.11487, 2.68013, 2.24106,
00899                       0.69698, 0,       0,       0.00041, 0,
00900                      0,0,0,0,0,
00901                      0,0,0,0,0,
00902                      0,0,0,0,0,
00903                      0,0,0,0,0};
00904   double teup[50] = {0.00181798,0.00155781,0.00125497,0.00188122,0.0013573,
00905                      0.00268924,0.00327829,0.00455317,0.005519,0.00582066,
00906                      0.00840255,0.00560191,0.00752972,0.0129454,0.0135563,
00907                      0.0167458,0.0273413,0.0319429,0.0457396,0.0770695,
00908                      0.113302,0.181813,0.320604,0.543146,0.931264,
00909                      1.55251,2.4848,3.77569,5.34883,6.77665,
00910                      7.69249,6.2814,6.52206,6.14857,5.2589,
00911                      2.93301,2.48698,2.22001,2.01712,1.88602,
00912                      1.83302,1.7337,1.69579,1.64394,1.58963,
00913                      1.5514,1.53539,1.51692,1.55346,1.50479};
00914   double tedw[50] = {0.00182367,0.00155781,0.00125497,0.00188122,0.0013573,
00915                      0.00268924,0.00327829,0.00455317,0.005519,0.00582066,
00916                      0.00840255,0.00560191,0.00752972,0.0129083,0.0135563,
00917                      0.0167458,0.0273026,0.0319294,0.0457391,0.076818,
00918                      0.113209,0.1814,0.318877,0.539943,0.920052,
00919                      1.52943,2.43068,3.65676,5.1071,6.35102,
00920                      7.07417,5.71773,5.90042,5.54619,4.78795,
00921                      2.48046,2.11197,1.89213,1.74004,1.63381,
00922                      1.5828,1.51001,1.48858,1.4472,1.39816,
00923                      1.37784,1.36899,1.35324,1.381,1.35579};
00924   */
00925 
00927   const double elup[50] = {51.148,49.002,25.704,19.266,18.943,
00928                            18.683,17.593,15.076,11.887, 8.496,
00929                            6.154, 4.612, 3.573, 2.912, 2.454,
00930                            2.148, 1.954, 1.858, 1.783, 1.921,
00931                            4.158, 4.478, 3.930, 3.371, 2.794,
00932                            0.868, 0.000, 0.000, 0.000, 0.000,
00933                            0.000, 0.000, 0.000, 0.000, 0.000,
00934                            0.000, 0.000, 0.000, 0.000, 0.000,
00935                            0.000, 0.000, 0.000, 0.000, 0.000,
00936                            0.000, 0.000, 0.000, 0.000, 0.000};
00937   const double eldw[50] = {51.148, 49.002, 25.704, 19.266, 18.943,
00938                            18.683, 17.593, 15.076, 11.887,  8.496,
00939                            6.154,  4.612,  3.573,  2.912,  2.454,
00940                            2.148,  1.954,  1.858,  1.783,  1.921,
00941                            4.158,  4.478,  3.930,  3.371,  2.794,
00942                            0.868,  0.000,  0.000,  0.000,  0.000,
00943                            0.000,  0.000,  0.000,  0.000,  0.000,
00944                            0.000,  0.000,  0.000,  0.000,  0.000,
00945                            0.000,  0.000,  0.000,  0.000,  0.000,
00946                            0.000,  0.000,  0.000,  0.000,  0.000};
00947 
00948   const double ntup[50] = {46.800,223.301, 4.484, 0.007, 0.000,
00949                            0.000, 0.000, 0.000, 0.000, 0.000,
00950                            0.000, 0.000, 0.000, 0.000, 0.000,
00951                            0.000, 0.000, 0.000, 0.000, 0.000,
00952                            0.000, 0.000, 0.000, 0.000, 0.000,
00953                            0.000, 0.000, 0.000, 0.000, 0.000,
00954                            0.000, 0.000, 0.000, 0.000, 0.000,
00955                            0.000, 0.000, 0.000, 0.000, 0.000,
00956                            0.000, 0.000, 0.000, 0.000, 0.000,
00957                            0.000, 0.000, 0.000, 0.000, 0.000};
00958   const double ntdw[50] = {46.800, 223.301,  4.484,  0.007,  0.000,
00959                            0.000,  0.000,  0.000,  0.000,  0.000,
00960                            0.000,  0.000,  0.000,  0.000,  0.000,
00961                            0.000,  0.000,  0.000,  0.000,  0.000,
00962                            0.000,  0.000,  0.000,  0.000,  0.000,
00963                            0.000,  0.000,  0.000,  0.000,  0.000,
00964                            0.000,  0.000,  0.000,  0.000,  0.000,
00965                            0.000,  0.000,  0.000,  0.000,  0.000,
00966                            0.000,  0.000,  0.000,  0.000,  0.000,
00967                            0.000,  0.000,  0.000,  0.000,  0.000};
00968 
00969   const double teup[50] = { 0.001, 0.002, 0.002, 0.002, 0.002,
00970                             0.003, 0.004, 0.004, 0.004, 0.005,
00971                             0.006, 0.008, 0.012, 0.012, 0.016,
00972                             0.022, 0.032, 0.043, 0.067, 0.092,
00973                             0.147, 0.240, 0.415, 0.685, 1.159,
00974                             1.920, 3.063, 4.589, 6.416, 7.996,
00975                             8.967, 7.207, 7.513, 6.945, 5.986,
00976                             3.128, 2.692, 2.403, 2.219, 2.030,
00977                             1.923, 1.878, 1.846, 1.781, 1.779,
00978                             1.736, 1.750, 1.731, 1.740, 1.755};
00979   const double tedw[50] = { 0.001,  0.002,  0.002,  0.002,  0.002,
00980                             0.003,  0.004,  0.004,  0.004,  0.005,
00981                             0.006,  0.008,  0.012,  0.012,  0.016,
00982                             0.022,  0.032,  0.043,  0.067,  0.092,
00983                             0.147,  0.240,  0.415,  0.685,  1.159,
00984                             1.920,  3.063,  4.589,  6.416,  7.996,
00985                             8.967,  7.207,  7.513,  6.945,  5.986,
00986                             3.128,  2.692,  2.403,  2.219,  2.030,
00987                             1.923,  1.878,  1.846,  1.781,  1.779,
00988                             1.736,  1.750,  1.731,  1.740,  1.755};
00989 
00990   vector<TGraphAsymmErrors *> errors;
00991   errors.push_back(new TGraphAsymmErrors(GetDQPlot(kDQEventLength, kDQTotal, kDQData, Detector::kNear)->GetNbinsX()));
00992   errors.push_back(new TGraphAsymmErrors(GetDQPlot(kDQNumTracks, kDQTotal, kDQData, Detector::kNear)->GetNbinsX()));
00993   errors.push_back(new TGraphAsymmErrors(GetDQPlot(kDQTrackExtension, kDQTotal, kDQData, Detector::kNear)->GetNbinsX()));
00994 
00995   errors[0]->SetName("eventLengthErrGr");
00996   errors[1]->SetName("numTracksErrGr");
00997   errors[2]->SetName("trackExtensionErrGr");
00998 
00999   for(int i = 0; i < 3; ++i){
01000     const double *eup = elup;
01001     const double *edw = eldw;
01002     double scale = 1.e-2;
01003     if(i == 1){
01004       scale = 1.e-3;
01005       eup = ntup;
01006       edw = ntdw;
01007     }
01008     if(i == 2){
01009       eup = teup;
01010       edw = tedw;
01011     }
01012     for(int j = 0; j < errors[i]->GetN(); ++j){
01013       errors[i]->SetPoint(j,
01014                           GetDQPlot(3+i, kDQTotal, kDQMC, Detector::kNear)->GetBinCenter(j+1),
01015                           GetDQPlot(3+i, kDQTotal, kDQMC, Detector::kNear)->GetBinContent(j+1));
01016       errors[i]->SetPointError(j,
01017                                0.5*GetDQPlot(3+i, kDQTotal, kDQMC, Detector::kNear)->GetBinWidth(j+1),
01018                                0.5*GetDQPlot(3+i, kDQTotal, kDQMC, Detector::kNear)->GetBinWidth(j+1),
01019                                edw[j]*scale, eup[j]*scale);
01020     }
01021   }//end loop to fill error graphs
01022 
01023   //make plot for executive summary
01024   TString canvName = "cutsDists";
01025   TCanvas *canv1 = new TCanvas(canvName, canvName, 150, 10, 900, 600);
01026   TLegend *leg1 = new TLegend(0.5, 0.6, 0.9, 0.9);
01027   leg1->SetBorderSize(0);
01028   leg1->SetFillStyle(0);
01029   leg1->AddEntry(GetDQPlot(kDQEventLength, kDQTotal, kDQData, Detector::kNear), "Near Detector Data", "lp");
01030   leg1->AddEntry(GetDQPlot(kDQEventLength, kDQTotal, kDQMC, Detector::kNear), "Monte Carlo", "l");
01031   leg1->AddEntry(GetDQPlot(kDQEventLength, kDQCC, kDQMC, Detector::kNear), "MC CC Background", "f");
01032 
01033 
01034 
01035   TPad *pad1 = new TPad("pad1", "", 0.0, 0.5, 0.5, 1.0);
01036   TPad *pad2 = new TPad("pad2", "", 0.5, 0.5, 1.0, 1.0);
01037   TPad *pad3 = new TPad("pad3", "", 0.0, 0.0, 0.5, 0.5);
01038   TPad *pad4 = new TPad("pad4", "", 0.5, 0.0, 1.0, 0.5);
01039 
01040   TLine *linePlanes = new TLine(60., 0, 60., maxl);
01041   TLine *lineTracks = new TLine(1., 0, 1., maxt);
01042   TLine *lineExtension = new TLine(5., 0, 5., maxe);
01043   TArrow *arrowPlanes = new TArrow(60., 0.75*maxl, 40., 0.75*maxl, 0.02, "|>");
01044   TArrow *arrowTracks = new TArrow(1., 0.75*maxt, 0.5, 0.75*maxt, 0.02, "|>");
01045   TArrow *arrowExtension = new TArrow(5., 0.9*maxe, -5., 0.9*maxe, 0.02, "|>");
01046 
01047   linePlanes->SetLineWidth(2);
01048   lineTracks->SetLineWidth(2);
01049   lineExtension->SetLineWidth(2);
01050   linePlanes->SetLineColor(4);
01051   lineTracks->SetLineColor(4);
01052   lineExtension->SetLineColor(4);
01053 
01054   arrowPlanes->SetLineWidth(2);
01055   arrowTracks->SetLineWidth(2);
01056   arrowExtension->SetLineWidth(2);
01057   arrowPlanes->SetLineColor(4);
01058   arrowTracks->SetLineColor(4);
01059   arrowExtension->SetLineColor(4);
01060   arrowPlanes->SetFillColor(4);
01061   arrowTracks->SetFillColor(4);
01062   arrowExtension->SetFillColor(4);
01063 
01064   pad1->Draw();
01065   pad2->Draw();
01066   pad3->Draw();
01067   pad4->Draw();
01068 
01069   TCanvas* cEvtLength=new TCanvas("event_length_near", "event length near");
01070   GetDQPlot(kDQEventLength, kDQTotal, kDQMC, Detector::kNear)->GetXaxis()->SetRangeUser(0., 100.);
01071   GetDQPlot(kDQEventLength, kDQTotal, kDQMC, Detector::kNear)->GetYaxis()->SetRangeUser(0., maxl);
01072   GetDQPlot(kDQEventLength, kDQTotal, kDQMC, Detector::kNear)->Draw("][");
01073   errors[0]->Draw("2");
01074   GetDQPlot(kDQEventLength, kDQCC, kDQMC, Detector::kNear)->Draw("same ][");
01075   GetDQPlot(kDQEventLength, kDQTotal, kDQData, Detector::kNear)->Draw("pe1same");
01076   linePlanes->Draw();
01077   arrowPlanes->Draw();
01078   //MarkPrelim(GetDQPlot(kDQEventLength, kDQTotal, kDQMC, Detector::kNear)->GetXaxis()->GetXmax()*0.1, maxl*0.8);
01079   leg1->Draw();
01080   gDirectory->Append(cEvtLength);
01081 
01082   TCanvas* cNumTracks=new TCanvas("num_tracks_near", "num tracks near");
01083   GetDQPlot(kDQNumTracks, kDQTotal, kDQMC, Detector::kNear)->GetXaxis()->SetRangeUser(0., 3.);
01084   GetDQPlot(kDQNumTracks, kDQTotal, kDQMC, Detector::kNear)->Draw("][");
01085   errors[1]->Draw("2");
01086   GetDQPlot(kDQNumTracks, kDQCC, kDQMC, Detector::kNear)->Draw("same ][");
01087   GetDQPlot(kDQNumTracks, kDQTotal, kDQData, Detector::kNear)->Draw("pe1same");
01088   lineTracks->Draw();
01089   arrowTracks->Draw();
01090   leg1->Draw();
01091   //MarkPrelim(GetDQPlot(kDQNumTracks, kDQTotal, kDQMC, Detector::kNear)->GetXaxis()->GetXmax()*0.1, maxt*0.8);
01092   gDirectory->Append(cNumTracks);
01093 
01094   //pad3->cd();
01095   TCanvas* cTrkExt=new TCanvas("trk_ext_near", "track extension near");
01096   GetDQPlot(kDQTrackExtension, kDQTotal, kDQMC, Detector::kNear)->GetXaxis()->SetRangeUser(-12., 20.);
01097   GetDQPlot(kDQTrackExtension, kDQTotal, kDQMC, Detector::kNear)->Draw("][");
01098   errors[2]->Draw("2");
01099   GetDQPlot(kDQTrackExtension, kDQCC, kDQMC, Detector::kNear)->Draw("same");
01100   GetDQPlot(kDQTrackExtension, kDQTotal, kDQData, Detector::kNear)->Draw("pe1same");
01101   lineExtension->Draw();
01102   arrowExtension->Draw();
01103   leg1->Draw();
01104   //MarkPrelim(GetDQPlot(kDQTrackExtension, kDQTotal, kDQMC, Detector::kNear)->GetXaxis()->GetXmax()*0.1, maxe*0.8);
01105   gDirectory->Append(cTrkExt);
01106 
01107   //pad4->cd();
01108 
01109   gDirectory->Append(canv1);
01110 
01111   DrawNearEventsPerPOT();
01112   DrawNearSpectra(fMonthlySpectraNDNC, "NC");
01113   DrawNearSpectra(fMonthlySpectraNDCC, "CC");
01114   DrawEventRatePlots(Detector::kNear);
01115   DrawStabilityPlots(Detector::kNear);
01116 }

void NCDataQualityModule::DrawNearEventsPerPOT (  )  [protected]

Definition at line 1767 of file NCDataQualityModule.cxx.

References fDQNearData2DCC, fDQNearData2DNC, fDQNearData2DTotal, kDQ2DEventsPerPOT, kDQ2DEventsPerPOTGT1GeV, kDQ2DEventsPerPOTLT05GeV, kDQ2DEventsPerPOTLT1GeV, and kDQ2DNumDists.

Referenced by DrawNearDataQualityPlots().

01768 {
01769 
01770   for(int dist = 0; dist < kDQ2DNumDists; ++dist){
01771     fDQNearData2DTotal[dist]->Write();
01772     fDQNearData2DCC[dist]->Write();
01773     fDQNearData2DNC[dist]->Write();
01774   }
01775 
01776   //make vectors of profile histograms
01777   vector<TProfile *> profTot;
01778   vector<TProfile *> profNC;
01779   vector<TProfile *> profCC;
01780 
01781   //and of TF1
01782   vector<TF1 *> fitTot;
01783   vector<TF1 *> fitNC;
01784   vector<TF1 *> fitCC;
01785   TString name = "";
01786 
01787   for (unsigned int i = 0; i < fDQNearData2DTotal.size(); ++i){
01788     profTot.push_back(fDQNearData2DTotal[i]->ProfileX());
01789     name = fDQNearData2DTotal[i]->GetName();
01790     fitTot.push_back(new TF1("fit"+name, "pol0"));
01791     profTot[i]->Fit(fitTot[i], "Q0");
01792     profNC.push_back(fDQNearData2DNC[i]->ProfileX());
01793     name = fDQNearData2DNC[i]->GetName();
01794     fitNC.push_back(new TF1("fit"+name, "pol0"));
01795     profNC[i]->Fit(fitNC[i], "Q0");
01796     profCC.push_back(fDQNearData2DCC[i]->ProfileX());
01797     name = fDQNearData2DCC[i]->GetName();
01798     fitCC.push_back(new TF1("fit"+name, "pol0"));
01799     profCC[i]->Fit(fitCC[i], "Q0");
01800   }
01801 
01802   //draw the profiles
01803   TCanvas *canv1 = new TCanvas("totalEventsPerPOT", "totalEventsPerPOT", 150, 10, 900, 600);
01804   TLegend *leg1 = new TLegend(0.75, 0.75, 0.95, 0.95);
01805   leg1->SetBorderSize(0);
01806   leg1->SetFillStyle(0);
01807 
01808   profTot[kDQ2DEventsPerPOT]->Draw();
01809   profTot[kDQ2DEventsPerPOTLT05GeV]->Draw("same");
01810   profTot[kDQ2DEventsPerPOTLT1GeV]->Draw("same");
01811   profTot[kDQ2DEventsPerPOTGT1GeV]->Draw("same");
01812   fitTot[kDQ2DEventsPerPOTLT05GeV]->Draw();
01813   fitTot[kDQ2DEventsPerPOTLT1GeV]->Draw();
01814   fitTot[kDQ2DEventsPerPOTGT1GeV]->Draw();
01815   fitTot[kDQ2DEventsPerPOT]->Draw();
01816 
01817   leg1->AddEntry(profTot[kDQ2DEventsPerPOT], "All Events", "p");
01818   leg1->AddEntry(profTot[kDQ2DEventsPerPOTLT05GeV], "0 < E_{vis} < 0.5 GeV", "p");
01819   leg1->AddEntry(profTot[kDQ2DEventsPerPOTLT1GeV], "0.5 < E_{vis} < 1.0 GeV", "p");
01820   leg1->AddEntry(profTot[kDQ2DEventsPerPOTGT1GeV], "1 GeV < E_{vis}", "p");
01821   leg1->Draw();
01822 
01823   gDirectory->Append(canv1);
01824 
01825   TCanvas *canv2 = new TCanvas("ncEventsPerPOT", "ncEventsPerPOT", 150, 10, 900, 600);
01826   TLegend *leg2 = new TLegend(0.75, 0.75, 0.95, 0.95);
01827   leg2->SetBorderSize(0);
01828   leg2->SetFillStyle(0);
01829 
01830   profNC[kDQ2DEventsPerPOT]->Draw();
01831   profNC[kDQ2DEventsPerPOTLT05GeV]->Draw("same");
01832   profNC[kDQ2DEventsPerPOTLT1GeV]->Draw("same");
01833   profNC[kDQ2DEventsPerPOTGT1GeV]->Draw("same");
01834   fitNC[kDQ2DEventsPerPOTLT05GeV]->Draw();
01835   fitNC[kDQ2DEventsPerPOTLT1GeV]->Draw();
01836   fitNC[kDQ2DEventsPerPOTGT1GeV]->Draw();
01837   fitNC[kDQ2DEventsPerPOT]->Draw();
01838 
01839   leg2->AddEntry(profNC[kDQ2DEventsPerPOT], "All Events", "p");
01840   leg2->AddEntry(profNC[kDQ2DEventsPerPOTLT05GeV], "0 < E_{vis} < 0.5 GeV", "p");
01841   leg2->AddEntry(profNC[kDQ2DEventsPerPOTLT1GeV], "0.5 < E_{vis} < 1.0 GeV", "p");
01842   leg2->AddEntry(profNC[kDQ2DEventsPerPOTGT1GeV], "1 GeV < E_{vis}", "p");
01843   leg2->Draw();
01844 
01845   gDirectory->Append(canv2);
01846 
01847   TCanvas *canv3 = new TCanvas("ccEventsPerPOT", "ccEventsPerPOT", 150, 10, 900, 600);
01848   TLegend *leg3 = new TLegend(0.75, 0.75, 0.95, 0.95);
01849   leg3->SetBorderSize(0);
01850   leg3->SetFillStyle(0);
01851 
01852   profCC[kDQ2DEventsPerPOT]->Draw();
01853   profCC[kDQ2DEventsPerPOTLT05GeV]->Draw("same");
01854   profCC[kDQ2DEventsPerPOTLT1GeV]->Draw("same");
01855   profCC[kDQ2DEventsPerPOTGT1GeV]->Draw("same");
01856   fitCC[kDQ2DEventsPerPOTLT05GeV]->Draw();
01857   fitCC[kDQ2DEventsPerPOTLT1GeV]->Draw();
01858   fitCC[kDQ2DEventsPerPOTGT1GeV]->Draw();
01859   fitCC[kDQ2DEventsPerPOT]->Draw();
01860 
01861   leg3->AddEntry(profCC[kDQ2DEventsPerPOT], "All Events", "p");
01862   leg3->AddEntry(profCC[kDQ2DEventsPerPOTLT05GeV], "0 < E_{vis} < 0.5 GeV", "p");
01863   leg3->AddEntry(profCC[kDQ2DEventsPerPOTLT1GeV], "0.5 < E_{vis} < 1.0 GeV", "p");
01864   leg3->AddEntry(profCC[kDQ2DEventsPerPOTGT1GeV], "1 GeV < E_{vis}", "p");
01865   leg3->Draw();
01866 
01867   gDirectory->Append(canv3);
01868 }

void NCDataQualityModule::DrawNearSpectra ( std::vector< NCDataQualityPlot * > &  spectra,
TString  nccc 
) [protected]

Definition at line 1624 of file NCDataQualityModule.cxx.

References MuELoss::e, fMonthlyNDPOT, JobCModule::GetName(), and Munits::m.

Referenced by DrawNearDataQualityPlots().

01626 {
01627   TCanvas *canv1 = new TCanvas("MonthlySpectra"+nccc, "MonthlySpectra"+nccc, 150, 10, 900, 600);
01628   TLegend *leg1 = new TLegend(0.5, 0.5, 0.75, 0.75);
01629   leg1->SetBorderSize(0);
01630   leg1->SetFillStyle(0);
01631   TLegend *leg2 = new TLegend(0.5, 0.5, 0.75, 0.75);
01632   leg2->SetBorderSize(0);
01633   leg2->SetFillStyle(0);
01634 
01635   TString name = "";
01636   TString months[17] = {"2005-05", "2005-06", "2005-07", "2005-08", "2005-09",
01637                         "2005-10", "2005-11", "2005-12", "2006-01", "2006-02",
01638                         "2006-09", "2006-10", "2006-11", "2006-12", "2007-01",
01639                         "2007-02", "2007-03"};
01640 
01641   if(spectra.empty()) return;
01642 
01643   //make a histogram of the mean for run I and run II
01644   TH1D *meanRunI = new TH1D("meanRunI"+nccc, "", spectra[0]->GetNbinsX(),
01645                             spectra[0]->GetXaxis()->GetXmin(),
01646                             spectra[0]->GetXaxis()->GetXmax());
01647   TH1D *meanRunII = new TH1D("meanRunII"+nccc, "", spectra[0]->GetNbinsX(),
01648                              spectra[0]->GetXaxis()->GetXmin(),
01649                              spectra[0]->GetXaxis()->GetXmax());
01650 
01651   meanRunI->SetXTitle(spectra[0]->GetXaxis()->GetTitle());
01652   meanRunI->SetYTitle("Events (#times 10^{3})");
01653   meanRunI->GetXaxis()->CenterTitle();
01654   meanRunI->GetYaxis()->CenterTitle();
01655 
01656   meanRunII->SetXTitle(spectra[0]->GetXaxis()->GetTitle());
01657   meanRunII->SetYTitle("Events (#times 10^{3})");
01658   meanRunII->GetXaxis()->CenterTitle();
01659   meanRunII->GetYaxis()->CenterTitle();
01660 
01661   //make a vector of tgraphs for run I and run II
01662   vector<TGraphErrors *> runI;
01663   vector<TGraphErrors *> runII;
01664 
01665   for (int m = 0; m < 17; ++m){
01666     for (unsigned int i = 0; i < spectra.size(); ++i){
01667       name = spectra[i]->GetName();
01668       if(name.Contains(months[m])){
01669         if(m < 10){
01670           runI.push_back(new TGraphErrors(spectra[i]->GetNbinsX()));
01671           runI[runI.size()-1]->SetName(months[m]);
01672           for(int j = 0; j < spectra[i]->GetNbinsX(); ++j){
01673             runI[runI.size()-1]->SetPoint(j, 0.1*(m-5)+0.05+spectra[i]->GetBinCenter(j+1),
01674                                           1.e-3*(1.e7/fMonthlyNDPOT[i])*spectra[i]->GetBinContent(j+1));
01675             runI[runI.size()-1]->SetPointError(j, 0.,
01676                                                1.e-3*(1.e7/fMonthlyNDPOT[i])*spectra[i]->GetBinError(j+1));
01677           }
01678           meanRunI->Add(spectra[i], 1.e-3*(1.e7/fMonthlyNDPOT[i])*0.1);
01679         }//end if run I
01680         else{
01681           runII.push_back(new TGraphErrors(spectra[i]->GetNbinsX()));
01682           runII[runII.size()-1]->SetName(months[m]);
01683           for(int j = 0; j < spectra[i]->GetNbinsX(); ++j){
01684             runII[runII.size()-1]->SetPoint(j, 0.1*(m-13)+0.05+spectra[i]->GetBinCenter(j+1),
01685                                             1.e-3*(1.e7/fMonthlyNDPOT[i])*spectra[i]->GetBinContent(j+1));
01686             runII[runII.size()-1]->SetPointError(j, 0.,
01687                                                  1.e-3*(1.e7/fMonthlyNDPOT[i])*spectra[i]->GetBinError(j+1));
01688           }
01689           meanRunII->Add(spectra[i], 1.e-3*(1.e7/fMonthlyNDPOT[i])*0.142857);
01690         }//end if run II
01691       }//end if on the right month
01692     }//end loop over spectra
01693   }//end loop over months
01694 
01695   //get skzp error envelope
01696   double skzpErrY[15] = {0.71, 0.43, 0.38, 0.39, 0.34,
01697                          0.24, 0.14, 0.09, 0.07, 0.06,
01698                          0., 0., 0., 0., 0.};
01699 
01700   TGraphAsymmErrors *meanRunIGr = new TGraphAsymmErrors(15);
01701   TGraphAsymmErrors *meanRunIIGr = new TGraphAsymmErrors(15);
01702 
01703   meanRunIGr->SetTitle("");
01704   meanRunIIGr->SetTitle("");
01705 
01706   meanRunIGr->SetName("meanRunIGr");
01707   meanRunIIGr->SetName("meanRunIIGr");
01708 
01709   for(int i = 0; i < 15; ++i){
01710     meanRunIGr->SetPoint(i, meanRunI->GetBinCenter(i+1),
01711                          meanRunI->GetBinContent(i+1));
01712     meanRunIGr->SetPointError(i, 0.5, 0.5, skzpErrY[i], skzpErrY[i]);
01713 
01714     meanRunIIGr->SetPoint(i, meanRunII->GetBinCenter(i+1),
01715                          meanRunII->GetBinContent(i+1));
01716     meanRunIIGr->SetPointError(i, 0.5, 0.5, skzpErrY[i], skzpErrY[i]);
01717   }
01718 
01719   meanRunIGr->GetHistogram()->GetXaxis()->SetTitle("E_{vis} (GeV)");
01720   meanRunIIGr->GetHistogram()->GetXaxis()->SetTitle("E_{vis} (GeV)");
01721 
01722   meanRunIGr->GetHistogram()->GetYaxis()->SetTitle("Events/10^{19} POT");
01723   meanRunIIGr->GetHistogram()->GetYaxis()->SetTitle("Events/10^{19} POT");
01724 
01725   meanRunIGr->GetHistogram()->GetXaxis()->CenterTitle();
01726   meanRunIIGr->GetHistogram()->GetXaxis()->CenterTitle();
01727 
01728   meanRunIGr->GetHistogram()->GetYaxis()->CenterTitle();
01729   meanRunIIGr->GetHistogram()->GetYaxis()->CenterTitle();
01730 
01731   TPad *pad1 = new TPad("pad1", "", 0.0, 0.5, 1.0, 1.0);
01732   TPad *pad2 = new TPad("pad2", "", 0.0, 0.0, 1.0, 0.5);
01733 
01734   pad1->Draw();
01735   pad2->Draw();
01736 
01737   pad1->cd();
01738   meanRunIGr->GetHistogram()->GetYaxis()->SetRangeUser(0.1, 12);
01739   meanRunIGr->Draw("pa2");
01740   meanRunI->Draw("same");
01741   for (unsigned int i = 0; i < runI.size(); ++i){
01742     runI[i]->Draw("pe1same");
01743     leg1->AddEntry(runI[i], runI[i]->GetName(), "lp");
01744   }
01745   leg1->AddEntry(meanRunI, "ND Run I Mean - "+nccc, "l");
01746   leg1->SetNColumns(2);
01747   leg1->Draw();
01748 
01749   pad2->cd();
01750   meanRunIIGr->GetHistogram()->GetYaxis()->SetRangeUser(0.1, 12);
01751   meanRunIIGr->Draw("pa2");
01752   meanRunII->Draw("same");
01753   for (unsigned int i = 0; i < runII.size(); ++i){
01754     runII[i]->Draw("pe1same");
01755     leg2->AddEntry(runII[i], runII[i]->GetName(), "lp");
01756   }
01757   leg2->AddEntry(meanRunII, "ND Run II Mean - "+nccc, "l");
01758   leg2->SetNColumns(2);
01759   leg2->Draw();
01760 
01761   gDirectory->Append(canv1);
01762 }

void NCDataQualityModule::DrawStabilityPlot ( Detector::Detector_t  det,
TString  longName,
std::map< int, TGraphErrors * > &  spectra,
std::map< int, TGraphErrors * > &  spectraMC,
std::map< int, TGraphErrors * > &  dblratios,
int  minplot,
int  maxplot,
std::map< int, TString > &  names 
) [protected]

Referenced by DrawStabilityPlots().

void NCDataQualityModule::DrawStabilityPlots ( Detector::Detector_t  detector  )  [protected]

Definition at line 1269 of file NCDataQualityModule.cxx.

References DrawStabilityPlot(), MuELoss::e, FillDoubleRatios(), GetDQPlot(), GetNDSectionGraphs(), kDQData, kDQEnergy, kDQEnergyA1, kDQEnergyA2, kDQEnergyQ1, kDQEnergyQ2, kDQEnergyQ3, kDQEnergyQ4, kDQEnergyZ1, kDQEnergyZ2, kDQEnergyZ3, kDQMC, and kDQNC.

Referenced by DrawNearDataQualityPlots().

01270 {
01271   //these plots will have 2 pads each, one to overlay the spectra, the
01272   //other to have the ratios of each section to the total
01273 
01274   //make vectors of graphs to display the data more clearly
01275   map<int, TGraphErrors*> spectra;
01276   map<int, TGraphErrors*> ratios;
01277   // And the same for MC
01278   map<int, TGraphErrors*> spectraMC;
01279   map<int, TGraphErrors*> ratiosMC;
01280   // And the double ratios, because they're the relevant bits
01281   map<int, TGraphErrors*> dblratios;
01282 
01283   GetNDSectionGraphs(det, kDQData, spectra, ratios);
01284   GetNDSectionGraphs(det, kDQMC, spectraMC, ratiosMC);
01285 
01286   FillDoubleRatios(ratios, ratiosMC, dblratios);
01287 
01288   for (int i=kDQData; i<=kDQMC; ++i) {
01289     NCDataQualityPlot* p=GetDQPlot(kDQEnergy, kDQNC, i, det);
01290     p->Scale(1.e-5);
01291     p->SetYTitle("Events #times 10^{5}");
01292     p->GetXaxis()->SetRangeUser(0.,15.);
01293     p->GetYaxis()->SetDecimals();
01294   }
01295 
01296   map<int, TString> names;
01297   names[kDQEnergyQ1]="0 < #theta < #pi/2";
01298   names[kDQEnergyQ2]="#pi/2 < #theta < #pi";
01299   names[kDQEnergyQ3]="#pi < #theta < 3#pi/2";
01300   names[kDQEnergyQ4]="3#pi/2 < #theta < 2#pi";
01301 
01302   names[kDQEnergyZ1]="1.73 < z < 2.73 m";
01303   names[kDQEnergyZ2]="2.73 < z < 3.73 m";
01304   names[kDQEnergyZ3]="3.73 < z < 4.73 m";
01305 
01306   names[kDQEnergyA1]="r_{vtx} < 0.5 m";
01307   names[kDQEnergyA2]="r_{vtx} > 0.5 m";
01308 
01309   DrawStabilityPlot(det, "quadrant", spectra, spectraMC, dblratios,
01310                     kDQEnergyQ1, kDQEnergyQ4, names);
01311   DrawStabilityPlot(det, "annuli", spectra, spectraMC, dblratios,
01312                     kDQEnergyA1, kDQEnergyA2, names);
01313   DrawStabilityPlot(det, "z", spectra, spectraMC, dblratios,
01314                     kDQEnergyZ1, kDQEnergyZ3, names);
01315 
01316 }

void NCDataQualityModule::DrawVertexPlots ( Detector::Detector_t  detector,
std::vector< double > &  x,
std::vector< double > &  y 
) [protected]

Definition at line 1563 of file NCDataQualityModule.cxx.

References bfld::AsString(), and MarkPrelim().

Referenced by DrawFarDataQualityPlots().

01566 {
01567   TString detstr = Detector::AsString(det);
01568 
01569   // We want this to be square, but because ROOT is an unutterably
01570   // stupid and useless bug-ridden mess, we can't use the constructor
01571   // that takes a "form" argument, like this:
01572   //
01573   // TCanvas *canv3 = new TCanvas(detstr+"VtxCanv", detstr+"VtxCanv", 2);
01574   //
01575   // because it just ignores this argument in batch mode. Instead, we have to do this:
01576 
01577   TCanvas *canv3 = new TCanvas(detstr+"VtxCanv",
01578                                detstr+"VtxCanv",
01579                                500, 500);
01580 
01581   TGraph *vtxGr = new TGraph(x.size(), &x[0], &y[0]);
01582   vtxGr->SetTitle("");
01583   vtxGr->SetName(detstr+"VtxYVsXGr");
01584   vtxGr->GetHistogram()->SetXTitle("x (m)");
01585   vtxGr->GetHistogram()->SetYTitle("y (m)");
01586   vtxGr->GetHistogram()->GetXaxis()->CenterTitle();
01587   vtxGr->GetHistogram()->GetYaxis()->CenterTitle();
01588   vtxGr->Write();
01589 
01590   float outlineY[] = {1.656, 4.00, 4.00, 1.656, -1.656,
01591                       -4.00, -4.00, -1.656, 1.656};
01592   float outlineX[] = {-4.00, -1.656, 1.656, 4.00, 4.00,
01593                       1.656, -1.656, -4.00, -4.00};
01594   TGraph *outline = new TGraph(9, outlineX, outlineY);
01595   outline->SetName("Detector_Outline");
01596   outline->SetTitle("Detector Outline");
01597   outline->GetHistogram()->SetXTitle("x (m)");
01598   outline->GetHistogram()->SetYTitle("y (m)");
01599   outline->GetHistogram()->GetXaxis()->CenterTitle();
01600   outline->GetHistogram()->GetYaxis()->CenterTitle();
01601 
01602   float outline1Y[] = {1.449, 3.50, 3.50, 1.449, -1.449,
01603                        -3.50, -3.50, -1.449, 1.449};
01604   float outline1X[] = {-3.50, -1.449, 1.449, 3.50, 3.50,
01605                        1.449, -1.449, -3.50, -3.50};
01606   TGraph *outline1 = new TGraph(9, outline1X, outline1Y);
01607   outline1->SetName("FV_Outline");
01608   outline1->SetTitle("Fiducial Volume");
01609   TArc *inner = new TArc(0., 0., 0.45);
01610 
01611   outline->Draw("al");
01612   outline1->Draw("l");
01613   outline1->SetLineColor(kRed);
01614   vtxGr->Draw("psame");
01615   inner->Draw();
01616 
01617   MarkPrelim(-3.5, 4);
01618 
01619   gDirectory->Append(canv3);
01620 }

void NCDataQualityModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 146 of file NCDataQualityModule.cxx.

References CombineDataQualityPlots(), DrawDataQualityPlots(), fFileName, JobCModule::GetConfig(), kDQData, kDQMC, kDQMCOsc, Detector::kFar, Msg::kInfo, Detector::kNear, MSG, Registry::Print(), and SetPOTValues().

00147 {
00148   GetConfig().SetName("config_registry");
00149   GetConfig().Print();
00150 
00151   CombineDataQualityPlots(Detector::kNear, kDQData);
00152   CombineDataQualityPlots(Detector::kNear, kDQMC);
00153   CombineDataQualityPlots(Detector::kFar,  kDQData);
00154   CombineDataQualityPlots(Detector::kFar,  kDQMC);
00155   CombineDataQualityPlots(Detector::kFar,  kDQMCOsc);
00156 
00157   SetPOTValues();
00158 
00159   TFile f(fFileName, "RECREATE");
00160   GetConfig().Write();
00161   DrawDataQualityPlots();
00162   f.Write();
00163   f.Close();
00164 
00165   MSG("NCDataQualityModule", Msg::kInfo) << "Output filename "
00166                                           << fFileName
00167                                           << endl;
00168 }

void NCDataQualityModule::FillDoubleRatios ( std::map< int, TGraphErrors * > &  nums,
std::map< int, TGraphErrors * > &  denoms,
std::map< int, TGraphErrors * > &  dblratios 
) [protected]

Referenced by DrawStabilityPlots().

void NCDataQualityModule::FindUncertainty ( double  value,
double &  uncertaintyLow,
double &  uncertaintyHigh 
) [protected]

determine the errors for each point based on poisson errors from Feldman and Cousins

Definition at line 1890 of file NCDataQualityModule.cxx.

Referenced by DrawEventRatePlots().

01893 {
01894   const double poissonErrorsUp[] = {1.29,  2.75,  4.25,  5.30,  6.78,
01895                                     7.81,  9.28, 10.30, 11.32, 12.79,
01896                                    13.81, 14.82, 16.29, 17.30, 18.32,
01897                                    19.32, 20.80, 21.81, 22.82, 23.82};
01898   const double poissonErrorsDown[] = {0.00,  0.37,  0.74,  1.10,  2.34,
01899                                       2.75,  3.82,  4.25,  5.30,  6.33,
01900                                       6.78,  7.81,  8.83,  9.28, 10.30,
01901                                      11.32, 12.33, 12.79, 13.81, 14.82};
01902 
01903   if(value > 19){
01904     uncertaintyLow = TMath::Sqrt(value);
01905     uncertaintyHigh = TMath::Sqrt(value);
01906   }
01907   else{
01908     uncertaintyHigh = poissonErrorsUp[int(value)]-value;
01909     uncertaintyLow = value - poissonErrorsDown[int(value)];
01910   }
01911 }

NCDataQualityPlot * NCDataQualityModule::GetDQPlot ( unsigned int  dist,
unsigned int  nccc,
unsigned int  datamc,
Detector::Detector_t  det,
unsigned int  intensity = kDQNominalIntensity 
) [protected]

Definition at line 218 of file NCDataQualityModule.cxx.

References CreateDQPlot(), fDQPlots, kDQMCOsc, kDQNumCombinations, kDQNumDatasets, kDQNumIntensities, kDQNumInteractions, Detector::kFar, and Detector::kNear.

Referenced by CombineDataQualityPlots(), DrawEventRatePlots(), DrawFarDataQualityPlots(), DrawFarTimingPlots(), DrawNearDataQualityPlots(), and DrawStabilityPlots().

00223 {
00224   // No-one should be trying to make ND oscillated MC.
00225   if(datamc == kDQMCOsc && det == Detector::kNear) return 0;
00226 
00227   assert(nccc < kDQNumInteractions);
00228   assert(datamc < kDQNumDatasets);
00229   assert(det == Detector::kNear || det == Detector::kFar);
00230   assert(intensity < kDQNumIntensities);
00231 
00232   // We are reliant on the actual numerical values of these, so check first.
00233   assert(Detector::kNear == 1 && Detector::kFar == 2);
00234   const unsigned int detOffset = det - 1;
00235 
00236   const unsigned int numDetectors = 2;
00237 
00238   const unsigned int totOffset = nccc +
00239                          kDQNumInteractions*datamc +
00240                          kDQNumInteractions*kDQNumDatasets*detOffset +
00241                          kDQNumInteractions*kDQNumDatasets*numDetectors*intensity +
00242                          kDQNumInteractions*kDQNumDatasets*numDetectors*kDQNumIntensities*dist;
00243 
00244   assert(totOffset < UInt_t(kDQNumCombinations));
00245 
00246   if(!fDQPlots[totOffset])
00247     fDQPlots[totOffset] = CreateDQPlot(dist, nccc, datamc, det, intensity);
00248 
00249   return fDQPlots[totOffset];
00250 }

TString NCDataQualityModule::GetFileTypeString ( Detector::Detector_t  det,
unsigned int  datamc 
) [protected]

Definition at line 427 of file NCDataQualityModule.cxx.

References fMockDataSet, fUseMCAsData, fUseMockData, kDQData, Detector::kFar, and Detector::kNear.

Referenced by CombineDataQualityPlots().

00429 {
00430   // In the case of data and...
00431   if(datamc == kDQData){
00432     // Nothing special is happening
00433     if(!fUseMCAsData && !fUseMockData){
00434       // In which case use data and blind for near and far respectively
00435       if(det == Detector::kNear) return "data"; else return "blind";
00436     }
00437 
00438     // Or we are using a mock data set of some sort in the far detector
00439     if(fUseMockData && det == Detector::kFar) return fMockDataSet;
00440   }
00441 
00442   // In all the other cases we use MC files
00443   return "mc";
00444 }

void NCDataQualityModule::GetNDSectionGraphs ( Detector::Detector_t  det,
int  datamc,
std::map< int, TGraphErrors * > &  spectra,
std::map< int, TGraphErrors * > &  ratios 
) [protected]

Referenced by DrawStabilityPlots().

void NCDataQualityModule::MarkPrelim ( double  x,
double  y 
) [protected]

Definition at line 1871 of file NCDataQualityModule.cxx.

References fFarPOTTotal, and Plot::Format().

Referenced by DrawEventRatePlots(), DrawFarDataQualityPlots(), DrawFarTimingPlots(), DrawNearDataQualityPlots(), and DrawVertexPlots().

01872 {
01873   static TLatex* latex = 0;
01874 
01875   if(!latex){
01876     latex = new TLatex();
01877     latex->SetName("Prelim");
01878     latex->SetTextSize(0.05);
01879     latex->SetTextColor(kBlue);
01880    }
01881 
01882   static const TString text = TString::Format("MINOS Preliminary: %3.2f #times 10^{20} POT",
01883                                               fFarPOTTotal/1e20);
01884 
01885   latex->DrawLatex(x, y, text);
01886 }

NCDataQualityModule& NCDataQualityModule::operator= ( const NCDataQualityModule  )  [private]
void NCDataQualityModule::SetPOTValues (  )  [protected]

Definition at line 194 of file NCDataQualityModule.cxx.

References NCPOTCounter::Config(), fBeamIndex, fFarPOTTotal, fNearPOTTotal, fRunsToUse, fUseMockData, JobCModule::GetConfig(), NCType::kBeamFile, NCType::kData, Detector::kFar, BeamType::kL010z185i, NCType::kMockFile, Detector::kNear, NC::RunUtil::kRunI, NC::RunUtil::kRunII, and NCPOTCounter::SetPOTValues().

Referenced by EndJob().

00195 {
00196   NCPOTCounter potcount;
00197 
00198   potcount.Config(GetConfig(), fBeamIndex, fRunsToUse);
00199 
00200   map<NCBeam::Info, double> dataPOTNear;
00201   map<NCBeam::Info, double> dataPOTFar;
00202 
00203   const NCType::EFileType fileType = fUseMockData ? NCType::kMockFile : NCType::kBeamFile;
00204 
00205   potcount.SetPOTValues(dataPOTNear, Detector::kNear,
00206                         NCType::kBeamFile, NCType::kData);
00207   potcount.SetPOTValues(dataPOTFar, Detector::kFar,
00208                         fileType, NCType::kData);
00209 
00210   const NCBeam::Info runI (BeamType::kL010z185i, NC::RunUtil::kRunI);
00211   const NCBeam::Info runII(BeamType::kL010z185i, NC::RunUtil::kRunII);
00212 
00213   fFarPOTTotal = dataPOTFar[runI] + dataPOTFar[runII];
00214   fNearPOTTotal = dataPOTNear[runI] + dataPOTNear[runII];
00215 }


Member Data Documentation

Definition at line 99 of file NCDataQualityModule.h.

Referenced by CombineDataQualityPlots(), Config(), and SetPOTValues().

TString NCDataQualityModule::fDataMCPath [protected]

path to uDST for data and MC files

Definition at line 98 of file NCDataQualityModule.h.

Referenced by CombineDataQualityPlots(), and Config().

This is the the array that GetDQPlot looks in.

Definition at line 94 of file NCDataQualityModule.h.

Referenced by GetDQPlot(), NCDataQualityModule(), and ~NCDataQualityModule().

Definition at line 117 of file NCDataQualityModule.h.

total exposure in far detector data

Definition at line 106 of file NCDataQualityModule.h.

Referenced by DrawFarDataQualityPlots(), MarkPrelim(), and SetPOTValues().

std::vector<double> NCDataQualityModule::fFarVtxX [protected]

Definition at line 122 of file NCDataQualityModule.h.

Referenced by CombineDataQualityPlots(), and DrawFarDataQualityPlots().

std::vector<double> NCDataQualityModule::fFarVtxXNC [protected]

Definition at line 124 of file NCDataQualityModule.h.

std::vector<double> NCDataQualityModule::fFarVtxY [protected]

Definition at line 123 of file NCDataQualityModule.h.

Referenced by CombineDataQualityPlots(), and DrawFarDataQualityPlots().

std::vector<double> NCDataQualityModule::fFarVtxYNC [protected]

Definition at line 125 of file NCDataQualityModule.h.

Definition at line 114 of file NCDataQualityModule.h.

Referenced by Config().

Definition at line 114 of file NCDataQualityModule.h.

Referenced by Config().

Definition at line 114 of file NCDataQualityModule.h.

Referenced by Config().

Definition at line 114 of file NCDataQualityModule.h.

Referenced by Config().

TString NCDataQualityModule::fFileName [protected]

Definition at line 119 of file NCDataQualityModule.h.

Referenced by Config(), and EndJob().

TString NCDataQualityModule::fMockDataSet [protected]

MDC run number designation.

Definition at line 104 of file NCDataQualityModule.h.

Referenced by Config(), and GetFileTypeString().

Definition at line 115 of file NCDataQualityModule.h.

Referenced by Config().

std::vector<double> NCDataQualityModule::fMonthlyNDPOT [protected]

Definition at line 101 of file NCDataQualityModule.h.

Referenced by CombineDataQualityPlots(), and DrawNearSpectra().

Definition at line 137 of file NCDataQualityModule.h.

Referenced by CombineDataQualityPlots(), and DrawNearDataQualityPlots().

Definition at line 136 of file NCDataQualityModule.h.

Referenced by CombineDataQualityPlots(), and DrawNearDataQualityPlots().

total exposure in near detector data

Definition at line 105 of file NCDataQualityModule.h.

Referenced by DrawNearDataQualityPlots(), and SetPOTValues().

std::vector<double> NCDataQualityModule::fNearVtxX [protected]

Definition at line 126 of file NCDataQualityModule.h.

Referenced by CombineDataQualityPlots().

std::vector<double> NCDataQualityModule::fNearVtxY [protected]

Definition at line 127 of file NCDataQualityModule.h.

Referenced by CombineDataQualityPlots().

Number of far MC uDSTs used.

Definition at line 108 of file NCDataQualityModule.h.

Referenced by CombineDataQualityPlots(), and DrawFarDataQualityPlots().

Number of near MC uDSTs used.

Definition at line 107 of file NCDataQualityModule.h.

Referenced by CombineDataQualityPlots(), and DrawNearDataQualityPlots().

<index of beams to use

Definition at line 100 of file NCDataQualityModule.h.

Referenced by CombineDataQualityPlots(), Config(), and SetPOTValues().

Definition at line 116 of file NCDataQualityModule.h.

Referenced by Config().

bool NCDataQualityModule::fUseCC [protected]

use the MC as data for testing purposes

Definition at line 102 of file NCDataQualityModule.h.

Referenced by Config(), and GetFileTypeString().

are you using mock data for the data?

Definition at line 103 of file NCDataQualityModule.h.

Referenced by Config(), GetFileTypeString(), and SetPOTValues().

bool NCDataQualityModule::fUseNC [protected]

The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1