BMSpillAna Class Reference
[BeamDataUtil]

Beam quality cuts and other method to analyze beam data ntuples. More...

#include <BMSpillAna.h>

List of all members.

Public Member Functions

 BMSpillAna ()
virtual ~BMSpillAna ()
const RegistryDefaultConfig () const
void Config (const Registry &r)
const RegistryGetUserCuts () const
 Access the cuts supplied by the user.
void UseDatabaseCuts (Bool_t usedb=true)
 Change if one wants to use the database or not.
void UseCutsSet (Dbi::Task cutset)
 Change the set of cuts to use.
void SetSpill (const BeamMonSpill &spill)
 Set the BeamMonSpill object.
void SetSpill (const NtpBDLiteRecord &ntpbdr, BeamMonSpill &spill)
void SetSnarlTime (const VldTimeStamp &vs_snarl)
void SetTimeDiff (Double_t tdiff)
const BeamMonSpillGetSpill () const
 Return a reference to BeamMonSpill object.
Bool_t SelectSpill ()
 Select a spill within the cut values.
Double_t FractionOnTarget ()
Double_t CalcFracOnTarget (Double_t bpos, Double_t bwid, Double_t tedg, Double_t toff)
void Print ()
 Print out the cut values.

Private Member Functions

void ChangeCutValues (const Registry &r)
 Apply changes to the cut values.
void ApplyUserCuts ()

Private Attributes

const BeamMonSpillfSpill
 The pointer to the reference to the BeamMonSpill object.
Registry fUserCuts
Bool_t fUseDBCuts
Dbi::Task fCutsSet
DbiResultPtr< BeamMonCutsfResPtr
Int_t fResID
Double_t fTimeDiff
Double_t fTimeDiffMax
 Below here are all the members that hold the cut values.
Double_t fPosTgtXMin
Double_t fPosTgtXMax
Double_t fPosTgtYMin
 Defaults are min=0.01 and max=2.0.
Double_t fPosTgtYMax
Double_t fWidXMin
Double_t fWidXMax
Double_t fWidYMin
 Defaults are min=0.1 and max=2.0.
Double_t fWidYMax
Int_t fUseSpotSizeCut
Int_t fUseProfMonOut
Double_t fTorIntMin
Double_t fTorIntMax
Double_t fHornCurMin
Double_t fHornCurMax
Int_t fTargetIn
Int_t fBeamType
Double_t fFracOnTargetMin
Double_t fFracOnTargetMax


Detailed Description

Beam quality cuts and other method to analyze beam data ntuples.

A helper class with a number of useful methods, like beam quality cuts, to handle BeamMonSpill or NtpBDLite objects. Behind the scenes, this class uses BeamMonSpill objects, and transforms NtpBDLiteRecord objects accordingly. In this way, one can maintain only one version of the code and also access useful methods in BeamMonSpill.

The default values for the cuts on the beam quantities are not very strict. So don't use them blindly, have a look at them and determine if they satisfy your needs. There is also no cut on the timing difference between the snarl and the spill.

As of February 22, 2007, the default is to use the cut values that are in the database table BEAMMONCUTS. It is possible to switch back and use hardcoded values through the fUseDBCuts switch.

Author:
(last to touch it)
Author
mdier
Version:
Revision
1.12
Date:
Date
2007/02/22 16:22:54
Contact: mdier@bnl.gov

Created on: Fri Aug 26 16:29:30 2005

Id
BMSpillAna.h,v 1.12 2007/02/22 16:22:54 mdier Exp

Definition at line 49 of file BMSpillAna.h.


Constructor & Destructor Documentation

BMSpillAna::BMSpillAna (  ) 

Definition at line 16 of file BMSpillAna.cxx.

References ChangeCutValues().

00017     :fSpill(0),fUserCuts(),fUseDBCuts(true),fCutsSet(0),fResPtr(),
00018      fResID(-1),fTimeDiff(-99999)
00019 {
00020     this->ChangeCutValues(this->DefaultConfig());
00021 }

BMSpillAna::~BMSpillAna (  )  [virtual]

Definition at line 24 of file BMSpillAna.cxx.

00025 {}


Member Function Documentation

void BMSpillAna::ApplyUserCuts (  )  [private]

Definition at line 109 of file BMSpillAna.cxx.

References ChangeCutValues(), and fUserCuts.

Referenced by SelectSpill().

00110 {
00111     this->ChangeCutValues(fUserCuts);
00112 }

Double_t BMSpillAna::CalcFracOnTarget ( Double_t  bpos,
Double_t  bwid,
Double_t  tedg,
Double_t  toff 
)

Calculates the fraction of the integral of a gaussian with mean bpos and width bwid between -tpos-toff and +tpos-toff

Definition at line 363 of file BMSpillAna.cxx.

