UberModuleLite Class Reference

#include <UberModuleLite.h>

Inheritance diagram for UberModuleLite:
JobCModule

List of all members.

Public Member Functions

 UberModuleLite ()
 ~UberModuleLite ()
virtual JobCResult Get (MomNavigator *mom)
virtual JobCResult Reco (MomNavigator *mom)

Private Member Functions

void FillNtpShower (UberRecordLite *ntprec)
void FillNtpTrack (UberRecordLite *ntprec)
void FillNtpEvent (UberRecordLite *ntprec)
void FillNtpCalDetPID (UberRecordLite *ntprec)
void FillNtpTrackLinearFit (NtpSRTrack *ntptrack, const CandTrackHandle *track)
void FillNtpTrackVertex (NtpSRTrack *ntptrack, const CandTrackHandle *track)
void FillNtpTrackEnd (NtpSRTrack *ntptrack, const CandTrackHandle *track)
void FillNtpTrackMomentum (NtpSRTrack *ntptrack, const CandTrackHandle *track)
void FillNtpTrackFit (NtpSRTrack *ntptrack, const CandTrackHandle *track)
void FillNtpTrackTime (NtpSRTrack *ntptrack, const CandTrackHandle *track)
void FillNtpFiducial (NtpSRFiducial &fid, const NtpSRVertex &vtx, const VldContext &vld)
void FillNtpTrackFidVtx (NtpSRTrack *ntptrack, const CandTrackHandle *track, const VldContext &vld)
void FillNtpTrackFidEnd (NtpSRTrack *ntptrack, const CandTrackHandle *track, const VldContext &vld)
void FillNtpTrackFidAll (NtpSRTrack *ntptrack, const CandTrackHandle *track, const VldContext &vld)

Static Private Member Functions

static Int_t MakePlaneStripIndex (Int_t plane, Int_t strip)

Private Attributes

Bool_t fIsMC
Bool_t fFirstEvent
Bool_t fMCDecision
Int_t fRunNumber
time_t fStarttime
CandRecordcandrec
CandDigitListHandlefCDLH
CandCalDetSIHandlefCDSI
std::map< int, int > fStripUidMap
std::map< int, int > fShowerUidMap
std::map< int, int > fTrackUidMap
std::map< int, int > fEventUidMap

Detailed Description

Definition at line 20 of file UberModuleLite.h.


Constructor & Destructor Documentation

UberModuleLite::UberModuleLite (  ) 

Definition at line 90 of file UberModuleLite.cxx.

References Msg::kDebug, and MSG.

00090                               :
00091   fIsMC(kFALSE),
00092   fFirstEvent(kTRUE),
00093   fMCDecision(kFALSE),
00094   fRunNumber(0),
00095   fStarttime(0),
00096   candrec(0),
00097   fCDLH(0),
00098   fCDSI(0),
00099   fStripUidMap(),
00100   fShowerUidMap(),
00101   fTrackUidMap(),
00102   fEventUidMap()
00103 {
00104 
00105 
00106   MSG("UberModuleLite",Msg::kDebug)<<"In UberModuleLite creator"<<endl;
00107 
00108 }//end UberModuleLite()
//________________________________________________________________________________

UberModuleLite::~UberModuleLite (  ) 

Definition at line 111 of file UberModuleLite.cxx.

References Msg::kDebug, and MSG.

00112 {
00113   MSG("UberModuleLite",Msg::kDebug)<<"In ~UberModuleLite"<<endl;
00114 }//end ~UberModuleLite()


Member Function Documentation

void UberModuleLite::FillNtpCalDetPID ( UberRecordLite ntprec  )  [private]

Definition at line 813 of file UberModuleLite.cxx.

References candrec, UberRecordLite::cpid, CandCalDetPIDHandle::GetOLChi2(), CandCalDetPIDHandle::GetPIDType(), CandCalDetPIDHandle::InCERTime(), NtpCalDetPID::inct, Msg::kVerbose, MSG, CandCalDetPIDHandle::NoOverlap(), NtpCalDetPID::nov, NtpCalDetPID::olchi2, and NtpCalDetPID::pid.

Referenced by Reco().

00814 {
00815      MSG("UberModuleLite",Msg::kVerbose) 
00816           << "UberModuleLiteModule::FillNtpCalDetPID" << endl;
00817 
00818      const CandCalDetPIDHandle* pidh 
00819           = dynamic_cast <const CandCalDetPIDHandle*> 
00820           (candrec -> FindCandHandle("CandCalDetPIDHandle"));
00821      if ( !pidh ) return; // all done
00822      
00823      if(pidh->NoOverlap()) ntprec->cpid.nov=1;
00824      else ntprec->cpid.nov=0;
00825 
00826      if(pidh->InCERTime()) ntprec->cpid.inct=1;
00827      else ntprec->cpid.inct=0;
00828      
00829      ntprec->cpid.pid=pidh->GetPIDType();
00830      ntprec->cpid.olchi2=pidh->GetOLChi2();
00831 
00832      return;
00833 }

void UberModuleLite::FillNtpEvent ( UberRecordLite ntprec  )  [private]

Definition at line 1063 of file UberModuleLite.cxx.

References NtpSREvent::AddStripAt(), NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, candrec, NtpSRPlane::end, NtpSRPlane::endu, NtpSRPlane::endv, UberRecordLite::evt, fEventUidMap, fShowerUidMap, fStripUidMap, fTrackUidMap, CandHandle::GetDaughterIterator(), CandHandle::GetUidInt(), NtpSRStripPulseHeight::gev, NtpSREvent::index, CalStripType::kGeV, CalStripType::kMIP, CalStripType::kNone, CalStripType::kPE, CalStripType::kSigCorr, CalStripType::kSigLin, PlaneView::kU, PlaneView::kV, Msg::kVerbose, NtpSRStripPulseHeight::mip, MSG, NtpSRPlane::n, NtpSREvent::ndigit, NtpSRPlane::nu, NtpSRPlane::nv, NtpSRPulseHeight::pe, NtpSREvent::ph, NtpSREvent::plane, NtpSRPulseHeight::raw, NtpSRPulseHeight::sigcor, and NtpSRPulseHeight::siglin.

Referenced by Reco().

01064 {
01065   //
01066   //  Purpose:  Private method used to fill event portion of ntuple record.
01067   //
01068   //  Arguments: pointers to UberModuleLiteRecord and CandRecord
01069   //  
01070   //  Return: status.
01071   // 
01072 
01073   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLite::FillNtpEvent" << endl;
01074 
01075   const CandEventListHandle *eventlisthandle 
01076    = dynamic_cast <const CandEventListHandle*> 
01077      (candrec -> FindCandHandle("CandEventListHandle"));
01078   if ( !eventlisthandle ) return; // all done
01079 
01080   Int_t nevent = 0;
01081   TIter eventItr(eventlisthandle->GetDaughterIterator());
01082   TClonesArray& eventarray = *(ntprec->evt);
01083   while (CandEventHandle* event=dynamic_cast<CandEventHandle*>
01084                                                       (eventItr())) {
01085     Int_t uid = event->GetUidInt();
01086     fEventUidMap.insert(std::make_pair(uid,nevent));
01087     // Uses new with placement to efficiently create event ntp
01088     NtpSREvent* ntpevent 
01089     = new(eventarray[nevent++])NtpSREvent(event->GetNStrip(),
01090                       event->GetLastShower()+1,event->GetLastTrack()+1);
01091     ntpevent->index = nevent-1;
01092     ntpevent->ndigit = event->GetNDigit();
01093 
01094     TIter eventstripItr(event->GetDaughterIterator());
01095     Int_t neventstrip = 0;
01096     // Fill indices of associated strips,showers,tracks in event ntuple
01097     while ( CandStripHandle *eventstrip = dynamic_cast<CandStripHandle*>
01098                                                       (eventstripItr())) {
01099       Int_t stripindex = fStripUidMap[eventstrip->GetUidInt()];
01100       ntpevent->AddStripAt(stripindex,neventstrip); // add index to event
01101       neventstrip++;
01102     }
01103     for (Int_t i = 0; i <= event->GetLastTrack(); i++ ) {
01104       const CandTrackHandle* track = event->GetTrack(i);
01105       Int_t trackindex = fTrackUidMap[track->GetUidInt()];
01106       ntpevent -> AddTrackAt(trackindex,i);
01107     }
01108     for (Int_t i = 0; i <= event->GetLastShower(); i++ ) {
01109       const CandShowerHandle* shower = event->GetShower(i);
01110       Int_t showerindex = fShowerUidMap[shower->GetUidInt()];
01111       ntpevent -> AddShowerAt(showerindex,i);
01112     }
01113 
01114     // Set range of planes included in event
01115     ntpevent->plane.n = event->GetNPlane();
01116     ntpevent->plane.nu = event->GetNPlane(PlaneView::kU);
01117     ntpevent->plane.nv = event->GetNPlane(PlaneView::kV);
01118     ntpevent->plane.beg = event->GetBegPlane();
01119     ntpevent->plane.begu = event->GetBegPlane(PlaneView::kU);
01120     ntpevent->plane.begv = event->GetBegPlane(PlaneView::kV);
01121     ntpevent->plane.end = event->GetEndPlane();
01122     ntpevent->plane.endu = event->GetEndPlane(PlaneView::kU);
01123     ntpevent->plane.endv = event->GetEndPlane(PlaneView::kV);
01124     // Set summed charge in event
01125     ntpevent->ph.raw = event->GetCharge(CalStripType::kNone);
01126     ntpevent->ph.siglin = event->GetCharge(CalStripType::kSigLin);
01127     ntpevent->ph.sigcor = event->GetCharge(CalStripType::kSigCorr);
01128     ntpevent->ph.pe = event->GetCharge(CalStripType::kPE);
01129     ntpevent->ph.mip = event->GetCharge(CalStripType::kMIP);
01130     ntpevent->ph.gev = event->GetCharge(CalStripType::kGeV);
01131   }
01132 
01133   return;
01134 }//end FillNtpEvent()

void UberModuleLite::FillNtpFiducial ( NtpSRFiducial fid,
const NtpSRVertex vtx,
const VldContext vld 
) [private]

Definition at line 1632 of file UberModuleLite.cxx.

References NtpSRFiducial::dr, NtpSRFiducial::dz, VldContext::GetDetector(), UgliGeomHandle::GetZExtent(), Detector::kCalDet, Detector::kFar, Msg::kVerbose, Msg::kWarning, min, MSG, NtpSRVertex::u, NtpSRVertex::v, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillNtpTrackFidAll(), FillNtpTrackFidEnd(), and FillNtpTrackFidVtx().

01633                                                          {
01634   //
01635   //  Purpose:  Private method used to fill NtpSRFiducial given a point
01636   //            defined by NtpSRVertex and the detector type.
01637   //
01638   //  Return: none.
01639   //  
01640 
01641 
01642   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLite::FillNtpFiducial" << endl;
01643 
01644   UgliGeomHandle ugh(vld);
01645   Float_t zextent[2];
01646   ugh.GetZExtent(zextent[0],zextent[1]); // apparently this doesn't work yet?
01647   Detector::Detector_t dtype = vld.GetDetector();
01648 
01649   Float_t du,dv,dx,dy;
01650 
01651   switch (dtype) {
01652 
01653   case Detector::kFar:
01654     du = min(4.-vtx.u,4.+vtx.u);
01655     dv = min(4.-vtx.v,4.+vtx.v);
01656     dx = min(4.-vtx.x,4.+vtx.x);
01657     dy = min(4.-vtx.y,4.+vtx.y);
01658     fid.dr = min(min(du,dv),min(dx,dy));
01659     if ( fid.dr < 0. ) fid.dr = 0;
01660     fid.dz = min(vtx.z-zextent[0],zextent[1]-vtx.z);
01661     
01662     break;
01663 
01664   case Detector::kCalDet:
01665     fid.dr = min(min(0.5+vtx.x,0.5-vtx.x),min(0.5+vtx.y,0.5-vtx.y));
01666     if ( fid.dr < 0. ) fid.dr = 0;
01667     fid.dz = min(vtx.z-zextent[0],zextent[1]-vtx.z);
01668 
01669     break;
01670 
01671   default:
01672     MSG("EventSR",Msg::kWarning) << "Detector type " << dtype
01673                                  << " not supported." << endl;
01674     break;
01675   }
01676 
01677   return;
01678 
01679 }

void UberModuleLite::FillNtpShower ( UberRecordLite ntprec  )  [private]

Definition at line 835 of file UberModuleLite.cxx.

