STND_BMS Class Reference

BeamMonSpill / SpillTimeND comparison. More...

#include <STND_BMS.h>

List of all members.

Public Member Functions

 STND_BMS ()
 ~STND_BMS ()
void Scan (VldTimeStamp begin=VldTimeStamp::GetBOT(), VldTimeStamp end=VldTimeStamp::GetEOT(), const char *folder="STND_BMS")
 STND from begin to end and check each entry against BMS.

Detailed Description

BeamMonSpill / SpillTimeND comparison.

Walk STND entries and see how BeamMonSpill fairs.

Author:
(last to touch it)
Author
bv
Version:
Revision
1.2
Date:
Date
2005/12/15 22:06:32

Contact: bv@bnl.gov

Created on: Mon Jul 11 18:43:25 2005

Id
STND_BMS.h,v 1.2 2005/12/15 22:06:32 bv Exp

Definition at line 31 of file STND_BMS.h.


Constructor & Destructor Documentation

STND_BMS::STND_BMS (  ) 

Definition at line 19 of file STND_BMS.cxx.

00020 {
00021 }

STND_BMS::~STND_BMS (  ) 

Definition at line 22 of file STND_BMS.cxx.

00023 {
00024 }


Member Function Documentation

void STND_BMS::Scan ( VldTimeStamp  begin = VldTimeStamp::GetBOT(),
VldTimeStamp  end = VldTimeStamp::GetEOT(),
const char *  folder = "STND_BMS" 
)

STND from begin to end and check each entry against BMS.

Definition at line 26 of file STND_BMS.cxx.

References HistMan::Book(), det, done(), BeamMonSpill::fTor101, BeamMonSpill::fTortgt, BeamMonSpill::fTr101d, BeamMonSpill::fTrtgtd, BDSpillAccessor::Get(), VldTimeStamp::GetBOT(), VldTimeStamp::GetEOT(), FileGap::GetFileBounds(), SpillTimeFinder::Instance(), it, SimFlag::kData, Detector::kNear, BDSpillAccessor::LoadSpill(), BeamMonSpill::SpillTime(), and HistMan::WriteOut().

