FitTrackMSListModule Class Reference

#include <FitTrackMSListModule.h>

Inheritance diagram for FitTrackMSListModule:
JobCModule

List of all members.

Public Member Functions

 FitTrackMSListModule ()
 ~FitTrackMSListModule ()
const RegistryDefaultConfig () const
void Config (const Registry &r)
JobCResult Reco (MomNavigator *mom)
JobCResult Ana (const MomNavigator *mom)
void EndJob ()

Private Attributes

TString fListIn
TString fListOut
TFile * fFile
TTree * fStripNt
TTree * fTrackNt
TTree * fPlaneNt
Int_t nt_run
Int_t nt_snarl
Int_t nt_timesec
Double_t nt_timens
Int_t nt_track
Int_t nt_plane
Int_t nt_planeview
Int_t nt_strip
Float_t nt_tpos
Int_t nt_inshower
Int_t nt_adc [2]
Float_t nt_adcplane
Double_t nt_time [2]
Double_t nt_corrtime [2]
Double_t nt_residtime [2]
Int_t nt_crate [2]
Int_t nt_varc [2]
Int_t nt_vmm [2]
Int_t nt_vaadc [2]
Int_t nt_vachip [2]
Int_t nt_vachannel [2]
Int_t nt_pixel [2]
Float_t nt_uvz [3]
Float_t nt_dircos [3]
Float_t nt_clearfiber [2]
Float_t nt_wlspigtail [2]
Float_t nt_halflength
Float_t nt_pmtph [2]
Float_t nt_attndist [2]
Float_t nt_attnc1 [2]
Float_t nt_attnc2 [2]
Float_t nt_attnl1 [2]
Float_t nt_attnl2 [2]
Float_t nt_attnnorm [2]
Float_t nt_attncorr [2]
Float_t nt_ds
Int_t nttrack_nstrip
Int_t nttrack_ntrackstrip
Int_t nttrack_ndigit
Int_t nttrack_ntrackdigit
Int_t nttrack_ntimefitdigit
Int_t nttrack_adc
Int_t nttrack_nplane
Int_t nttrack_nplane_track
Float_t nttrack_uvz [3]
Float_t nttrack_dircos [3]
Float_t nttrack_houghdircos [3]
Float_t nttrack_fitdircos [3]
Float_t nttrack_fitintercept [2]
Float_t nttrack_uvzend [3]
Float_t nttrack_dircosend [3]
Float_t nttrack_timeslope
Float_t nttrack_timefitchi2
Float_t nttrack_houghchi2
Float_t nttrack_maxradius
UInt_t nttrack_date_year
UInt_t nttrack_date_month
UInt_t nttrack_date_day
UInt_t nttrack_date_hour
UInt_t nttrack_date_minute
UInt_t nttrack_date_second
UInt_t nttrack_date_nanosecond
Int_t nttrack_snarl_nstrip
Int_t nttrack_snarl_begplane
Int_t nttrack_snarl_endplane
Int_t nttrack_snarl_nplane
Float_t nttrack_snarl_adc
Float_t nttrack_utime [2]
Float_t nttrack_vtime [2]
Int_t nttrack_nplanefaildemux
Float_t nttrack_begdigitstrip [2]
Int_t nttrack_dplanebeg
Int_t nttrack_dplaneend
Float_t nttrack_momentum
Float_t nttrack_ds
Int_t ntreroot_inu
Int_t ntreroot_iaction
Float_t ntreroot_p4nu [4]
Float_t ntreroot_p4sh [4]
Float_t ntreroot_p4mu [4]
Float_t ntreroot_p4el [4]
Float_t ntreroot_xyz [3]
Int_t ntplane_nstrip
Int_t ntplane_adc
Int_t ntplane_plane
Float_t ntplane_uvz [3]
Float_t ntplane_dircos [3]
Float_t nttrack_momentumL
Float_t nttrack_momentumBF
Float_t nttrack_momentumMS
Float_t nttrack_momentumBoth
Float_t nttrack_momentumAlt
Float_t nttrack_chi2
Float_t nttrack_chi2L
Float_t nttrack_chi2BF
Float_t nttrack_chi2MS
Float_t nttrack_chi2Both
Float_t nttrack_chi2Alt
Int_t nttrack_flag
Float_t nttrack_charge
Float_t nttrack_charged
Int_t nttrack_iter

Detailed Description

Definition at line 24 of file FitTrackMSListModule.h.


Constructor & Destructor Documentation

FitTrackMSListModule::FitTrackMSListModule (  ) 

Definition at line 67 of file FitTrackMSListModule.cxx.

References AlgFactory::GetInstance(), Msg::kVerbose, MSG, and AlgFactory::Register().

00067                                            :
00068     fListIn("CandTrackList"),fListOut("CandFitTrackMSList"),fFile(0)
00069 {
00070    MSG("FitTrackMS", Msg::kVerbose) << "FitTrackMSListModule::Constructor\n";
00071 
00072   // Get Singleton instance of AlgFactory.
00073   AlgFactory &af = AlgFactory::GetInstance();
00074 
00075   // Register (Algorithm, configset) by names ("AlgFitTrackMS", "default")
00076   af.Register("AlgFitTrackMS", "default", "libCandFitTrackMS.so", "AlgConfig");
00077 
00078   // Register (Algorithm, configset) by names ("AlgFitTrackMSList", "default")
00079   af.Register("AlgFitTrackMSList", "default", "libCandFitTrackMS.so",
00080               "AlgConfig");
00081 }

FitTrackMSListModule::~FitTrackMSListModule (  ) 

Definition at line 84 of file FitTrackMSListModule.cxx.

References Msg::kVerbose, and MSG.

00085 {
00086    MSG("FitTrackMS", Msg::kVerbose) << "FitTrackMSListModule::Destructor\n";
00087 }


Member Function Documentation

JobCResult FitTrackMSListModule::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 227 of file FitTrackMSListModule.cxx.