References NtpSRShower::AddStripAt(), NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, candrec, NtpSRPlane::end, NtpSRPlane::endu, NtpSRPlane::endv, fShowerUidMap, fStripUidMap, CandHandle::GetDaughterIterator(), CandStripHandle::GetPlane(), CandStripHandle::GetStrip(), NtpSRStripPulseHeight::gev, NtpSRShower::index, CalStripType::kGeV, CalStripType::kMIP, CalStripType::kNone, CalStripType::kPE, CalStripType::kSigCorr, CalStripType::kSigLin, PlaneView::kU, PlaneView::kV, Msg::kVerbose, MakePlaneStripIndex(), NtpSRStripPulseHeight::mip, MSG, NtpSRPlane::n, NtpSRShower::ndigit, NtpSRPlane::nu, NtpSRPlane::nv, NtpSRPulseHeight::pe, NtpSRShower::ph, NtpSRShower::plane, NtpSRPulseHeight::raw, UberRecordLite::shw, NtpSRPulseHeight::sigcor, and NtpSRPulseHeight::siglin.

Referenced by Reco().

00836 {
00837   //
00838   //  Purpose:  Private method used to fill shower portion of ntuple record.
00839   //
00840   //  Arguments: pointers to UberModuleLiteRecord and CandRecord
00841   //  
00842   //  Return: status.
00843   // 
00844 
00845   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLiteModule::FillNtpShower" << endl;
00846 
00847   const CandShowerListHandle *showerlisthandle 
00848    = dynamic_cast <const CandShowerListHandle*> 
00849      (candrec -> FindCandHandle("CandShowerListHandle"));
00850   if ( !showerlisthandle ) return; // all done
00851 
00852   Int_t nshower = 0;
00853   TIter showerItr(showerlisthandle->GetDaughterIterator());
00854   TClonesArray& showerarray = *(ntprec->shw);
00855   while (CandShowerHandle* shower=dynamic_cast<CandShowerHandle*>
00856                                                       (showerItr())) {
00857     Int_t uid = shower->GetUidInt();
00858     fShowerUidMap.insert(std::make_pair(uid,nshower));
00859     // Uses new with placement to efficiently create slice ntp
00860     NtpSRShower* ntpshower 
00861          = new(showerarray[nshower++])NtpSRShower(shower->GetNStrip());
00862     // Fill indices of associated strips in shower tree
00863     ntpshower->index = nshower - 1;
00864     ntpshower->ndigit = shower->GetNDigit();
00865     TIter showerstripItr(shower->GetDaughterIterator());
00866     Int_t nshowerstrip = 0;
00867 //    while ( CandShowerHandle *showerstrip = dynamic_cast<CandShowerHandle*>
00868     //                                                (showerstripItr()) ) {
00869     while (TObject* obj = showerstripItr()) {
00870        CandStripHandle* showerstrip = dynamic_cast<CandStripHandle*>(obj);
00871        if(showerstrip){
00872           Int_t plane = showerstrip->GetPlane();
00873           Int_t strip = showerstrip->GetStrip();
00874 //        Int_t uid = showerstrip->GetUidInt();
00875           Int_t uid = MakePlaneStripIndex(plane,strip);
00876           Int_t stripindex = fStripUidMap[uid]; // should use find
00877           ntpshower->AddStripAt(stripindex,nshowerstrip); // add index to strip
00878           nshowerstrip++;
00879        }
00880     }
00881 
00882     // Set range of planes included in slice
00883     ntpshower->plane.n = shower->GetNPlane();
00884     ntpshower->plane.nu = shower->GetNPlane(PlaneView::kU);
00885     ntpshower->plane.nv = shower->GetNPlane(PlaneView::kV);
00886     ntpshower->plane.beg = shower->GetBegPlane();
00887     ntpshower->plane.begu = shower->GetBegPlane(PlaneView::kU);
00888     ntpshower->plane.begv = shower->GetBegPlane(PlaneView::kV);
00889     ntpshower->plane.end = shower->GetEndPlane();
00890     ntpshower->plane.endu = shower->GetEndPlane(PlaneView::kU);
00891     ntpshower->plane.endv = shower->GetEndPlane(PlaneView::kV);
00892     // Set summed charge in shower
00893     ntpshower->ph.raw = shower->GetCharge(CalStripType::kNone);
00894     ntpshower->ph.siglin = shower->GetCharge(CalStripType::kSigLin);
00895     ntpshower->ph.sigcor = shower->GetCharge(CalStripType::kSigCorr);
00896     ntpshower->ph.pe = shower->GetCharge(CalStripType::kPE);
00897     ntpshower->ph.mip = shower->GetCharge(CalStripType::kMIP);
00898     ntpshower->ph.gev = shower->GetCharge(CalStripType::kGeV);
00899 
00900   }
00901 
00902   return;
00903 }//end FillNtpShower(UberRecordLite, candrec)

void UberModuleLite::FillNtpTrack ( UberRecordLite ntprec  )  [private]

Definition at line 907 of file UberModuleLite.cxx.

References NtpSRTrack::AddStripAt(), NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, candrec, NtpSRTrack::cputime, Calibrator::DecalStripToStrip(), Calibrator::DecalTime(), NtpSRTrack::ds, NtpSRPlane::end, NtpSRPlane::endu, NtpSRPlane::endv, FillNtpTrackEnd(), FillNtpTrackFidAll(), FillNtpTrackFidEnd(), FillNtpTrackFidVtx(), FillNtpTrackFit(), FillNtpTrackLinearFit(), FillNtpTrackMomentum(), FillNtpTrackTime(), FillNtpTrackVertex(), CandRecord::FindCandHandle(), fStripUidMap, fTrackUidMap, CandFitTrackSRHandle::GetBadFit(), CandStripHandle::GetCharge(), CandTrackSRListHandle::GetCPUTime(), CandHandle::GetDaughterIterator(), CandStripHandle::GetNDigit(), CandTrackHandle::GetNTrackPlane(), CandTrackSRHandle::GetNTrackPlane(), CandStripHandle::GetPlane(), CandFitTrackHandle::GetPlaneChi2(), CandFitTrackSRHandle::GetPlanePreChi2(), CandFitTrackHandle::GetPlaneQP(), CandStripHandle::GetStrip(), CandStripHandle::GetStripEndId(), CandHandle::GetUidInt(), RecMinos::GetVldContext(), NtpSRStripPulseHeight::gev, NtpSRTrack::index, Calibrator::Instance(), CalStripType::kGeV, CalStripType::kMIP, StripEnd::kNegative, CalStripType::kNone, CalDigitType::kNone, CalStripType::kPE, StripEnd::kPositive, CalStripType::kSigCorr, CalStripType::kSigLin, CalStripType::kSigMapped, PlaneView::kU, PlaneView::kV, Msg::kVerbose, MakePlaneStripIndex(), NtpSRStripPulseHeight::mip, MSG, NtpSRPlane::n, NtpSRTrackPlane::ntrklike, NtpSRPlane::nu, NtpSRPlane::nv, NtpSRPulseHeight::pe, NtpSRTrack::ph, NtpSRTrack::plane, NtpSRTrack::range, NtpSRPulseHeight::raw, NtpSRTrack::SetAttnC0(), NtpSRTrack::SetCalT0(), NtpSRTrack::SetPh(), NtpSRTrack::SetTime(), NtpSRPulseHeight::sigcor, NtpSRPulseHeight::siglin, NtpSRTrack::stpds, NtpSRTrack::stpfit, NtpSRTrack::stpfitchi2, NtpSRTrack::stpfitprechi2, NtpSRTrack::stpfitqp, NtpSRTrack::stpu, NtpSRTrack::stpv, NtpSRTrack::stpx, NtpSRTrack::stpy, NtpSRTrack::stpz, and UberRecordLite::trk.

Referenced by Reco().

00908 {
00909   //
00910   //  Purpose:  Private method used to fill track portion of ntuple record.
00911   //
00912   //  Arguments: pointers to UberModuleLiteRecord and CandRecord
00913   //  
00914   //  Return: status.
00915   // 
00916 
00917 
00918   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLite::FillNtpTrack" << endl;
00919 
00920   const Double_t cos45 = 0.70710678;  // used for converting from u,v to x,y
00921 
00922   const CandTrackListHandle *tracklisthandle 
00923      = dynamic_cast <const CandTrackListHandle*> 
00924      (candrec -> FindCandHandle("CandFitTrackListHandle"));
00925   if ( !tracklisthandle ) {
00926     tracklisthandle = dynamic_cast <const CandTrackListHandle*>
00927       (candrec -> FindCandHandle("CandTrackListHandle"));
00928   }
00929   if ( !tracklisthandle ) return;
00930 
00931   CandTrackSRListHandle* tracksrlisthandle=dynamic_cast<CandTrackSRListHandle*>
00932                       (candrec->FindCandHandle("CandTrackSRListHandle"));
00933 
00934   const VldContext& vld = *(candrec->GetVldContext());
00935 
00936   TIter trackItr(tracklisthandle->GetDaughterIterator());
00937   TClonesArray& trackarray = *(ntprec->trk);
00938   Int_t ntrack = 0;
00939   while (CandTrackHandle* track = dynamic_cast<CandTrackHandle*>(trackItr())){
00940     Int_t uid = track->GetUidInt();
00941     fTrackUidMap.insert(std::make_pair(uid,ntrack));
00942     // Uses new with placement to efficiently create event ntp
00943     NtpSRTrack* ntptrack 
00944              = new(trackarray[ntrack++])NtpSRTrack(track->GetNStrip());
00945 
00946     ntptrack->index = ntrack-1;
00947 
00948     CandTrackSRHandle *tracksr = dynamic_cast<CandTrackSRHandle*>(track);
00949     //CandFitTrackHandle *fittrack = dynamic_cast<CandFitTrackHandle*>(track);
00950     CandFitTrackSRHandle *fittracksr
00951                                 =dynamic_cast<CandFitTrackSRHandle*>(track);
00952 
00953     // Set range of planes included in track
00954     NtpSRTrackPlane& plane = ntptrack->plane;
00955     plane.n = track->GetNPlane();
00956     plane.nu = track->GetNPlane(PlaneView::kU);
00957     plane.nv = track->GetNPlane(PlaneView::kV);
00958     plane.beg = track->GetBegPlane();
00959     plane.begu = track->GetBegPlane(PlaneView::kU);
00960     plane.begv = track->GetBegPlane(PlaneView::kV);
00961     plane.end = track->GetEndPlane();
00962     plane.endu = track->GetEndPlane(PlaneView::kU);
00963     plane.endv = track->GetEndPlane(PlaneView::kV);
00964     if (tracksr) plane.ntrklike = tracksr->GetNTrackPlane();
00965     if (fittracksr) plane.ntrklike = fittracksr->GetNTrackPlane();
00966 
00967     // Set summed pulse height information for track
00968     NtpSRStripPulseHeight& ph = ntptrack->ph;
00969     ph.raw = track->GetCharge(CalStripType::kNone);
00970     ph.siglin = track->GetCharge(CalStripType::kSigLin);
00971     ph.sigcor = track->GetCharge(CalStripType::kSigCorr);
00972     ph.pe = track->GetCharge(CalStripType::kPE);
00973     ph.mip = track->GetCharge(CalStripType::kMIP);
00974     ph.gev = track->GetCharge(CalStripType::kGeV);
00975     
00976     ntptrack->ds = track->GetdS(); // distance from vertex to end
00977     ntptrack->range = track->GetRange(); // g/cm**2 from vertex to end
00978     // CPU to create track list
00979     if (tracksrlisthandle) ntptrack->cputime = tracksrlisthandle->GetCPUTime();
00980 
00981     this->FillNtpTrackVertex(ntptrack,track);
00982     this->FillNtpTrackEnd(ntptrack,track);
00983     this->FillNtpTrackLinearFit(ntptrack,track);
00984 
00985     this->FillNtpTrackFidVtx(ntptrack,track,vld);
00986     this->FillNtpTrackFidEnd(ntptrack,track,vld);
00987     this->FillNtpTrackFidAll(ntptrack,track,vld);
00988 
00989     this->FillNtpTrackMomentum(ntptrack,track);
00990     this->FillNtpTrackFit(ntptrack,track);
00991     this->FillNtpTrackTime(ntptrack,track);
00992 
00993     // Loop over strips associated with track
00994     TIter trackstripItr(track->GetDaughterIterator());
00995     Int_t ntrackstrip = 0;
00996     // Fill indices of associated strips in track ntuple
00997 //    while ( CandStripHandle *trackstrip = dynamic_cast<CandStripHandle*>
00998     //                                              (trackstripItr())) {
00999     while (TObject* obj = (trackstripItr())) {
01000        CandStripHandle* trackstrip = dynamic_cast<CandStripHandle*>(obj);
01001        if(trackstrip){
01002           Int_t plane = trackstrip->GetPlane();
01003           Int_t strip = trackstrip->GetStrip();
01004           Int_t uid = MakePlaneStripIndex(plane,strip);
01005           Int_t stripindex = fStripUidMap[uid];
01006           ntptrack->AddStripAt(stripindex,ntrackstrip); // add index to track
01007           // Track positional information at plane associated with each strip
01008           Int_t iplane = trackstrip->GetPlane();
01009           ntptrack->stpu[ntrackstrip] = track->GetU(iplane);
01010           ntptrack->stpv[ntrackstrip] = track->GetV(iplane);
01011           ntptrack->stpx[ntrackstrip] = cos45*(ntptrack->stpu[ntrackstrip]
01012                                                -ntptrack->stpv[ntrackstrip]);
01013           ntptrack->stpy[ntrackstrip] = cos45*(ntptrack->stpu[ntrackstrip]
01014                                                +ntptrack->stpv[ntrackstrip]);
01015           ntptrack->stpz[ntrackstrip] = track->GetZ(iplane);
01016           // dS is travel distance from vertex
01017           ntptrack->stpds[ntrackstrip] = track->GetdS(iplane);
01018           
01019           // Fit track dependent quantities
01020           if ( fittracksr ) {
01021              ntptrack->stpfitchi2[ntrackstrip] = fittracksr->GetPlaneChi2(iplane);
01022              ntptrack->stpfitprechi2[ntrackstrip] 
01023                 = fittracksr->GetPlanePreChi2(iplane);
01024              ntptrack->stpfitqp[ntrackstrip] = fittracksr->GetPlaneQP(iplane);
01025              if ( fittracksr->GetBadFit(iplane) ) ntptrack->stpfit[ntrackstrip] = 0;
01026           }
01027 
01028           // Strip end dependent quantities
01029           for (UInt_t i = 0; i < 2; i++ ) {
01030              StripEnd::EStripEnd stripend = StripEnd::kNegative;
01031              if (i == 1) stripend = StripEnd::kPositive;
01032              if ( trackstrip->GetNDigit(stripend) > 0 ) {
01033                 Float_t sigmap = track->GetStripCharge(trackstrip,
01034                                                        CalStripType::kSigMapped,stripend);
01035                 Float_t mip = track->GetStripCharge(trackstrip,
01036                                                     CalStripType::kMIP,stripend);
01037                 Float_t gev = track->GetStripCharge(trackstrip,
01038                                                     CalStripType::kGeV,stripend);
01039                 ntptrack->SetPh(sigmap,mip,gev,ntrackstrip,i); 
01040                 ntptrack->SetTime(track->GetT(iplane,stripend),ntrackstrip,i);
01041              }
01042              // NJT 07/04
01043              // Use the new Calibrator to dig out the values of interest.
01044              float c0 = Calibrator::Instance().DecalStripToStrip(1.0,trackstrip->GetStripEndId(stripend));
01045              ntptrack->SetAttnC0( c0 ,ntrackstrip,i);
01046 
01047              float t0 = Calibrator::Instance().DecalTime(0.0,trackstrip->GetCharge(CalDigitType::kNone,stripend),trackstrip->GetStripEndId(stripend));
01048              ntptrack->SetCalT0(t0,ntrackstrip,i);
01049 
01050           }
01051           ntrackstrip++;
01052        }
01053     }
01054         
01055   }
01056 
01057   return;
01058 
01059 }//end FillNtpTrack()

