DataUtil Namespace Reference
[DataUtil]

Functions

Bool_t IsGoodBeam (const VldContext cx)
Bool_t IsGoodBeamSPILL (const VldContext cx)
Bool_t IsGoodBeamHORN (const VldContext cx)
Int_t GetBeamType (const VldContext cx)
Double_t GetBeamPoTs (const VldContext cx)
void SelectBeamDB (const VldContext cx, Int_t &beamtype, Double_t &beampots, Bool_t &goodbeamspill, Bool_t &goodbeamhorn)
void SelectBeamDB (const Int_t sec, const Int_t nanosec, Int_t &beamtype, Double_t &beampots, Bool_t &goodbeamspill, Bool_t &goodbeamhorn)
void QueryBeamDB (const VldContext cx, Int_t &beamtype, Double_t &dt_spill, Double_t &dt_beamspill, Double_t &horncurr, Double_t &pots, Bool_t &passfail)
void QueryBeamDB (const Int_t sec, const Int_t nanosec, Int_t &beamtype, Double_t &dt_spill, Double_t &dt_beamspill, Double_t &horncurr, Double_t &pots, Bool_t &passfail)
template<class OutputIterator , class CandDaughterType >
OutputIterator CDL2STL (const CandHandle &handle, OutputIterator result)
 Base function to convert a candidate daughter list to an STL container of specific Candidate Handle type.
template<class OutputIterator >
OutputIterator CDL2STL (const CandHandle &handle, OutputIterator result)
 Base function to convert a candidate daughter list to an STL container of CandHandles.
template<class CandDaughterType >
std::vector< const
CandDaughterType * > 
CDL2STLvector (const CandHandle &handle)
 Convert a Candidate's Daughter list to an STL vector of pointers to given candidate handle type.
template<class CandDaughterType >
std::vector< CandDaughterType * > CDL2STLvector (CandHandle &handle)
 non const
template<class CandDaughterType >
std::list< const
CandDaughterType * > 
CDL2STLlist (const CandHandle &handle)
 Convert a Candidate's Daughter list to an STL list of pointers to given candidate handle type.
template<class CandDaughterType >
std::list< CandDaughterType * > CDL2STLlist (CandHandle &handle)
 nonconst version:
Bool_t IsGoodData (const NtpStRecord *st)
Bool_t IsGoodData (const VldContext &cx)
Bool_t IsGoodDataRUN (const VldContext &cx)
Bool_t IsGoodDataHV (const VldContext &cx)
Bool_t IsGoodDataCOIL (const VldContext &cx)
Bool_t IsGoodDataGPS (const VldContext &cx)
Bool_t IsGoodFDData (const NtpStRecord *st)
Bool_t IsGoodFDData (const VldContext &cx)
Bool_t IsGoodFDDataRUN (const VldContext &cx)
Bool_t IsGoodFDDataHV (const VldContext &cx)
Bool_t IsGoodFDDataCOIL (const VldContext &cx)
Bool_t IsGoodFDDataGPS (const VldContext &cx)
Bool_t IsGoodNDData (const NtpStRecord *st)
Bool_t IsGoodNDData (const VldContext &cx)
Bool_t IsGoodNDDataRUN (const VldContext &cx)
Bool_t IsGoodNDDataCOIL (const VldContext &cx)
bool dump_mom (const MomNavigator *, std::ostream &os)
 Dump the contents of mom ot give ostream.
bool dump_cand (const CandHandle *ch, std::ostream &os, std::string prefix="", int recurse_depth=1, int max_daughters=5)
const CandHeaderGetCandHeader (const MomNavigator *mom)
 Return the CandHeader from mom.
template<class CandType >
CandType * GetCandidate (const MomNavigator *mom, const char *cand_type=0, const char *cand_name=0)
 Pull candidate of given name and type out of mom. Return 0 if fail.
Detector::Detector_t GetDetector (const MomNavigator &mom)
 Returns the type of detector associated with the data in the given Mom.
Detector::Detector_t GetDetectorType (const MomNavigator &mom)
 old interface
void GetDetectorBinsZ (UgliGeomHandle ugh, int &nbins, double &min, double &max)
 Return number of bins and min/max in z to let one create integral binning based on z position of scintilator planes.
void GetDetectorBinsUV (UgliGeomHandle ugh, PlaneView::EPlaneView view, int &nbins, double &min, double &max)
 Return number of bins and min/max in U or V to let one create integral binning based on z position of scintilator strips. In general the two views give different results (NearDet).
template<class BlockType >
std::vector< const BlockType * > GetRawBlocks (const MomNavigator *mom)
 Pull RawData blocks out of Mom.
template<class BlockType >
const BlockType * GetRawBlock (const MomNavigator *mom)
template<class HeaderType >
const HeaderType * GetRawHeader (const MomNavigator *mom)
 Pull out the RawHeader from Mom.
template<class RecordType >
std::vector< RecordType * > GetRecords (MomNavigator *mom)
 Pull out records from Mom.
template<class RecordType >
std::vector< RecordType * > GetRecords (const MomNavigator *mom)
bool GetRunSnarlEvent (const MomNavigator *mom, int &run, int &snarl, int &event)
 Return run, snarl and event.
const RegistryGetTempTags (const TObject *record)
 Return a temptags Registry for a MINOS record without requiring the user to handle the two disparate inheritance hierarchies.
std::string GetTempTagString (const TObject *record, std::string key)
 Return a string value from a MINOS record temptags Registry; if the key doesn't exist return nonsense value. Works only for string type keys.
UgliGeomHandle GetUgliGeomHandle (const MomNavigator *mom)
 Try to produce an UgliGeomHandle from data in mom.
