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

TridModel Class Reference

#include <TridModel.h>

Inheritance diagram for TridModel:

TridModelCrate TridModelIntersect TridModelPixel TridModelPmt TridModelRecoStrip TridModelShower TridModelSlice TridModelStrip TridModelTrack List of all members.

Public Member Functions

 TridModel ()
virtual ~TridModel ()
virtual Int_t GetSortKey () const
virtual void SetSortKey (Int_t i)
Int_t GetId () const
virtual void AddStrip (Int_t stripid, const VldContext &cx, const NtpSRStrip *stripobj, StripEnd::StripEnd_t ends=StripEnd::kWhole)
virtual void AddDigit (CandDigitHandle cdh)
virtual void AddCandidate (const CandHandle &handle)
virtual Int_t GetSlice () const
virtual Int_t GetEvent () const
virtual Double_t GetTotalCharge (CalStripType::CalStripType_t t=CalStripType::kPE) const
virtual Double_t GetMeanTime (CalTimeType::CalTimeType_t t=CalTimeType::kT0) const
virtual Double_t GetEarliestTime (CalTimeType::CalTimeType_t t=CalTimeType::kT0) const
virtual Double_t GetLatestTime (CalTimeType::CalTimeType_t t=CalTimeType::kT0) const
virtual Int_t GetDigits () const
virtual Int_t GetStrips () const
virtual Int_t GetStripEnds () const
virtual Int_t GetOccupancy () const
virtual void PrintToDigitText (DigitText *dt) const
virtual void Print (std::ostream &os=std::cout) const
virtual Bool_t Intersects (const TridModel *other) const
virtual void AddFromModel (const TridModel *other)

Public Attributes

Int_t fSlice
Int_t fEvent
Int_t fNDigits
Int_t fNStrips
std::vector< Double_t > fTotalCharge
std::vector< Double_t > fTotalTime
Int_t fTimes
std::vector< Double_t > fEarliestTime
std::vector< Double_t > fLatestTime

Private Types

typedef std::set< PlexStripEndIdStripEndList_t
typedef std::set< Int_t > CompList_t

Private Attributes

Int_t fSortKey
Int_t fId
StripEndList_t fStripEnds
UInt_t fNStripEnds
CompList_t fCompList
UInt_t fNComps

Static Private Attributes

Int_t fsIdCounter = 1

Member Typedef Documentation

typedef std::set<Int_t> TridModel::CompList_t [private]
 

Definition at line 73 of file TridModel.h.

typedef std::set<PlexStripEndId> TridModel::StripEndList_t [private]
 

Definition at line 69 of file TridModel.h.


Constructor & Destructor Documentation

TridModel::TridModel  ) 
 

Definition at line 15 of file TridModel.cxx.

00015                      :
00016   fId(fsIdCounter++),
00017   fNStripEnds(0),
00018   fNComps(0),
00019   fSlice(-1),
00020   fEvent(-1),
00021   fNDigits(0),
00022   fNStrips(0),
00023   fTotalCharge(CalStripType::kGeV+1,0),
00024   fTotalTime(CalTimeType::kT0+1,0),
00025   fEarliestTime(CalTimeType::kT0+1,99e9),
00026   fLatestTime(CalTimeType::kT0+1,-99e9) 
00027 {
00028 }

virtual TridModel::~TridModel  )  [inline, virtual]
 

Definition at line 21 of file TridModel.h.

00021 {};


Member Function Documentation

void TridModel::AddCandidate const CandHandle handle  )  [virtual]
 

Definition at line 118 of file TridModel.cxx.

References AddDigit(), and CandHandle::GetDaughterIterator().

Referenced by TridModelMaker::CreateShowerModels(), and TridModelMaker::CreateTrackModels().

00119 {
00120   // Is it a digit itself?
00121   const CandDigitHandle* cdh = dynamic_cast<const CandDigitHandle*>(&handle);
00122   if(cdh) {
00123     this->AddDigit(*cdh);
00124     return;
00125   }
00126 
00127   // If not, burrow down looking for digits.
00128   TIter it = handle.GetDaughterIterator();
00129   TObject* obj;
00130   while( (obj=it.Next()) ) {
00131     const CandHandle* newHandle = dynamic_cast<const CandHandle*>(obj);
00132     if(newHandle)
00133      AddCandidate(*newHandle);
00134   }; 
00135 }

void TridModel::AddDigit CandDigitHandle  cdh  )  [virtual]
 

Reimplemented in TridModelStrip.

Definition at line 96 of file TridModel.cxx.

