Truthifier Class Reference
[DataUtil]

Contains a set of maps allowing navigation between various MC truth objects. More...

#include <Truthifier.h>

List of all members.

Public Member Functions

 Truthifier (const MomNavigator *mom, Bool_t supressErrors=false)
void Reset (const MomNavigator *mom, Bool_t supressErrors=false)
Bool_t IsValid () const
std::vector< Int_t > GetListOfNeutrinoIndecies () const
Int_t GetStdHepSize () const
const TParticle * GetStdHepParticle (Int_t index) const
Int_t GetScintHitListSize () const
const DigiScintHitGetScintHit (Int_t index) const
const REROOT_NeuKinGetNeuKin (Int_t i) const
const REROOT_NeuKinGetNeuKinOfParticle (Int_t index) const
const RawDigitGetRawDigit (const CandDigitHandle &cdh) const
const std::vector< const
DigiSignal * > & 
GetSignalVector (const DigiScintHit *hit) const
const RawDigitGetRawDigit (const DigiSignal *signal) const
const std::vector< const
RawDigit * > & 
GetRawDigitVector (const DigiScintHit *hit) const
template<class T >
std::vector< const T * > GetCandidatesFromParticle (int ParticleId, const CandHandle *list) const
template<class T >
std::vector< const T * > GetCandidatesFromTrack (int TrackId, const CandHandle *list) const
Int_t GetNeutrinoOfTrack (Int_t trackId) const
const DigiSignalGetSignal (const CandDigitHandle &cdh) const
 Digit->Signal.
const DigiSignalGetSignal (const RawDigit *digit) const
DigiSignal::DigiPmtTruth_t GetSignalTruthFlags (const CandDigitHandle &cdh) const
DigiSignal::DigiPmtTruth_t GetSignalTruthFlags (const RawDigit *digit) const
Bool_t DigitIsOnlyCrosstalk (const CandDigitHandle &cdh) const
Bool_t DigitIsOnlyCrosstalk (const RawDigit *digit) const
Bool_t DigitIsOnlyCrosstalk (const CandDigitHandle *cdh) const
Float_t IsSignalFromParticle (Int_t particleID, const DigiSignal *signal) const
Float_t IsSignalFromTrack (Int_t trackID, const DigiSignal *signal) const
Float_t IsSignalFromNeutrino (Int_t neturinoID, const DigiSignal *signal, Double_t max_t=1e19) const
const DigiScintHitGetBiggestHit (const CandDigitHandle &cdh) const
const DigiScintHitGetBiggestHit (const RawDigit *digit) const
Float_t IsDigitFromParticle (Int_t particleID, const CandDigitHandle &cdh) const
Float_t IsDigitFromParticle (Int_t particleID, const RawDigit *digit) const
Float_t IsDigitFromTrack (Int_t trackID, const CandDigitHandle &cdh) const
Float_t IsDigitFromTrack (Int_t trackID, const RawDigit *digit) const
Float_t IsDigitFromNeutrino (Int_t neutrinoID, const CandDigitHandle &cdh, Double_t max_t=1e19) const
Float_t IsDigitFromNeutrino (Int_t neutrinoID, const RawDigit *digit, Double_t max_t=1e19) const
PlexStripEndId BestSEIdOfDigit (const CandDigitHandle *cdh) const
 Candidate -> info.
void GetAllScintHits (const RawDigit *digit, std::set< const DigiScintHit * > &outSet) const
 These functions get a list (set) of hits, not overcounting.
void GetAllScintHits (const CandDigitHandle &cdh, std::set< const DigiScintHit * > &outSet) const
void GetAllScintHits (const CandHandle *candidate, std::set< const DigiScintHit * > &outSet) const
Float_t GetTotalEnergy (const RawDigit *digit, Int_t particleID=0) const
Float_t GetTotalEnergy (const CandDigitHandle &cdh, Int_t particleID=0) const
Float_t GetTotalEnergy (const CandHandle *candidate, Int_t particleID=0) const
Float_t IsCandidateFromParticle (Int_t particleID, const CandHandle *candidate) const
Float_t IsCandidateFromTrack (Int_t trackID, const CandHandle *candidate) const
Float_t IsCandidateGenuine (const CandHandle *candidate) const
 Use this to see if your CandStrip is all noise or crosstalk:.
virtual void Print (const Option_t *="") const
 Prints out the whole blessed mess.

Static Public Member Functions

static const TruthifierInstance (const MomNavigator *mom, Bool_t supressErrors=false)

Private Types

typedef std::vector< Int_t > NeutrinoList_t
typedef std::vector< Int_t > TrackIndexToNeutrinoIndex_t
typedef std::map< Int_t,
std::vector< Int_t > > 
NeutrinoIndexToTrackIndex_t
typedef std::map< Int_t,
std::vector< const
DigiScintHit * > > 
TrackToHit_t
typedef std::map< const
DigiScintHit *, std::vector
< const DigiSignal * > > 
HitToSignal_t
typedef std::map< const
DigiSignal *, const RawDigit * > 
SignalToDigit_t
typedef std::map< UInt_t,
const DigiSignal * > 
SignalMap_t

Private Member Functions

void CandDigitsFrom (std::vector< const CandDigitHandle * > &output, const CandHandle *list) const
 ClassDef (Truthifier, 0)

Private Attributes

const MomNavigatorfMom
Bool_t fValid
const RawDigitDataBlockfRddb
const TClonesArray * fStdHep
const TClonesArray * fNeuKins
const TObjArray * fScintHitArray
NeutrinoList_t fNeutrinoList
TrackIndexToNeutrinoIndex_t fTrackIndexToNeutrinoIndex
NeutrinoIndexToTrackIndex_t fNeutrinoIndexToTrackIndex
TrackToHit_t fTrackToHit
HitToSignal_t fHitToSignal
SignalToDigit_t fSignalToDigit
SignalMap_t fSignals

Detailed Description

Contains a set of maps allowing navigation between various MC truth objects.

Author:
(last to touch it)
Author
bv
Version:
Revision
1.12
Date:
Date
2005/04/15 14:50:02

Contact: N. Tagg, Oxford n.tagg1@physics.ox.ac.uk

Created on:

Id
Truthifier.h,v 1.12 2005/04/15 14:50:02 bv Exp

Definition at line 62 of file Truthifier.h.


Member Typedef Documentation

typedef std::map<const DigiScintHit*, std::vector<const DigiSignal*> > Truthifier::HitToSignal_t [private]

Definition at line 208 of file Truthifier.h.

typedef std::map<Int_t,std::vector<Int_t> > Truthifier::NeutrinoIndexToTrackIndex_t [private]

Definition at line 200 of file Truthifier.h.

typedef std::vector<Int_t> Truthifier::NeutrinoList_t [private]

Definition at line 193 of file Truthifier.h.