std::vector< VldContextGetVldContext (const MomNavigator *mom, const char *filter=0)
 Return a vector of unique VldContexts from the records in mom. Optional character string holds a comma separated list of class, user and stream names to use to filter from what records the VldContexts are taken. The string either lists an inclusive set, or if the first character is a '!', an exclusive set. If not set, all records will be considered.
void GetRunNumber (VldContext context, Int_t &run, Int_t &subrun)
void GetRunTimes (Detector::Detector_t detector, Int_t run, Int_t subrun, VldTimeStamp &startTime, VldTimeStamp &endTime)
void GetRunTimes (Detector::Detector_t detector, Int_t run, VldTimeStamp &startTime, VldTimeStamp &endTime)
VldTimeStamp GetStartTime (Detector::Detector_t detector, Int_t run, Int_t subrun=-1)
VldTimeStamp GetEndTime (Detector::Detector_t detector, Int_t run, Int_t subrun=-1)
Int_t GetRun (VldContext context)
Int_t GetSubRun (VldContext context)

Function Documentation

template<class OutputIterator >
OutputIterator DataUtil::CDL2STL ( const CandHandle handle,
OutputIterator  result 
) [inline]

Base function to convert a candidate daughter list to an STL container of CandHandles.

Start filling at "result" with the daughter list of the CandHandle. Will dynamic_cast<> each daughter to the given CandDaughterType. The end of the sequence is returned.

End users will likely be better off using CDL2STLvector or CDL2STLlist functions. Get a sequence of const CandDigitHandle* from a CandDigitListHandle:

Example to get a sequence of base const CandHandle's:

    typedef vector<const CandDigitHandle*> digivec_t;
    digivec_t digit_vec;
    typedef back_insert_iterator<digivec_t> digivec_inserter;
    digivec_inserter dvi(digit_vec);
    DataUtil::CDL2STL<digivec_inserter,const CandDigitHandle>(*cdlh,dvi);

Definition at line 96 of file CDL2STL.h.

00097 {
00098     return CDL2STL<OutputIterator,const CandHandle>(handle,result);
00099 }

template<class CandDaughterType >
std::list<CandDaughterType*> DataUtil::CDL2STLlist ( CandHandle handle  )  [inline]

nonconst version:

Definition at line 160 of file CDL2STL.h.

00161 {
00162     typedef std::list<CandDaughterType*> dvec_t;
00163     dvec_t dv;
00164     typedef std::back_insert_iterator<dvec_t> dv_inserter;
00165     dv_inserter dvi(dv);
00166     DataUtil::CDL2STL<dv_inserter, CandDaughterType>(handle,dvi);
00167     return dv;
00168 }

template<class CandDaughterType >
std::vector<CandDaughterType*> DataUtil::CDL2STLvector ( CandHandle handle  )  [inline]

non const

Definition at line 127 of file CDL2STL.h.

00128 {
00129     typedef std::vector<CandDaughterType*> dvec_t;
00130     dvec_t dv;
00131     typedef std::back_insert_iterator<dvec_t> dv_inserter;
00132 
00133     dv_inserter dvi(dv);
00134     DataUtil::CDL2STL<dv_inserter, CandDaughterType>(handle,dvi);
00135     return dv;
00136 }

bool DataUtil::dump_cand ( const CandHandle ch,
std::ostream &  os,
std::string  prefix = "",
int  recurse_depth = 1,
int  max_daughters = 5 
)

Definition at line 22 of file DumpMom.cxx.

References Form(), CandHandle::GetDaughterIterator(), CandHandle::GetName(), CandHandle::GetNDaughters(), CandHandle::GetTitle(), and n.

Referenced by dump_mom().

00027 {
00028   // Add name and title if it's a CandHandle.
00029   if(ch) {
00030     os << prefix 
00031        << Form("%s \t\"%s\" %s",ch->ClassName(),ch->GetName(), ch->GetTitle()) 
00032        << std::endl;
00033     int n = ch->GetNDaughters();
00034     if( max_daughters < n ) n = max_daughters;
00035     if( recurse_depth <=0) n = 0;
00036     if(n > 0) {
00037       TIter iter = ch->GetDaughterIterator();
00038       for(int i=0;i<n;i++) {
00039         const CandHandle* next = dynamic_cast<const CandHandle*>(iter.Next());
00040         if(next)
00041           if(! next->InheritsFrom("CandDigitHandle") )
00042             dump_cand(next,
00043                       os,
00044                       prefix+"  ",
00045                       recurse_depth-1,
00046                       max_daughters);
00047         
00048       } 
00049     }
00050     if(ch->GetNDaughters() > 0) {
00051       os << prefix << ".. Total daughters:" <<  ch->GetNDaughters() << endl;
00052     }
00053     
00054     return true;
00055   }
00056   return false;
00057 }

Double_t DataUtil::GetBeamPoTs ( const VldContext  cx  ) 

Definition at line 96 of file BeamQualDB.cxx.

References beamtype, and SelectBeamDB().

00097 {
00098   // query database
00099   // ==============
00100   Int_t beamtype;
00101   Double_t beampots; 
00102   Bool_t goodbeamspill;
00103   Bool_t goodbeamhorn;
00104 
00105   DataUtil::SelectBeamDB(cx,
00106                          beamtype,beampots,
00107                          goodbeamspill,goodbeamhorn);
00108   
00109   // return beam PoTs
00110   // ================
00111   return beampots;
00112 }

Int_t DataUtil::GetBeamType ( const VldContext  cx  ) 

Definition at line 78 of file BeamQualDB.cxx.

References beamtype, and SelectBeamDB().

Referenced by NueExtrapolationJB::AddChain().