Referenced by FractionOnTarget().

00364 {
00365     Double_t powl = tedg+bpos-toff;
00366     powl /= bwid;
00367     powl /= TMath::Sqrt(2.0);
00368     Double_t powu = tedg-bpos+toff;
00369     powu /= bwid;
00370     powu /= TMath::Sqrt(2.0);
00371     Double_t frac = TMath::Erf(powl)/2 +  TMath::Erf(powu)/2; 
00372     return frac;
00373 }

void BMSpillAna::ChangeCutValues ( const Registry r  )  [private]

Apply changes to the cut values.

Definition at line 74 of file BMSpillAna.cxx.

References fBeamType, fFracOnTargetMax, fFracOnTargetMin, fHornCurMax, fHornCurMin, fPosTgtXMax, fPosTgtXMin, fPosTgtYMax, fPosTgtYMin, fTargetIn, fTimeDiffMax, fTorIntMax, fTorIntMin, fUseProfMonOut, fUseSpotSizeCut, fWidXMax, fWidXMin, fWidYMax, fWidYMin, Registry::Get(), and Registry::Size().

Referenced by ApplyUserCuts(), BMSpillAna(), Config(), and SelectSpill().

00075 {
00076     if (r.Size()>0){
00077         r.Get("TimeDiffMax",fTimeDiffMax);
00078         
00079         r.Get("PosTgtXMin",fPosTgtXMin);
00080         r.Get("PosTgtXMax",fPosTgtXMax);
00081         
00082         r.Get("PosTgtYMin",fPosTgtYMin);
00083         r.Get("PosTgtYMax",fPosTgtYMax);
00084         
00085         r.Get("WidXMin",fWidXMin);
00086         r.Get("WidXMax",fWidXMax);
00087         
00088         r.Get("WidYMin",fWidYMin);
00089         r.Get("WidYMax",fWidYMax);
00090 
00091         r.Get("UseSpotSizeCut",fUseSpotSizeCut);
00092         
00093         r.Get("UseProfMonOut",fUseProfMonOut);
00094         
00095         r.Get("TorIntMin",fTorIntMin);
00096         r.Get("TorIntMax",fTorIntMax);
00097         
00098         r.Get("HornCurMin",fHornCurMin);
00099         r.Get("HornCurMax",fHornCurMax);
00100         
00101         r.Get("TargetIn",fTargetIn);
00102         r.Get("BeamType",fBeamType);
00103         
00104         r.Get("FracOnTargetMin",fFracOnTargetMin);
00105         r.Get("FracOnTargetMax",fFracOnTargetMax);
00106     }        
00107 }

void BMSpillAna::Config ( const Registry r  ) 

Definition at line 68 of file BMSpillAna.cxx.

References ChangeCutValues(), and fUserCuts.

Referenced by NueBeamMonModule::Config(), MeuCuts::GetBDSelectSpillInfo(), NuBeam::IsGoodSpillAndFillPot(), NtpTools::PassBeamCuts(), and StndBmsSpin::Scan().

00069 {
00070     fUserCuts=r;
00071     this->ChangeCutValues(r);
00072 }

const Registry & BMSpillAna::DefaultConfig (  )  const

Definition at line 28 of file BMSpillAna.cxx.

References Munits::ampere, Registry::LockValues(), Munits::mm, Munits::s, Registry::Set(), Registry::Size(), and Registry::UnLockValues().

00029 {
00030     static Registry r;
00031     if (r.Size() == 0) {
00032         r.UnLockValues();
00033         r.Set("TimeDiffMax", 1.0*Munits::s);
00034 
00035         r.Set("PosTgtXMin",-2.0*Munits::mm);
00036         r.Set("PosTgtXMax",-0.01*Munits::mm);
00037 
00038         r.Set("PosTgtYMin",0.01*Munits::mm);
00039         r.Set("PosTgtYMax",2.0*Munits::mm);
00040 
00041         r.Set("WidXMin",0.1*Munits::mm);
00042         r.Set("WidXMax",1.5*Munits::mm);
00043 
00044         r.Set("WidYMin",0.1*Munits::mm);
00045         r.Set("WidYMax",2.0*Munits::mm);
00046 
00047         r.Set("UseSpotSizeCut",0);
00048         
00049         r.Set("UseProfMonOut",1);
00050 
00051         r.Set("TorIntMin",0.50);
00052         r.Set("TorIntMax",50.0);
00053 
00054         r.Set("HornCurMin",-2.0e5*Munits::ampere);
00055         r.Set("HornCurMax",-1.55e5*Munits::ampere);
00056 
00057         r.Set("TargetIn",1);
00058         r.Set("BeamType",-1);
00059 
00060         r.Set("FracOnTargetMin",0.0);
00061         r.Set("FracOnTargetMax",1.0);
00062 
00063         r.LockValues();
00064     }
00065     return r;
00066 }

