Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Morgue Class Reference

#include <Morgue.h>

List of all members.

Public Types

typedef std::multimap< PlexStripEndId,
StripGrave
Graveyard_t
typedef std::map< PlexStripEndId,
StripPrisonCell
Prison_t
enum  Deadness_t { kNotDead = 0, kMaybeDead = 1, kDead = 2, kExParrot = 16 }
enum  Badness_t {
  kGood = 0, kFlaky = 1, kBadTime = 2, kBad = 16,
  kUgly = 32
}

Public Member Functions

void Print (Option_t *option="") const
Int_t GetNumDeadStripEndsInVeto (Double_t time=-1.0, Deadness_t deadness=kMaybeDead) const
Int_t GetNumDeadStripEnds () const
Int_t GetNumDeadStripEnds (Int_t plane_start, Int_t plane_end, Double_t time=-1.0, Deadness_t deadness=kMaybeDead) const
Int_t GetNumDeadStripEnds (Int_t plane, Double_t time=-1.0, Deadness_t deadness=kMaybeDead) const
Deadness_t StripEndIsDead (PlexStripEndId seid, Double_t time=-1.0) const
const std::vector< PlexStripEndId > & GetDeadStripEnds (Double_t time=-1.0, Deadness_t deadness=kMaybeDead) const
Int_t GetNumBadStripEnds (Int_t plane_start, Int_t plane_end, Badness_t badness=kFlaky) const
Int_t GetNumBadStripEnds (Int_t plane, Badness_t badness=kFlaky) const
Badness_t StripEndIsBad (const PlexStripEndId &seid) const
const char * HowIsStripEndBad (const PlexStripEndId &seid) const
Double_t GetNearestLiTime () const
Double_t GetTriggerTime () const

Static Public Member Functions

const MorgueGetMorgue (const MomNavigator *mom)
const MorgueGetMorgue (const CandRecord *candrecord)

Protected Member Functions

 Morgue ()
 ~Morgue ()
void Reset ()
void SetTriggerTime (Double_t trigger)
void AddDeadStrip (const PlexStripEndId &seid, Double_t fired, Double_t probableRecover, Double_t definateRecover)
void AddBadStrip (const PlexStripEndId &seid, HardwareComponent comp, Badness_t badness, const char *reason)
void SetNearestLiTime (double time)

Private Member Functions

 ClassDef (Morgue, 1)

Private Attributes

Double_t fTriggerTime
Graveyard_t fGraveyard
Prison_t fPrison
Double_t fNearestLiTime

Friends

class Coroner


Member Typedef Documentation

typedef std::multimap<PlexStripEndId,StripGrave> Morgue::Graveyard_t
 

Definition at line 132 of file Morgue.h.

typedef std::map<PlexStripEndId,StripPrisonCell> Morgue::Prison_t
 

Definition at line 140 of file Morgue.h.


Member Enumeration Documentation

enum Morgue::Badness_t
 

Enumeration values:
kGood 
kFlaky 
kBadTime 
kBad 
kUgly 

Definition at line 87 of file Morgue.h.

Referenced by StripEndIsBad().

00087                {
00088     kGood    = 0,   // you can trust this thing    
00089     kFlaky   = 1,   // If there's data, you can trust it, but it may not read out. I.e. broken fibre
00090     kBadTime = 2,   // You can trust the calorimetry if it's there, but not the timing
00091     kBad     = 16,  // Data from this thing is untrustworthy.
00092     kUgly    = 32   // Don't even think about it.
00093   } Badness_t;

enum Morgue::Deadness_t
 

Enumeration values:
kNotDead 
kMaybeDead 
kDead 
kExParrot 

Definition at line 54 of file Morgue.h.

Referenced by Morgue::StripGrave::Deadness(), Print(), and StripEndIsDead().

00054                {
00055     kNotDead   = 0,   // PMT should be live
00056     kMaybeDead = 1,   // PMT may have finished reading out and be live again
00057     kDead      = 2,   // PMT should definately still be reading out and therefore dead.
00058     kExParrot  = 16   // Mate, that parrot wouldn't zoom if you put four million volts through it
00059   } Deadness_t;


Constructor & Destructor Documentation

Morgue::Morgue  )  [protected]
 

Definition at line 40 of file Morgue.cxx.

00041 {
00042   Reset();
00043 }

Morgue::~Morgue  )  [protected]
 

Definition at line 45 of file Morgue.cxx.

References Reset().

00046 {
00047   Reset();
00048 }


Member Function Documentation

void Morgue::AddBadStrip const PlexStripEndId seid,
HardwareComponent  component,
Badness_t  badness,
const char *  reason
[protected]
 

Protected: for Coroner to add bad strips.

Definition at line 80 of file Morgue.cxx.