typedef std::map<UInt_t,const DigiSignal*> Truthifier::SignalMap_t [private]

Definition at line 216 of file Truthifier.h.

typedef std::map<const DigiSignal*, const RawDigit*> Truthifier::SignalToDigit_t [private]

Definition at line 212 of file Truthifier.h.

typedef std::vector<Int_t> Truthifier::TrackIndexToNeutrinoIndex_t [private]

Definition at line 197 of file Truthifier.h.

typedef std::map<Int_t,std::vector<const DigiScintHit*> > Truthifier::TrackToHit_t [private]

Definition at line 204 of file Truthifier.h.


Constructor & Destructor Documentation

Truthifier::Truthifier ( const MomNavigator mom,
Bool_t  supressErrors = false 
) [inline]

Definition at line 75 of file Truthifier.h.

References Reset().

00075 { Reset(mom,supressErrors); };


Member Function Documentation

PlexStripEndId Truthifier::BestSEIdOfDigit ( const CandDigitHandle cdh  )  const

Candidate -> info.

Returns the SEID alternative for the strip end that has the most PEs on it.

Definition at line 733 of file Truthifier.cxx.

References PlexSEIdAltL::GetEnd(), DigiSignal::GetHit(), DigiSignal::GetHitWeight(), DigiSignal::GetNumberOfHits(), CandDigitHandle::GetPlexSEIdAltL(), GetSignal(), PlexStripEndId::IsValid(), Msg::kError, MSG, PlexStripEndId::SetEnd(), and DigiScintHit::StripEndId().

Referenced by DmxDeMuxModule::Ana().

00734 {
00739   // Get list of the stripends.
00740   std::map<PlexStripEndId,float> ends;
00741   std::map<PlexStripEndId,float>::iterator endit;
00742 
00743   if(!cdh) {
00744     MSG("DataUtil",Msg::kError) << "BestSEIdOfDigit was handed null CandDigitHandle*" << endl;
00745     return PlexStripEndId();
00746   }
00747 
00748   const DigiSignal* signal = GetSignal(*cdh);
00749   if(signal) {
00750     for(UInt_t i=0; i<signal->GetNumberOfHits(); i++) {
00751       PlexStripEndId seid = signal->GetHit(i)->StripEndId();
00752       float weight = signal->GetHitWeight(i);
00753       ends[seid] += weight;
00754     }
00755   } else return PlexStripEndId();
00756 
00757   // Find the best one.
00758   PlexStripEndId best;
00759   float bestpe = 0;
00760   for(endit = ends.begin(); endit!= ends.end(); endit++) {
00761     if(endit->second > bestpe) {
00762       bestpe = endit->second;
00763       best = endit->first;
00764     }
00765   }
00766   
00767   if(best.IsValid()) best.SetEnd(cdh->GetPlexSEIdAltL().GetEnd());
00768   
00769   return best;
00770 }

void Truthifier::CandDigitsFrom ( std::vector< const CandDigitHandle * > &  output,
const CandHandle list 
) const [private]

Definition at line 991 of file Truthifier.cxx.

References CandHandle::GetDaughterIterator(), and it.

Referenced by GetAllScintHits(), IsCandidateFromParticle(), IsCandidateFromTrack(), and IsCandidateGenuine().

00993 {
00994   if(!list) return;
00995  
00996   const CandDigitHandle* cdh = 
00997     dynamic_cast<const CandDigitHandle*>(list);
00998  
00999   if(cdh){
01000     output.push_back(cdh);
01001     return;
01002   }
01003 
01004   TIter it = list->GetDaughterIterator();
01005   TObject* obj;
01006   while( (obj=it.Next()) ) {
01007     const CandHandle* newHandle = dynamic_cast<const CandHandle*>(obj);
01008     if(newHandle)
01009       CandDigitsFrom(output,newHandle);
01010   }; 
01011 }

Truthifier::ClassDef ( Truthifier  ,
 
) [private]
Bool_t Truthifier::DigitIsOnlyCrosstalk ( const CandDigitHandle cdh  )  const [inline]

Definition at line 137 of file Truthifier.h.

References DigitIsOnlyCrosstalk().

00137                                                                  { 
00138     if(cdh) return DigitIsOnlyCrosstalk(*cdh); return false;};

Bool_t Truthifier::DigitIsOnlyCrosstalk ( const RawDigit digit  )  const

Example how to use the truth flags. Returns true if the Digit is has some crosstalk but has no genuine light.

Definition at line 547 of file Truthifier.cxx.

References GetSignalTruthFlags(), DigiSignal::kCrosstalk, DigiSignal::kCrosstalkOptical, and DigiSignal::kGenuine.

00548 {
00554   DigiSignal::DigiPmtTruth_t flags = GetSignalTruthFlags(digit);
00555   if(  ( (flags & DigiSignal::kCrosstalk) || (flags & DigiSignal::kCrosstalkOptical) )
00556        && ( ! (flags & DigiSignal::kGenuine) ) ) {
00557     return true;
00558   }
00559   return false;
00560 
00561 }

Bool_t Truthifier::DigitIsOnlyCrosstalk ( const CandDigitHandle cdh  )  const
void Truthifier::GetAllScintHits ( const CandHandle candidate,
std::set< const DigiScintHit * > &  outSet 
) const

Definition at line 802 of file Truthifier.cxx.

References CandDigitsFrom(), digits(), and GetAllScintHits().

00804 {
00805   if(!candidate) return;
00806   std::vector<const CandDigitHandle*> digits;
00807   CandDigitsFrom(digits,candidate);
00808 
00809   for(UInt_t i=0;i<digits.size();i++) 
00810     GetAllScintHits(*(digits[i]),outSet);
00811 }

void Truthifier::GetAllScintHits ( const CandDigitHandle cdh,
std::set< const DigiScintHit * > &  outSet 
) const

Definition at line 788 of file Truthifier.cxx.

References DigiSignal::GetHit(), DigiSignal::GetNumberOfHits(), GetSignal(), and n.

00790 {
00791   const DigiSignal* signal = GetSignal(cdh);
00792   if(!signal) return;
00793   UInt_t n = signal->GetNumberOfHits();
00794   for(UInt_t i=0; i<n; i++) {
00795     const DigiScintHit* hit = signal->GetHit(i);
00796     outSet.insert(hit);
00797   }
00798 }

void Truthifier::GetAllScintHits ( const RawDigit digit,
std::set< const DigiScintHit * > &  outSet 
) const

These functions get a list (set) of hits, not overcounting.

Definition at line 774 of file Truthifier.cxx.

References DigiSignal::GetHit(), DigiSignal::GetNumberOfHits(), GetSignal(), and n.

Referenced by GetAllScintHits(), and GetTotalEnergy().