Double_t BMSpillAna::FractionOnTarget (  ) 

Calcualte the fraction of beam on target using the BPM position at the target and the beam with from the profile monitors. It is actually the product of the fraction in the horizontal and vertical direction. For the latter, the part of the target that is hidden behind the baffle is not taken as part of the target (i.e. assume a target of +-5.5mm in vertical and +-3.2mm in horizontal, values from sections 4.2.2 and 4.2.3 of the NuMI Technical Design Handbook)

note **** This method can only be used when the widths assume a gaussian distribution (e.g. obtained from fitting to the profile monitors). At the moment, only the rms of the beam profiles are in the database and the result from this method has no meaning.

Definition at line 305 of file BMSpillAna.cxx.

References BeamMonSpill::BpmAtTarget(), CalcFracOnTarget(), BeamMonSpill::fProfWidX, BeamMonSpill::fProfWidY, fSpill, VldTimeStamp::GetSec(), Munits::mm, and BeamMonSpill::SpillTime().

Referenced by SelectSpill().

00306 {
00307     Double_t frac = -1;
00308 //
00309     Double_t bposx = 0;
00310     Double_t bwidx = 0;
00311 //
00312     Double_t bposy = 0;
00313     Double_t bwidy = 0;
00314     
00315     // Get the position at target 
00316     fSpill->BpmAtTarget(bposx,bposy,bwidx,bwidy);
00317     
00318     // Set the values of the widths to prof mon fits
00319     bwidx = fSpill->fProfWidX; 
00320     bwidy = fSpill->fProfWidY; 
00321 
00322     // information of profile monitors not available or fits failed
00323     if (bwidx<=0 || bwidy<=0) return frac;
00324 
00325     // large values also indicate fit failure
00326 
00327     if (bwidx>5*Munits::mm || bwidy>05*Munits::mm) return frac;
00328 
00329 
00330     Double_t tedgx = -9999;
00331     Double_t toffx = -9999;
00332     Double_t tedgy = -9999;
00333     Double_t toffy = -9999;
00334 
00335     const VldTimeStamp startNOvA(2013,6,1,0/*hr*/,0/*min*/,0/*sec*/,0/*ns*/);
00336 
00337     Double_t spilltime = fSpill->SpillTime().GetSec();
00338 
00339 
00340     if (spilltime >= (double)startNOvA) {
00341 
00342       // Nova era target coordinates
00343       tedgx = 3.7*Munits::mm;
00344       toffx = 1.0*Munits::mm;
00345       tedgy = 3.7*Munits::mm;
00346       toffy = 1.0*Munits::mm;
00347     }
00348     else  {
00349       // MINOS era target coordinates:
00350       tedgx = 3.2*Munits::mm;
00351       toffx = -1.2*Munits::mm;
00352       tedgy = 5.5*Munits::mm;
00353       toffy = 0.9*Munits::mm;
00354     }
00355 
00356 
00357     frac = CalcFracOnTarget(bposx,bwidx,tedgx,toffx);
00358     frac *= CalcFracOnTarget(bposy,bwidy,tedgy,toffy);
00359     
00360     return frac;    
00361 }

const BeamMonSpill & BMSpillAna::GetSpill (  )  const [inline]

Return a reference to BeamMonSpill object.

Definition at line 276 of file BMSpillAna.h.

References fSpill.

Referenced by NuBeam::IsGoodSpillAndFillPot().

00277 {return *fSpill;}

const Registry & BMSpillAna::GetUserCuts (  )  const [inline]

Access the cuts supplied by the user.

Definition at line 273 of file BMSpillAna.h.

References fUserCuts.

00274 {return fUserCuts;}

void BMSpillAna::Print (  ) 

Print out the cut values.

Definition at line 375 of file BMSpillAna.cxx.

References Munits::ampere, fBeamType, fFracOnTargetMax, fFracOnTargetMin, fHornCurMax, fHornCurMin, fPosTgtXMax, fPosTgtXMin, fPosTgtYMax, fPosTgtYMin, fTargetIn, fTimeDiffMax, fTorIntMax, fTorIntMin, fUseProfMonOut, fWidXMax, fWidXMin, fWidYMax, fWidYMin, and Munits::mm.

Referenced by NuAnalysis::ExtractConfig(), NuBeam::IsGoodSpillAndFillPot(), and SelectSpill().