void UberModuleLite::FillNtpTrackEnd ( NtpSRTrack ntptrack,
const CandTrackHandle track 
) [private]

Definition at line 1490 of file UberModuleLite.cxx.

References NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, NtpSRVertex::edcosu, NtpSRVertex::edcosv, NtpSRVertex::edcosx, NtpSRVertex::edcosy, NtpSRVertex::edcosz, NtpSRTrack::end, NtpSRVertex::eu, NtpSRVertex::ev, NtpSRVertex::ex, NtpSRVertex::ey, CandRecoHandle::GetEndDirCosU(), CandRecoHandle::GetEndDirCosV(), CandRecoHandle::GetEndDirCosZ(), CandFitTrackHandle::GetEnddUError(), CandFitTrackHandle::GetEnddVError(), CandRecoHandle::GetEndPlane(), CandRecoHandle::GetEndT(), CandRecoHandle::GetEndU(), CandFitTrackHandle::GetEndUError(), CandRecoHandle::GetEndV(), CandFitTrackHandle::GetEndVError(), CandRecoHandle::GetEndZ(), Msg::kVerbose, MSG, NtpSRVertex::plane, NtpSRVertex::t, NtpSRVertex::u, NtpSRVertex::v, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillNtpTrack().

01491                                                                 {
01492   //
01493   //  Purpose:  Private method used to fill end portion of ntuple track.
01494   //
01495   //  Arguments: NtpSRTrack to fill and const CandTrackHandle pointer.
01496   //  
01497   //  Return: status.
01498   // 
01499 
01500 
01501   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLite::FillNtpTrackEnd" << endl;
01502 
01503   const Double_t cos45 = 0.70710678;  // used for converting from u,v to x,y
01504 
01505   NtpSRVertex& end = ntptrack->end;
01506   //  NtpSRFitVertex& end = ntptrack->end;
01507 
01508   end.u = track->GetEndU();
01509   end.v = track->GetEndV();
01510   end.x = cos45*(end.u-end.v);
01511   end.y = cos45*(end.u+end.v);
01512   end.z = track->GetEndZ();
01513   end.t = track->GetEndT();
01514   end.plane = track->GetEndPlane();
01515   end.dcosu = track->GetEndDirCosU();
01516   end.dcosv = track->GetEndDirCosV();
01517   end.dcosx = cos45*(end.dcosu-end.dcosv);
01518   end.dcosy = cos45*(end.dcosu+end.dcosv);
01519   end.dcosz = track->GetEndDirCosZ();
01520 
01521   const CandFitTrackSRHandle* fittracksr
01522                     =dynamic_cast<const CandFitTrackSRHandle*>(track);
01523   if ( fittracksr ) {
01524     end.eu = fittracksr->GetEndUError();
01525     end.ev = fittracksr->GetEndVError();
01526     end.ex = cos45*sqrt(end.eu*end.eu+end.ev*end.ev);
01527     end.ey = cos45*sqrt(end.eu*end.eu+end.ev*end.ev);
01528     Double_t edudz = fittracksr->GetEnddUError();
01529     Double_t edvdz = fittracksr->GetEnddVError();
01530     // These calculations should include the dudz and dvdz covariance terms
01531     // but currently the covariance terms are not accessible
01532     end.edcosz = fabs(end.dcosz)*sqrt(pow(end.dcosu*edudz,2)+
01533                                       pow(end.dcosv*edvdz,2));
01534     end.edcosu = sqrt(fabs(end.dcosz))*sqrt(pow(end.dcosu*end.dcosv*edvdz,2)
01535                + pow((pow(end.dcosz,2)+pow(end.dcosv,2))*edudz,2));
01536     end.edcosv = sqrt(fabs(end.dcosz))*sqrt(pow(end.dcosu*end.dcosv*edudz,2)
01537                + pow((pow(end.dcosz,2)+pow(end.dcosu,2))*edvdz,2));
01538     end.edcosx = cos45*sqrt(end.edcosu*end.edcosu+end.edcosv*end.edcosv);
01539     end.edcosy = cos45*sqrt(end.edcosu*end.edcosu+end.edcosv*end.edcosv);
01540   }
01541 
01542   return;
01543 
01544 }

void UberModuleLite::FillNtpTrackFidAll ( NtpSRTrack ntptrack,
const CandTrackHandle track,
const VldContext vld 
) [private]

Definition at line 1385 of file UberModuleLite.cxx.

References NtpSRFiducial::dr, NtpSRFiducial::dz, NtpSRTrack::fidall, NtpSRTrack::fidend, NtpSRTrack::fidvtx, FillNtpFiducial(), CandHandle::GetDaughterIterator(), CandTrackHandle::GetU(), CandTrackHandle::GetV(), Msg::kVerbose, min, MSG, NtpSRFiducial::nplane, NtpSRVertex::plane, NtpSRFiducial::trace, NtpSRFiducial::tracez, NtpSRVertex::u, NtpSRVertex::v, NtpSRVertex::x, and NtpSRVertex::y.

Referenced by FillNtpTrack().

01387                                                             {
01388   //
01389   //  Purpose:  Private method used to fill NtpSRTrack fidall data member
01390   //            given a pointer to the ntuple track, a pointer to the
01391   //            associated CandTrackHandle, and the vldcontext of the
01392   //            event.
01393   //
01394   //  Return: none.
01395   //
01396   //  Notes: This method should be called after FillNtpTrackFidAll
01397   //         and FillNtpFiducialEnd 
01398 
01399 
01400   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLite::FillNtpFiducialAll" << endl;
01401   const Double_t cos45 = 0.70710678;  // used for converting from u,v to x,y
01402 
01403   NtpSRFiducial& fidall = ntptrack->fidall;
01404 
01405   NtpSRFiducial fidtmp;
01406   NtpSRVertex vtxtmp;
01407   fidall.dr = min(ntptrack->fidvtx.dr,ntptrack->fidend.dr);
01408   fidall.dz = min(ntptrack->fidvtx.dz,ntptrack->fidend.dz);
01409   fidall.trace   = min(ntptrack->fidvtx.trace,ntptrack->fidend.trace);
01410   fidall.tracez  = min(ntptrack->fidvtx.tracez,ntptrack->fidend.tracez);
01411   fidall.nplane  = min(ntptrack->fidvtx.nplane,ntptrack->fidend.nplane);
01412   //  fidall.nplaneu  = min(ntptrack->fidvtx.nplaneu,ntptrack->fidend.nplaneu);
01413   //  fidall.nplanev  = min(ntptrack->fidvtx.nplanev,ntptrack->fidend.nplanev);
01414 
01415   TIter trackstripItr(track->GetDaughterIterator());
01416   while(CandStripHandle* trackstrip = dynamic_cast<CandStripHandle*>
01417         (trackstripItr())) {
01418     // For all strips calculate closest approach to boundaries
01419     Int_t iplane = trackstrip->GetPlane();
01420     vtxtmp.plane = iplane;
01421     vtxtmp.u = track->GetU(iplane);
01422     vtxtmp.v = track->GetV(iplane);
01423     vtxtmp.x = cos45*(vtxtmp.u-vtxtmp.v);
01424     vtxtmp.y = cos45*(vtxtmp.u+vtxtmp.v);
01425     this->FillNtpFiducial(fidtmp,vtxtmp,vld); // fills dr,dz
01426     fidall.dr = min(fidtmp.dr,fidall.dr);
01427     fidall.dz = min(fidtmp.dz,fidall.dz);
01428   }
01429 
01430   return;
01431 
01432 }

void UberModuleLite::FillNtpTrackFidEnd ( NtpSRTrack ntptrack,
const CandTrackHandle track,
const VldContext vld 
) [private]

Definition at line 1350 of file UberModuleLite.cxx.

References NtpSRTrack::end, NtpSRTrack::fidend, FillNtpFiducial(), CandFitTrackSRHandle::GetEndExtrapolate(), CandTrackHandle::GetEndTrace(), CandTrackHandle::GetEndTraceZ(), Msg::kVerbose, MSG, NtpSRFiducial::nplane, NtpSRFiducial::trace, and NtpSRFiducial::tracez.

Referenced by FillNtpTrack().

01352                                                             {
01353   //
01354   //  Purpose:  Private method used to fill NtpSRTrack fidend data member
01355   //            given a pointer to the ntuple track, a pointer to the
01356   //            associated CandTrackHandle, and the vldcontext of the
01357   //            event.
01358   //
01359   //  Return: none.
01360   // 
01361 
01362 
01363   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLite::FillNtpTrackFidEnd" << endl;
01364 
01365   NtpSRFiducial& fid = ntptrack->fidend;
01366   NtpSRVertex& end = ntptrack->end;
01367   //NtpSRFitVertex& end = ntptrack->end;
01368   this->FillNtpFiducial(fid,end,vld); // fills dr,dz
01369 
01370   fid.trace   = track->GetEndTrace();
01371   fid.tracez  = track->GetEndTraceZ();
01372 
01373   const CandFitTrackSRHandle* fittracksr 
01374     = dynamic_cast<const CandFitTrackSRHandle*>(track);
01375   if ( fittracksr ) {                                     
01376     fid.nplane  = fittracksr->GetEndExtrapolate();
01377     //  fid.nplaneu = fittracksr->GetEndExtrapolate(PlaneView::kU);
01378     //  fid.nplanev = fittracksr->GetEndExtrapolate(PlaneView::kV);
01379   }  
01380 
01381   return;
01382 
01383 }

void UberModuleLite::FillNtpTrackFidVtx ( NtpSRTrack ntptrack,
const CandTrackHandle track,
const VldContext vld 
) [private]

Definition at line 1315 of file UberModuleLite.cxx.