References Morgue::StripPrisonCell::fBadness, Morgue::StripPrisonCell::fComponent, fPrison, and Morgue::StripPrisonCell::fReason.

Referenced by Coroner::RecordBadStrips().

00084 {
00088   StripPrisonCell cell;
00089   cell.fComponent = component,
00090   cell.fBadness = badness;
00091   cell.fReason  = reason;
00092   Prison_t::iterator it = fPrison.find(seid);
00093   if(it!=fPrison.end()) {
00094     // This strip already has an entry. Take the worst entry.
00095     if(badness > it->second.fBadness) {
00096       it->second = cell;
00097     }
00098     return;
00099   }
00100 
00101   // insert a new entry.
00102   fPrison[seid] = cell;
00103 }

void Morgue::AddDeadStrip const PlexStripEndId seid,
Double_t  fired,
Double_t  probableRecover,
Double_t  definateRecover
[protected]
 

Protected: for Coroner to add dead strips.

Definition at line 62 of file Morgue.cxx.

References Morgue::StripGrave::fDefinateRecover, Morgue::StripGrave::fFired, fGraveyard, and Morgue::StripGrave::fProbableRecover.

Referenced by Coroner::RecordDeadStrips().

00066 {
00070   StripGrave grave;
00071   //grave.fSeid = seid;
00072   grave.fFired = fired;
00073   grave.fProbableRecover = probableRecover;
00074   grave.fDefinateRecover = definateRecover;
00075   
00076   fGraveyard.insert(std::pair<PlexStripEndId,StripGrave>(seid,grave));
00077 }

Morgue::ClassDef Morgue  ,
[private]
 

const std::vector< PlexStripEndId > & Morgue::GetDeadStripEnds Double_t  time = -1.0,
Deadness_t  deadness = kMaybeDead
const
 

Return a list of dead strip ends (i.e. at or worse than deadness) Time is in absolute units (i.e. seconds past the second.) Note that the return value is a static, and should be copied if not used right away. Time is in absolute units (i.e. seconds past the second.) Default time (-1) indicates that the DAQ trigger time is used

Definition at line 318 of file Morgue.cxx.

References fGraveyard, and GetTriggerTime().

00320 {
00329   if(time == -1.0) time = GetTriggerTime();
00330 
00331   static std::vector<PlexStripEndId> retval;
00332   retval.clear();
00333   retval.reserve(1024);
00334 
00335   Graveyard_t::const_iterator it = fGraveyard.begin();
00336   for(; it!=fGraveyard.end(); it++) {
00337     if(it->second.Deadness(time) >= deadness) retval.push_back(it->first);
00338   }
00339   
00340   return retval;
00341 }

const Morgue & Morgue::GetMorgue const CandRecord candrec  )  [static]
 

User function to get a Morgue handle from the CandRecord.

Definition at line 123 of file Morgue.cxx.

References RecMinos::FindComponent(), and RecMinos::FindTemporary().

00124 {
00128   static Morgue nullMorgue;
00129   const Morgue* m;
00130 
00131   if (candrec == 0) return nullMorgue;
00132   
00133   m = dynamic_cast<const Morgue*>(candrec->FindComponent("Morgue","Morgue"));
00134   if(m) return *m;
00135 
00136   m = dynamic_cast<const Morgue*>(candrec->FindTemporary("Morgue","Morgue"));
00137   if(m) return *m;
00138 
00139   return nullMorgue;
00140 }

const Morgue & Morgue::GetMorgue const MomNavigator mom  )  [static]
 

User function to get a Morgue handle from Mom.

Definition at line 110 of file Morgue.cxx.

References MomNavigator::GetFragment().

Referenced by Coroner::Ana().

00111 {
00115 
00116    // Find PrimaryCandidateRecord fragment in MOM.
00117   CandRecord *candrec = dynamic_cast<CandRecord *>
00118     (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00119  
00120   return GetMorgue(candrec);
00121 }

Double_t Morgue::GetNearestLiTime  )  const [inline]
 

Definition at line 107 of file Morgue.h.

Referenced by Coroner::RecordLiHits().

00107 { return fNearestLiTime; };

Int_t Morgue::GetNumBadStripEnds Int_t  plane,
Badness_t  badness = kFlaky
const
 

Get number of strip ends in plane p that are 'badness' or worse.

Definition at line 366 of file Morgue.cxx.

References fPrison.

00368 {
00372   int bad_strips = 0;
00373   for(Prison_t::const_iterator it = fPrison.begin(); 
00374       it!= fPrison.end(); it++) {
00375     if( plane == it->first.GetPlane() ) {
00376       if(it->second.fBadness >= badness) bad_strips++;
00377     }
00378   }
00379   return bad_strips;
00380 }

Int_t Morgue::GetNumBadStripEnds Int_t  plane_start,
Int_t  plane_end,
Badness_t  badness = kFlaky
const
 