00079 {
00080   // query database
00081   // ==============
00082   Int_t beamtype;
00083   Double_t beampots; 
00084   Bool_t goodbeamspill;
00085   Bool_t goodbeamhorn;
00086 
00087   DataUtil::SelectBeamDB(cx,
00088                          beamtype,beampots,
00089                          goodbeamspill,goodbeamhorn);
00090   
00091   // return beam type
00092   // ================
00093   return beamtype;
00094 }

Detector::Detector_t DataUtil::GetDetectorType ( const MomNavigator mom  )  [inline]

old interface

Definition at line 36 of file GetDetector.h.

References GetDetector().

00037     { return GetDetector(mom); }

VldTimeStamp DataUtil::GetEndTime ( Detector::Detector_t  detector,
Int_t  run,
Int_t  subrun = -1 
)

Definition at line 195 of file RunInfoDB.cxx.

References GetRunTimes().

00196 {
00197   std::cout << " *** DataUtil::GetEndTime(...) *** " << std::endl;
00198   
00199   VldTimeStamp startTime;
00200   VldTimeStamp endTime;
00201 
00202   GetRunTimes(detector, 
00203               run, subrun,
00204               startTime, endTime);
00205 
00206   return endTime;
00207 }  

template<class BlockType >
const BlockType* DataUtil::GetRawBlock ( const MomNavigator mom  )  [inline]

Definition at line 65 of file GetRawBlock.h.

00066 {
00067   std::vector<const BlockType*> v = GetRawBlocks<BlockType>(mom);
00068   if(v.size()>0) return v[0];
00069   else return NULL;
00070 }

template<class RecordType >
std::vector<RecordType*> DataUtil::GetRecords ( const MomNavigator mom  )  [inline]

Definition at line 53 of file GetRecords.h.

00054 {
00055     return GetRecords<RecordType>(const_cast<MomNavigator*>(mom));
00056 }

Int_t DataUtil::GetRun ( VldContext  context  ) 

Definition at line 209 of file RunInfoDB.cxx.

References GetRunNumber(), and run().

Referenced by LIRawNt::Ana(), TrackDirectionModule::Ana(), PTSimModule::Reco(), and DetectorAlignmentModule::Reco().

00210 {
00211   std::cout << " *** DataUtil::GetRun(...) *** " << std::endl;
00212   
00213   Int_t run = -1;
00214   Int_t subrun = -1;
00215 
00216   GetRunNumber(context, run, subrun);
00217 
00218   return run;
00219 }

void DataUtil::GetRunNumber ( VldContext  context,
Int_t &  run,
Int_t &  subrun 
)

Definition at line 11 of file RunInfoDB.cxx.

References bfld::AsString(), VldContext::GetDetector(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), DbuFarRunQuality::GetRun(), DbuNearRunQuality::GetRun(), VldContext::GetSimFlag(), DbuNearRunQuality::GetSubRun(), DbuFarRunQuality::GetSubRun(), VldContext::GetTimeStamp(), SimFlag::kData, Detector::kFar, Detector::kNear, n, and DbiResultPtr< T >::NewQuery().

Referenced by GetRun(), and GetSubRun().

00012 {
00013   std::cout << " *** DataUtil::GetRunNumber(...) *** " << std::endl;
00014 
00015   std::cout << "   Query DB: " << std::endl
00016             << "    Detector=" << Detector::AsString(context.GetDetector()) << std::endl
00017             << "    Time=" << context.GetTimeStamp() << std::endl;
00018 
00019   // initialise run/subrun number
00020   // ============================
00021   run = -1;
00022   subrun = -1;
00023 
00024   if( context.GetSimFlag() != SimFlag::kData ) return;
00025 
00026   // far detector
00027   // ============
00028   if( context.GetDetector()==Detector::kFar ) {
00029     std::cout << "   Searching in DbuFarRunQuality Table... " << std::endl;
00030 
00031     // search database
00032     DbiResultPtr<DbuFarRunQuality> farquery;
00033     Int_t fDbiTaskFar = 0;
00034     farquery.NewQuery(context,fDbiTaskFar);   
00035 
00036     // loop over results
00037     std::cout << "   Found " << farquery.GetNumRows() << " Rows " << std::endl;
00038     for( UInt_t n=0; n<farquery.GetNumRows(); n++ ){
00039       const DbuFarRunQuality* rowptr = farquery.GetRow(n);
00040       if( run>=0 && subrun>=0
00041        && rowptr->GetRun()!=run 
00042        && rowptr->GetSubRun()!=subrun ){
00043         std::cout << "    Warning: inconsistent run numbers " << std::endl
00044                   << "     " << rowptr->GetRun() << "(" << run << ") " 
00045                   << "     " << rowptr->GetSubRun() << "(" << subrun << ") " << std::endl;
00046       }
00047       run = rowptr->GetRun();
00048       subrun = rowptr->GetSubRun();
00049     }
00050   }
00051 
00052   // near detector
00053   // =============
00054   else if( context.GetDetector()==Detector::kNear ) {
00055     std::cout << "   Searching in DbuNearRunQuality Table... " << std::endl;
00056 
00057     // search database
00058     DbiResultPtr<DbuNearRunQuality> nearquery;
00059     Int_t fDbiTaskNear = 1;
00060     nearquery.NewQuery(context,fDbiTaskNear);   
00061 
00062     // loop over results
00063     std::cout << "   Found " << nearquery.GetNumRows() << " Rows " << std::endl;
00064     for( UInt_t n=0; n<nearquery.GetNumRows(); n++ ){
00065       const DbuNearRunQuality* rowptr = nearquery.GetRow(n);
00066       if( run>=0 && subrun>=0
00067        && rowptr->GetRun()!=run 
00068        && rowptr->GetSubRun()!=subrun ){
00069         std::cout << "    Warning: inconsistent run numbers " << std::endl
00070                   << "     " << rowptr->GetRun() << "(" << run << ") " 
00071                   << "     " << rowptr->GetSubRun() << "(" << subrun << ") " << std::endl;
00072       }
00073       run = rowptr->GetRun();
00074       subrun = rowptr->GetSubRun();
00075     }
00076   }
00077 
00078   std::cout << "   Result: " << std::endl
00079             << "    Run=" << run << std::endl
00080             << "    SubRun=" << subrun << std::endl;
00081   
00082   return;
00083 }

