#include <BMS_STND.h>
Public Member Functions | |
| BMS_STND () | |
| ~BMS_STND () | |
| void | Scan (VldTimeStamp begin=VldTimeStamp::GetBOT(), VldTimeStamp end=VldTimeStamp::GetEOT(), const char *folder="BMS_STND") |
| STND from begin to end and check each entry against BMS. | |
Walk STND entries and see how BeamMonSpill faires.
Created on: Mon Jul 11 18:43:25 2005
Definition at line 31 of file BMS_STND.h.
|
|
Definition at line 19 of file BMS_STND.cxx. 00020 {
00021 }
|
|
|
Definition at line 22 of file BMS_STND.cxx. 00023 {
00024 }
|
|
||||||||||||||||
|
STND from begin to end and check each entry against BMS.
Definition at line 26 of file BMS_STND.cxx. References HistMan::Book(), det, done(), BeamMonSpill::Fill(), BeamMonSpill::fTor101, BeamMonSpill::fTortgt, BeamMonSpill::fTr101d, BeamMonSpill::fTrtgtd, BDSpillAccessor::Get(), VldTimeStamp::GetEOT(), FileGap::GetFileBounds(), SpillTimeFinder::GetTimeOfNextSpill(), SpillTimeFinder::Instance(), BDSpillAccessor::LoadSpill(), BeamMonSpill::SpillTime(), and HistMan::WriteOut(). 00028 {
00029
00030 FileGap fg;
00031 FileGap::BoundList bounds = fg.GetFileBounds(begin_run,end_run);
00032
00033 int nfiles = bounds.size();
00034
00035 HistMan hm(folder);
00036 TProfile* h_dt_file =
00037 hm.Book<TProfile>("dt_file",
00038 "SpillTimeND - BeamMonSPill vs file",
00039 nfiles,0,nfiles);
00040 TH1F* h_missing_file =
00041 hm.Book<TH1F>("missing_file","Number BMS > .5 sec away from STND",
00042 nfiles,0,nfiles);
00043 TH1F* h_miss_per_file =
00044 hm.Book<TH1F>("miss_per_file","Percent BMS > .5 sec away from STND",
00045 nfiles,0,nfiles);
00046
00047
00048 TH1F* h_notor_file =
00049 hm.Book<TH1F>("notor_file","Number BMS < .5 sec away from STND, no toroids",
00050 nfiles,0,nfiles);
00051 TH1F* h_notor_per_file =
00052 hm.Book<TH1F>("notor_per_file","Percent BMS < .5 sec away from STND, no toroids",
00053 nfiles,0,nfiles);
00054
00055 TH1F* h_dt_in = hm.Book<TH1F>("dt_in","SpillTimeND - BeamMonSPill",
00056 2000,-0.1,0.1);
00057 TH1F* h_dt_out = hm.Book<TH1F>("dt_out","SpillTimeND - BeamMonSPill",
00058 2000,-10,10);
00059
00060
00061 SpillTimeFinder& stf = SpillTimeFinder::Instance();
00062 BDSpillAccessor& sa = BDSpillAccessor::Get();
00063
00064 Detector::Detector_t det = Detector::kNear;
00065 SimFlag::SimFlag_t simflag = SimFlag::kData;
00066
00067 VldTimeStamp numi_start(2005,1,1,0,0,0);
00068
00069
00070 FileGap::BoundList::iterator it, done = bounds.end();
00071
00072 int file=0;
00073 for (it = bounds.begin(); it != done; ++it) {
00074 int missing_bms=0;
00075 int no_toroids = 0;
00076
00077 VldTimeStamp beg = it->first;
00078 VldTimeStamp end = it->second;
00079
00080 cerr << beg << " --> " << end << endl;
00081
00082 VldTimeStamp vts = beg;
00083 int nspills = 0;
00084 while (vts <= end) {
00085 ++nspills;
00086 VldContext vc(det,simflag,vts);
00087
00088 VldTimeStamp stnd_vts = stf.GetTimeOfNextSpill(vc);
00089
00090 if (stnd_vts < numi_start) {
00091 cerr << "Bailing on file after " << nspills
00092 << " due to getting early SpillTimeND: "
00093 << stnd_vts
00094 << " last vts = " << vts
00095 << endl;
00096 break;
00097 }
00098
00099 const BeamMonSpill* bms = sa.LoadSpill(stnd_vts);
00100 VldTimeStamp bms_vts;
00101 if (!bms) {
00102 cerr << "No BeamMonSpill for " << stnd_vts << endl;
00103 bms_vts = VldTimeStamp::GetEOT();
00104 }
00105 else {
00106 bms_vts = bms->SpillTime();
00107 //cerr << stnd_vts << " - " << bms_vts
00108 // << " = " << (double)(stnd_vts-bms_vts)
00109 // << endl;
00110 }
00111
00112 double dt = stnd_vts-bms_vts;
00113 h_dt_in->Fill(dt);
00114 h_dt_out->Fill(dt);
00115 h_dt_file->Fill(file,dt);
00116
00117 if (fabs(dt)>0.5) {
00118 ++missing_bms;
00119 h_missing_file->Fill(file,1);
00120 }
00121
00122 if (bms->fTor101 == 0.0 && bms->fTr101d == 0.0 &&
00123 bms->fTortgt == 0.0 && bms->fTrtgtd == 0.0)
00124 {
00125 ++no_toroids;
00126 h_notor_file->Fill(file,1);
00127 }
00128
00129 if (vts >= stnd_vts) {
00130 cerr << "Error, infinite loop, bailing with\n\tbms= " << vts
00131 << " stnd= " << stnd_vts << endl;
00132 break;
00133 }
00134 vts = stnd_vts;
00135
00136 } // loop over one file
00137 if (missing_bms)
00138 cerr << "File " << file << " no BeamMonSpill "
00139 << missing_bms << " times\n";
00140
00141 h_miss_per_file->Fill(file,(1.0*missing_bms)/nspills);
00142 h_notor_per_file->Fill(file,(1.0*no_toroids)/nspills);
00143 ++file;
00144 }
00145
00146
00147 HistMan io("");
00148 io.WriteOut("bms_stnd.root");
00149 }
|
1.3.9.1