References NtpSRTrack::fidvtx, FillNtpFiducial(), CandFitTrackSRHandle::GetVtxExtrapolate(), CandTrackHandle::GetVtxTrace(), CandTrackHandle::GetVtxTraceZ(), Msg::kVerbose, MSG, NtpSRFiducial::nplane, NtpSRFiducial::trace, NtpSRFiducial::tracez, and NtpSRTrack::vtx.

Referenced by FillNtpTrack().

01317                                                             {
01318   //
01319   //  Purpose:  Private method used to fill NtpSRTrack fidvtx data member
01320   //            given a pointer to the ntuple track, a pointer to the
01321   //            associated CandTrackHandle, and the vldcontext of the
01322   //            event.
01323   //
01324   //  Return: none.
01325   // 
01326 
01327 
01328   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLite::FillNtpTrackFidVtx" << endl;
01329 
01330   NtpSRFiducial& fid = ntptrack->fidvtx;
01331   NtpSRVertex& vtx = ntptrack->vtx;
01332   //NtpSRFitVertex& vtx = ntptrack->vtx;
01333   this->FillNtpFiducial(fid,vtx,vld); // fills dr,dz
01334 
01335   fid.trace   = track->GetVtxTrace();
01336   fid.tracez  = track->GetVtxTraceZ();
01337 
01338   const CandFitTrackSRHandle* fittracksr 
01339     = dynamic_cast<const CandFitTrackSRHandle*>(track);
01340   if ( fittracksr ) {                                     
01341     fid.nplane  = fittracksr->GetVtxExtrapolate();
01342     //   fid.nplaneu = fittracksr->GetVtxExtrapolate(PlaneView::kU);
01343     //  fid.nplanev = fittracksr->GetVtxExtrapolate(PlaneView::kV);
01344   }  
01345 
01346   return;
01347 
01348 }

void UberModuleLite::FillNtpTrackFit ( NtpSRTrack ntptrack,
const CandTrackHandle track 
) [private]

Definition at line 1280 of file UberModuleLite.cxx.

References NtpSRFitTrack::chi2, NtpSRFitTrack::cputime, NtpSRTrack::fit, CandFitTrackHandle::GetChi2(), CandFitTrackHandle::GetCPUTime(), CandFitTrackHandle::GetNDOF(), CandFitTrackHandle::GetNIterate(), CandFitTrackHandle::GetNSwimFail(), CandFitTrackHandle::GetPass(), Msg::kVerbose, MSG, NtpSRFitTrack::ndof, NtpSRFitTrack::niterate, NtpSRFitTrack::nswimfail, and NtpSRFitTrack::pass.

Referenced by FillNtpTrack().

01281                                                                 {
01282   //
01283   //  Purpose:  Private method used to fill NtpSRTrack fit data member
01284   //            given a pointer to the ntuple track and a pointer to the
01285   //            associated CandTrackHandle.
01286   //
01287   //  Return: none.
01288   // 
01289 
01290 
01291   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLite::FillNtpTrackFit" << endl;
01292 
01293   NtpSRFitTrack& fit = ntptrack->fit;
01294 
01295   const CandFitTrackHandle* fittrack 
01296     = dynamic_cast<const CandFitTrackHandle*>(track);
01297   if ( fittrack ) {
01298     fit.chi2 = fittrack->GetChi2();
01299     fit.pass = fittrack->GetPass();
01300   }
01301 
01302   const CandFitTrackSRHandle* fittracksr 
01303     = dynamic_cast<const CandFitTrackSRHandle*>(track);
01304   if ( fittracksr ) {
01305     fit.ndof      = fittracksr->GetNDOF();
01306     fit.niterate  = fittracksr->GetNIterate();
01307     fit.nswimfail = fittracksr->GetNSwimFail();
01308     fit.cputime   = fittracksr->GetCPUTime();
01309   }
01310 
01311   return;
01312 
01313 }

void UberModuleLite::FillNtpTrackLinearFit ( NtpSRTrack ntptrack,
const CandTrackHandle track 
) [private]

Definition at line 1546 of file UberModuleLite.cxx.

References NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, CandHandle::GetDaughterIterator(), CandRecoHandle::GetTimeSlope(), CandRecoHandle::GetVtxT(), CandRecoHandle::GetVtxZ(), StripEnd::kNegative, StripEnd::kPositive, PlaneView::kU, PlaneView::kV, Msg::kVerbose, NtpSRTrack::lin, MSG, NtpSRVertex::t, NtpSRVertex::u, NtpSRVertex::v, LinearFit::Weighted(), NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillNtpTrack().

01547                                                                       {
01548   //
01549   //  Purpose:  Private method used to fill linar fit track portion of 
01550   //            ntuple track.
01551   //
01552   //  Arguments: NtpSRTrack to fill and const CandTrackHandle pointer.
01553   //  
01554   //  Return: status.
01555   // 
01556 
01557 
01558   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLite::FillNtpFitTrack" << endl;
01559 
01560   const Double_t cos45 = 0.70710678;  // used for converting from u,v to x,y
01561 
01562   // First array dimension is view (u or v)
01563   // Second array dimension is plane number
01564   const Int_t nplane = 1000;
01565   const Int_t nview = 2; // u,v
01566   Double_t zfit[nview][nplane]={{0},{0}},fit[nview][nplane]={{0},{0}};
01567   Double_t wfit[nview][nplane]={{0},{0}},ph[nview][nplane]={{0},{0}};
01568 
01569   // Loop over all strips on track
01570   TIter trackstripItr(track->GetDaughterIterator());
01571   while(CandStripHandle* trackstrip = dynamic_cast<CandStripHandle*>
01572         (trackstripItr())) {
01573 
01574     Float_t tpos = trackstrip->GetTPos();
01575     Float_t phend[2]  = {trackstrip->GetCharge(StripEnd::kNegative),
01576                          trackstrip->GetCharge(StripEnd::kPositive)};
01577     Float_t phsum   = phend[0] + phend[1];
01578 
01579     Int_t iplane = trackstrip->GetPlane();
01580     assert(iplane >= 0 && iplane < 1000);
01581 
01582     Int_t iview = -1;
01583     if ( trackstrip->GetPlaneView()==PlaneView::kU ) iview = 0;
01584     else if ( trackstrip->GetPlaneView()==PlaneView::kV ) iview = 1;
01585     else continue;
01586 
01587     zfit[iview][iplane] = trackstrip->GetZPos();
01588     fit[iview][iplane] += tpos*phsum; // pulse height weighted average of tpos
01589     ph[iview][iplane]  += phsum;  // summed pulse height both ends 
01590     wfit[iview][iplane] = 1;   // weight assigned for use in fit
01591   }
01592 
01593   // Finished with loop over all strips, calculate fit results
01594   for ( Int_t ip = 0; ip < nplane; ip++ ) {
01595     for ( Int_t iv = 0; iv < nview; iv++ ) {
01596       if ( ph[iv][ip] > 0 ) fit[iv][ip] /= ph[iv][ip];
01597     }
01598   }
01599 
01600   Double_t uparm[2],ueparm[2],vparm[2],veparm[2];
01601   LinearFit::Weighted(1000,zfit[0],fit[0],wfit[0],uparm,ueparm);
01602   LinearFit::Weighted(1000,zfit[1],fit[1],wfit[1],vparm,veparm);
01603   NtpSRVertex& lin = ntptrack->lin;
01604 
01605   Double_t dudz = uparm[1];
01606   Double_t dvdz = vparm[1];
01607   Double_t dxdz = cos45*(uparm[1]-vparm[1]);
01608   Double_t dydz = cos45*(uparm[1]+vparm[1]);
01609   lin.z = track->GetVtxZ();
01610   lin.t = track->GetVtxT();
01611   lin.u = uparm[0]+lin.z*dudz;
01612   lin.v = vparm[0]+lin.z*dvdz;
01613   lin.x = cos45*(uparm[0]-vparm[0])+lin.z*dxdz;
01614   lin.y = cos45*(uparm[0]+vparm[0])+lin.z*dydz;
01615   Double_t anorm = sqrt(1.+dxdz*dxdz+dydz*dydz);
01616   Int_t sign = 1;
01617   if ( track->GetTimeSlope() < 0. ) sign = -1;
01618   lin.dcosu = sign*dudz/anorm;
01619   lin.dcosv = sign*dvdz/anorm;
01620   lin.dcosx = sign*dxdz/anorm;
01621   lin.dcosy = sign*dydz/anorm;
01622   lin.dcosz = sign*1./anorm;
01623 
01624   return;
01625 
01626 }

void UberModuleLite::FillNtpTrackMomentum ( NtpSRTrack ntptrack,
const CandTrackHandle track 
) [private]

Definition at line 1138 of file UberModuleLite.cxx.

References NtpSRMomentum::eqp, CandFitTrackHandle::GetEMCharge(), CandTrackHandle::GetMomentum(), CandFitTrackHandle::GetMomentumCurve(), CandFitTrackHandle::GetVtxQPError(), Msg::kVerbose, NtpSRTrack::momentum, MSG, NtpSRMomentum::qp, and NtpSRMomentum::range.

Referenced by FillNtpTrack().

01139                                                                      {
01140   //
01141   //  Purpose:  Private method used to fill NtpSRTrack momentum data member
01142   //            given a pointer to the ntuple track and a pointer to the
01143   //            associated CandTrackHandle.
01144   //
01145   //  Return: none.
01146   // 
01147 
01148 
01149   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLite::FillNtpTrackMomentum" << endl;
01150 
01151   NtpSRMomentum& momentum = ntptrack->momentum;
01152   momentum.range = track->GetMomentum();
01153 
01154   const CandFitTrackHandle* fittrack 
01155     = dynamic_cast<const CandFitTrackHandle*>(track);
01156   if ( fittrack ) {
01157       if(fittrack->GetMomentumCurve())
01158           momentum.qp = fittrack->GetEMCharge()/fittrack->GetMomentumCurve();
01159       else momentum.qp=0;
01160   }
01161 
01162   const CandFitTrackSRHandle* fittracksr 
01163     = dynamic_cast<const CandFitTrackSRHandle*>(track);
01164   if ( fittracksr ) {
01165     momentum.eqp = fittracksr->GetVtxQPError();
01166   }
01167 
01168   return;
01169 
01170 }

void UberModuleLite::FillNtpTrackTime ( NtpSRTrack ntptrack,
const CandTrackHandle track 
) [private]

Definition at line 1172 of file UberModuleLite.cxx.

References NtpSRTrackTime::cdtds, NtpSRTrackTime::chi2, NtpSRTrackTime::dtds, NtpSRTrackTime::du, NtpSRTrackTime::dv, OscFit::GetCharge(), CandHandle::GetDaughterIterator(), CandTrackHandle::GetNTimeFitDigit(), CandTrackSRHandle::GetNTimeFitDigit(), VHS::GetPlane(), CandTrackHandle::GetT(), CandTrackHandle::GetTimeFitChi2(), CandTrackSRHandle::GetTimeFitChi2(), CandRecoHandle::GetTimeOffset(), CandRecoHandle::GetTimeSlope(), StripEnd::kNegative, StripEnd::kPositive, PlaneView::kU, PlaneView::kV, Msg::kVerbose, MSG, NtpSRTrackTime::ndigit, NtpSRTrackTime::t0, NtpSRTrack::time, NtpSRTrackTime::u0, NtpSRTrackTime::u1, NtpSRTrackTime::v0, NtpSRTrackTime::v1, and PropagationVelocity::VelocityPosErr().

Referenced by FillNtpTrack().