00376 {
00377     cout << endl << "Beam Monitoring Cut Values:" << endl;
00378     cout         << "===========================" << endl;
00379 
00380     printf(" > Maximum time diffrence (s):         %5.3f\n",fTimeDiffMax);
00381     printf(" > Spill intensity (1e12 pot):     [%5.2f,%5.2f]\n",
00382            fTorIntMin, fTorIntMax);
00383     printf(" > Horn Current (kA):             [%+5.1f,%+5.1f]\n",
00384            fHornCurMin/Munits::ampere/1e3, fHornCurMax/Munits::ampere/1e3);
00385     printf(" > Target in/out:                      %3d\n",fTargetIn);
00386     printf(" > fBeamType:                          %3d\n",fBeamType);    
00387     printf(" > Horizontal beam position (mm): [%+5.3f,%+5.3f]\n",
00388            fPosTgtXMin/Munits::mm, fPosTgtXMax/Munits::mm);
00389     printf(" > Vertical beam position (mm):   [%+5.3f,%+5.3f]\n",
00390            fPosTgtYMin/Munits::mm, fPosTgtYMax/Munits::mm);
00391     printf(" > Horizontal beam width a (mm):  [%+5.3f,%+5.3f]\n",
00392            fWidXMin/Munits::mm, fWidXMax/Munits::mm);
00393     printf(" > Vertical beam width a (mm):    [%+5.3f,%+5.3f]\n",
00394            fWidYMin/Munits::mm, fWidYMax/Munits::mm);
00395     printf(" > Use spill when prof mon out:        %3d\n",fUseProfMonOut);
00396     printf(" > Beam fraction on target:       [%5.3f,%5.3f]\n",
00397            fFracOnTargetMin, fFracOnTargetMax);
00398 
00399 }

Bool_t BMSpillAna::SelectSpill (  ) 

Select a spill within the cut values.

Definition at line 163 of file BMSpillAna.cxx.

References ApplyUserCuts(), BeamMonSpill::BeamType(), BeamMonSpill::BpmAtTarget(), ChangeCutValues(), fBeamType, fCutsSet, fFracOnTargetMax, fFracOnTargetMin, BeamMonSpill::fHornCur, fHornCurMax, BeamMonCuts::FillRegistry(), fPosTgtXMax, fPosTgtYMax, BeamMonSpill::fProfWidX, BeamMonSpill::fProfWidY, FractionOnTarget(), fResID, fResPtr, fSpill, fTargetIn, fTimeDiff, fTimeDiffMax, fTorIntMax, fTorIntMin, BeamMonSpill::fTrtgtd, fUseDBCuts, fUseProfMonOut, fUseSpotSizeCut, fWidXMax, fWidXMin, fWidYMax, fWidYMin, MsgStream::GetLogLevel(), DbiResultPtr< T >::GetResultID(), DbiResultPtr< T >::GetRow(), BeamMonSpill::GetStatusBits(), MsgService::GetStream(), MsgService::Instance(), SimFlag::kData, Msg::kDebug, Detector::kNear, Msg::kWarning, MAXMSG, Munits::mm, MSG, DbiResultPtr< T >::NewQuery(), Print(), and BeamMonSpill::SpillTime().

Referenced by ParticleBeamMonAna::ana(), MadTVAnalysis::CreatePAN(), MadPIDAnalysis::CreatePAN(), MadMKAnalysis::CreatePAN(), MadAnalysis::CreatePAN(), NuExtraction::ExtractBeamInfoDB(), NuAnalysis::ExtractConfig(), ANtpInfoObjectFillerBeam::FillBeamInformation(), NtpMaker::FillSpillInfo(), MeuCuts::GetBDSelectSpillInfo(), NuBeam::IsGoodSpillAndFillPot(), NtpTools::PassBeamCuts(), DataQualityInterface::ProcessBeamStatus(), DataUtil::QueryBeamDB(), NueBeamMonModule::Reco(), and StndBmsSpin::Scan().