References fCompList, fEarliestTime, fLatestTime, fNComps, fNDigits, fNStripEnds, fStripEnds, fTimes, fTotalCharge, fTotalTime, PlexSEIdAltL::GetBestSEId(), CandHandle::GetCandBase(), CandDigitHandle::GetCharge(), CandDigitHandle::GetPlexSEIdAltL(), and CandDigitHandle::GetTime().

Referenced by AddCandidate(), TridModelStrip::AddDigit(), TridModelMaker::CreateChannelModels(), and TridModelMaker::CreatePmtModels().

00097 {
00098   fNDigits++;
00099   for(int i=0;i<=CalStripType::kPE;i++) {
00100     fTotalCharge[i] += cdh.GetCharge((CalDigitType::CalDigitType_t)i);
00101   }
00102   fTimes++;
00103   
00104   for(int i=0;i<=CalTimeType::kT0;i++) {
00105     double t = cdh.GetTime((CalTimeType::CalTimeType_t)i);
00106     fTotalTime[i]+=t;
00107     if(t < fEarliestTime[i] ) fEarliestTime[i] = t;
00108     if(t > fLatestTime[i] )   fLatestTime[i] = t;
00109   }
00110 
00111   fStripEnds.insert(cdh.GetPlexSEIdAltL().GetBestSEId());
00112   fNStripEnds = fStripEnds.size();
00113   fCompList.insert((int)cdh.GetCandBase());
00114   fNComps = fCompList.size();
00115 }

void TridModel::AddFromModel const TridModel other  )  [virtual]
 

Definition at line 203 of file TridModel.cxx.

References fCompList, fEarliestTime, fLatestTime, fNComps, fNStripEnds, fStripEnds, fTimes, fTotalCharge, and fTotalTime.

Referenced by TridModelIntersect::TridModelIntersect().

00204 {
00205   if(!other) return;
00206   for(int i=0;i<CalStripType::kGeV+1;i++) {
00207     fTotalCharge[i] += other->fTotalCharge[i];
00208   }
00209 
00210   for(int i=0;i<CalTimeType::kT0+1;i++) {
00211     if(other->fEarliestTime[i] < fEarliestTime[i]) fEarliestTime[i]= other->fEarliestTime[i];
00212     if(other->fLatestTime[i]   > fLatestTime[i]  ) fLatestTime[i]  = other->fLatestTime[i];
00213    
00214     fTotalTime[i] += other->fTotalTime[i];
00215   }
00216   fTimes += other->fTimes;
00217 
00218 
00219   fCompList.insert(other->fCompList.begin(),other->fCompList.end());
00220   fNComps = fCompList.size();
00221 
00222   fStripEnds.insert(other->fStripEnds.begin(),other->fStripEnds.end());
00223   fNStripEnds = fStripEnds.size();
00224 }

void TridModel::AddStrip Int_t  stripid,
const VldContext cx,
const NtpSRStrip stripobj,
StripEnd::StripEnd_t  ends = StripEnd::kWhole
[virtual]
 

Reimplemented in TridModelStrip.

Definition at line 30 of file TridModel.cxx.

References det, fCompList, fEarliestTime, fLatestTime, fNComps, fNStrips, fStripEnds, fTimes, fTotalCharge, fTotalTime, VldContext::GetDetector(), VldTimeStamp::GetNanoSec(), VldContext::GetTimeStamp(), NtpSRPulseHeight::pe, NtpSRStrip::ph0, NtpSRStrip::ph1, NtpSRStrip::plane, NtpSRPulseHeight::raw, NtpSRPulseHeight::sigcor, NtpSRPulseHeight::siglin, NtpSRStrip::strip, NtpSRStrip::time0, and NtpSRStrip::time1.

Referenced by TridModelStrip::AddStrip(), TridModelMaker::CreateChannelModels(), TridModelMaker::CreatePmtModels(), TridModelMaker::CreateShowerModels(), TridModelMaker::CreateSliceModels(), and TridModelMaker::CreateTrackModels().