00028 {
00029 
00030     FileGap fg;
00031     FileGap::BoundList bounds = fg.GetFileBounds(begin_run,end_run);
00032     FileGap::Bound& first = bounds.front();
00033     if (first.first < begin_run) first.first = begin_run;
00034     FileGap::Bound& last = bounds.back();
00035     if (last.second > end_run) last.second = end_run;
00036 
00037     int nfiles = bounds.size();
00038 
00039     HistMan hm(folder);
00040     TProfile* h_dt_file =
00041         hm.Book<TProfile>("dt_file",
00042                           "SpillTimeND - BeamMonSPill vs file",
00043                           nfiles,0,nfiles);
00044     TH1F* h_missing_file =
00045         hm.Book<TH1F>("missing_file","Number BMS > .5 sec away from STND",
00046                       nfiles,0,nfiles);
00047     TH1F* h_miss_per_file =
00048         hm.Book<TH1F>("miss_per_file","Percent BMS > .5 sec away from STND",
00049                       nfiles,0,nfiles);
00050 
00051 
00052     TH1F* h_notor_file =
00053         hm.Book<TH1F>("notor_file","Number BMS < .5 sec away from STND, no toroids",
00054                       nfiles,0,nfiles);
00055     TH1F* h_notor_per_file =
00056         hm.Book<TH1F>("notor_per_file","Percent BMS < .5 sec away from STND, no toroids",
00057                       nfiles,0,nfiles);
00058     
00059     TH1F* h_dt_in = hm.Book<TH1F>("dt_in","SpillTimeND - BeamMonSPill",
00060                                   2000,-0.1,0.1);
00061     TH1F* h_dt_out = hm.Book<TH1F>("dt_out","SpillTimeND - BeamMonSPill",
00062                                    2000,-10,10);
00063 
00064     TH1F* h_rep_stnd = hm.Book<TH1F>("rep_stnd","Rep period for SpillTimeND",
00065                                      600,0,60);
00066     TH1F* h_rep_bms = hm.Book<TH1F>("rep_bms","Rep period for BeamMonSpill",
00067                                     600,0,60);
00068     
00069     SpillTimeFinder& stf = SpillTimeFinder::Instance();
00070     BDSpillAccessor& sa = BDSpillAccessor::Get();
00071 
00072     Detector::Detector_t det = Detector::kNear;
00073     SimFlag::SimFlag_t simflag = SimFlag::kData;
00074 
00075     VldTimeStamp numi_start(2005,1,1,0,0,0);
00076     
00077 
00078     FileGap::BoundList::iterator it, done = bounds.end();
00079 
00080     VldTimeStamp last_stnd(VldTimeStamp::GetBOT()), last_bms(VldTimeStamp::GetBOT());
00081 
00082     int file=0;
00083     for (it = bounds.begin(); it != done; ++it) {
00084         int missing_stnd=0;
00085         int no_toroids = 0;
00086         
00087         VldTimeStamp beg = it->first;
00088         VldTimeStamp end = it->second;
00089 
00090         cerr << beg << " --> " << end << endl;
00091 
00092         VldTimeStamp vts = beg;
00093         int nspills = 0;
00094 
00095         while (vts <= end) {
00096             ++nspills;
00097 
00098             const BeamMonSpill* bms = sa.LoadSpill(vts,+1);
00099             VldTimeStamp bms_vts;
00100             if (!bms) {
00101                 cerr << "No BeamMonSpill for " << vts << endl;
00102                 bms_vts = VldTimeStamp::GetEOT();
00103             }
00104             else bms_vts = bms->SpillTime();
00105 
00106             VldContext vc(det,simflag,bms_vts);
00107             VldTimeStamp stnd_vts = stf.GetTimeOfNearestSpill(vc);
00108 
00109             if (stnd_vts < numi_start) {
00110                 cerr << "Bailing on file after " << nspills
00111                      << " due to getting early SpillTimeND: "
00112                      << stnd_vts
00113                      << " last vts = " << vts
00114                      << endl;
00115                 break;
00116             }
00117 
00118             h_rep_stnd->Fill(stnd_vts-last_stnd);
00119             h_rep_bms->Fill(bms_vts-last_bms);
00120 
00121             last_stnd = stnd_vts;
00122             last_bms  =  bms_vts;
00123 
00124             double dt = stnd_vts-bms_vts;
00125             h_dt_in->Fill(dt);
00126             h_dt_out->Fill(dt);
00127             h_dt_file->Fill(file,dt);
00128 
00129             if (fabs(dt)>0.5) {
00130                 ++missing_stnd;
00131                 h_missing_file->Fill(file,1);
00132             }
00133 
00134             if (bms->fTor101 == 0.0 && bms->fTr101d == 0.0 &&
00135                 bms->fTortgt == 0.0 && bms->fTrtgtd == 0.0)
00136             {
00137                 ++no_toroids;
00138                 h_notor_file->Fill(file,1);
00139             }
00140 
00141             if (vts >= stnd_vts) {
00142                 cerr << "Error, infinite loop, bailing with\n\tbms= " << vts
00143                      << " stnd= " << stnd_vts << endl;
00144                 break;
00145             }
00146             vts = bms_vts;
00147             
00148         } // loop over one file
00149         if (missing_stnd)
00150             cerr << "File " << file << " no SpillTimeND "
00151                  << missing_stnd << " times\n";
00152 
00153         h_miss_per_file->Fill(file,(1.0*missing_stnd)/nspills);
00154         h_notor_per_file->Fill(file,(1.0*no_toroids)/nspills);
00155         ++file;
00156     }
00157 
00158 
00159     HistMan io("");
00160     io.WriteOut("stnd_bms.root");
00161 }


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1