void DataUtil::GetRunTimes ( Detector::Detector_t  detector,
Int_t  run,
VldTimeStamp startTime,
VldTimeStamp endTime 
)

Definition at line 176 of file RunInfoDB.cxx.

References GetRunTimes().

00177 {
00178   GetRunTimes(detector,run,-1,startTime,endTime);
00179 }

void DataUtil::GetRunTimes ( Detector::Detector_t  detector,
Int_t  run,
Int_t  subrun,
VldTimeStamp startTime,
VldTimeStamp endTime 
)

Definition at line 85 of file RunInfoDB.cxx.

References bfld::AsString(), Form(), DbuNearRunQuality::GetEndTime(), DbuFarRunQuality::GetEndTime(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), DbuFarRunQuality::GetRun(), DbuNearRunQuality::GetRun(), VldTimeStamp::GetSec(), DbuFarRunQuality::GetStartTime(), DbuNearRunQuality::GetStartTime(), DbuNearRunQuality::GetSubRun(), DbuFarRunQuality::GetSubRun(), SimFlag::kData, Detector::kFar, Detector::kNear, n, and DbiResultPtr< T >::NewQuery().

Referenced by GetEndTime(), GetRunTimes(), and GetStartTime().

00086 {
00087   std::cout << " *** DataUtil::GetRunTimes(...) *** " << std::endl;
00088 
00089   std::cout << "   Query DB: " << std::endl
00090             << "    Detector=" << Detector::AsString(detector) << std::endl
00091             << "    Run=" << run << std::endl;
00092   if( subrun>=0 ){
00093     std::cout << "    SubRun=" << subrun << std::endl;
00094   }
00095   else{
00096     std::cout << "    (All SubRuns) " << std::endl;
00097   }
00098 
00099   // initialise start/end time
00100   // =========================
00101   startTime = VldTimeStamp(2030,1,1,0,0,0);
00102   endTime = VldTimeStamp(1980,1,1,0,0,0);
00103 
00104   // far detector
00105   // ============
00106   if( detector==Detector::kFar ) {
00107     std::cout << "   Searching in DbuFarRunQuality Table... " << std::endl;
00108 
00109     // search database
00110     DbiResultPtr<DbuFarRunQuality> farquery;
00111 
00112     Int_t fDbiTaskFar = 0;
00113     const char* sqltxt = Form("(AGGREGATENO=%d) and (TASK=%d) and (DETECTORMASK & %d) and (SIMMASK & %d)",run,fDbiTaskFar,Detector::kFar,SimFlag::kData);  
00114     DbiSqlContext sqlcontext(sqltxt);
00115     farquery.NewQuery(sqlcontext,fDbiTaskFar);
00116 
00117     // loop over results
00118     std::cout << "   Found " << farquery.GetNumRows() << " Rows " << std::endl;
00119     for( UInt_t n=0; n<farquery.GetNumRows(); n++ ){
00120       const DbuFarRunQuality* rowptr = farquery.GetRow(n);
00121       if( rowptr ){
00122         Int_t myRun = rowptr->GetRun();
00123         Int_t mySubRun = rowptr->GetSubRun();
00124         VldTimeStamp myStartTime = rowptr->GetStartTime();
00125         VldTimeStamp myEndTime = rowptr->GetEndTime();
00126 
00127         if( myRun==run
00128          && (mySubRun==subrun || subrun<0) ){
00129           if( myStartTime.GetSec()<startTime.GetSec() ) startTime = myStartTime;
00130           if( myEndTime.GetSec()>endTime.GetSec() ) endTime = myEndTime;
00131         }
00132       }
00133     }
00134 
00135   }
00136 
00137   // near detector
00138   // =============
00139   else if( detector==Detector::kNear ) {
00140     std::cout << "   Searching in DbuNearRunQuality Table... " << std::endl;
00141 
00142     // search database
00143     DbiResultPtr<DbuNearRunQuality> nearquery;
00144 
00145     Int_t fDbiTaskNear = 1;
00146     const char* sqltxt = Form("(AGGREGATENO=%d) and (TASK=%d) and (DETECTORMASK & %d) and (SIMMASK & %d)",run,fDbiTaskNear,Detector::kNear,SimFlag::kData);  
00147     DbiSqlContext sqlcontext(sqltxt);
00148     nearquery.NewQuery(sqlcontext,fDbiTaskNear);
00149 
00150     // loop over results
00151     std::cout << "   Found " << nearquery.GetNumRows() << " Rows " << std::endl;
00152     for( UInt_t n=0; n<nearquery.GetNumRows(); n++ ){
00153       const DbuNearRunQuality* rowptr = nearquery.GetRow(n);
00154       if( rowptr ){
00155         Int_t myRun = rowptr->GetRun();
00156         Int_t mySubRun = rowptr->GetSubRun();
00157         VldTimeStamp myStartTime = rowptr->GetStartTime();
00158         VldTimeStamp myEndTime = rowptr->GetEndTime();
00159 
00160         if( myRun==run
00161          && (mySubRun==subrun || subrun<0) ){
00162           if( myStartTime.GetSec()<startTime.GetSec() ) startTime = myStartTime;
00163           if( myEndTime.GetSec()>endTime.GetSec() ) endTime = myEndTime;
00164         }
00165       }
00166     }
00167   }
00168 
00169   std::cout << "   Result: " << std::endl
00170             << "    Start=" << startTime << std::endl
00171             << "    End=" << endTime << std::endl;
00172   
00173   return;
00174 }