00034 {  
00035   fCompList.insert(stripid);
00036   fNComps+=1;
00037 
00038   fNStrips+=1;
00039 
00040   Detector::Detector_t det = cx.GetDetector();
00041   double snarlt0 = cx.GetTimeStamp().GetNanoSec() * 1e-9;
00042 
00043   if(stripobj) {
00044     PlexStripEndId seid(det, stripobj->plane, stripobj->strip, end);
00045     if(end & StripEnd::kNegative) {
00046       seid.SetEnd(StripEnd::kNegative); 
00047       fStripEnds.insert(seid);
00048 
00049       if(stripobj->ph0.raw>0) {
00050         double time0 = stripobj->time0 - snarlt0;
00051         fTotalTime[CalTimeType::kT0]   += time0;
00052         fTotalTime[CalTimeType::kNone] += time0;
00053         fTimes++;
00054         if(stripobj->time0 < fEarliestTime[CalTimeType::kT0]) 
00055           fEarliestTime[CalTimeType::kT0] = time0;
00056         if(stripobj->time0 < fEarliestTime[CalTimeType::kNone]) 
00057           fEarliestTime[CalTimeType::kNone] = time0;
00058         if(stripobj->time0 > fLatestTime[CalTimeType::kT0]) 
00059           fLatestTime[CalTimeType::kT0] = time0;
00060         if(stripobj->time0 > fLatestTime[CalTimeType::kNone]) 
00061           fLatestTime[CalTimeType::kNone] = time0;
00062       }
00063 
00064       fTotalCharge[CalStripType::kNone]   += stripobj->ph0.raw;
00065       fTotalCharge[CalStripType::kSigLin] += stripobj->ph0.siglin;
00066       fTotalCharge[CalStripType::kSigCorr] += stripobj->ph0.sigcor;
00067       fTotalCharge[CalStripType::kPE]     += stripobj->ph0.pe;
00068     }
00069 
00070     if(end & StripEnd::kPositive) { 
00071       seid.SetEnd(StripEnd::kPositive); 
00072       fStripEnds.insert(seid);
00073 
00074       if(stripobj->ph1.raw>0) {
00075         double time1 = stripobj->time1 - snarlt0;
00076         fTotalTime[CalTimeType::kT0]   += time1;
00077         fTotalTime[CalTimeType::kNone] += time1;
00078         fTimes++;
00079         if(stripobj->time1 < fEarliestTime[CalTimeType::kT0]) 
00080           fEarliestTime[CalTimeType::kT0] = time1;
00081         if(stripobj->time1 < fEarliestTime[CalTimeType::kNone]) 
00082           fEarliestTime[CalTimeType::kNone] = time1;
00083         if(stripobj->time1 > fLatestTime[CalTimeType::kT0]) 
00084           fLatestTime[CalTimeType::kT0] = time1;
00085         if(stripobj->time1 > fLatestTime[CalTimeType::kNone]) 
00086           fLatestTime[CalTimeType::kNone] = time1;
00087       }
00088       fTotalCharge[CalStripType::kNone]   += stripobj->ph1.raw;
00089       fTotalCharge[CalStripType::kSigLin] += stripobj->ph1.siglin;
00090       fTotalCharge[CalStripType::kSigCorr] += stripobj->ph1.sigcor;
00091       fTotalCharge[CalStripType::kPE]     += stripobj->ph1.pe;
00092     }
00093   }
00094 }

virtual Int_t TridModel::GetDigits void   )  const [inline, virtual]
 

Definition at line 51 of file TridModel.h.

Referenced by TridModelCrate::Print(), and Print().

00051 { return fNDigits; };

virtual Double_t TridModel::GetEarliestTime CalTimeType::CalTimeType_t  t = CalTimeType::kT0  )  const [inline, virtual]
 

Definition at line 45 of file TridModel.h.

Referenced by TridPmtPage::CreateSketches(), TridPageSlice::CreateSketches(), TridCratePage::CreateSketches(), TridControl::GetRangedModelColor(), and Print().

00046   { return fEarliestTime[t]; }

virtual Int_t TridModel::GetEvent  )  const [inline, virtual]
 

Definition at line 37 of file TridModel.h.

Referenced by Print().

00037 { return fSlice; };

Int_t TridModel::GetId  )  const [inline]
 

Definition at line 24 of file TridModel.h.

Referenced by TridModelMaker::CreateIntersectionModels(), TridPageDetector::CreateSketches(), TridModelMaker::CreateStripModels(), TridPageSlice::ModifySketches(), and TridPageDetector::ModifySketches().

00024 { return fId; };

virtual Double_t TridModel::GetLatestTime CalTimeType::CalTimeType_t  t = CalTimeType::kT0  )  const [inline, virtual]
 

Definition at line 48 of file TridModel.h.

Referenced by TridPageSlice::CreateSketches(), and Print().

00049   { return fLatestTime[t]; }

virtual Double_t TridModel::GetMeanTime CalTimeType::CalTimeType_t  t = CalTimeType::kT0  )  const [inline, virtual]
 

Definition at line 42 of file TridModel.h.