Return number of strip ends worse or equal to badness in the range of planes given.

Definition at line 348 of file Morgue.cxx.

References fPrison.

00351 {
00355   int bad_strips = 0;
00356   for(Prison_t::const_iterator it = fPrison.begin(); 
00357       it!= fPrison.end(); ++it) {
00358     int plane = it->first.GetPlane();
00359     if((plane >= plane_start) && (plane <= plane_end)) {
00360       if(it->second.fBadness >= badness) bad_strips++;
00361     }
00362   }
00363   return bad_strips;
00364 }

Int_t Morgue::GetNumDeadStripEnds Int_t  plane,
Double_t  time = -1.0,
Deadness_t  deadness = kMaybeDead
const
 

Returns the number of strip ends that are at least 'deadness' dead in the given plane at the given time. Time is in absolute units (i.e. seconds past the second.) Default time (-1) indicates that the DAQ trigger time should be used.

Definition at line 258 of file Morgue.cxx.

References fGraveyard, and GetTriggerTime().

00262 {
00269 
00270   if(time==-1.0) time = GetTriggerTime();
00271 
00272   int num = 0;
00273   Graveyard_t::const_iterator it = fGraveyard.begin();
00274   for(; it!=fGraveyard.end(); it++) {
00275 
00276     // Is this strip up for consideration?
00277     if(it->first.GetPlane() != plane) continue;
00278     
00279     if(it->second.Deadness(time) >= deadness) {
00280       num++; // It's at least as dead as the requested deadness.
00281     }
00282   }
00283   return num;
00284 }

Int_t Morgue::GetNumDeadStripEnds Int_t  plane_start,
Int_t  plane_end,
Double_t  time = -1.0,
Deadness_t  deadness = kMaybeDead
const
 

Returns the number of dead strip ends between plane_start and plane_end (inclusive) that are at least deadness dead at the given time. Time is in absolute units (i.e. seconds past the second.) Default time (-1) indicates that the DAQ trigger time should be used.

Definition at line 226 of file Morgue.cxx.

References fGraveyard, and GetTriggerTime().

00230 {
00237   
00238   if (time == -1.0) time = GetTriggerTime();
00239 
00240   int num = 0;
00241   Graveyard_t::const_iterator it = fGraveyard.begin();
00242   for(; it!=fGraveyard.end(); it++) {
00243 
00244     // Is this strip up for consideration?
00245     if(it->first.GetPlane() <= plane_start) continue;
00246     if(it->first.GetPlane() >= plane_end) continue;    
00247 
00248     
00249     if(it->second.Deadness(time) >= deadness) {
00250       num++; // It's at least as dead as the requested deadness.
00251     }
00252   }
00253   
00254   return num;
00255 }

Int_t Morgue::GetNumDeadStripEnds  )  const [inline]
 

Definition at line 65 of file Morgue.h.

Referenced by Print().

00065 { return GetNumDeadStripEnds(0,500); };

Int_t Morgue::GetNumDeadStripEndsInVeto Double_t  time = -1.0,
Deadness_t  deadness = kMaybeDead
const
 

Returns the number of dead strip ends in the veto shield that are at least 'deadness' dead at the given time. Time is in absolute units (i.e. seconds past the second.) Default time (-1) indicates that the DAQ trigger time should be used.

Definition at line 196 of file Morgue.cxx.

References fGraveyard, and GetTriggerTime().

00198 {
00205   
00206     if (time == -1.0) time = GetTriggerTime();
00207 
00208   int num = 0;
00209   Graveyard_t::const_iterator it = fGraveyard.begin();
00210   for(; it!=fGraveyard.end(); it++) {
00211 
00212     // Is this strip up for consideration?
00213     if(it->first.IsVetoShield()) {
00214       if(it->second.Deadness(time) >= deadness) {
00215         num++; // It's at least as dead as the requested deadness.
00216       }
00217     }
00218   }
00219   
00220   return num;
00221 
00222 }

Double_t Morgue::GetTriggerTime void   )  const [inline]
 

Definition at line 108 of file Morgue.h.

Referenced by GetDeadStripEnds(), GetNumDeadStripEnds(), GetNumDeadStripEndsInVeto(), Coroner::RecordLiHits(), and StripEndIsDead().

00108 { return fTriggerTime; };

const char * Morgue::HowIsStripEndBad const PlexStripEndId seid  )  const
 

Return a description of what is wrong with this strip. Note that this funtion will only work if used 'inline' with the Coroner. If you are looking a Morgue saved in a file, this data is thrown away for reasons of data volume.

Definition at line 393 of file Morgue.cxx.

References fPrison.

