DataUtil

A package to provide classes and functions generally useful for accessing the data. More...

Classes

class  DatabaseToucher
 Module that does nothing but load databases. More...
class  DumpMomModule
 A JobControl module which will call DataUtil::dump_mom() and dump the contents of the MomNavigator to cerr. More...
class  FarTimingFidFinder
 A class to provide look-up services on the FarTimingFid table. More...
class  HistManModule
 A module to write out any histograms held in the HistMan hierarchy. More...
class  MasterGeVPerMip
 A class for managing sets of GeVPerMip values by release name (or arbitrary string). More...
class  MCFilePOTInfoFinder
 A class to provide look-up services on the MCFilePOTInfo table. More...
class  McNormalizationFinder
 A class to provide look-up services on the MC_NORMALIZATION table. More...
class  PlaneOutline
 A detector plane outline. More...
class  RawRecCounts
 Characterize a RawData file. More...
class  SleepModule
 A sleepy job module. More...
class  TruthHelper
class  Truthifier
 Contains a set of maps allowing navigation between various MC truth objects. More...
class  ValidateRawChecksums
 A job module that checks checksums. More...

Namespaces

namespace  DataUtil

Functions

template<class OutputIterator , class CandDaughterType >
OutputIterator DataUtil::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 CandDaughterType >
std::vector< const
CandDaughterType * > 
DataUtil::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::list< const
CandDaughterType * > 
DataUtil::CDL2STLlist (const CandHandle &handle)
 Convert a Candidate's Daughter list to an STL list of pointers to given candidate handle type.
bool DataUtil::dump_mom (const MomNavigator *, std::ostream &os)
 Dump the contents of mom ot give ostream.
const CandHeaderDataUtil::GetCandHeader (const MomNavigator *mom)
 Return the CandHeader from mom.
template<class CandType >
CandType * DataUtil::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 DataUtil::GetDetector (const MomNavigator &mom)
 Returns the type of detector associated with the data in the given Mom.
void DataUtil::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 DataUtil::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 * > DataUtil::GetRawBlocks (const MomNavigator *mom)
 Pull RawData blocks out of Mom.
template<class HeaderType >
const HeaderType * DataUtil::GetRawHeader (const MomNavigator *mom)
 Pull out the RawHeader from Mom.
template<class RecordType >
std::vector< RecordType * > DataUtil::GetRecords (MomNavigator *mom)
 Pull out records from Mom.
bool DataUtil::GetRunSnarlEvent (const MomNavigator *mom, int &run, int &snarl, int &event)
 Return run, snarl and event.
const RegistryDataUtil::GetTempTags (const TObject *record)
 Return a temptags Registry for a MINOS record without requiring the user to handle the two disparate inheritance hierarchies.
std::string DataUtil::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 DataUtil::GetUgliGeomHandle (const MomNavigator *mom)
 Try to produce an UgliGeomHandle from data in mom.