00776 {
00777   const DigiSignal* signal = GetSignal(digit);
00778   if(!signal) return;
00779   UInt_t n = signal->GetNumberOfHits();
00780   for(UInt_t i=0; i<n; i++) {
00781     const DigiScintHit* hit = signal->GetHit(i);
00782     outSet.insert(hit);
00783   }
00784 }

const DigiScintHit * Truthifier::GetBiggestHit ( const RawDigit digit  )  const

Returns pointer to the hit that contributed the most light to this digit.

Definition at line 649 of file Truthifier.cxx.

References DigiSignal::GetBiggestHit(), and GetSignal().

00650 {
00655   const DigiSignal* signal = GetSignal(digit);
00656   if(!signal) return 0;
00657   return signal->GetBiggestHit();
00658 }

const DigiScintHit * Truthifier::GetBiggestHit ( const CandDigitHandle cdh  )  const

Returns pointer for the hit that contributed the most light to this digit.

Definition at line 637 of file Truthifier.cxx.

References DigiSignal::GetBiggestHit(), and GetSignal().

Referenced by MCAnalysis::Ana(), and AlgRmMu::RunAlg().

00638 {
00643   const DigiSignal* signal = GetSignal(cdh);
00644   if(!signal) return 0;
00645   return signal->GetBiggestHit();
00646 }

template<class T >
std::vector< const T * > Truthifier::GetCandidatesFromParticle ( int  ParticleId,
const CandHandle list 
) const [inline]

Track->Hit->Signal->Digit->Candidate

Use like this: myTruthifier->GetCandidatesFromParticle<CandStripHandle>(13,CandStripListHandlePtr)

Reads the given CandxxxxListHandle and returns a vector of CandxxxxHandles that are from the TrackId.

Definition at line 393 of file Truthifier.cxx.

References CandHandle::GetDaughterIterator(), IsCandidateFromParticle(), and it.

00395 {
00400   std::vector<const T*> output;
00401 
00402   // Loop throuth the list.
00403   TIter it = list->GetDaughterIterator();
00404   TObject* obj;
00405   while( (obj=it.Next()) ) {
00406     const T* thing = dynamic_cast<const T*>(obj);
00407     if(thing) {
00408       const CandHandle* handle = dynamic_cast<const CandHandle*>(thing);
00409       if(handle)
00410         if(IsCandidateFromParticle(ParticleId,handle)) output.push_back(thing);
00411     }
00412   }; 
00413   
00414   return output;
00415 }

template<class T >
std::vector< const T * > Truthifier::GetCandidatesFromTrack ( int  TrackId,
const CandHandle list 
) const [inline]

Reads the given CandxxxxListHandle and returns a vector of CandxxxxHandles that are from the TrackId.

Definition at line 419 of file Truthifier.cxx.

References CandHandle::GetDaughterIterator(), IsCandidateFromTrack(), and it.

00421 {
00426   std::vector<const T*> output;
00427 
00428   // Loop throuth the list.
00429   TIter it = list->GetDaughterIterator();
00430   TObject* obj;
00431   while( (obj=it.Next()) ) {
00432     const T* thing = dynamic_cast<const T*>(obj);
00433     if(thing) {
00434       const CandHandle* handle = dynamic_cast<const CandHandle*>(thing);
00435       if(handle)
00436         if(IsCandidateFromTrack(TrackId,handle)) output.push_back(thing);
00437     }
00438   }; 
00439   
00440   return output;
00441 }

std::vector< Int_t > Truthifier::GetListOfNeutrinoIndecies (  )  const

Definition at line 265 of file Truthifier.cxx.

References fNeutrinoList.

Referenced by ChopModule::Ana(), and AlgChopListPerfectMC::RunAlg().

00266 {
00267   return fNeutrinoList;
00268 }

const REROOT_NeuKin * Truthifier::GetNeuKin ( Int_t  i  )  const

Definition at line 287 of file Truthifier.cxx.

References fNeuKins.

Referenced by ChopModule::Ana(), and GetNeuKinOfParticle().

00288 {
00289   if(fNeuKins) {
00290     return dynamic_cast<const REROOT_NeuKin*>((*fNeuKins)[i]);
00291   }
00292   return 0;
00293 }

const REROOT_NeuKin * Truthifier::GetNeuKinOfParticle ( Int_t  index  )  const

Definition at line 295 of file Truthifier.cxx.

References fNeutrinoList, and GetNeuKin().

00296 {
00297   // Find matching neutrino
00298   for(Int_t i=fNeutrinoList.size()-1;i>=0;i--) {
00299     if(fNeutrinoList[i] <= index) {
00300       return GetNeuKin(i);
00301     }
00302   }
00303   return 0;
00304 }

Int_t Truthifier::GetNeutrinoOfTrack ( Int_t  trackId  )  const

Backward tracking: Digit->...->Particle

Definition at line 337 of file Truthifier.cxx.

References fTrackIndexToNeutrinoIndex.

Referenced by ChopModule::Ana().

00338 {
00339   return fTrackIndexToNeutrinoIndex[abs(track)];
00340 }

const RawDigit * Truthifier::GetRawDigit ( const DigiSignal signal  )  const

Retrieves a pointer to a raw digit caused by a given DigiSignal.

Definition at line 359 of file Truthifier.cxx.

References fSignalToDigit, and it.

00360 {
00364   SignalToDigit_t::const_iterator it = fSignalToDigit.find(signal);
00365   if(it!=fSignalToDigit.end()) return it->second;
00366   return 0;
00367 }

const RawDigit * Truthifier::GetRawDigit ( const CandDigitHandle cdh  )  const

Definition at line 322 of file Truthifier.cxx.

References RawDigitDataBlock::At(), digit(), fRddb, and CandDigitHandle::GetRawDigitIndex().

Referenced by ChopEvaluation::Evaluate(), and GetRawDigitVector().

00323 {
00324   int digitIndex = cdh.GetRawDigitIndex();
00325   const RawDigit* digit = 0;
00326   if(fRddb) digit = fRddb->At(digitIndex);
00327   return digit;
00328 }

const std::vector< const RawDigit * > & Truthifier::GetRawDigitVector ( const DigiScintHit hit  )  const

Creates a vector of RawDigit pointers associated with a given particle Hit.

Note: copy the output after retrieving; returned variable is a simple static variable.

Definition at line 371 of file Truthifier.cxx.

References GetRawDigit(), and GetSignalVector().

00372 {
00380   static std::vector<const RawDigit*> output;
00381   output.clear();
00382   const std::vector<const DigiSignal*>& signalList
00383     = GetSignalVector(hit);
00384   for(UInt_t i=0;i<signalList.size();i++) {
00385     output.push_back(GetRawDigit(signalList[i]));
00386   }
00387   return output;
00388 }

const DigiScintHit * Truthifier::GetScintHit ( Int_t  index  )  const

Definition at line 314 of file Truthifier.cxx.

References GetScintHitListSize().