VldTimeStamp DataUtil::GetStartTime ( Detector::Detector_t  detector,
Int_t  run,
Int_t  subrun = -1 
)

Definition at line 181 of file RunInfoDB.cxx.

References GetRunTimes().

Referenced by RunQualityFinder::QueryDB().

00182 {
00183   std::cout << " *** DataUtil::GetStartTime(...) *** " << std::endl;
00184   
00185   VldTimeStamp startTime;
00186   VldTimeStamp endTime;
00187 
00188   GetRunTimes(detector, 
00189               run, subrun,
00190               startTime, endTime);
00191 
00192   return startTime;
00193 }

Int_t DataUtil::GetSubRun ( VldContext  context  ) 

Definition at line 221 of file RunInfoDB.cxx.

References GetRunNumber(), and run().

Referenced by TrackDirectionModule::Ana(), and DetectorAlignmentModule::Reco().

00222 {
00223   std::cout << " *** DataUtil::GetSubRun(...) *** " << std::endl;
00224   
00225   Int_t run = -1;
00226   Int_t subrun = -1;
00227 
00228   GetRunNumber(context, run, subrun);
00229 
00230   return subrun;
00231 }

Bool_t DataUtil::IsGoodBeam ( const VldContext  cx  ) 

Definition at line 12 of file BeamQualDB.cxx.

References VldContext::GetSimFlag(), IsGoodBeamHORN(), IsGoodBeamSPILL(), and SimFlag::kData.

00013 {
00014   // If it's not real data, return kOK
00015   // =================================
00016   if( cx.GetSimFlag() != SimFlag::kData ){
00017     return 1;
00018   }
00019   
00020   // requirements for good beam
00021   // ==========================
00022   // (i) run beam selection - IsGoodBeamSPILL(cx)
00023   // (ii) cut on horn current - IsGoodBeamHORN(cx) 
00024 
00025   if( IsGoodBeamSPILL(cx)
00026    && IsGoodBeamHORN(cx) ) return 1;
00027   else return 0;
00028 }

Bool_t DataUtil::IsGoodBeamHORN ( const VldContext  cx  ) 

Definition at line 54 of file BeamQualDB.cxx.

References beamtype, VldContext::GetSimFlag(), SimFlag::kData, and SelectBeamDB().

Referenced by IsGoodBeam().

00055 {
00056   // If it's not real data, return kOK
00057   // =================================
00058   if( cx.GetSimFlag() != SimFlag::kData ){
00059     return 1;
00060   }
00061 
00062   // query database
00063   // ==============
00064   Int_t beamtype;
00065   Double_t beampots; 
00066   Bool_t goodbeamspill;
00067   Bool_t goodbeamhorn;
00068 
00069   DataUtil::SelectBeamDB(cx,
00070                          beamtype,beampots,
00071                          goodbeamspill,goodbeamhorn);
00072   
00073   // return pass/fail
00074   // ================
00075   return goodbeamhorn;
00076 }

Bool_t DataUtil::IsGoodBeamSPILL ( const VldContext  cx  ) 

Definition at line 30 of file BeamQualDB.cxx.

References beamtype, VldContext::GetSimFlag(), SimFlag::kData, and SelectBeamDB().

Referenced by IsGoodBeam().

00031 {
00032   // If it's not real data, return kOK
00033   // =================================
00034   if( cx.GetSimFlag() != SimFlag::kData ){
00035     return 1;
00036   }
00037 
00038   // query database
00039   // ==============
00040   Int_t beamtype;
00041   Double_t beampots; 
00042   Bool_t goodbeamspill;
00043   Bool_t goodbeamhorn;
00044 
00045   DataUtil::SelectBeamDB(cx,
00046                          beamtype,beampots,
00047                          goodbeamspill,goodbeamhorn);
00048 
00049   // return pass/fail
00050   // ================
00051   return goodbeamspill;
00052 }

Bool_t DataUtil::IsGoodData ( const VldContext cx  ) 

Definition at line 34 of file DataQualDB.cxx.

References VldContext::GetDetector(), VldContext::GetSimFlag(), IsGoodDataCOIL(), IsGoodDataGPS(), IsGoodDataHV(), IsGoodDataRUN(), SimFlag::kData, Detector::kFar, and Detector::kNear.

00035 {   
00036   // If it's not real data, return kOK
00037   // =================================
00038   if( cx.GetSimFlag() != SimFlag::kData ){
00039     return 1;
00040   }
00041 
00042   // Far Detector Data Selection
00043   // ===========================
00044   if( cx.GetDetector() == Detector::kFar ) { 
00045   
00046     // requirements for good far detector data: 
00047     //  (i)   good run - IsGoodDataRUN(cx)
00048     //  (ii)  good hv - IsGoodDataHV(cx)
00049     //  (iii) good coil - IsGoodDataCOIL(cx)
00050     //  (iv)  good gps error - IsGoodDataGPS(cx)
00051 
00052     if( IsGoodDataRUN(cx) && IsGoodDataHV(cx)
00053      && IsGoodDataCOIL(cx) && IsGoodDataGPS(cx) ) return 1;
00054     else return 0;
00055   }
00056   
00057   // Near Detector Data Selection
00058   // ============================
00059   if( cx.GetDetector() == Detector::kNear ) { 
00060   
00061     // requirements for good near detector data: 
00062     //  (i)  good run - IsGoodDataRUN(cx)
00063     //  (ii) good coil - IsGoodDataCOIL(cx)
00064 
00065     if( IsGoodDataRUN(cx) 
00066      && IsGoodDataCOIL(cx) ) return 1;
00067     else return 0;
00068   }
00069 
00070   return 1;
00071 }

