StndBmsSpin Class Reference

BeamMonSpill / SpillTimeND comparison. More...

#include <StndBmsSpin.h>

List of all members.

Public Member Functions

 StndBmsSpin ()
 ~StndBmsSpin ()
void Scan (VldTimeStamp begin=VldTimeStamp::GetBOT(), VldTimeStamp end=VldTimeStamp::GetEOT(), const char *filename="stndbmsspin", const char *folder="StndBmsSpin")
 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
mdier
Version:
Revision
1.3
Date:
Date
2006/01/03 23:35:46

Contact: bv@bnl.gov

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

Id
StndBmsSpin.h,v 1.3 2006/01/03 23:35:46 mdier Exp

Definition at line 31 of file StndBmsSpin.h.


Constructor & Destructor Documentation

StndBmsSpin::StndBmsSpin (  ) 

Definition at line 24 of file StndBmsSpin.cxx.

00025 {
00026 }

StndBmsSpin::~StndBmsSpin (  ) 

Definition at line 27 of file StndBmsSpin.cxx.

00028 {
00029 }


Member Function Documentation

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

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

Definition at line 31 of file StndBmsSpin.cxx.

References VldTimeStamp::Add(), BeamMonSpill::BeamType(), HistMan::Book(), BeamMonSpill::BpmAtTarget(), BMSpillAna::Config(), det, done(), BeamMonSpill::fHornCur, Form(), BeamMonSpill::fProfWidX, BeamMonSpill::fProfWidY, BeamMonSpill::fTor101, BeamMonSpill::fTortgt, BeamMonSpill::fTr101d, BeamMonSpill::fTrtgtd, BDSpillAccessor::Get(), VldTimeStamp::GetEOT(), FileGap::GetFileBounds(), BoundsTracker::GetIndex(), VldTimeStamp::GetSeconds(), BeamMonSpill::GetStatusBits(), BoundsTracker::InFile(), SpillTimeFinder::Instance(), it, SimFlag::kData, Detector::kNear, BDSpillAccessor::LoadSpill(), Registry::LockValues(), Munits::mm, BMSpillAna::SelectSpill(), BMSpillAna::SetSpill(), BMSpillAna::SetTimeDiff(), BeamMonSpill::SpillTime(), Registry::UnLockValues(), and HistMan::WriteOut().