Referenced by TridModelMaker::CreateIntersectionModels(), TridUVPage::CreateSketches(), TridPageDetector::CreateSketches(), TridModelMaker::CreateSliceModels(), TridControl::GetRangedModelColor(), TridControl::GetRangedModelTrans(), and Print().

00043   {  if(fTimes) return fTotalTime[t]/fTimes; return -99e9; }    

virtual Int_t TridModel::GetOccupancy  )  const [inline, virtual]
 

Definition at line 54 of file TridModel.h.

Referenced by TridCratePage::CreateSketches(), and TridControl::GetRangedModelColor().

00054 { return GetDigits(); };

virtual Int_t TridModel::GetSlice  )  const [inline, virtual]
 

Definition at line 36 of file TridModel.h.

Referenced by TridPageSlice::ModifySketches(), and Print().

00036 { return fSlice; };

virtual Int_t TridModel::GetSortKey  )  const [inline, virtual]
 

Definition at line 22 of file TridModel.h.

Referenced by TridModelList::AddModel(), TridModelMaker::CreateChannelModels(), TridModelMaker::CreateIntersectionModels(), TridModelMaker::CreatePmtModels(), TridPageDetector::CreateSketches(), TridModelMaker::CreateStripModels(), TridUVPage::ModifySketches(), TridPageSlice::ModifySketches(), and TridPageDetector::ModifySketches().

00022 { return fSortKey; };

virtual Int_t TridModel::GetStripEnds  )  const [inline, virtual]
 

Definition at line 53 of file TridModel.h.

00053 { return fStripEnds.size(); };

virtual Int_t TridModel::GetStrips  )  const [inline, virtual]
 

Definition at line 52 of file TridModel.h.

Referenced by Print().

00052 { return fNStrips; };

virtual Double_t TridModel::GetTotalCharge CalStripType::CalStripType_t  t = CalStripType::kPE  )  const [inline, virtual]
 

Definition at line 39 of file TridModel.h.

Referenced by TridPmtPage::CreateSketches(), TridControl::GetRangedModelColor(), TridControl::GetRangedModelTrans(), TridModelCrate::Print(), and Print().

00040   { return fTotalCharge[t]; }

Bool_t TridModel::Intersects const TridModel other  )  const [virtual]
 

Checks to see if there are any commonalities between this model and the other one.

Definition at line 180 of file TridModel.cxx.

References fCompList, fNComps, fStripEnds, and test_set_intersection().

Referenced by TridControl::IsPicked().

00181 {
00186 
00187 
00188   // First, check for component IDs.
00189   if((fNComps>0)&&(other->fNComps>0)) {
00190     return test_set_intersection(        fCompList.begin(),        fCompList.end(),
00191                                   other->fCompList.begin(), other->fCompList.end() ); 
00192   }
00193 
00194   // Next, check for strip end IDs
00195   if(fStripEnds.size()==0) return false;
00196   if(other->fStripEnds.size()==0) return false;
00197 
00198     return test_set_intersection(        fStripEnds.begin(),        fStripEnds.end(),
00199                                   other->fStripEnds.begin(), other->fStripEnds.end() ); 
00200 }

void TridModel::Print std::ostream &  os = std::cout  )  const [virtual]
 

Reimplemented in TridModelCrate, TridModelIntersect, TridModelPmt, TridModelPixel, TridModelRecoStrip, TridModelShower, TridModelStrip, and TridModelTrack.

Definition at line 151 of file TridModel.cxx.

References Form(), GetDigits(), GetEarliestTime(), GetEvent(), GetLatestTime(), GetMeanTime(), GetSlice(), GetStrips(), and GetTotalCharge().

Referenced by TridUVPage::ModifySketches(), TridPage::MouseOver(), TridModelTrack::Print(), TridModelStrip::Print(), TridModelShower::Print(), TridModelRecoStrip::Print(), TridModelPixel::Print(), TridModelPmt::Print(), TridModelIntersect::Print(), PrintToDigitText(), and TridPage::PrintToFile().