std::vector< VldContextDataUtil::GetVldContext (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.

Detailed Description

A package to provide classes and functions generally useful for accessing the data.

Note:
This package MUST only depend on core packages and core package must NOT depend on it.

Function Documentation

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

Base function to convert a candidate daughter list to an STL container of specific Candidate Handle type.

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.

Example to get a sequence of base CandHandle's:

    const CandDigitList* cdlh;
    // ...
    typedef vector<const CandHandle*> digivec_t;
    digivec_t digit_vec;
    back_insert_iterator<digivec_t> dvi(digit_vec);
    DataUtil::CDL2STL(*cdlh,dvi);

Definition at line 58 of file CDL2STL.h.

References CandHandle::GetDaughterIterator().

00059 {
00060 
00061     TIter next = handle.GetDaughterIterator();
00062     TObject* obj;
00063     while ((obj=next())) {
00064         *result = dynamic_cast<CandDaughterType*>(obj);
00065         ++result;
00066     }
00067     return result;
00068 }

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

Convert a Candidate's Daughter list to an STL list of pointers to given candidate handle type.

const version

Definition at line 148 of file CDL2STL.h.

00149 {
00150     typedef std::list<const CandDaughterType*> dvec_t;
00151     dvec_t dv;
00152     typedef std::back_insert_iterator<dvec_t> dv_inserter;
00153     dv_inserter dvi(dv);
00154     DataUtil::CDL2STL<dv_inserter,const CandDaughterType>(handle,dvi);
00155     return dv;
00156 }

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

Convert a Candidate's Daughter list to an STL vector of pointers to given candidate handle type.

Example of:

    vector<const CandDigitHandle*> dv = CDL2STLvector<CAndDigitHandle>(*cdlh);

Definition at line 114 of file CDL2STL.h.

00115 {
00116     typedef std::vector<const CandDaughterType*> dvec_t;
00117     dvec_t dv;
00118     typedef std::back_insert_iterator<dvec_t> dv_inserter;
00119 
00120     dv_inserter dvi(dv);
00121     DataUtil::CDL2STL<dv_inserter,const CandDaughterType>(handle,dvi);
00122     return dv;
00123 }

bool DataUtil::dump_mom ( const MomNavigator mom,
std::ostream &  os 
)

Dump the contents of mom ot give ostream.

Author:
(last to touch it)
Author
tagg
Version:
Revision
1.4
Date:
Date
2005/05/12 11:12:49

Contact: bv@bnl.gov

Created on: Mon Dec 9 14:11:00 2002

Id
DumpMom.h,v 1.4 2005/05/12 11:12:49 tagg Exp

Definition at line 60 of file DumpMom.cxx.

References dump_cand(), RawHeader::FormatToOStream(), MomNavigator::FragmentIter(), CandRecord::GetCandHandleList(), CandRecord::GetCandHeader(), RecDataRecord< T >::GetComponents(), RecMinos::GetComponents(), MomNavigator::GetFragment(), RawRecord::GetRawHeader(), SimSnarlRecord::GetSimSnarlHeader(), RecMinos::GetTemporaries(), RecDataRecord< T >::GetTemporaries(), SimSnarlHeader::Print(), and CandHeader::Print().

Referenced by BDataQualityModule::Ana(), DumpMomModule::Ana(), ReadDispatcherModule::IsNewEventReady(), and EventInfoPage::WriteInfo().

00061 {
00062     if (!mom) {
00063         return false;
00064     }
00065 
00066     os << "Mom holds:\n";
00067     TIter next = mom->FragmentIter();
00068     TObject* obj;
00069     while ( (obj=next()) ) {
00070         RecMinos*  rm  = dynamic_cast<RecMinos*>(obj);
00071         RecRecord* rdr = dynamic_cast<RecRecord*>(obj);
00072         const TObjArray* compArray[2] = {0,0};
00073 
00074         if (!rm && !rdr) {
00075           // It's not a RecMinos/RecRecord, so just dump the class title:
00076           os << obj->ClassName() << endl;
00077           os << "\tNo Components." << endl;
00078           continue;
00079         }
00080 
00081         // If it comes from RecMinos or RecRecord, it's got a name and title.
00082         
00083         if (rm) {
00084           os <<  obj->ClassName()
00085              << "\t\"" << rm->GetName() << "\""
00086              << "\t" << rm->GetTitle() << endl;
00087 
00088           compArray[0] = &(rm->GetComponents());
00089           compArray[1] = &(rm->GetTemporaries());
00090 
00091           // If it's a RawRecord, print the header.
00092           RawRecord* rawrec = dynamic_cast<RawRecord*>(rm);
00093           if(rawrec) {
00094             if(rawrec->GetRawHeader()) {
00095               rawrec->GetRawHeader()->FormatToOStream(os);
00096               os << endl;
00097             }
00098           }
00099 
00100           // If it's a CandRecord, print the header
00101           CandRecord* candrec = dynamic_cast<CandRecord*>(rm);
00102           if (candrec) {
00103             const CandHeader* candhead = candrec->GetCandHeader();
00104             if (candhead) {
00105               candhead->Print();   // currently can't handle other than cout
00106             }
00107           }
00108 
00109         }
00110 
00111         if (rdr) {
00112           os <<  obj->ClassName()
00113              << "\t\"" << rdr->GetName() << "\""
00114              << "\t" << rdr->GetTitle() << endl;
00115 
00116           // If it's a SimSnarlRecord, print the header
00117           SimSnarlRecord* simrec = dynamic_cast<SimSnarlRecord*>(rdr);
00118           if (simrec) {
00119             compArray[0] = &(simrec->GetComponents());
00120             compArray[1] = &(simrec->GetTemporaries());
00121 
00122             const SimSnarlHeader* simhead = simrec->GetSimSnarlHeader();
00123             if (simhead) {
00124               simhead->Print(os);
00125               os << endl;
00126             }
00127           }
00128         }
00129         
00130 
00131         const char* arrayName[2] = {"Components","Temporaries"};
00132         for (int iArray=0; iArray<2; ++iArray) {
00133           if ( compArray[iArray] == 0 || 
00134                compArray[iArray]->GetEntriesFast() <= 0 ) continue;
00135           os << "---" << arrayName[iArray] << ":" << endl;
00136           const TObjArray& oa = *(compArray[iArray]);
00137           TIter next_comp(oa.MakeIterator());
00138           TObject* comp;
00139           while ( (comp=next_comp()) ) {
00140                        
00141             // Try to see what kind o' thing it is
00142             TNamed* named = dynamic_cast<TNamed*>(comp);
00143             CandHandle* ch = dynamic_cast<CandHandle*>(comp);
00144             TCollection* col = dynamic_cast<TCollection*>(comp);
00145             
00146             if(col) {
00147               // Add name and title if it's a collection
00148               os << "      " << comp->ClassName()
00149                  << "\t\"" << col->GetName() << "\"\t with " << col->GetSize() << " elements" << endl;
00150 
00151             } else if(named) {
00152               // Add name and title if it's a named object.
00153               os << "      " << comp->ClassName()
00154                  << "\t\"" << named->GetName() << "\"\t" << named->GetTitle() << endl;
00155 
00156             } else if(ch) {
00157               // It's a candidate. Do something clever.
00158               dump_cand(ch,os,"      ");
00159 
00160             } else {
00161               // Dunno. Print it's name or something.
00162               os << "      " << comp->ClassName() << endl;
00163             };        
00164 
00165             //const RawDataBlock* rdb = dynamic_cast<const RawDataBlock*>(comp);
00166             //if(rdb) rdb->Print(); // keep from printing all the rawdigits in an RDDB
00167           
00168           }
00169         }  // loop over Components/Temporaries
00170         
00171         os << endl;
00172 
00173     } // loop over objects in mom's basket
00174 
00175 #if 0
00176     CandRecord* crec = dynamic_cast<CandRecord*>
00177         (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00178     if (!crec) {
00179         cerr << "dump_mom: no CandRecord\n";
00180         return false;
00181     }
00182 
00183     const TObjArray oa = crec->GetCandHandleList();
00184     int last = oa.GetLast();
00185     cerr << "Contents of PrimaryCandidateRecord:\n";
00186     for (int i = 0; i <= last; ++i) {
00187         TObject* o = oa.At(i);
00188         if (!o) continue;
00189         cerr << "\t" << o->ClassName() << "::" << o->GetName()<< endl;
00190     }
00191     
00192 #endif
00193     return true;
00194 }

const CandHeader* DataUtil::GetCandHeader ( const MomNavigator mom  )  [inline]

Return the CandHeader from mom.

Author:
(last to touch it)
Author
bv
Version:
Revision
1.4
Date:
Date
2005/04/15 15:39:49

Contact: bv@bnl.gov

Created on: Wed Jul 10 11:41:41 2002

Id
GetCandHeader.h,v 1.4 2005/04/15 15:39:49 bv Exp

Definition at line 28 of file GetCandHeader.h.

References CandRecord::GetCandHeader(), and MomNavigator::GetFragment().

Referenced by StopMuFilterModule::Ana(), NtpStModule::Get(), GetRunSnarlEvent(), StopMuFinderFar::IsStopping(), NtpSRModule::Reco(), NtpMRModule::Reco(), NtpFitSAModule::Reco(), NtpEMModule::Reco(), NtpCluster3DModule::Reco(), and DemoCandNtpModule::Reco().

00029 {
00030     if (!mom) return 0;
00031     CandRecord* crec = dynamic_cast<CandRecord*>
00032         (mom->GetFragment("CandRecord","PrimaryCandidateRecord"));
00033     if (!crec) return 0;
00034     return crec->GetCandHeader();
00035 }

template<class CandType >
CandType* DataUtil::GetCandidate ( const MomNavigator mom,
const char *  cand_type = 0,
const char *  cand_name = 0 
) [inline]

Pull candidate of given name and type out of mom. Return 0 if fail.

Author:
(last to touch it)
Author
bv
Version:
Revision
1.6
Date:
Date
2005/04/15 15:39:49

Contact: bv@bnl.gov

Created on: Fri Jun 28 10:34:37 2002

Id
GetCandidate.h,v 1.6 2005/04/15 15:39:49 bv Exp

Definition at line 30 of file GetCandidate.h.

References CandRecord::FindCandHandle(), and MomNavigator::GetFragment().

00033 {
00034     CandRecord* crec = dynamic_cast<CandRecord*> 
00035         (mom->GetFragment("CandRecord","PrimaryCandidateRecord"));
00036     if (!crec) return 0;
00037     return dynamic_cast<CandType*>(crec->FindCandHandle(cand_type,cand_name));
00038 }

Detector::Detector_t DataUtil::GetDetector ( const MomNavigator mom  ) 

Returns the type of detector associated with the data in the given Mom.

Definition at line 8 of file GetDetector.cxx.

References VldContext::GetDetector(), MomNavigator::GetFragment(), RecRecordImp< T >::GetHeader(), RecHeader::GetVldContext(), RecMinos::GetVldContext(), and Detector::kUnknown.

Referenced by NueHandScan::Ana(), LIRawNt::Ana(), CandTrackHandle::BelongsWithShower(), CandShowerSRHandle::BelongsWithTrack(), CandShowerHandle::BelongsWithTrack(), NueExtrapolationJB::BuildAppTrueHistExact(), NueExtrapolationJB::BuildAppTrueHistFast(), UserDisplayModule::BuildDisplay(), NueDisplayModule::BuildDisplay(), PlexusReroot::BuildPermute(), MadAnalysis::CreatePAN(), Calibrator::DecalAttenCorrectedTpos(), SimpleCalScheme::DecalGainAndWidth(), PulserTimeCalScheme::DecalTime(), RawVtmTimeInfoBlock::FillCrateId(), RawQieLookUpTableBlock::FillCrateId(), RawCrateMonitorBlock::FillCrateId(), RerootToTruthModule::Get(), Calibrator::GetAttenCorrectedTpos(), PulserTimeCalScheme::GetCalibratedTime(), NueExtrapolationJB::GetCCRatio(), GetDetectorType(), PulserSigLinCalScheme::GetDriftFar(), PulserDriftCalScheme::GetDriftFar(), PulserSigLinCalScheme::GetDriftPoint(), PulserDriftCalScheme::GetDriftPoint(), SimpleCalScheme::GetPhotoElectrons(), PEGainCalScheme::GetRow(), PEGainAggCalScheme::GetRow(), CandStripHandle::GetTPos(), UgliStripHandle::GlobalPos(), PEGainCalScheme::GuessGainAndWidth(), PEGainAggCalScheme::GuessGainAndWidth(), RerootToRawDataModule::InitWorkingArray(), CandTrackHandle::IsUnphysical(), NueExtrapolationJB::LoadFiles(), UgliStripHandle::LocalToGlobal(), UgliSteelPlnHandle::LocalToGlobal(), UgliScintPlnHandle::LocalToGlobal(), UgliScintMdlHandle::LocalToGlobal(), UgliSteelPlnHandle::LocalToGlobalVect(), Anp::FillTruth::Run(), GeoValidate::TestGeom_GetTransverseExtent(), GeoValidate::TestGeom_GetZExtent(), SRMom::TrackEndDistOuterTransEdge(), SRMom::TrackEndDistZEnd(), and PulserTimeCalScheme::WalkCorrection().

00009 {
00010     const VldContext* vc = 0;
00011     RecMinos* rm = dynamic_cast<RecMinos*>(mom.GetFragment("RecMinos"));
00012     if (rm) vc = rm->GetVldContext();
00013     else {
00014       RecRecordImp<RecCandHeader> *rr =
00015           dynamic_cast<RecRecordImp<RecCandHeader>*>
00016                (mom.GetFragment("RecRecordImp<RecCandHeader>"));
00017       if (rr) vc = &(rr->GetHeader().GetVldContext());
00018     }
00019     if (!vc) return Detector::kUnknown;
00020     return vc->GetDetector();
00021 }

void DataUtil::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).

Definition at line 14 of file GetDetectorBins.cxx.

References VldRange::GetDetectorMask(), UgliGeomHandle::GetScintPlnHandleVector(), UgliGeomHandle::GetVldRange(), Detector::kCalib, Detector::kFar, Detector::kNear, and PlaneCoverage::kNearFull.

Referenced by HistDisp::HistDisp().

00016 {
00017     vector<UgliScintPlnHandle> scints = ugh.GetScintPlnHandleVector();
00018 
00019     // u/v bins
00020     double binper=0;
00021     switch (ugh.GetVldRange().GetDetectorMask()) {
00022     case Detector::kNear:
00023         for (size_t ind = 0; ind < scints.size(); ++ind) {
00024             if (scints[ind].GetPlaneCoverage() == PlaneCoverage::kNearFull) {
00025                 if (scints[ind].GetPlaneView() == view) {
00026                     vector<UgliStripHandle> v = scints[ind].GetStripHandleVector();
00027                     min = v.front().GetTPos()-v.front().GetHalfWidth();
00028                     max = v.back().GetTPos()+v.back().GetHalfWidth();
00029                     binper = v.size()/(max-min);
00030                 }
00031                 if (binper) break;
00032             }
00033         }
00034         break;
00035     case Detector::kFar: case Detector::kCalib: {
00036         vector<UgliStripHandle> v = scints[0].GetStripHandleVector();
00037         min = v.front().GetTPos()-v.front().GetHalfWidth();
00038         max =  v.back().GetTPos() +v.back().GetHalfWidth();
00039         binper = v.size()/(max-min);
00040         break;}
00041     default:
00042         break;
00043     }
00044     nbins = (int)(((max-min)*binper)+0.5);
00045 }

void DataUtil::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.

Definition at line 48 of file GetDetectorBins.cxx.

References VldRange::GetDetectorMask(), UgliGeomHandle::GetSteelPlnHandleVector(), UgliGeomHandle::GetVldRange(), UgliGeomHandle::GetZExtent(), Detector::kCalib, Detector::kFar, Detector::kNear, max, and min.

Referenced by HistDisp::HistDisp().

00050 {
00051     vector<UgliSteelPlnHandle> steel = ugh.GetSteelPlnHandleVector();
00052 
00053     // Z bins
00054     double zbinper=0;
00055     switch (ugh.GetVldRange().GetDetectorMask()) {
00056     case Detector::kNear: case Detector::kCalib:
00057         ugh.GetZExtent(zmin,zmax);
00058         zbinper = steel.size()/(zmax-zmin);
00059         break;
00060     case Detector::kFar:{
00061         double max,min;
00062         ugh.GetZExtent(zmin,min,0);
00063         ugh.GetZExtent(max,zmax,1);
00064         zbinper = steel.size()/((zmax-zmin)-(max-min));
00065         break;}
00066     default:
00067         break;
00068     }
00069     nbins = (int)(((zmax-zmin)*zbinper)+0.5);
00070 }

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

Pull RawData blocks out of Mom.

Definition at line 38 of file GetRawBlock.h.

References MomNavigator::FragmentIter(), and RawRecord::GetRawBlockIter().

00039 {
00040   std::vector<const BlockType*> result;
00041 
00042   if(!mom) return result;
00043 
00044   // Loop through all RawRecords in mom:
00045   TObject* tobj;
00046   TIter fragiter = mom->FragmentIter();
00047   while( ( tobj = fragiter.Next() ) ) {
00048     const RawRecord* rawrec = dynamic_cast<const RawRecord*>(tobj);
00049 
00050     if(rawrec) {
00051       // Loop through all blocks in record.
00052       TIter blockiter = rawrec->GetRawBlockIter();
00053       while( ( tobj = blockiter.Next() ) ) {
00054         const BlockType* myBlock = dynamic_cast<const BlockType*>(tobj);
00055         if(myBlock) result.push_back(myBlock);
00056       }
00057       
00058     }
00059   }
00060   return result;
00061 }

template<class HeaderType >
const HeaderType* DataUtil::GetRawHeader ( const MomNavigator mom  )  [inline]

Pull out the RawHeader from Mom.

Definition at line 36 of file GetRawHeader.h.

References MomNavigator::FragmentIter(), and RawRecord::GetRawHeader().

Referenced by LIRawNt::Ana(), NtpStModule::Get(), NtpFitSAModule::Reco(), NtpEMModule::Reco(), NtpSRModule::Reco(), DemoNtupleModule::Reco(), NtpCluster3DModule::Reco(), and NtpMRModule::Reco().

00037 {
00038   if (!mom) return 0;
00039   // Loop through all RawRecords in mom:
00040   TObject* tobj;
00041   TIter fragiter = mom->FragmentIter();
00042   while( ( tobj = fragiter.Next() ) ) {
00043     const RawRecord* rawrec = dynamic_cast<const RawRecord*>(tobj);
00044     if(rawrec) {
00045       const HeaderType* myHead = dynamic_cast<const HeaderType*>(rawrec->GetRawHeader());
00046       if(myHead) return myHead;
00047     }
00048   }
00049   return NULL;
00050 }

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

Pull out records from Mom.

This function simplifies getting all records of a particular type out of a MomNavigator. It simply returns an STL vector of all Records matching the templated type.

Definition at line 40 of file GetRecords.h.

References MomNavigator::FragmentIter().

00041 {
00042     std::vector<RecordType*> ret;    
00043     TIter mitr = mom->FragmentIter();
00044     TObject* object = 0;
00045     while ( (object = mitr.Next()) ) {
00046         RecordType* rec = dynamic_cast<RecordType*>(object);
00047         if (rec) ret.push_back(rec);
00048     }
00049     return ret;
00050 }

bool DataUtil::GetRunSnarlEvent ( const MomNavigator mom,
int &  run,
int &  snarl,
int &  event 
) [inline]

Return run, snarl and event.

Note:
Event number is determined by a candidate not DAQ.

Definition at line 39 of file GetRunSnarlEvent.h.

References GetCandHeader(), RecCandHeader::GetEvent(), CandHeader::GetEvent(), MomNavigator::GetFragment(), RecRecordImp< T >::GetHeader(), RecDataHeader::GetRun(), CandHeader::GetRun(), RecPhysicsHeader::GetSnarl(), and CandHeader::GetSnarl().

Referenced by ChopModule::Ana(), ParticleDisplay::BuildDisplay(), NueDisplayModule::BuildDisplay(), NueDisplayModule::GetBasicInfo(), EVD::PrintCanvas(), UserHist::Refresh(), RunSnarlEntry::Update(), EVD::Update(), ParticleDisplay::UpdateDisplay(), NueDisplayModule::UpdateDisplay(), EVD::UpdateSummary(), and EVD::UpdateTime().

00041 {
00042     if (!mom) return false;
00043 
00044     // look for a Candidate record header
00045     const CandHeader* chead = GetCandHeader(mom);
00046     if ( chead ) {
00047        run   = chead->GetRun();
00048        snarl = chead->GetSnarl();
00049        event = chead->GetEvent();
00050        return true;
00051     }
00052  
00053     // look for new record headers (ie. ntuples )
00054     RecRecordImp<RecCandHeader> *rr = 
00055         dynamic_cast<RecRecordImp<RecCandHeader>*>
00056            (mom->GetFragment("RecRecordImp<RecCandHeader>"));
00057     if ( rr ) {
00058         run   = rr->GetHeader().GetRun();
00059         snarl = rr->GetHeader().GetSnarl();
00060         event = rr->GetHeader().GetEvent();
00061         return true;
00062     }
00063 
00064     return false;
00065 }

const Registry * DataUtil::GetTempTags ( const TObject *  record  ) 

Return a temptags Registry for a MINOS record without requiring the user to handle the two disparate inheritance hierarchies.

Definition at line 14 of file GetTempTags.cxx.

Referenced by GetTempTagString(), main(), OltNewModule::Reco(), PerInputStreamManager::RemoveAllFragments(), PerInputStreamManager::RemoveFragmentsNotInWindow(), and RecValidate::TestRecordTempTags().

00015 {
00016 
00017   if (!record) return 0;
00018 
00019   if (const RecMinos* rec = dynamic_cast<const RecMinos*>(record)) {
00020     // RawRecord, CandRecord
00021     return &(rec->GetTempTags());
00022   }
00023   else if (const RecRecord* rec  = dynamic_cast<const RecRecord*>(record)) {
00024     // SimSnarlRecord, Ntp*Record
00025     return &(rec->GetTempTags());
00026   }
00027 
00028   return 0;
00029 }

std::string DataUtil::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.

Definition at line 31 of file GetTempTags.cxx.

References Registry::Get(), and GetTempTags().

Referenced by ParticleBeamMonAna::ana(), GetVldContext(), and NueModule::Reco().

00032 {
00033   const Registry* recreg = GetTempTags(record);
00034   string value("<no-"+key+">");
00035   if ( ! recreg ) return value;
00036   const char* tmp = 0;
00037   if (recreg->Get(key.c_str(),tmp)) value = tmp;
00038   return value;
00039 
00040 }

UgliGeomHandle DataUtil::GetUgliGeomHandle ( const MomNavigator mom  ) 

Try to produce an UgliGeomHandle from data in mom.

It does this by first looking for a RawRecord, failing that a CandRecord, and failing that for a new RecRecord, and asking their Headers for the VldContext needed to build the UGH.

Since UGHs are meant to be passed by value you had better check if the returned object is valid with: UgliGeomHandle::IsValid()!!!!!

Definition at line 52 of file GetUgliGeomHandle.h.

References RerootExodus::BuildVldContext(), VldContext::GetDetector(), MomNavigator::GetFragment(), RawRecord::GetRawHeader(), RecMinosHdr::GetVldContext(), gMINFast, and Detector::kUnknown.

00053     {
00054         if (!mom) return UgliGeomHandle();
00055 
00056         RawRecord* rr = dynamic_cast<RawRecord*>(mom->GetFragment("RawRecord"));
00057         if (rr) return UgliGeomHandle(rr->GetRawHeader()->GetVldContext());
00058 
00059         CandRecord* cr = dynamic_cast<CandRecord*>(mom->GetFragment("CandRecord"));
00060         if (cr) return UgliGeomHandle(cr->GetCandHeader()->GetVldContext());
00061 
00062         RecRecordImp<RecCandHeader>* rri = 
00063           dynamic_cast<RecRecordImp<RecCandHeader>*>(mom->GetFragment("RecRecordImp<RecCandHeader>"));
00064         if (rri) return UgliGeomHandle(rri->GetHeader().GetVldContext());
00065 
00066         if (gMINFast) {
00067             VldContext vld = RerootExodus::BuildVldContext();
00068             if (vld.GetDetector() != Detector::kUnknown) 
00069                 return UgliGeomHandle(vld);
00070         }
00071 
00072         return UgliGeomHandle();
00073     }

vector< VldContext > DataUtil::GetVldContext ( 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.

Definition at line 20 of file GetVldContext.cxx.

References MomNavigator::GetFragmentArray(), GetTempTagString(), Msg::kDebug, MSG, and UtilString::StringTok().

00022 {
00023     static const char* last_filter = 0; // slight optimization
00024     static bool include = true;
00025     static map<string,int> filt;    
00026 
00027     if (filter && filter[0] && filter != last_filter) {
00028         last_filter = filter;
00029         filt.clear();
00030 
00031         if (filter[0] == '!') {
00032             include = false;
00033             ++filter;
00034         }
00035 
00036         std::vector<string> toklist;
00037         UtilString::StringTok(toklist,filter,",:;");
00038         for ( size_t i = 0; i < toklist.size(); ++i ) {
00039           std::string& item = toklist[i];
00040           filt[item] = 1;
00041           MSG("GetVldContext",Msg::kDebug) 
00042             << "filter by "
00043             << (include ? "including " : "excluding ")
00044             << item << endl;
00045         }
00046     }
00047 
00048     vector<VldContext> ret;
00049     if (!mom) return ret;
00050 
00051     TIter fiter(mom->GetFragmentArray());
00052     TObject* fragment = 0;
00053     while ((fragment = fiter())) {
00054         if (!fragment) continue;
00055 
00056         if (filter) {
00057             string classname  = fragment->ClassName();
00058             TNamed* named = dynamic_cast<TNamed*>(fragment);
00059             string username   = (named) ? named->GetName() : "<no-name>";
00060             string streamname = DataUtil::GetTempTagString(fragment,"stream");
00061             int found = filt[classname] || filt[username] || filt[streamname];
00062             if (found && !include) {
00063                 MSG("GetVldContext",Msg::kDebug) 
00064                   << "excluding " << classname << "," << username
00065                   << "," << streamname << endl;
00066                 continue;
00067             }
00068             if (!found && include) {
00069                 MSG("GetVldContext",Msg::kDebug)
00070                   << "excluding " << classname << "," << username
00071                   << "," << streamname << endl;
00072                 continue;
00073             }
00074         }
00075 
00076         if (RecMinos* rec = dynamic_cast<RecMinos*>(fragment)) {
00077             ret.push_back(rec->GetHeader()->GetVldContext());
00078         }
00079         else if (RecRecord* rec  = dynamic_cast<RecRecord*>(fragment)) {
00080             ret.push_back(rec->GetHeader().GetVldContext());
00081         }
00082     }
00083     return ret;
00084 }


Generated on 24 Jul 2018 for loon by  doxygen 1.6.1