00164 {
00165     if (fTimeDiff==-99999) {
00166         MSG("BMSpillAna", Msg::kWarning) <<
00167             "Time difference seems not to be set correctly" << endl;
00168     }
00169     
00170     // If using the database, check whether the cuts need to be
00171     // updated
00172         
00173     if (fUseDBCuts){
00174         MAXMSG("BMSpillAna", Msg::kDebug,5) <<
00175             "Using database cuts" << endl;
00176 
00177 
00178         VldContext vc(Detector::kNear,SimFlag::kData,fSpill->SpillTime());
00179         Int_t nrows = fResPtr.NewQuery(vc,fCutsSet);
00180         if (nrows==0){
00181             MAXMSG("BMSpillAna",Msg::kWarning,20)
00182                 << "No cuts found in database. This should not happen!"
00183                 << endl;
00184         }
00185         else {
00186             if (nrows>1) {
00187                 MAXMSG("BMSpillAna",Msg::kWarning,20)
00188                     << "More than one row found for VldContext " 
00189                     << vc << endl
00190                     << "   --> Will only use first row! " << endl;
00191             }
00192             
00193             MAXMSG("BMSpillAna", Msg::kDebug,5) <<
00194                 "Rows found in BEAMMONCUTS table" << endl;
00195             // If the cuts are still the same (i.e. the data in the
00196             // DbiResultPointer is the same, do nothing, just keep the
00197             // current cut values, else change the cut values and
00198             // apply user cuts
00199 
00200             Int_t newid = fResPtr.GetResultID();
00201             if (newid != fResID){
00202                 MSG("BMSpillAna", Msg::kDebug) <<
00203                     "Cuts need to be updated for spill at " << fSpill->SpillTime()  << endl;
00204                 fResID = newid;
00205                 const BeamMonCuts* bmc = fResPtr.GetRow(0);
00206                 Registry newreg;
00207                 bmc->FillRegistry(&newreg);
00208                 this->ChangeCutValues(newreg);
00209 
00210                 Int_t loglevel = MsgService::Instance()->GetStream("BMSpillAna")->GetLogLevel();
00211                 if (loglevel == Msg::kDebug){
00212                     cout << "Database cuts" << endl;
00213                     this->Print();
00214                 }
00215 
00216                 this->ApplyUserCuts();
00217                 if (loglevel == Msg::kDebug){
00218                     cout << "After user cuts" << endl;
00219                     this->Print();
00220                 }
00221             }
00222         }        
00223     }
00224 
00225     if (fabs(fTimeDiff)>fTimeDiffMax) return false;
00226     
00227     Double_t xmean=0;
00228     Double_t ymean=0;
00229     Double_t xrms=0;
00230     Double_t yrms=0;
00231     fSpill->BpmAtTarget(xmean,ymean,xrms,yrms);
00232     if (xmean < fPosTgtXMin || xmean > fPosTgtXMax) return false;
00233     if (ymean < fPosTgtYMin || ymean > fPosTgtYMax) return false;
00234 
00235 
00236     // Never select fit failures
00237     if (fSpill->fProfWidX < -0.1*Munits::mm
00238         || fSpill->fProfWidY < -0.1*Munits::mm) return false;
00239     //
00240     if (fUseSpotSizeCut){
00241         // The widths should never be negative, unless it's due to a
00242         // fit failure, but these are already excluded above. The
00243         // values will be zero if the profile monitor is out.
00244         Double_t spot_size=0;
00245         if (fSpill->fProfWidX>0 && fSpill->fProfWidY>0)
00246             spot_size = fSpill->fProfWidX*fSpill->fProfWidY;
00247 
00248         // put this defualt to a small negative value, so that the
00249         // pribility exists to select the spill if the profile monitor
00250         // is out, i.e. widths are zero.
00251         Double_t spot_size_min = -0.01*Munits::mm*Munits::mm;
00252         if (fWidXMin>0 && fWidYMin>0)
00253             spot_size_min = fWidXMin*fWidYMin;
00254 
00255         // Assume people are smart enough not to put negative values
00256         // for the upper limit on the beam widths. If they do, they
00257         // will loose all spills...
00258         Double_t spot_size_max = fWidXMax*fWidYMax;
00259 
00260         if (!(fUseProfMonOut) && spot_size < spot_size_min ) return false;
00261         else if (spot_size > spot_size_max) return false;
00262 
00263     }
00264     else {       
00265         if (!(fUseProfMonOut) && fSpill->fProfWidX < fWidXMin) return false;
00266         else if (fSpill->fProfWidX > fWidXMax) return false;
00267         
00268         if (!(fUseProfMonOut) && fSpill->fProfWidY < fWidYMin) return false;
00269         else if (fSpill->fProfWidY > fWidYMax) return false;
00270     }
00271 
00272 
00273     //changed to Trtgtd from Tortgt on 20080814
00274     if (fSpill->fTrtgtd < fTorIntMin || fSpill->fTrtgtd > fTorIntMax){
00275         return false;
00276     }
00277     
00278     // FIXME: values in the database are in kAmps, not in
00279     // Munits. This will get fixed eventually, but for now, there
00280     // need to be an explicit factor of 1e3.
00281     if (fSpill->fHornCur*1e3 < fHornCurMin || fSpill->fHornCur*1e3 > fHornCurMax){
00282         return false;
00283     }
00284 
00285     //added  fTargetIn < 0 || on 20080814
00286     if ( fTargetIn < 0 || (fTargetIn >= 0 && (Bool_t)fSpill->GetStatusBits().target_in != (Bool_t)fTargetIn) ){ 
00287         return false;
00288     }
00289 
00290     if (fBeamType >=0 && (fSpill->BeamType() != fBeamType)){
00291         return false;
00292     }
00293 
00294     if (fFracOnTargetMin > 0 &&  this->FractionOnTarget() < fFracOnTargetMin) {
00295         return false;
00296     }
00297     if (fFracOnTargetMax < 1 &&  this->FractionOnTarget() > fFracOnTargetMax) {
00298         return false;
00299     }
00300     
00301     return true;
00302 }