01173                                                                  {
01174   //
01175   //  Purpose:  Private method used to fill NtpSRTrack time data member
01176   //            given a pointer to the ntuple track and a pointer to the
01177   //            associated CandTrackHandle.
01178   //
01179   //  Return: none.
01180   // 
01181 
01182 
01183   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLite::FillNtpTrackTime" << endl;
01184 
01185   NtpSRTrackTime& time = ntptrack->time;
01186 
01187   const CandTrackSRHandle* tracksr 
01188     = dynamic_cast<const CandTrackSRHandle*>(track);
01189   if ( tracksr ) {
01190     time.ndigit = tracksr->GetNTimeFitDigit();
01191     time.chi2   = tracksr->GetTimeFitChi2();
01192   }
01193 
01194   const CandFitTrackSRHandle* fittracksr 
01195     = dynamic_cast<const CandFitTrackSRHandle*>(track);
01196   if ( fittracksr ) {
01197     time.ndigit = fittracksr->GetNTimeFitDigit();
01198     time.chi2   = fittracksr->GetTimeFitChi2();
01199   }
01200 
01201   time.cdtds = fabs(track->GetTimeSlope())*3.e8;
01202   time.dtds = track->GetTimeSlope();
01203   time.t0   = track->GetTimeOffset();
01204   
01205   Double_t totuph[2] = {0}, totvph[2] = {0};
01206   Int_t    ndutimespace[1000] = {0}, ndvtimespace[1000] = {0};
01207   Double_t dutimespace[1000]  = {0}, dvtimespace[1000] = {0};
01208   
01209   TIter trackstripItr(track->GetDaughterIterator());
01210   while (CandStripHandle* trackstrip = dynamic_cast<CandStripHandle*>
01211                                                    (trackstripItr())) {
01212     Int_t iplane = trackstrip -> GetPlane();
01213     assert(iplane >= 0 && iplane < 1000);
01214     Float_t ph0 = trackstrip -> GetCharge(StripEnd::kNegative);
01215     Float_t ph1 = trackstrip -> GetCharge(StripEnd::kPositive);
01216     Float_t t0  = track->GetT(iplane,StripEnd::kNegative);
01217     Float_t t1  = track->GetT(iplane,StripEnd::kPositive);
01218 
01219     if ( trackstrip -> GetPlaneView() == PlaneView::kU ) {
01220       if ( trackstrip -> GetNDigit(StripEnd::kNegative) > 0 ) {
01221         totuph[0] += ph0;
01222         time.u0   += ph0*t0;
01223       }
01224       if ( trackstrip -> GetNDigit(StripEnd::kPositive) > 0 ) {
01225         totuph[1] += ph1;
01226         time.u1   += ph1*t1;
01227       }
01228       if ( t0 > 0 && t1 > 0 ) {
01229         Float_t dapos = .5*(t0-t1)*PropagationVelocity::VelocityPosErr();
01230         if (!ndutimespace[iplane] || fabs(dapos)<fabs(dutimespace[iplane])) {
01231           dutimespace[iplane] = dapos;
01232           ndutimespace[iplane] = 1;
01233         }
01234       }
01235     }
01236 
01237     if ( trackstrip -> GetPlaneView() == PlaneView::kV ) {
01238       if ( trackstrip -> GetNDigit(StripEnd::kNegative) > 0 ) {
01239         totvph[0] += ph0;
01240         time.v0   += ph0*t0;
01241       }
01242       if ( trackstrip -> GetNDigit(StripEnd::kPositive) > 0 ) {
01243         totvph[1] += ph1;
01244         time.v1   += ph1*t1;
01245       }
01246       if ( trackstrip -> GetNDigit(StripEnd::kNegative) > 0 &&
01247            trackstrip -> GetNDigit(StripEnd::kPositive) > 0 ) {
01248         Float_t dapos = .5*(t0-t1)*PropagationVelocity::VelocityPosErr();
01249         if (!ndvtimespace[iplane]||fabs(dapos) < fabs(dvtimespace[iplane])) {
01250           dvtimespace[iplane] = dapos;
01251           ndvtimespace[iplane] = 1;
01252         }
01253       }
01254     }
01255   }
01256 
01257   Int_t ndu = 0;
01258   Int_t ndv = 0;
01259   for (int ip = 0; ip < 1000; ip++ ) {
01260     if ( ndutimespace[ip] > 0 ) {
01261       ndu++;
01262       time.du += dutimespace[ip];
01263     }
01264     if ( ndvtimespace[ip] > 0 ) {
01265       ndv++;
01266       time.dv += dvtimespace[ip];
01267     }
01268   }
01269   if ( totuph[0] > 0. ) time.u0 /= totuph[0];
01270   if ( totvph[0] > 0. ) time.v0 /= totvph[0];
01271   if ( totuph[1] > 0. ) time.u1 /= totuph[1];
01272   if ( totvph[1] > 0. ) time.v1 /= totvph[1];
01273   if ( ndu ) time.du /= (Float_t)ndu;
01274   if ( ndv ) time.dv /= (Float_t)ndv;
01275 
01276   return;
01277 
01278 }

void UberModuleLite::FillNtpTrackVertex ( NtpSRTrack ntptrack,
const CandTrackHandle track 
) [private]

Definition at line 1434 of file UberModuleLite.cxx.

References NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, NtpSRVertex::edcosu, NtpSRVertex::edcosv, NtpSRVertex::edcosx, NtpSRVertex::edcosy, NtpSRVertex::edcosz, NtpSRVertex::eu, NtpSRVertex::ev, NtpSRVertex::ex, NtpSRVertex::ey, CandRecoHandle::GetDirCosU(), CandRecoHandle::GetDirCosV(), CandRecoHandle::GetDirCosZ(), CandFitTrackHandle::GetVtxdUError(), CandFitTrackHandle::GetVtxdVError(), CandRecoHandle::GetVtxPlane(), CandRecoHandle::GetVtxT(), CandRecoHandle::GetVtxU(), CandFitTrackHandle::GetVtxUError(), CandRecoHandle::GetVtxV(), CandFitTrackHandle::GetVtxVError(), CandRecoHandle::GetVtxZ(), Msg::kVerbose, MSG, NtpSRVertex::plane, NtpSRVertex::t, NtpSRVertex::u, NtpSRVertex::v, NtpSRTrack::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillNtpTrack().

01435                                                                    {
01436   //
01437   //  Purpose:  Private method used to fill vertex portion of ntuple track.
01438   //
01439   //  Arguments: NtpSRTrack to fill and const CandTrackHandle pointer.
01440   //  
01441   //  Return: status.
01442   // 
01443 
01444 
01445   MSG("UberModuleLite",Msg::kVerbose) << "UberModuleLite::FillNtpTrackVertex" << endl;
01446 
01447   const Double_t cos45 = 0.70710678;  // used for converting from u,v to x,y
01448 
01449   NtpSRVertex& vtx = ntptrack->vtx;
01450   //  NtpSRFitVertex& vtx = ntptrack->vtx;
01451 
01452   vtx.u = track->GetVtxU();
01453   vtx.v = track->GetVtxV();
01454   vtx.x = cos45*(vtx.u-vtx.v);
01455   vtx.y = cos45*(vtx.u+vtx.v);
01456   vtx.z = track->GetVtxZ();
01457   vtx.t = track->GetVtxT();
01458   vtx.plane = track->GetVtxPlane();
01459   vtx.dcosu = track->GetDirCosU();
01460   vtx.dcosv = track->GetDirCosV();
01461   vtx.dcosx = cos45*(vtx.dcosu-vtx.dcosv);
01462   vtx.dcosy = cos45*(vtx.dcosu+vtx.dcosv);
01463   vtx.dcosz = track->GetDirCosZ();
01464 
01465   const CandFitTrackSRHandle* fittracksr
01466                         = dynamic_cast<const CandFitTrackSRHandle*>(track);
01467   if ( fittracksr ) {
01468     vtx.eu = fittracksr->GetVtxUError();
01469     vtx.ev = fittracksr->GetVtxVError();
01470     vtx.ex = cos45*sqrt(vtx.eu*vtx.eu+vtx.ev*vtx.ev);
01471     vtx.ey = cos45*sqrt(vtx.eu*vtx.eu+vtx.ev*vtx.ev);
01472     Double_t edudz = fittracksr->GetVtxdUError();
01473     Double_t edvdz = fittracksr->GetVtxdVError();
01474     // These calculations should include the dudz and dvdz covariance terms
01475     // but currently the covariance terms are not accessible
01476     vtx.edcosz = fabs(vtx.dcosz)*sqrt(pow(vtx.dcosu*edudz,2)+
01477                                       pow(vtx.dcosv*edvdz,2));
01478     vtx.edcosu = sqrt(fabs(vtx.dcosz))*sqrt(pow(vtx.dcosu*vtx.dcosv*edvdz,2)
01479                + pow((pow(vtx.dcosz,2)+pow(vtx.dcosv,2))*edudz,2));
01480     vtx.edcosv = sqrt(fabs(vtx.dcosz))*sqrt(pow(vtx.dcosu*vtx.dcosv*edudz,2)
01481                + pow((pow(vtx.dcosz,2)+pow(vtx.dcosu,2))*edvdz,2));
01482     vtx.edcosx = cos45*sqrt(vtx.edcosu*vtx.edcosu+vtx.edcosv*vtx.edcosv);
01483     vtx.edcosy = cos45*sqrt(vtx.edcosu*vtx.edcosu+vtx.edcosv*vtx.edcosv);
01484   }
01485 
01486   return;
01487 
01488 }

JobCResult UberModuleLite::Get ( MomNavigator mom  )  [virtual]

Implement if your module needs to read data from some external source and fill mom

Reimplemented from JobCModule.

Definition at line 117 of file UberModuleLite.cxx.

References candrec, fCDLH, fCDSI, CandRecord::FindCandHandle(), fRunNumber, CandRecord::GetCandHeader(), MomNavigator::GetFragment(), CandHeader::GetRun(), Msg::kDebug, Msg::kError, JobCResult::kFailed, JobCResult::kPassed, and MSG.

00118 {
00119   MSG("UberModuleLite",Msg::kDebug)<<"In UberModuleLite get"<<endl;
00120 
00121   // Check that mom exists.
00122   assert(mom);  
00123 
00124   //ask mom  for a candidate record
00125   candrec=dynamic_cast<CandRecord*>
00126      (mom->GetFragment("CandRecord","PrimaryCandidateRecord"));
00127   if(candrec==0){
00128     MSG("UberModuleLite",Msg::kError)<<"candrec==0"<<endl;
00129     return JobCResult(JobCResult::kFailed);
00130   }
00131   if(fRunNumber==0){
00132     const CandHeader *ch = candrec->GetCandHeader();
00133     if(ch!=0){
00134       fRunNumber=ch->GetRun();
00135       MSG("UberModuleLite",Msg::kDebug)<<"RUN NUMBER "<<fRunNumber<<endl;
00136     }
00137   }
00138 
00139   fCDLH = dynamic_cast<CandDigitListHandle *>
00140     (candrec->FindCandHandle("CandDigitListHandle","canddigitlist"));
00141   if(fCDLH == 0) {//failure
00142     MSG("UberModuleLite",Msg::kError)<<"fCDLH==0"<<endl;
00143     return JobCResult(JobCResult::kFailed);
00144   }
00145 
00146   //now ask candrecord for a CandCalDetSIHandle
00147   fCDSI = dynamic_cast<CandCalDetSIHandle *>
00148     (candrec->FindCandHandle("CandCalDetSIHandle"));
00149   if(fCDSI == 0) {//failure
00150     MSG("UberModuleLite",Msg::kError)<<"fCDSI==0"<<endl;
00151     return JobCResult(JobCResult::kFailed);
00152   }
00153 
00154   
00155   MSG("UberModuleLite",Msg::kDebug)<<"Returning kPassed"<<endl;
00156   
00157   return JobCResult(JobCResult::kPassed); //success
00158 }//end Get

Int_t UberModuleLite::MakePlaneStripIndex ( Int_t  plane,
Int_t  strip 
) [static, private]

Definition at line 80 of file UberModuleLite.cxx.

Referenced by FillNtpShower(), FillNtpTrack(), and Reco().

00081 {
00082    // ought to add range checking
00083    return plane*200 + strip;
00084    
00085 }

JobCResult UberModuleLite::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 160 of file UberModuleLite.cxx.