00394 {
00401   Prison_t::const_iterator it = fPrison.find(seid);
00402   if(it==fPrison.end()) return "Good";
00403   
00404   if(it->second.fReason) return it->second.fReason;
00405   return "Unknown";
00406 }

void Morgue::Print Option_t *  option = ""  )  const
 

User-readable printout.

Definition at line 145 of file Morgue.cxx.

References Deadness_t, fGraveyard, fTriggerTime, GetNumDeadStripEnds(), and option.

Referenced by Coroner::Ana().

00146 {
00150   using namespace std;
00151   cout << "----Morgue-----" << endl;
00152   cout << " Total dead stripends " << GetNumDeadStripEnds() << endl;
00153   cout << "  at trigger time " << fTriggerTime*1e9 << endl;
00154 
00155   if(option[0]=='a') {
00156     Graveyard_t::const_iterator it = fGraveyard.begin();
00157     for(; it!=fGraveyard.end(); it++) {    
00158       Deadness_t deadness = it->second.Deadness(fTriggerTime);
00159       cout << it->first.AsString() 
00160            << "\t" << deadness 
00161            << "\t" << 1e9*(it->second.fFired-fTriggerTime)
00162            << "\t" << 1e9*(it->second.fProbableRecover-fTriggerTime)
00163            << "\t" << 1e9*(it->second.fDefinateRecover-fTriggerTime)
00164            << endl;
00165     }
00166   }
00167 }

void Morgue::Reset  )  [protected]
 

Clear the data.

Definition at line 50 of file Morgue.cxx.

References fGraveyard, fNearestLiTime, fPrison, and fTriggerTime.

Referenced by ~Morgue().

00051 {
00055   fTriggerTime = 0;
00056   fNearestLiTime = -1e9;
00057   fGraveyard.clear();
00058   fPrison.clear();
00059 }

void Morgue::SetNearestLiTime double  time  )  [inline, protected]
 

Definition at line 121 of file Morgue.h.

References fNearestLiTime.

Referenced by Coroner::RecordLiHits().

00121 {  fNearestLiTime = time; };

void Morgue::SetTriggerTime Double_t  trigger  )  [inline, protected]
 

Definition at line 118 of file Morgue.h.

References fTriggerTime.

Referenced by Coroner::RecordDeadStrips().

00118 { fTriggerTime = trigger; };

Morgue::Badness_t Morgue::StripEndIsBad const PlexStripEndId seid  )  const
 

Return just how bad stripend seid is. 1= good, 2=flaky, etc.

Definition at line 382 of file Morgue.cxx.

References Badness_t, and fPrison.

00383 {
00387   Prison_t::const_iterator it = fPrison.find(seid);
00388   if(it==fPrison.end()) return kGood;
00389   
00390   return it->second.fBadness;
00391 }

Morgue::Deadness_t Morgue::StripEndIsDead PlexStripEndId  seid,
Double_t  time = -1.0
const
 

Returns how dead a strip end seid is at the given time. Time is in absolute units (i.e. seconds past the second.) Default time (-1) indicates that the DAQ trigger time is used

Definition at line 288 of file Morgue.cxx.

References Deadness_t, fGraveyard, and GetTriggerTime().

00291 {
00297 
00298   if(time==-1.0) time = GetTriggerTime();
00299 
00300   // Default: alive.
00301   Deadness_t result = kNotDead;
00302 
00303   // Find all graves for this strip.
00304   std::pair<Graveyard_t::const_iterator,Graveyard_t::const_iterator> range = 
00305     fGraveyard.equal_range(seid);
00306 
00307   // Go through all these possible dead times and return the worst one.
00308   Graveyard_t::const_iterator it;
00309   for(it = range.first; it!= range.second; it++) {
00310     Deadness_t thisres = it->second.Deadness(time);
00311     if(thisres>result) result = thisres;
00312   }
00313   
00314   return result;
00315 }


Friends And Related Function Documentation

friend class Coroner [friend]
 

Definition at line 40 of file Morgue.h.


Member Data Documentation

Graveyard_t Morgue::fGraveyard [private]
 

Definition at line 145 of file Morgue.h.

Referenced by AddDeadStrip(), GetDeadStripEnds(), GetNumDeadStripEnds(), GetNumDeadStripEndsInVeto(), Print(), Reset(), and StripEndIsDead().

Double_t Morgue::fNearestLiTime [private]
 

Definition at line 148 of file Morgue.h.

Referenced by Reset(), and SetNearestLiTime().

Prison_t Morgue::fPrison [private]
 

Definition at line 146 of file Morgue.h.

Referenced by AddBadStrip(), GetNumBadStripEnds(), HowIsStripEndBad(), Reset(), and StripEndIsBad().

Double_t Morgue::fTriggerTime [private]
 

Definition at line 144 of file Morgue.h.

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


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:09:37 2010 for loon by  doxygen 1.3.9.1