void BMSpillAna::SetSnarlTime ( const VldTimeStamp vs_snarl  ) 

Give the snarl trigger time, to calculate the time difference wrt the beam monitoring data. This can be used alternative to SetTimeDiff below. This need to be called when using BeamMonSpill objects (i.e. no BDLite ntuples). Be aware that you will need to call this method AFTER you set the spill object, and this needs to be set.

Definition at line 154 of file BMSpillAna.cxx.

References fSpill, Msg::kError, MSG, SetTimeDiff(), and BeamMonSpill::SpillTime().

Referenced by ParticleBeamMonAna::ana(), MadPIDAnalysis::CreatePAN(), and NueBeamMonModule::Reco().

00155 {
00156     if (fSpill==0){
00157         MSG("BMSpillAna", Msg::kError)<< "Set the spill object before setting this time" << endl;
00158         return;
00159     }
00160     this->SetTimeDiff(vs_snarl-fSpill->SpillTime());
00161 }

void BMSpillAna::SetSpill ( const NtpBDLiteRecord ntpbdr,
BeamMonSpill spill 
)

Set the NtpBDLiteRecord object. The user should create and pass in a non const BeamMonSpill object by him/herself. This is to facilitate memory management.

Definition at line 124 of file BMSpillAna.cxx.

References NtpBDLiteRecord::bpmint, NtpBDLiteRecord::bposx, NtpBDLiteRecord::bposy, NtpBDLiteRecord::bwidx, NtpBDLiteRecord::bwidy, BeamMonSpill::fBpmInt, BeamMonSpill::fDaeTime, BeamMonSpill::fHadInt, BeamMonSpill::fHornCur, BeamMonSpill::fMuInt1, BeamMonSpill::fMuInt2, BeamMonSpill::fMuInt3, BeamMonSpill::fProfWidX, BeamMonSpill::fProfWidY, fSpill, BeamMonSpill::fTargBpmX, BeamMonSpill::fTargBpmY, BeamMonSpill::fTor101, BeamMonSpill::fTortgt, BeamMonSpill::fTr101d, BeamMonSpill::fTrtgtd, BeamMonSpill::fVmeTime, BeamDataLiteHeader::GetEarliestTimeStamp(), RecRecordImp< T >::GetHeader(), BeamDataLiteHeader::GetStatus(), BeamDataLiteHeader::GetTimeDiffStreamSpill(), NtpBDLiteRecord::hadint, NtpBDLiteRecord::horncur, NtpBDLiteRecord::muint1, NtpBDLiteRecord::muint2, NtpBDLiteRecord::muint3, BeamMonSpill::SetStatusBits(), SetTimeDiff(), NtpBDLiteRecord::tor101, NtpBDLiteRecord::tortgt, NtpBDLiteRecord::tr101d, and NtpBDLiteRecord::trtgtd.

00125 {
00126     fSpill = &spill;
00127 
00128     this->SetTimeDiff(ntpbdr.GetHeader().GetTimeDiffStreamSpill());
00129     
00130     spill.fDaeTime = ntpbdr.GetHeader().GetEarliestTimeStamp();
00131     spill.fVmeTime = ntpbdr.GetHeader().GetEarliestTimeStamp();
00132     spill.fTor101  = ntpbdr.tor101;
00133     spill.fTr101d  = ntpbdr.tr101d;
00134     spill.fTortgt  = ntpbdr.tortgt;
00135     spill.fTrtgtd  = ntpbdr.trtgtd;
00136     spill.fHornCur = ntpbdr.horncur;
00137     for (int i=0;i<6;++i){
00138         spill.fTargBpmX[i] = ntpbdr.bposx[i];
00139         spill.fTargBpmY[i] = ntpbdr.bposy[i];
00140         spill.fBpmInt[i]   = ntpbdr.bpmint[i];
00141     }
00142     spill.fProfWidX = ntpbdr.bwidx;
00143     spill.fProfWidY = ntpbdr.bwidy;
00144     spill.fHadInt = ntpbdr.hadint;
00145     spill.fMuInt1 = ntpbdr.muint1;
00146     spill.fMuInt2 = ntpbdr.muint2;
00147     spill.fMuInt3 = ntpbdr.muint3;
00148     union {int integer; BeamMonSpill::StatusBits bits; } status;
00149     status.integer = ntpbdr.GetHeader().GetStatus();
00150     spill.SetStatusBits(status.bits);
00151 
00152 }

void BMSpillAna::SetSpill ( const BeamMonSpill spill  ) 

Set the BeamMonSpill object.