Bool_t DataUtil::IsGoodData ( const NtpStRecord st  ) 

Definition at line 12 of file DataQualDB.cxx.

References RecRecordImp< T >::GetHeader(), and RecHeader::GetVldContext().

Referenced by ScintCalModule::Ana(), EventQualAna::Analyze(), NuExtraction::ExtractDataQuality(), ANtpInfoObjectFiller::FillHeaderInformation(), IsGoodFDData(), IsGoodNDData(), MiniMakerPID::RunMiniMakerPID(), and Trimmer::RunTrimmer().

00012                                                  {
00013 
00014   // far detector data quality
00015   // =========================
00016   // number of crates enabled
00017   // (superseded by DbuFarRunQuality table)
00018   
00019   // Int_t cratemask = 0;
00020   // const NtpSRDataQuality *ntpDataQual;
00021   // ntpDataQual = &(st->dataquality);
00022   // cratemask = ntpDataQual->cratemask;
00023   // if( cratemask!=16 ) return 0;
00024  
00025   // get validity context
00026   // ====================
00027   const RecCandHeader* Header = &(st->GetHeader());
00028   VldContext cx = Header->GetVldContext();
00029 
00030   return IsGoodData(cx);
00031 }

Bool_t DataUtil::IsGoodDataCOIL ( const VldContext cx  ) 

Definition at line 124 of file DataQualDB.cxx.

References VldContext::GetDetector(), VldContext::GetSimFlag(), RunStatus::IsOK(), SimFlag::kData, Detector::kFar, and Detector::kNear.

Referenced by ScintCalModule::Ana(), NuExtraction::ExtractDataQuality(), IsGoodData(), IsGoodFDDataCOIL(), and IsGoodNDDataCOIL().

00125 {
00126   // If it's not real data, return kOK
00127   // =================================
00128   if( cx.GetSimFlag() != SimFlag::kData ){
00129     return 1;
00130   }
00131 
00132   // Far Detector Data - Check Coil Status
00133   // =====================================
00134   if( cx.GetDetector() == Detector::kFar ) {
00135     return CoilTools::IsOK(cx);     
00136   }
00137   
00138   // Near Detector Data - Check Coil Status
00139   // ======================================
00140   if( cx.GetDetector() == Detector::kNear ) {
00141     return CoilTools::IsOK(cx);     
00142   }
00143 
00144   return 1;
00145 }

Bool_t DataUtil::IsGoodDataGPS ( const VldContext cx  ) 

Definition at line 147 of file DataQualDB.cxx.

References VldContext::GetDetector(), SpillServerMonFinder::GetNearestSpill(), VldTimeStamp::GetSec(), VldContext::GetSimFlag(), SpillServerMon::GetSpillTime(), SpillServerMon::GetSpillTimeError(), SpillServerMon::GetSpillType(), VldContext::GetTimeStamp(), SpillServerMonFinder::Instance(), SimFlag::kData, and Detector::kFar.

Referenced by NuExtraction::ExtractDataQuality(), IsGoodData(), and IsGoodFDDataGPS().

00148 {
00149   // If it's not real data, return kOK
00150   // =================================
00151   if( cx.GetSimFlag() != SimFlag::kData ){
00152     return 1;
00153   }
00154 
00155   // Far Detector Data - Check GPS Status
00156   // ====================================
00157   // get spillserver monitoring block for this snarl,
00158   // get GPS worst case uncertainty (nsec)
00159   // spill must be real and within 5 minutes
00160   if( cx.GetDetector() == Detector::kFar ) {
00161   
00162     SpillServerMonFinder& smon = SpillServerMonFinder::Instance();
00163     const SpillServerMon& spill_near = smon.GetNearestSpill(cx);
00164     VldTimeStamp dt = spill_near.GetSpillTime()-cx.GetTimeStamp();
00165 
00166     Int_t dt_sec = abs(dt.GetSec());
00167     Int_t gps_error = spill_near.GetSpillTimeError();
00168     Int_t spill_type = spill_near.GetSpillType();
00169 
00170     if( spill_type==1 && dt_sec<360 && gps_error>1000 ) return 0;
00171     else return 1;
00172   }
00173 
00174   return 1;
00175 }  

Bool_t DataUtil::IsGoodDataHV ( const VldContext cx  ) 

Definition at line 96 of file DataQualDB.cxx.

References VldContext::GetDetector(), HvStatusFinder::GetHvStatus(), VldContext::GetSimFlag(), CoilStatus::Good(), HvStatusFinder::Instance(), SimFlag::kData, Detector::kFar, and Detector::kNear.

Referenced by ScintCalModule::Ana(), NuExtraction::ExtractDataQuality(), IsGoodData(), and IsGoodFDDataHV().

00097 {
00098   // If it's not real data, return kOK
00099   // =================================
00100   if( cx.GetSimFlag() != SimFlag::kData ){
00101     return 1;
00102   }
00103 
00104   // Far Detector Data - Check HV Status
00105   // ===================================
00106   // check HV status within 60 secs of snarl
00107   // (N.B: arguments given to HvStatusFinder: 
00108   //   validity context, time window, task number)
00109   if( cx.GetDetector() == Detector::kFar ) {
00110     HvStatus::HvStatus_t hv_ok = 
00111       HvStatusFinder::Instance().GetHvStatus(cx,60,1);
00112     return HvStatus::Good(hv_ok);
00113   }
00114 
00115   // Near Detector Data, return kOK
00116   // ==============================
00117   if( cx.GetDetector() == Detector::kNear ) {
00118     return 1;
00119   }
00120 
00121   return 1;
00122 }