Referenced by ChopModule::Ana().

00315 {
00316   if(index >= GetScintHitListSize()) return 0;
00317   return dynamic_cast<const DigiScintHit*>( (*fScintHitArray)[index] );
00318 }

Int_t Truthifier::GetScintHitListSize (  )  const

Definition at line 306 of file Truthifier.cxx.

References fScintHitArray.

Referenced by ChopModule::Ana(), and GetScintHit().

00307 {
00308   if(fScintHitArray) {
00309     return fScintHitArray->GetEntriesFast();
00310   }
00311   return 0;
00312 }

const DigiSignal * Truthifier::GetSignal ( const RawDigit digit  )  const

GetSignal Retrives pointer to the DigiSignal associated with this RawDigit.

Definition at line 472 of file Truthifier.cxx.

References fSignals, RawDigiDigitMixIn::GetDigiSignalIndex(), and it.

00473 {
00478 
00479   if(digit==0) return NULL;
00480 
00481   const RawDigiDigitMixIn* ddigit = dynamic_cast<const RawDigiDigitMixIn*>(digit);
00482   if(ddigit==0) return NULL;
00483 
00484   UInt_t id = ddigit->GetDigiSignalIndex();
00485   
00486   SignalMap_t::const_iterator it = fSignals.find(id);
00487   if(it!=fSignals.end()) return it->second;
00488 
00489   return NULL;
00490 }

const DigiSignal * Truthifier::GetSignal ( const CandDigitHandle cdh  )  const

Digit->Signal.

GetSignal Retrieves pinter to the DigiSignal associated with this CandDigit

Definition at line 493 of file Truthifier.cxx.

References RawDigitDataBlock::At(), digit(), fRddb, and CandDigitHandle::GetRawDigitIndex().

Referenced by MCAnalysis::Ana(), CustomLightInjector::Ana(), BestSEIdOfDigit(), TruthHelper::EventCompletenessImp(), TruthHelper::EventPurity(), NtpMCModule::FillNtpMCTruth(), NtpTHModule::FillNtpTHStrip(), GetAllScintHits(), TruthHelper::GetBestEventNeuMatch(), TruthHelper::GetBestNeuMatch(), TruthHelper::GetBestShowerNeuMatch(), TruthHelper::GetBestSliceNeuMatch(), TruthHelper::GetBestTrackIdMatch(), GetBiggestHit(), GetSignalTruthFlags(), TruthHelper::GetStripNeuIndex(), TruthHelper::GetTrackMaxE(), TruthHelper::GetTrackMinE(), IsDigitFromNeutrino(), IsDigitFromParticle(), IsDigitFromTrack(), TruthHelper::NumNeu(), Reset(), AlgRmMu::RunAlg(), TruthHelper::secondNEU(), TruthHelper::ShowerCompletenessImp(), TruthHelper::ShowerPurity(), TruthHelper::SliceCompleteness(), TruthHelper::SliceCompleteness_MaxTimeGap(), TruthHelper::SliceCompleteness_xtalk(), TruthHelper::SlicePurity(), TruthHelper::SlicePurity_MaxTimeGap(), TruthHelper::SlicePurity_xtalk(), TruthHelper::SliceTrueStrip(), TruthHelper::SliceTrueStripxtalk(), TruthHelper::StripPurity(), TruthHelper::TrackCompleteness(), TruthHelper::TrackPurity(), and TruthHelper::TruthSliceNum().

00494 {
00499   int digitIndex = cdh.GetRawDigitIndex();
00500   const RawDigit* digit = 0;
00501   if(fRddb) digit = fRddb->At(digitIndex);
00502   return GetSignal(digit);
00503 }

DigiSignal::DigiPmtTruth_t Truthifier::GetSignalTruthFlags ( const RawDigit digit  )  const

Gets the truth flags for the digit.

Definition at line 520 of file Truthifier.cxx.

References GetSignal(), DigiSignal::GetTruth(), and DigiSignal::kUnknown.

00521 {
00525   const DigiSignal* signal = GetSignal(digit);
00526   if(signal==0) return DigiSignal::kUnknown;
00527   return signal->GetTruth();
00528 }

DigiSignal::DigiPmtTruth_t Truthifier::GetSignalTruthFlags ( const CandDigitHandle cdh  )  const

Gets the truth flags for the digit.

Definition at line 508 of file Truthifier.cxx.

References GetSignal(), DigiSignal::GetTruth(), and DigiSignal::kUnknown.

Referenced by DigitIsOnlyCrosstalk(), NtpTHModule::FillNtpTHStrip(), and IsCandidateGenuine().

00509 {
00513   const DigiSignal* signal = GetSignal(cdh);
00514   if(signal==0) return DigiSignal::kUnknown;
00515   return signal->GetTruth();
00516 }

const std::vector< const DigiSignal * > & Truthifier::GetSignalVector ( const DigiScintHit hit  )  const

Forward tracking: Particle->...->Digit

Retrieve a vector of DigiSignals that this hit caused.

Definition at line 345 of file Truthifier.cxx.

References fHitToSignal, and it.

Referenced by GetRawDigitVector().

00346 {
00350   HitToSignal_t::const_iterator it = fHitToSignal.find(hit);
00351   if(it!=fHitToSignal.end()) return it->second;
00352 
00353   static std::vector<const DigiSignal*> nullResult;
00354   return nullResult;
00355 }

const TParticle * Truthifier::GetStdHepParticle ( Int_t  index  )  const

Definition at line 270 of file Truthifier.cxx.

References fStdHep.

Referenced by ChopModule::Ana().

00271 {
00272   if(fStdHep) {
00273     TParticle* part = dynamic_cast<TParticle*>((*fStdHep)[index]);
00274     return part;
00275   }
00276   return 0;
00277 }

Int_t Truthifier::GetStdHepSize (  )  const

Definition at line 279 of file Truthifier.cxx.

References fStdHep.

00280 {
00281   if(fStdHep) {
00282     return fStdHep->GetEntries();
00283   }
00284   return 0;
00285 }

Float_t Truthifier::GetTotalEnergy ( const CandHandle candidate,
Int_t  particleID = 0 
) const

Definition at line 859 of file Truthifier.cxx.

References DigiScintHit::DE(), GetAllScintHits(), it, DigiScintHit::ParticleId(), and total().

00860 {
00861   // Get the total energy of all scinthits that lent energy to this digit.
00862   // If particleID is non-zero, only add energy from that particle type
00863   // (-ve or +ve of that type)
00864  
00865   std::set<const DigiScintHit*> hits;
00866   std::set<const DigiScintHit*>::iterator it;
00867   Float_t total = 0;
00868   GetAllScintHits(candidate,hits);
00869   for(it = hits.begin(); it!= hits.end(); it++) {
00870     const DigiScintHit* hit = *it;
00871     if(hit)
00872       if((particleID==0) || (abs(hit->ParticleId()) == particleID))
00873         total += hit->DE();
00874   }
00875 
00876   return total;
00877 }