Definition at line 115 of file BMSpillAna.cxx.

References fSpill, and SetTimeDiff().

Referenced by ParticleBeamMonAna::ana(), MadTVAnalysis::CreatePAN(), MadPIDAnalysis::CreatePAN(), MadMKAnalysis::CreatePAN(), MadAnalysis::CreatePAN(), NuExtraction::ExtractBeamInfoDB(), NuAnalysis::ExtractConfig(), ANtpInfoObjectFillerBeam::FillBeamInformation(), NtpMaker::FillSpillInfo(), MeuCuts::GetBDSelectSpillInfo(), NuBeam::IsGoodSpillAndFillPot(), NtpTools::PassBeamCuts(), DataQualityInterface::ProcessBeamStatus(), DataUtil::QueryBeamDB(), NueBeamMonModule::Reco(), and StndBmsSpin::Scan().

00116 {
00117     fSpill = &spill;
00118     // Reset the time difference every time to make sure that the user
00119     // updates it.
00120     this->SetTimeDiff(-99999);
00121 
00122 }

void BMSpillAna::SetTimeDiff ( Double_t  tdiff  )  [inline]

Set the time difference between the data stream and the beam monitoring data, needed when not using the ntuples. Be aware that you will need to call this method AFTER you set the spill object.

Definition at line 279 of file BMSpillAna.h.

References fTimeDiff.

Referenced by MadTVAnalysis::CreatePAN(), MadMKAnalysis::CreatePAN(), MadAnalysis::CreatePAN(), NuExtraction::ExtractBeamInfoDB(), ANtpInfoObjectFillerBeam::FillBeamInformation(), NtpMaker::FillSpillInfo(), DataQualityInterface::ProcessBeamStatus(), DataUtil::QueryBeamDB(), StndBmsSpin::Scan(), SetSnarlTime(), and SetSpill().

00280 {fTimeDiff = tdiff;}

void BMSpillAna::UseCutsSet ( Dbi::Task  cutset  )  [inline]

Change the set of cuts to use.

Definition at line 270 of file BMSpillAna.h.

References fCutsSet.

00271 {fCutsSet = cutset;}

void BMSpillAna::UseDatabaseCuts ( Bool_t  usedb = true  )  [inline]

Change if one wants to use the database or not.

Definition at line 267 of file BMSpillAna.h.

References fUseDBCuts.

Referenced by ANtpInfoObjectFillerBeam::ANtpInfoObjectFillerBeam(), MadTVAnalysis::CreatePAN(), MadPIDAnalysis::CreatePAN(), NuExtraction::ExtractBeamInfoDB(), NuAnalysis::ExtractConfig(), NtpMaker::FillSpillInfo(), NuBeam::IsGoodSpillAndFillPot(), NueBeamMonModule::NueBeamMonModule(), DataQualityInterface::ProcessBeamStatus(), and DataUtil::QueryBeamDB().

00268 {fUseDBCuts = usedb;}


Member Data Documentation

Int_t BMSpillAna::fBeamType [private]

Select specific beam type determined from the position of the target position and horn current. The conventions of Conventions/BeamType.h are followed. Note that the value is stored as an int, so let's hope no one will change the order of the enumeration.... Use the value "-1" to select all target positions. Default is -1

Definition at line 252 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Dbi::Task BMSpillAna::fCutsSet [private]

The database can hold different set of cuts used for different purposes. This variables determines which set of cuts to use: 0: Analysis cuts (default) 1-?: Beam study cuts

Definition at line 145 of file BMSpillAna.h.

Referenced by SelectSpill(), and UseCutsSet().

Double_t BMSpillAna::fFracOnTargetMax [private]

Definition at line 262 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Double_t BMSpillAna::fFracOnTargetMin [private]

Fraction of the beam on target, calculated using BMSpillAna::GetFracOnTarget. The default does not make a selection on this value, i.e. min=0 and max=1 This also makes an assumption of the knowledge of the horizontal and vertical target position. These values might have changed throughout the run.

Definition at line 261 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Double_t BMSpillAna::fHornCurMax [private]

Definition at line 236 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Double_t BMSpillAna::fHornCurMin [private]

Cuts on the horn current. Units are Munits::ampere Defaults are min=-2.0e5 and max=-1.55e5

Definition at line 235 of file BMSpillAna.h.

Referenced by ChangeCutValues(), and Print().

Double_t BMSpillAna::fPosTgtXMax [private]

Definition at line 172 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Double_t BMSpillAna::fPosTgtXMin [private]

Cuts on the beam position at the target projected from the intensity weighted average of all the batch positions measured by the BPMs. Be aware that the target center is not necessarily at (0,0) in this coordinate system. This offset is hard-coded for the time being! Hopefully this can be changed sometime in the future. Units are in Munits::mm. Defaults are min=-2.0 and max=-0.01