Bool_t DataUtil::IsGoodDataRUN ( const VldContext cx  ) 

Definition at line 73 of file DataQualDB.cxx.

References VldContext::GetDetector(), VldContext::GetSimFlag(), RunQualityFinder::Instance(), RunQualityFinder::IsOK(), SimFlag::kData, Detector::kFar, and Detector::kNear.

Referenced by ScintCalModule::Ana(), NuExtraction::ExtractDataQuality(), IsGoodData(), IsGoodFDDataRUN(), and IsGoodNDDataRUN().

00074 {
00075   // If it's not real data, return kOK
00076   // =================================
00077   if( cx.GetSimFlag() != SimFlag::kData ){
00078     return 1;
00079   }
00080 
00081   // Far Detector Data - Check Run Status
00082   // ====================================
00083   if( cx.GetDetector() == Detector::kFar ) {
00084     return RunQualityFinder::Instance().IsOK(cx);
00085   }
00086 
00087   // Near Detector Data - Check Run Status
00088   // =====================================
00089   if( cx.GetDetector() == Detector::kNear ) {
00090     return RunQualityFinder::Instance().IsOK(cx);
00091   }
00092 
00093   return 1;
00094 }

Bool_t DataUtil::IsGoodFDData ( const VldContext cx  ) 

Definition at line 184 of file DataQualDB.cxx.

References IsGoodData().

00185 { 
00186   return IsGoodData(cx); 
00187 }

Bool_t DataUtil::IsGoodFDData ( const NtpStRecord st  ) 
Bool_t DataUtil::IsGoodFDDataCOIL ( const VldContext cx  ) 

Definition at line 199 of file DataQualDB.cxx.

References IsGoodDataCOIL().

00200 { 
00201   return IsGoodDataCOIL(cx); 
00202 }

Bool_t DataUtil::IsGoodFDDataGPS ( const VldContext cx  ) 

Definition at line 204 of file DataQualDB.cxx.

References IsGoodDataGPS().

00205 { 
00206   return IsGoodDataGPS(cx); 
00207 }

Bool_t DataUtil::IsGoodFDDataHV ( const VldContext cx  ) 

Definition at line 194 of file DataQualDB.cxx.

References IsGoodDataHV().

00195 { 
00196   return IsGoodDataHV(cx); 
00197 }

Bool_t DataUtil::IsGoodFDDataRUN ( const VldContext cx  ) 

Definition at line 189 of file DataQualDB.cxx.

References IsGoodDataRUN().

00190 { 
00191   return IsGoodDataRUN(cx); 
00192 }

Bool_t DataUtil::IsGoodNDData ( const VldContext cx  ) 

Definition at line 216 of file DataQualDB.cxx.

References IsGoodData().

00217 { 
00218   return IsGoodData(cx); 
00219 }

Bool_t DataUtil::IsGoodNDData ( const NtpStRecord st  ) 

Definition at line 210 of file DataQualDB.cxx.

References IsGoodData().

00211 { 
00212   return IsGoodData(st); 
00213 }

Bool_t DataUtil::IsGoodNDDataCOIL ( const VldContext cx  ) 

Definition at line 226 of file DataQualDB.cxx.

References IsGoodDataCOIL().

00227 { 
00228   return IsGoodDataCOIL(cx); 
00229 }

Bool_t DataUtil::IsGoodNDDataRUN ( const VldContext cx  ) 

Definition at line 221 of file DataQualDB.cxx.

References IsGoodDataRUN().

00222 { 
00223   return IsGoodDataRUN(cx); 
00224 }

void DataUtil::QueryBeamDB ( const Int_t  sec,
const Int_t  nanosec,
Int_t &  beamtype,
Double_t &  dt_spill,
Double_t &  dt_beamspill,
Double_t &  horncurr,
Double_t &  pots,
Bool_t &  passfail 
)

Definition at line 167 of file BeamQualDB.cxx.

References SimFlag::kData, Detector::kFar, and QueryBeamDB().

00168 {
00169   VldTimeStamp vldTime(sec,nanosec);
00170   VldContext cx(Detector::kFar, SimFlag::kData, vldTime);
00171 
00172   QueryBeamDB(cx,
00173               beamtype,
00174               dt_spill,dt_beamspill,
00175               horncurr,pots,passfail);  
00176 
00177   return;
00178 }

void DataUtil::QueryBeamDB ( const VldContext  cx,
Int_t &  beamtype,
Double_t &  dt_spill,
Double_t &  dt_beamspill,
Double_t &  horncurr,
Double_t &  pots,
Bool_t &  passfail 
)

Definition at line 180 of file BeamQualDB.cxx.

References BeamMonSpill::BeamType(), MuELoss::e, BeamMonSpill::fHornCur, BeamMonSpill::fTor101, BeamMonSpill::fTortgt, BeamMonSpill::fTrtgtd, BDSpillAccessor::Get(), VldTimeStamp::GetNanoSec(), SpillTimeFinder::GetNearestSpill(), VldTimeStamp::GetSec(), SpillTimeND::GetTimeStamp(), SpillTimeFinder::GetTimeToNearestSpill(), SpillTimeFinder::Instance(), BDSpillAccessor::LoadSpill(), BMSpillAna::SelectSpill(), BMSpillAna::SetSpill(), BMSpillAna::SetTimeDiff(), BeamMonSpill::SpillTime(), and BMSpillAna::UseDatabaseCuts().