Float_t Truthifier::GetTotalEnergy ( const CandDigitHandle cdh,
Int_t  particleID = 0 
) const

Definition at line 837 of file Truthifier.cxx.

References DigiScintHit::DE(), GetAllScintHits(), it, DigiScintHit::ParticleId(), and total().

00838 {
00839   // Get the total energy of all scinthits that lent energy to this digit.
00840   // If particleID is non-zero, only add energy from that particle type
00841   // (-ve or +ve of that type)
00842  
00843   std::set<const DigiScintHit*> hits;
00844   std::set<const DigiScintHit*>::iterator it;
00845   Float_t total = 0;
00846   GetAllScintHits(cdh,hits);
00847   for(it = hits.begin(); it!= hits.end(); it++) {
00848     const DigiScintHit* hit = *it;
00849     if(hit)
00850       if((particleID==0) || (abs(hit->ParticleId()) == particleID))
00851         total += hit->DE();
00852   }
00853 
00854   return total;
00855 }

Float_t Truthifier::GetTotalEnergy ( const RawDigit digit,
Int_t  particleID = 0 
) const

Note that using these functions you may OVERCOUNT energy! e.g. two digits from the same strip will give the same energy but asking for a CandStrip's energy will NOT overcount.

Definition at line 815 of file Truthifier.cxx.

References DigiScintHit::DE(), GetAllScintHits(), it, DigiScintHit::ParticleId(), and total().

00816 {
00817   // Get the total energy of all scinthits that lent energy to this digit.
00818   // If particleID is non-zero, only add energy from that particle type
00819   // (-ve or +ve of that type)
00820  
00821   std::set<const DigiScintHit*> hits;
00822   std::set<const DigiScintHit*>::iterator it;
00823   Float_t total = 0;
00824   GetAllScintHits(digit,hits);
00825   for(it = hits.begin(); it!= hits.end(); it++) {
00826     const DigiScintHit* hit = *it;
00827     if(hit)
00828       if((particleID==0) || (abs(hit->ParticleId()) == particleID))
00829         total += hit->DE();
00830   }
00831 
00832   return total;
00833 }

const Truthifier & Truthifier::Instance ( const MomNavigator mom,
Bool_t  supressErrors = false 
) [static]

Important note:

If there's anything you want from this object please let me know and I'll put it in.

--Nathaniel

How to use the truthifier:

The truthifier builds itself from Mom, and stores itself in Mom. It is not stored on disk but resides in memory for as long as Mom is around. If one already exists, it uses it.

const Truthifier& truth = Truthifier::Instance(mom);

Note that this may return an invalid Truthifier, due to lack of truth information. Using an invalid Truthifier should not cause any crash, but some or all of the info returned will be incorrect.

Returns a truthifier for mom. Builds one if neccessary, otherwise finds it.

Definition at line 29 of file Truthifier.cxx.

References RecDataRecord< T >::AdoptTemporary(), RecDataRecord< T >::FindTemporary(), IsValid(), and Reset().

Referenced by DmxDeMuxModule::Ana(), CustomLightInjector::Ana(), ChopModule::Ana(), TruthHelper::EventCompletenessImp(), TruthHelper::EventPurity(), NtpMCModule::FillNtpMCTruth(), TruthHelper::GetBestEventNeuMatch(), TruthHelper::GetBestNeuMatch(), TruthHelper::GetBestShowerNeuMatch(), TruthHelper::GetBestSliceNeuMatch(), TruthHelper::GetBestTrackIdMatch(), TruthHelper::GetStripNeuIndex(), TruthHelper::GetTrackMaxE(), TruthHelper::GetTrackMinE(), CDTruthifier::GetTruthHitInfo(), TruthHelper::NumNeu(), NtpTHModule::Reco(), AlgChopListPerfectMC::RunAlg(), TruthHelper::secondNEU(), TruthHelper::ShowerCompletenessImp(), TruthHelper::ShowerPurity(), TruthHelper::SliceCompleteness(), TruthHelper::SliceCompleteness_MaxTimeGap(), TruthHelper::SliceCompleteness_xtalk(), TruthHelper::SlicePurity(), TruthHelper::SlicePurity_MaxTimeGap(), TruthHelper::SlicePurity_xtalk(), TruthHelper::SliceTrueStrip(), TruthHelper::SliceTrueStripxtalk(), TruthHelper::StripPurity(), TruthHelper::Stripxtalk(), TruthHelper::TrackCompleteness(), TruthHelper::TrackPurity(), and TruthHelper::TruthSliceNum().

00030 {
00035 
00036   // Deal with the case of a null mom.
00037   static Truthifier nullTruth(0);
00038   if(mom==0) return nullTruth;
00039 
00040   // Look for the simSnarl in Mom.
00041   SimSnarlRecord* simsnarl = 0;
00042   TObject* tobj;
00043   TIter    fragiter = mom->FragmentIter();
00044   while( ( tobj = fragiter.Next() ) ) {
00045     simsnarl = dynamic_cast<SimSnarlRecord*>(tobj);
00046     if(simsnarl) break;
00047   }
00048   
00049   if(simsnarl==0) return nullTruth; // No good.
00050 
00051   // look for the Truthifier in the simSnarl.
00052   const TObject* o;
00053   o = simsnarl->FindTemporary("Truthifier","Truthifier");
00054   if(o) {
00055     // Found one.
00056     Truthifier* ct = const_cast<Truthifier*>(dynamic_cast<const Truthifier*>(o));
00057     if(ct){
00058       if(ct->IsValid()) return *ct;
00059       else {
00060         ct->Reset(mom,supressErrors);
00061         return *ct;
00062         // it's not valid. Tell the record to drop it.
00063         // whooops, this is illegal.
00064         //simsnarl->RemoveTemporary(o);
00065       }
00066     }    
00067   }
00068 
00069   // Ok, now there's no truthifier.
00070   // Make one.
00071   Truthifier* t = new Truthifier(mom, supressErrors);
00072 
00073   // Save it.
00074   simsnarl->AdoptTemporary(t);
00075   
00076   // return it.
00077   return *t;
00078 }

Float_t Truthifier::IsCandidateFromParticle ( Int_t  particleID,
const CandHandle candidate 
) const

Returns the fractional digits that are due to a certain particle ID

Definition at line 883 of file Truthifier.cxx.

References CandDigitsFrom(), digits(), IsDigitFromParticle(), and total().

Referenced by GetCandidatesFromParticle().

00884 {
00888   if(!candidate) return 0;
00889   std::vector<const CandDigitHandle*> digits;
00890   CandDigitsFrom(digits,candidate);
00891 
00892   // Test each digit. to see if it satisfies.
00893   Float_t total = 0;
00894   for(UInt_t i=0;i<digits.size();i++) 
00895     total += IsDigitFromParticle(particleID,*digits[i]);
00896   
00897   return total;
00898 }

