Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Cuts.cxx

Go to the documentation of this file.
00001 #include <cmath>
00002 
00003 #include "Cuts.h"
00004 
00005 #include <HistMan/HistMan.h>
00006 
00007 #include <BeamData/ana/bmnt/AcnetDevice.h>
00008 #include <BeamData/ana/bmnt/Knot.h>
00009 
00010 #include <TH1D.h>
00011 #include <TH2D.h>
00012 
00013 void Cuts::Book(PlotterManager& )
00014 {
00015     HistMan hm("cuts");
00016     hm.Book<TH1D>("tortgt","Proton intensity at E:TORTGT (x10^12 protons)",
00017                   100,0,10);
00018     hm.Book<TH1D>("tortgt_time","Time of E:TORTGT (from start of run 6067) (sec)",
00019                   108,-21600,21600);
00020     hm.Book<TH1D>("horncur","Horn Current, all quadrants (KAmp)",
00021                   40,-200,200);
00022 }
00023 
00024 // Check if timestamp is in the two runs we care about
00025 static bool tortgt_ok(PlotterManager& pm)
00026 {
00027     const int ti_6067 = 1106355930-1; // 2005-01-22 01:05:30 UCT
00028     const int tf_6067 = 1106362789+1; // 2005-01-22 02:59:49 UTC
00029     const int ti_6068 = 1106409473-1; // 2005-01-22 15:57:53 UTC
00030     const int tf_6068 = 1106420416+1; // 2005-01-22 19:00:16 UTC
00031 
00032     const AcnetDevice* tortgt = pm.GetKnot().GetDevice("E:TORTGT");
00033     if (!tortgt->ndata) return false;
00034 
00035     HistMan hm("cuts");
00036 
00037     hm.Fill1d("tortgt",tortgt->data[0]);
00038     if (tortgt->data[0] < 2.0) return false;
00039 
00040     int sec = tortgt->sec;
00041     hm.Fill1d("tortgt_time",sec-ti_6067+1);
00042 
00043     bool in_runs = ((sec>=ti_6067 && sec<=tf_6067) || (sec>=ti_6068 && sec<=tf_6068));
00044     return in_runs;
00045 }
00046 
00047 // Check if the horn current is decent
00048 static bool horn_off(PlotterManager& pm)
00049 {
00050     const char* hc[] = {
00051         "E:NSLINA",
00052         "E:NSLINB",
00053         "E:NSLINC",
00054         "E:NSLIND",
00055         0
00056     };
00057     double horn_current = 0;
00058     for (int ind = 0; hc[ind]; ++ind) {
00059         const AcnetDevice* ad = pm.GetKnot().GetDevice(hc[ind]);
00060         if (!ad->ndata) continue;
00061         horn_current += ad->data[0];
00062     }
00063     HistMan hm("cuts");
00064     hm.Fill1d("horncur",horn_current);
00065     return fabs(horn_current) < 175;
00066 }
00067 
00068 bool Cuts::Fill(PlotterManager& pm)
00069 {
00070     if (!tortgt_ok(pm)) return false;
00071 
00072     if (horn_off(pm)) return false;
00073      
00074     return true;
00075 }

Generated on Mon Feb 15 11:06:33 2010 for loon by  doxygen 1.3.9.1