DSTUtil::Bflux Namespace Reference


Enumerations

enum  TrigBits {
  kNoPIDBeamBit = 0, kPiBeamBit = 5, kKBeamBit = 4, kPBeamBit = 6,
  kPiIntBit = 9, kKIntBit = 8, kPIntBit = 10
}

Functions

bool SelectAll (MIPPSpillSummary *const )
 For use with functor...
void GetBeamFluxForRun (const MIPPRunSummary *rs, TTree *spillTree, double *flux, std::vector< int > &gspl, bool(*goodsplfcn)(MIPPSpillSummary *const))
 Get beam flux for spills selected by goodsplfcn in this run.
void GetBeamFluxForRun (const MIPPRunSummary *rs, TTree *spillTree, double *flux, std::vector< int > &gspl)
 Get beam flux for good spills in this run.
void GetBeamFluxForRun (TFile *f, double *flux)
 Get beam flux for this run.
void GetBeamFluxForRun (TFile *f, double *flux, std::vector< int > &gspl)
 Get beam flux for good spills in this run.
bool GoodSpill (MIPPSpillSummary *const fSpl)
 Check if this spill is good.


Enumeration Type Documentation

enum DSTUtil::Bflux::TrigBits

Enumerator:
kNoPIDBeamBit 
kPiBeamBit 
kKBeamBit 
kPBeamBit 
kPiIntBit 
kKIntBit 
kPIntBit 

Definition at line 133 of file DSTUtil.h.

00133                   {
00134       kNoPIDBeamBit = 0,
00135 
00136       kPiBeamBit = 5,
00137       kKBeamBit = 4,
00138       kPBeamBit = 6,
00139 
00140       kPiIntBit = 9,
00141       kKIntBit = 8,
00142       kPIntBit = 10
00143     };


Function Documentation

bool DSTUtil::Bflux::SelectAll ( MIPPSpillSummary * const  fSpl  ) 

For use with functor...

Definition at line 429 of file DSTUtil.cxx.

Referenced by GetBeamFluxForRun().

00430 {
00431   return true;
00432 }

void DSTUtil::Bflux::GetBeamFluxForRun ( const MIPPRunSummary rs,
TTree *  spillTree,
double *  flux,
std::vector< int > &  gspl,
bool(*)(MIPPSpillSummary *const)  goodsplfcn 
)

Get beam flux for spills selected by goodsplfcn in this run.

Definition at line 438 of file DSTUtil.cxx.

References MIPPSpillSummary::gatedTrigBit, kKBeamBit, kKIntBit, kPBeamBit, kPiBeamBit, kPiIntBit, kPIntBit, MIPPSpillSummary::spill, and MIPPRunSummary::trigps.

Referenced by GetBeamFluxForRun(), and main().

00443 {
00444   gspl.clear();
00445   int prescale[3] = {0,0,0}; //Pi, K, prot
00446   prescale[0] = rs->trigps[kPiIntBit]+1;
00447   prescale[1] = rs->trigps[kKIntBit]+1;
00448   prescale[2] = rs->trigps[kPIntBit]+1;
00449 
00450   double fl[3] = {0,0,0};
00451 
00452   MIPPSpillSummary* fSpl = new MIPPSpillSummary();
00453   spillTree->SetBranchAddress("fSpillInfo", &fSpl);
00454   int nspills = spillTree->GetEntries();
00455 
00456   for (int spill=0; spill!=nspills; ++spill) {
00457     spillTree->GetEntry(spill);
00458     if (goodsplfcn(fSpl)) {
00459       gspl.push_back(fSpl->spill);
00460       fl[0] += ((double)fSpl->gatedTrigBit[kPiBeamBit]);
00461       fl[1] += ((double)fSpl->gatedTrigBit[kKBeamBit]);
00462       fl[2] += ((double)fSpl->gatedTrigBit[kPBeamBit]);    
00463     }
00464   }
00465   
00466   for (int i=0; i!=3; ++i) flux[i] = fl[i]/prescale[i];
00467 }

void DSTUtil::Bflux::GetBeamFluxForRun ( const MIPPRunSummary rs,
TTree *  spillTree,
double *  flux,
std::vector< int > &  gspl 
)

Get beam flux for good spills in this run.

Definition at line 472 of file DSTUtil.cxx.

References GetBeamFluxForRun(), and GoodSpill().

00476 {
00477   GetBeamFluxForRun(rs, spillTree, flux, gspl, &GoodSpill);
00478 }

void DSTUtil::Bflux::GetBeamFluxForRun ( TFile *  f,
double *  flux 
)

Get beam flux for this run.

Definition at line 483 of file DSTUtil.cxx.

References GetBeamFluxForRun(), DSTUtil::GetRunSummary(), DSTUtil::GetSpillTree(), s, and SelectAll().

00484 {
00485   MIPPRunSummary* rs = GetRunSummary(f);
00486   TTree* spilltree = GetSpillTree(f);
00487   std::vector<int> s;
00488   GetBeamFluxForRun(rs, spilltree, flux, s, &SelectAll);
00489 }

void DSTUtil::Bflux::GetBeamFluxForRun ( TFile *  f,
double *  flux,
std::vector< int > &  gspl 
)

Get beam flux for good spills in this run.

Definition at line 494 of file DSTUtil.cxx.

References GetBeamFluxForRun(), DSTUtil::GetRunSummary(), and DSTUtil::GetSpillTree().

00496 {
00497   MIPPRunSummary* rs = GetRunSummary(f);
00498   TTree* spilltree = GetSpillTree(f);
00499   GetBeamFluxForRun(rs, spilltree, flux, gspl);
00500 }

bool DSTUtil::Bflux::GoodSpill ( MIPPSpillSummary *const   fSpl  ) 

Check if this spill is good.

For now: demand reasonable lifetime

Definition at line 506 of file DSTUtil.cxx.

References MIPPSpillSummary::gatedTrigBit, and MIPPSpillSummary::rawTrigBit.

Referenced by GetBeamFluxForRun().

00507 {
00508   double rfgated = fSpl->gatedTrigBit[12];
00509   double rfraw = fSpl->rawTrigBit[12];
00510   double fLT = (rfraw == 0.) ? 0. : rfgated/rfraw;
00511 
00512   return (fLT>0. && fLT<1.);
00513 }


Generated on Mon Nov 23 08:05:24 2009 for MIPP(E907) by  doxygen 1.4.7