Float_t Truthifier::IsCandidateFromTrack ( Int_t  trackID,
const CandHandle candidate 
) const

Returns the fractional digits that are due to a certain track ID

Definition at line 902 of file Truthifier.cxx.

References CandDigitsFrom(), digits(), IsDigitFromTrack(), and total().

Referenced by GetCandidatesFromTrack().

00903 {
00907   if(!candidate) return 0;
00908   std::vector<const CandDigitHandle*> digits;
00909   CandDigitsFrom(digits,candidate);
00910 
00911   // Test each digit. to see if it satisfies.
00912   Float_t total = 0;
00913   for(UInt_t i=0;i<digits.size();i++) 
00914     total += IsDigitFromTrack(trackID,*digits[i]);
00915   
00916   return total;
00917 }

Float_t Truthifier::IsCandidateGenuine ( const CandHandle candidate  )  const

Use this to see if your CandStrip is all noise or crosstalk:.

Returns the fractional digits that are due to a certain track ID

Definition at line 921 of file Truthifier.cxx.

References CandDigitsFrom(), digits(), GetSignalTruthFlags(), DigiSignal::kGenuine, and total().

00922 {
00926   if(!candidate) return 0;
00927   std::vector<const CandDigitHandle*> digits;
00928   CandDigitsFrom(digits,candidate);
00929 
00930   // Test each digit. to see if it satisfies.
00931   Float_t total = 0;
00932   for(UInt_t i=0;i<digits.size();i++) {
00933     DigiSignal::DigiPmtTruth_t flags = GetSignalTruthFlags(*digits[i]);       
00934     if(flags & DigiSignal::kGenuine) {
00935       total++;
00936     }
00937   }
00938 
00939   return total/(float)(digits.size());
00940 }

Float_t Truthifier::IsDigitFromNeutrino ( Int_t  neutrinoID,
const RawDigit digit,
Double_t  max_t = 1e19 
) const

Returns the fraction of the signal that is due to a certain track ID.

Definition at line 698 of file Truthifier.cxx.

References GetSignal(), and IsSignalFromNeutrino().

00699 {
00704   return IsSignalFromNeutrino(neutrinoID,GetSignal(digit),max_t);
00705 }

Float_t Truthifier::IsDigitFromNeutrino ( Int_t  neutrinoID,
const CandDigitHandle cdh,
Double_t  max_t = 1e19 
) const

Returns the fraction of the signal that is due to a certain track ID.

Definition at line 721 of file Truthifier.cxx.

References GetSignal(), and IsSignalFromNeutrino().

Referenced by ChopModule::Ana(), ChopEvaluation::Evaluate(), and AlgChopListPerfectMC::RunAlg().

00722 {
00727   return IsSignalFromNeutrino(neutrinoID,GetSignal(cdh),max_t);
00728 }

Float_t Truthifier::IsDigitFromParticle ( Int_t  particleID,
const RawDigit digit 
) const

Returns the fraction of the signal that is due to a certain particle ID.

Definition at line 664 of file Truthifier.cxx.

References GetSignal(), and IsSignalFromParticle().

00665 {
00670   return IsSignalFromParticle(particleID,GetSignal(digit));
00671 }

Float_t Truthifier::IsDigitFromParticle ( Int_t  particleID,
const CandDigitHandle cdh 
) const

Returns the fraction of the signal that is due to a certain particle ID.

Definition at line 675 of file Truthifier.cxx.

References GetSignal(), and IsSignalFromParticle().

Referenced by FitTrackCamAnalysisModule::EfficiencySection(), IsCandidateFromParticle(), and FitTrackCamAnalysisModule::TruthSliceSection().

00676 {
00681   return IsSignalFromParticle(particleID,GetSignal(cdh));
00682 }

Float_t Truthifier::IsDigitFromTrack ( Int_t  trackID,
const RawDigit digit 
) const

Returns the fraction of the signal that is due to a certain track ID.

Definition at line 687 of file Truthifier.cxx.

References GetSignal(), and IsSignalFromTrack().

00688 {
00693   return IsSignalFromTrack(trackID,GetSignal(digit));
00694 }

Float_t Truthifier::IsDigitFromTrack ( Int_t  trackID,
const CandDigitHandle cdh 
) const

Returns the fraction of the signal that is due to a certain track ID.

Definition at line 709 of file Truthifier.cxx.

References GetSignal(), and IsSignalFromTrack().

Referenced by IsCandidateFromTrack().

00710 {
00715   return IsSignalFromTrack(trackID,GetSignal(cdh));
00716 }

Float_t Truthifier::IsSignalFromNeutrino ( Int_t  neturinoID,
const DigiSignal signal,
Double_t  max_t = 1e19 
) const

Returns the fraction of the signal that is due to a certain neutrino

Definition at line 610 of file Truthifier.cxx.

References fTrackIndexToNeutrinoIndex, DigiSignal::GetHit(), DigiSignal::GetHitWeight(), DigiSignal::GetNumberOfHits(), n, DigiScintHit::T1(), total(), and DigiScintHit::TrackId().

Referenced by IsDigitFromNeutrino().

00611 {
00615   if(! signal) return 0;
00616   Float_t total = 0;
00617   Float_t totalMatch = 0;
00618   UInt_t n = signal->GetNumberOfHits();
00619   for(UInt_t i=0; i<n; i++) {
00620     const DigiScintHit* hit = signal->GetHit(i);
00621     Float_t weight = signal->GetHitWeight(i);
00622     total += weight;
00623     int trackId = abs(hit->TrackId());
00624 
00625     if(fTrackIndexToNeutrinoIndex[trackId]==neutrinoID) {
00626       if(hit->T1()<=max_t)
00627         totalMatch += weight;
00628     }
00629   }
00630   if(total<=0) return 0;  // Guard against FPEs
00631   return totalMatch/total;
00632 }

Float_t Truthifier::IsSignalFromParticle ( Int_t  particleID,
const DigiSignal signal 
) const

Returns the fraction of the signal that is due to a certain particle ID.

Definition at line 566 of file Truthifier.cxx.

References DigiSignal::GetHit(), DigiSignal::GetHitWeight(), DigiSignal::GetNumberOfHits(), n, DigiScintHit::ParticleId(), and total().

Referenced by IsDigitFromParticle().

00567 {
00572   if(! signal) return 0;
00573   Float_t total = 0;
00574   Float_t totalMatch = 0;
00575   UInt_t n = signal->GetNumberOfHits();
00576   for(UInt_t i=0; i<n; i++) {
00577     const DigiScintHit* hit = signal->GetHit(i);
00578     Float_t weight = signal->GetHitWeight(i);
00579     if(hit->ParticleId() == particleID)  totalMatch += weight;
00580     total += weight;
00581   }
00582   if(total<=0) return 0;  // Guard against FPEs
00583   return totalMatch/total;
00584 }