Definition at line 171 of file BMSpillAna.h.

Referenced by ChangeCutValues(), and Print().

Double_t BMSpillAna::fPosTgtYMax [private]

Definition at line 175 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Double_t BMSpillAna::fPosTgtYMin [private]

Defaults are min=0.01 and max=2.0.

Definition at line 174 of file BMSpillAna.h.

Referenced by ChangeCutValues(), and Print().

Int_t BMSpillAna::fResID [private]

Definition at line 148 of file BMSpillAna.h.

Referenced by SelectSpill().

DbiResultPtr<BeamMonCuts> BMSpillAna::fResPtr [private]

Definition at line 147 of file BMSpillAna.h.

Referenced by SelectSpill().

const BeamMonSpill* BMSpillAna::fSpill [private]

The pointer to the reference to the BeamMonSpill object.

Definition at line 131 of file BMSpillAna.h.

Referenced by FractionOnTarget(), GetSpill(), SelectSpill(), SetSnarlTime(), and SetSpill().

Int_t BMSpillAna::fTargetIn [private]

Target in? <0: i don't care =0: target out >0: target in Default is 1

Definition at line 243 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Double_t BMSpillAna::fTimeDiff [private]

Time difference between the data stream one is looking at and the beam monitoring time. This will be automatically set when using the beam data ntuples, but has to be set manually when using BeamMonSpill objects. Note that this variable always gets reset after setting the spill when not using the ntuples.

Definition at line 155 of file BMSpillAna.h.

Referenced by SelectSpill(), and SetTimeDiff().

Double_t BMSpillAna::fTimeDiffMax [private]

Below here are all the members that hold the cut values.

The maximum absolute time difference allowed. default is 1 second

Definition at line 161 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Double_t BMSpillAna::fTorIntMax [private]

Definition at line 230 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Double_t BMSpillAna::fTorIntMin [private]

The beam intensity as read out by TORTGT. Units are in 1e12 protons on target Defaults are min=0.5 and max=50

Definition at line 229 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Bool_t BMSpillAna::fUseDBCuts [private]

Choose wether to use the database or not, current default is to use the database.

Definition at line 139 of file BMSpillAna.h.

Referenced by SelectSpill(), and UseDatabaseCuts().

Int_t BMSpillAna::fUseProfMonOut [private]

Select beam when profile monitors are out. Default is true, one can also use a small negative values for the minimum widths cuts (e.g. -0.1mm)

Definition at line 224 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Registry BMSpillAna::fUserCuts [private]

Hold the user defined cut values as a Registry. Will be used to override the default values

Definition at line 135 of file BMSpillAna.h.

Referenced by ApplyUserCuts(), Config(), and GetUserCuts().

Int_t BMSpillAna::fUseSpotSizeCut [private]

If this value is non-zero, cut on the spot size instead of individual widths. This is introduced predominantly do deal with the cable swaps of the readout of x and y during the period Summer/Fall 2007. When using the old method of hard coded cuts, the default method will be to cut on the individual widths. In the database, most likely the individual cuts can be maintained for the first year of running, while the cut on beam spot size will be used for data thereafter.

Definition at line 219 of file BMSpillAna.h.

Referenced by ChangeCutValues(), and SelectSpill().

Double_t BMSpillAna::fWidXMax [private]

Definition at line 204 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Double_t BMSpillAna::fWidXMin [private]

Cuts on the beam widths as measured by the last profile monitor before the target. Be aware that the SWIC devices are not always read out, so there might be perfectly good beam be thrown away Units are in Munits::mm.

For reco version R1.18.0, the rms of the beam profile is in the database. These are in general larger than the widths of a gaussian fit. The default cuts on the rms are determined from the recommended values on the widths above, using data from May 19, 2005 to July 19, 2005. Defaults for rms in x are min=0.1 and max=2.0 Defaults for rms in y are min=0.1 and max=5.0

During the repopulating of the database in November, the widths of the profile monitors where obtained from a Gaussian fit. In the rare case of a fit failure, the database gets filled with -999.

These values will also be used to determine the cut value on the beam spot size. The minimum cut values on the widths in x and y should be set such that S_min=pi*fWidXMin*fWidYMin and likewise for the maximum cut value

Defaults are min=0.1 and max=1.5

Definition at line 203 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Double_t BMSpillAna::fWidYMax [private]

Definition at line 207 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().

Double_t BMSpillAna::fWidYMin [private]

Defaults are min=0.1 and max=2.0.

Definition at line 206 of file BMSpillAna.h.

Referenced by ChangeCutValues(), Print(), and SelectSpill().


The documentation for this class was generated from the following files:
Generated on Thu Jul 10 22:52:28 2014 for loon by  doxygen 1.4.7