References UberRecordLite::AddNextCosmicHit(), UberRecordLite::AddNextCosmicHitValues(), UberRecordLite::AddNextHit(), UberRecordLite::AddNextHitValues(), MomNavigator::AdoptFragment(), UberRecordLite::ceradc, UberRecordLite::certime, CalDetConstants::FARTIMECONVERT, fCDLH, fCDSI, fEventUidMap, fFirstEvent, FillNtpCalDetPID(), FillNtpEvent(), FillNtpShower(), FillNtpTrack(), RecDataRecord< T >::FindComponent(), fIsMC, fMCDecision, fRunNumber, fShowerUidMap, fStarttime, fStripUidMap, fTrackUidMap, CandDigitListHandle::GetAbsTime(), CandCalDetSIHandle::GetCerenkovChannel1(), CandCalDetSIHandle::GetCerenkovChannel2(), CandCalDetSIHandle::GetCerenkovChannel3(), OscFit::GetCharge(), CandHandle::GetDaughterIterator(), CandCalDetSIHandle::GetDeadChips(), RawChannelId::GetElecType(), PlexPixelSpotId::GetEncoded(), PlexStripEndId::GetEnd(), MomNavigator::GetFragment(), CandCalDetSIHandle::GetKovADC1(), CandCalDetSIHandle::GetKovADC2(), CandCalDetSIHandle::GetKovADC3(), CandCalDetSIHandle::GetKovTimeStamp1(), CandCalDetSIHandle::GetKovTimeStamp2(), CandCalDetSIHandle::GetKovTimeStamp3(), Calibrator::GetMIP(), CalDetBeamMomentum::GetMomentum(), DbiResultPtr< T >::GetNumRows(), PlexSEIdAltLItem::GetPE(), PlexHandle::GetPixelSpotId(), PlexSEIdAltL::GetPlane(), PlexPlaneId::GetPlane(), VHS::GetPlane(), PlexHandle::GetReadoutType(), DbiResultPtr< T >::GetRow(), VldTimeStamp::GetSec(), PlexHandle::GetSEIdAltL(), VldContext::GetSimFlag(), CandCalDetSIHandle::GetSnarl(), PlexStripEndId::GetStrip(), VldContext::GetTimeStamp(), CandCalDetSIHandle::GetTofADC0(), CandCalDetSIHandle::GetTofADC1(), CandCalDetSIHandle::GetTofADC2(), CandCalDetSIHandle::GetTofADCTimeStamp0(), CandCalDetSIHandle::GetTofADCTimeStamp1(), CandCalDetSIHandle::GetTofADCTimeStamp2(), CandCalDetSIHandle::GetTofTDC0(), CandCalDetSIHandle::GetTofTDC1(), CandCalDetSIHandle::GetTofTDC2(), CandCalDetSIHandle::GetTofTimeStamp(), CandCalDetSIHandle::GetTriggerORBits(), CandCalDetSIHandle::GetTriggerOROK(), CandCalDetSIHandle::GetTrigSource(), Calibrator::Instance(), RawChannelId::IsSameChannel(), RawChannelId::IsSameVAChip(), Msg::kDebug, Msg::kError, CalHelpers::KeyFromEnd(), CalHelpers::KeyFromPlane(), CalHelpers::KeyFromStrip(), JobCResult::kFailed, SimFlag::kMC, JobCResult::kPassed, ElecType::kQIE, SimFlag::kReroot, CalDigitType::kSigCorr, CalDigitType::kSigLin, CalTimeType::kT0, ElecType::kVA, MakePlaneStripIndex(), UberRecordLite::maxadc, UberRecordLite::maxmip, UberRecordLite::maxnpe, UberRecordLite::maxtime, UberRecordLite::mindeadplaneno, UberRecordLite::mipshowermax, UberRecordLite::mipweighaveplane, UberRecordLite::mipweighcentereven, UberRecordLite::mipweighcenterodd, UberRecordLite::mipweighrad, MSG, Munits::nanosecond, UberRecordLite::ndeadplanes, UberRecordLite::nhitplanes, UberRecordLite::nhits, UberRecordLite::nhitstrips, UberRecordLite::p0maxmiptstamp, UberRecordLite::p0stripmaxmip, UberRecordLite::p0totmip, UberRecordLite::p1maxmiptstamp, UberRecordLite::p1stripmaxmip, UberRecordLite::p1totmip, CalDetConstants::PLANECONST, CalScheme::Reset(), UberRecHeader::SetBeamMomentum(), RawChannelId::SetCommonMode(), RawChannelId::SetCrate(), RawChannelId::SetDetector(), RawChannelId::SetElecType(), RawChannelId::SetGeographicAddress(), RawChannelId::SetMasterChannel(), RawChannelId::SetMinderChannel(), RawChannelId::SetPedMode(), UberRecHeader::SetRunNo(), RawChannelId::SetSparsMode(), UberRecHeader::SetStartTime(), UberRecHeader::SetTemperature(), RawChannelId::SetVaAdcSel(), RawChannelId::SetVaChannel(), RawChannelId::SetVaChip(), RawChannelId::SetVarcId(), RawChannelId::SetVmm(), UberRecordLite::showermax, UberRecordLite::sigcorrconv, size, UberRecordLite::snarlno, CalDetConstants::STRIPCONST, UberRecordLite::tofadc, UberRecordLite::tofhittime, UberRecordLite::toftdc, UberRecordLite::toftime, UberRecordLite::torbits, UberRecordLite::torok, UberRecordLite::totmip, UberRecordLite::triggertime, and UberRecordLite::triggerword.

