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

static Int_t fsIdCounter = 1

Detailed Description

Definition at line 17 of file TridModel.h.


Member Typedef Documentation

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

Definition at line 74 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 122 of file TridModel.cxx.

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

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

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

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(), CandDigitHandle::GetTime(), CalStripType::kPE, and CalTimeType::kT0.

Referenced by AddCandidate(), 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 #ifndef MINOS_TRY64
00114   fCompList.insert((int)cdh.GetCandBase());
00115 #else
00116   fCompList.insert((Long64_t)cdh.GetCandBase());
00117 #endif
00118   fNComps = fCompList.size();
00119 }

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

Definition at line 207 of file TridModel.cxx.

References fCompList, fEarliestTime, fLatestTime, fNComps, fNStripEnds, fStripEnds, fTimes, fTotalCharge, fTotalTime, CalStripType::kGeV, and CalTimeType::kT0.

Referenced by TridModelIntersect::TridModelIntersect().

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

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, MuELoss::e, fCompList, fEarliestTime, fLatestTime, fNComps, fNStrips, fStripEnds, fTimes, fTotalCharge, fTotalTime, VldContext::GetDetector(), VldTimeStamp::GetNanoSec(), VldContext::GetTimeStamp(), StripEnd::kNegative, CalTimeType::kNone, CalStripType::kNone, CalStripType::kPE, StripEnd::kPositive, CalStripType::kSigCorr, CalStripType::kSigLin, CalTimeType::kT0, NtpSRPulseHeight::pe, NtpSRStrip::ph0, NtpSRStrip::ph1, NtpSRStrip::plane, NtpSRPulseHeight::raw, PlexStripEndId::SetEnd(), NtpSRPulseHeight::sigcor, NtpSRPulseHeight::siglin, NtpSRStrip::strip, NtpSRStrip::time0, and NtpSRStrip::time1.

Referenced by 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.

References fNDigits.

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

00051 { return fNDigits; };

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

Definition at line 37 of file TridModel.h.

References fSlice.

Referenced by Print().

00037 { return fSlice; };

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

Definition at line 48 of file TridModel.h.

References fLatestTime.

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

00049   { return fLatestTime[t]; }

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

Definition at line 54 of file TridModel.h.

References GetDigits().

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.

References fSlice.

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

00036 { return fSlice; };

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

Definition at line 53 of file TridModel.h.

References fStripEnds.

00053 { return fStripEnds.size(); };

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

Definition at line 52 of file TridModel.h.

References fNStrips.

Referenced by Print().

00052 { return fNStrips; };

virtual Double_t TridModel::GetTotalCharge ( CalStripType::CalStripType_t  t = CalStripType::kPE  )  const [inline, virtual]
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 184 of file TridModel.cxx.

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

Referenced by TridControl::IsPicked().

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

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

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

Definition at line 155 of file TridModel.cxx.

References Form(), GetDigits(), GetEarliestTime(), GetEvent(), GetLatestTime(), GetMeanTime(), GetSlice(), GetStrips(), GetTotalCharge(), CalStripType::kGeV, CalStripType::kMIP, CalTimeType::kNone, CalStripType::kNone, CalStripType::kPE, CalStripType::kSigCorr, CalStripType::kSigLin, CalStripType::kSigMapped, CalTimeType::kT0, and Munits::ns.

Referenced by TridUVPage::ModifySketches(), TridPage::MouseOver(), TridModelRecoStrip::Print(), and PrintToDigitText().

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

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

Definition at line 142 of file TridModel.cxx.

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

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

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

Member Data Documentation

Definition at line 80 of file TridModel.h.

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

std::vector<Double_t> TridModel::fEarliestTime

Definition at line 91 of file TridModel.h.

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

Definition at line 85 of file TridModel.h.

Int_t TridModel::fId [private]

Definition at line 65 of file TridModel.h.

Referenced by GetId().

std::vector<Double_t> TridModel::fLatestTime

Definition at line 92 of file TridModel.h.

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

UInt_t TridModel::fNComps [private]

Definition at line 81 of file TridModel.h.

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

Definition at line 86 of file TridModel.h.

Referenced by AddDigit(), and GetDigits().

UInt_t TridModel::fNStripEnds [private]

Definition at line 71 of file TridModel.h.

Referenced by AddDigit(), and AddFromModel().

Definition at line 87 of file TridModel.h.

Referenced by AddStrip(), and GetStrips().

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

Definition at line 66 of file TridModel.h.

Definition at line 84 of file TridModel.h.

Referenced by TridModelMaker::CreateSliceModels(), GetEvent(), and GetSlice().

Int_t TridModel::fSortKey [private]

Definition at line 64 of file TridModel.h.

Referenced by GetSortKey(), and SetSortKey().

Definition at line 70 of file TridModel.h.

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

Definition at line 90 of file TridModel.h.

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

std::vector<Double_t> TridModel::fTotalCharge
std::vector<Double_t> TridModel::fTotalTime

Definition at line 89 of file TridModel.h.

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


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1