Float_t Truthifier::IsSignalFromTrack ( Int_t  trackID,
const DigiSignal signal 
) const

Returns the fraction of the signal that is due to a certain particle track.

Definition at line 588 of file Truthifier.cxx.

References DigiSignal::GetHit(), DigiSignal::GetHitWeight(), DigiSignal::GetNumberOfHits(), n, total(), and DigiScintHit::TrackId().

Referenced by IsDigitFromTrack().

00589 {
00594   if(! signal) return 0;
00595   Float_t total = 0;
00596   Float_t totalMatch = 0;
00597   UInt_t n = signal->GetNumberOfHits();
00598   for(UInt_t i=0; i<n; i++) {
00599     const DigiScintHit* hit = signal->GetHit(i);
00600     Float_t weight = signal->GetHitWeight(i);
00601     if(hit->TrackId() == trackID)  totalMatch += weight;
00602     total += weight;
00603   }
00604   if(total<=0) return 0;  // Guard against FPEs
00605   return totalMatch/total;
00606 }

Bool_t Truthifier::IsValid (  )  const [inline]

Definition at line 78 of file Truthifier.h.

References fValid.

Referenced by MCAnalysis::Ana(), Instance(), and AlgRmMu::RunAlg().

00078 { return fValid; };

void Truthifier::Print ( const Option_t *  = ""  )  const [virtual]

Prints out the whole blessed mess.

Prints out a complete map of the event, from tracks to hits. Useful for debugging, but too difficult for real work.

Definition at line 943 of file Truthifier.cxx.

References bfld::AsString(), DigiScintHit::AsString(), digit(), Munits::fC, fHitToSignal, fSignalToDigit, fTrackToHit, DigiSignal::GetCharge(), and DigiSignal::GetTruth().

00944 {
00950 
00951   // Go through all tracks.
00952   TrackToHit_t::const_iterator hitItr = fTrackToHit.begin();
00953   for( ; hitItr!=fTrackToHit.end(); hitItr++) {
00954     std::cout << "+--- TRACK " << hitItr->first << " ---------\n";
00955     
00956     // For each scint hit
00957     for(UInt_t ihit=0; ihit<hitItr->second.size(); ihit++) {
00958       const DigiScintHit* hit =  (hitItr->second)[ihit];
00959       std::cout << "|+-- DigiScintHit: " << hit->AsString() << std::endl;
00960       
00961       // For each signal
00962       HitToSignal_t::const_iterator htsItr = fHitToSignal.find(hit);
00963       if(htsItr != fHitToSignal.end()) {
00964         for(UInt_t isig = 0; isig<htsItr->second.size(); isig++) {
00965           
00966           const DigiSignal* signal = (htsItr->second)[isig];
00967           SignalToDigit_t::const_iterator stdItr = fSignalToDigit.find(signal);
00968           if(stdItr != fSignalToDigit.end()) {
00969             const RawDigit* digit = stdItr->second;
00970             std::cout << " |-- RawDigit: " << *digit << std::endl;
00971             std::cout << " |   DigiSignal: " 
00972                       << signal->GetCharge() / Munits::fC 
00973                << " fC" 
00974                       << "  Truth: " << AsString(signal->GetTruth()) << std::endl;      
00975           }
00976         }
00977         
00978       }
00979       
00980     }
00981   }
00982 }

void Truthifier::Reset ( const MomNavigator mom,
Bool_t  supressErrors = false 
)

Reset(mom) Builds or rebuilds the association maps to do all the other cool things this class does.

Definition at line 81 of file Truthifier.cxx.

References fHitToSignal, RecDataRecord< T >::FindComponent(), fMom, fNeuKins, fNeutrinoIndexToTrackIndex, fNeutrinoList, MomNavigator::FragmentIter(), fRddb, fScintHitArray, fSignals, fSignalToDigit, fStdHep, fTrackIndexToNeutrinoIndex, fTrackToHit, fValid, RawDigitDataBlock::GetDatumIter(), DigiSignal::GetHit(), DigiSignal::GetId(), DigiSignal::GetNumberOfHits(), RawRecord::GetRawBlockIter(), RawRecord::GetRawHeader(), GetSignal(), Msg::kDebug, Msg::kWarning, MAXMSG, MSG, and DigiScintHit::TrackId().

Referenced by Instance(), and Truthifier().