00033 {
00034 
00035     FileGap fg;
00036     FileGap::BoundList bounds = fg.GetFileBounds(begin_run,end_run,0.8);
00037     BoundsTracker btracker(bounds);
00038 
00039     int nfiles = bounds.size();
00040     double dt_period = end_run.GetSeconds()-begin_run.GetSeconds();
00041     int ndays = int(dt_period/86400);
00042     double day_end = begin_run.GetSeconds()+ndays*86400;
00043     
00044     HistMan hm(folder);
00045     TProfile* h_dt_file =
00046         hm.Book<TProfile>("dt_file",
00047                           "SpillTimeND - BeamMonSPill vs file",
00048                           nfiles,0,nfiles);
00049     TProfile* h_dt_day =
00050         hm.Book<TProfile>("dt_day",
00051                           "SpillTimeND - BeamMonSPill daily",
00052                           ndays,begin_run.GetSeconds(),day_end);
00053 
00054     TH2F* h_dt_in_period =
00055         hm.Book<TH2F>("h_dt_in_period",
00056                       "SpillTimeND - BeamMonSPill <1s",
00057                       432,begin_run.GetSeconds(),end_run.GetSeconds(),
00058                       10,0,1);
00059     TH2F* h_dt_out_period =
00060         hm.Book<TH2F>("h_dt_out_period",
00061                       "SpillTimeND - BeamMonSPill <1s",
00062                       432,begin_run.GetSeconds(),end_run.GetSeconds(),
00063                       10,0,10);
00064                       
00065     
00066     TH1F* h_missing_file =
00067         hm.Book<TH1F>("missing_file", "Number BMS > .5 sec away from STND",
00068                       nfiles,0,nfiles);
00069 
00070     TH1F* h_missing_day =
00071         hm.Book<TH1F>("missing_day", "Number BMS > .5 sec away from STND",
00072                       ndays,begin_run.GetSeconds(),day_end);
00073 
00074     TH1F* h_spills_lost =
00075         hm.Book<TH1F>("spills_lost",
00076                       "Number of STND with no file vs. prev file number",
00077                         nfiles,0,nfiles);
00078 
00079     TH1F* h_spills_lost_all =
00080         hm.Book<TH1F>("spills_lost_all",
00081                       "Number of STND with no file vs. prev file number, no time cut",
00082                         nfiles,0,nfiles);
00083 
00084     TH1F* h_notor_file =
00085         hm.Book<TH1F>("notor_file",
00086                       "Number BMS < .5 sec away from STND, no toroids",
00087                       nfiles,0,nfiles);
00088     
00089     TH1F* h_notor_day =
00090         hm.Book<TH1F>("notor_day",
00091                       "Number BMS < .5 sec away from STND, no toroids",
00092                       ndays,begin_run.GetSeconds(),day_end);
00093     
00094     TH1F* h_dt_in = hm.Book<TH1F>("dt_in","SpillTimeND - BeamMonSPill",
00095                                   2000,-0.1,0.1);
00096     TH1F* h_dt_out = hm.Book<TH1F>("dt_out","SpillTimeND - BeamMonSPill",
00097                                    2000,-10,10);
00098 
00099     TH1F* h_dt_out_nosel = hm.Book<TH1F>("dt_out_nosel","SpillTimeND - BeamMonSPill",
00100                                    2000,-10,10);
00101 
00102     
00103     TH1F* h_nspill_stnd_file =
00104         hm.Book<TH1F>("nspill_stnd_file",
00105                       "Number of spills in SpillTimeND per file ",
00106                       nfiles,0,nfiles);
00107     
00108     TH1F* h_nspill_stnd_day =
00109         hm.Book<TH1F>("nspill_stnd_day",
00110                       "Number of spills in SpillTimeND per day",
00111                       ndays,begin_run.GetSeconds(),day_end);
00112 
00113     TH1F* h_nspill_bmtime_file =
00114         hm.Book<TH1F>("nspill_bmtime_file",
00115                       "Number of spills BeamMon time  per file ",
00116                       nfiles,0,nfiles);
00117     
00118     TH1F* h_nspill_bmtime_day =
00119         hm.Book<TH1F>("nspill_bmtime_day",
00120                       "Number of spills BeamMon time per day",
00121                       ndays,begin_run.GetSeconds(),day_end);
00122 
00123     TH1F* h_ctor =
00124         hm.Book<TH1F>("ctor","Toroid protons on target",164,-1,40);
00125     TH1F* h_ctor_ac =
00126         hm.Book<TH1F>("ctor_ac","Toroid protons on target - after cuts",164,-1,40);
00127     TH1F* h_ctor_zero =
00128         hm.Book<TH1F>("ctor_zero","Toroid protons on target",200,-0.05,0.15);
00129     TH1F* h_ctor_bysel =
00130         hm.Book<TH1F>("ctor_bysel","Toroid protons on target - BMSpillAna Selected",164,-1.0,40);
00131     TH1F* h_ctor_bnsel =
00132         hm.Book<TH1F>("ctor_bnsel","Toroid protons on target - BMSPillAna Not Sel",164,-1.0,40);
00133     TH1F* h_ctortgt =
00134         hm.Book<TH1F>("ctortgt","Tortgt protons on target",164,-1,40);
00135     TH1F* h_ctortgt_zero =
00136         hm.Book<TH1F>("ctortgt_zero","Tortgt protons on target",200,-0.05,0.15);
00137 
00138     TH1F* h_nspill_wtor_file =
00139         hm.Book<TH1F>("nspill_wtor_file",
00140                       "Number of spills with good toroids per file ",
00141                       nfiles,0,nfiles);
00142     
00143     TH1F* h_nspill_wtor_day =
00144         hm.Book<TH1F>("nspill_wtor_day",
00145                       "Number of spills with good toroids per day",
00146                       ndays,begin_run.GetSeconds(),day_end);
00147 
00148     TH1F* h_npot_wtor_file =
00149         hm.Book<TH1F>("npot_wtor_file",
00150                       "Total PoT with good toroids per file ",
00151                       nfiles,0,nfiles);
00152     
00153     TH1F* h_npot_wtor_day =
00154         hm.Book<TH1F>("npot_wtor_day",
00155                       "Total PoT  with good toroids per day",
00156                       ndays,begin_run.GetSeconds(),day_end);
00157 
00158     //
00159     TH1F* h_nspill_ctor_file =
00160         hm.Book<TH1F>("nspill_ctor_file",
00161                       "Number of spills with good toroids intensity per file ",
00162                       nfiles,0,nfiles);
00163     
00164     TH1F* h_nspill_ctor_day =
00165         hm.Book<TH1F>("nspill_ctor_day",
00166                       "Number of spills with good toroids intensity per day",
00167                       ndays,begin_run.GetSeconds(),day_end);
00168 
00169     TH1F* h_npot_ctor_file =
00170         hm.Book<TH1F>("npot_ctor_file",
00171                       "Total PoT with good toroids intensity per file ",
00172                       nfiles,0,nfiles);
00173     
00174     TH1F* h_npot_ctor_day =
00175         hm.Book<TH1F>("npot_ctor_day",
00176                       "Total PoT  with good toroids intensity per day",
00177                       ndays,begin_run.GetSeconds(),day_end);
00178 
00179     //
00180     TH1F* h_chcur =
00181         hm.Book<TH1F>("chcur","Horn Current",840,-200,10);
00182     TH1F* h_chcur_zero =
00183         hm.Book<TH1F>("chcur_zero","Horn Current at zero",100,-1,1);
00184     TH1F* h_chcur_ac =
00185         hm.Book<TH1F>("chcur_ac","Horn Current - after cuts",840,-200,10);
00186     TH1F* h_chcur_bysel =
00187         hm.Book<TH1F>("chcur_bysel","Horn Current - BMSpillAna Selected",840,-200,10);
00188     TH1F* h_chcur_bnsel =
00189         hm.Book<TH1F>("chcur_bnsel","Horn Current - BMSpillAna Not Sel",840,-200,10);
00190     
00191     TH1F* h_nspill_chcur_file =
00192         hm.Book<TH1F>("nspill_chcur_file",
00193                       "Number of spills with good horn current per file ",
00194                       nfiles,0,nfiles);
00195     
00196     TH1F* h_nspill_chcur_day =
00197         hm.Book<TH1F>("nspill_chcur_day",
00198                       "Number of spills with good horn current per day",
00199                       ndays,begin_run.GetSeconds(),day_end);
00200 
00201     TH1F* h_npot_chcur_file =
00202         hm.Book<TH1F>("npot_chcur_file",
00203                       "Total PoT with good horn current per file ",
00204                       nfiles,0,nfiles);
00205     
00206     TH1F* h_npot_chcur_day =
00207         hm.Book<TH1F>("npot_chcur_day",
00208                       "Total PoT  with good horn current per day",
00209                       ndays,begin_run.GetSeconds(),day_end);
00210 
00211     //
00212     TH1F* h_ctgtin =
00213         hm.Book<TH1F>("ctgtin","Target in/out",2,0,2);
00214     TH1F* h_ctgtin_ac =
00215         hm.Book<TH1F>("ctgtin_ac","Target in/out - after cuts",2,0,2);
00216     TH1F* h_ctgtin_bysel =
00217         hm.Book<TH1F>("ctgtin_bysel","Target in/out - BMSpillAna Selected",2,0,2);
00218     TH1F* h_ctgtin_bnsel =
00219         hm.Book<TH1F>("ctgtin_bnsel","Target in/out - BMSpillAna Not Sel",2,0,2);
00220     
00221     TH1F* h_nspill_ctgtin_file =
00222         hm.Book<TH1F>("nspill_ctgtin_file",
00223                       "Number of spills with target in per file ",
00224                       nfiles,0,nfiles);
00225     
00226     TH1F* h_nspill_ctgtin_day =
00227         hm.Book<TH1F>("nspill_ctgtin_day",
00228                       "Number of spills with target in per day",
00229                       ndays,begin_run.GetSeconds(),day_end);
00230 
00231     TH1F* h_npot_ctgtin_file =
00232         hm.Book<TH1F>("npot_ctgtin_file",
00233                       "Total PoT with target in per file ",
00234                       nfiles,0,nfiles);
00235     
00236     TH1F* h_npot_ctgtin_day =
00237         hm.Book<TH1F>("npot_ctgtin_day",
00238                       "Total PoT with target in per day",
00239                       ndays,begin_run.GetSeconds(),day_end);
00240 
00241     //
00242     TH1F* h_cbpos_x =
00243         hm.Book<TH1F>("cbpos_x","Horizontal beam position",400,-5,5);
00244     TH1F* h_cbpos_x_ac =
00245         hm.Book<TH1F>("cbpos_x_ac","Horizontal beam position - after cuts",400,-5,5);
00246     TH1F* h_cbpos_x_zero =
00247         hm.Book<TH1F>("cbpos_x_zero","Horizontal beam position",400,-0.1,0.1);
00248     TH1F* h_cbpos_x_bysel =
00249         hm.Book<TH1F>("cbpos_x_bysel","Horizontal beam position - BMSpillAna Sel",400,-5,5);
00250     TH1F* h_cbpos_x_bnsel =
00251         hm.Book<TH1F>("cbpos_x_bnsel","Horizontal beam position - BMSpillAna Not Sel",400,-5,5);
00252 //
00253     TH1F* h_cbpos_y =
00254         hm.Book<TH1F>("cbpos_y","Vertical beam position",400,-5,5);
00255     TH1F* h_cbpos_y_ac =
00256         hm.Book<TH1F>("cbpos_y_ac","Vertical beam position - after cuts",400,-5,5);
00257     TH1F* h_cbpos_y_zero =
00258         hm.Book<TH1F>("cbpos_y_zero","Vertical beam position",400,-0.1,0.1);
00259     TH1F* h_cbpos_y_bysel =
00260         hm.Book<TH1F>("cbpos_y_bysel","Vertical beam position - BMSpillAna Sel",400,-5,5);
00261     TH1F* h_cbpos_y_bnsel =
00262         hm.Book<TH1F>("cbpos_y_bnsel","Vertical beam position - BMSpillAna Not Sel",400,-5,5);
00263     
00264     TH1F* h_nspill_cbpos_file =
00265         hm.Book<TH1F>("nspill_cbpos_file",
00266                       "Number of spills with good beam position per file ",
00267                       nfiles,0,nfiles);
00268     
00269     TH1F* h_nspill_cbpos_day =
00270         hm.Book<TH1F>("nspill_cbpos_day",
00271                       "Number of spills with good beam position per day",
00272                       ndays,begin_run.GetSeconds(),day_end);
00273 
00274     TH1F* h_npot_cbpos_file =
00275         hm.Book<TH1F>("npot_cbpos_file",
00276                       "Total PoT with good beam position per file ",
00277                       nfiles,0,nfiles);
00278     
00279     TH1F* h_npot_cbpos_day =
00280         hm.Book<TH1F>("npot_cbpos_day",
00281                       "Total PoT with good beam position per day",
00282                       ndays,begin_run.GetSeconds(),day_end);
00283 
00284     //
00285     TH1F* h_cbwid_x =
00286         hm.Book<TH1F>("cbwid_x","Horizontal beam width",500,0,5);
00287     TH1F* h_cbwid_x_ac =
00288         hm.Book<TH1F>("cbwid_x_ac","Horizontal beam width - after cuts",500,0,5);
00289     TH1F* h_cbwid_x_bysel =
00290         hm.Book<TH1F>("cbwid_x_bysel","Horizontal beam width - BMSpillAna Sel",500,0,5);
00291     TH1F* h_cbwid_x_bnsel =
00292         hm.Book<TH1F>("cbwid_x_bnsel","Horizontal beam width - BMSpillAna Not Sel",500,0,5);
00293     TH1F* h_cbwid_y =
00294         hm.Book<TH1F>("cbwid_y","Vertical beam width",500,0,5);
00295     TH1F* h_cbwid_y_ac =
00296         hm.Book<TH1F>("cbwid_y_ac","Vertical beam width - after cuts",500,0,5);
00297     TH1F* h_cbwid_y_bysel =
00298         hm.Book<TH1F>("cbwid_y_bysel","Vertical beam width - BMSpillAna Sel",500,0,5);
00299     TH1F* h_cbwid_y_bnsel =
00300         hm.Book<TH1F>("cbwid_y_bnsel","Vertical beam width - BMSpillAna Not Sel",500,0,5);
00301 
00302     TH1F* h_nspill_cbwid_file =
00303         hm.Book<TH1F>("nspill_cbwid_file",
00304                       "Number of spills with good beam width per file ",
00305                       nfiles,0,nfiles);
00306     
00307     TH1F* h_nspill_cbwid_day =
00308         hm.Book<TH1F>("nspill_cbwid_day",
00309                       "Number of spills with good beam width per day",
00310                       ndays,begin_run.GetSeconds(),day_end);
00311 
00312     TH1F* h_npot_cbwid_file =
00313         hm.Book<TH1F>("npot_cbwid_file",
00314                       "Total PoT with good beam width per file ",
00315                       nfiles,0,nfiles);
00316     
00317     TH1F* h_npot_cbwid_day =
00318         hm.Book<TH1F>("npot_cbwid_day",
00319                       "Total PoT with good beam width per day",
00320                       ndays,begin_run.GetSeconds(),day_end);
00321 
00322     TH1F* h_btyp =
00323         hm.Book<TH1F>("btyp","Beam Type",20,0,20);
00324     TH1F* h_btyp_db =
00325         hm.Book<TH1F>("btyp_db","Beam Monitoring Beam Type",
00326                       10,0,10);
00327     
00328     SpillTimeFinder& stf = SpillTimeFinder::Instance();
00329     BDSpillAccessor& sa = BDSpillAccessor::Get();
00330 
00331     Detector::Detector_t det = Detector::kNear;
00332     SimFlag::SimFlag_t simflag = SimFlag::kData;
00333 
00334     VldTimeStamp numi_start(2005,1,1,0,0,0);
00335     
00336 
00337     FileGap::BoundList::iterator it, done = bounds.end();
00338 
00339     VldTimeStamp vts = begin_run;
00340 
00341     // Check BMSpillAna too
00342     BMSpillAna bmsa;
00343     // change default values
00344     static Registry r;
00345     r.UnLockValues();
00346 //    r.Set("PosTgtXMax",-0.05*Munits::mm);
00347 //    r.Set("PosTgtYMin",0.05*Munits::mm);
00348 //    r.Set("HornCurMax",1e5*Munits::ampere);
00349 //    r.Set("HornCurMin",-1e5*Munits::ampere);
00350     r.LockValues();
00351     bmsa.Config(r);
00352 
00353     int nspill_all=0;
00354     int nspill_tot=0;
00355     int nspill_bmtime=0;
00356     int nspill_wtor=0;
00357     int nspill_ctor=0;
00358     int nspill_chcur=0;
00359     int nspill_ctgtin=0;
00360     int nspill_cbpos=0;
00361     int nspill_cbwid=0;
00362 //
00363     double pot_tot=0;
00364     double pot_ctor=0;
00365     double pot_chcur=0;
00366     double pot_ctgtin=0;
00367     double pot_cbpos=0;
00368     double pot_cbwid=0;
00369     double pot_tortgt_all=0;
00370     double pot_trtgtd_all=0;
00371     double pot_tor101_all=0;
00372     double pot_tr101d_all=0;
00373     while (vts <= end_run) {
00374 
00375         VldContext vc(det,simflag,vts);
00376         VldTimeStamp stnd_vts = stf.GetTimeOfNextSpill(vc);
00377 
00378         if (stnd_vts < numi_start) {
00379 //          cout << "Getting early SpillTimeND: "
00380 //               << stnd_vts << endl;
00381 //            cout << "Try adding 1s to last vts = " << vts
00382 //               << endl;
00383             vts.Add(1);
00384             continue;
00385         }
00386 
00387         ++nspill_all;
00388         // Check if this SpillTimeND is in a BeamMon file
00389         int in_file = btracker.InFile(stnd_vts);
00390         int file = btracker.GetIndex();
00391         int out_file = file;
00392         if (in_file < 0) --out_file; // want to know file before gap
00393         in_file = !in_file;     // !=0 now means vts is in a file
00394 
00395         const BeamMonSpill* bms = sa.LoadSpill(stnd_vts);
00396         VldTimeStamp bms_vts;
00397         if (!bms) {
00398             cerr << "No BeamMonSpill for " << stnd_vts << endl;
00399             bms_vts = VldTimeStamp::GetEOT();
00400         }
00401         else {
00402             bms_vts = bms->SpillTime();
00403         }
00404         double dt = stnd_vts-bms_vts;
00405 
00406         bmsa.SetSpill(*bms);
00407         bmsa.SetTimeDiff(dt);
00408         
00409         if (in_file) {          // stnd is w/in a file boundary
00410             nspill_tot++;
00411             h_dt_in->Fill(dt);
00412             h_dt_out->Fill(dt);
00413             h_dt_file->Fill(file,dt);
00414             h_dt_day->Fill(stnd_vts.GetSeconds(),dt);
00415 
00416             if (fabs(dt)>1.0) {
00417                 h_missing_file->Fill(file,1);
00418                 h_missing_day->Fill(stnd_vts.GetSeconds(),1);
00419                 h_dt_out_period->Fill(stnd_vts.GetSeconds(),fabs(dt));
00420             }
00421             else {
00422                 h_dt_in_period->Fill(stnd_vts.GetSeconds(),fabs(dt));
00423             }
00424             
00425             if (bms->fTor101 == 0.0 && bms->fTr101d == 0.0 &&
00426                 bms->fTortgt == 0.0 && bms->fTrtgtd == 0.0)
00427             {
00428                 h_notor_file->Fill(file,1);
00429                 h_notor_day->Fill(stnd_vts.GetSeconds(),1);
00430             }
00431 
00432             h_nspill_stnd_file->Fill(file);
00433             h_nspill_stnd_day->Fill(stnd_vts.GetSeconds());
00434 
00435 
00436             bool cut_pass = true;
00437             bool lowc_pass = true;
00438             if (fabs(dt)>1.0) {
00439                 cut_pass=false;
00440                 lowc_pass=false;
00441             }
00442             if (cut_pass){
00443                 nspill_bmtime++;
00444                 h_nspill_bmtime_file->Fill(file);
00445                 h_nspill_bmtime_day->Fill(stnd_vts.GetSeconds());
00446 
00447                 pot_tortgt_all+=bms->fTortgt;
00448                 pot_trtgtd_all+=bms->fTrtgtd;
00449                 pot_tor101_all+=bms->fTor101;
00450                 pot_tr101d_all+=bms->fTr101d;
00451 
00452                 h_btyp->Fill(bms->BeamType());
00453                 h_btyp_db->Fill(bms->GetStatusBits().beam_type);    
00454             }
00455             
00456             
00457             if (cut_pass && bms->fTor101 == 0.0 && bms->fTr101d == 0.0 &&
00458                 bms->fTortgt == 0.0 && bms->fTrtgtd == 0.0) cut_pass=false;
00459 
00460             float pot = 0;
00461             if (pot == 0) pot = bms->fTortgt;
00462             if (pot == 0) pot = bms->fTrtgtd;
00463             if (pot == 0) pot = bms->fTor101;
00464             if (pot == 0) pot = bms->fTr101d;
00465 
00466             if (lowc_pass){
00467                 h_ctor->Fill(pot);
00468                 h_ctor_zero->Fill(pot);
00469                 h_ctortgt->Fill(bms->fTortgt);
00470                 h_ctortgt_zero->Fill(bms->fTortgt);
00471             }
00472             
00473             if (cut_pass){
00474                 nspill_wtor++;
00475                 pot_tot+=pot;
00476                 h_nspill_wtor_file->Fill(file,1);
00477                 h_nspill_wtor_day->Fill(stnd_vts.GetSeconds(),1);
00478                 h_npot_wtor_file->Fill(file,pot);
00479                 h_npot_wtor_day->Fill(stnd_vts.GetSeconds(),pot);
00480             }
00481 
00482             if (cut_pass && (pot<0.5 || pot>50)) {
00483                 cut_pass=false;
00484                 lowc_pass=false;
00485             }
00486             if (cut_pass){
00487                 nspill_ctor++;
00488                 pot_ctor+=pot;
00489                 h_nspill_ctor_file->Fill(file,1);
00490                 h_nspill_ctor_day->Fill(stnd_vts.GetSeconds(),1);
00491                 h_npot_ctor_file->Fill(file,pot);
00492                 h_npot_ctor_day->Fill(stnd_vts.GetSeconds(),pot);
00493             }
00494 
00495             if (lowc_pass){
00496                 h_chcur->Fill(bms->fHornCur);
00497                 h_chcur_zero->Fill(bms->fHornCur);
00498             }
00499             if (cut_pass && (bms->fHornCur<-200 || bms->fHornCur>-155)) cut_pass=false;
00500             if (cut_pass){
00501                 nspill_chcur++;
00502                 pot_chcur+=pot;
00503                 h_nspill_chcur_file->Fill(file,1);
00504                 h_nspill_chcur_day->Fill(stnd_vts.GetSeconds(),1);
00505                 h_npot_chcur_file->Fill(file,pot);
00506                 h_npot_chcur_day->Fill(stnd_vts.GetSeconds(),pot);
00507             }
00508 
00509             if (lowc_pass){
00510                 h_ctgtin->Fill(bms->GetStatusBits().target_in);
00511             }
00512             if (cut_pass && bms->GetStatusBits().target_in==0) cut_pass=false;
00513             if (cut_pass){
00514                 nspill_ctgtin++;
00515                 pot_ctgtin+=pot;
00516                 h_nspill_ctgtin_file->Fill(file,1);
00517                 h_nspill_ctgtin_day->Fill(stnd_vts.GetSeconds(),1);
00518                 h_npot_ctgtin_file->Fill(file,pot);
00519                 h_npot_ctgtin_day->Fill(stnd_vts.GetSeconds(),pot);
00520             }
00521 
00522             Double_t xmean=0;
00523             Double_t ymean=0;
00524             Double_t xrms=0;
00525             Double_t yrms=0;
00526             bms->BpmAtTarget(xmean,ymean,xrms,yrms);
00527 
00528             if (lowc_pass){
00529                 h_cbpos_x->Fill(xmean/Munits::mm);
00530                 h_cbpos_y->Fill(ymean/Munits::mm);
00531                 h_cbpos_x_zero->Fill(xmean/Munits::mm);
00532                 h_cbpos_y_zero->Fill(ymean/Munits::mm);
00533             }
00534             if (cut_pass && (xmean<-2.0*Munits::mm || xmean>-0.05*Munits::mm) ) cut_pass=false;
00535             if (cut_pass && (ymean<0.05*Munits::mm  || ymean>2.0*Munits::mm) ) cut_pass=false;
00536             if (cut_pass){
00537                 nspill_cbpos++;
00538                 pot_cbpos+=pot;
00539                 h_nspill_cbpos_file->Fill(file,1);
00540                 h_nspill_cbpos_day->Fill(stnd_vts.GetSeconds(),1);
00541                 h_npot_cbpos_file->Fill(file,pot);
00542                 h_npot_cbpos_day->Fill(stnd_vts.GetSeconds(),pot);
00543             }
00544 
00545             if (lowc_pass){
00546                 h_cbwid_x->Fill(bms->fProfWidX/Munits::mm);
00547                 h_cbwid_y->Fill(bms->fProfWidY/Munits::mm);
00548             }
00549             
00550             if (cut_pass && bms->fProfWidX>1.5*Munits::mm) cut_pass=false;
00551             if (cut_pass && bms->fProfWidY>2.0*Munits::mm) cut_pass=false;
00552             if (cut_pass){
00553                 nspill_cbwid++;
00554                 pot_cbwid+=pot;
00555                 h_nspill_cbwid_file->Fill(file,1);
00556                 h_nspill_cbwid_day->Fill(stnd_vts.GetSeconds(),1);
00557                 h_npot_cbwid_file->Fill(file,pot);
00558                 h_npot_cbwid_day->Fill(stnd_vts.GetSeconds(),pot);
00559             }
00560 
00561             // plot quantities after all cuts
00562             if (cut_pass){
00563                 h_ctor_ac->Fill(pot);
00564                 h_chcur_ac->Fill(bms->fHornCur);
00565                 h_ctgtin_ac->Fill(bms->GetStatusBits().target_in);
00566                 h_cbpos_x_ac->Fill(xmean/Munits::mm);
00567                 h_cbpos_y_ac->Fill(ymean/Munits::mm);
00568                 h_cbwid_x_ac->Fill(bms->fProfWidX/Munits::mm);
00569                 h_cbwid_y_ac->Fill(bms->fProfWidY/Munits::mm);
00570             }
00571 
00572             if (bmsa.SelectSpill()){
00573                 //Fill histograms
00574                 h_ctor_bysel->Fill(pot);
00575                 h_chcur_bysel->Fill(bms->fHornCur);
00576                 h_ctgtin_bysel->Fill(bms->GetStatusBits().target_in);
00577                 h_cbpos_x_bysel->Fill(xmean/Munits::mm);
00578                 h_cbpos_y_bysel->Fill(ymean/Munits::mm);
00579                 h_cbwid_x_bysel->Fill(bms->fProfWidX/Munits::mm);
00580                 h_cbwid_y_bysel->Fill(bms->fProfWidY/Munits::mm);
00581             }
00582             else {
00583                 if (fabs(dt)<1.0) {
00584                 //Fill histograms
00585                     h_ctor_bnsel->Fill(pot);
00586                     h_chcur_bnsel->Fill(bms->fHornCur);
00587                     h_ctgtin_bnsel->Fill(bms->GetStatusBits().target_in);
00588                     h_cbpos_x_bnsel->Fill(xmean/Munits::mm);
00589                     h_cbpos_y_bnsel->Fill(ymean/Munits::mm);
00590                     h_cbwid_x_bnsel->Fill(bms->fProfWidX/Munits::mm);
00591                     h_cbwid_y_bnsel->Fill(bms->fProfWidY/Munits::mm);
00592                 }
00593             }
00594             
00595         }
00596         else {                  // not in a file
00597             if (fabs(dt)>1.0)   // remove edge effects
00598                 h_spills_lost->Fill(file,1);
00599 
00600             h_spills_lost_all->Fill(file,1);
00601             h_dt_out_nosel->Fill(dt);
00602 
00603         }
00604         
00605         if (vts >= stnd_vts) {
00606             cerr << "Error, infinite loop, bailing with\n\tbms= " << vts
00607                  << " stnd= " << stnd_vts << endl;
00608             break;
00609         }
00610         vts = stnd_vts;
00611             
00612     }
00613 
00614     cout << endl << "Summary statistics" << endl;
00615     cout << "==================" << endl << endl;
00616     if (nspill_all==0) cout << "No spill selected for this period" << endl;
00617     else {            
00618         printf("Total # of spills: %8d\n",nspill_all);
00619         printf("Tot in file bound: %8d\n",nspill_tot);
00620         if (nspill_tot>0) {
00621             printf("Good BeamMon time: %8d  (%7.3f%%)\n",nspill_bmtime,float(nspill_bmtime)/nspill_tot*100.0);
00622             printf("At least 1 toroid: %8d  (%7.3f%%)\n",nspill_wtor,float(nspill_wtor)/nspill_tot*100.0);
00623             printf("Good beam intens:  %8d  (%7.3f%%)\n",nspill_ctor,float(nspill_ctor)/nspill_tot*100.0);
00624             printf("Good horn current: %8d  (%7.3f%%)\n",nspill_chcur,float(nspill_chcur)/nspill_tot*100.0);
00625             printf("Target in:         %8d  (%7.3f%%)\n",nspill_ctgtin,float(nspill_ctgtin)/nspill_tot*100.0);
00626             printf("Good beam pos:     %8d  (%7.3f%%)\n",nspill_cbpos,float(nspill_cbpos)/nspill_tot*100.0);
00627             printf("Good beam width:   %8d  (%7.3f%%)\n",nspill_cbwid,float(nspill_cbwid)/nspill_tot*100.0);
00628         }
00629     }
00630 
00631     cout << endl;
00632     if (pot_tot==0) cout << "No PoT selected for this period" << endl;
00633     else {            
00634         printf("Total pot        : %5e\n",pot_tot);
00635         printf("Good beam intens:  %5e  (%7.3f%%)\n",pot_ctor,pot_ctor/pot_tot*100);
00636         printf("Good horn current: %5e  (%7.3f%%)\n",pot_chcur,pot_chcur/pot_tot*100);
00637         printf("Target in:         %5e  (%7.3f%%)\n",pot_ctgtin,pot_ctgtin/pot_tot*100);
00638         printf("Good beam pos:     %5e  (%7.3f%%)\n",pot_cbpos,pot_cbpos/pot_tot*100);
00639         printf("Good beam width:   %5e  (%7.3f%%)\n",pot_cbwid,pot_cbwid/pot_tot*100);
00640         cout << endl;
00641         printf("Sum of all tortgt:   %5e  \n",pot_tortgt_all);
00642         printf("Sum of all trtgtd:   %5e  \n",pot_trtgtd_all);
00643         printf("Sum of all tor101:   %5e  \n",pot_tor101_all);
00644         printf("Sum of all tr101d:   %5e  \n",pot_tr101d_all);
00645     }
00646     cout << endl;
00647     
00648     HistMan io("");
00649     io.WriteOut(Form("%s.root",filename));
00650 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1