00161 {
00162   MSG("UberModuleLite",Msg::kDebug)<<"In UberModuleLite Reco"<<endl;
00163 
00164   //get an iterator over the digits
00165   CandDigitHandleItr hi(fCDLH->GetDaughterIterator());
00166   if(!hi.IsValid()){
00167     MSG("UberModuleLite",Msg::kError)<<"DaugherIter not valid"<<endl;
00168     return JobCResult(JobCResult::kFailed);
00169   }
00170 
00171   //Get a validity context and a plex handle
00172   const VldContext *vc = (*hi)->GetVldContext();
00173   PlexHandle ph(*vc, kTRUE);
00174   if(!fMCDecision){
00175     if(vc->GetSimFlag()==SimFlag::kReroot||vc->GetSimFlag()==SimFlag::kMC){
00176       fIsMC = kTRUE;
00177     }
00178     fMCDecision = kTRUE;
00179   }
00180   
00181   Calibrator::Instance().Reset(*vc);
00182 
00183   // Use validity context to create header for ntuple record
00184   UberRecHeader newHdr(*vc);
00185   newHdr.SetRunNo(fRunNumber);
00186   if(fFirstEvent){
00187     fStarttime = vc->GetTimeStamp().GetSec();
00188     
00189     fFirstEvent=kFALSE;
00190   }
00191   newHdr.SetStartTime(fStarttime);
00192 
00193   // Read temperature from the db.
00194   float temp = 100.0; // obviously fake value
00195   if(fIsMC){
00196        // set a bogus temperature
00197        newHdr.SetTemperature(temp);
00198   }
00199   else{
00200         newHdr.SetTemperature(Calibrator::Instance().GetTemperature());
00201 
00202   }
00203 
00204   // Read momentum from the db!
00205   float p = 0.1;// obviously fake value
00206   if(fIsMC){
00207        // try to figure out the momentum from mc truth
00208        // grab the simrecord
00209        const SimSnarlRecord* simrec=dynamic_cast<const SimSnarlRecord*>
00210             (mom->GetFragment("SimSnarlRecord"));
00211        if(simrec){
00212             // grab the stdhep block
00213             const TClonesArray* stdhep = dynamic_cast<const TClonesArray*> 
00214                  (simrec->FindComponent("TClonesArray", "StdHep"));
00215             if(stdhep){
00216                  // primary should be first in the list
00217                  const TParticle* part=
00218                       dynamic_cast<const TParticle*>(stdhep->At(0));
00219                  if(part) p = part->P();
00220             }
00221        }
00222   }
00223   else{
00224        DbiResultPtr<CalDetBeamMomentum> cdbm(*vc);
00225        if(cdbm.GetNumRows()==1) p = cdbm.GetRow(0)->GetMomentum();
00226   }
00227   newHdr.SetBeamMomentum(p);
00228 
00229   //create a new uberrecord
00230   UberRecordLite *snarldata = new UberRecordLite(newHdr);
00231 
00232 
00233 //  MSG("UberModuleLite",Msg::kDebug)<<"Resetting Event"<<endl;
00234 //  snarldata->ResetEvent();
00235   fStripUidMap.clear();
00236   fShowerUidMap.clear();
00237   fTrackUidMap.clear();
00238   fEventUidMap.clear();
00239 
00240   //start filling the snarldata
00241 
00242   //get the time since beginning of timeframe from from candigitlisthandle
00243   snarldata->triggertime = fCDLH->GetAbsTime();
00244 
00245   //get pid info from the CandCalDetSIHandle
00246   snarldata->snarlno = fCDSI->GetSnarl();
00247   MSG("UberModuleLite",Msg::kDebug)<<"SNARL NO "<<snarldata->snarlno<<endl;
00248   snarldata->triggerword = fCDSI->GetTrigSource();
00249   snarldata->ceradc[0]=fCDSI->GetKovADC2();
00250   snarldata->ceradc[1]=fCDSI->GetKovADC1();
00251   snarldata->ceradc[2]=fCDSI->GetKovADC3();
00252   snarldata->torbits=fCDSI->GetTriggerORBits();
00253   snarldata->torok=fCDSI->GetTriggerOROK();
00254 
00255   //get time relative to trigger time of cerenkov hits
00256   //note:  CalDetConstants::FARTIMECONVERT()--magic number to convert ticks to 
00257   //nanoseconds for the FAR DETECTOR electronics
00258   //we will need to fix this if the cerenkov is ever read out
00259   //using Near detector electronics (ie 2003)
00260   if(fCDSI->GetKovTimeStamp2()!=0){
00261     snarldata->certime[0]=fCDSI->GetKovTimeStamp2()
00262       *CalDetConstants::FARTIMECONVERT-snarldata->triggertime/Munits::nanosecond;
00263     MSG("UberModuleLite",Msg::kDebug)<<"Kov 2 timestamp "<<fCDSI->GetKovTimeStamp2()
00264                               <<" time convert "<<CalDetConstants::FARTIMECONVERT
00265                               <<" trigger time "<<snarldata->triggertime
00266                               <<" in ns "
00267                               <<snarldata->triggertime/Munits::nanosecond
00268                               <<endl;
00269   }
00270   if(fCDSI->GetKovTimeStamp1()!=0){
00271     snarldata->certime[1]=fCDSI->GetKovTimeStamp1()
00272       *CalDetConstants::FARTIMECONVERT-snarldata->triggertime/Munits::nanosecond;
00273   }
00274   if(fCDSI->GetKovTimeStamp3()!=0){
00275     snarldata->certime[2]=fCDSI->GetKovTimeStamp3()
00276       *CalDetConstants::FARTIMECONVERT-snarldata->triggertime/Munits::nanosecond;
00277   }
00278   snarldata->toftdc[0]=fCDSI->GetTofTDC0();
00279   snarldata->toftdc[1]=fCDSI->GetTofTDC1();
00280   snarldata->toftdc[2]=fCDSI->GetTofTDC2();
00281   snarldata->tofadc[0]=fCDSI->GetTofADC0();
00282   snarldata->tofadc[1]=fCDSI->GetTofADC1();
00283   snarldata->tofadc[2]=fCDSI->GetTofADC2();
00284   if(fCDSI->GetTofTimeStamp()!=0){
00285      snarldata->toftime=fCDSI->GetTofTimeStamp()
00286         *CalDetConstants::FARTIMECONVERT-snarldata->triggertime/Munits::nanosecond;
00287      MSG("UberModuleLite",Msg::kDebug)<<"tof timestamp "<<fCDSI->GetTofTimeStamp()
00288                                       <<" time convert "<<CalDetConstants::FARTIMECONVERT
00289                                       <<setprecision(10)<<" trigger time "
00290                                       <<snarldata->triggertime
00291                                       <<" in ns "
00292                                       <<setprecision(10)
00293                                       <<snarldata->triggertime/Munits::nanosecond
00294                                       <<" tof time "<<snarldata->toftime<<endl;
00295      
00296   }
00297   if(fCDSI->GetTofADCTimeStamp0()!=0){
00298     snarldata->tofhittime[0]=fCDSI->GetTofADCTimeStamp0()
00299       *CalDetConstants::FARTIMECONVERT-snarldata->triggertime/Munits::nanosecond;
00300   }
00301   if(fCDSI->GetTofADCTimeStamp1()!=0){
00302     snarldata->tofhittime[1]=fCDSI->GetTofADCTimeStamp1()
00303       *CalDetConstants::FARTIMECONVERT-snarldata->triggertime/Munits::nanosecond;
00304   }
00305   if(fCDSI->GetTofADCTimeStamp2()!=0){
00306     snarldata->tofhittime[2]=fCDSI->GetTofADCTimeStamp2()
00307       *CalDetConstants::FARTIMECONVERT-snarldata->triggertime/Munits::nanosecond;
00308   }
00309 
00310   //add the number of seconds since the beginning of the run to the
00311   //trigger time to make trigger time absolute since beginning of run
00312   snarldata->triggertime+=vc->GetTimeStamp().GetSec()-fStarttime;
00313   MSG("UberModuleLite",Msg::kDebug)<<"Trigger time "<<snarldata->triggertime<<endl
00314                             <<"vld context time "
00315                             <<vc->GetTimeStamp().GetSec()<<endl;
00316 /*
00317   PlexHandle ph(*vc, kTRUE);
00318   if(!fMCDecision){
00319     if(vc->GetSimFlag()==SimFlag::kReroot||vc->GetSimFlag()==SimFlag::kMC){
00320       fIsMC = kTRUE;
00321     }
00322     fMCDecision = kTRUE;
00323   }
00324 */
00325   Bool_t gotsigcorrconv = kFALSE;
00326 
00327 
00328   //check dead chip list in the CandCalDetSIHandle to find mindeadplane
00329   //and and number of dead planes
00330   set<UShort_t> deadplanemap;
00331   vector<RawChannelId>::const_iterator dcit(fCDSI->GetDeadChips().begin());
00332   MSG("UberModuleLite", Msg::kDebug)<<"Starting to get dead chip vector"<<endl
00333                                <<"Size of Dead Chip vector "
00334                                <<fCDSI->GetDeadChips().size()<<endl;
00335   while(dcit!=fCDSI->GetDeadChips().end()){
00336     //make a rawchannel id out of the dead chip (use va channel 3)
00337 //changed 8-27-03 to make dead chip checking work with QIE chips
00338     RawChannelId newid;
00339     newid.SetDetector((*dcit).GetDetector());
00340     newid.SetElecType((*dcit).GetElecType()); 
00341     newid.SetCrate((*dcit).GetCrate());
00342     if((*dcit).GetElecType()==ElecType::kVA){
00343        newid.SetVarcId((*dcit).GetVarcId());
00344        newid.SetVmm((*dcit).GetVmm());
00345        newid.SetVaAdcSel((*dcit).GetVaAdcSel());
00346        newid.SetVaChip((*dcit).GetVaChip());
00347        newid.SetVaChannel(3);
00348     }
00349     if((*dcit).GetElecType()==ElecType::kQIE){
00350        newid.SetGeographicAddress((*dcit).GetGeographicAddress());
00351        newid.SetMasterChannel((*dcit).GetMasterChannel());
00352        newid.SetMinderChannel((*dcit).GetMinderChannel());
00353     }
00354 //    newid.SetModeBits(false,false,false);
00355     newid.SetPedMode(false);
00356     newid.SetSparsMode(false);
00357     newid.SetCommonMode(false);
00358        
00359 
00360        
00361     if(ph.GetSEIdAltL(newid).GetPlane()>=0){
00362        deadplanemap.insert(ph.GetSEIdAltL(newid).GetPlane());
00363     }
00364     if(newid.GetElecType()==ElecType::kVA){
00365        if(fCDSI->GetCerenkovChannel3().GetElecType()==ElecType::kVA){
00366           if(newid.IsSameVAChip(fCDSI->GetCerenkovChannel3())){
00367              deadplanemap.insert(65);
00368           }
00369        }
00370        if(fCDSI->GetCerenkovChannel1().GetElecType()==ElecType::kVA){
00371           if(newid.IsSameVAChip(fCDSI->GetCerenkovChannel1())){
00372              deadplanemap.insert(66);
00373           }
00374        }
00375        if(fCDSI->GetCerenkovChannel2().GetElecType()==ElecType::kVA){
00376           if(newid.IsSameVAChip(fCDSI->GetCerenkovChannel2())){
00377              deadplanemap.insert(67);
00378           }
00379        }
00380     }
00381     else if(newid.GetElecType()==ElecType::kQIE){
00382        if(fCDSI->GetCerenkovChannel3().GetElecType()==ElecType::kQIE){
00383           if(newid.IsSameChannel(fCDSI->GetCerenkovChannel3())){
00384              deadplanemap.insert(65);
00385           }
00386        }
00387        if(fCDSI->GetCerenkovChannel1().GetElecType()==ElecType::kQIE){
00388           if(newid.IsSameChannel(fCDSI->GetCerenkovChannel1())){
00389              deadplanemap.insert(66);
00390           }
00391        }
00392        if(fCDSI->GetCerenkovChannel2().GetElecType()==ElecType::kQIE){
00393           if(newid.IsSameChannel(fCDSI->GetCerenkovChannel2())){
00394              deadplanemap.insert(67);
00395           }
00396        }
00397     }
00398     //make another possible rawchannel id out of the dead chip(use va channel 11)
00399     //which could possibly be on the next plane
00400     //modified 8-17-03 to work with qie elec., 
00401     //need to look at 4 different masterchans to make sure we get all the planes
00402     RawChannelId newid2;
00403     newid2.SetDetector((*dcit).GetDetector());
00404     newid2.SetElecType((*dcit).GetElecType()); 
00405     newid2.SetCrate((*dcit).GetCrate());
00406     if((*dcit).GetElecType()==ElecType::kVA){
00407        newid2.SetVarcId((*dcit).GetVarcId());
00408        newid2.SetVmm((*dcit).GetVmm());
00409        newid2.SetVaAdcSel((*dcit).GetVaAdcSel());
00410        newid2.SetVaChip((*dcit).GetVaChip());
00411        newid2.SetVaChannel(11);
00412     }
00413     if((*dcit).GetElecType()==ElecType::kQIE){
00414        newid2.SetGeographicAddress((*dcit).GetGeographicAddress());
00415        newid2.SetMasterChannel((*dcit).GetMasterChannel()+1);
00416        newid2.SetMinderChannel((*dcit).GetMinderChannel());
00417     }
00418 //    newid2.SetModeBits(false,false,false);
00419       newid2.SetPedMode(false);
00420       newid2.SetSparsMode(false);
00421       newid2.SetCommonMode(false);
00422        
00423   
00424     if(ph.GetSEIdAltL(newid2).GetPlane()>=0){
00425       deadplanemap.insert(ph.GetSEIdAltL(newid2).GetPlane());
00426     }
00427     if((*dcit).GetElecType()==ElecType::kQIE){
00428        RawChannelId newid3;
00429        newid3.SetDetector((*dcit).GetDetector());
00430        newid3.SetElecType((*dcit).GetElecType()); 
00431        newid3.SetCrate((*dcit).GetCrate());
00432        newid3.SetElecType((*dcit).GetElecType()); 
00433        newid3.SetGeographicAddress((*dcit).GetGeographicAddress());
00434        newid3.SetMasterChannel((*dcit).GetMasterChannel()+2);
00435        newid3.SetMinderChannel((*dcit).GetMinderChannel());
00436 //       newid3.SetModeBits(false,false,false);
00437        newid3.SetPedMode(false);
00438        newid3.SetSparsMode(false);
00439        newid3.SetCommonMode(false);
00440        
00441 
00442        if(ph.GetSEIdAltL(newid3).GetPlane()>=0){
00443           deadplanemap.insert(ph.GetSEIdAltL(newid3).GetPlane());
00444        }
00445        RawChannelId newid4;
00446        newid4.SetDetector((*dcit).GetDetector());
00447        newid4.SetElecType((*dcit).GetElecType()); 
00448        newid4.SetCrate((*dcit).GetCrate());
00449        newid4.SetElecType((*dcit).GetElecType()); 
00450        newid4.SetGeographicAddress((*dcit).GetGeographicAddress());
00451        newid4.SetMasterChannel((*dcit).GetMasterChannel()+3);
00452        newid4.SetMinderChannel((*dcit).GetMinderChannel());
00453 //       newid4.SetModeBits(false,false,false);
00454        newid4.SetPedMode(false);
00455        newid4.SetSparsMode(false);
00456        newid4.SetCommonMode(false);
00457 
00458     
00459        if(ph.GetSEIdAltL(newid4).GetPlane()>=0){
00460           deadplanemap.insert(ph.GetSEIdAltL(newid4).GetPlane());
00461        }
00462     }
00463 
00464 
00465     dcit++;
00466   }
00467   if(deadplanemap.size()!=0){
00468     snarldata->mindeadplaneno = *(deadplanemap.begin());
00469     snarldata->ndeadplanes = deadplanemap.size();
00470   }
00471   MSG("UberModuleLite",Msg::kDebug)<<"First dead plane "<<snarldata->mindeadplaneno
00472                             <<" No. dead planes "<<snarldata->ndeadplanes<<endl;
00473   
00474 
00475 
00476   //sort hits in event by plane
00477   CandDigitHandleKeyFunc* kf = hi.CreateKeyFunc();
00478   kf->SetFun(CalHelpers::KeyFromPlane);
00479   hi.GetSet()->AdoptSortKeyFunc(kf,kTRUE,kFALSE);
00480   //further sort hits by strip
00481   kf=hi.CreateKeyFunc();
00482   kf->SetFun(CalHelpers::KeyFromStrip);
00483   hi.GetSet()->AdoptSortKeyFunc(kf,kFALSE,kFALSE);
00484   //and finally, sort by strip end
00485   kf=hi.CreateKeyFunc();
00486   kf->SetFun(CalHelpers::KeyFromEnd);
00487   hi.GetSet()->AdoptSortKeyFunc(kf,kFALSE,kTRUE);
00488   kf = 0;
00489   MSG("UberModuleLite",Msg::kDebug)<<"Done sorting"<<endl;
00490   
00491   //declare variables to find maxes
00492   Float_t maxplanemip = 0.;
00493   Float_t maxp0stripmip=0.;
00494   Float_t maxp1stripmip=0.;
00495   Float_t maxp0hitmip=0.;
00496   Float_t maxp1hitmip=0.;
00497   Float_t totmipeven=0.;
00498   Float_t totmipodd=0.;
00499 
00500 /*
00501   map<PlexStripEndId, REROOT_FLSDigit> FLSDigitMap;
00502   int nmchitstrips=0;
00503   if(fIsMC){
00504     const TClonesArray *hep = RerootExodus::GetStdHepList();
00505     mc->SetStdHep(hep);
00506     MSG("UberModuleLite",Msg::kDebug)<<"size of hep is "<<hep->GetEntries()<<endl;
00507     REROOT_Event *revt = gMINFast->GetREROOTEvent();
00508     mc->nhep = revt->n_stdheps();
00509     MSG("UberModuleLite",Msg::kDebug)<<"and mc nhep is  "<<mc->nhep<<endl;
00510     REROOT_StdHep *stdhep = static_cast<REROOT_StdHep *>(hep->At(0));
00511     if(stdhep!=0){
00512       mc->mctype = stdhep->ID();
00513       mc->mcpx = stdhep->Px();
00514       mc->mcpy = stdhep->Py();
00515       mc->mcpz = stdhep->Pz();
00516       mc->mcenergy = stdhep->E();
00517       mc->mcvx = stdhep->Xmm();
00518       mc->mcvy = stdhep->Ymm();
00519       mc->mcvz = stdhep->Zmm();
00520     }
00521     const TClonesArray *flsd = RerootExodus::GetFLSDigitList();
00522     int i=0;
00523     TObject *obj;
00524     while((obj=flsd->At(i))){
00525       REROOT_FLSDigit *mcdig = static_cast<REROOT_FLSDigit*>(obj);
00526       PlexStripEndId mcseid = RerootExodus::PECAB2SEId(mcdig->IPln(),
00527                                                        mcdig->IExtr(),
00528                                                        mcdig->ICell(),0);
00529       FLSDigitMap[mcseid]=*mcdig;
00530       i++;
00531     }
00532   }
00533 */
00534     
00535 
00536   
00537   //begin looping over planes
00538   MSG("UberModuleLite",Msg::kDebug)<<"begining to loop over hits"<<endl;;
00539   for(hi.Reset();hi.IsValid();hi.NextKey()){ 
00540     UShort_t plane = (*hi)->GetPlexSEIdAltL().GetPlane();
00541     MSG("UberModuleLite",Msg::kDebug)<<"PLANE "<<plane<<endl;
00542     Bool_t iscosmic = kFALSE;
00543     if(plane>=CalDetConstants::PLANECONST){ //if not a detector plane, continue
00544       iscosmic=kTRUE;
00545     }
00546     if(!iscosmic){
00547       snarldata->nhitplanes++; //increment nhitplanes
00548     }
00549     Float_t planemip=0.;
00550 
00551     //begin looping over strips
00552     for(CandDigitHandleItr siter(hi, kTRUE);
00553         siter.IsValid();siter.NextKey()){ 
00554       UShort_t strip = (*siter)->GetPlexSEIdAltL().GetBestSEId().GetStrip();
00555       MSG("UberModuleLite",Msg::kDebug)<<"STRIP "<<strip<<endl;
00556       if(!iscosmic){
00557         MSG("UberModuleLite",Msg::kDebug)<<"adding one to nhitstrips"<<endl;
00558         snarldata->nhitstrips++;  //increment nhitstrips
00559         MSG("UberModuleLite",Msg::kDebug)<<"adding next hit to tclonesarray"<<endl;
00560         //make a hit in UberEvent's TClonesArray
00561         int sindx = snarldata->AddNextHit(plane,strip);
00562         MSG("UberModuleLite",Msg::kDebug)<<"added next hit to tclonesarray"<<endl;
00563         //int uid = (*siter)->GetUidInt();
00564         Int_t uid = MakePlaneStripIndex(plane, strip);
00565         fStripUidMap.insert(std::make_pair(uid,sindx));
00566 
00567 /*
00568         if(fIsMC){
00569           mc->AddNextHit(plane,strip);
00570         }
00571 */
00572       }
00573       if(iscosmic){
00574         snarldata->AddNextCosmicHit(plane,strip);
00575       }
00576       Float_t p0stripmip=0.;
00577       Float_t p1stripmip=0.;
00578 
00579       //begin looping over ends
00580       for(CandDigitHandleItr eiter(siter,kTRUE);
00581           eiter.IsValid();eiter.Next()){ //loop over ends
00582         
00583         MSG("UberModuleLite",Msg::kDebug)<<"RAW CHANNEL ID FOR THIS TIME ROUND:"<<endl;
00584 //        (*eiter)->GetChannelId().Print();
00585         MSG("UberModuleLite",Msg::kDebug)<<endl;
00586 //        (*eiter)->GetPlexSEIdAltL().Print();
00587         MSG("UberModuleLite",Msg::kDebug)<<" readouttype "
00588                                      <<ph.GetReadoutType((*eiter)->GetChannelId())
00589                                      <<endl;
00590 
00591         if(((*eiter)->GetPlexSEIdAltL()).size()!=1){
00592            MSG("UberModuleLite",Msg::kDebug)<<"Wrong size of Plexseidaltl "
00593                                         <<((*eiter)->GetPlexSEIdAltL()).size()
00594                                         <<" snarl no "<<snarldata->snarlno
00595                                         <<" plane is "<<plane<<endl;
00596         }
00597         if((*eiter)->GetPlexSEIdAltL().size()<=0){
00598           MSG("UberModuleLite",Msg::kDebug)<<"plexseidaltl is EMPTY"<<endl;
00599           //(*eiter)->GetChannelId().Print();
00600           //MSG("UberModuleLite",Msg::kDebug)<<endl;
00601           //(*eiter)->GetPlexSEIdAltL().Print();
00602           //MSG("UberModuleLite",Msg::kDebug)<<endl;
00603           continue;
00604         }
00605         /*
00606         //for debugging the reading of the near detector stuff:
00607         if((*eiter)->GetChannelId().GetElecType()==ElecType::kQIE){
00608           MSG("UberModuleLite",Msg::kDebug)<<" FOUND A QIE DIGIT "<<endl;
00609         }
00610         */
00611         PlexStripEndId pse = (*eiter)->GetPlexSEIdAltL().GetBestSEId();
00612         StripEnd::StripEnd_t se = pse.GetEnd();
00613         PlexSEIdAltLItem pseitem = (*eiter)->GetPlexSEIdAltL().GetBestItem();
00614 
00615 
00616         //get hit info
00617         Int_t adc = (int)(*eiter)->GetCharge();
00618         Float_t siglin = (*eiter)->GetCharge(CalDigitType::kSigLin);
00619         Float_t npe = pseitem.GetPE();
00620         Float_t sigcorr = (*eiter)->GetCharge(CalDigitType::kSigCorr);
00621         Float_t mip = Calibrator::Instance().GetMIP((*eiter)
00622                                                    ->GetCharge(CalDigitType::kSigCorr),pse);
00623         Float_t time = ((*eiter)->GetSubtractedTime(CalTimeType::kT0)
00624                         /Munits::nanosecond);
00625         PlexPixelSpotId pps=ph.GetPixelSpotId(pse);
00626         Int_t agg = pps.GetEncoded();
00627         // added by mak March 25, 2003
00628 
00629         if(iscosmic){
00630           snarldata->AddNextCosmicHitValues(se, adc, time, agg);
00631           continue;
00632         }
00633 
00634         snarldata->nhits++;  //increment nhits
00635         if(!gotsigcorrconv){
00636           // MAK -- 6/3/03 : Added sig fpe protection
00637           if(mip>0) snarldata->sigcorrconv = sigcorr/mip;
00638           else snarldata->sigcorrconv=-1;
00639           gotsigcorrconv=kTRUE;
00640         }
00641 
00642         //add the hit info to UberEvent's TClonesArray
00643 //CandDigit now removes the pedestal offset!!!!!, no need to do anything special
00644 //for qie digits anymore
00645 /*
00646         if((*eiter)->GetChannelId().GetElecType()==ElecType::kQIE){
00647           // MAK -- 6/3/03 : Added sig fpe protection
00648           float Nd=0;
00649           float Nc=0;
00650           if(siglin>0) Nd = 1.*adc/siglin;
00651           else Nd=1.0;
00652           if(mip) Nc = 1.*siglin/mip;
00653           else Nc=1.0;
00654           snarldata->AddNextHitValues(se, adc-50, siglin, 
00655                                       (adc-50)*1./(1.*adc/npe), (adc-50)/(Nd*Nc),
00656                                       time, agg);
00657         }
00658         else{
00659           snarldata->AddNextHitValues(se, adc, siglin, npe, mip, time, agg);
00660         }
00661 */
00662 
00663         snarldata->AddNextHitValues(se, adc, siglin, npe, mip, time, agg);
00664         MSG("UberModuleLite",Msg::kDebug)<<"STRIP END "<<se<<" adc "<<adc<<endl;
00665         planemip+=mip;  //increment the mips deposited in current plane
00666 
00667         if(pse.GetPlane()%2==0){  //calculate center in even planes
00668           snarldata->mipweighcentereven+=mip*pse.GetStrip();
00669           totmipeven+=mip;
00670         }
00671         else{ //calculate center in odd planes
00672           snarldata->mipweighcenterodd+=mip*pse.GetStrip();
00673           totmipodd+=mip;
00674         }
00675 
00676         //look for max hit adc, npe, mip, time
00677         if(adc>snarldata->maxadc){
00678           snarldata->maxadc = adc;
00679         }
00680         if(npe>snarldata->maxnpe){
00681           snarldata->maxnpe = npe;
00682         }
00683         if(mip>snarldata->maxmip){
00684           snarldata->maxmip = mip;
00685         }
00686         if(time>snarldata->maxtime){
00687           snarldata->maxtime = time;
00688         }
00689 
00690         //add mip in all planes but plane 0
00691         if(pse.GetPlane()!=0){
00692           snarldata->totmip+=mip;
00693         }
00694 
00695         //find mips in plane 0
00696         if(pse.GetPlane()==0){
00697           snarldata->p0totmip+=mip;
00698           p0stripmip+=mip;
00699           if(mip>maxp0hitmip){
00700             maxp0hitmip = mip;
00701             snarldata->p0maxmiptstamp = time;
00702           } 
00703         }
00704 
00705         //find mips in plane 1
00706         if(pse.GetPlane()==1){
00707           snarldata->p1totmip+=mip;
00708           p1stripmip+=mip;
00709           if(mip>maxp1hitmip){
00710             maxp1hitmip = mip;
00711             snarldata->p1maxmiptstamp = time;
00712           } 
00713         }
00714       }//end loop over ends
00715 /*      
00716       if(fIsMC&&!iscosmic){
00717         PlexStripEndId mcpse = (*siter)->GetPlexSEIdAltL().GetBestSEId();
00718         mcpse.SetEnd(StripEnd::kNegative);
00719         REROOT_FLSDigit mcd = FLSDigitMap.find(mcpse)->second;
00720         MSG("UberModuleLite",Msg::kDebug)<<"pse.GetPlane() "
00721                                   <<(*siter)
00722           ->GetPlexSEIdAltL().GetBestSEId().GetPlane()
00723                                   <<" mc plane "<<mcd.IPln()<<endl;
00724         mc->AddNextHitValues(mcd.HitBits(),mcd.SumETrue(),mcd.TPos(),mcd.RawB(),
00725                              mcd.RawA(), mcd.CorrB(), mcd.CorrA(), mcd.TDCB(),
00726                              mcd.TDCA(), mcd.AveDistTrueB(),mcd.AveDistTrueA());
00727         mc->mcenergydep += mcd.SumETrue();
00728         nmchitstrips++;
00729       }
00730 */
00731       //find max mip in an strip in plane 0
00732       if(p0stripmip>maxp0stripmip){ 
00733         maxp0stripmip = p0stripmip;
00734         snarldata->p0stripmaxmip = strip;
00735       }
00736       //find max mip in a strip in plane 1
00737       if(p1stripmip>maxp1stripmip){
00738         maxp1stripmip = p1stripmip;
00739         snarldata->p1stripmaxmip = strip;
00740       }
00741     }//end loop over strips
00742 
00743     snarldata->mipweighaveplane+=planemip*plane;  //calculate mip weigh ave plane
00744     if(planemip>maxplanemip){  //find showermax
00745       maxplanemip = planemip;
00746       snarldata->mipshowermax = maxplanemip;
00747       snarldata->showermax = plane;
00748     }
00749   }//end loop over planes
00750   // MAK -- sept 21 2003
00751   if((snarldata->totmip+snarldata->p0totmip)>0){
00752        snarldata->mipweighaveplane/=(snarldata->totmip
00753                                      +snarldata->p0totmip);
00754   }
00755   else snarldata->mipweighaveplane=-1;
00756   // MAK -- 6/3/03
00757   // added some sig fpe checking here
00758   if(totmipeven>0) snarldata->mipweighcentereven/=totmipeven;
00759   else snarldata->mipweighcentereven=-1;
00760   if(totmipodd>0) snarldata->mipweighcenterodd/=totmipodd;
00761   else snarldata->mipweighcenterodd=-1;
00762   
00763 
00764   //loop again to calculate radius of event:
00765   for(hi.Reset();hi.IsValid();hi.NextKey()){
00766     UShort_t plane = ((*hi)->GetPlexSEIdAltL()).GetPlane();
00767     if(plane>=CalDetConstants::PLANECONST){
00768       continue;
00769     }
00770     float center = 0.;
00771     if(plane%2==0){
00772       center=snarldata->mipweighcentereven;
00773     }
00774     else{
00775       center = snarldata->mipweighcenterodd;
00776     }
00777     for(CandDigitHandleItr siter(hi, kTRUE);
00778         siter.IsValid();siter.NextKey()){ //loop over strips
00779       for(CandDigitHandleItr eiter(siter,kTRUE);
00780           eiter.IsValid();eiter.Next()){ //loop over ends
00781         PlexStripEndId pse = (*eiter)->GetPlexSEIdAltL().GetBestSEId();
00782         if(pse.GetStrip()>=CalDetConstants::STRIPCONST){
00783           continue;
00784         }
00785         Float_t mip = Calibrator::Instance().GetMIP((*eiter)
00786                                                     ->GetCharge(CalDigitType::kSigCorr),pse);
00787 
00788         snarldata->mipweighrad += fabs(center-pse.GetStrip())*mip;
00789       }//end end loop
00790     }//end strip loop
00791   }//end planeloop
00792 
00793   // MAK -- 6/3/03 : Added sig fpe protection  
00794   if((snarldata->totmip+snarldata->p0totmip)>0.0) 
00795     snarldata->mipweighrad/=(snarldata->totmip+snarldata->p0totmip);
00796   else snarldata->mipweighrad=0;
00797 
00798   this->FillNtpCalDetPID(snarldata);
00799 
00800   this -> FillNtpShower(snarldata);
00801   this -> FillNtpTrack(snarldata);
00802   this -> FillNtpEvent(snarldata);
00803 
00804   MSG("UberModuleLite",Msg::kDebug)<<"giving fragment to mom"<<endl;  
00805   mom->AdoptFragment(snarldata);
00806 
00807 
00808   MSG("UberModuleLite",Msg::kDebug)<<"done with this event"<<endl;
00809   return JobCResult(JobCResult::kPassed);
00810 }//end Reco()