00082 {
00088 
00089   fMom = mom;
00090   fRddb = 0;
00091   fStdHep = 0;
00092   fNeutrinoList.clear();
00093   fTrackIndexToNeutrinoIndex.clear();
00094   fNeutrinoIndexToTrackIndex.clear();
00095   fTrackToHit.clear();
00096   fHitToSignal.clear();
00097   fSignalToDigit.clear();
00098   fSignals.clear(); 
00099   fValid=false;
00100 
00101   if(fMom ==0 ) return;
00102   
00103   // Find the simsnarl.
00104   SimSnarlRecord* simsnarl = 0;
00105   TObject* tobj;
00106   TIter    fragiter = mom->FragmentIter();
00107 
00108   // Get the simsnarl.
00109   while( ( tobj = fragiter.Next() ) ) {
00110     simsnarl = dynamic_cast<SimSnarlRecord*>(tobj);
00111     if(simsnarl) break;
00112   }
00113   if (simsnarl==0) { MSG("DataUtil",Msg::kWarning) << "Can't find simsnarl.\n"; return; };
00114   
00115   // Get the scint hit array.
00116   fScintHitArray = 
00117     dynamic_cast<const TObjArray*>(simsnarl->FindComponent(0,"DigiScintHits"));
00118   if (fScintHitArray==0) { 
00119 
00120     if (!supressErrors) {
00121       MSG("DataUtil",Msg::kWarning) << "Can't find scint hit array.\n"; 
00122     }
00123 
00124   } else {
00125   
00126     // Build the array of hits.
00127     TIter hitarrayIter(fScintHitArray);
00128     while( (tobj = hitarrayIter.Next()) ) {
00129       const DigiScintHit* scinthit = dynamic_cast<DigiScintHit*>(tobj);
00130       if(scinthit)
00131         fTrackToHit[scinthit->TrackId()].push_back(scinthit);
00132     }
00133 
00134   }
00135 
00136   // Get the signal array.
00137   const TObjArray* signalArray = 
00138     dynamic_cast<const TObjArray*>(simsnarl->FindComponent(0,"DigiSignal"));
00139   if (signalArray==0) { 
00140 
00141     if (!supressErrors) {
00142       MSG("DataUtil",Msg::kWarning) << "Can't find signal array.\n";
00143     }
00144   
00145   } else {
00146 
00147     // Build the array of signals.
00148     TIter signalIter(signalArray);
00149     while( (tobj = signalIter.Next()) ) {
00150       const DigiSignal* signal = dynamic_cast<DigiSignal*>(tobj);
00151       if(signal) {
00152         fSignals[signal->GetId()] = signal;
00153         for(UInt_t i=0;i<signal->GetNumberOfHits();i++) {
00154           const DigiScintHit* hit = signal->GetHit(i);
00155           if(hit) 
00156             fHitToSignal[hit].push_back(signal);
00157         }
00158       }
00159     }
00160     if (!supressErrors) {
00161       MSG("DataUtil",Msg::kDebug) 
00162         << "Got " << fSignals.size() << " signals." << std::endl;
00163     }
00164 
00165   }
00166 
00167   // Get the StdHep list.
00168   fStdHep = dynamic_cast<const TClonesArray*>(simsnarl->FindComponent("TClonesArray","StdHep"));
00169   if (fStdHep ==0) {
00170     if (!supressErrors)  {
00171       MSG("DataUtil",Msg::kWarning) << "Can't find StdHep list.\n";
00172     }
00173   } else {
00174     // Look through initial pariticle list. Associate track ID with originating neutrinos
00175     Int_t siz = fStdHep->GetEntriesFast();
00176     fTrackIndexToNeutrinoIndex.resize(siz);
00177     fNeutrinoList.clear();
00178     Int_t neu = 0;
00179     for(Int_t ind=0; ind<siz; ind++) {
00180       TParticle* part = dynamic_cast<TParticle*>((*fStdHep)[ind]);
00181       
00182       // Is this a lepton?
00183       if(abs(part->GetPdgCode())>=12 &&
00184          abs(part->GetPdgCode())<=16 
00185          ) {
00186         // Is the status code "Documentation" or "null"?
00187         // This should indicate that it was an initial particle
00188         // into the event generator.
00189         Int_t status = part->GetStatusCode();
00190         if( status == 3 || status == 0 ) {
00191           // We got a neutrino event!
00192           neu=ind;
00193           fNeutrinoList.push_back(ind);
00194         }
00195       }
00196       fTrackIndexToNeutrinoIndex[ind]=neu;
00197       fNeutrinoIndexToTrackIndex[neu].push_back(ind);
00198     }    
00199   }
00200 
00201   // Get the NeuKin list.
00202   fNeuKins = dynamic_cast<const TClonesArray*>(simsnarl->FindComponent("TClonesArray","NeuKinList"));
00203   
00204   // Find the RDDB.
00205   const RawHeader* rawhead =0;
00206   fRddb =0;
00207   fragiter.Reset();
00208   while( ( tobj = fragiter.Next() ) ) {
00209     RawRecord* rawRec = dynamic_cast<RawRecord*>(tobj);
00210     if(rawRec) {
00211       rawhead = rawRec->GetRawHeader();
00212       TIter itr = rawRec->GetRawBlockIter();
00213       RawDataBlock* rawBlk;
00214       while ( ( rawBlk = dynamic_cast<RawDataBlock*>(itr.Next()) ) ) {
00215         fRddb = dynamic_cast<RawDigitDataBlock*>(rawBlk);
00216         if(fRddb) {
00217           // Got one!
00218           TIter diter = fRddb->GetDatumIter();
00219           RawDigit* rawDigit;
00220           diter.Reset();
00221           while( ( rawDigit = (RawDigit*) diter.Next() ) ) {
00222             // Relate this digit to the signal
00223             const DigiSignal* signal = GetSignal(rawDigit);
00224             if(signal) {
00225               fSignalToDigit[signal] = rawDigit;
00226             }
00227           }
00228         }
00229       }
00230     }
00231   } // Ugly ugly ugly
00232 
00233   // See if we're good enough.
00234   fValid = true;
00235 
00236 
00237   if(fRddb==0) {
00238     //if(!supressErrors) MSG("DataUtil",Msg::kError) << "Couldn't find RDDB. Truthifier is invalid. \n";
00239     fValid = false;
00240   }
00241   if(fTrackToHit.size()==0) {
00242     //if(!supressErrors) MSG("DataUtil",Msg::kError) << "No hits found. Truthifier is invalid. \n";
00243     fValid = false;
00244   }
00245   if(fHitToSignal.size()==0) {
00246     //if(!supressErrors) MSG("DataUtil",Msg::kError) << "No map hit->signal. Truthifier is invalid. \n";
00247     fValid = false;
00248   }
00249   if(fSignalToDigit.size()==0) {
00250     //if(!supressErrors) MSG("DataUtil",Msg::kError) << "No map signal->digit found. Truthifier is invalid. \n";
00251     fValid = false;
00252   }
00253   if(fSignals.size()==0) {
00254     //if(!supressErrors)  MSG("DataUtil",Msg::kError) << "No signals found. Truthifier is invalid. \n";
00255     fValid = false;
00256   }  
00257   if ((!fValid)&&(!supressErrors)) {
00258     MAXMSG("DataUtil",Msg::kWarning,5) 
00259       << "Truthifier built but is invalid. Not MC or null snarl." << endl;
00260   }
00261 }


Member Data Documentation

Definition at line 209 of file Truthifier.h.

Referenced by GetSignalVector(), Print(), and Reset().

const MomNavigator* Truthifier::fMom [private]

Definition at line 184 of file Truthifier.h.

Referenced by Reset().

const TClonesArray* Truthifier::fNeuKins [private]

Definition at line 189 of file Truthifier.h.

Referenced by GetNeuKin(), and Reset().

Definition at line 201 of file Truthifier.h.

Referenced by Reset().

Definition at line 194 of file Truthifier.h.

Referenced by GetListOfNeutrinoIndecies(), GetNeuKinOfParticle(), and Reset().

Definition at line 187 of file Truthifier.h.

Referenced by GetRawDigit(), GetSignal(), and Reset().

const TObjArray* Truthifier::fScintHitArray [private]

Definition at line 190 of file Truthifier.h.

Referenced by GetScintHitListSize(), and Reset().

Definition at line 217 of file Truthifier.h.

Referenced by GetSignal(), and Reset().

Definition at line 213 of file Truthifier.h.

Referenced by GetRawDigit(), Print(), and Reset().

const TClonesArray* Truthifier::fStdHep [private]

Definition at line 188 of file Truthifier.h.

Referenced by GetStdHepParticle(), GetStdHepSize(), and Reset().

Definition at line 198 of file Truthifier.h.

Referenced by GetNeutrinoOfTrack(), IsSignalFromNeutrino(), and Reset().

Definition at line 205 of file Truthifier.h.

Referenced by Print(), and Reset().

Bool_t Truthifier::fValid [private]

Definition at line 185 of file Truthifier.h.

Referenced by IsValid(), and Reset().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1