NuBeam Class Reference

#include <NuBeam.h>

List of all members.

Public Member Functions

 NuBeam ()
 ~NuBeam ()
Bool_t IsGoodSpillAndFillPot (const NtpBDLiteRecord *recBD, const NuConfig &config, NuEvent &nu) const

Detailed Description

Definition at line 16 of file NuBeam.h.


Constructor & Destructor Documentation

NuBeam::NuBeam (  ) 

Definition at line 35 of file NuBeam.cxx.

References Msg::kDebug, and MSG.

00036 {
00037   MSG("NuBeam",Msg::kDebug)
00038     <<"Running NuBeam Constructor..."<<endl;
00039 
00040 
00041   MSG("NuBeam",Msg::kDebug)
00042     <<"Finished NuBeam Constructor"<<endl;
00043 }

NuBeam::~NuBeam (  ) 

Definition at line 47 of file NuBeam.cxx.

References Msg::kDebug, and MSG.

00048 {
00049   MSG("NuBeam",Msg::kDebug)
00050     <<"Running NuBeam Destructor..."<<endl;
00051   
00052 
00053   MSG("NuBeam",Msg::kDebug)
00054     <<"Finished NuBeam Destructor"<<endl;
00055 }


Member Function Documentation

Bool_t NuBeam::IsGoodSpillAndFillPot ( const NtpBDLiteRecord recBD,
const NuConfig config,
NuEvent nu 
) const

This function makes plots/counts the POTs NOTE: in order to get POT counting right when the coil is bad then the coil information has to be obtained before running this function

Definition at line 59 of file NuBeam.cxx.

References bfld::AsString(), BeamMonSpill::BeamType(), NuConfig::beamType, BeamMonSpill::BpmAtTarget(), NtpBDLiteRecord::bpmint, NtpBDLiteRecord::bposx, NtpBDLiteRecord::bposy, NtpBDLiteRecord::bwidx, NtpBDLiteRecord::bwidy, NuEvent::coilIsOk, BMSpillAna::Config(), NuConfig::detector, RecRecordImp< T >::GetHeader(), MCInfo::GetMCPoT(), MCInfo::GetNoSnarlPerFile(), BMSpillAna::GetSpill(), BeamMonSpill::GetStatusBits(), BeamDataLiteHeader::GetTimeDiffStreamSpill(), NuEvent::goodBeamSntp, NtpBDLiteRecord::horncur, NuConfig::hornCurrent, NuEvent::isGoodDataQuality, SimFlag::kData, Msg::kDebug, Msg::kError, Detector::kFar, Msg::kInfo, BeamType::kL010z170i, BeamType::kL010z185i, BeamType::kL010z200i, Msg::kWarning, Registry::LockValues(), MAXMSG, NuConfig::mcVersion, Munits::mm, MSG, n, NuEvent::pot, Registry::PrettyPrint(), BMSpillAna::Print(), NuUtilities::ReturnConventionsBeamType(), NuConfig::run, NuConfig::runPeriod, BMSpillAna::SelectSpill(), Registry::Set(), BMSpillAna::SetSpill(), NuConfig::simFlag, NtpBDLiteRecord::tor101, NtpBDLiteRecord::tortgt, NtpBDLiteRecord::tr101d, NtpBDLiteRecord::trtgtd, Registry::UnLockValues(), BMSpillAna::UseDatabaseCuts(), and NuEvent::useDBForDataQuality.

Referenced by NuAnalysis::ChargeSeparationOneSnarl(), NuAnalysis::ChargeSignCut(), NuAnalysis::Efficiencies(), NuAnalysis::EnergySpect(), NuAnalysis::LIRejectionTest(), NuAnalysis::MakeFullDST(), NuAnalysis::N_1(), and NuAnalysis::NuMuBarAppearance().