Member Data Documentation

Definition at line 58 of file UberModuleLite.h.

Referenced by FillNtpCalDetPID(), FillNtpEvent(), FillNtpShower(), FillNtpTrack(), and Get().

Definition at line 59 of file UberModuleLite.h.

Referenced by Get(), and Reco().

Definition at line 60 of file UberModuleLite.h.

Referenced by Get(), and Reco().

std::map<int,int> UberModuleLite::fEventUidMap [private]

Definition at line 65 of file UberModuleLite.h.

Referenced by FillNtpEvent(), and Reco().

Bool_t UberModuleLite::fFirstEvent [private]

Definition at line 54 of file UberModuleLite.h.

Referenced by Reco().

Bool_t UberModuleLite::fIsMC [private]

Definition at line 53 of file UberModuleLite.h.

Referenced by Reco().

Bool_t UberModuleLite::fMCDecision [private]

Definition at line 55 of file UberModuleLite.h.

Referenced by Reco().

Int_t UberModuleLite::fRunNumber [private]

Definition at line 56 of file UberModuleLite.h.

Referenced by Get(), and Reco().

std::map<int,int> UberModuleLite::fShowerUidMap [private]

Definition at line 63 of file UberModuleLite.h.

Referenced by FillNtpEvent(), FillNtpShower(), and Reco().

time_t UberModuleLite::fStarttime [private]

Definition at line 57 of file UberModuleLite.h.

Referenced by Reco().

std::map<int,int> UberModuleLite::fStripUidMap [private]

Definition at line 62 of file UberModuleLite.h.

Referenced by FillNtpEvent(), FillNtpShower(), FillNtpTrack(), and Reco().

std::map<int,int> UberModuleLite::fTrackUidMap [private]

Definition at line 64 of file UberModuleLite.h.

Referenced by FillNtpEvent(), FillNtpTrack(), and Reco().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1