References RawDigitDataBlock::At(), UgliStripHandle::ClearFiber(), digit(), fFile, CandRecord::FindCandHandle(), RawRecord::FindRawBlock(), fPlaneNt, fStripNt, fTrackNt, CandDigitListHandle::GetAbsTime(), RawDigit::GetADC(), CalMapperFits::GetC1(), CalMapperFits::GetC2(), RawDigit::GetChannel(), CandFitTrackHandle::GetChi2(), CandFitTrackMSHandle::GetChi2Alt(), CandFitTrackMSHandle::GetChi2BF(), CandFitTrackMSHandle::GetChi2Both(), CandFitTrackMSHandle::GetChi2L(), CandFitTrackMSHandle::GetChi2MS(), RawChannelId::GetCrate(), RawDigit::GetCrateT0(), VldTimeStamp::GetDate(), CandHandle::GetDaughterIterator(), CandFitTrackHandle::GetEMCharge(), CandFitTrackMSHandle::GetEMChargeD(), CandFitTrackMSHandle::GetFlag(), MomNavigator::GetFragment(), UgliStripHandle::GetHalfLength(), CandFitTrackMSHandle::GetIter(), CalMapperFits::GetLambda1(), CalMapperFits::GetLambda2(), CandFitTrackMSHandle::GetMomentumAlt(), CandFitTrackMSHandle::GetMomentumBF(), CandFitTrackMSHandle::GetMomentumBoth(), CandFitTrackMSHandle::GetMomentumL(), CandFitTrackMSHandle::GetMomentumMS(), VldTimeStamp::GetNanoSec(), CandHandle::GetNDaughters(), CalMapperFits::GetNorm(), RawRecord::GetRawHeader(), MINFast::GetREROOTEvent(), DbiResultPtr< T >::GetRowByIndex(), RawDaqHeader::GetRun(), VldTimeStamp::GetSec(), RawDaqSnarlHeader::GetSnarl(), UgliGeomHandle::GetStripHandle(), VldTimeStamp::GetTime(), VldContext::GetTimeStamp(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChannel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RecMinos::GetVldContext(), RawChannelId::GetVmm(), gMINFast, REROOT_NeuKin::IAction(), REROOT_NeuKin::INu(), Msg::kDebug, Msg::kError, StripEnd::kNegative, JobCResult::kPassed, StripEnd::kPositive, PlaneView::kU, StripEnd::kUnknown, PlaneView::kV, Msg::kWarning, StripEnd::kWhole, MSG, REROOT_Event::neukins(), REROOT_Event::neuvtxs(), DbiResultPtr< T >::NewQuery(), nt_adc, nt_adcplane, nt_attnc1, nt_attnc2, nt_attncorr, nt_attndist, nt_attnl1, nt_attnl2, nt_attnnorm, nt_clearfiber, nt_corrtime, nt_crate, nt_dircos, nt_ds, nt_halflength, nt_inshower, nt_pixel, nt_plane, nt_planeview, nt_pmtph, nt_residtime, nt_run, nt_snarl, nt_strip, nt_time, nt_timens, nt_timesec, nt_tpos, nt_track, nt_uvz, nt_vaadc, nt_vachannel, nt_vachip, nt_varc, nt_vmm, nt_wlspigtail, ntplane_adc, ntplane_dircos, ntplane_nstrip, ntplane_plane, ntplane_uvz, ntreroot_iaction, ntreroot_inu, ntreroot_p4el, ntreroot_p4mu, ntreroot_p4nu, ntreroot_p4sh, ntreroot_xyz, nttrack_adc, nttrack_begdigitstrip, nttrack_charge, nttrack_charged, nttrack_chi2, nttrack_chi2Alt, nttrack_chi2BF, nttrack_chi2Both, nttrack_chi2L, nttrack_chi2MS, nttrack_date_day, nttrack_date_hour, nttrack_date_minute, nttrack_date_month, nttrack_date_nanosecond, nttrack_date_second, nttrack_date_year, nttrack_dircos, nttrack_dircosend, nttrack_dplanebeg, nttrack_dplaneend, nttrack_ds, nttrack_fitdircos, nttrack_fitintercept, nttrack_flag, nttrack_houghchi2, nttrack_houghdircos, nttrack_iter, nttrack_maxradius, nttrack_momentum, nttrack_momentumAlt, nttrack_momentumBF, nttrack_momentumBoth, nttrack_momentumL, nttrack_momentumMS, nttrack_ndigit, nttrack_nplane, nttrack_nplane_track, nttrack_nplanefaildemux, nttrack_nstrip, nttrack_ntimefitdigit, nttrack_ntrackdigit, nttrack_ntrackstrip, nttrack_snarl_adc, nttrack_snarl_begplane, nttrack_snarl_endplane, nttrack_snarl_nplane, nttrack_snarl_nstrip, nttrack_timefitchi2, nttrack_timeslope, nttrack_utime, nttrack_uvz, nttrack_uvzend, nttrack_vtime, REROOT_NeuKin::P4El1(), REROOT_NeuKin::P4Mu1(), REROOT_NeuKin::P4Neu(), REROOT_NeuKin::P4Shw(), JobCResult::SetFailed(), JobCResult::SetWarning(), LinearFit::Weighted(), UgliStripHandle::WlsPigtail(), REROOT_NeuVtx::X(), REROOT_NeuVtx::Y(), and REROOT_NeuVtx::Z().

00228 {
00229 
00230   JobCResult result(JobCResult::kPassed);
00231 
00232 
00233   MSG("FitTrackMS", Msg::kDebug) << "FitTrackMSListModule::Ana\n";
00234 
00235   if (!fFile) {
00236     fFile = new TFile("fittrackms.root","RECREATE");
00237   
00238     fStripNt = new TTree("stripnt","StripSR Tree");
00239     fStripNt->SetAutoSave(100000);
00240     fStripNt->Branch("run",&nt_run,"run/I");
00241     fStripNt->Branch("snarl",&nt_snarl,"snarl/I");
00242     fStripNt->Branch("timesec",&nt_timesec,"timesec/I");
00243     fStripNt->Branch("timens",&nt_timens,"timens/D");
00244     fStripNt->Branch("track",&nt_track,"track/I");
00245     fStripNt->Branch("plane",&nt_plane,"plane/i2");
00246     fStripNt->Branch("planeview",&nt_planeview,"planeview/I1");
00247     fStripNt->Branch("strip",&nt_strip,"strip/i1");
00248     fStripNt->Branch("tpos",&nt_tpos,"tpos/F");
00249     fStripNt->Branch("inshower",&nt_inshower,"inshower/i1");
00250     fStripNt->Branch("adc",&nt_adc,"adc[2]/I2");
00251     fStripNt->Branch("adcplane",&nt_adcplane,"adcplane/F");
00252     fStripNt->Branch("time",&nt_time,"time[2]/D");
00253     fStripNt->Branch("corrtime",&nt_corrtime,"corrtime[2]/D");
00254     fStripNt->Branch("residtime",&nt_residtime,"residtime[2]/D");
00255     fStripNt->Branch("crate",&nt_crate,"crate[2]/I1");
00256     fStripNt->Branch("varc",&nt_varc,"varc[2]/I1");
00257     fStripNt->Branch("vmm",&nt_vmm,"vmm[2]/I1");
00258     fStripNt->Branch("vaadc",&nt_vaadc,"vaadc[2]/I1");
00259     fStripNt->Branch("vachip",&nt_vachip,"vachip[2]/I1");
00260     fStripNt->Branch("vachannel",&nt_vachannel,"vachannel[2]/I1");
00261     fStripNt->Branch("pixel",&nt_pixel,"pixel[2]/I1");
00262     fStripNt->Branch("uvz",&nt_uvz,"uvz[3]/F");
00263     fStripNt->Branch("vtxuvz",&nttrack_uvz,"vtxuvz[3]/F");
00264     fStripNt->Branch("vtxdircos",&nttrack_dircos,"vtxdircos[3]/F");
00265     fStripNt->Branch("houghdircos",&nttrack_houghdircos,"houghdircos[3]/F");
00266     fStripNt->Branch("fitdircos",&nttrack_fitdircos,"fitdircos[3]/F");
00267     fStripNt->Branch("fitintercept",&nttrack_fitintercept,"fitintercept[2]/F");
00268     fStripNt->Branch("enduvz",&nttrack_uvzend,"enduvz[3]/F");
00269     fStripNt->Branch("enddircos",&nttrack_dircosend,"enddircos[3]/F");
00270     fStripNt->Branch("dircos",&nt_dircos,"dircos[3]/F");
00271     fStripNt->Branch("clearfiber",&nt_clearfiber,"clearfiber[2]/F");
00272     fStripNt->Branch("wlspigtail",&nt_wlspigtail,"wlspigtail[2]/F");
00273     fStripNt->Branch("halflength",&nt_halflength,"halflength/F");
00274     fStripNt->Branch("timeslope",&nttrack_timeslope,"timeslope/F");
00275     fStripNt->Branch("pmtph",&nt_pmtph,"pmtph[2]/F");
00276     fStripNt->Branch("houghchi2",&nttrack_houghchi2,"houghchi2/F");
00277     fStripNt->Branch("attndist",&nt_attndist,"attndist[2]/F");
00278     fStripNt->Branch("c1",&nt_attnc1,"c1[2]/F");
00279     fStripNt->Branch("c2",&nt_attnc2,"c2[2]/F");
00280     fStripNt->Branch("l1",&nt_attnl1,"l1[2]/F");
00281     fStripNt->Branch("l2",&nt_attnl2,"l2[2]/F");
00282     fStripNt->Branch("attnnorm",&nt_attnnorm,"attnnorm[2]/F");
00283     fStripNt->Branch("attncorr",&nt_attncorr,"attncorr[2]/F");
00284     fStripNt->Branch("ds",&nt_ds,"ds/F");
00285   
00286     fPlaneNt = new TTree("planent","PlaneSR Tree");
00287     fPlaneNt->SetAutoSave(10000);
00288     fPlaneNt->Branch("run",&nt_run,"run/I");
00289     fPlaneNt->Branch("snarl",&nt_snarl,"snarl/I");
00290     fPlaneNt->Branch("timesec",&nt_timesec,"timesec/I");
00291     fPlaneNt->Branch("timens",&nt_timens,"timens/D");
00292     fPlaneNt->Branch("track",&nt_track,"track/I");
00293     fPlaneNt->Branch("nstrip",&ntplane_nstrip,"nstrip/I");
00294     fPlaneNt->Branch("adc",&ntplane_adc,"adc/I");
00295     fPlaneNt->Branch("plane",&ntplane_plane,"plane/i2");
00296     fPlaneNt->Branch("uvz",&ntplane_uvz,"uvz[3]/F");
00297     fPlaneNt->Branch("dircos",&ntplane_dircos,"dircos[3]/F");
00298   
00299     fTrackNt = new TTree("tracknt","FitTrackMS Tree");
00300     fTrackNt->SetAutoSave(10000);
00301     fTrackNt->Branch("run",&nt_run,"run/I");
00302     fTrackNt->Branch("snarl",&nt_snarl,"snarl/I");
00303     fTrackNt->Branch("timesec",&nt_timesec,"timesec/I");
00304     fTrackNt->Branch("timens",&nt_timens,"timens/D");
00305     fTrackNt->Branch("track",&nt_track,"track/I");
00306     fTrackNt->Branch("nstrip",&nttrack_nstrip,"nstrip/I");
00307     fTrackNt->Branch("ntrackstrip",&nttrack_ntrackstrip,"ntrackstrip/I");
00308     fTrackNt->Branch("ndigit",&nttrack_ndigit,"ndigit/I");
00309     fTrackNt->Branch("ntrackdigit",&nttrack_ntrackdigit,"ntrackdigit/I");
00310     fTrackNt->Branch("ntimefitdigit",&nttrack_ntimefitdigit,"ntimefitdigit/I");
00311     fTrackNt->Branch("adc",&nttrack_adc,"adc/I");
00312     fTrackNt->Branch("nplane",&nttrack_nplane,"nplane/i2");
00313     fTrackNt->Branch("nplanetrack",&nttrack_nplane_track,"nplanetrack/i2");
00314     fTrackNt->Branch("uvz",&nttrack_uvz,"uvz[3]/F");
00315     fTrackNt->Branch("dircos",&nttrack_dircos,"dircos[3]/F");
00316     fTrackNt->Branch("houghdircos",&nttrack_houghdircos,"houghdircos[3]/F");
00317     fTrackNt->Branch("fitdircos",&nttrack_fitdircos,"fitdircos[3]/F");
00318     fTrackNt->Branch("uvzend",&nttrack_uvzend,"uvzend[3]/F");
00319     fTrackNt->Branch("dircosend",&nttrack_dircosend,"dircosend[3]/F");
00320     fTrackNt->Branch("timeslope",&nttrack_timeslope,"timeslope/F");
00321     fTrackNt->Branch("timefitchi2",&nttrack_timefitchi2,"timefitchi2/F");
00322     fTrackNt->Branch("houghchi2",&nttrack_houghchi2,"houghchi2/F");
00323     fTrackNt->Branch("year",&nttrack_date_year,"year/i3");
00324     fTrackNt->Branch("month",&nttrack_date_month,"month/i2");
00325     fTrackNt->Branch("day",&nttrack_date_day,"day/i2");
00326     fTrackNt->Branch("hour",&nttrack_date_hour,"hour/i2");
00327     fTrackNt->Branch("minute",&nttrack_date_minute,"minute/i2");
00328     fTrackNt->Branch("second",&nttrack_date_second,"second/i2");
00329     fTrackNt->Branch("nanosecond",&nttrack_date_nanosecond,"nanosecond/i");
00330     fTrackNt->Branch("snarl_nstrip",&nttrack_snarl_nstrip,"snarl_nstrip/i");
00331     fTrackNt->Branch("snarl_begplane",&nttrack_snarl_begplane,"snarl_begplane/i2");
00332     fTrackNt->Branch("snarl_endplane",&nttrack_snarl_endplane,"snarl_endplane/i2");
00333     fTrackNt->Branch("snarl_nplane",&nttrack_snarl_nplane,"snarl_nplane/i2");
00334     fTrackNt->Branch("snarl_adc",&nttrack_snarl_adc,"snarl_adc/F");
00335     fTrackNt->Branch("utime",&nttrack_utime,"utime[2]/F");
00336     fTrackNt->Branch("vtime",&nttrack_vtime,"vtime[2]/F");
00337     fTrackNt->Branch("nplanefaildemux",&nttrack_nplanefaildemux,"nplanefaildemux/i2");
00338     fTrackNt->Branch("begdigitstrip",&nttrack_begdigitstrip,"begdigitstrip[2]/F");
00339     fTrackNt->Branch("dplanebeg",&nttrack_dplanebeg,"dplanebeg/I");
00340     fTrackNt->Branch("dplaneend",&nttrack_dplaneend,"dplaneend/I");
00341 
00342     fTrackNt->Branch("momentum",&nttrack_momentum,"momentum/F");
00343     fTrackNt->Branch("momentumL",&nttrack_momentumL,"momentumL/F");
00344     fTrackNt->Branch("momentumBF",&nttrack_momentumBF,"momentumBF/F");
00345     fTrackNt->Branch("momentumMS",&nttrack_momentumMS,"momentumMS/F");
00346     fTrackNt->Branch("momentumBoth",&nttrack_momentumBoth,"momentumBoth/F");
00347     fTrackNt->Branch("momentumAlt",&nttrack_momentumAlt,"momentumAlt/F");
00348     fTrackNt->Branch("chi2",&nttrack_chi2,"chi2/F");
00349     fTrackNt->Branch("chi2L",&nttrack_chi2L,"chi2L/F");
00350     fTrackNt->Branch("chi2BF",&nttrack_chi2BF,"chi2BF/F");
00351     fTrackNt->Branch("chi2MS",&nttrack_chi2MS,"chi2MS/F");
00352     fTrackNt->Branch("chi2Both",&nttrack_chi2Both,"chi2Both/F");
00353     fTrackNt->Branch("chi2Alt",&nttrack_chi2Alt,"chi2Alt/F");
00354  
00355     fTrackNt->Branch("ds",&nttrack_ds,"ds/F");
00356     fTrackNt->Branch("maxradius",&nttrack_maxradius,"maxradius/F");
00357 
00358     fTrackNt->Branch("charge",&nttrack_charge,"charge/F");
00359     fTrackNt->Branch("charged",&nttrack_charged,"charged/F");
00360     fTrackNt->Branch("flag",&nttrack_flag,"flag/I");
00361     fTrackNt->Branch("iter",&nttrack_iter,"iter/I");
00362 
00363     if (gMINFast) {
00364       fTrackNt->Branch("inu",&ntreroot_inu,"inu/I1");
00365       fTrackNt->Branch("iaction",&ntreroot_iaction,"inu/I1");
00366       fTrackNt->Branch("p4nu",&ntreroot_p4nu,"p4nu[4]/F");
00367       fTrackNt->Branch("p4sh",&ntreroot_p4sh,"p4sh[4]/F");
00368       fTrackNt->Branch("p4mu",&ntreroot_p4mu,"p4mu[4]/F");
00369       fTrackNt->Branch("p4el",&ntreroot_p4el,"p4el[4]/F");
00370       fTrackNt->Branch("xyz",&ntreroot_xyz,"xyz[3]/F");
00371     }
00372   
00373   }
00374 
00375 
00376   REROOT_Event *ev = 0;
00377   REROOT_NeuKin *rneukin = 0;
00378   REROOT_NeuVtx *rneuvtx = 0;
00379   if (gMINFast) {
00380     ev = gMINFast->GetREROOTEvent();
00381     rneukin = dynamic_cast<REROOT_NeuKin*>(ev->neukins()->First());
00382     rneuvtx = dynamic_cast<REROOT_NeuVtx*>(ev->neuvtxs()->First());
00383   }
00384 
00385   ntreroot_inu = 0;
00386   ntreroot_iaction = 0;
00387   for (int i=0; i<4; i++) {
00388     ntreroot_p4nu[i] = 0.;
00389     ntreroot_p4sh[i] = 0.;
00390     ntreroot_p4mu[i] = 0.;
00391     ntreroot_p4el[i] = 0.;
00392   }
00393   for (int i=0; i<3; i++) {
00394     ntreroot_xyz[i] = 0.;
00395   }
00396 
00397   if (rneuvtx && rneukin) {
00398     ntreroot_inu = rneukin->INu();
00399     ntreroot_iaction = rneukin->IAction();
00400     for (int i=0; i<4; i++) {
00401       ntreroot_p4nu[i] = rneukin->P4Neu()[i];
00402       ntreroot_p4sh[i] = rneukin->P4Shw()[i];
00403       ntreroot_p4mu[i] = rneukin->P4Mu1()[i];
00404       ntreroot_p4el[i] = rneukin->P4El1()[i];
00405     }
00406     ntreroot_xyz[0] = rneuvtx->X();
00407     ntreroot_xyz[1] = rneuvtx->Y();
00408     ntreroot_xyz[2] = rneuvtx->Z();
00409   }
00410 
00411   
00412 //  Int_t pixel2vach[17] = {0,3,5,14,16,7,9,10,12,11,13,6,8,17,15,2,4};
00413   Int_t vach2pixel[18] = {0,0,15,1,16,2,11,5,12,6,7,9,8,10,3,14,4,13};
00414 
00415   CandRecord* candrec = dynamic_cast<CandRecord*>
00416     (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00417   if (candrec==0) {
00418     MSG("FitTrackMS", Msg::kWarning)
00419       << "No PrimaryCandidateRecord in MOM." << endl;
00420     result.SetWarning().SetFailed();
00421     return result;
00422   }
00423 
00424   CandFitTrackListHandle *tracklist = dynamic_cast<CandFitTrackListHandle*>
00425     (candrec->FindCandHandle("CandFitTrackListHandle"));
00426   if (!tracklist) {
00427     MSG("FitTrackMS", Msg::kWarning)
00428       << "No CandFitTrackListHandle in CandRecord." << endl;
00429     return result;
00430   }
00431 
00432   CandDigitListHandle *digitlist = dynamic_cast<CandDigitListHandle*>
00433     (candrec->FindCandHandle("CandDigitListHandle"));
00434 
00435   CandSliceListHandle *slicelist = dynamic_cast<CandSliceListHandle*>
00436     (candrec->FindCandHandle("CandSliceListHandle"));
00437 
00438   nttrack_snarl_nstrip = 0;
00439   nttrack_snarl_begplane = 0;
00440   nttrack_snarl_endplane = 0;
00441   nttrack_snarl_nplane = 0;
00442   nttrack_snarl_adc = 0.;
00443 
00444   Int_t planedigit[1000];
00445   Int_t planestrip[1000];
00446   Float_t planecharge[1000];
00447   for (int i=0; i<1000; i++) {
00448     planedigit[i] = 0;
00449     planestrip[i] = 0;
00450     planecharge[i] = 0.;
00451   }
00452 
00453   if (slicelist && slicelist->GetNDaughters()>0) {
00454     TIter sliceItr(slicelist->GetDaughterIterator());
00455     CandSliceHandle *slice = dynamic_cast<CandSliceHandle*>(sliceItr());
00456     nttrack_snarl_nstrip = slice->GetNStrip();
00457     nttrack_snarl_begplane = slice->GetBegPlane();
00458     nttrack_snarl_endplane = slice->GetEndPlane();
00459     nttrack_snarl_adc = slice->GetCharge();
00460     TIter stripItr(slice->GetDaughterIterator());
00461     while (CandStripHandle *strip = dynamic_cast<CandStripHandle*>(stripItr())) {
00462       Int_t iplane = strip->GetPlane();
00463       if (iplane>=0 && iplane<1000) {
00464         planestrip[iplane]++;
00465         planedigit[iplane] += strip->GetNDigit();
00466         planecharge[iplane] += strip->GetCharge();
00467       }
00468     }
00469   }
00470 
00471   for (int i=0; i<1000; i++) {
00472     if (planecharge[i]>200.) {
00473       nttrack_snarl_nplane++;
00474     }
00475   }
00476 
00477   nttrack_nplanefaildemux = 0;
00478   for (int i=0; i<1000; i++) {
00479     if (planestrip[i]>0 && (Float_t)(planedigit[i])/(Float_t)(planestrip[i])<1.2) {
00480       nttrack_nplanefaildemux++;
00481     }
00482   }
00483 
00484 
00485   // we require a DaqSnarl (ie. has RawDigitDataBlock) RawRecord
00486   RawRecord *rr = dynamic_cast<RawRecord *>(mom->GetFragment("RawRecord",0,"DaqSnarl"));
00487   if (rr == 0) {
00488     MSG("FitTrackMS", Msg::kWarning) << "No RawRecord in MOM." << endl;
00489     return result;
00490   }
00491 
00492   const RawDaqSnarlHeader* snarlHdr =
00493      dynamic_cast<const RawDaqSnarlHeader*>(rr->GetRawHeader());
00494   if (snarlHdr) {
00495      nt_run = snarlHdr->GetRun();
00496      nt_snarl = snarlHdr->GetSnarl();
00497   }
00498 
00499 
00500   const RawDigitDataBlock *rddb = dynamic_cast<const RawDigitDataBlock *>
00501                         (rr->FindRawBlock("RawDigitDataBlock"));
00502   if (rddb == 0) {
00503     MSG("FitTrackMS", Msg::kWarning) << "No RawDigitDataBlock in RawRecord." << endl;
00504     return result;
00505 
00506   }
00507 
00508   TIter trackItr(tracklist->GetDaughterIterator());
00509 
00510   nt_timesec = -1;
00511   nt_timens = -1.;
00512   if (digitlist) {
00513     nt_timens = digitlist->GetAbsTime();
00514   }
00515 
00516   candrec->GetVldContext()->GetTimeStamp().GetTime(kTRUE, 0, &nttrack_date_hour, &nttrack_date_minute, &nttrack_date_second);
00517   candrec->GetVldContext()->GetTimeStamp().GetDate(kTRUE, 0, &nttrack_date_year, &nttrack_date_month, &nttrack_date_day);
00518 
00519   nttrack_date_nanosecond = candrec->GetVldContext()->GetTimeStamp().GetNanoSec();
00520 
00521   nttrack_nstrip = 0;
00522   nttrack_ndigit = 0;
00523   nttrack_nplane = 0;
00524   nttrack_nplane_track = 0;
00525   nttrack_adc = 0;
00526   nttrack_uvz[0] = 0.;
00527   nttrack_uvz[1] = 0.;
00528   nttrack_uvz[2] = 0.;
00529   nttrack_dircos[0] = 0.;
00530   nttrack_dircos[1] = 0.;
00531   nttrack_dircos[2] = 0.;
00532   nttrack_uvzend[0] = 0.;
00533   nttrack_uvzend[1] = 0.;
00534   nttrack_uvzend[2] = 0.;
00535   nttrack_dircosend[0] = 0.;
00536   nttrack_dircosend[1] = 0.;
00537   nttrack_dircosend[2] = 0.;
00538   nttrack_houghdircos[0] = 0.;
00539   nttrack_houghdircos[1] = 0.;
00540   nttrack_houghdircos[2] = 0.;
00541   nttrack_fitdircos[0] = 0.;
00542   nttrack_fitdircos[1] = 0.;
00543   nttrack_fitdircos[2] = 0.;
00544   nttrack_fitintercept[0] = 0.;
00545   nttrack_fitintercept[1] = 0.;
00546   nttrack_houghchi2 = 0.;
00547   nttrack_utime[0] = 0.;
00548   nttrack_utime[1] = 0.;
00549   nttrack_vtime[0] = 0.;
00550   nttrack_vtime[1] = 0.;
00551   nttrack_dplanebeg = 0;
00552   nttrack_dplaneend = 0;
00553   nttrack_momentum = 0.;
00554   nttrack_ds = 0.;
00555   nttrack_maxradius = 0.;
00556   nttrack_begdigitstrip[0] = 0.;
00557   nttrack_begdigitstrip[1] = 0.;
00558   nttrack_ntrackstrip = 0;
00559   nttrack_ntrackdigit = 0;
00560   nttrack_ntimefitdigit = 0;
00561   nttrack_dircosend[0] = 0.;
00562   nttrack_dircosend[1] = 0.;
00563   nttrack_dircosend[2] = 0.;
00564   nttrack_houghdircos[0] = 0.;
00565   nttrack_houghdircos[1] = 0.;
00566   nttrack_houghdircos[2] = 0.;
00567   nttrack_houghchi2 = 0.;
00568   nttrack_nplane_track = 0;
00569   nttrack_timefitchi2 = 0;
00570   nttrack_timeslope = 0.;
00571 
00572   nttrack_momentumL = 0.;
00573   nttrack_momentumMS = 0.;
00574   nttrack_momentumBF = 0.;
00575   nttrack_momentumBoth = 0.;
00576   nttrack_momentumAlt = 0.;
00577   nttrack_chi2 = 0.;
00578   nttrack_chi2L = 0.;
00579   nttrack_chi2MS = 0.;
00580   nttrack_chi2BF = 0.;
00581   nttrack_chi2Both = 0.;
00582   nttrack_chi2Alt = 0.;
00583   
00584   nttrack_flag = 0;
00585   nttrack_iter = 0;
00586   nttrack_charge = 0.;
00587   nttrack_charged = 0.;
00588 
00589   
00590   DbiResultPtr<CalMapperFits> fMapperFitsPtr;
00591   fMapperFitsPtr.NewQuery(*candrec->GetVldContext(),0);
00592 
00593   Int_t itrack=0;
00594   while (CandFitTrackHandle *track = dynamic_cast<CandFitTrackHandle*>(trackItr())) {
00595     CandFitTrackMSHandle *fittrackms = 0;
00596     if (track->InheritsFrom("CandFitTrackMSHandle")) {
00597       fittrackms = dynamic_cast<CandFitTrackMSHandle*>(track);
00598     }
00599     itrack++;
00600     nt_track = itrack;
00601     nttrack_nstrip = track->GetNStrip();
00602     nttrack_ndigit = track->GetNDigit();
00603     nttrack_nplane = track->GetNPlane();
00604     nttrack_nplane_track = 0;
00605     nttrack_adc = 0;
00606     nttrack_uvz[0] = track->GetVtxU();
00607     nttrack_uvz[1] = track->GetVtxV();
00608     nttrack_uvz[2] = track->GetVtxZ();
00609     nttrack_dircos[0] = track->GetDirCosU();
00610     nttrack_dircos[1] = track->GetDirCosV();
00611     nttrack_dircos[2] = track->GetDirCosZ();
00612     Int_t endplane = track->GetEndPlane();
00613     nttrack_uvzend[0] = track->GetU(endplane);
00614     nttrack_uvzend[1] = track->GetV(endplane);
00615     nttrack_uvzend[2] = track->GetZ(endplane);
00616     nttrack_dircosend[0] = 0.;
00617     nttrack_dircosend[1] = 0.;
00618     nttrack_dircosend[2] = 0.;
00619     nttrack_houghdircos[0] = 0.;
00620     nttrack_houghdircos[1] = 0.;
00621     nttrack_houghdircos[2] = 0.;
00622     nttrack_fitdircos[0] = 0.;
00623     nttrack_fitdircos[1] = 0.;
00624     nttrack_fitdircos[2] = 0.;
00625     nttrack_fitintercept[0] = 0.;
00626     nttrack_fitintercept[1] = 0.;
00627     nttrack_houghchi2 = 999999.;
00628     nttrack_utime[0] = 0.;
00629     nttrack_utime[1] = 0.;
00630     nttrack_vtime[0] = 0.;
00631     nttrack_vtime[1] = 0.;
00632     nttrack_dplanebeg = track->GetBegPlane(PlaneView::kU)-track->GetBegPlane(PlaneView::kV);
00633     nttrack_dplaneend = track->GetEndPlane(PlaneView::kU)-track->GetEndPlane(PlaneView::kV);
00634     nttrack_momentum = track->GetMomentum();
00635     nttrack_ds = 0;   //track->GetdS();
00636     nttrack_maxradius = 0.;
00637     Float_t totcharge[2][2] = {{0.,0.},{0.,0.}};
00638     nttrack_begdigitstrip[0] = (Float_t)(planedigit[track->GetBegPlane(PlaneView::kU)])/(Float_t)(planestrip[track->GetBegPlane(PlaneView::kU)]);
00639     nttrack_begdigitstrip[1] = (Float_t)(planedigit[track->GetBegPlane(PlaneView::kV)])/(Float_t)(planestrip[track->GetBegPlane(PlaneView::kV)]);
00640 
00641     if (fittrackms) {
00642 
00643       nttrack_momentumL = fittrackms->GetMomentumL();
00644       nttrack_momentumBF = fittrackms->GetMomentumBF();
00645       nttrack_momentumMS = fittrackms->GetMomentumMS();
00646       nttrack_momentumBoth = fittrackms->GetMomentumBoth();
00647       nttrack_momentumAlt = fittrackms->GetMomentumAlt();
00648 
00649       nttrack_chi2 = fittrackms->GetChi2();
00650       nttrack_chi2L = fittrackms->GetChi2L();
00651       nttrack_chi2BF = fittrackms->GetChi2BF();
00652       nttrack_chi2MS = fittrackms->GetChi2MS();
00653       nttrack_chi2Both = fittrackms->GetChi2Both();
00654       nttrack_chi2Alt = fittrackms->GetChi2Alt();
00655 
00656       nttrack_flag = fittrackms->GetFlag();
00657       nttrack_iter = fittrackms->GetIter();
00658       nttrack_charge = fittrackms->GetEMCharge();
00659       nttrack_charged = fittrackms->GetEMChargeD();
00660     }
00661     nttrack_timeslope = fabs(track->GetTimeSlope());
00662 
00663     Double_t timeslope = fabs(track->GetTimeSlope());
00664     Double_t timeoffset = track->GetTimeOffset();
00665 
00666     TIter stripItr(track->GetDaughterIterator());
00667 
00668     Double_t uzfit[1000],ufit[1000],uwfit[1000],uph[1000];
00669     Double_t vzfit[1000],vfit[1000],vwfit[1000],vph[1000];
00670   
00671     for (int i=0; i<1000; i++) {
00672       uzfit[i] = 0.;
00673       ufit[i] = 0.;
00674       uwfit[i] = 0.;
00675       uph[i] = 0.;
00676       vzfit[i] = 0.;
00677       vfit[i] = 0.;
00678       vwfit[i] = 0.;
00679       vph[i] = 0.;
00680     }
00681 
00682     stripItr.Reset();
00683     while (CandStripHandle *strip = dynamic_cast<CandStripHandle*>(stripItr())) {
00684       nt_plane = strip->GetPlane();
00685       nt_tpos = strip->GetTPos();
00686       if (strip->GetPlaneView()==PlaneView::kU) {
00687         if (strip->GetNDigit(StripEnd::kNegative)>0) {
00688           totcharge[0][0] += strip->GetCharge(StripEnd::kNegative);
00689           nttrack_utime[0] += strip->GetCharge(StripEnd::kNegative)*track->GetT(nt_plane,StripEnd::kNegative);
00690         }
00691         if (strip->GetNDigit(StripEnd::kPositive)>0) {
00692           totcharge[0][1] += strip->GetCharge(StripEnd::kPositive);
00693           nttrack_utime[1] += strip->GetCharge(StripEnd::kPositive)*track->GetT(nt_plane,StripEnd::kPositive);
00694         }
00695         uzfit[nt_plane] = strip->GetZPos();
00696         ufit[nt_plane] += nt_tpos*strip->GetCharge();
00697         uph[nt_plane] += strip->GetCharge();
00698         uwfit[nt_plane] = 1.;
00699       } else if (strip->GetPlaneView()==PlaneView::kV) {
00700         if (strip->GetNDigit(StripEnd::kNegative)>0) {
00701           totcharge[1][0] += strip->GetCharge(StripEnd::kNegative);
00702           nttrack_vtime[0] += strip->GetCharge(StripEnd::kNegative)*track->GetT(nt_plane,StripEnd::kNegative);
00703         }
00704         if (strip->GetNDigit(StripEnd::kPositive)>0) {
00705           totcharge[1][1] += strip->GetCharge(StripEnd::kPositive);
00706           nttrack_vtime[1] += strip->GetCharge(StripEnd::kPositive)*track->GetT(nt_plane,StripEnd::kPositive);
00707         }
00708         vzfit[nt_plane] = strip->GetZPos();
00709         vfit[nt_plane] += nt_tpos*strip->GetCharge();
00710         vph[nt_plane] += strip->GetCharge();
00711         vwfit[nt_plane] = 1.;
00712       }
00713     }
00714 
00715     for (int i=0; i<2; i++) {
00716       if (totcharge[0][i]>0.) {
00717         nttrack_utime[i] /= totcharge[0][i];
00718       }
00719       else {
00720         nttrack_utime[i] = -1.;
00721       }
00722       if (totcharge[1][i]>0.) {
00723         nttrack_vtime[i] /= totcharge[1][i];
00724       }
00725       else {
00726         nttrack_vtime[i] = -1.;
00727       }
00728     }
00729 
00730     for (int i=0; i<1000; i++) {
00731       if (uph[i]>0.) {
00732         ufit[i] /= uph[i];
00733       }
00734       if (vph[i]>0.) {
00735         vfit[i] /= vph[i];
00736       }
00737     }
00738 
00739     Double_t uparm[2],ueparm[2];
00740     Double_t vparm[2],veparm[2];
00741 
00742     LinearFit::Weighted(1000,uzfit,ufit,uwfit,uparm,ueparm);
00743     LinearFit::Weighted(1000,vzfit,vfit,vwfit,vparm,veparm);
00744 
00745     Double_t dudz = uparm[1];
00746     Double_t dvdz = vparm[1];
00747     nttrack_fitdircos[0] = dudz/sqrt(1.+dudz*dudz+dvdz*dvdz);
00748     nttrack_fitdircos[1] = dvdz/sqrt(1.+dudz*dudz+dvdz*dvdz);
00749     nttrack_fitdircos[2] = 1./sqrt(1.+dudz*dudz+dvdz*dvdz);
00750 
00751     nttrack_fitintercept[0] = uparm[0];
00752     nttrack_fitintercept[1] = vparm[0];
00753 
00754     if (track->GetTimeSlope()<0.) {
00755       nttrack_fitdircos[0] *= -1.;
00756       nttrack_fitdircos[1] *= -1.;
00757       nttrack_fitdircos[2] *= -1.;
00758     }
00759 
00760     stripItr.Reset();
00761     while (CandStripHandle *strip = dynamic_cast<CandStripHandle*>(stripItr())) {
00762       for (int i=0; i<2; i++) {
00763         nt_adc[i] = -1;
00764         nt_time[i] = -1.;
00765         nt_corrtime[i] = -1.;
00766         nt_residtime[i] = -1.;
00767         nt_crate[i] = -1;
00768         nt_varc[i] = -1;
00769         nt_vmm[i] = -1;
00770         nt_vaadc[i] = -1;
00771         nt_vachip[i] = -1;
00772         nt_vachannel[i] = -1;
00773         nt_pixel[i] = -1;
00774         nt_pmtph[i] = 0.;
00775       }
00776       nt_plane = strip->GetPlane();
00777       nt_planeview = (Int_t)strip->GetPlaneView();
00778       nt_strip = strip->GetStrip();
00779       nt_tpos = strip->GetTPos();
00780       nt_inshower = track->IsInShower(strip);
00781       nt_uvz[0] = track->GetU(nt_plane);
00782       nt_uvz[1] = track->GetV(nt_plane);
00783       nt_uvz[2] = track->GetZ(nt_plane);
00784       //      if (tracksr) {
00785       //        nt_dircos[0] = tracksr->GetDirCosU(nt_plane);
00786       //        nt_dircos[1] = tracksr->GetDirCosV(nt_plane);
00787       //        nt_dircos[2] = tracksr->GetDirCosZ(nt_plane);
00788       //      }
00789       nt_adcplane = planecharge[nt_plane];
00790       nt_ds = 0; //track->GetdS(nt_plane);
00791       TIter digitItr(strip->GetDaughterIterator());
00792       PlexStripEndId *plexstripendid=0;
00793       UgliGeomHandle *ugh = 0;
00794       while (CandDigitHandle *digit = dynamic_cast<CandDigitHandle*>(digitItr())) {
00795         if (!plexstripendid) {
00796           plexstripendid = new PlexStripEndId(digit->GetPlexSEIdAltL().GetBestSEId());
00797           ugh = new UgliGeomHandle(*digit->GetVldContext());
00798         }
00799         const RawDigit *rd = rddb->At(digit->GetRawDigitIndex());
00800         if (rd) nttrack_adc += rd->GetADC();
00801         switch (digit->GetPlexSEIdAltL().GetBestSEId().GetEnd()) {
00802         case StripEnd::kNegative: case StripEnd::kWhole: case StripEnd::kUnknown:
00803           nt_time[0] = strip->GetBegTime(digit->GetPlexSEIdAltL().GetBestSEId().GetEnd());
00804           nt_corrtime[0] = track->GetT(strip->GetPlane(),StripEnd::kNegative);
00805           nt_residtime[0] = nt_corrtime[0]-(timeoffset+timeslope*nt_ds);
00806           if (rd) {
00807             RawChannelId rawid = rd->GetChannel();
00808             nt_timesec = rd->GetCrateT0().GetSec();
00809             nt_adc[0] = rd->GetADC();
00810             nt_crate[0] = rawid.GetCrate();
00811             nt_varc[0] = rawid.GetVarcId();
00812             nt_vmm[0] = rawid.GetVmm();
00813             nt_vaadc[0] = rawid.GetVaAdcSel();
00814             nt_vachip[0] = rawid.GetVaChip();
00815             nt_vachannel[0] = rawid.GetVaChannel();
00816             nt_pixel[0] = -1;
00817             if (nt_vachannel[0]>=2 && nt_vachannel[0]<=17) {
00818               nt_pixel[0] = vach2pixel[nt_vachannel[0]];
00819             }
00820           }
00821           break;
00822         case StripEnd::kPositive:
00823           nt_time[1] = strip->GetBegTime(digit->GetPlexSEIdAltL().GetBestSEId().GetEnd());
00824           nt_corrtime[1] = track->GetT(strip->GetPlane(),StripEnd::kPositive);
00825           nt_residtime[1] = nt_corrtime[1]-(timeoffset+timeslope*nt_ds);
00826           if (rd) {
00827             RawChannelId rawid = rd->GetChannel();
00828             nt_timesec = rd->GetCrateT0().GetSec();
00829             nt_adc[1] = rd->GetADC();
00830             nt_crate[1] = rawid.GetCrate();
00831             nt_varc[1] = rawid.GetVarcId();
00832             nt_vmm[1] = rawid.GetVmm();
00833             nt_vaadc[1] = rawid.GetVaAdcSel();
00834             nt_vachip[1] = rawid.GetVaChip();
00835             nt_vachannel[1] = rawid.GetVaChannel();
00836             nt_pixel[1] = -1;
00837             if (nt_vachannel[1]>=2 && nt_vachannel[1]<=17) {
00838               nt_pixel[1] = vach2pixel[nt_vachannel[1]];
00839             }
00840           }
00841           break;
00842         default:
00843           MSG("FitTrackMS",Msg::kError) << "undefined StripEnd " << digit->GetPlexSEIdAltL().GetBestSEId().GetEnd() << "\n";
00844           break;
00845         }
00846       }
00847       const CalMapperFits *mapcal[2];
00848       mapcal[0] = fMapperFitsPtr.GetRowByIndex(strip->GetStripEndId(StripEnd::kNegative).BuildPlnStripEndKey());
00849       mapcal[1] = fMapperFitsPtr.GetRowByIndex(strip->GetStripEndId(StripEnd::kPositive).BuildPlnStripEndKey());
00850       nt_attnc1[0] = 0.;
00851       nt_attnc2[0] = 0.;
00852       nt_attnl1[0] = 0.;
00853       nt_attnl2[0] = 0.;
00854       nt_attnnorm[0] = 0.;
00855       nt_attnc1[1] = 0.;
00856       nt_attnc2[1] = 0.;
00857       nt_attnl1[1] = 0.;
00858       nt_attnl2[1] = 0.;
00859       nt_attnnorm[1] = 0.;
00860       if (mapcal[0]) {
00861         nt_attnc1[0] = mapcal[0]->GetC1();
00862         nt_attnc2[0] = mapcal[0]->GetC2();
00863         nt_attnl1[0] = mapcal[0]->GetLambda1()/100.;
00864         nt_attnl2[0] = mapcal[0]->GetLambda2()/100.;
00865         nt_attnnorm[0] = mapcal[0]->GetNorm();
00866       }
00867       if (mapcal[1]) {
00868         nt_attnc1[1] = mapcal[1]->GetC1();
00869         nt_attnc2[1] = mapcal[1]->GetC2();
00870         nt_attnl1[1] = mapcal[1]->GetLambda1()/100.;
00871         nt_attnl2[1] = mapcal[1]->GetLambda2()/100.;
00872         nt_attnnorm[1] = mapcal[1]->GetNorm();
00873       }
00874       UgliStripHandle striphandle = ugh->GetStripHandle(*plexstripendid);
00875       nt_clearfiber[0] = striphandle.ClearFiber(StripEnd::kNegative);
00876       nt_clearfiber[1] = striphandle.ClearFiber(StripEnd::kPositive);
00877       nt_wlspigtail[0] = striphandle.WlsPigtail(StripEnd::kNegative);
00878       nt_wlspigtail[1] = striphandle.WlsPigtail(StripEnd::kPositive);
00879       nt_halflength = striphandle.GetHalfLength();
00880       nt_attndist[0] = 0.;
00881       nt_attndist[1] = 0.;
00882       if (strip->GetPlaneView()==PlaneView::kU) {
00883         nt_attndist[0] = nt_halflength+nt_wlspigtail[0]-nt_uvz[1];
00884         nt_attndist[1] = nt_halflength+nt_wlspigtail[1]+nt_uvz[1];
00885       }
00886       if (strip->GetPlaneView()==PlaneView::kV) {
00887         nt_attndist[0] = nt_halflength+nt_wlspigtail[0]+nt_uvz[0];
00888         nt_attndist[1] = nt_halflength+nt_wlspigtail[1]-nt_uvz[0];
00889       }
00890       for (int iside=0; iside<2; iside++) {
00891         nt_attncorr[iside] = nt_attnc1[iside]*exp(-nt_attndist[iside]/nt_attnl1[iside])+nt_attnc2[iside]*exp(-nt_attndist[iside]/nt_attnl2[iside]);
00892       }
00893       if (digitlist) {
00894         TIter alldigitItr(digitlist->GetDaughterIterator());
00895         while (CandDigitHandle *digit = dynamic_cast<CandDigitHandle*>(alldigitItr())) {
00896           const RawDigit *rd = rddb->At(digit->GetRawDigitIndex());
00897           if (rd) {
00898             for (int i=0; i<2; i++) {
00899               RawChannelId rawid = rd->GetChannel();
00900               if (rawid.GetCrate()==nt_crate[i] &&
00901                   rawid.GetVarcId()==nt_varc[i] &&
00902                   rawid.GetVmm()==nt_vmm[i] &&
00903                   rawid.GetVaAdcSel()==nt_vaadc[i] &&
00904                   rawid.GetVaChip()==nt_vachip[i]) {
00905                 nt_pmtph[i] += digit->GetCharge();
00906               }
00907             }
00908           }
00909         }
00910       }
00911       delete plexstripendid;
00912       delete ugh;
00913       if (nt_uvz[0]*nt_uvz[0]+nt_uvz[1]*nt_uvz[1]>nttrack_maxradius*nttrack_maxradius) {
00914         nttrack_maxradius = sqrt(nt_uvz[0]*nt_uvz[0]+nt_uvz[1]*nt_uvz[1]);
00915       }
00916       fStripNt->Fill();
00917     }
00918 
00919 
00920 
00921     fTrackNt->Fill();
00922 
00923     for (Int_t iplane = track->GetBegPlane(); iplane<=track->GetEndPlane(); iplane++) {
00924       ntplane_nstrip = 0;
00925       ntplane_adc = 0;
00926       ntplane_plane = iplane;
00927       ntplane_uvz[0] = 0.;
00928       ntplane_uvz[1] = 0.;
00929       ntplane_uvz[2] = 0.;
00930       ntplane_dircos[0] = 0.;
00931       ntplane_dircos[1] = 0.;
00932       ntplane_dircos[2] = 0.;
00933       Float_t totalcharge=0.;
00934       stripItr.Reset();
00935       while (CandStripHandle *strip = dynamic_cast<CandStripHandle*>(stripItr())) {
00936         if (strip->GetPlane()==iplane) {
00937           ntplane_nstrip++;
00938           totalcharge += strip->GetCharge();
00939           ntplane_uvz[0] += strip->GetCharge()*track->GetU(iplane);
00940           ntplane_uvz[1] += strip->GetCharge()*track->GetV(iplane);
00941           ntplane_uvz[2] += strip->GetCharge()*track->GetZ(iplane);
00942           //          if (tracksr) {
00943           //            ntplane_dircos[0] += strip->GetCharge()*tracksr->GetDirCosU(iplane);
00944           //            ntplane_dircos[1] += strip->GetCharge()*tracksr->GetDirCosV(iplane);
00945           //            ntplane_dircos[2] += strip->GetCharge()*tracksr->GetDirCosZ(iplane);
00946           //          }
00947           TIter digitItr(strip->GetDaughterIterator());
00948           while (CandDigitHandle *digit = dynamic_cast<CandDigitHandle*>(digitItr())) {
00949             const RawDigit *rd = rddb->At(digit->GetRawDigitIndex());
00950             if (rd) ntplane_adc += rd->GetADC();
00951           }
00952         }
00953       }
00954       if (ntplane_nstrip>0) {
00955         for (int i=0; i<3; i++) {
00956           ntplane_uvz[i] /= totalcharge;
00957           ntplane_dircos[i] /= totalcharge;
00958         }
00959         fPlaneNt->Fill();
00960       }
00961     }
00962  
00963   }
00964 
00965   if (!itrack) {
00966     nt_track = -1;
00967     fTrackNt->Fill();
00968   }
00969 
00970   fFile->Write("",TObject::kOverwrite);
00971   
00972   return result;
00973 }

void FitTrackMSListModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 209 of file FitTrackMSListModule.cxx.

References AlgHandle::GetAlgConfig(), AlgFactory::GetAlgHandle(), AlgFactory::GetInstance(), Msg::kDebug, Registry::LockValues(), Registry::Merge(), MSG, and Registry::UnLockValues().

00210 {
00211   // Configures the module, given a registry.  Uses AlgConfig
00212 
00213   MSG("FitTrackMS", Msg::kDebug) << "FitTrackMSListModule::Config" <<
00214     endl;
00215   
00216   // Get Singleton instance of AlgFactory.
00217   AlgFactory &af = AlgFactory::GetInstance();
00218   AlgHandle adf = af.GetAlgHandle("AlgFitTrackMS","default");
00219   AlgConfig &acdf = adf.GetAlgConfig();
00220 
00221   acdf.UnLockValues();
00222   acdf.Merge(r);
00223   acdf.LockValues();
00224 }

const Registry & FitTrackMSListModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 163 of file FitTrackMSListModule.cxx.

References Munits::cm, JobCModule::GetName(), Munits::GeV, Msg::kDebug, Registry::LockValues(), Munits::m, MSG, Registry::Set(), and Registry::UnLockValues().

00164 {
00165   // Returns registry item containing default configuration
00166   // for the module
00167 
00168   MSG("FitTrackMS",Msg::kDebug) <<
00169     "FitTrackMSListModule::DefaultConfig" << endl;
00170 
00171   static Registry r;
00172 
00173   std::string name = this->JobCModule::GetName();
00174   name += ".config.default";
00175   r.SetName(name.c_str());
00176   r.UnLockValues();
00177 
00178   // Set Nofit to nonzero for testing purposes to skip fitting step.
00179   r.Set("Nofit",0);
00180   r.Set("NoBField",0);
00181   r.Set("NoMS",0);
00182   r.Set("BothFit",1);
00183   r.Set("FullAna",0);
00184   r.Set("BFisFlipped",1);
00185   
00186   // physical constants and data
00187   r.Set("PosErr",1.18*Munits::cm);
00188   r.Set("XZero",1.76*Munits::cm);
00189   r.Set("Dedx",1.454*Munits::GeV / Munits::m);
00190   r.Set("SuperModGapSize",1.593*Munits::m);
00191   r.Set("SuperModSkippedPlane",250);
00192 
00193   // parameters
00194   r.Set("MaxHits",400);
00195   r.Set("MinHits",5);
00196   r.Set("MaxP",100*Munits::GeV);
00197   r.Set("MinP",0.01*Munits::GeV);
00198   r.Set("MaxIter",30);
00199   r.Set("InShower",99);
00200   r.Set("LTolerance",.01);
00201   r.Set("PTolerance",.01);
00202 
00203   r.LockValues();
00204 
00205   return r;
00206 }

void FitTrackMSListModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 975 of file FitTrackMSListModule.cxx.

References fFile.

00976 {
00977   if (fFile) {
00978     fFile->Write("",TObject::kOverwrite);
00979     fFile->Close();
00980   }
00981 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 89 of file FitTrackMSListModule.cxx.

References CandRecord::FindCandHandle(), fListOut, AlgFactory::GetAlgHandle(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), CandHandle::GetName(), Msg::kDebug, JobCResult::kPassed, Msg::kVerbose, Msg::kWarning, CandFitTrackMSList::MakeCandidate(), MSG, CandRecord::SecureCandHandle(), CandContext::SetCandRecord(), CandContext::SetDataIn(), JobCResult::SetFailed(), CandHandle::SetName(), CandHandle::SetTitle(), and JobCResult::SetWarning().

00090 {
00091   JobCResult result(JobCResult::kPassed);
00092 
00093    MSG("FitTrackMS", Msg::kVerbose) << "FitTrackMSListModule::Reco\n";
00094 
00095 // Find PrimaryCandidateRecord fragment in MOM.
00096    CandRecord *candrec = dynamic_cast<CandRecord *>
00097              (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00098    if (candrec == 0) {
00099      MSG("FitTrackMS", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00100                                       << endl;
00101      result.SetWarning().SetFailed();
00102      return result;
00103    }
00104 
00105 // Find CandSliceList fragment in PrimaryCandidateRecord.
00106    MSG("FitTrackMS", Msg::kVerbose)
00107       << "CandSliceListHandle *cslh = (CandSliceListHandle *) "
00108       << "candrec->FindCandHandle(\"CandSliceListHandle\", "
00109       << "fListIn.Data());" << endl;
00110    /* create a pointer which is a slice list handle obtained from the
00111       candidate record.  dynamic cast deals with the function
00112       FindCANDIDATEHandle ; cast casts the type from generic handle to 
00113       CandidateSliceListHandle -- this makes something which is a
00114       pointer to a handle*/
00115    CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00116       (candrec->FindCandHandle("CandSliceListHandle"));
00117    CandTrackListHandle *ctlh = dynamic_cast<CandTrackListHandle *>
00118       (candrec->FindCandHandle("CandTrackListHandle"));
00119 
00120    TObjArray cxin;
00121    cxin.Add(cslh);
00122    cxin.Add(ctlh);
00123 
00124 
00125 // Get Singleton instance of AlgFactory.
00126    MSG("FitTrackMS", Msg::kDebug)
00127                       << "Get Singleton instance of AlgFactory." << endl
00128                << "AlgFactory &af = AlgFactory::GetInstance();" << endl;
00129    /* &af is a reference to an algfactory object, GetInstance returns
00130       a reference to an AlgFactory*/
00131    AlgFactory &af = AlgFactory::GetInstance();
00132 
00133 // Build a CandFitTrackMSList containing all CandFitTrackMSs in Frame.
00134    MSG("FitTrackMS", Msg::kDebug)
00135         << "Ask AlgFactory for Singleton AlgFitTrackMSList instance." << endl
00136    << "AlgHandle adlh = af.GetAlgHandle(\"AlgFitTrackMSList\", \"default\");"
00137                                                                 << endl;
00138    AlgHandle adlh = af.GetAlgHandle("AlgFitTrackMSList", "default");
00139 
00140    MSG("FitTrackMS", Msg::kDebug) << "CandContext cx(this);" << endl;
00141    CandContext cx(this, mom);
00142 
00143    MSG("FitTrackMS", Msg::kDebug) << "cx.SetDataIn(cslh);" << endl;
00144    cx.SetDataIn(&cxin);
00145    cx.SetCandRecord(candrec);
00146 
00147 
00148    MSG("FitTrackMS", Msg::kDebug)
00149             << "ctllh = CandFitTrackMSList::MakeCandidate(adlh, cx);" << endl;
00150    CandFitTrackMSListHandle ctllh = CandFitTrackMSList::MakeCandidate(adlh, cx);
00151    ctllh.SetName(fListOut.Data());
00152    ctllh.SetTitle(TString("Created by FitTrackMSListModule from ").
00153                  Append(ctlh->GetName()));
00154 
00155 // Give the CandHandle to the CandRecord
00156    MSG("FitTrackMS", Msg::kDebug) << "candrec->SecureCandHandle(ctllh);"
00157                                                                 << endl;
00158    candrec->SecureCandHandle(ctllh);
00159 
00160    return result;
00161 }


Member Data Documentation

TFile* FitTrackMSListModule::fFile [private]

Definition at line 44 of file FitTrackMSListModule.h.

Referenced by Ana(), and EndJob().

TString FitTrackMSListModule::fListIn [private]

Definition at line 41 of file FitTrackMSListModule.h.

TString FitTrackMSListModule::fListOut [private]

Definition at line 42 of file FitTrackMSListModule.h.

Referenced by Reco().

Definition at line 48 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 46 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 47 of file FitTrackMSListModule.h.

Referenced by Ana().

Int_t FitTrackMSListModule::nt_adc[2] [private]

Definition at line 60 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 61 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nt_attnc1[2] [private]

Definition at line 79 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nt_attnc2[2] [private]

Definition at line 80 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nt_attncorr[2] [private]

Definition at line 84 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nt_attndist[2] [private]

Definition at line 78 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nt_attnl1[2] [private]

Definition at line 81 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nt_attnl2[2] [private]

Definition at line 82 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nt_attnnorm[2] [private]

Definition at line 83 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 74 of file FitTrackMSListModule.h.

Referenced by Ana().

Double_t FitTrackMSListModule::nt_corrtime[2] [private]

Definition at line 63 of file FitTrackMSListModule.h.

Referenced by Ana().

Int_t FitTrackMSListModule::nt_crate[2] [private]

Definition at line 65 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nt_dircos[3] [private]

Definition at line 73 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nt_ds [private]

Definition at line 85 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 76 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 59 of file FitTrackMSListModule.h.

Referenced by Ana().

Int_t FitTrackMSListModule::nt_pixel[2] [private]

Definition at line 71 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 55 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 56 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nt_pmtph[2] [private]

Definition at line 77 of file FitTrackMSListModule.h.

Referenced by Ana().

Double_t FitTrackMSListModule::nt_residtime[2] [private]

Definition at line 64 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 50 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 51 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 57 of file FitTrackMSListModule.h.

Referenced by Ana().

Double_t FitTrackMSListModule::nt_time[2] [private]

Definition at line 62 of file FitTrackMSListModule.h.

Referenced by Ana().

Double_t FitTrackMSListModule::nt_timens [private]

Definition at line 53 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 52 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nt_tpos [private]

Definition at line 58 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 54 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nt_uvz[3] [private]

Definition at line 72 of file FitTrackMSListModule.h.

Referenced by Ana().

Int_t FitTrackMSListModule::nt_vaadc[2] [private]

Definition at line 68 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 70 of file FitTrackMSListModule.h.

Referenced by Ana().

Int_t FitTrackMSListModule::nt_vachip[2] [private]

Definition at line 69 of file FitTrackMSListModule.h.

Referenced by Ana().

Int_t FitTrackMSListModule::nt_varc[2] [private]

Definition at line 66 of file FitTrackMSListModule.h.

Referenced by Ana().

Int_t FitTrackMSListModule::nt_vmm[2] [private]

Definition at line 67 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 75 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 137 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 140 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 136 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 138 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::ntplane_uvz[3] [private]

Definition at line 139 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 128 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 127 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 132 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 131 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 129 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 130 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::ntreroot_xyz[3] [private]

Definition at line 133 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 92 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 121 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 157 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 158 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 148 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 153 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 150 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 152 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 149 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 151 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 108 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 109 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 110 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 107 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 112 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 111 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 106 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 96 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 101 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 122 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 123 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 125 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 98 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 99 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 155 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 104 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 97 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 160 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 105 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 124 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 146 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 143 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 145 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 142 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 144 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 89 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 93 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 94 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 120 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 87 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 91 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 90 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 88 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 117 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 114 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 115 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 116 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 113 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 103 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 102 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 118 of file FitTrackMSListModule.h.

Referenced by Ana().

Float_t FitTrackMSListModule::nttrack_uvz[3] [private]

Definition at line 95 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 100 of file FitTrackMSListModule.h.

Referenced by Ana().

Definition at line 119 of file FitTrackMSListModule.h.

Referenced by Ana().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1