00062 {
00067 
00068   static TH1F* hPottor101=0;
00069   static TH1F* hPottr101d=0;
00070   static TH1F* hPottortgt=0;
00071   static TH1F* hPottrtgtd=0;
00072 
00073   //good pot
00074   static TH1F* hPotGoodtor101=0;
00075   static TH1F* hPotGoodtr101d=0;
00076   static TH1F* hPotGoodtortgt=0;
00077   static TH1F* hPotGoodtrtgtd=0;
00078 
00079   //bad pot
00080   static TH1F* hPotBadtor101=0;
00081   static TH1F* hPotBadtr101d=0;
00082   static TH1F* hPotBadtortgt=0;
00083   static TH1F* hPotBadtrtgtd=0;
00084   
00085   //horncur, etc
00086   static TH1F* hHorncur=0;
00087   static TH1F* hHorncurBad=0;
00088   static TH1F* hBwidx=0;
00089   static TH1F* hBwidxBad=0;
00090   static TH1F* hBwidy=0;
00091   static TH1F* hBwidyBad=0;
00092   static TH1F* hBposx=0;
00093   static TH1F* hBposxBad=0;
00094   static TH1F* hBposy=0;
00095   static TH1F* hBposyBad=0;
00096   static TH1F* hBpmint=0;
00097   static TH1F* hBpmintBad=0;
00098 
00099   static TH1F* hAvBposx=0;
00100   static TH1F* hAvBposxBad=0;
00101   static TH1F* hAvBposy=0;
00102   static TH1F* hAvBposyBad=0;
00103 
00104   static TH1F* hDeltaBposx=0;
00105   static TH1F* hDeltaBposxBad=0;
00106   static TH1F* hDeltaBposy=0;
00107   static TH1F* hDeltaBposyBad=0;
00108 
00109   static TH1F* hBDTimeDiff=0;
00110   static TH1F* hBDTimeDiffBad=0;
00111   static TH1F* hBDTimeDiffBadBad=0;
00112 
00113   static TH1F* hBeamType=0;
00114   static TH1F* hBeamTypeBad=0;
00115   static TH1F* hTargetIn=0;
00116   static TH1F* hTargetInBad=0;
00117 
00118   static TH1F* hSpillsPerFile=0;
00119   
00120   if (!hPottor101){
00121     MAXMSG("NuBeam",Msg::kDebug,1)
00122       <<"Creating POT plots..."<<endl;
00123     
00124     //these 1st four POT histograms also take into account the coil
00125     //the PotGood histos below are for all spills where the beam
00126     //was good (regardless of the coil)
00127     hPottor101=new TH1F("hPottor101","hPottor101",100000,-10,90);
00128     hPottor101->GetXaxis()->SetTitle("POT (x10^{12})");
00129     hPottor101->GetXaxis()->CenterTitle();
00130     hPottor101->GetYaxis()->SetTitle("");
00131     hPottor101->GetYaxis()->CenterTitle();
00132     hPottor101->SetFillColor(0);
00133     hPottor101->SetLineColor(1);
00134     //hPottor101->SetBit(TH1::kCanRebin);
00135 
00136     hPottr101d=new TH1F("hPottr101d","hPottr101d",100000,-10,90);
00137     hPottr101d->GetXaxis()->SetTitle("POT (x10^{12})");
00138     hPottr101d->GetXaxis()->CenterTitle();
00139     hPottr101d->GetYaxis()->SetTitle("");
00140     hPottr101d->GetYaxis()->CenterTitle();
00141     hPottr101d->SetFillColor(0);
00142     hPottr101d->SetLineColor(1);
00143     //hPottr101d->SetBit(TH1::kCanRebin);
00144 
00145     hPottortgt=new TH1F("hPottortgt","hPottortgt",100000,-10,90);
00146     hPottortgt->GetXaxis()->SetTitle("POT (x10^{12})");
00147     hPottortgt->GetXaxis()->CenterTitle();
00148     hPottortgt->GetYaxis()->SetTitle("");
00149     hPottortgt->GetYaxis()->CenterTitle();
00150     hPottortgt->SetFillColor(0);
00151     hPottortgt->SetLineColor(1);
00152     //hPottortgt->SetBit(TH1::kCanRebin);
00153 
00154     hPottrtgtd=new TH1F("hPottrtgtd","hPottrtgtd",100000,-10,90);
00155     hPottrtgtd->GetXaxis()->SetTitle("POT (x10^{12})");
00156     hPottrtgtd->GetXaxis()->CenterTitle();
00157     hPottrtgtd->GetYaxis()->SetTitle("");
00158     hPottrtgtd->GetYaxis()->CenterTitle();
00159     hPottrtgtd->SetFillColor(0);
00160     hPottrtgtd->SetLineColor(1);
00161     //hPottrtgtd->SetBit(TH1::kCanRebin);
00162 
00163     
00164     //Good POT
00165     hPotGoodtor101=new TH1F("hPotGoodtor101","hPotGoodtor101",
00166                            100000,-10,90);
00167     hPotGoodtor101->GetXaxis()->SetTitle("POT (x10^{12})");
00168     hPotGoodtor101->GetXaxis()->CenterTitle();
00169     hPotGoodtor101->GetYaxis()->SetTitle("");
00170     hPotGoodtor101->GetYaxis()->CenterTitle();
00171     hPotGoodtor101->SetFillColor(0);
00172     hPotGoodtor101->SetLineColor(1);
00173     //hPotGoodtor101->SetBit(TH1::kCanRebin);
00174 
00175     hPotGoodtr101d=new TH1F("hPotGoodtr101d","hPotGoodtr101d",
00176                            100000,-10,90);
00177     hPotGoodtr101d->GetXaxis()->SetTitle("POT (x10^{12})");
00178     hPotGoodtr101d->GetXaxis()->CenterTitle();
00179     hPotGoodtr101d->GetYaxis()->SetTitle("");
00180     hPotGoodtr101d->GetYaxis()->CenterTitle();
00181     hPotGoodtr101d->SetFillColor(0);
00182     hPotGoodtr101d->SetLineColor(1);
00183     //hPotGoodtr101d->SetBit(TH1::kCanRebin);
00184 
00185     hPotGoodtortgt=new TH1F("hPotGoodtortgt","hPotGoodtortgt",
00186                            100000,-10,90);
00187     hPotGoodtortgt->GetXaxis()->SetTitle("POT (x10^{12})");
00188     hPotGoodtortgt->GetXaxis()->CenterTitle();
00189     hPotGoodtortgt->GetYaxis()->SetTitle("");
00190     hPotGoodtortgt->GetYaxis()->CenterTitle();
00191     hPotGoodtortgt->SetFillColor(0);
00192     hPotGoodtortgt->SetLineColor(1);
00193     //hPotGoodtortgt->SetBit(TH1::kCanRebin);
00194 
00195     hPotGoodtrtgtd=new TH1F("hPotGoodtrtgtd","hPotGoodtrtgtd",
00196                            100000,-10,90);
00197     hPotGoodtrtgtd->GetXaxis()->SetTitle("POT (x10^{12})");
00198     hPotGoodtrtgtd->GetXaxis()->CenterTitle();
00199     hPotGoodtrtgtd->GetYaxis()->SetTitle("");
00200     hPotGoodtrtgtd->GetYaxis()->CenterTitle();
00201     hPotGoodtrtgtd->SetFillColor(0);
00202     hPotGoodtrtgtd->SetLineColor(1);
00203     //hPotGoodtrtgtd->SetBit(TH1::kCanRebin);
00204 
00205 
00206     //bad POT
00207     hPotBadtor101=new TH1F("hPotBadtor101","hPotBadtor101",
00208                            100000,-10,90);
00209     hPotBadtor101->GetXaxis()->SetTitle("POT (x10^{12})");
00210     hPotBadtor101->GetXaxis()->CenterTitle();
00211     hPotBadtor101->GetYaxis()->SetTitle("");
00212     hPotBadtor101->GetYaxis()->CenterTitle();
00213     hPotBadtor101->SetFillColor(0);
00214     hPotBadtor101->SetLineColor(1);
00215     //hPotBadtor101->SetBit(TH1::kCanRebin);
00216 
00217     hPotBadtr101d=new TH1F("hPotBadtr101d","hPotBadtr101d",
00218                            100000,-10,90);
00219     hPotBadtr101d->GetXaxis()->SetTitle("POT (x10^{12})");
00220     hPotBadtr101d->GetXaxis()->CenterTitle();
00221     hPotBadtr101d->GetYaxis()->SetTitle("");
00222     hPotBadtr101d->GetYaxis()->CenterTitle();
00223     hPotBadtr101d->SetFillColor(0);
00224     hPotBadtr101d->SetLineColor(1);
00225     //hPotBadtr101d->SetBit(TH1::kCanRebin);
00226 
00227     hPotBadtortgt=new TH1F("hPotBadtortgt","hPotBadtortgt",
00228                            100000,-10,90);
00229     hPotBadtortgt->GetXaxis()->SetTitle("POT (x10^{12})");
00230     hPotBadtortgt->GetXaxis()->CenterTitle();
00231     hPotBadtortgt->GetYaxis()->SetTitle("");
00232     hPotBadtortgt->GetYaxis()->CenterTitle();
00233     hPotBadtortgt->SetFillColor(0);
00234     hPotBadtortgt->SetLineColor(1);
00235     //hPotBadtortgt->SetBit(TH1::kCanRebin);
00236 
00237     hPotBadtrtgtd=new TH1F("hPotBadtrtgtd","hPotBadtrtgtd",
00238                            100000,-10,90);
00239     hPotBadtrtgtd->GetXaxis()->SetTitle("POT (x10^{12})");
00240     hPotBadtrtgtd->GetXaxis()->CenterTitle();
00241     hPotBadtrtgtd->GetYaxis()->SetTitle("");
00242     hPotBadtrtgtd->GetYaxis()->CenterTitle();
00243     hPotBadtrtgtd->SetFillColor(0);
00244     hPotBadtrtgtd->SetLineColor(1);
00245     //hPotBadtrtgtd->SetBit(TH1::kCanRebin);
00246 
00247 
00248     //horn current
00249     hHorncur=new TH1F("hHorncur","hHorncur",
00250                       1000,-250,250);
00251     hHorncur->GetXaxis()->SetTitle("Horn Current");
00252     hHorncur->GetXaxis()->CenterTitle();
00253     hHorncur->GetYaxis()->SetTitle("");
00254     hHorncur->GetYaxis()->CenterTitle();
00255     hHorncur->SetFillColor(0);
00256     hHorncur->SetLineColor(1);
00257     //hHorncur->SetBit(TH1::kCanRebin);
00258 
00259     hHorncurBad=new TH1F("hHorncurBad","hHorncurBad",
00260                          1000,-250,250);
00261     hHorncurBad->GetXaxis()->SetTitle("Horn Current");
00262     hHorncurBad->GetXaxis()->CenterTitle();
00263     hHorncurBad->GetYaxis()->SetTitle("");
00264     hHorncurBad->GetYaxis()->CenterTitle();
00265     hHorncurBad->SetFillColor(0);
00266     hHorncurBad->SetLineColor(1);
00267     //hHorncurBad->SetBit(TH1::kCanRebin);
00268 
00269 
00270 
00271     hBwidx=new TH1F("hBwidx","hBwidx",
00272                     1000,-0.002,0.01);
00273     hBwidx->GetXaxis()->SetTitle("Beam Width x");
00274     hBwidx->GetXaxis()->CenterTitle();
00275     hBwidx->GetYaxis()->SetTitle("");
00276     hBwidx->GetYaxis()->CenterTitle();
00277     hBwidx->SetFillColor(0);
00278     hBwidx->SetLineColor(1);
00279     //hBwidx->SetBit(TH1::kCanRebin);
00280 
00281     hBwidxBad=new TH1F("hBwidxBad","hBwidxBad",
00282                        1000,-0.002,0.01);
00283     hBwidxBad->GetXaxis()->SetTitle("Beam Width x");
00284     hBwidxBad->GetXaxis()->CenterTitle();
00285     hBwidxBad->GetYaxis()->SetTitle("");
00286     hBwidxBad->GetYaxis()->CenterTitle();
00287     hBwidxBad->SetFillColor(0);
00288     hBwidxBad->SetLineColor(1);
00289     //hBwidxBad->SetBit(TH1::kCanRebin);
00290 
00291     hBwidy=new TH1F("hBwidy","hBwidy",
00292                     1000,-0.002,0.01);
00293     hBwidy->GetXaxis()->SetTitle("Beam Width y");
00294     hBwidy->GetXaxis()->CenterTitle();
00295     hBwidy->GetYaxis()->SetTitle("");
00296     hBwidy->GetYaxis()->CenterTitle();
00297     hBwidy->SetFillColor(0);
00298     hBwidy->SetLineColor(1);
00299     //hBwidy->SetBit(TH1::kCanRebin);
00300 
00301     hBwidyBad=new TH1F("hBwidyBad","hBwidyBad",
00302                        1000,-0.002,0.01);
00303     hBwidyBad->GetXaxis()->SetTitle("Beam Width y");
00304     hBwidyBad->GetXaxis()->CenterTitle();
00305     hBwidyBad->GetYaxis()->SetTitle("");
00306     hBwidyBad->GetYaxis()->CenterTitle();
00307     hBwidyBad->SetFillColor(0);
00308     hBwidyBad->SetLineColor(1);
00309     //hBwidyBad->SetBit(TH1::kCanRebin);
00310 
00311 
00312     //beam intensity per batch
00313     hBpmint=new TH1F("hBpmint","hBpmint",
00314                      2010,-10,2000);
00315     hBpmint->GetXaxis()->SetTitle("Beam intensity");
00316     hBpmint->GetXaxis()->CenterTitle();
00317     hBpmint->GetYaxis()->SetTitle("");
00318     hBpmint->GetYaxis()->CenterTitle();
00319     hBpmint->SetFillColor(0);
00320     hBpmint->SetLineColor(1);
00321     //hBpmint->SetBit(TH1::kCanRebin);
00322     
00323     hBpmintBad=new TH1F("hBpmintBad","hBpmintBad",
00324                         2010,-10,2000);
00325     hBpmintBad->GetXaxis()->SetTitle("Beam intensity");
00326     hBpmintBad->GetXaxis()->CenterTitle();
00327     hBpmintBad->GetYaxis()->SetTitle("");
00328     hBpmintBad->GetYaxis()->CenterTitle();
00329     hBpmintBad->SetFillColor(0);
00330     hBpmintBad->SetLineColor(1);
00331     //hBpmintBad->SetBit(TH1::kCanRebin);
00332 
00333 
00334     hBposx=new TH1F("hBposx","hBposx",
00335                     5000,-0.01,0.01);
00336     hBposx->GetXaxis()->SetTitle("Beam Position x");
00337     hBposx->GetXaxis()->CenterTitle();
00338     hBposx->GetYaxis()->SetTitle("");
00339     hBposx->GetYaxis()->CenterTitle();
00340     hBposx->SetFillColor(0);
00341     hBposx->SetLineColor(1);
00342     //hBposx->SetBit(TH1::kCanRebin);
00343 
00344     hBposxBad=new TH1F("hBposxBad","hBposxBad",
00345                        5000,-0.01,0.01);
00346     hBposxBad->GetXaxis()->SetTitle("Beam Position x");
00347     hBposxBad->GetXaxis()->CenterTitle();
00348     hBposxBad->GetYaxis()->SetTitle("");
00349     hBposxBad->GetYaxis()->CenterTitle();
00350     hBposxBad->SetFillColor(0);
00351     hBposxBad->SetLineColor(1);
00352     //hBposxBad->SetBit(TH1::kCanRebin);
00353 
00354     hBposy=new TH1F("hBposy","hBposy",
00355                     5000,-0.01,0.01);//
00356     hBposy->GetXaxis()->SetTitle("Beam Position y");
00357     hBposy->GetXaxis()->CenterTitle();
00358     hBposy->GetYaxis()->SetTitle("");
00359     hBposy->GetYaxis()->CenterTitle();
00360     hBposy->SetFillColor(0);
00361     hBposy->SetLineColor(1);
00362     //hBposy->SetBit(TH1::kCanRebin);
00363 
00364     hBposyBad=new TH1F("hBposyBad","hBposyBad",
00365                        5000,-0.01,0.01);
00366     hBposyBad->GetXaxis()->SetTitle("Beam Position y");
00367     hBposyBad->GetXaxis()->CenterTitle();
00368     hBposyBad->GetYaxis()->SetTitle("");
00369     hBposyBad->GetYaxis()->CenterTitle();
00370     hBposyBad->SetFillColor(0);
00371     hBposyBad->SetLineColor(1);
00372     //hBposyBad->SetBit(TH1::kCanRebin);
00373 
00374 
00375 
00376     hAvBposx=new TH1F("hAvBposx","hAvBposx",
00377                     5000,-0.01,0.01);
00378     hAvBposx->GetXaxis()->SetTitle("Av. Beam Position x");
00379     hAvBposx->GetXaxis()->CenterTitle();
00380     hAvBposx->GetYaxis()->SetTitle("");
00381     hAvBposx->GetYaxis()->CenterTitle();
00382     hAvBposx->SetFillColor(0);
00383     hAvBposx->SetLineColor(1);
00384     //hAvBposx->SetBit(TH1::kCanRebin);
00385 
00386     hAvBposxBad=new TH1F("hAvBposxBad","hAvBposxBad",
00387                        5000,-0.01,0.01);
00388     hAvBposxBad->GetXaxis()->SetTitle("Av. Beam Position x");
00389     hAvBposxBad->GetXaxis()->CenterTitle();
00390     hAvBposxBad->GetYaxis()->SetTitle("");
00391     hAvBposxBad->GetYaxis()->CenterTitle();
00392     hAvBposxBad->SetFillColor(0);
00393     hAvBposxBad->SetLineColor(1);
00394     //hAvBposxBad->SetBit(TH1::kCanRebin);
00395 
00396     hAvBposy=new TH1F("hAvBposy","hAvBposy",
00397                     5000,-0.01,0.01);//
00398     hAvBposy->GetXaxis()->SetTitle("Av. Beam Position y");
00399     hAvBposy->GetXaxis()->CenterTitle();
00400     hAvBposy->GetYaxis()->SetTitle("");
00401     hAvBposy->GetYaxis()->CenterTitle();
00402     hAvBposy->SetFillColor(0);
00403     hAvBposy->SetLineColor(1);
00404     //hAvBposy->SetBit(TH1::kCanRebin);
00405 
00406     hAvBposyBad=new TH1F("hAvBposyBad","hAvBposyBad",
00407                        5000,-0.01,0.01);
00408     hAvBposyBad->GetXaxis()->SetTitle("Av. Beam Position y");
00409     hAvBposyBad->GetXaxis()->CenterTitle();
00410     hAvBposyBad->GetYaxis()->SetTitle("");
00411     hAvBposyBad->GetYaxis()->CenterTitle();
00412     hAvBposyBad->SetFillColor(0);
00413     hAvBposyBad->SetLineColor(1);
00414     //hAvBposyBad->SetBit(TH1::kCanRebin);
00415 
00416 
00417 
00418     hDeltaBposx=new TH1F("hDeltaBposx","hDeltaBposx",
00419                          5000,-0.01,0.01);//
00420     hDeltaBposx->GetXaxis()->SetTitle("Delta Beam Position x");
00421     hDeltaBposx->GetXaxis()->CenterTitle();
00422     hDeltaBposx->GetYaxis()->SetTitle("");
00423     hDeltaBposx->GetYaxis()->CenterTitle();
00424     hDeltaBposx->SetFillColor(0);
00425     hDeltaBposx->SetLineColor(1);
00426     //hDeltaBposx->SetBit(TH1::kCanRebin);
00427 
00428     hDeltaBposxBad=new TH1F("hDeltaBposxBad","hDeltaBposxBad",
00429                             5000,-0.01,0.01);
00430     hDeltaBposxBad->GetXaxis()->SetTitle("Delta Beam Position x");
00431     hDeltaBposxBad->GetXaxis()->CenterTitle();
00432     hDeltaBposxBad->GetYaxis()->SetTitle("");
00433     hDeltaBposxBad->GetYaxis()->CenterTitle();
00434     hDeltaBposxBad->SetFillColor(0);
00435     hDeltaBposxBad->SetLineColor(1);
00436     //hDeltaBposxBad->SetBit(TH1::kCanRebin);
00437 
00438     hDeltaBposy=new TH1F("hDeltaBposy","hDeltaBposy",
00439                          5000,-0.01,0.01);//
00440     hDeltaBposy->GetXaxis()->SetTitle("Delta Beam Position y");
00441     hDeltaBposy->GetXaxis()->CenterTitle();
00442     hDeltaBposy->GetYaxis()->SetTitle("");
00443     hDeltaBposy->GetYaxis()->CenterTitle();
00444     hDeltaBposy->SetFillColor(0);
00445     hDeltaBposy->SetLineColor(1);
00446     //hDeltaBposy->SetBit(TH1::kCanRebin);
00447 
00448     hDeltaBposyBad=new TH1F("hDeltaBposyBad","hDeltaBposyBad",
00449                             5000,-0.01,0.01);
00450     hDeltaBposyBad->GetXaxis()->SetTitle("Delta Beam Position y");
00451     hDeltaBposyBad->GetXaxis()->CenterTitle();
00452     hDeltaBposyBad->GetYaxis()->SetTitle("");
00453     hDeltaBposyBad->GetYaxis()->CenterTitle();
00454     hDeltaBposyBad->SetFillColor(0);
00455     hDeltaBposyBad->SetLineColor(1);
00456     //hDeltaBposyBad->SetBit(TH1::kCanRebin);
00457 
00458 
00459 
00460     //timediff
00461     hBDTimeDiff=new TH1F("hBDTimeDiff","hBDTimeDiff",
00462                          5000,-2.5,2.5);
00463     hBDTimeDiff->GetXaxis()->SetTitle("Beam/ND Time Difference (s)");
00464     hBDTimeDiff->GetXaxis()->CenterTitle();
00465     hBDTimeDiff->GetYaxis()->SetTitle("");
00466     hBDTimeDiff->GetYaxis()->CenterTitle();
00467     hBDTimeDiff->SetFillColor(0);
00468     hBDTimeDiff->SetLineColor(1);
00469     //hBDTimeDiff->SetBit(TH1::kCanRebin);
00470 
00471     hBDTimeDiffBad=new TH1F("hBDTimeDiffBad","hBDTimeDiffBad",
00472                             5000,-2.5,2.5);
00473     hBDTimeDiffBad->GetXaxis()->SetTitle("Beam/ND Time Difference (s)");
00474     hBDTimeDiffBad->GetXaxis()->CenterTitle();
00475     hBDTimeDiffBad->GetYaxis()->SetTitle("");
00476     hBDTimeDiffBad->GetYaxis()->CenterTitle();
00477     hBDTimeDiffBad->SetFillColor(0);
00478     hBDTimeDiffBad->SetLineColor(1);
00479     //hBDTimeDiffBad->SetBit(TH1::kCanRebin);
00480 
00481     hBDTimeDiffBadBad=new TH1F("hBDTimeDiffBadBad","hBDTimeDiffBadBad",
00482                                5000,-2.5,1000);
00483     hBDTimeDiffBadBad->GetXaxis()->
00484       SetTitle("Beam/ND Time Difference (s)");
00485     hBDTimeDiffBadBad->GetXaxis()->CenterTitle();
00486     hBDTimeDiffBadBad->GetYaxis()->SetTitle("");
00487     hBDTimeDiffBadBad->GetYaxis()->CenterTitle();
00488     hBDTimeDiffBadBad->SetFillColor(0);
00489     hBDTimeDiffBadBad->SetLineColor(1);
00490     //hBDTimeDiffBadBad->SetBit(TH1::kCanRebin);
00491 
00492 
00493     
00494     hBeamType=new TH1F("hBeamType","hBeamType",
00495                        100,-10,90);//
00496     hBeamType->GetXaxis()->SetTitle("Beam Type");
00497     hBeamType->GetXaxis()->CenterTitle();
00498     hBeamType->GetYaxis()->SetTitle("");
00499     hBeamType->GetYaxis()->CenterTitle();
00500     hBeamType->SetFillColor(0);
00501     hBeamType->SetLineColor(1);
00502     //hBeamType->SetBit(TH1::kCanRebin);
00503 
00504     hBeamTypeBad=new TH1F("hBeamTypeBad","hBeamTypeBad",
00505                           100,-10,90);
00506     hBeamTypeBad->GetXaxis()->SetTitle("Beam Type");
00507     hBeamTypeBad->GetXaxis()->CenterTitle();
00508     hBeamTypeBad->GetYaxis()->SetTitle("");
00509     hBeamTypeBad->GetYaxis()->CenterTitle();
00510     hBeamTypeBad->SetFillColor(0);
00511     hBeamTypeBad->SetLineColor(1);
00512     //hBeamTypeBad->SetBit(TH1::kCanRebin);
00513 
00514 
00515     hTargetIn=new TH1F("hTargetIn","hTargetIn",
00516                        100,-10,90);//
00517     hTargetIn->GetXaxis()->SetTitle("Target In");
00518     hTargetIn->GetXaxis()->CenterTitle();
00519     hTargetIn->GetYaxis()->SetTitle("");
00520     hTargetIn->GetYaxis()->CenterTitle();
00521     hTargetIn->SetFillColor(0);
00522     hTargetIn->SetLineColor(1);
00523     //hTargetIn->SetBit(TH1::kCanRebin);
00524 
00525     hTargetInBad=new TH1F("hTargetInBad","hTargetInBad",
00526                           100,-10,90);
00527     hTargetInBad->GetXaxis()->SetTitle("Target In");
00528     hTargetInBad->GetXaxis()->CenterTitle();
00529     hTargetInBad->GetYaxis()->SetTitle("");
00530     hTargetInBad->GetYaxis()->CenterTitle();
00531     hTargetInBad->SetFillColor(0);
00532     hTargetInBad->SetLineColor(1);
00533     //hTargetInBad->SetBit(TH1::kCanRebin);
00534 
00535     hSpillsPerFile=new TH1F("hSpillsPerFile","hSpillsPerFile",
00536                             10000,0,10000);
00537     hSpillsPerFile->GetXaxis()->SetTitle("hSpillsPerFile");
00538     hSpillsPerFile->GetXaxis()->CenterTitle();
00539     hSpillsPerFile->GetYaxis()->SetTitle("");
00540     hSpillsPerFile->GetYaxis()->CenterTitle();
00541     hSpillsPerFile->SetFillColor(0);
00542     hSpillsPerFile->SetLineColor(1);
00543     //hSpillsPerFile->SetBit(TH1::kCanRebin);
00544   }
00545   
00546   if (!recBD) { //this is the MC case
00547     //this is the pot for carrot MC at LE-10
00548     Float_t potPerSpill=24.2;//x1e12 but ntp assumes e12
00549     Float_t spillsPerFile=400;
00550     
00551     //This function, for e.g., returns the value 24.2, since PoT/snarl 
00552     //for Daikon L010185 Near MC is 2.42*1013.
00553 
00554     //Convert to canonical BeamType in the case of intensity
00555     //weighted MC
00556     NuUtilities utils;
00557     BeamType::BeamType_t convBeamType =
00558       utils.ReturnConventionsBeamType(config);
00559     MAXMSG("NuBeam",Msg::kInfo,1)
00560       << "Beam type to be used for PoT counting: "
00561       << BeamType::AsString(convBeamType)
00562       << endl;
00563     
00564     Int_t RunNumber = config.run - 10000*int(config.run/10000);  //JJW 20110420: Gives last 4 digits of run number
00565     RunNumber = 1000*int(RunNumber/1000);                    //JJW 20110420:  Gives runNumber in terms of thousand series.  i.e. 1000, 5000, 6000 etc.
00566     
00567     potPerSpill=MCInfo::GetMCPoT
00568       (static_cast<Detector::Detector_t>(config.detector),
00569        static_cast<BeamType::BeamType_t>(convBeamType),
00570        static_cast<ReleaseType::Release_t>(config.mcVersion));
00571     spillsPerFile=MCInfo::GetNoSnarlPerFile
00572       (static_cast<Detector::Detector_t>(config.detector),
00573        static_cast<BeamType::BeamType_t>(convBeamType),
00574        static_cast<ReleaseType::Release_t>(config.mcVersion),
00575        config.runPeriod,
00576        RunNumber);
00577     //remove the FD factor of 1e8 so that it can be stored in the histo
00578     //also just put a 1 for spills per file, since it's pot/file really
00579     if (config.detector==Detector::kFar) {
00580       if (potPerSpill < 0) {
00581         MAXMSG("NuBeam",Msg::kWarning,50) << "*** Warning: potPerSpill undefined for beam type: " 
00582         << BeamType::AsString(convBeamType) << " (" << convBeamType << ") in the far detector." << endl
00583         << "ASSUMING 6.5e20 per file, which is standard for Daikon.  " << endl
00584         << "This is dangerous - make sure the above beam type is added to DataUtil/MCInfo::GetMCPoT() ASAP." << endl;
00585         potPerSpill = 6.5e8;
00586       }
00587       potPerSpill/=1e8;
00588       if (spillsPerFile<=0) {
00589         MAXMSG("NuBeam",Msg::kInfo,1)
00590           <<"Overriding spills per file (="<<spillsPerFile
00591           <<"), now set to 1"<<endl;
00592         spillsPerFile=1;
00593       }
00594     }
00595 
00596     //sanity check: histogram overflow
00597     Int_t n=hSpillsPerFile->GetNbinsX();
00598     if (hSpillsPerFile->GetBinContent(n+1)>0){
00599       MSG("NuBeam",Msg::kError)
00600         <<"n bins="<<n
00601         <<", overflow="<<hSpillsPerFile->GetBinContent(n+1)<<endl; 
00602     }
00603 
00604     MAXMSG("NuBeam",Msg::kInfo,1)
00605       <<"No NtpBDLiteRecord, so using potPerSpill="<<potPerSpill
00606       <<"x10^12 ND (10^20 FD)"<<" and spillsPerFile="<<spillsPerFile
00607       <<" for beamType="<<convBeamType
00608       <<", hornCurrent="<<config.hornCurrent
00609       <<", mcVersion="<<config.mcVersion<<endl;
00610     
00611     //fill histos
00612     hPottor101->Fill(potPerSpill);
00613     hPottr101d->Fill(potPerSpill);
00614     hPottortgt->Fill(potPerSpill);
00615     hPottrtgtd->Fill(potPerSpill);
00616     hSpillsPerFile->Fill(spillsPerFile);
00617 
00618     //write out the potPerSpill
00619     nu.pot=potPerSpill;
00620     nu.goodBeamSntp=true;//always true for MC
00621     
00622     //don't fill the bad histos ever in this case
00623   }
00625   //this is the data case
00627   else {
00628     MAXMSG("NuBeam",Msg::kInfo,1)
00629       <<"Using NtpBDLiteRecord for POT"<<endl;
00630     
00631     const NtpBDLiteRecord& ntpBD=*recBD;
00632     
00633     static BeamMonSpill spill;
00634     static BMSpillAna bmsa;
00635         
00636     //tell it to use the database defined values of the cuts
00637     bmsa.UseDatabaseCuts();
00638     
00639     Bool_t changeBeamCuts=false;
00640     //change default values (only once though)
00641     static Registry* pr=0;
00642     if (!pr && changeBeamCuts){
00643       MAXMSG("NuBeam",Msg::kInfo,1)
00644         <<"Changing default values of BMSpillAna"<<endl;
00645       pr=new Registry();
00646       Registry& r=*pr;//get a reference
00647       r.UnLockValues();
00648       //r.Set("TargetIn",1);
00649       //r.Set("BeamType",-1);//don't care if ME,LE,etc
00650       //r.Set("PosTgtXMin",-2.0*Munits::mm);
00651       //have to make sure that zero is not included
00652       r.Set("PosTgtXMax",-0.0000001*Munits::mm);
00653       r.Set("PosTgtYMin", 0.0000001*Munits::mm);
00654       //r.Set("PosTgtYMax", 2.0*Munits::mm);
00655       r.LockValues();
00656       bmsa.Config(r);
00657       
00658       //print the registry
00659       r.PrettyPrint(cout);
00660     }
00661     
00662     //give it the spill
00663     bmsa.SetSpill(ntpBD,spill);
00664 
00665     Double_t xmean=0;
00666     Double_t ymean=0;
00667     Double_t xrms=0;
00668     Double_t yrms=0;
00669     bmsa.GetSpill().BpmAtTarget(xmean,ymean,xrms,yrms);
00670     
00671     Int_t beamType=spill.GetStatusBits().beam_type;
00672     Int_t targetIn=spill.GetStatusBits().target_in;
00673     
00674     //write to the object whether the beam is good
00675     nu.goodBeamSntp=bmsa.SelectSpill();
00676 
00677     //set the pot value
00678     nu.pot=ntpBD.trtgtd;
00679 
00680     if (nu.pot<0) nu.pot=0;//bad spills can be <0 but don't want to sum
00681     Float_t tor101=ntpBD.tor101;
00682     if (tor101<0) tor101=0;
00683     Float_t tr101d=ntpBD.tr101d;
00684     if (tr101d<0) tr101d=0;
00685     Float_t tortgt=ntpBD.tortgt;
00686     if (tortgt<0) tortgt=0;
00687     Float_t trtgtd=ntpBD.trtgtd;
00688     if (trtgtd<0) trtgtd=0;    
00689 
00690     //check if a good spill
00691     if (!nu.goodBeamSntp) {
00692 
00693       MAXMSG("NuBeam",Msg::kWarning, 20)
00694       <<"NuBeam: BAD SPILL:" << endl
00695       << "  > Maximum time diffrence (s):     " << ntpBD.GetHeader().GetTimeDiffStreamSpill() << endl
00696       << "  > Spill intensity (1e12 pot):     " << trtgtd << endl
00697       << "  > Horn Current (kA):              " << ntpBD.horncur << endl
00698       << "  > fBeamType:                      " << BeamType::AsString(static_cast<BeamType::BeamType_t>(spill.BeamType())) <<" ("<<spill.BeamType()<<")"<<endl
00699       << "  > Horizontal beam position (mm):  " << xmean << endl
00700       << "  > Vertical beam position (mm):    " << ymean << endl
00701       << "  > Horizontal beam width a (mm):   " << ntpBD.bwidx << endl
00702       << "  > Vertical beam width a (mm):     " << ntpBD.bwidy << endl;
00703 
00704       //for the Bad plots to have any meaning you have to make sure
00705       //that the spill was in time, otherwise you just plot
00706       //data from spills ages ago.
00707       if (ntpBD.GetHeader().GetTimeDiffStreamSpill()>1){
00708         hBDTimeDiffBadBad->Fill(ntpBD.GetHeader().
00709                                 GetTimeDiffStreamSpill());
00710       }
00711       else {
00712         hPotBadtor101->Fill(tor101);
00713         hPotBadtr101d->Fill(tr101d);
00714         hPotBadtortgt->Fill(tortgt);
00715         hPotBadtrtgtd->Fill(trtgtd);
00716         hHorncurBad->Fill(ntpBD.horncur);
00717         hBwidxBad->Fill(ntpBD.bwidx);
00718         hBwidyBad->Fill(ntpBD.bwidy);
00719         hBDTimeDiffBad->Fill(ntpBD.GetHeader().
00720                              GetTimeDiffStreamSpill());
00721         
00722         hAvBposxBad->Fill(xmean);
00723         hAvBposyBad->Fill(ymean);
00724         
00725         for (Int_t batch=0;batch<6;batch++){
00726           hBpmintBad->Fill(ntpBD.bpmint[batch]);
00727           //check if batch existed in spill
00728           if (ntpBD.bpmint[batch]>1) {
00729             hBposxBad->Fill(ntpBD.bposx[batch]);
00730             hBposyBad->Fill(ntpBD.bposy[batch]);
00731             
00732             //calc delta from mean position
00733             //should probably use some sort of intensity weighting
00734             hDeltaBposxBad->Fill(ntpBD.bposx[batch]-xmean);
00735             hDeltaBposyBad->Fill(ntpBD.bposy[batch]-ymean);
00736           }
00737         }
00738 
00739         hTargetInBad->Fill(targetIn);
00740         hBeamTypeBad->Fill(beamType);
00741       }
00742       return nu.goodBeamSntp;
00743     }
00744     
00745     MAXMSG("NuBeam",Msg::kInfo,1)
00746       <<"Found first good spill"<<", trtgtd="<<trtgtd
00747       <<", timeDiff="<<ntpBD.GetHeader().GetTimeDiffStreamSpill() 
00748       <<", beamType="<<beamType<<", tgtIn="<<targetIn<<endl;
00749   
00750     static Bool_t firstTime=true;
00751     if (firstTime) {
00752       bmsa.Print(); 
00753       cout<<endl;
00754       firstTime=false;
00755     }
00756 
00757     //perform sanity check that hornCurrent is 
00758     //within +/- 4% of the config one
00759     Double_t upperBeamCheck = 1.04;
00760     Double_t lowerBeamCheck = 0.96;
00761     if (Detector::kFar == config.detector &&
00762         SimFlag::kData == config.simFlag &&
00763         (config.beamType == BeamType::kL010z170i ||
00764          config.beamType == BeamType::kL010z200i ||
00765          config.beamType == BeamType::kL010z185i)){
00766       upperBeamCheck = 1.2;
00767       lowerBeamCheck = 0.8;
00768     }
00769     if (!(fabs(ntpBD.horncur)>fabs(config.hornCurrent)*lowerBeamCheck &&
00770           fabs(ntpBD.horncur)<fabs(config.hornCurrent)*upperBeamCheck)){
00771       MSG("NuBeam",Msg::kError)
00772         <<"HornCurrent problem for BeamType (sntp)="<<beamType
00773         <<", event hornCur="<<ntpBD.horncur
00774         <<" config.hornCurrent="<<config.hornCurrent
00775         <<endl;
00776       TH1F* hError=dynamic_cast<TH1F*>(gROOT->FindObject("hError"));
00777       if (hError) hError->Fill(1);//set an error flag
00778     }
00779 
00780     //these histograms are the ones used for POT counting
00781     //have to check the coil and data quality as well
00782     if (nu.goodBeamSntp && nu.coilIsOk && 
00783         (nu.isGoodDataQuality || !nu.useDBForDataQuality)) {
00784       hPottor101->Fill(tor101);
00785       hPottr101d->Fill(tr101d);
00786       hPottortgt->Fill(tortgt);
00787       hPottrtgtd->Fill(trtgtd);
00788     }
00789     
00790     //these are just for when the beam is good (regardless of coil)
00791     hPotGoodtor101->Fill(tor101);
00792     hPotGoodtr101d->Fill(tr101d);
00793     hPotGoodtortgt->Fill(tortgt);
00794     hPotGoodtrtgtd->Fill(trtgtd);
00795     hHorncur->Fill(ntpBD.horncur);
00796     hBwidx->Fill(ntpBD.bwidx);
00797     hBwidy->Fill(ntpBD.bwidy);
00798     hBDTimeDiff->Fill(ntpBD.GetHeader().GetTimeDiffStreamSpill());
00799 
00800     hAvBposx->Fill(xmean);
00801     hAvBposy->Fill(ymean);
00802     
00803     for (Int_t batch=0;batch<6;batch++){
00804       hBpmint->Fill(ntpBD.bpmint[batch]);
00805       //check if batch existed in spill
00806       if (ntpBD.bpmint[batch]>1) {
00807         hBposx->Fill(ntpBD.bposx[batch]);
00808         hBposy->Fill(ntpBD.bposy[batch]);
00809 
00810             
00811         //calc delta from mean position
00812         //should probably use some sort of intensity weighting
00813         hDeltaBposx->Fill(ntpBD.bposx[batch]-xmean);
00814         hDeltaBposy->Fill(ntpBD.bposy[batch]-ymean);
00815       }
00816     }
00817 
00818     hTargetIn->Fill(targetIn);
00819     hBeamType->Fill(beamType);
00820   }
00821 
00822   return nu.goodBeamSntp;
00823 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1