00152 { 
00153   os << "In slice: " << GetSlice() << std::endl;
00154   os << "In event: " << GetEvent() << std::endl;
00155   os << "Digits: " << GetDigits() << std::endl;
00156   os << "Strips: " << GetStrips() << std::endl;
00157   os << "Total Charge: " << std::endl;
00158   os << Form("  ADC: %6.0f PE: %4.1f\n  SigLin: %4.1f  SigCorr: %4.1f  SigMap: %4.1f  SigMip: %4.1f  GeV: %4.1f",
00159              GetTotalCharge(CalStripType::kNone), 
00160              GetTotalCharge(CalStripType::kPE), 
00161              GetTotalCharge(CalStripType::kSigLin), 
00162              GetTotalCharge(CalStripType::kSigCorr), 
00163              GetTotalCharge(CalStripType::kSigMapped), 
00164              GetTotalCharge(CalStripType::kMIP), 
00165              GetTotalCharge(CalStripType::kGeV) ) << std::endl;
00166   os << "Time:" << std::endl;
00167   os << Form("  Mean Time:     %6.1f ns (uncal)   %6.1f ns (cal)",
00168              GetMeanTime(CalTimeType::kNone)/Munits::ns,
00169              GetMeanTime(CalTimeType::kT0)/Munits::ns ) << std::endl;
00170   os << Form("  Earliest Time: %6.1f ns (uncal)   %6.1f ns (cal)",
00171              GetEarliestTime(CalTimeType::kNone)/Munits::ns,
00172              GetEarliestTime(CalTimeType::kT0)/Munits::ns ) << std::endl;
00173   os << Form("  Latest Time:   %6.1f ns (uncal)   %6.1f ns (cal)",
00174              GetLatestTime(CalTimeType::kNone)/Munits::ns,
00175              GetLatestTime(CalTimeType::kT0)/Munits::ns ) << std::endl;
00176              
00177 }

void TridModel::PrintToDigitText DigitText dt  )  const [virtual]
 

Definition at line 138 of file TridModel.cxx.

References DigitText::AddLine(), DigitText::Clear(), and Print().

00139 { 
00140   if(!dt) return;
00141   dt->Clear();
00142   std::stringstream buf;
00143   this->Print(buf);
00144   char line[1000];
00145   while(!buf.eof()) {
00146     buf.getline(line,1000);
00147     dt->AddLine(line);
00148   };
00149 }

virtual void TridModel::SetSortKey Int_t  i  )  [inline, virtual]
 

Definition at line 23 of file TridModel.h.

Referenced by TridModelMaker::CreateSliceModels(), TridModelCrate::TridModelCrate(), TridModelIntersect::TridModelIntersect(), TridModelPixel::TridModelPixel(), TridModelPmt::TridModelPmt(), and TridModelStrip::TridModelStrip().

00023 { fSortKey = i; };


Member Data Documentation

CompList_t TridModel::fCompList [private]
 

Definition at line 74 of file TridModel.h.

Referenced by AddDigit(), AddFromModel(), AddStrip(), and Intersects().

std::vector<Double_t> TridModel::fEarliestTime
 

Definition at line 85 of file TridModel.h.

Referenced by AddDigit(), AddFromModel(), and AddStrip().

Int_t TridModel::fEvent
 

Definition at line 79 of file TridModel.h.

Int_t TridModel::fId [private]
 

Definition at line 65 of file TridModel.h.

std::vector<Double_t> TridModel::fLatestTime
 

Definition at line 86 of file TridModel.h.

Referenced by AddDigit(), AddFromModel(), and AddStrip().

UInt_t TridModel::fNComps [private]
 

Definition at line 75 of file TridModel.h.

Referenced by AddDigit(), AddFromModel(), AddStrip(), and Intersects().

Int_t TridModel::fNDigits
 

Definition at line 80 of file TridModel.h.

Referenced by AddDigit().

UInt_t TridModel::fNStripEnds [private]
 

Definition at line 71 of file TridModel.h.

Referenced by AddDigit(), and AddFromModel().

Int_t TridModel::fNStrips
 

Definition at line 81 of file TridModel.h.

Referenced by AddStrip().

Int_t TridModel::fsIdCounter = 1 [static, private]
 

Definition at line 13 of file TridModel.cxx.

Int_t TridModel::fSlice
 

Definition at line 78 of file TridModel.h.

Referenced by TridModelMaker::CreateSliceModels().

Int_t TridModel::fSortKey [private]
 

Definition at line 64 of file TridModel.h.

StripEndList_t TridModel::fStripEnds [private]
 

Definition at line 70 of file TridModel.h.

Referenced by AddDigit(), AddFromModel(), AddStrip(), and Intersects().

Int_t TridModel::fTimes
 

Definition at line 84 of file TridModel.h.

Referenced by AddDigit(), AddFromModel(), and AddStrip().

std::vector<Double_t> TridModel::fTotalCharge
 

Definition at line 82 of file TridModel.h.

Referenced by AddDigit(), AddFromModel(), AddStrip(), TridModelMaker::CreateShowerModels(), and TridModelMaker::CreateTrackModels().

std::vector<Double_t> TridModel::fTotalTime
 

Definition at line 83 of file TridModel.h.

Referenced by AddDigit(), AddFromModel(), and AddStrip().


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