Referenced by QueryBeamDB(), and SelectBeamDB().

00181 {
00182   // initialise output variables
00183   // ===========================
00184   beamtype = 0;
00185   dt_spill = 0.0;
00186   dt_beamspill = 0.0;
00187   horncurr = 0.0;
00188   pots = 0.0;
00189   passfail = 0;
00190 
00191   // Beam Quality Info
00192   // =================
00193   Int_t beamType = 0;
00194   Double_t spillSubTime = 0.0;
00195   Double_t beamSubTime = 0.0;
00196   Double_t hornCurr = 0.0;
00197   Double_t PoTs = 0.0;
00198   Bool_t selectSpill = 0;
00199   Bool_t selectSpillBM = 0;
00200 
00201   // Spill Finder
00202   // ============
00203   // SpillTimeFinder: look up near detector spill data
00204   const SpillTimeND& spillND = SpillTimeFinder::Instance().GetNearestSpill(cx);
00205   VldTimeStamp spillTime = spillND.GetTimeStamp();
00206   
00207   spillSubTime = SpillTimeFinder::Instance().GetTimeToNearestSpill(cx);
00208 
00209 
00210   // Beam Monitor
00211   // ============
00212   // BeamSpillAccessor: look up beam monitoring data
00213   const BeamMonSpill* spillBM = BDSpillAccessor::Get().LoadSpill(spillTime);
00214   if( spillBM ){
00215     VldTimeStamp beamTime = spillBM->SpillTime();
00216 
00217     // get beam monitoring info
00218     // ========================
00219     beamType = spillBM->BeamType();
00220     hornCurr = spillBM->fHornCur;
00221 
00222     PoTs = 0.0;
00223     if(spillBM->fTrtgtd != 0.0) PoTs = spillBM->fTrtgtd;
00224     else if(spillBM->fTortgt != 0.0)  PoTs = spillBM->fTortgt;
00225     else if(spillBM->fTor101 != 0.0) PoTs = spillBM->fTor101;
00226     if( PoTs<0.06 ) PoTs = 0.0;
00227 
00228     beamSubTime = (beamTime.GetSec()-spillTime.GetSec())
00229          + 1.0e-9*(beamTime.GetNanoSec()-spillTime.GetNanoSec());
00230 
00231     // apply beam selection cuts
00232     // =========================
00233     BMSpillAna BMana;
00234     BMana.UseDatabaseCuts();
00235     BMana.SetSpill(*spillBM);
00236     BMana.SetTimeDiff(beamSubTime);
00237     selectSpillBM = BMana.SelectSpill();
00238 
00239     if( fabs(spillSubTime)<=0.5 && fabs(beamSubTime)<=1.0 ){
00240       selectSpill = selectSpillBM;
00241     }
00242   }
00243       
00244   // return output variables
00245   // =======================
00246   beamtype = beamType;
00247   dt_spill = spillSubTime;
00248   dt_beamspill = beamSubTime;
00249   horncurr = hornCurr;
00250   pots = PoTs;
00251   passfail = selectSpill;
00252 
00253   return;
00254 }

void DataUtil::SelectBeamDB ( const Int_t  sec,
const Int_t  nanosec,
Int_t &  beamtype,
Double_t &  beampots,
Bool_t &  goodbeamspill,
Bool_t &  goodbeamhorn 
)

Definition at line 114 of file BeamQualDB.cxx.

References SimFlag::kData, Detector::kFar, and SelectBeamDB().

00115 {
00116   VldTimeStamp vldTime(sec,nanosec);
00117   VldContext cx(Detector::kFar, SimFlag::kData, vldTime);
00118 
00119   SelectBeamDB(cx,
00120                beamtype, beampots,
00121                goodbeamspill, goodbeamhorn);
00122 
00123   return;
00124 }

void DataUtil::SelectBeamDB ( const VldContext  cx,
Int_t &  beamtype,
Double_t &  beampots,
Bool_t &  goodbeamspill,
Bool_t &  goodbeamhorn 
)

Definition at line 126 of file BeamQualDB.cxx.

References QueryBeamDB().

Referenced by GetBeamPoTs(), GetBeamType(), IsGoodBeamHORN(), IsGoodBeamSPILL(), and SelectBeamDB().

00127 {
00128   // query database
00129   // ==============
00130   Int_t query_beamtype = 0;
00131   Double_t query_dt_spill = 0.0;
00132   Double_t query_dt_beamspill = 0.0;
00133   Double_t query_horncurr = 0.0;
00134   Double_t query_pots = 0.0;
00135   Bool_t query_passfail = 0;  
00136 
00137   QueryBeamDB(cx,
00138               query_beamtype,
00139               query_dt_spill,query_dt_beamspill,
00140               query_horncurr,query_pots,query_passfail);  
00141 
00142   // apply selection
00143   // ===============
00144   beamtype = 0;
00145   beampots = 0.0;
00146   goodbeamspill = 0;
00147   goodbeamhorn = 0;
00148 
00149   if( fabs(query_dt_beamspill)<=60.0 ){
00150     beamtype = query_beamtype;
00151   }
00152 
00153   if( fabs(query_dt_spill)<=0.5 && fabs(query_dt_beamspill)<=1.0 ){
00154     beampots = query_pots;
00155   }
00156 
00157   if( fabs(query_dt_spill)<=0.5 && fabs(query_dt_beamspill)<=1.0 ){
00158     if( query_horncurr<-155.0 ) goodbeamhorn = 1;
00159     else goodbeamhorn = 0;
00160   }
00161 
00162   goodbeamspill = query_passfail;
00163 
00164   return;
00165 }


Generated on 14 Dec 2017 for loon by  doxygen 1.6.1