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

NtpSRModule Class Reference

#include <NtpSRModule.h>

Inheritance diagram for NtpSRModule:

JobCModule List of all members.

Public Member Functions

 NtpSRModule ()
 ~NtpSRModule ()
const RegistryDefaultConfig () const
void Config (const Registry &r)
JobCResult Reco (MomNavigator *mom)

Private Member Functions

void FillNtpStrip (TClonesArray &ntpstparray, const CandRecord *cndrec)
void FillNtpSlice (TClonesArray &ntpslcarray, const CandRecord *cndrec)
void FillNtpCluster (TClonesArray &ntpcluarray, const CandRecord *cndrec)
void FillNtpShower (TClonesArray &ntpshwarray, const CandRecord *cndrec)
void FillNtpTrack (TClonesArray &ntptrkarray, const CandRecord *cndrec)
void FillNtpEvent (TClonesArray &ntpevtarray, const CandRecord *cndrec)
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 FillNtpFiducialDistance (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)
void FillNtpTrackCosmicRay (NtpSRCosmicRay &ntpcosmicray, const NtpSRTrack *ntptrack, const VldContext &vld)
void FillNtpDmxStatus (NtpSRDmxStatus &ntpdmxstatus, const CandRecord *cndrec)
void FillNtpDetStatus (NtpSRDetStatus &ntpdetstatus, const VldContext &vldc)
void FillNtpEventSummary (NtpSREventSummary &ntpeventsummary, const CandRecord *cndrec, const RawRecord *rawrec)
void FillNtpShield (TClonesArray &ntpshieldstriparray, NtpSRShieldSummary &ntpshieldsummary, const NtpSRTrack *ntptrack, const RawRecord *rawrec)
void FillNtpShieldStrip (TClonesArray &ntpshieldstriparray, NtpSRShieldSummary &ntpshieldsummary, const NtpSRTrack *ntptrack, const RawRecord *rawrec)
void FillNtpTrackProjectionToShield (NtpSRShieldSummary &ntpshieldsummary, const NtpSRTrack *ntptrack)

Private Attributes

std::map< int, int > fStripUidMap
std::map< int, int > fSliceUidMap
std::map< int, int > fClusterUidMap
std::map< int, int > fShowerUidMap
std::map< int, int > fTrackUidMap
std::map< int, int > fEventUidMap
Double_t fPreTrigger
Double_t fPostTrigger
std::string fCandRecordName
std::string fRecordName
std::string fRecordTitle
bool fUseStandard
ShieldGeomfShGeom

Static Private Attributes

const Double_t kCos45 = 0.70710678

Constructor & Destructor Documentation

NtpSRModule::NtpSRModule  )  [inline]
 

Definition at line 35 of file NtpSRModule.h.

References fCandRecordName, fPostTrigger, fPreTrigger, fRecordName, fRecordTitle, fShGeom, and fUseStandard.

00035                : fPreTrigger(0),fPostTrigger(0),fCandRecordName(""),
00036                  fRecordName(""),fRecordTitle(""),fUseStandard(false),
00037                  fShGeom(0) {}

NtpSRModule::~NtpSRModule  )  [inline]
 

Definition at line 38 of file NtpSRModule.h.

00038 {}


Member Function Documentation

void NtpSRModule::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 119 of file NtpSRModule.cxx.

References fCandRecordName, fPostTrigger, fPreTrigger, fRecordName, fRecordTitle, fUseStandard, Registry::Get(), and MSG.

00119                                           {
00120   //
00121   // Purpose: Configure the module given a registry.
00122   //
00123   // Arguments: Registry to use to configure the module.
00124   //
00125   // Return: none.
00126   //
00127 
00128   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::Config" << endl;
00129   
00130   Int_t tmpi;
00131   Double_t tmpd;
00132   const Char_t* tmps;
00133 
00134   if ( r.Get("PreTrigger",tmpi) ) fPreTrigger = fabs((Double_t)(tmpi)*1.e-9);
00135   if ( r.Get("PreTrigger",tmpd) ) fPreTrigger = fabs(tmpd*1.e-9);
00136   if ( r.Get("PostTrigger",tmpi)) fPostTrigger = fabs((Double_t)(tmpi)*1.e-9);
00137   if ( r.Get("PostTrigger",tmpd)) fPostTrigger = fabs(tmpd*1.e-9);
00138 
00139   if ( r.Get("CandRecordName",tmps) ) fCandRecordName = tmps;
00140   if ( r.Get("RecordName", tmps) )  fRecordName = tmps;
00141   if ( r.Get("RecordTitle", tmps) ) fRecordTitle = tmps;
00142 
00143   if ( r.Get("UseStandard",tmpi) ) fUseStandard = tmpi;
00144   
00145 }

const Registry & NtpSRModule::DefaultConfig  )  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 88 of file NtpSRModule.cxx.

References JobCModule::GetName(), Registry::LockValues(), MSG, name, Registry::Set(), and Registry::UnLockValues().

00088                                                  {
00089   //
00090   // Purpose: Method to return default configuration.
00091   // 
00092   // Arguments: none.
00093   //
00094   // Return: Registry containing default configuration
00095   //
00096 
00097   MSG("NtpSR",Msg::kDebug) << 
00098     "NtpSRModule::DefaultConfig" << endl;
00099 
00100   static Registry r; 
00101   std::string name = this->JobCModule::GetName();
00102   name += ".config.default";
00103   r.SetName(name.c_str());
00104 
00105   r.UnLockValues();
00106   r.Set("PreTrigger",50.);
00107   r.Set("PostTrigger",150.);
00108   r.Set("CandRecordName", "PrimaryCandidateRecord");
00109   r.Set("RecordName", "Primary");
00110   r.Set("RecordTitle", "Created by NtpSRModule");
00111   r.Set("UseStandard",0);
00112   r.LockValues();
00113 
00114   return r;
00115 }

void NtpSRModule::FillNtpCluster TClonesArray &  ntpcluarray,
const CandRecord cndrec
[private]
 

Definition at line 839 of file NtpSRModule.cxx.

References NtpSRCluster::AddStripAt(), NtpSRCluster::avgdev, NtpSRCluster::begplane, NtpSRCluster::endplane, fClusterUidMap, fSliceUidMap, fStripUidMap, CandSubShowerSRHandle::GetAvgDev(), CandRecoHandle::GetBegPlane(), CandClusterHandle::GetBegPlane(), CandRecoHandle::GetCharge(), CandClusterHandle::GetCharge(), CandSubShowerSRHandle::GetClusterID(), CandHandle::GetDaughterIterator(), CandRecoHandle::GetEndPlane(), CandClusterHandle::GetEndPlane(), CandSubShowerSRHandle::GetEnergy(), CandRecoHandle::GetNDigit(), CandRecoHandle::GetNPlane(), CandClusterHandle::GetNPlane(), CandRecoHandle::GetNStrip(), CandClusterHandle::GetNStrip(), CandSubShowerSRHandle::GetPlaneView(), CandClusterHandle::GetPlaneView(), CandSubShowerSRHandle::GetProbEM(), CandSubShowerSRHandle::GetSlope(), CandHandle::GetUidInt(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), NtpSRStripPulseHeight::gev, NtpSRCluster::id, NtpSRCluster::index, NtpSRStripPulseHeight::mip, MSG, NtpSRCluster::ndigit, NtpSRCluster::nplane, NtpSRPulseHeight::pe, NtpSRCluster::ph, NtpSRCluster::planeview, NtpSRCluster::probem, NtpSRPulseHeight::raw, NtpSRPulseHeight::sigcor, NtpSRPulseHeight::siglin, NtpSRStripPulseHeight::sigmap, NtpSRCluster::slc, NtpSRCluster::slope, NtpSRCluster::tposvtx, and NtpSRCluster::zvtx.

Referenced by Reco().

00840                                                           {
00841   //
00842   //  Purpose:  Private method used to fill cluster portion of ntuple record.
00843   //
00844   //  Arguments: reference to TClonesArray of NtpSRClusters & CandRecord ptr
00845   //  
00846   //  Return: none.
00847   // 
00848 
00849   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpCluster" << endl;
00850 
00851   Int_t ncluster = 0;
00852   
00853   const CandSubShowerSRListHandle *clusterlisthandle 
00854     = dynamic_cast <const CandSubShowerSRListHandle*> 
00855     (cndrec -> FindCandHandle("CandSubShowerSRListHandle"));
00856   
00857   if ( !clusterlisthandle ) {
00858     //look for CandClusterListHandle instead and fill NtpSRCluster
00859     //as well as possible
00860     const CandClusterListHandle *clulisthandle
00861       = dynamic_cast <const CandClusterListHandle*>
00862       (cndrec -> FindCandHandle("CandClusterListHandle"));
00863     if( !clulisthandle ) return; //nothing to do here
00864     
00865     TIter cluItr(clulisthandle->GetDaughterIterator());
00866     while (CandClusterHandle* clus=dynamic_cast<CandClusterHandle*>(cluItr())){
00867       Int_t uid = clus->GetUidInt();
00868       fClusterUidMap.insert(std::make_pair(uid,ncluster));
00869 
00870       // Uses new with placement to efficiently create cluster ntp
00871       NtpSRCluster* ntpcluster 
00872         = new(ntpclusterarray[ncluster++])NtpSRCluster(clus->GetNStrip()); 
00873       
00874       // Fill indices of associated strips in cluster tree
00875       ntpcluster->index = ncluster - 1;
00876       
00877       // index to associated slice in slice array
00878       const CandSliceHandle* clusterslice = clus -> GetCandSlice();
00879       if ( clusterslice ) {
00880         std::map<int,int>::iterator uidItr 
00881                       = fSliceUidMap.find(clusterslice->GetUidInt());
00882         if ( uidItr == fSliceUidMap.end() ) {
00883           MSG("NtpSR",Msg::kError)
00884             << "Cluster slice w/Uid " << clusterslice->GetUidInt()
00885             << " does not match any in slice list." 
00886             << "\n clu slc will not be properly filled." << endl;
00887         }
00888         else {
00889           ntpcluster->slc = uidItr->second;
00890         }
00891       }
00892       else {
00893         MSG("NtpSR",Msg::kWarning) << "No associated Slice found for cluster"
00894                                    << endl;
00895         ntpcluster->slc = -1;
00896       }
00897       
00898       TIter clusterstripItr(clus->GetDaughterIterator());
00899       Int_t nclusterstrip = 0;
00900       while ( CandStripHandle *clusterstrip = dynamic_cast<CandStripHandle*>
00901               (clusterstripItr()) ) {
00902         std::map<int,int>::iterator uidItr
00903                     = fStripUidMap.find(clusterstrip->GetUidInt());
00904         if ( uidItr == fStripUidMap.end() ) {
00905           MSG("NtpSR",Msg::kError)
00906             << "Cluster strip w/Uid " << clusterstrip->GetUidInt() 
00907             << " does not match any in strip list."
00908             << "\n clu stp entry will not be properly filled." << endl;
00909         }
00910         else {
00911           Int_t stripindex = uidItr->second;
00912           ntpcluster->AddStripAt(stripindex,nclusterstrip); // add ind to strip
00913         }
00914         nclusterstrip++;
00915       }
00916       
00917       ntpcluster->planeview = clus->GetPlaneView();
00918       ntpcluster->nplane    = clus->GetNPlane();
00919       ntpcluster->begplane  = clus->GetBegPlane();
00920       ntpcluster->endplane  = clus->GetEndPlane();
00921       ntpcluster->id = ClusterType::kUnknown;
00922       
00923       // Set summed charge in cluster
00924       ntpcluster->ph.raw = clus->GetCharge();
00925       ntpcluster->ph.siglin = 0.;
00926       ntpcluster->ph.sigcor = 0.;
00927       ntpcluster->ph.pe = 0.;
00928       ntpcluster->ph.sigmap = 0.;
00929       ntpcluster->ph.mip = 0.;
00930       ntpcluster->ph.gev = 0.;
00931       MSG("NtpSR",Msg::kDebug) << "CandCluster uid " 
00932                                << clus -> GetUidInt() << "\n"  
00933                                << (*ntpcluster) << endl;
00934     }
00935     return;
00936   }
00937 
00938   //otherwise, we have CandSubShowerSRListHandle
00939   CandSubShowerSRHandleItr clusterItr(clusterlisthandle->GetDaughterIterator());
00940   CandSubShowerSRHandleKeyFunc *engKF = clusterItr.CreateKeyFunc();
00941   engKF->SetFun(CandSubShowerSRHandle::KeyFromViewEnergy);
00942   clusterItr.GetSet()->AdoptSortKeyFunc(engKF);
00943   engKF = 0;
00944   while (CandSubShowerSRHandle* cluster=dynamic_cast<CandSubShowerSRHandle*>
00945                                                     (clusterItr())) {
00946     Int_t uid = cluster->GetUidInt();
00947     fClusterUidMap.insert(std::make_pair(uid,ncluster));
00948     
00949     // Uses new with placement to efficiently create cluster ntp
00950     NtpSRCluster* ntpcluster 
00951       = new(ntpclusterarray[ncluster++])NtpSRCluster(cluster->GetNStrip()); 
00952 
00953     // Fill indices of associated strips in cluster tree
00954     ntpcluster->index = ncluster - 1;
00955 
00956     // Fill index to associated slice in slice array
00957     const CandSliceHandle* clusterslice = cluster -> GetCandSlice();
00958     if ( clusterslice ) {
00959       std::map<int,int>::iterator uidItr 
00960                     = fSliceUidMap.find(clusterslice->GetUidInt());
00961       if ( uidItr == fSliceUidMap.end() ) {
00962         MSG("NtpSR",Msg::kError)
00963           << "Cluster slice w/Uid " << clusterslice->GetUidInt()
00964           << " does not match any in slice list." 
00965           << "\n clu slc will not be properly filled." << endl;
00966       }
00967       else {
00968         ntpcluster->slc = uidItr->second;
00969       }
00970     }
00971     else {
00972       MSG("NtpSR",Msg::kWarning) << "No associated Slice found for cluster"
00973                            << endl;
00974       ntpcluster->slc = -1;
00975     }
00976     
00977     ntpcluster->ndigit = cluster->GetNDigit();
00978 
00979     TIter clusterstripItr(cluster->GetDaughterIterator());
00980     Int_t nclusterstrip = 0;
00981     while ( CandStripHandle *clusterstrip = dynamic_cast<CandStripHandle*>
00982                                                     (clusterstripItr()) ) {
00983       std::map<int,int>::iterator uidItr
00984                     = fStripUidMap.find(clusterstrip->GetUidInt());
00985       if ( uidItr == fStripUidMap.end() ) {
00986         MSG("NtpSR",Msg::kError)
00987           << "Cluster strip w/Uid " << clusterstrip->GetUidInt() 
00988           << " does not match any in strip list."
00989           << "\n clu stp entry will not be properly filled." << endl;
00990       }
00991       else {
00992         Int_t stripindex = uidItr->second;
00993         ntpcluster->AddStripAt(stripindex,nclusterstrip); // add ind to strip
00994       }
00995       nclusterstrip++;
00996     }
00997 
00998     ntpcluster->planeview = cluster->GetPlaneView();
00999     ntpcluster->nplane = cluster->GetNPlane();
01000     ntpcluster->begplane = cluster->GetBegPlane();
01001     ntpcluster->endplane = cluster->GetEndPlane();
01002 
01003     ntpcluster->zvtx = cluster->GetVtxZ();
01004     if(ntpcluster->planeview==PlaneView::kU || 
01005        ntpcluster->planeview==PlaneView::kX) ntpcluster->tposvtx = cluster->GetVtxU();
01006     else if(ntpcluster->planeview==PlaneView::kV || 
01007             ntpcluster->planeview==PlaneView::kY) ntpcluster->tposvtx = cluster->GetVtxV();
01008 
01009     ntpcluster->slope = cluster->GetSlope();    
01010     ntpcluster->avgdev = cluster->GetAvgDev();
01011     ntpcluster->id = cluster->GetClusterID();    
01012     ntpcluster->probem = cluster->GetProbEM();
01013 
01014     // Set summed charge in cluster
01015     ntpcluster->ph.raw = cluster->GetCharge(CalStripType::kNone);
01016     ntpcluster->ph.siglin = cluster->GetCharge(CalStripType::kSigLin);
01017     ntpcluster->ph.sigcor = cluster->GetCharge(CalStripType::kSigCorr);
01018     ntpcluster->ph.pe = cluster->GetCharge(CalStripType::kPE);
01019     ntpcluster->ph.sigmap = cluster->GetCharge(CalStripType::kSigMapped);
01020     ntpcluster->ph.mip = cluster->GetCharge(CalStripType::kMIP);
01021     ntpcluster->ph.gev = cluster->GetEnergy();
01022     MSG("NtpSR",Msg::kDebug) << "CandSubShowerSR uid " 
01023                              << cluster -> GetUidInt() << "\n"
01024                              << (*ntpcluster) << endl;
01025   }
01026 
01027   return;
01028 }

void NtpSRModule::FillNtpDetStatus NtpSRDetStatus ntpdetstatus,
const VldContext vldc
[private]
 

Definition at line 2187 of file NtpSRModule.cxx.

References NtpSRDetStatus::coilstatus, VldContext::GetDetector(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), and MSG.

Referenced by Reco().

02188                                                            {
02189   //
02190   //  Purpose:  Private method used to fill det status portion of ntuple 
02191   //            record.
02192   //
02193   //  Arguments: pointers to NtpSRRecord and vldc
02194   //  
02195   //  Return: none.
02196   // 
02197 
02198 
02199   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpSRDetStatus" << endl;
02200 
02201   ntpdetstatus.coilstatus = 0; // default is unknown
02202 
02203   DbiResultPtr<BfieldCoilCurrent> coilTable(vldc);
02204   const BfieldCoilCurrent* coilCurrent = 0;
02205   if ( coilTable.GetNumRows() > 0 ) coilCurrent = coilTable.GetRow(0);
02206   if ( !coilCurrent ) return; // should issue warning?
02207   
02208   DetectorType::Detector_t dtype = vldc.GetDetector();
02209    
02210   switch (dtype) {
02211 
02212   case DetectorType::kFar:
02213     if ( coilCurrent -> GetSm1Status() == coilCurrent -> GetSm2Status() ) 
02214       ntpdetstatus.coilstatus = coilCurrent -> GetSm1Status();
02215     break;
02216 
02217   case DetectorType::kNear:
02218     ntpdetstatus.coilstatus = coilCurrent -> GetSm1Status();
02219     break;
02220     
02221   default:
02222     break;
02223   }
02224   
02225 
02226   MSG("NtpSR",Msg::kDebug) << ntpdetstatus << endl;
02227   
02228   return;
02229 
02230 }

void NtpSRModule::FillNtpDmxStatus NtpSRDmxStatus ntpdmxstatus,
const CandRecord cndrec
[private]
 

Definition at line 2232 of file NtpSRModule.cxx.

References NtpSRDmxStatus::avgtimeoffset, CandDeMuxDigitListHandle::GetAvgTimeOffset(), CandDeMuxDigitListHandle::GetDeMuxDigitListFlagWord(), CandDeMuxDigitListHandle::GetNumStrayPlanesU(), CandDeMuxDigitListHandle::GetNumStrayPlanesV(), CandDeMuxDigitListHandle::GetNumValidPlanesU(), CandDeMuxDigitListHandle::GetNumValidPlanesV(), NtpSRDmxStatus::ismultimuon, MSG, NtpSRDmxStatus::nonphysicalfail, NtpSRDmxStatus::ustrayplanes, NtpSRDmxStatus::uvalidplanes, NtpSRDmxStatus::validplanesfail, NtpSRDmxStatus::vertexplanefail, NtpSRDmxStatus::vstrayplanes, and NtpSRDmxStatus::vvalidplanes.

Referenced by Reco().

02233                                                              {
02234   //
02235   //  Purpose:  Private method used to fill dmx status portion of ntuple 
02236   //            record.
02237   //
02238   //  Arguments: pointers to NtpSRRecord and CandRecord
02239   //  
02240   //  Return: none.
02241   // 
02242 
02243 
02244   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpDmxStatus" << endl;
02245 
02246   const CandDeMuxDigitListHandle *dlh 
02247    = dynamic_cast <const CandDeMuxDigitListHandle*> 
02248      (cndrec -> FindCandHandle("CandDeMuxDigitListHandle"));
02249   if ( !dlh ) return;
02250 
02251   Int_t demuxflagword = dlh->GetDeMuxDigitListFlagWord();
02252   if (demuxflagword & CandDeMuxDigitList::kMultipleMuonEvent)
02253     ntpdmxstatus.ismultimuon = 1; 
02254 
02255   if (demuxflagword & CandDeMuxDigitList::kNonPhysicalStripSolution)
02256     ntpdmxstatus.nonphysicalfail = 1; 
02257 
02258   if (demuxflagword & CandDeMuxDigitList::kTooFewValidPlanes)
02259     ntpdmxstatus.validplanesfail = 1;
02260  
02261   if (demuxflagword & CandDeMuxDigitList::kNoVertex)
02262     ntpdmxstatus.vertexplanefail = 1; 
02263 
02264   ntpdmxstatus.ustrayplanes = dlh->GetNumStrayPlanesU();
02265   ntpdmxstatus.vstrayplanes = dlh->GetNumStrayPlanesV();
02266   ntpdmxstatus.uvalidplanes = dlh->GetNumValidPlanesU();
02267   ntpdmxstatus.vvalidplanes = dlh->GetNumValidPlanesV();
02268   ntpdmxstatus.avgtimeoffset = dlh->GetAvgTimeOffset();
02269 
02270   MSG("NtpSR",Msg::kDebug) << ntpdmxstatus << endl;
02271   
02272   return;
02273 
02274 }

void NtpSRModule::FillNtpEvent TClonesArray &  ntpevtarray,
const CandRecord cndrec
[private]
 

Definition at line 1214 of file NtpSRModule.cxx.

References NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, NtpSREvent::end, NtpSRPlane::end, NtpSRPlane::endu, NtpSRPlane::endv, fEventUidMap, fShowerUidMap, fSliceUidMap, fStripUidMap, fTrackUidMap, CandRecoHandle::GetBegPlane(), CandRecoHandle::GetCharge(), CandHandle::GetDaughterIterator(), CandRecoHandle::GetEndDirCosU(), CandRecoHandle::GetEndDirCosV(), CandRecoHandle::GetEndDirCosZ(), CandRecoHandle::GetEndPlane(), CandRecoHandle::GetEndT(), CandRecoHandle::GetEndU(), CandRecoHandle::GetEndV(), CandRecoHandle::GetEndZ(), CandEventHandle::GetEnergy(), CandEventHandle::GetLastShower(), CandEventHandle::GetLastTrack(), CandRecoHandle::GetNDigit(), CandRecoHandle::GetNPlane(), CandRecoHandle::GetNStrip(), CandEventHandle::GetShower(), CandEventHandle::GetTrack(), CandHandle::GetUidInt(), CandRecoHandle::GetVtxDirCosU(), CandRecoHandle::GetVtxDirCosV(), CandRecoHandle::GetVtxDirCosZ(), CandRecoHandle::GetVtxPlane(), CandRecoHandle::GetVtxT(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), NtpSRStripPulseHeight::gev, NtpSREvent::index, kCos45, NtpSRStripPulseHeight::mip, MSG, NtpSRPlane::n, NtpSREvent::ndigit, NtpSRPlane::nu, NtpSRPlane::nv, NtpSRPulseHeight::pe, NtpSREvent::ph, NtpSRVertex::plane, NtpSREvent::plane, NtpSRPulseHeight::raw, NtpSRPulseHeight::sigcor, NtpSRPulseHeight::siglin, NtpSRStripPulseHeight::sigmap, NtpSREvent::slc, NtpSRVertex::t, NtpSRVertex::u, NtpSRVertex::v, NtpSREvent::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by Reco().

01215                                                          {
01216   //
01217   //  Purpose:  Private method used to fill event portion of ntuple record.
01218   //
01219   //  Arguments: pointers to NtpSRRecord and CandRecord
01220   //  
01221   //  Return: status.
01222   // 
01223 
01224   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpEvent" << endl;
01225 
01226   const CandEventListHandle *eventlisthandle 
01227    = dynamic_cast <const CandEventListHandle*> 
01228      (cndrec -> FindCandHandle("CandEventListHandle"));
01229   if (!eventlisthandle) return; // all done
01230 
01231   Int_t nevent = 0;
01232   TIter eventItr(eventlisthandle->GetDaughterIterator());
01233   while (CandEventHandle* event=dynamic_cast<CandEventHandle*>
01234                                                       (eventItr())) {
01235     Int_t uid = event->GetUidInt();
01236     fEventUidMap.insert(std::make_pair(uid,nevent));
01237     // Uses new with placement to efficiently create event ntp
01238     NtpSREvent* ntpevent 
01239     = new(ntpeventarray[nevent++])NtpSREvent(event->GetNStrip(),
01240                       event->GetLastShower()+1,event->GetLastTrack()+1);
01241     ntpevent->index = nevent-1;
01242     // index to associated slice in slice array
01243     const CandSliceHandle* eventslice = event -> GetCandSlice();
01244 
01245     if ( eventslice ) {
01246       std::map<int,int>::iterator uidItr;
01247       uidItr = fSliceUidMap.find(eventslice->GetUidInt());
01248       if ( uidItr == fSliceUidMap.end() ) {
01249         MSG("NtpSR",Msg::kError)
01250           << "Event slice w/Uid "
01251           << eventslice->GetUidInt()
01252           << " does not match any in slice list."
01253           << "\n evt slc will not be properly filled." << endl;
01254       }
01255       else {
01256         ntpevent->slc = uidItr->second;
01257       }
01258     }
01259     else {
01260       MSG("NtpSR",Msg::kWarning) << "No associated Slice found for event"
01261                                  << endl;
01262       ntpevent->slc = -1;
01263     }
01264 
01265     ntpevent->ndigit = event->GetNDigit();
01266 
01267     TIter eventstripItr(event->GetDaughterIterator());
01268     Int_t neventstrip = 0;
01269     // Fill indices of associated strips,showers,tracks in event ntuple
01270     std::map<int,int>::iterator uidItr;
01271     while ( CandStripHandle *eventstrip = dynamic_cast<CandStripHandle*>
01272                                                       (eventstripItr())) {
01273       uidItr = fStripUidMap.find(eventstrip->GetUidInt());
01274       if ( uidItr == fStripUidMap.end() ) {
01275         MSG("NtpSR",Msg::kError)
01276            << "Event strip w/Uid " 
01277            << eventstrip->GetUidInt() 
01278            << " does not match any in strip list."
01279            << "\nevt stp array will not be properly filled." << endl;        
01280       } 
01281       else {
01282         Int_t stripindex = uidItr->second;
01283         ntpevent -> AddStripAt(stripindex,neventstrip);
01284       }
01285       neventstrip++;
01286     }
01287     for (Int_t i = 0; i <= event->GetLastTrack(); i++ ) {
01288       const CandTrackHandle* track = event->GetTrack(i);
01289       uidItr = fTrackUidMap.find(track->GetUidInt());
01290       if ( uidItr == fTrackUidMap.end() ) {
01291         MSG("NtpSR",Msg::kError) 
01292            << "Event track w/Uid " 
01293            << track->GetUidInt() << " does not match any in track list."
01294            << "\nevt trk array will not be properly filled." << endl;        
01295       } 
01296       else {
01297         Int_t trackindex = uidItr->second;
01298         ntpevent -> AddTrackAt(trackindex,i);
01299       }
01300     }
01301     for (Int_t i = 0; i <= event->GetLastShower(); i++ ) {
01302       const CandShowerHandle* shower = event->GetShower(i);
01303       uidItr = fShowerUidMap.find(shower->GetUidInt());
01304       if ( uidItr == fShowerUidMap.end() ) {
01305         MSG("NtpSR",Msg::kError) 
01306            << "Event shower w/Uid " 
01307            << shower->GetUidInt() << " does not match any in shower list."
01308            << "\nevt shw array will not be properly filled." << endl;        
01309       } 
01310       else {
01311         Int_t showerindex = uidItr->second;
01312         ntpevent -> AddShowerAt(showerindex,i);
01313       }
01314     }
01315 
01316     // Set range of planes included in event
01317     ntpevent->plane.n = event->GetNPlane();
01318     ntpevent->plane.nu = event->GetNPlane(PlaneView::kU);
01319     ntpevent->plane.nv = event->GetNPlane(PlaneView::kV);
01320     ntpevent->plane.beg = event->GetBegPlane();
01321     ntpevent->plane.begu = event->GetBegPlane(PlaneView::kU);
01322     ntpevent->plane.begv = event->GetBegPlane(PlaneView::kV);
01323     ntpevent->plane.end = event->GetEndPlane();
01324     ntpevent->plane.endu = event->GetEndPlane(PlaneView::kU);
01325     ntpevent->plane.endv = event->GetEndPlane(PlaneView::kV);
01326     // Set summed charge in event
01327     ntpevent->ph.raw    = event->GetCharge(CalStripType::kNone);
01328     ntpevent->ph.siglin = event->GetCharge(CalStripType::kSigLin);
01329     ntpevent->ph.sigcor = event->GetCharge(CalStripType::kSigCorr);
01330     ntpevent->ph.pe     = event->GetCharge(CalStripType::kPE);
01331     ntpevent->ph.sigmap = event->GetCharge(CalStripType::kSigMapped);
01332     ntpevent->ph.mip    = event->GetCharge(CalStripType::kMIP);
01333 
01334     ntpevent->ph.gev = event->GetEnergy();
01335 
01336     // Set event vertex & end 
01337     NtpSRVertex& vtx = ntpevent->vtx;
01338     vtx.u     = event->GetVtxU();
01339     vtx.v     = event->GetVtxV();
01340     vtx.x     = kCos45*(vtx.u - vtx.v);
01341     vtx.y     = kCos45*(vtx.u + vtx.v);
01342     vtx.z     = event->GetVtxZ();
01343     vtx.t     = event->GetVtxT();
01344     vtx.plane = event->GetVtxPlane();
01345     vtx.dcosu = event->GetVtxDirCosU();
01346     vtx.dcosv = event->GetVtxDirCosV();
01347     vtx.dcosx = kCos45*(vtx.dcosu - vtx.dcosv);
01348     vtx.dcosy = kCos45*(vtx.dcosu + vtx.dcosv);
01349     vtx.dcosz = event->GetVtxDirCosZ();
01350     
01351     NtpSRVertex& end = ntpevent->end;
01352     end.u = event->GetEndU();
01353     end.v = event->GetEndV();
01354     end.x = kCos45*(end.u - end.v);
01355     end.y = kCos45*(end.u + end.v);
01356     end.z = event->GetEndZ();
01357     end.t = event->GetEndT();
01358     end.plane = event->GetEndPlane();
01359     end.dcosu = event->GetEndDirCosU();
01360     end.dcosv = event->GetEndDirCosV();
01361     end.dcosx = kCos45*(end.dcosu - end.dcosv);
01362     end.dcosy = kCos45*(end.dcosu + end.dcosv);
01363     end.dcosz = event->GetEndDirCosZ();
01364 
01365     MSG("NtpSR",Msg::kDebug) << (*ntpevent) << endl;
01366   }
01367 
01368   return;
01369 }

void NtpSRModule::FillNtpEventSummary NtpSREventSummary ntpeventsummary,
const CandRecord cndrec,
const RawRecord rawrec
[private]
 

Definition at line 2276 of file NtpSRModule.cxx.

References NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, NtpSREventSummary::date, NtpSRDate::day, NtpSRPlane::end, NtpSRPlane::endu, NtpSRPlane::endv, fClusterUidMap, fEventUidMap, CandRecord::FindCandHandle(), fShowerUidMap, fSliceUidMap, fStripUidMap, fTrackUidMap, CandDigitListHandle::GetAbsTime(), RawDigit::GetADC(), RawDigit::GetChannel(), CandDigitHandle::GetCharge(), VldTimeStamp::GetDate(), CandDigitHandle::GetPlexSEIdAltL(), PlexHandle::GetReadoutType(), VldTimeStamp::GetSec(), RawDigit::GetTDC(), VldTimeStamp::GetTime(), Calibrator::GetTimeFromTDC(), VldContext::GetTimeStamp(), RecMinos::GetVldContext(), NtpSRDate::hour, Calibrator::Instance(), NtpSREventSummary::litime, NtpSRDate::minute, NtpSRDate::month, MSG, NtpSRPlane::n, NtpSREventSummary::ncluster, NtpSREventSummary::ndigit, NtpSREventSummary::nevent, NtpSREventSummary::nshower, NtpSREventSummary::nslice, NtpSREventSummary::nstrip, NtpSREventSummary::ntrack, NtpSRPlane::nu, NtpSRPlane::nv, NtpSRPulseHeight::pe, NtpSREventSummary::ph, NtpSREventSummary::plane, NtpSREventSummary::planeall, NtpSRPulseHeight::raw, NtpSRDate::sec, NtpSRPulseHeight::sigcor, NtpSRPulseHeight::siglin, NtpSREventSummary::trigtime, NtpSRDate::utc, and NtpSRDate::year.

Referenced by Reco().

02278                                                                {
02279   //
02280   //  Purpose:  Private method used to fill event summary portion of ntuple 
02281   //            record.
02282   //
02283   //  Arguments: pointers to NtpSRRecord and CandRecord
02284   //  
02285   //  Return: none.
02286   // 
02287 
02288 
02289   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpEventSummary" << endl;
02290   const CandDigitListHandle *dlh = dynamic_cast <const CandDigitListHandle*> 
02291      (cndrec->FindCandHandle("CandDigitListHandle"));
02292   if ( !dlh ) return; // no digits => done
02293 
02294   ntpeventsummary.nstrip  = fStripUidMap.size();
02295   ntpeventsummary.nslice  = fSliceUidMap.size();
02296   ntpeventsummary.ncluster = fClusterUidMap.size();
02297   ntpeventsummary.nshower = fShowerUidMap.size();
02298   ntpeventsummary.ntrack  = fTrackUidMap.size();
02299   ntpeventsummary.nevent  = fEventUidMap.size();
02300 
02301   ntpeventsummary.trigtime = dlh->GetAbsTime();
02302 
02303   const VldContext& vld = *(cndrec->GetVldContext());
02304   PlexHandle plex(vld);
02305   
02306   Double_t maxliTime = -1;
02307   if ( rawrec ) {
02308     TIter blockIter = rawrec -> GetRawBlockIter();
02309     TObject* blockobj = 0;
02310     while ( ( blockobj = blockIter.Next() ) ) {
02311       const RawDigitDataBlock* rddb 
02312         = dynamic_cast<const RawDigitDataBlock*>(blockobj);
02313       if ( rddb != 0 ) {
02314         TIter digititer = rddb -> GetDatumIter();
02315         TObject* digitobj = 0;
02316         while ( ( digitobj = digititer.Next() ) ) {
02317           RawDigit* rawdigit = dynamic_cast<RawDigit*>(digitobj);
02318           if ( rawdigit ) {
02319             RawChannelId rcid = rawdigit->GetChannel();
02320             ReadoutType::Readout_t type = plex.GetReadoutType(rcid);
02321             if ( type == ReadoutType::kFlashTrigPMT ) {
02322               if ( rawdigit->GetADC() > 100 ) {
02323                 Double_t liTime = 
02324                 Calibrator::Instance().GetTimeFromTDC(rawdigit->GetTDC(),
02325                                                   rawdigit->GetChannel());
02326                 maxliTime = TMath::Max(liTime,maxliTime);
02327               }
02328             }
02329           }       
02330         }       
02331       }      
02332     }    
02333   }
02334   else {
02335     MSG("NtpSR",Msg::kWarning) << "Missing RawRecord!"
02336                    << "\n evthdr.litime will not be properly filled." << endl;
02337   }
02338   ntpeventsummary.litime = maxliTime;
02339   
02340   // Fill the NtpSRDate portion of the NtpSREventSummary object
02341   UInt_t year,month,day,hour,minute,sec;
02342   vld.GetTimeStamp().GetDate(kTRUE,0,&year,&month,&day);
02343   vld.GetTimeStamp().GetTime(kTRUE,0,&hour,&minute,&sec);
02344   ntpeventsummary.date.year   = (UShort_t)year;  
02345   ntpeventsummary.date.month  = (Char_t)month;   
02346   ntpeventsummary.date.day    = (Char_t)day;     
02347   ntpeventsummary.date.hour   = (Char_t)hour;  
02348   ntpeventsummary.date.minute = (Char_t)minute; 
02349   ntpeventsummary.date.sec    =  (Double_t)sec; 
02350   ntpeventsummary.date.sec   += ntpeventsummary.trigtime; 
02351   ntpeventsummary.date.utc = vld.GetTimeStamp().GetSec();
02352 
02353   Int_t minplaneall  = -1;
02354   Int_t minplaneallu = -1;
02355   Int_t minplaneallv = -1;
02356   Int_t maxplaneall  = -1;
02357   Int_t maxplaneallu = -1;
02358   Int_t maxplaneallv = -1;
02359   std::map<Int_t,Bool_t> planeoccupancyall; 
02360   std::map<Int_t,Bool_t> planeoccupancyallu;
02361   std::map<Int_t,Bool_t> planeoccupancyallv;
02362   Float_t planepe[1000][2] = {{0},{0}}; // initializes all members to 0
02363 
02364   // Loop over all digits
02365   TIter digitItr(dlh -> GetDaughterIterator());
02366   while (CandDigitHandle* digit = dynamic_cast<CandDigitHandle*>(digitItr())) {
02367     // Calculate the summed pulse height of all digits (non-shield) in 
02368     // the entire event
02369     PlexSEIdAltL pseid(digit->GetPlexSEIdAltL());
02370     if (pseid.IsVetoShield()) continue;
02371     ntpeventsummary.ndigit++;
02372 
02373     ntpeventsummary.ph.raw += digit->GetCharge(CalDigitType::kNone);
02374     Float_t calcharge[3] = {0};
02375     if ( pseid.GetDemuxVetoFlag() == 0 ) { 
02376       // demux successful
02377       calcharge[0] = digit->GetCharge(CalDigitType::kSigLin);
02378       calcharge[1] = digit->GetCharge(CalDigitType::kSigCorr);
02379       calcharge[2] = digit->GetCharge(CalDigitType::kPE);
02380     }
02381     else if ( pseid.GetSize() > 0 ) {
02382       // if it wasn't demuxed, then simply use first entry
02383       calcharge[0] = pseid[0].GetSigLin();
02384       calcharge[1] = pseid[0].GetSigCorr();
02385       calcharge[2] = pseid[0].GetPE();
02386     }
02387     ntpeventsummary.ph.siglin += calcharge[0];
02388     ntpeventsummary.ph.sigcor += calcharge[1];
02389     ntpeventsummary.ph.pe     += calcharge[2];
02390 
02391     // Now determine the range of planes.  In the first case, the range of
02392     // planes is determined as the min/max plane with any digit.  
02393     Int_t iplane = pseid.GetPlane();
02394     if ( iplane < 0 || iplane >= 1000 ) continue;
02395 
02396     if ( minplaneall < 0 || iplane < minplaneall ) minplaneall = iplane;
02397     if ( maxplaneall < 0 || iplane > maxplaneall ) maxplaneall = iplane;
02398     planeoccupancyall[iplane] = kTRUE; // at least one digit on this plane
02399 
02400     switch (pseid.GetPlaneView()) {
02401     case PlaneView::kU:
02402       if (minplaneallu < 0 || iplane < minplaneallu) minplaneallu = iplane;
02403       if (maxplaneallu < 0 || iplane > maxplaneallu) maxplaneallu = iplane;
02404       planeoccupancyallu[iplane] = kTRUE; // at least one digit on this u-plane
02405       break;
02406     case PlaneView::kV:
02407       if (minplaneallv < 0 || iplane < minplaneallv) minplaneallv = iplane;
02408       if (maxplaneallv < 0 || iplane > maxplaneallv) maxplaneallv = iplane;
02409       planeoccupancyallv[iplane] = kTRUE; // at least one digit on this v-plane
02410       break;
02411     default:
02412       break;
02413     }
02414     
02415     // In the second case, the range of plane requires determining which planes
02416     // have a summed ph (over both readout ends) of > 3 pe. Store the plane
02417     // pe sum now and use it below.
02418     switch (pseid.GetEnd()) {
02419     case StripEnd::kNegative:
02420       planepe[iplane][0] += calcharge[2];  // CalDigitType::kPE
02421       break;
02422     case StripEnd::kPositive:
02423       planepe[iplane][1] += calcharge[2];  // CalDigitType::kPE
02424       break;
02425     default:
02426       break;
02427     }
02428   } // end of digit while loop
02429 
02430   ntpeventsummary.planeall.beg  = minplaneall;
02431   ntpeventsummary.planeall.end  = maxplaneall;
02432   ntpeventsummary.planeall.begu = minplaneallu;
02433   ntpeventsummary.planeall.endu = maxplaneallu;
02434   ntpeventsummary.planeall.begv = minplaneallv;
02435   ntpeventsummary.planeall.endv = maxplaneallv;
02436   std::map<Int_t,Bool_t>::iterator iter;
02437   for ( Int_t iplane = minplaneall; iplane <= maxplaneall; iplane ++ ) {
02438     iter = planeoccupancyall.find(iplane); // at least one digit
02439     if ( iter != planeoccupancyall.end() ) ntpeventsummary.planeall.n++;
02440     iter = planeoccupancyallu.find(iplane); // at least one digit u
02441     if ( iter != planeoccupancyallu.end() ) ntpeventsummary.planeall.nu++;
02442     iter = planeoccupancyallv.find(iplane); // at least one digit v
02443     if ( iter != planeoccupancyallv.end() ) ntpeventsummary.planeall.nv++;
02444   }
02445 
02446   // plane.beg/end is determined by first testing for 4 contiguous planes
02447   // with a summed ph > 3 pe across both ends. The minimum plane of the first 
02448   // such group and the maximum plane of the last such group form plane.beg 
02449   // and plane.end respectively.
02450   Int_t minplane  = -1;
02451   Int_t maxplane  = -1;
02452   bool found(0);
02453   for (Int_t iplane=minplaneall;iplane<=maxplaneall-3 && !found; iplane++) {
02454     if ( !found && (planepe[iplane][0] + planepe[iplane][1]) > 3.  
02455                 && (planepe[iplane+1][0] + planepe[iplane+1][1]) > 3. 
02456                 && (planepe[iplane+2][0] + planepe[iplane+2][1]) > 3. 
02457                 && (planepe[iplane+3][0] + planepe[iplane+3][1]) > 3. ) {
02458       found = 1;
02459       minplane = iplane;
02460     }
02461   }
02462   found = 0;
02463   for (Int_t iplane=maxplaneall;iplane>=minplaneall+3 && !found; iplane--) {
02464     if ( !found && (planepe[iplane][0] + planepe[iplane][1]) > 3.  
02465                 && (planepe[iplane-1][0] + planepe[iplane-1][1]) > 3. 
02466                 && (planepe[iplane-2][0] + planepe[iplane-2][1]) > 3. 
02467                 && (planepe[iplane-3][0] + planepe[iplane-3][1]) > 3. ) {
02468       found = 1;
02469       maxplane = iplane;
02470     }
02471   }
02472 
02473   Int_t minplaneu = -1;
02474   Int_t minplanev = -1;
02475   Int_t maxplaneu = -1;
02476   Int_t maxplanev = -1;
02477   for (Int_t iplane = minplane; iplane <= maxplane; iplane++ ) {
02478     if ( iplane >= 0 ) {
02479       if ( planepe[iplane][0] + planepe[iplane][1] > 0. ) {
02480         ntpeventsummary.plane.n++;  // non-zero readout at either end
02481         iter = planeoccupancyallu.find(iplane);
02482         if ( iter != planeoccupancyallu.end() ) {
02483           ntpeventsummary.plane.nu++; // non-zero readout on u plane
02484           if ( minplaneu < 0 || iplane < minplaneu ) minplaneu = iplane;
02485           if ( maxplaneu < 0 || iplane > maxplaneu ) maxplaneu = iplane;
02486         }
02487         iter = planeoccupancyallv.find(iplane);
02488         if ( iter != planeoccupancyallv.end() ) {
02489           ntpeventsummary.plane.nv++;
02490           if ( minplanev < 0 || iplane < minplanev ) minplanev = iplane;
02491           if ( maxplanev < 0 || iplane > maxplanev ) maxplanev = iplane;
02492         }
02493       }
02494     }
02495   }
02496 
02497   ntpeventsummary.plane.beg = minplane;
02498   ntpeventsummary.plane.end = maxplane;
02499   ntpeventsummary.plane.begu = minplaneu;
02500   ntpeventsummary.plane.endu = maxplaneu;
02501   ntpeventsummary.plane.begv = minplanev;
02502   ntpeventsummary.plane.endv = maxplanev;
02503 
02504   MSG("NtpSR",Msg::kDebug) << ntpeventsummary << endl;
02505   
02506   return;
02507 
02508 }

void NtpSRModule::FillNtpFiducialDistance NtpSRFiducial fid,
const NtpSRVertex vtx,
const VldContext vld
[private]
 

Definition at line 1572 of file NtpSRModule.cxx.

References RawTriggerCodes::AsString(), NtpSRFiducial::dr, NtpSRFiducial::dz, VldContext::GetDetector(), UgliGeomHandle::GetZExtent(), MAXMSG, min(), NtpSRVertex::u, NtpSRVertex::v, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

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

01574                                                                  {
01575   //
01576   //  Purpose:  Private method used to fill NtpSRFiducial dr and dz
01577   //            data members  given a point defined by NtpSRVertex and 
01578   //            the detector type.
01579   //
01580   //  Return: none.
01581   // 
01582 
01583 
01584   UgliGeomHandle ugh(vld);
01585   Float_t zextent[2];
01586   ugh.GetZExtent(zextent[0],zextent[1]);
01587 
01588   MAXMSG("NtpSR",Msg::kDebug,1) << "Det zmin/max(m) " << zextent[0]
01589                                 << "/" << zextent[1] << endl;
01590   
01591   DetectorType::Detector_t dtype = vld.GetDetector();
01592 
01593   Float_t du,dv,dx,dy;
01594 
01595   switch (dtype) {
01596 
01597   case DetectorType::kFar:
01598     du = min(4.-vtx.u,4.+vtx.u);
01599     dv = min(4.-vtx.v,4.+vtx.v);
01600     dx = min(4.-vtx.x,4.+vtx.x);
01601     dy = min(4.-vtx.y,4.+vtx.y);
01602     fid.dr = min(min(du,dv),min(dx,dy));
01603     if ( fid.dr < 0. ) fid.dr = 0;
01604     fid.dz = min(vtx.z-zextent[0],zextent[1]-vtx.z);
01605     
01606     break;
01607 
01608   case DetectorType::kCalDet:
01609     fid.dr = min(min(0.5+vtx.x,0.5-vtx.x),min(0.5+vtx.y,0.5-vtx.y));
01610     if ( fid.dr < 0. ) fid.dr = 0;
01611     fid.dz = min(vtx.z-zextent[0],zextent[1]-vtx.z);
01612 
01613     break;
01614 
01615   default:
01616     MAXMSG("NtpSR",Msg::kWarning,10) 
01617       << "Detector '" << Detector::AsString(dtype)
01618       << "' not supported for FillNtpFiducialDistance." << endl;
01619     break;
01620   }
01621 
01622   return;
01623 
01624 }

void NtpSRModule::FillNtpShield TClonesArray &  ntpshieldstriparray,
NtpSRShieldSummary ntpshieldsummary,
const NtpSRTrack ntptrack,
const RawRecord rawrec
[private]
 

Definition at line 728 of file NtpSRModule.cxx.

References FillNtpShieldStrip(), FillNtpTrackProjectionToShield(), fShGeom, VldContext::GetTimeStamp(), RecMinos::GetVldContext(), MSG, and ShieldGeom::Reinitialize().

Referenced by Reco().

00731                                                          {
00732   //
00733   //  Purpose:  Private method used to fill shield portion of ntuple.
00734   //
00735   //  Arguments: NtpSRRecord 
00736   //  
00737   //  Return: none.
00738   // 
00739   //  Notes: Should be called post-filling of ntp tracks
00740   //
00741 
00742   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpShield" << endl;
00743 
00744   //Getting the Shield geometry **!! Not reloaded unless VldTimeStamp obtained from rawrec is out of VldRange of ShieldGeom object (that's what "Reinitialize" does
00745   const VldContext& vldc = *(rawrec->GetVldContext());
00746   VldTimeStamp time=vldc.GetTimeStamp();
00747   if( !fShGeom ){
00748     fShGeom = new ShieldGeom(time);
00749   }
00750   else{
00751     fShGeom->Reinitialize(time);
00752   }
00753 
00754   // Fill results of projecting track to shield in shield summary first
00755   // The result of projection is used to correct timing data in shield strips
00756   // for the propagation time along the z-direction of strip
00757   this -> FillNtpTrackProjectionToShield(ntpshieldsummary,ntptrack);
00758   this -> FillNtpShieldStrip(ntpshieldstriparray,ntpshieldsummary,ntptrack,
00759                                                                    rawrec); 
00760   MSG("NtpSR",Msg::kDebug) << ntpshieldsummary << endl;
00761   
00762   return;
00763 
00764 }

void NtpSRModule::FillNtpShieldStrip TClonesArray &  ntpshieldstriparray,
NtpSRShieldSummary ntpshieldsummary,
const NtpSRTrack ntptrack,
const RawRecord rawrec
[private]
 

Definition at line 406 of file NtpSRModule.cxx.

References NtpSRShieldSummary::adc, NtpSRShieldStrip::adc, NtpSRShieldStrip::clearlen, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, NtpSRShieldSummary::dx, NtpSRShieldSummary::dxvetostp, fPostTrigger, fPreTrigger, fShGeom, RawDigit::GetADC(), RawDigit::GetChannel(), RawChannelId::GetCrate(), RawDigitDataBlock::GetDatumIter(), PlexStripEndId::GetEnd(), PlexPlaneId::GetPlane(), ShieldGeom::GetPlank_X(), ShieldGeom::GetPlank_Y(), RawRecord::GetRawBlockIter(), PlexHandle::GetSEIdAltL(), PlexSEIdAltL::GetSize(), PlexStripEndId::GetStrip(), UgliGeomHandle::GetStripHandle(), RawDigit::GetTDC(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChannel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RecMinos::GetVldContext(), RawChannelId::GetVmm(), NtpSRShieldStrip::index, ShieldGeom::IsVertical(), PlexSEIdAltL::IsVetoShield(), max(), min(), MSG, NtpSRShieldSummary::ndigit, NtpSRShieldStrip::ndigit, NtpSRShieldSummary::nplank, NtpSRShieldStrip::plank, NtpSRShieldStrip::pln, NtpSRShieldStrip::pmtindex, NtpSRShieldStrip::pmtpixel, NtpSRShieldSummary::projz, PlexVetoShieldHack::RenumberMuxToMdl(), NtpSRVertex::t, NtpSRShieldStrip::time, NtpSRShieldStrip::timeraw, PropagationVelocity::Velocity(), NtpSRTrack::vtx, NtpSRShieldStrip::wlspigtail, NtpSRVertex::x, NtpSRVertex::y, NtpSRVertex::z, and NtpSRShieldStrip::z.

Referenced by FillNtpShield().

00409                                                               {
00410   //
00411   //  Purpose:  Private method used to fill shield strip portion of ntuple 
00412   //            record.
00413   //
00414   //  Arguments: TClonesArray& of NtpSRShieldStrip's and CandRecord ptr
00415   //  
00416   //  Return: status.
00417   // 
00418 
00419   const VldContext& vldc = *(rawrec->GetVldContext());
00420   PlexHandle plexhandle(vldc);
00421   UgliGeomHandle ugh(vldc);
00422 
00423   Int_t minend = TMath::Min(StripEnd::kNegative,StripEnd::kPositive);
00424 
00425   // these constants should be taken from the database
00426   Double_t propagation_velocity = PropagationVelocity::Velocity();
00427   Double_t c1 = -14.45;
00428   Double_t c2 =   7.498;
00429   Double_t c3 =  -1.566;
00430 
00431   Double_t tracktime = 0;
00432   if ( ntptrack ) tracktime = ntptrack->vtx.t;
00433 
00434   PlexVetoShieldHack plexvetoshieldhack;
00435   TIter rdbit = rawrec->GetRawBlockIter();
00436   TObject* tobject;
00437   // filled with NtpSRShieldStrip objects organized by time period
00438   std::vector<NtpSRShieldStrip*> shieldlist[3]; 
00439   while ((tobject = rdbit())) {
00440     RawDigitDataBlock *rdb = dynamic_cast<RawDigitDataBlock*>(tobject);
00441     if ( !rdb ) continue;
00442     TIter rdit = rdb->GetDatumIter();
00443     RawDigit* rd;
00444     while ((rd = dynamic_cast<RawDigit*>(rdit()))) {
00445       RawChannelId rawch = rd->GetChannel();
00446       PlexSEIdAltL plexaltl = plexhandle.GetSEIdAltL(rawch);
00447       Int_t stripend = 0;
00448       if ( plexaltl.IsVetoShield() ) {
00449         PlexStripEndId oldseid = plexaltl[0].GetSEId();
00450         const PlexStripEndId& newseid 
00451           = plexvetoshieldhack.RenumberMuxToMdl(vldc,oldseid);
00452         stripend = 1 - (Int_t)(newseid.GetEnd()-minend); // so that S=0,N=1
00453         assert(stripend >= 0 && stripend < 2);
00454             
00455         NtpSRShieldStrip* ntpshieldstrip = new NtpSRShieldStrip();
00456         ntpshieldstrip->ndigit++;
00457         ntpshieldstrip->pln = newseid.GetPlane();
00458         ntpshieldstrip->plank = newseid.GetStrip();
00459         ntpshieldstrip->adc[stripend] = rd->GetADC();
00460         ntpshieldstrip->pmtindex[stripend] = rawch.GetCrate()*108
00461               + rawch.GetVarcId()*36 + rawch.GetVmm()*6 + rawch.GetVaAdcSel()*3
00462               + rawch.GetVaChip(); 
00463         Int_t vach2pixel[18]={0,0,15,1,16,2,11,5,12,6,7,9,8,10,3,14,4,13};
00464         if ( rawch.GetVaChannel() >= 2 && rawch.GetVaChannel() <= 17 ) {
00465           ntpshieldstrip->pmtpixel[stripend]
00466                     = vach2pixel[rawch.GetVaChannel()];
00467         }
00468         ntpshieldstrip->timeraw[stripend] 
00469            = rd->GetTDC()*1.5625e-9 + 26.e-9; // ?RWH/BR 26ns is a historical mystery
00470         // Correct for time walk
00471         Double_t logph
00472               =log((Double_t)(ntpshieldstrip->adc[stripend])/70.)/2.3;
00473         ntpshieldstrip->time[stripend] = ntpshieldstrip->timeraw[stripend] 
00474                 - (c1*logph + c2*logph*logph + c3*logph*logph*logph)*1.e-9;
00475 
00476         UgliStripHandle ush(ugh.GetStripHandle(newseid));
00477         if ( ush.IsValid() ) {
00478           TVector3 stripxyz0(ush.GlobalPos(-ush.GetHalfLength()));
00479           TVector3 stripxyz1(ush.GlobalPos(ush.GetHalfLength()));
00480           ntpshieldstrip -> x = 0.5*(stripxyz0[0]+stripxyz1[0]);
00481           ntpshieldstrip -> y = 0.5*(stripxyz0[1]+stripxyz1[1]);
00482           ntpshieldstrip -> z[0] = min(stripxyz0[2],stripxyz1[2]);
00483           ntpshieldstrip -> z[1] = max(stripxyz0[2],stripxyz1[2]);
00484           // Average wlspigtail and clearlen over all strip ends
00485           for ( int i = 0; i < plexaltl.GetSize(); i++ ) {
00486             PlexStripEndId stpoldseid=plexaltl[i].GetSEId();
00487             const PlexStripEndId& stpnewseid 
00488             = plexvetoshieldhack.RenumberMuxToMdl(vldc,stpoldseid);
00489             UgliStripHandle stpush(ugh.GetStripHandle(stpnewseid));
00490             Int_t stpstripend 
00491                 = 1 - (Int_t)(stpnewseid.GetEnd()-minend); // S=0,N=1
00492             assert(stpstripend >= 0 && stpstripend < 2);
00493             ntpshieldstrip -> wlspigtail[1] 
00494                            += stpush.WlsPigtail(StripEnd::kNegative);
00495             ntpshieldstrip -> wlspigtail[0] 
00496                            += stpush.WlsPigtail(StripEnd::kPositive);
00497             ntpshieldstrip -> clearlen[1] 
00498                            += stpush.ClearFiber(StripEnd::kNegative);
00499             ntpshieldstrip -> clearlen[0] 
00500                            += stpush.ClearFiber(StripEnd::kPositive);
00501           }
00502           if ( plexaltl.GetSize() > 0 ) {
00503             for ( int iend = 0; iend < 2; iend++ ) {
00504               ntpshieldstrip->wlspigtail[iend] /=(Float_t)(plexaltl.GetSize());
00505               ntpshieldstrip->clearlen[iend] /= (Float_t)(plexaltl.GetSize());
00506             }
00507           }
00508           // correct for wlspigtail + clear fiber
00509           Double_t fiberlen = ntpshieldstrip->wlspigtail[stripend] 
00510                             + ntpshieldstrip->clearlen[stripend];
00511           if ( fiberlen > 20. ) fiberlen = 20.; // limit bad lengths
00512           ntpshieldstrip->time[stripend] -= fiberlen/propagation_velocity;
00513         }
00514         // Time is corrected for propagation length along strip
00515         if ( ntptrack && ntpshieldsummary.projz >= ntpshieldstrip->z[0] &&
00516                          ntpshieldsummary.projz <= ntpshieldstrip->z[1] ) {
00517            ntpshieldstrip->time[stripend] -= fabs(ntpshieldsummary.projz
00518                        -ntpshieldstrip->z[stripend])/propagation_velocity;
00519         }
00520 
00521         // determine which shield window the time of this strip fell:
00522         // pretrigger,trigger or posttrigger
00523         Int_t ishieldtime = 1;
00524         if ( (ntpshieldstrip->time[stripend]-tracktime)< -1.*fabs(fPreTrigger))
00525           ishieldtime = 0;
00526         else if((ntpshieldstrip->time[stripend]-tracktime)>fabs(fPostTrigger)) 
00527           ishieldtime = 2;
00528         ntpshieldsummary.ndigit[ishieldtime]++;
00529         ntpshieldsummary.adc[ishieldtime] += rd->GetADC();;
00530 
00531         // Search through list of shield strips in this time window to
00532         // determine if new shield strip should be merged with existing
00533         // shield strip (same plane,plank).
00534         bool isFound = false;
00535         std::vector<NtpSRShieldStrip*>::iterator vsItr;
00536         for ( vsItr = shieldlist[ishieldtime].begin(); 
00537               vsItr!= shieldlist[ishieldtime].end() && !isFound; vsItr++) {
00538           NtpSRShieldStrip* liststrip = *vsItr;
00539           if ( liststrip->pln == ntpshieldstrip->pln && 
00540                liststrip->plank == ntpshieldstrip->plank  ) {
00541             isFound = true;
00542             liststrip->ndigit += ntpshieldstrip->ndigit;
00543             if ( liststrip->adc[stripend] == 0 ) {
00544               liststrip->timeraw[stripend] = ntpshieldstrip->timeraw[stripend];
00545               liststrip->time[stripend]    = ntpshieldstrip->time[stripend];
00546               liststrip->wlspigtail[stripend] 
00547                                         = ntpshieldstrip->wlspigtail[stripend];
00548               liststrip->clearlen[stripend]=ntpshieldstrip->clearlen[stripend];
00549               liststrip->pmtindex[stripend]=ntpshieldstrip->pmtindex[stripend];
00550               liststrip->pmtpixel[stripend]=ntpshieldstrip->pmtpixel[stripend];
00551             }
00552             liststrip->adc[stripend] += ntpshieldstrip->adc[stripend];
00553             delete ntpshieldstrip; ntpshieldstrip = 0;
00554           }
00555         }
00556         if ( !isFound ) {
00557           shieldlist[ishieldtime].push_back(ntpshieldstrip);
00558           ntpshieldsummary.nplank[ishieldtime]++;
00559         }
00560       }
00561     }
00562 
00563     // Finally, loop over all strips, grouped by time interval, and produce
00564     // TClonesArray of shield strips.  Entries in TClonesArray are timeordered
00565     // such that pre-trigger strips appear first, then trigger, 
00566     // then post-trigger.
00567     Int_t nshieldstrip = 0;
00568     for ( int ishieldtime = 0; ishieldtime < 3; ishieldtime++ ) {
00569       std::vector<NtpSRShieldStrip*>::iterator vsItr;
00570       for ( vsItr = shieldlist[ishieldtime].begin(); 
00571             vsItr!= shieldlist[ishieldtime].end(); vsItr++) {
00572         NtpSRShieldStrip* liststrip = *vsItr;
00573         // Invoke copy constructor to add strip to TClonesArray
00574         NtpSRShieldStrip& ntpstrip = 
00575        *(new(ntpshieldstriparray[nshieldstrip++])NtpSRShieldStrip(*liststrip));
00576         ntpstrip.index = nshieldstrip - 1;
00577         if ( ntptrack ) {
00578           // Project track back to shield hit and determine distance of closest
00579           // approach to any shield hit
00580           const NtpSRVertex& vtx = ntptrack -> vtx;
00581 
00582          Float_t dx;
00583          Int_t sign=1;
00584          ShieldProj sp(vtx.x,vtx.y,vtx.z,vtx.dcosx,vtx.dcosy,vtx.dcosz,ntpstrip.pln,ntpstrip.plank,fShGeom);
00585          if(sp.GetProjInter_Z() >= ntpstrip.z[0] && sp.GetProjInter_Z() <= ntpstrip.z[1]){
00586            if(fShGeom->IsVertical(ntpstrip.pln)){
00587              if(sp.GetProjInter_Y()-(fShGeom->GetPlank_Y(ntpstrip.pln,ntpstrip.plank)) < 0){
00588                sign=-1;
00589              }
00590            } else{
00591              if(sp.GetProjInter_X()-(fShGeom->GetPlank_X(ntpstrip.pln,ntpstrip.plank)) < 0){
00592                sign=-1;
00593              }
00594            }        
00595            dx=sp.GetProjDis()*sign;
00596            for(Int_t ie = 0; ie<2; ie++){
00597              if(fabs(dx)<fabs(ntpshieldsummary.dx[ishieldtime])){
00598                ntpshieldsummary.dx[ishieldtime] = dx;
00599                ntpshieldsummary.dxvetostp[ishieldtime] = nshieldstrip-1;
00600              }
00601            }
00602          }         
00603         } // ntptrack exists
00604         delete liststrip; liststrip = 0; // done with temporary liststrip
00605         MSG("NtpSR",Msg::kDebug) << ntpstrip << endl;
00606       }
00607     }
00608   }
00609 
00610   return;
00611 
00612 }

void NtpSRModule::FillNtpShower TClonesArray &  ntpshwarray,
const CandRecord cndrec
[private]
 

Definition at line 1030 of file NtpSRModule.cxx.

References NtpSRShower::AddStripAt(), NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, NtpSRShowerPulseHeight::EMgev, NtpSRPlane::end, NtpSRPlane::endu, NtpSRPlane::endv, fClusterUidMap, fShowerUidMap, fSliceUidMap, fStripUidMap, CandRecoHandle::GetBegPlane(), CandRecoHandle::GetCharge(), CandShowerHandle::GetCluster(), CandHandle::GetDaughterIterator(), CandRecoHandle::GetDirCosU(), CandRecoHandle::GetDirCosV(), CandRecoHandle::GetDirCosZ(), CandRecoHandle::GetEndPlane(), CandShowerHandle::GetEnergy(), CandShowerHandle::GetLastCluster(), CandShowerSRHandle::GetLastSubShower(), CandRecoHandle::GetNDigit(), CandRecoHandle::GetNPlane(), CandRecoHandle::GetNStrip(), CandShowerSRHandle::GetNumSubShowersU(), CandShowerSRHandle::GetNumSubShowersV(), CandClusterHandle::GetPlaneView(), CandShowerSRHandle::GetSubShower(), CandHandle::GetUidInt(), CandRecoHandle::GetVtxPlane(), CandRecoHandle::GetVtxT(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), NtpSRStripPulseHeight::gev, NtpSRShower::index, kCos45, NtpSRShowerPulseHeight::linCCgev, NtpSRShowerPulseHeight::linNCgev, NtpSRStripPulseHeight::mip, MSG, NtpSRPlane::n, NtpSRShower::ncluster, NtpSRShower::ndigit, NtpSRPlane::nu, NtpSRShower::nUcluster, NtpSRPlane::nv, NtpSRShower::nVcluster, NtpSRPulseHeight::pe, NtpSRShower::ph, NtpSRVertex::plane, NtpSRShower::plane, NtpSRPulseHeight::raw, NtpSRShower::shwph, NtpSRPulseHeight::sigcor, NtpSRPulseHeight::siglin, NtpSRStripPulseHeight::sigmap, NtpSRShower::slc, NtpSRVertex::t, NtpSRVertex::u, NtpSRVertex::v, NtpSRShower::vtx, NtpSRShowerPulseHeight::wtCCgev, NtpSRShowerPulseHeight::wtNCgev, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by Reco().

01031                                                           {
01032   //
01033   //  Purpose:  Private method used to fill shower portion of ntuple record.
01034   //
01035   //  Arguments: reference to TClonesArray of NtpSRShowers and CandRecord ptr
01036   //  
01037   //  Return: status.
01038   // 
01039 
01040   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpShower" << endl;
01041 
01042   const CandShowerListHandle *showerlisthandle 
01043    = dynamic_cast <const CandShowerListHandle*> 
01044      (cndrec -> FindCandHandle("CandShowerListHandle"));
01045   if ( !showerlisthandle ) return; // all done
01046 
01047   Int_t nshower = 0;
01048   TIter showerItr(showerlisthandle->GetDaughterIterator());
01049   while (CandShowerHandle* shower=dynamic_cast<CandShowerHandle*>
01050                                                       (showerItr())) {
01051     Int_t uid = shower->GetUidInt();
01052     fShowerUidMap.insert(std::make_pair(uid,nshower));
01053     // Uses new with placement to efficiently create slice ntp
01054     NtpSRShower* ntpshower = 0;
01055     if (shower -> InheritsFrom("CandShowerSRHandle")) {
01056       CandShowerSRHandle* showerSR = dynamic_cast<CandShowerSRHandle*>(shower);
01057       ntpshower 
01058       = new(ntpshowerarray[nshower++])NtpSRShower(showerSR->GetNStrip(),
01059                   showerSR->GetNumSubShowersU()+showerSR->GetNumSubShowersV());
01060     }
01061     else {
01062       ntpshower=new(ntpshowerarray[nshower++])NtpSRShower(shower->GetNStrip(),
01063                                                shower->GetLastCluster()+1);
01064     }
01065     ntpshower -> nstpcnt = shower->GetNStrip();
01066     
01067     // Fill indices of associated strips in shower tree
01068     ntpshower->index = nshower - 1;
01069 
01070     // index to associated slice in slice array
01071     const CandSliceHandle* showerslice = shower -> GetCandSlice();
01072     if ( showerslice ) {
01073       std::map<int,int>::iterator uidItr;
01074       uidItr = fSliceUidMap.find(showerslice->GetUidInt());
01075       if ( uidItr == fSliceUidMap.end() ) {
01076         MSG("NtpSR",Msg::kError)
01077           << "Shower slice w/Uid "
01078           << showerslice->GetUidInt()
01079           << " does not match any in slice list."
01080           << "\n shw slc will not be properly filled." << endl;
01081       }
01082       else {
01083         ntpshower->slc = uidItr->second;
01084       }
01085     }
01086     else {
01087       MSG("NtpSR",Msg::kWarning) << "No associated Slice found for shower"
01088                                  << endl;
01089       ntpshower->slc = -1;
01090     }
01091 
01092     ntpshower->ndigit = shower->GetNDigit();
01093     TIter showerstripItr(shower->GetDaughterIterator());
01094     Int_t nshowerstrip = 0;
01095     while ( CandStripHandle *showerstrip = dynamic_cast<CandStripHandle*>
01096                                                         (showerstripItr()) ) {
01097       Int_t uid = showerstrip->GetUidInt();
01098       std::map<int,int>::iterator uidItr;
01099       uidItr = fStripUidMap.find(uid);
01100       if ( uidItr == fStripUidMap.end() ) {
01101         MSG("NtpSR",Msg::kError)
01102           << "Shower strip w/Uid " << uid
01103           << " does not match any in strip list."
01104           << "\n shw stp entry will not be properly filled." << endl;
01105       }
01106       else {
01107         Int_t stripindex = uidItr->second;
01108         ntpshower->AddStripAt(stripindex,nshowerstrip); // add index to strip
01109       }
01110       nshowerstrip++;
01111     }
01112 
01113     // cluster stuff:
01114     ntpshower->ncluster = 0;
01115     ntpshower->nUcluster = 0;
01116     ntpshower->nVcluster = 0;
01117     
01118     if ( shower -> InheritsFrom("CandShowerSRHandle") ) {
01119       CandShowerSRHandle* showerSR = dynamic_cast<CandShowerSRHandle*>(shower);
01120       ntpshower->ncluster = showerSR->GetLastSubShower()+1;
01121       if ( showerSR -> GetLastSubShower() + 1 > 0 ) {
01122         ntpshower -> nUcluster = showerSR->GetNumSubShowersU();
01123         ntpshower -> nVcluster = showerSR->GetNumSubShowersV();
01124         for ( int i = 0; i < ntpshower->ncluster; i++ ) {
01125           const CandSubShowerSRHandle* showercluster=showerSR->GetSubShower(i);
01126           Int_t uid = showercluster->GetUidInt();
01127           std::map<int,int>::iterator uidItr = fClusterUidMap.find(uid);
01128           if ( uidItr == fClusterUidMap.end() ) {
01129             MSG("NtpSR",Msg::kError)
01130               << "Shower CandSubShowerSR w/Uid " << uid
01131               << " does not match any in cluster list."
01132               << " shw clu entry will not be properly filled." << endl;
01133           }
01134           else {
01135             Int_t clusterindex = uidItr->second;
01136             ntpshower -> AddClusterAt(clusterindex,i);
01137           }
01138         }
01139       }
01140     }
01141     else {
01142       ntpshower->ncluster = shower->GetLastCluster()+1;
01143       for (int i = 0; i < ntpshower->ncluster; i++ ) {
01144         const CandClusterHandle* showercluster = shower->GetCluster(i);
01145         Int_t uid = showercluster->GetUidInt();
01146         std::map<int,int>::iterator uidItr = fClusterUidMap.find(uid);
01147         if ( uidItr == fClusterUidMap.end() ) {
01148           MSG("NtpSR",Msg::kError)
01149             << "\nShower CandCluster of index " << i << " (of " 
01150             << ntpshower->ncluster << " clusters) w/Uid " << uid
01151             << " does not match any in cluster list." 
01152             << "\nshw clu entry for CandShower of index "
01153             << ntpshower->index << " w/Uid " << shower->GetUidInt() 
01154             << " will not be properly filled!" << endl;
01155         }
01156         else {
01157           Int_t clusterindex = uidItr->second;
01158           ntpshower -> AddClusterAt(clusterindex,i);
01159         }
01160         if ( showercluster->GetPlaneView() == PlaneView::kU )
01161            ntpshower->nUcluster += 1;
01162         else if (showercluster->GetPlaneView() == PlaneView::kV )
01163            ntpshower->nVcluster += 1;
01164       }
01165     }
01166  
01167     // Set range of planes included in slice
01168     ntpshower->plane.n = shower->GetNPlane();
01169     ntpshower->plane.nu = shower->GetNPlane(PlaneView::kU);
01170     ntpshower->plane.nv = shower->GetNPlane(PlaneView::kV);
01171     ntpshower->plane.beg = shower->GetBegPlane();
01172     ntpshower->plane.begu = shower->GetBegPlane(PlaneView::kU);
01173     ntpshower->plane.begv = shower->GetBegPlane(PlaneView::kV);
01174     ntpshower->plane.end = shower->GetEndPlane();
01175     ntpshower->plane.endu = shower->GetEndPlane(PlaneView::kU);
01176     ntpshower->plane.endv = shower->GetEndPlane(PlaneView::kV);
01177     // Set summed charge in shower
01178     ntpshower->ph.raw = shower->GetCharge(CalStripType::kNone);
01179     ntpshower->ph.siglin = shower->GetCharge(CalStripType::kSigLin);
01180     ntpshower->ph.sigcor = shower->GetCharge(CalStripType::kSigCorr);
01181     ntpshower->ph.pe = shower->GetCharge(CalStripType::kPE);
01182     ntpshower->ph.sigmap = shower->GetCharge(CalStripType::kSigMapped);
01183     ntpshower->ph.mip = shower->GetCharge(CalStripType::kMIP);
01184     ntpshower->ph.gev = shower->GetEnergy(CandShowerHandle::kWtCC);
01185     ntpshower->shwph.wtCCgev = shower->GetEnergy(CandShowerHandle::kWtCC);
01186     ntpshower->shwph.linCCgev = shower->GetEnergy(CandShowerHandle::kCC);
01187     ntpshower->shwph.wtNCgev = shower->GetEnergy(CandShowerHandle::kWtNC);
01188     ntpshower->shwph.linNCgev = shower->GetEnergy(CandShowerHandle::kNC);
01189     ntpshower->shwph.EMgev = shower->GetEnergy(CandShowerHandle::kEM);
01190 
01191     // Set vertex of shower
01192     NtpSRVertex& vtx = ntpshower->vtx;
01193     vtx.u = shower->GetVtxU();
01194     vtx.v = shower->GetVtxV();
01195     vtx.x = kCos45*(vtx.u-vtx.v);
01196     vtx.y = kCos45*(vtx.u+vtx.v);
01197     vtx.z = shower->GetVtxZ();
01198     vtx.t = shower->GetVtxT();
01199     vtx.plane = shower->GetVtxPlane();
01200     vtx.dcosu = shower->GetDirCosU();
01201     vtx.dcosv = shower->GetDirCosV();
01202     vtx.dcosx = kCos45*(vtx.dcosu-vtx.dcosv);
01203     vtx.dcosy = kCos45*(vtx.dcosu+vtx.dcosv);
01204     vtx.dcosz = shower->GetDirCosZ();
01205     MSG("NtpSR",Msg::kDebug) << "CandShower uid " 
01206                              << shower -> GetUidInt() << "\n"
01207                              << (*ntpshower) << endl;
01208   }
01209 
01210   return;
01211 }

void NtpSRModule::FillNtpSlice TClonesArray &  ntpslcarray,
const CandRecord cndrec
[private]
 

Definition at line 766 of file NtpSRModule.cxx.

References NtpSRSlice::AddStripAt(), NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, NtpSRPlane::end, NtpSRPlane::endu, NtpSRPlane::endv, fSliceUidMap, fStripUidMap, CandSliceHandle::GetBegPlane(), CandSliceHandle::GetCharge(), CandHandle::GetDaughterIterator(), CandSliceHandle::GetEndPlane(), CandSliceHandle::GetNDigit(), CandSliceHandle::GetNPlane(), CandSliceHandle::GetNStrip(), CandHandle::GetUidInt(), NtpSRSlice::index, MSG, NtpSRPlane::n, NtpSRSlice::ndigit, NtpSRPlane::nu, NtpSRPlane::nv, NtpSRPulseHeight::pe, NtpSRSlice::ph, NtpSRSlice::plane, NtpSRPulseHeight::raw, NtpSRPulseHeight::sigcor, and NtpSRPulseHeight::siglin.

Referenced by Reco().

00767                                                          {
00768   //
00769   //  Purpose:  Private method used to fill slice portion of ntuple record.
00770   //
00771   //  Arguments: reference to TClonesArray of NtpSRSlice's and CandRecord ptr
00772   //  
00773   //  Return: status.
00774   // 
00775 
00776   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpSlice" << endl;
00777 
00778   const CandSliceListHandle *slicelisthandle 
00779    = dynamic_cast <const CandSliceListHandle*> 
00780      (cndrec -> FindCandHandle("CandSliceListHandle"));
00781   if ( !slicelisthandle ) return; // all done
00782 
00783   Int_t nslice = 0;
00784   TIter sliceItr(slicelisthandle->GetDaughterIterator());
00785   while ( CandSliceHandle* slice=dynamic_cast<CandSliceHandle*>(sliceItr())) {
00786     Int_t uid = slice->GetUidInt();
00787     
00788     fSliceUidMap.insert(std::make_pair(uid,nslice));
00789     // Uses new with placement to efficiently create slice ntp
00790     NtpSRSlice* ntpslice = new(ntpslicearray[nslice++])
00791                         NtpSRSlice(slice->GetNStrip());
00792     ntpslice->index  = nslice-1; // index is number of slices - 1
00793     ntpslice->ndigit = slice->GetNDigit();
00794     // Fill indices of associated strips in slice tree
00795     TIter slicestripItr(slice->GetDaughterIterator());
00796     Int_t nslicestrip = 0;
00797     while ( CandStripHandle *slicestrip = dynamic_cast<CandStripHandle*>
00798                                                       (slicestripItr())) {
00799       Int_t uid = slicestrip->GetUidInt();
00800       std::map<int,int>::iterator uidItr;
00801       uidItr = fStripUidMap.find(uid);
00802       if ( uidItr == fStripUidMap.end() ) {
00803         MSG("NtpSR",Msg::kError)
00804           << "Slice strip w/Uid " << uid
00805           << " does not match any in strip list."
00806           << "\n slc stp entry will not be properly filled." << endl;
00807       }
00808       else {
00809         Int_t stripindex = uidItr->second;
00810         ntpslice->AddStripAt(stripindex,nslicestrip); // add index to strip
00811       }
00812       nslicestrip++;
00813     }
00814 
00815     // Set summed charge in slice
00816     ntpslice->ph.raw = slice->GetCharge(CalDigitType::kNone);
00817     ntpslice->ph.siglin = slice->GetCharge(CalDigitType::kSigLin);
00818     ntpslice->ph.sigcor = slice->GetCharge(CalDigitType::kSigCorr);
00819     ntpslice->ph.pe = slice->GetCharge(CalDigitType::kPE);
00820 
00821     // Set range of planes included in slice
00822     ntpslice->plane.n   =slice->GetNPlane();
00823     ntpslice->plane.beg = slice->GetBegPlane();
00824     ntpslice->plane.end = slice->GetEndPlane();
00825     ntpslice->plane.nu   = slice->GetNPlane(PlaneView::kU);
00826     ntpslice->plane.begu = slice->GetBegPlane(PlaneView::kU);
00827     ntpslice->plane.endu = slice->GetEndPlane(PlaneView::kU);
00828     ntpslice->plane.nv   = slice->GetNPlane(PlaneView::kV);
00829     ntpslice->plane.begv = slice->GetBegPlane(PlaneView::kV);
00830     ntpslice->plane.endv = slice->GetEndPlane(PlaneView::kV);
00831    
00832     MSG("NtpSR",Msg::kDebug) << "CandSlice uid " << slice-> GetUidInt() 
00833                              << "\n" << (*ntpslice) << endl;
00834   }
00835 
00836   return;
00837 }

void NtpSRModule::FillNtpStrip TClonesArray &  ntpstparray,
const CandRecord cndrec
[private]
 

Definition at line 332 of file NtpSRModule.cxx.

References NtpSRStrip::demuxveto, CandRecord::FindCandHandle(), fStripUidMap, CandDigitHandle::GetChannelId(), CandStripHandle::GetCharge(), RawChannelId::GetCrate(), CandHandle::GetDaughterIterator(), CandStripHandle::GetDemuxVetoFlag(), CandStripHandle::GetNDigit(), CandStripHandle::GetPlane(), CandStripHandle::GetPlaneView(), CandStripHandle::GetStrip(), CandStripHandle::GetTime(), CandStripHandle::GetTPos(), CandHandle::GetUidInt(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RawChannelId::GetVmm(), CandStripHandle::GetZPos(), NtpSRStrip::index, MSG, NtpSRStrip::ndigit, NtpSRPulseHeight::pe, NtpSRStrip::plane, NtpSRStrip::planeview, NtpSRPulseHeight::raw, NtpSRStrip::SetPh(), NtpSRStrip::SetPmtIndex(), NtpSRStrip::SetTime(), NtpSRPulseHeight::sigcor, NtpSRPulseHeight::siglin, NtpSRStrip::strip, NtpSRStrip::tpos, and NtpSRStrip::z.

Referenced by Reco().

00333                                                          {
00334   //
00335   //  Purpose:  Private method used to fill strip portion of ntuple record.
00336   //
00337   //  Arguments: NtpSRRecord and CandRecord
00338   //  
00339   //  Return: status.
00340   // 
00341 
00342   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpStrip" << endl;
00343 
00344   const CandStripListHandle *striplisthandle 
00345    = dynamic_cast <const CandStripListHandle*> 
00346      (cndrec->FindCandHandle("CandStripListHandle"));
00347   if ( !striplisthandle ) return; // no strips => done
00348 
00349   Int_t nstrip = 0;
00350   TIter stripItr(striplisthandle->GetDaughterIterator());
00351   while ( CandStripHandle* strip=dynamic_cast<CandStripHandle*>(stripItr())) {
00352     Int_t uid = strip->GetUidInt();
00353     fStripUidMap.insert(std::make_pair(uid,nstrip));
00354     // Uses new with placement to efficiently create strip ntp
00355     NtpSRStrip* ntpstrip = new((ntpstriparray)[nstrip++])NtpSRStrip();
00356     // Transport information from CandStrip to strip ntp
00357     ntpstrip->index = nstrip-1;
00358     ntpstrip->planeview = strip->GetPlaneView(); // plane view
00359     ntpstrip->ndigit = strip->GetNDigit();
00360     ntpstrip->demuxveto = strip->GetDemuxVetoFlag();
00361     ntpstrip->strip = strip->GetStrip(); // strip number
00362     ntpstrip->plane = strip->GetPlane(); // plane number
00363     ntpstrip->tpos = strip->GetTPos();  // tpos
00364     ntpstrip->z = strip->GetZPos();  // zpos
00365 
00366     // Raw channel id of first digit associated with each end
00367     bool negEndDone = false;
00368     bool posEndDone = false;
00369     TIter digitItr(strip -> GetDaughterIterator());
00370     while (CandDigitHandle* digit=dynamic_cast<CandDigitHandle*>(digitItr())) {
00371       const RawChannelId& rawch = digit->GetChannelId();
00372       Int_t pmtindex = rawch.GetCrate()*108 + rawch.GetVarcId()*36
00373                   +rawch.GetVmm()*6 + rawch.GetVaAdcSel()*3+rawch.GetVaChip();
00374       if ( !negEndDone && 
00375            digit -> GetPlexSEIdAltL().GetEnd()==StripEnd::kNegative) { 
00376         ntpstrip->SetPmtIndex(pmtindex,0); negEndDone = true;  
00377       }
00378       else if( !posEndDone && 
00379               digit -> GetPlexSEIdAltL().GetEnd()==StripEnd::kPositive) {
00380         ntpstrip->SetPmtIndex(pmtindex,1); posEndDone = true;
00381       }  
00382     }
00383 
00384     // Strip end dependent quantities
00385     for (UInt_t i = 0; i < 2; i++ ) {
00386       StripEnd::EStripEnd stripend = StripEnd::kNegative;
00387       if (i == 1) stripend = StripEnd::kPositive;
00388       if ( strip->GetNDigit(stripend) > 0 ) {
00389         NtpSRPulseHeight ph;
00390         ph.raw = strip->GetCharge(CalDigitType::kNone,stripend);
00391         ph.siglin = strip->GetCharge(CalDigitType::kSigLin,stripend);
00392         ph.sigcor = strip->GetCharge(CalDigitType::kSigCorr,stripend);
00393         ph.pe = strip->GetCharge(CalDigitType::kPE,stripend);
00394         ntpstrip->SetPh(ph,i); 
00395         ntpstrip->SetTime(strip->GetTime(stripend),i);
00396       }
00397     }
00398     MSG("NtpSR",Msg::kVerbose) << (*ntpstrip) << endl;
00399   } // done with all strips
00400 
00401  
00402   return;
00403 
00404 }

void NtpSRModule::FillNtpTrack TClonesArray &  ntptrkarray,
const CandRecord cndrec
[private]
 

Definition at line 1371 of file NtpSRModule.cxx.

References NtpSRTrack::AddStripAt(), NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, NtpSRTrack::cputime, NtpSRTrack::cr, Calibrator::DecalStripToStrip(), Calibrator::DecalTime(), NtpSRTrack::ds, NtpSRPlane::end, NtpSRPlane::endu, NtpSRPlane::endv, FillNtpTrackCosmicRay(), FillNtpTrackEnd(), FillNtpTrackFidAll(), FillNtpTrackFidEnd(), FillNtpTrackFidVtx(), FillNtpTrackFit(), FillNtpTrackLinearFit(), FillNtpTrackMomentum(), FillNtpTrackTime(), FillNtpTrackVertex(), CandRecord::FindCandHandle(), fSliceUidMap, fStripUidMap, fTrackUidMap, CandFitTrackSRHandle::GetBadFit(), CandRecoHandle::GetBegPlane(), CandStripHandle::GetCharge(), CandRecoHandle::GetCharge(), CandTrackSRListHandle::GetCPUTime(), CandHandle::GetDaughterIterator(), CandTrackHandle::GetdS(), CandRecoHandle::GetEndPlane(), CandHandle::GetNDaughters(), CandStripHandle::GetNDigit(), CandRecoHandle::GetNDigit(), CandRecoHandle::GetNPlane(), CandRecoHandle::GetNStrip(), CandFitTrackSRHandle::GetNTrackPlane(), CandTrackSRHandle::GetNTrackPlane(), CandStripHandle::GetPlane(), CandFitTrackSRHandle::GetPlaneChi2(), CandFitTrackSRHandle::GetPlanePreChi2(), CandFitTrackSRHandle::GetPlaneQP(), CandTrackHandle::GetRange(), CandRecoHandle::GetStripCharge(), CandStripHandle::GetStripEndId(), CandTrackHandle::GetT(), CandTrackHandle::GetU(), CandHandle::GetUidInt(), CandTrackHandle::GetV(), RecMinos::GetVldContext(), CandTrackHandle::GetZ(), NtpSRStripPulseHeight::gev, NtpSRTrack::index, Calibrator::Instance(), kCos45, NtpSRStripPulseHeight::mip, MSG, NtpSRPlane::n, NtpSRTrack::ndigit, 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, NtpSRStripPulseHeight::sigmap, NtpSRTrack::slc, NtpSRTrack::stpds, NtpSRTrack::stpfit, NtpSRTrack::stpfitchi2, NtpSRTrack::stpfitprechi2, NtpSRTrack::stpfitqp, NtpSRTrack::stpu, NtpSRTrack::stpv, NtpSRTrack::stpx, NtpSRTrack::stpy, and NtpSRTrack::stpz.

Referenced by Reco().

01372                                                          {
01373   //
01374   //  Purpose:  Private method used to fill track portion of ntuple record.
01375   //
01376   //  Arguments: TClonesArray of NtpSRTrack's and CandRecord ptr
01377   //  
01378   //  Return: none.
01379   // 
01380 
01381 
01382   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpTrack" << endl;
01383 
01384   const CandTrackListHandle *tracklisthandle 
01385      = dynamic_cast <const CandTrackListHandle*> 
01386      (cndrec -> FindCandHandle("CandFitTrackListHandle"));
01387   if ( !tracklisthandle ) {
01388     tracklisthandle = dynamic_cast <const CandTrackListHandle*>
01389       (cndrec -> FindCandHandle("CandTrackListHandle"));
01390   }
01391   if ( !tracklisthandle ) return;
01392 
01393   CandTrackSRListHandle* tracksrlisthandle=dynamic_cast<CandTrackSRListHandle*>
01394                       (cndrec->FindCandHandle("CandTrackSRListHandle"));
01395 
01396   const VldContext& vld = *(cndrec->GetVldContext());
01397   
01398   TIter trackItr(tracklisthandle->GetDaughterIterator());
01399   Int_t ntrack = 0;
01400   while (CandTrackHandle* track = dynamic_cast<CandTrackHandle*>(trackItr())){
01401     if(track->GetNDaughters()==0 && 
01402        track->InheritsFrom("CandFitTrackHandle") &&  
01403        dynamic_cast<CandFitTrackHandle*>(track)->GetFinderTrack()){
01404       track = dynamic_cast<CandFitTrackHandle*>(track)->GetFinderTrack();
01405     }
01406     Int_t uid = track->GetUidInt();
01407     fTrackUidMap.insert(std::make_pair(uid,ntrack));
01408     // Uses new with placement to efficiently create event ntp
01409     NtpSRTrack* ntptrack 
01410              = new(ntptrackarray[ntrack++])NtpSRTrack(track->GetNStrip());
01411     ntptrack->index = ntrack-1;
01412 
01413     // index to associated slice in slice array
01414     const CandSliceHandle* trackslice = track -> GetCandSlice();
01415     if ( trackslice ) {
01416       std::map<int,int>::iterator uidItr;
01417       uidItr = fSliceUidMap.find(trackslice->GetUidInt());
01418       if ( uidItr == fSliceUidMap.end() ) {
01419         MSG("NtpSR",Msg::kError)
01420           << "Track slice w/Uid "
01421           << trackslice->GetUidInt()
01422           << " does not match any in slice list."
01423           << "\n trk slc will not be properly filled." << endl;
01424       }
01425       else {
01426         ntptrack->slc = uidItr->second;
01427       }
01428     }
01429     else {
01430       MSG("NtpSR",Msg::kWarning) << "No associated Slice found for track"
01431                                  << endl;
01432       ntptrack->slc = -1;
01433     }
01434 
01435     ntptrack->ndigit = track->GetNDigit();
01436 
01437     CandTrackSRHandle *tracksr = dynamic_cast<CandTrackSRHandle*>(track);
01438     //CandFitTrackHandle *fittrack = dynamic_cast<CandFitTrackHandle*>(track);
01439     CandFitTrackSRHandle *fittracksr
01440                                 =dynamic_cast<CandFitTrackSRHandle*>(track);
01441 
01442     // Set range of planes included in track
01443     NtpSRTrackPlane& plane = ntptrack->plane;
01444     plane.n = track->GetNPlane();
01445     plane.nu = track->GetNPlane(PlaneView::kU);
01446     plane.nv = track->GetNPlane(PlaneView::kV);
01447     plane.beg = track->GetBegPlane();
01448     plane.begu = track->GetBegPlane(PlaneView::kU);
01449     plane.begv = track->GetBegPlane(PlaneView::kV);
01450     plane.end = track->GetEndPlane();
01451     plane.endu = track->GetEndPlane(PlaneView::kU);
01452     plane.endv = track->GetEndPlane(PlaneView::kV);
01453     if (tracksr) plane.ntrklike = tracksr->GetNTrackPlane();
01454     if (fittracksr) plane.ntrklike = fittracksr->GetNTrackPlane();
01455 
01456     // Set summed pulse height information for track
01457     NtpSRStripPulseHeight& ph = ntptrack->ph;
01458     ph.raw = track->GetCharge(CalStripType::kNone);
01459     ph.siglin = track->GetCharge(CalStripType::kSigLin);
01460     ph.sigcor = track->GetCharge(CalStripType::kSigCorr);
01461     ph.pe = track->GetCharge(CalStripType::kPE);
01462     ph.sigmap = track->GetCharge(CalStripType::kSigMapped);
01463     ph.mip = track->GetCharge(CalStripType::kMIP);
01464     ph.gev = track->GetCharge(CalStripType::kGeV);
01465     
01466     ntptrack->ds = track->GetdS(); // distance from vertex to end
01467     ntptrack->range = track->GetRange(); // g/cm**2 from vertex to end
01468     // CPU to create track list
01469     if (tracksrlisthandle) ntptrack->cputime = tracksrlisthandle->GetCPUTime();
01470 
01471     this->FillNtpTrackVertex(ntptrack,track);
01472     this->FillNtpTrackEnd(ntptrack,track);
01473     this->FillNtpTrackLinearFit(ntptrack,track);
01474 
01475     this->FillNtpTrackFidVtx(ntptrack,track,vld);
01476     this->FillNtpTrackFidEnd(ntptrack,track,vld);
01477     this->FillNtpTrackFidAll(ntptrack,track,vld);
01478 
01479     this->FillNtpTrackFit(ntptrack,track);
01480     this->FillNtpTrackMomentum(ntptrack,track);
01481     this->FillNtpTrackTime(ntptrack,track);
01482 
01483     NtpSRCosmicRay& ntpcosmicray = ntptrack->cr;
01484     this->FillNtpTrackCosmicRay(ntpcosmicray,ntptrack,vld);
01485 
01486     // Loop over strips associated with track
01487     TIter trackstripItr(track->GetDaughterIterator());
01488     Int_t ntrackstrip = 0;
01489     // Fill indices of associated strips in track ntuple
01490     while ( CandStripHandle *trackstrip = dynamic_cast<CandStripHandle*>
01491                                                       (trackstripItr())) {
01492       Int_t uid = trackstrip->GetUidInt();
01493       std::map<int,int>::iterator uidItr;
01494       uidItr = fStripUidMap.find(uid);
01495       if ( uidItr == fStripUidMap.end() ) {
01496         MSG("NtpSR",Msg::kError)
01497           << "Track strip w/Uid " << uid
01498           << " does not match any in strip list."
01499           << "\n trk stp entry will not be properly filled." << endl;
01500       }
01501       else {
01502         Int_t stripindex = uidItr->second;
01503         ntptrack->AddStripAt(stripindex,ntrackstrip); // add index to strip
01504       }
01505 
01506       // Track positional information at plane associated with each strip
01507       Int_t iplane = trackstrip->GetPlane();
01508       ntptrack->stpu[ntrackstrip] = track->GetU(iplane);
01509       ntptrack->stpv[ntrackstrip] = track->GetV(iplane);
01510       ntptrack->stpx[ntrackstrip] = kCos45*(ntptrack->stpu[ntrackstrip]
01511                                           -ntptrack->stpv[ntrackstrip]);
01512       ntptrack->stpy[ntrackstrip] = kCos45*(ntptrack->stpu[ntrackstrip]
01513                                           +ntptrack->stpv[ntrackstrip]);
01514       ntptrack->stpz[ntrackstrip] = track->GetZ(iplane);
01515       // dS is travel distance from vertex
01516       ntptrack->stpds[ntrackstrip] = track->GetdS(iplane);
01517  
01518       // Fit track dependent quantities
01519       if ( fittracksr ) {
01520         ntptrack->stpfitchi2[ntrackstrip] = fittracksr->GetPlaneChi2(iplane);
01521         ntptrack->stpfitprechi2[ntrackstrip] 
01522                                        = fittracksr->GetPlanePreChi2(iplane);
01523         ntptrack->stpfitqp[ntrackstrip] = fittracksr->GetPlaneQP(iplane);
01524         if ( fittracksr->GetBadFit(iplane) ) ntptrack->stpfit[ntrackstrip] = 0;
01525       }
01526       else{
01527         ntptrack->stpfitchi2[ntrackstrip] = 0;
01528         ntptrack->stpfitprechi2[ntrackstrip] =0;
01529         ntptrack->stpfitqp[ntrackstrip] = 0;
01530         ntptrack->stpfit[ntrackstrip] = 0;
01531       }
01532 
01533       // Strip end dependent quantities
01534       for (UInt_t i = 0; i < 2; i++ ) {
01535         StripEnd::EStripEnd stripend = StripEnd::kNegative;
01536         if (i == 1) stripend = StripEnd::kPositive;
01537         if ( trackstrip->GetNDigit(stripend) > 0 ) {
01538           Float_t sigmap = track->GetStripCharge(trackstrip,
01539                                           CalStripType::kSigMapped,stripend);
01540           Float_t mip = track->GetStripCharge(trackstrip,
01541                                           CalStripType::kMIP,stripend);
01542           Float_t gev = track->GetStripCharge(trackstrip,
01543                                           CalStripType::kGeV,stripend);
01544           ntptrack->SetPh(sigmap,mip,gev,ntrackstrip,i); 
01545           ntptrack->SetTime(track->GetT(iplane,stripend),ntrackstrip,i);
01546 
01547           // New, NJT 07/04
01548           // Will now fill with default values if real ones don't exist.
01549           // Uses Calibrator configuration, not a custom thing.
01550           // Use DecalStripToStrip on input charge 1 to get muon C0
01551           double c0 = Calibrator::Instance().DecalStripToStrip(1.0,
01552                                  trackstrip->GetStripEndId(stripend));
01553           ntptrack->SetAttnC0(c0,ntrackstrip,i);
01554           // Use DecalTime on input time 0 to get time offset
01555           double t0 = Calibrator::Instance().DecalTime(0.0,
01556                  trackstrip->GetCharge(CalDigitType::kNone,stripend),
01557                  trackstrip->GetStripEndId(stripend));
01558           ntptrack->SetCalT0(t0,ntrackstrip,i);
01559         }
01560       } 
01561       ntrackstrip++;
01562     } // loop over all track strips
01563     
01564     MSG("NtpSR",Msg::kDebug) << (*ntptrack) << endl;
01565         
01566   }
01567 
01568   return;
01569 
01570 }

void NtpSRModule::FillNtpTrackCosmicRay NtpSRCosmicRay ntpcosmicray,
const NtpSRTrack ntptrack,
const VldContext vld
[private]
 

Definition at line 1662 of file NtpSRModule.cxx.

References NtpSRCosmicRay::azimuth, AstUtil::CalendarToJulian(), NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, NtpSRCosmicRay::dec, AstUtil::EquatorialToCelestial(), VldTimeStamp::GetDate(), VldContext::GetDetector(), AstUtil::GetDetLatitude(), AstUtil::GetDetLongitude(), VldTimeStamp::GetTime(), VldContext::GetTimeStamp(), AstUtil::GSTToLST(), AstUtil::HorizonToEquatorial(), NtpSRCosmicRay::juliandate, AstUtil::JulianToGAST(), AstUtil::LocalToHorizon(), NtpSRCosmicRay::locsiderialtime, MSG, NtpSRCosmicRay::ra, NtpSRCosmicRay::rahourangle, NtpSRTrack::vtx, and NtpSRCosmicRay::zenith.

Referenced by FillNtpTrack(), and Reco().

01664                                                                 {
01665   //
01666   //  Purpose:  Private method used to fill NtpSRTrack cr data member
01667   //            given a pointer to the ntuple track and a pointer to the
01668   //            associated CandTrackHandle.
01669   //
01670   //  Return: none.
01671   // 
01672 
01673 
01674   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackCosmicRay" << endl;
01675   if ( !ntptrack ) return;
01676 
01677   DetectorType::Detector_t dettype = vldc.GetDetector();
01678 
01679  // Reverse sign for pointing track back up to source
01680   Float_t dcosx = -(ntptrack->vtx.dcosx);
01681   Float_t dcosy = -(ntptrack->vtx.dcosy);
01682   Float_t dcosz = -(ntptrack->vtx.dcosz);
01683 
01684   Double_t altitude,azimuth;
01685   AstUtil::LocalToHorizon(dcosx,dcosy,dcosz,dettype,altitude,azimuth);
01686   // Zenith = 90 - altitude
01687   ntpcosmicray.zenith = 90. - altitude;
01688   ntpcosmicray.azimuth = azimuth;
01689 
01690   UInt_t dyear,dmonth,dday,dhour,dminute,dsec;
01691   vldc.GetTimeStamp().GetDate(kTRUE,0,&dyear,&dmonth,&dday);
01692   vldc.GetTimeStamp().GetTime(kTRUE,0,&dhour,&dminute,&dsec);
01693   
01694   int year    = dyear;
01695   int month   = dmonth;
01696   int day     = dday;
01697   double hour = dhour + (dminute + (dsec)/60.)/60.;
01698 
01699   AstUtil::CalendarToJulian(year,month,day,hour,ntpcosmicray.juliandate);
01700   double longitude = AstUtil::GetDetLongitude(dettype);
01701   double latitude = AstUtil::GetDetLatitude(dettype);
01702 
01703   double gast;  // in hours
01704   AstUtil::JulianToGAST(ntpcosmicray.juliandate,gast);
01705   double last;
01706   AstUtil::GSTToLST(gast,longitude,last);
01707   // sidereal time misspelled here for historical consistency
01708   ntpcosmicray.locsiderialtime = last; 
01709   double hourangle, declination;
01710   AstUtil::HorizonToEquatorial(altitude,azimuth,latitude,hourangle,
01711                                                          declination);
01712   ntpcosmicray.dec = declination;
01713   double ra;
01714   AstUtil::EquatorialToCelestial(hourangle,gast,longitude,ra);
01715   ntpcosmicray.ra = ra;
01716 
01717   ntpcosmicray.rahourangle = ntpcosmicray.ra*12./180.; // hours
01718 
01719   return;
01720 
01721 }

void NtpSRModule::FillNtpTrackEnd NtpSRTrack ntptrack,
const CandTrackHandle track
[private]
 

Definition at line 2037 of file NtpSRModule.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(), CandFitTrackSRHandle::GetEnddUError(), CandFitTrackSRHandle::GetEnddVError(), CandRecoHandle::GetEndPlane(), CandRecoHandle::GetEndT(), CandRecoHandle::GetEndU(), CandFitTrackSRHandle::GetEndUError(), CandRecoHandle::GetEndV(), CandFitTrackSRHandle::GetEndVError(), CandRecoHandle::GetEndZ(), kCos45, MSG, NtpSRVertex::plane, NtpSRVertex::t, NtpSRVertex::u, NtpSRVertex::v, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillNtpTrack().

02038                                                                 {
02039   //
02040   //  Purpose:  Private method used to fill end portion of ntuple track.
02041   //
02042   //  Arguments: NtpSRTrack to fill and const CandTrackHandle pointer.
02043   //  
02044   //  Return: status.
02045   // 
02046 
02047 
02048   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackEnd" << endl;
02049 
02050   NtpSRVertex& end = ntptrack->end;
02051 
02052   end.u = track->GetEndU();
02053   end.v = track->GetEndV();
02054   end.x = kCos45*(end.u-end.v);
02055   end.y = kCos45*(end.u+end.v);
02056   end.z = track->GetEndZ();
02057   end.t = track->GetEndT();
02058   end.plane = track->GetEndPlane();
02059   end.dcosu = track->GetEndDirCosU();
02060   end.dcosv = track->GetEndDirCosV();
02061   end.dcosx = kCos45*(end.dcosu-end.dcosv);
02062   end.dcosy = kCos45*(end.dcosu+end.dcosv);
02063   end.dcosz = track->GetEndDirCosZ();
02064 
02065   const CandFitTrackSRHandle* fittracksr
02066                     =dynamic_cast<const CandFitTrackSRHandle*>(track);
02067   if ( fittracksr ) {
02068     end.eu = fittracksr->GetEndUError();
02069     end.ev = fittracksr->GetEndVError();
02070     end.ex = kCos45*sqrt(end.eu*end.eu+end.ev*end.ev);
02071     end.ey = kCos45*sqrt(end.eu*end.eu+end.ev*end.ev);
02072     Double_t edudz = fittracksr->GetEnddUError();
02073     Double_t edvdz = fittracksr->GetEnddVError();
02074     // These calculations should include the dudz and dvdz covariance terms
02075     // but currently the covariance terms are not accessible
02076     end.edcosz = fabs(end.dcosz)*sqrt(pow(end.dcosu*edudz,2)+
02077                                       pow(end.dcosv*edvdz,2));
02078     end.edcosu = sqrt(fabs(end.dcosz))*sqrt(pow(end.dcosu*end.dcosv*edvdz,2)
02079                + pow((pow(end.dcosz,2)+pow(end.dcosv,2))*edudz,2));
02080     end.edcosv = sqrt(fabs(end.dcosz))*sqrt(pow(end.dcosu*end.dcosv*edudz,2)
02081                + pow((pow(end.dcosz,2)+pow(end.dcosu,2))*edvdz,2));
02082     end.edcosx = kCos45*sqrt(end.edcosu*end.edcosu+end.edcosv*end.edcosv);
02083     end.edcosy = kCos45*sqrt(end.edcosu*end.edcosu+end.edcosv*end.edcosv);
02084   }
02085 
02086   return;
02087 
02088 }

void NtpSRModule::FillNtpTrackFidAll NtpSRTrack ntptrack,
const CandTrackHandle track,
const VldContext vld
[private]
 

Definition at line 1935 of file NtpSRModule.cxx.

References NtpSRFiducial::dr, NtpSRFiducial::dz, NtpSRTrack::fidall, NtpSRTrack::fidend, NtpSRTrack::fidvtx, FillNtpFiducialDistance(), CandHandle::GetDaughterIterator(), CandStripHandle::GetPlane(), CandTrackHandle::GetU(), CandTrackHandle::GetV(), CandTrackHandle::GetZ(), kCos45, max(), min(), MSG, NtpSRFiducial::nplane, NtpSRFiducial::nplaneu, NtpSRFiducial::nplanev, NtpSRVertex::plane, NtpSRFiducial::trace, NtpSRFiducial::tracez, NtpSRVertex::u, NtpSRVertex::v, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillNtpTrack().

01937                                                             {
01938   //
01939   //  Purpose:  Private method used to fill NtpSRTrack fidall data member
01940   //            given a pointer to the ntuple track, a pointer to the
01941   //            associated CandTrackHandle, and the vldcontext of the
01942   //            event.
01943   //
01944   //  Return: none.
01945   //
01946   //  Notes: This method should be called after FillNtpTrackFidAll
01947   //         and FillNtpFiducialEnd 
01948 
01949 
01950   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpFiducialAll" << endl;
01951 
01952   NtpSRFiducial& fidall = ntptrack->fidall;
01953 
01954   NtpSRFiducial fidtmp;
01955   NtpSRVertex vtxtmp;
01956   fidall.dr = min(ntptrack->fidvtx.dr,ntptrack->fidend.dr);
01957   fidall.dz = min(ntptrack->fidvtx.dz,ntptrack->fidend.dz);
01958   fidall.trace   = min(ntptrack->fidvtx.trace,ntptrack->fidend.trace);
01959   fidall.tracez  = min(ntptrack->fidvtx.tracez,ntptrack->fidend.tracez);
01960   fidall.nplane  = max(ntptrack->fidvtx.nplane,ntptrack->fidend.nplane);
01961   fidall.nplaneu  = max(ntptrack->fidvtx.nplaneu,ntptrack->fidend.nplaneu);
01962   fidall.nplanev  = max(ntptrack->fidvtx.nplanev,ntptrack->fidend.nplanev);
01963 
01964   TIter trackstripItr(track->GetDaughterIterator());
01965   while(CandStripHandle* trackstrip = dynamic_cast<CandStripHandle*>
01966         (trackstripItr())) {
01967     // For all strips calculate closest approach to boundaries
01968     Int_t iplane = trackstrip->GetPlane();
01969     vtxtmp.plane = iplane;
01970     vtxtmp.u = track->GetU(iplane);
01971     vtxtmp.v = track->GetV(iplane);
01972     vtxtmp.x = kCos45*(vtxtmp.u-vtxtmp.v);
01973     vtxtmp.y = kCos45*(vtxtmp.u+vtxtmp.v);
01974     vtxtmp.z = track->GetZ(iplane);
01975     this->FillNtpFiducialDistance(fidtmp,vtxtmp,vld); // fills dr,dz
01976     fidall.dr = min(fidtmp.dr,fidall.dr);
01977     fidall.dz = min(fidtmp.dz,fidall.dz);
01978   }
01979 
01980   return;
01981 
01982 }

void NtpSRModule::FillNtpTrackFidEnd NtpSRTrack ntptrack,
const CandTrackHandle track,
const VldContext vld
[private]
 

Definition at line 1901 of file NtpSRModule.cxx.

References NtpSRTrack::end, NtpSRTrack::fidend, FillNtpFiducialDistance(), CandFitTrackSRHandle::GetEndExtrapolate(), CandTrackHandle::GetEndTrace(), CandTrackHandle::GetEndTraceZ(), MSG, NtpSRFiducial::nplane, NtpSRFiducial::nplaneu, NtpSRFiducial::nplanev, NtpSRFiducial::trace, and NtpSRFiducial::tracez.

Referenced by FillNtpTrack().

01903                                                             {
01904   //
01905   //  Purpose:  Private method used to fill NtpSRTrack fidend data member
01906   //            given a pointer to the ntuple track, a pointer to the
01907   //            associated CandTrackHandle, and the vldcontext of the
01908   //            event.
01909   //
01910   //  Return: none.
01911   // 
01912 
01913 
01914   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackFidEnd" << endl;
01915 
01916   NtpSRFiducial& fid = ntptrack->fidend;
01917   NtpSRVertex& end = ntptrack->end;
01918   this->FillNtpFiducialDistance(fid,end,vld); // fills dr,dz
01919 
01920   fid.trace   = track->GetEndTrace();
01921   fid.tracez  = track->GetEndTraceZ();
01922 
01923   const CandFitTrackSRHandle* fittracksr 
01924     = dynamic_cast<const CandFitTrackSRHandle*>(track);
01925   if ( fittracksr ) {                                     
01926     fid.nplane  = fittracksr->GetEndExtrapolate();
01927     fid.nplaneu = fittracksr->GetEndExtrapolate(PlaneView::kU);
01928     fid.nplanev = fittracksr->GetEndExtrapolate(PlaneView::kV);
01929   }  
01930 
01931   return;
01932 
01933 }

void NtpSRModule::FillNtpTrackFidVtx NtpSRTrack ntptrack,
const CandTrackHandle track,
const VldContext vld
[private]
 

Definition at line 1867 of file NtpSRModule.cxx.

References NtpSRTrack::fidvtx, FillNtpFiducialDistance(), CandFitTrackSRHandle::GetVtxExtrapolate(), CandTrackHandle::GetVtxTrace(), CandTrackHandle::GetVtxTraceZ(), MSG, NtpSRFiducial::nplane, NtpSRFiducial::nplaneu, NtpSRFiducial::nplanev, NtpSRFiducial::trace, NtpSRFiducial::tracez, and NtpSRTrack::vtx.

Referenced by FillNtpTrack().

01869                                                             {
01870   //
01871   //  Purpose:  Private method used to fill NtpSRTrack fidvtx data member
01872   //            given a pointer to the ntuple track, a pointer to the
01873   //            associated CandTrackHandle, and the vldcontext of the
01874   //            event.
01875   //
01876   //  Return: none.
01877   // 
01878 
01879 
01880   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackFidVtx" << endl;
01881 
01882   NtpSRFiducial& fid = ntptrack->fidvtx;
01883   NtpSRVertex& vtx = ntptrack->vtx;
01884   this->FillNtpFiducialDistance(fid,vtx,vld); // fills dr,dz
01885 
01886   fid.trace   = track->GetVtxTrace();
01887   fid.tracez  = track->GetVtxTraceZ();
01888 
01889   const CandFitTrackSRHandle* fittracksr 
01890     = dynamic_cast<const CandFitTrackSRHandle*>(track);
01891   if ( fittracksr ) {                                     
01892     fid.nplane  = fittracksr->GetVtxExtrapolate();
01893     fid.nplaneu = fittracksr->GetVtxExtrapolate(PlaneView::kU);
01894     fid.nplanev = fittracksr->GetVtxExtrapolate(PlaneView::kV);
01895   }  
01896 
01897   return;
01898 
01899 }

void NtpSRModule::FillNtpTrackFit NtpSRTrack ntptrack,
const CandTrackHandle track
[private]
 

Definition at line 1832 of file NtpSRModule.cxx.

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

Referenced by FillNtpTrack().

01833                                                                 {
01834   //
01835   //  Purpose:  Private method used to fill NtpSRTrack fit data member
01836   //            given a pointer to the ntuple track and a pointer to the
01837   //            associated CandTrackHandle.
01838   //
01839   //  Return: none.
01840   // 
01841 
01842 
01843   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackFit" << endl;
01844 
01845   NtpSRFitTrack& fit = ntptrack->fit;
01846 
01847   const CandFitTrackHandle* fittrack 
01848     = dynamic_cast<const CandFitTrackHandle*>(track);
01849   if ( fittrack ) {
01850     fit.chi2 = fittrack->GetChi2();
01851     fit.pass = fittrack->GetPass();
01852     fit.ndof      = fittrack->GetNDOF();
01853     fit.niterate  = fittrack->GetNIterate();
01854     fit.cputime   = fittrack->GetCPUTime();
01855   }
01856 
01857   const CandFitTrackSRHandle* fittracksr 
01858     = dynamic_cast<const CandFitTrackSRHandle*>(track);
01859   if ( fittracksr ) {
01860     fit.nswimfail = fittracksr->GetNSwimFail();
01861   }
01862 
01863   return;
01864 
01865 }

void NtpSRModule::FillNtpTrackLinearFit NtpSRTrack ntptrack,
const CandTrackHandle track
[private]
 

Definition at line 2090 of file NtpSRModule.cxx.

References NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, CandStripHandle::GetCharge(), CandHandle::GetDaughterIterator(), CandStripHandle::GetPlane(), CandStripHandle::GetPlaneView(), CandRecoHandle::GetTimeSlope(), CandStripHandle::GetTPos(), CandRecoHandle::GetVtxT(), CandRecoHandle::GetVtxZ(), CandStripHandle::GetZPos(), kCos45, NtpSRTrack::lin, MSG, NtpSRVertex::t, NtpSRVertex::u, NtpSRVertex::v, LinearFit::Weighted(), NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillNtpTrack().

02091                                                                       {
02092   //
02093   //  Purpose:  Private method used to fill linar fit track portion of 
02094   //            ntuple track.
02095   //
02096   //  Arguments: NtpSRTrack to fill and const CandTrackHandle pointer.
02097   //  
02098   //  Return: status.
02099   // 
02100 
02101 
02102   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackLinearFit" << endl;
02103 
02104   // First array dimension is view (u or v)
02105   // Second array dimension is plane number
02106   const Int_t nplane = 1000;
02107   Double_t uzfit[nplane]={0},vzfit[nplane]={0},ufit[nplane]={0};
02108   Double_t vfit[nplane]={0},uwfit[nplane]={0},vwfit[nplane]={0};
02109   Double_t uph[nplane]={0},vph[nplane]={0};
02110 
02111   // Loop over all strips on track
02112   TIter trackstripItr(track->GetDaughterIterator());
02113   while(CandStripHandle* trackstrip = dynamic_cast<CandStripHandle*>
02114         (trackstripItr())) {
02115 
02116     Float_t tpos = trackstrip->GetTPos();
02117     Float_t phend[2]  = {trackstrip->GetCharge(StripEnd::kNegative),
02118                          trackstrip->GetCharge(StripEnd::kPositive)};
02119     Float_t phsum   = phend[0] + phend[1];
02120 
02121     Int_t iplane = trackstrip->GetPlane();
02122     assert(iplane >= 0 && iplane < nplane);
02123 
02124     if ( trackstrip->GetPlaneView()==PlaneView::kU ) {
02125       uzfit[iplane] = trackstrip->GetZPos();
02126       ufit[iplane] += tpos*phsum; // pulse height weighted average of tpos
02127       uph[iplane]  += phsum;  // summed pulse height both ends 
02128       uwfit[iplane] = 1;   // weight assigned for use in fit
02129     }
02130     else if ( trackstrip->GetPlaneView()==PlaneView::kV ) {
02131       vzfit[iplane] = trackstrip->GetZPos();
02132       vfit[iplane] += tpos*phsum; // pulse height weighted average of tpos
02133       vph[iplane]  += phsum;  // summed pulse height both ends 
02134       vwfit[iplane] = 1;   // weight assigned for use in fit
02135     }
02136 
02137   }
02138 
02139   // Finished with loop over all strips, calculate fit results
02140   NtpSRVertex& lin = ntptrack->lin;
02141   lin.z = track->GetVtxZ();
02142   lin.t = track->GetVtxT();
02143   Int_t timesign = 1;
02144   if ( track->GetTimeSlope() < 0. ) timesign = -1;
02145  
02146   Int_t nhitplane[2] = {0};
02147   for ( Int_t ip = 0; ip < nplane; ip++ ) {
02148     if ( uph[ip] > 0 ) { nhitplane[0]++; ufit[ip] /= uph[ip]; }
02149     if ( vph[ip] > 0 ) { nhitplane[1]++; vfit[ip] /= vph[ip]; }
02150   }
02151 
02152   Double_t uparm[2]={0},ueparm[2]={0},vparm[2]={0},veparm[2]={0};
02153   if ( nhitplane[0] > 1 ) {
02154      LinearFit::Weighted(nplane,uzfit,ufit,uwfit,uparm,ueparm);
02155   }
02156   if ( nhitplane[1] > 1 ) {
02157     LinearFit::Weighted(nplane,vzfit,vfit,vwfit,vparm,veparm);
02158   }
02159 
02160   if ( nhitplane[0] > 1 || nhitplane[1] > 1 ) {
02161     // Need at least one of two views to make attempt at filling direction
02162     Double_t dvdz = vparm[1];
02163     lin.v = vparm[0]+lin.z*dvdz;
02164     Double_t dudz = uparm[1];
02165     lin.u = uparm[0]+lin.z*dudz;
02166     Double_t anorm = sqrt(1.+dudz*dudz+dvdz*dvdz);
02167     lin.dcosu = timesign*dudz/anorm;
02168     lin.dcosv = timesign*dvdz/anorm;
02169     lin.dcosz = timesign*1./anorm;
02170   }
02171 
02172   if ( nhitplane[0] > 1 && nhitplane[1] > 1 ) {
02173     // Need both u&z views fit to rotate to x,y
02174     Double_t dxdz = kCos45*(uparm[1]-vparm[1]);
02175     Double_t dydz = kCos45*(uparm[1]+vparm[1]);
02176     Double_t anorm = sqrt(1.+dxdz*dxdz+dydz*dydz);
02177     lin.dcosx = timesign*dxdz/anorm;
02178     lin.dcosy = timesign*dydz/anorm;
02179     lin.x = kCos45*(uparm[0]-vparm[0])+lin.z*dxdz; // Xv = Xint + dx/dz * Zv
02180     lin.y = kCos45*(uparm[0]+vparm[0])+lin.z*dydz;
02181   }
02182 
02183   return;
02184 
02185 }

void NtpSRModule::FillNtpTrackMomentum NtpSRTrack ntptrack,
const CandTrackHandle track
[private]
 

Definition at line 1626 of file NtpSRModule.cxx.

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

Referenced by FillNtpTrack().

01627                                                                      {
01628   //
01629   //  Purpose:  Private method used to fill NtpSRTrack momentum data member
01630   //            given a pointer to the ntuple track and a pointer to the
01631   //            associated CandTrackHandle.
01632   //
01633   //  Return: none.
01634   // 
01635 
01636 
01637   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackMomentum" << endl;
01638 
01639   NtpSRMomentum& momentum = ntptrack->momentum;
01640   momentum.range = track->GetMomentum();
01641 
01642   const CandFitTrackHandle* fittrack 
01643     = dynamic_cast<const CandFitTrackHandle*>(track);
01644   if ( fittrack ) {
01645     // Guard against divide by 0
01646     Double_t pcurve = max(fittrack->GetMomentumCurve(),0.001);
01647     //if ( ntptrack->fit.pass ) momentum.qp = fittrack->GetEMCharge()/pcurve;
01648     momentum.qp = fittrack->GetEMCharge()/pcurve;
01649     momentum.eqp = fittrack->GetVtxQPError();
01650   }
01651 
01652 //   const CandFitTrackSRHandle* fittracksr 
01653 //     = dynamic_cast<const CandFitTrackSRHandle*>(track);
01654 //   if ( fittracksr ) {
01655 //     momentum.eqp = fittracksr->GetVtxQPError();
01656 //   }
01657 
01658   return;
01659 
01660 }

void NtpSRModule::FillNtpTrackProjectionToShield NtpSRShieldSummary ntpshieldsummary,
const NtpSRTrack ntptrack
[private]
 

Definition at line 614 of file NtpSRModule.cxx.

References NtpSRShieldSummary::dcos, NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, fShGeom, NtpSRShieldSummary::ishit, MSG, NtpSRShieldSummary::projx, NtpSRShieldSummary::projy, NtpSRShieldSummary::projz, NtpSRVertex::u, NtpSRVertex::v, NtpSRTrack::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillNtpShield().

00615                                                                   {
00616   //
00617   //  Purpose:  Private method used to fill projection of track intercept
00618   //            with shield portion of shield summary ntuple.
00619   //
00620   //  Arguments: Reference to NtpSRShieldSummary and ptr to primary track
00621   //  
00622   //  Return: none.
00623   // 
00624   //  Notes: Should be called before ntp veto shield strips and
00625   //         post-filling of ntp tracks
00626   //         If multiple tracks, projection is calculated using first of
00627   //         tracks.
00628 
00629   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackProjectionToShield" 
00630                              << endl;
00631 
00632   if ( ! ntptrack ) return;  // no track to project
00633  
00634   const NtpSRVertex& vtx = ntptrack->vtx;
00635  
00636   CandShieldSR cs(vtx.x,vtx.y,vtx.z,vtx.dcosx,vtx.dcosy,vtx.dcosz,fShGeom); 
00637   ntpshieldsummary.ishit  = 0;
00638   if(cs.IsVetoHit() == true){
00639     ntpshieldsummary.ishit = 1;   
00640   }
00641    ntpshieldsummary.projx=cs.GetCandShieldInter_X();
00642    ntpshieldsummary.projy=cs.GetCandShieldInter_Y();
00643    ntpshieldsummary.projz=cs.GetCandShieldInter_Z();
00644 
00645   // I left this to fill ntpshieldsummary.dcos in the SR way  **!!
00646    Float_t xzproj[2] = {-999.,-999.};
00647    Int_t ishit=0;
00648    if ( vtx.dcosy != 0. ) {
00649     xzproj[0] = vtx.x + vtx.dcosx/vtx.dcosy*(4.37-vtx.y);
00650     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosy*(4.37-vtx.y);
00651     if (fabs(xzproj[0])<2.03 && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00652       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00653       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {
00654         ntpshieldsummary.dcos = vtx.dcosy;
00655       }
00656     }
00657     xzproj[0] = vtx.x + vtx.dcosx/vtx.dcosy*(3.06-vtx.y);
00658     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosy*(3.06-vtx.y);
00659     if (fabs(xzproj[0])>3.34 && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00660       if (fabs(xzproj[0])<6.05&&xzproj[1]>0.0&&xzproj[1]<30.) 
00661         ishit = 1;
00662       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {       
00663         ntpshieldsummary.dcos = vtx.dcosy;
00664       }
00665     }
00666   }
00667   if (vtx.dcosu!=0.) {
00668     xzproj[0] = vtx.v + vtx.dcosv/vtx.dcosu*(4.45-vtx.u);
00669     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosu*(4.45-vtx.u);
00670     if (xzproj[0]>-.22624&&xzproj[0]<1.5554 
00671     && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00672       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00673       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {
00674         ntpshieldsummary.dcos = vtx.dcosu;
00675       }
00676     }
00677   }
00678   if (vtx.dcosv!=0.) {
00679     xzproj[0] = vtx.u +vtx.dcosu/vtx.dcosv*(4.45-vtx.v);
00680     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosv*(4.45-vtx.v);
00681     if (xzproj[0]>-.22624&&xzproj[0]<1.5554 
00682     && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00683       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00684       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {       
00685         ntpshieldsummary.dcos = vtx.dcosv;
00686       }
00687     }
00688   }
00689   if (vtx.dcosx!=0.) {
00690     xzproj[0] = vtx.y + vtx.dcosy/vtx.dcosx*(6.7-vtx.x);
00691     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosx*(6.7-vtx.x);
00692     if (xzproj[0]>1.20&&xzproj[0]<4.64 && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00693       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00694       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {
00695         ntpshieldsummary.dcos = vtx.dcosx;
00696       }
00697     }
00698     xzproj[0] = vtx.y + vtx.dcosy/vtx.dcosx*(-6.7-vtx.x);
00699     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosx*(-6.7-vtx.x);
00700     if (xzproj[0]>1.20&&xzproj[0]<4.64 && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00701       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00702       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {       
00703         ntpshieldsummary.dcos = vtx.dcosx;
00704       }
00705     }
00706     xzproj[0] = vtx.y + vtx.dcosy/vtx.dcosx*(4.3-vtx.x);
00707     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosx*(4.3-vtx.x);
00708     if (xzproj[0]>-1.5&&xzproj[0]<0.5 && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00709       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00710       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {       
00711         ntpshieldsummary.dcos = vtx.dcosx;
00712       }
00713     }
00714     xzproj[0] = vtx.y + vtx.dcosy/vtx.dcosx*(-4.3-vtx.x);
00715     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosx*(-4.3-vtx.x);
00716     if (xzproj[0]>-1.5&&xzproj[0]<0.5 && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00717       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00718       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {       
00719         ntpshieldsummary.dcos = vtx.dcosx;
00720       }
00721     }
00722   }
00723 
00724   return;
00725 
00726 }

void NtpSRModule::FillNtpTrackTime NtpSRTrack ntptrack,
const CandTrackHandle track
[private]
 

Definition at line 1723 of file NtpSRModule.cxx.

References NtpSRTrackTime::cdtds, NtpSRTrackTime::chi2, NtpSRTrackTime::dtds, NtpSRTrackTime::du, NtpSRTrackTime::dv, CandHandle::GetDaughterIterator(), CandStripHandle::GetNDigit(), CandFitTrackSRHandle::GetNTimeFitDigit(), CandTrackSRHandle::GetNTimeFitDigit(), CalHelpers::GetPlane(), CandTrackHandle::GetT(), CandFitTrackSRHandle::GetTimeFitChi2(), CandTrackSRHandle::GetTimeFitChi2(), CandRecoHandle::GetTimeOffset(), CandRecoHandle::GetTimeSlope(), MSG, NtpSRTrackTime::ndigit, NtpSRTrackTime::t0, NtpSRTrack::time, NtpSRTrackTime::u0, NtpSRTrackTime::u1, NtpSRTrackTime::v0, NtpSRTrackTime::v1, and PropagationVelocity::VelocityPosErr().

Referenced by FillNtpTrack().

01724                                                                  {
01725   //
01726   //  Purpose:  Private method used to fill NtpSRTrack time data member
01727   //            given a pointer to the ntuple track and a pointer to the
01728   //            associated CandTrackHandle.
01729   //
01730   //  Return: none.
01731   // 
01732 
01733 
01734   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackTime" << endl;
01735 
01736   NtpSRTrackTime& time = ntptrack->time;
01737 
01738   const CandTrackSRHandle* tracksr 
01739     = dynamic_cast<const CandTrackSRHandle*>(track);
01740   if ( tracksr ) {
01741     time.ndigit = tracksr->GetNTimeFitDigit();
01742     time.chi2   = tracksr->GetTimeFitChi2();
01743   }
01744 
01745   const CandFitTrackSRHandle* fittracksr 
01746     = dynamic_cast<const CandFitTrackSRHandle*>(track);
01747   if ( fittracksr ) {
01748     time.ndigit = fittracksr->GetNTimeFitDigit();
01749     time.chi2   = fittracksr->GetTimeFitChi2();
01750   }
01751 
01752   time.cdtds = fabs(track->GetTimeSlope())*3.e8;
01753   time.dtds = track->GetTimeSlope();
01754   time.t0   = track->GetTimeOffset();
01755   
01756   Double_t totuph[2] = {0}, totvph[2] = {0};
01757   Int_t    ndutimespace[1000] = {0}, ndvtimespace[1000] = {0};
01758   Double_t dutimespace[1000]  = {0}, dvtimespace[1000] = {0};
01759 
01760   TIter trackstripItr(track->GetDaughterIterator());
01761   while (CandStripHandle* trackstrip = dynamic_cast<CandStripHandle*>
01762                                                    (trackstripItr())) {
01763     Int_t iplane = trackstrip -> GetPlane();
01764     assert(iplane >= 0 && iplane < 1000);
01765     Double_t ph0 = trackstrip -> GetCharge(StripEnd::kNegative);
01766     Double_t ph1 = trackstrip -> GetCharge(StripEnd::kPositive);
01767     Double_t t0  = track->GetT(iplane,StripEnd::kNegative);
01768     Double_t t1  = track->GetT(iplane,StripEnd::kPositive);
01769 
01770     if ( trackstrip -> GetPlaneView() == PlaneView::kU ) {
01771       if ( trackstrip -> GetNDigit(StripEnd::kNegative) > 0 ) {
01772         totuph[0] += ph0;
01773         time.u0   += ph0*t0;
01774       }
01775       if ( trackstrip -> GetNDigit(StripEnd::kPositive) > 0 ) {
01776         totuph[1] += ph1;
01777         time.u1   += ph1*t1;
01778       }
01779       if ( trackstrip->GetNDigit(StripEnd::kNegative) > 0 && 
01780            trackstrip->GetNDigit(StripEnd::kPositive) > 0 ) {
01781         Double_t dapos = .5*(t0-t1)*PropagationVelocity::VelocityPosErr();
01782         if (!ndutimespace[iplane] || fabs(dapos)<fabs(dutimespace[iplane])) {
01783           dutimespace[iplane] = dapos;
01784           ndutimespace[iplane] = 1;
01785         }
01786       }
01787     }
01788 
01789     if ( trackstrip -> GetPlaneView() == PlaneView::kV ) {
01790       if ( trackstrip -> GetNDigit(StripEnd::kNegative) > 0 ) {
01791         totvph[0] += ph0;
01792         time.v0   += ph0*t0;
01793       }
01794       if ( trackstrip -> GetNDigit(StripEnd::kPositive) > 0 ) {
01795         totvph[1] += ph1;
01796         time.v1   += ph1*t1;
01797       }
01798       if ( trackstrip -> GetNDigit(StripEnd::kNegative) > 0 &&
01799            trackstrip -> GetNDigit(StripEnd::kPositive) > 0 ) {
01800         Double_t dapos = .5*(t0-t1)*PropagationVelocity::VelocityPosErr();
01801         if (!ndvtimespace[iplane] || fabs(dapos) < fabs(dvtimespace[iplane])) {
01802           dvtimespace[iplane] = dapos;
01803           ndvtimespace[iplane] = 1;
01804         }
01805       }
01806     }
01807   }
01808 
01809   Int_t ndu = 0;
01810   Int_t ndv = 0;
01811   for (int ip = 0; ip < 1000; ip++ ) {
01812     if ( ndutimespace[ip] > 0 ) {
01813       ndu++;
01814       time.du += dutimespace[ip];
01815     }
01816     if ( ndvtimespace[ip] > 0 ) {
01817       ndv++;
01818       time.dv += dvtimespace[ip];
01819     }
01820   }
01821   if ( totuph[0] > 0. ) time.u0 /= totuph[0];
01822   if ( totvph[0] > 0. ) time.v0 /= totvph[0];
01823   if ( totuph[1] > 0. ) time.u1 /= totuph[1];
01824   if ( totvph[1] > 0. ) time.v1 /= totvph[1];
01825   if ( ndu ) time.du /= (Double_t)ndu;
01826   if ( ndv ) time.dv /= (Double_t)ndv;
01827 
01828   return;
01829 
01830 }

void NtpSRModule::FillNtpTrackVertex NtpSRTrack ntptrack,
const CandTrackHandle track
[private]
 

Definition at line 1984 of file NtpSRModule.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(), kCos45, MSG, NtpSRVertex::plane, NtpSRVertex::t, NtpSRVertex::u, NtpSRVertex::v, NtpSRTrack::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillNtpTrack().

01985                                                                    {
01986   //
01987   //  Purpose:  Private method used to fill vertex portion of ntuple track.
01988   //
01989   //  Arguments: NtpSRTrack to fill and const CandTrackHandle pointer.
01990   //  
01991   //  Return: status.
01992   // 
01993 
01994 
01995   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackVertex" << endl;
01996 
01997   NtpSRVertex& vtx = ntptrack->vtx;
01998 
01999   vtx.u = track->GetVtxU();
02000   vtx.v = track->GetVtxV();
02001   vtx.x = kCos45*(vtx.u-vtx.v);
02002   vtx.y = kCos45*(vtx.u+vtx.v);
02003   vtx.z = track->GetVtxZ();
02004   vtx.t = track->GetVtxT();
02005   vtx.plane = track->GetVtxPlane();
02006   vtx.dcosu = track->GetDirCosU();
02007   vtx.dcosv = track->GetDirCosV();
02008   vtx.dcosx = kCos45*(vtx.dcosu-vtx.dcosv);
02009   vtx.dcosy = kCos45*(vtx.dcosu+vtx.dcosv);
02010   vtx.dcosz = track->GetDirCosZ();
02011 
02012   const CandFitTrackHandle* fittrack
02013                         = dynamic_cast<const CandFitTrackHandle*>(track);
02014   if ( fittrack ) {
02015     vtx.eu = fittrack->GetVtxUError();
02016     vtx.ev = fittrack->GetVtxVError();
02017     vtx.ex = kCos45*sqrt(vtx.eu*vtx.eu+vtx.ev*vtx.ev);
02018     vtx.ey = kCos45*sqrt(vtx.eu*vtx.eu+vtx.ev*vtx.ev);
02019     Double_t edudz = fittrack->GetVtxdUError();
02020     Double_t edvdz = fittrack->GetVtxdVError();
02021     // These calculations should include the dudz and dvdz covariance terms
02022     // but currently the covariance terms are not accessible
02023     vtx.edcosz = fabs(vtx.dcosz)*sqrt(pow(vtx.dcosu*edudz,2)+
02024                                       pow(vtx.dcosv*edvdz,2));
02025     vtx.edcosu = sqrt(fabs(vtx.dcosz))*sqrt(pow(vtx.dcosu*vtx.dcosv*edvdz,2)
02026                + pow((pow(vtx.dcosz,2)+pow(vtx.dcosv,2))*edudz,2));
02027     vtx.edcosv = sqrt(fabs(vtx.dcosz))*sqrt(pow(vtx.dcosu*vtx.dcosv*edudz,2)
02028                + pow((pow(vtx.dcosz,2)+pow(vtx.dcosu,2))*edvdz,2));
02029     vtx.edcosx = kCos45*sqrt(vtx.edcosu*vtx.edcosu+vtx.edcosv*vtx.edcosv);
02030     vtx.edcosy = kCos45*sqrt(vtx.edcosu*vtx.edcosu+vtx.edcosv*vtx.edcosv);
02031   }
02032 
02033   return;
02034 
02035 }

JobCResult NtpSRModule::Reco MomNavigator mom  )  [virtual]
 

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 149 of file NtpSRModule.cxx.

References NtpSRRecord::crhdr, NtpStRecord::crhdr, NtpSRRecord::detstatus, NtpStRecord::detstatus, NtpSRRecord::dmxstatus, NtpStRecord::dmxstatus, NtpSRRecord::evthdr, NtpStRecord::evthdr, fCandRecordName, fClusterUidMap, fEventUidMap, FillNtpCluster(), FillNtpDetStatus(), FillNtpDmxStatus(), FillNtpEvent(), FillNtpEventSummary(), FillNtpShield(), FillNtpShower(), FillNtpSlice(), FillNtpStrip(), FillNtpTrack(), FillNtpTrackCosmicRay(), fRecordName, fRecordTitle, fShowerUidMap, fSliceUidMap, fStripUidMap, fTrackUidMap, DataUtil::GetCandHeader(), RawDaqSnarlHeader::GetErrorCode(), RecDataHeader::GetErrorCode(), CandHeader::GetEvent(), MomNavigator::GetFragment(), DataUtil::GetRawHeader(), RawDaqSnarlHeader::GetRemoteSpillType(), RecPhysicsHeader::GetRemoteSpillType(), CandHeader::GetRun(), RawDaqHeader::GetRun(), RecDataHeader::GetRun(), RawDaqHeader::GetRunType(), RecDataHeader::GetRunType(), SimSnarlRecord::GetSimSnarlHeader(), CandHeader::GetSnarl(), RawDaqSnarlHeader::GetSnarl(), RecPhysicsHeader::GetSnarl(), RawDaqHeader::GetSubRun(), RecDataHeader::GetSubRun(), RecPhysicsHeader::GetTimeFrame(), RawDaqHeader::GetTimeFrameNum(), RawDaqSnarlHeader::GetTrigSrc(), RecPhysicsHeader::GetTrigSrc(), RecMinosHdr::GetVldContext(), RecHeader::GetVldContext(), RecRecordImp< T >::GetVldContext(), Calibrator::Instance(), MSG, NtpSREventSummary::ntrack, CalScheme::Reset(), JobCResult::SetFailed(), JobCResult::SetWarning(), NtpSRRecord::vetohdr, and NtpStRecord::vetohdr.

00149                                               {
00150   //
00151   //  Purpose:  Create and fill ntuple record.
00152   //
00153   //  Arguments: mom.
00154   //  
00155   //  Return: status.
00156   // 
00157 
00158   JobCResult result(JobCResult::kPassed);  
00159   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::Reco" << endl;
00160 
00161   // Reset maps used to associate uid of reconstructed object with array index
00162   fStripUidMap.clear();
00163   fSliceUidMap.clear();
00164   fClusterUidMap.clear();
00165   fShowerUidMap.clear();
00166   fTrackUidMap.clear();
00167   fEventUidMap.clear();
00168 
00169   // Check that mom exists.
00170   assert(mom);
00171 
00172   // CandRecord will be extracted by name to match record name of NtpSRRecord
00173   const CandRecord* cndrec = dynamic_cast<const CandRecord*>
00174           (mom->GetFragment("CandRecord",fCandRecordName.c_str()));
00175   const SimSnarlRecord* simrec = dynamic_cast<const SimSnarlRecord*>
00176           (mom->GetFragment("SimSnarlRecord"));
00177   const RawRecord* rawrec = dynamic_cast<const RawRecord*>
00178           (mom->GetFragment("RawRecord","","DaqSnarl"));
00179 
00180   if (!cndrec && !simrec ) {
00181     MSG("NtpSR",Msg::kWarning) 
00182       << "No CandRecord of name " << fRecordName 
00183       << " or SimSnarlRecord in Mom" << endl;
00184     result.SetWarning().SetFailed();
00185     return result;
00186   }
00187  
00188   TClonesArray* ntpstparrptr = 0;
00189   TClonesArray* ntpslcarrptr = 0;
00190   TClonesArray* ntpcluarrptr = 0;
00191   TClonesArray* ntpshwarrptr = 0;
00192   TClonesArray* ntptrkarrptr = 0;
00193   TClonesArray* ntpevtarrptr = 0;
00194   TClonesArray* ntpvetostparrptr = 0;
00195   NtpSREventSummary* ntpeventsummaryptr = 0;
00196   NtpSRShieldSummary* ntpshieldsummaryptr = 0;
00197   NtpSRCosmicRay* ntpcosmicrayptr = 0;
00198   NtpSRDmxStatus* ntpdmxstatusptr = 0;
00199   NtpSRDetStatus* ntpdetstatusptr = 0;
00200   
00201   NtpSRRecord* ntpsrrec = 0;
00202   NtpStRecord* ntpstrec = 0;
00203   const VldContext* ntpvldcptr = 0;
00204   if ( fUseStandard ) {
00205     ntpstrec = dynamic_cast<NtpStRecord*>(mom->GetFragment("NtpStRecord",
00206                                           fRecordName.c_str()));
00207     if ( !ntpstrec ) {
00208       MSG("NtpSR",Msg::kWarning) 
00209         << "No NtpStRecord in Mom of name " << fRecordName.c_str() 
00210         << "\nMust call NtpStModule::Get first." << endl;
00211       result.SetWarning().SetFailed();
00212       return result;
00213     }
00214     ntpstparrptr = ntpstrec -> stp;
00215     ntpslcarrptr = ntpstrec -> slc;
00216     ntpcluarrptr = ntpstrec -> clu;
00217     ntpshwarrptr = ntpstrec -> shw;
00218     ntptrkarrptr = ntpstrec -> trk;
00219     ntpevtarrptr = ntpstrec -> evt;
00220     ntpvetostparrptr = ntpstrec-> vetostp;
00221     ntpeventsummaryptr = &(ntpstrec->evthdr);
00222     ntpshieldsummaryptr = &(ntpstrec->vetohdr);
00223     ntpcosmicrayptr = &(ntpstrec->crhdr);
00224     ntpdmxstatusptr = &(ntpstrec->dmxstatus);
00225     ntpdetstatusptr = &(ntpstrec->detstatus);
00226     ntpvldcptr = ntpstrec->GetVldContext();
00227   }
00228   else {
00229     if ( !cndrec ) {
00230       // Use SimSnarlRecord header - presumably a triggerless mc event
00231       const SimSnarlHeader* simhdr = simrec->GetSimSnarlHeader();
00232 
00233       RecCandHeader ntphdr(simhdr->GetVldContext(),simhdr->GetRun(),
00234            simhdr->GetSubRun(),simhdr->GetRunType(),simhdr->GetErrorCode(),
00235            simhdr->GetSnarl(),simhdr->GetTrigSrc(),
00236            simhdr->GetTimeFrame(),simhdr->GetRemoteSpillType(),-1);
00237       ntpsrrec = new NtpSRRecord(ntphdr);
00238       ntpsrrec -> SetName(fRecordName.c_str());
00239       ntpsrrec -> SetTitle(fRecordTitle.c_str());
00240       mom -> AdoptFragment(ntpsrrec); // pass record to mom to own
00241       return result; // a triggerless event
00242     }
00243 
00244     // Extract header from CandRecord and use this to create RecCandHeader
00245     // and NtpSRRecord.
00246     const CandHeader* cndhdr = cndrec -> GetCandHeader();
00247     if (!rawrec) {
00248       MSG("NtpSR",Msg::kWarning) << "No DaqSnarl RawRecord in Mom"
00249          <<"\nShield data will not be filled and header will be incomplete." 
00250          << endl;
00251       result.SetWarning();
00252     }
00253     if (rawrec) {  
00254       const RawDaqSnarlHeader* rawhdr = dynamic_cast<const RawDaqSnarlHeader*>
00255                                         (rawrec -> GetRawHeader());
00256       RecCandHeader ntphdr(rawhdr->GetVldContext(),rawhdr->GetRun(),
00257            rawhdr->GetSubRun(),rawhdr->GetRunType(),rawhdr->GetErrorCode(),
00258            rawhdr->GetSnarl(),rawhdr->GetTrigSrc(),rawhdr->GetTimeFrameNum(),
00259            rawhdr->GetRemoteSpillType(),cndhdr->GetEvent());
00260       ntpsrrec = new NtpSRRecord(ntphdr);
00261     }
00262     else {
00263       // This dependency is terrible, but is because CandRecord never made
00264       // the transition to new base class and CandHeader is incomplete
00265       RecCandHeader ntphdr(cndhdr->GetVldContext(),cndhdr->GetRun(),
00266              -1,-1,0,cndhdr->GetSnarl(),0,-1,-1,cndhdr->GetEvent());
00267       ntpsrrec = new NtpSRRecord(ntphdr);
00268     }
00269     ntpsrrec -> SetName(fRecordName.c_str());
00270     ntpsrrec -> SetTitle(fRecordTitle.c_str());
00271 
00272     ntpstparrptr = ntpsrrec -> stp;
00273     ntpslcarrptr = ntpsrrec -> slc;
00274     ntpcluarrptr = ntpsrrec -> clu;
00275     ntpshwarrptr = ntpsrrec -> shw;
00276     ntptrkarrptr = ntpsrrec -> trk;
00277     ntpevtarrptr = ntpsrrec -> evt;
00278     ntpvetostparrptr = ntpsrrec-> vetostp;
00279     ntpeventsummaryptr = &(ntpsrrec->evthdr);
00280     ntpshieldsummaryptr = &(ntpsrrec->vetohdr);
00281     ntpcosmicrayptr = &(ntpsrrec->crhdr);
00282     ntpdmxstatusptr = &(ntpsrrec->dmxstatus);
00283     ntpdetstatusptr = &(ntpsrrec->detstatus);
00284     ntpvldcptr = ntpsrrec->GetVldContext();
00285   }
00286   
00287   TClonesArray& ntpstriparray = *(ntpstparrptr);
00288   TClonesArray& ntpslicearray = *(ntpslcarrptr);
00289   TClonesArray& ntpclusterarray = *(ntpcluarrptr);
00290   TClonesArray& ntpshowerarray = *(ntpshwarrptr);
00291   TClonesArray& ntptrackarray = *(ntptrkarrptr);
00292   TClonesArray& ntpeventarray = *(ntpevtarrptr);
00293   NtpSREventSummary& ntpeventsummary = *(ntpeventsummaryptr);
00294   NtpSRShieldSummary& ntpshieldsummary = *(ntpshieldsummaryptr);
00295   NtpSRCosmicRay& ntpcosmicray = *(ntpcosmicrayptr);
00296   NtpSRDmxStatus& ntpdmxstatus = *(ntpdmxstatusptr);
00297   NtpSRDetStatus& ntpdetstatus = *(ntpdetstatusptr);
00298   const VldContext& vldc = *(ntpvldcptr);
00299   
00300   // Calibrator is used by FillNtpTrack
00301   Calibrator::Instance().Reset(vldc);
00302   
00303   this -> FillNtpStrip(ntpstriparray,cndrec);
00304   this -> FillNtpSlice(ntpslicearray,cndrec);
00305   this -> FillNtpCluster(ntpclusterarray,cndrec);
00306   this -> FillNtpShower(ntpshowerarray,cndrec);
00307   this -> FillNtpTrack(ntptrackarray,cndrec);
00308   this -> FillNtpEvent(ntpeventarray,cndrec);
00309 
00310   this -> FillNtpDmxStatus(ntpdmxstatus,cndrec);
00311   this -> FillNtpDetStatus(ntpdetstatus,vldc);
00312   this -> FillNtpEventSummary(ntpeventsummary,cndrec,rawrec);
00313   
00314   const NtpSRTrack* ntptrack = 0;
00315   if(ntpeventsummary.ntrack > 0) ntptrack 
00316                      = dynamic_cast<NtpSRTrack*>(ntptrackarray.At(0));
00317   if ( ntptrack ) this->FillNtpTrackCosmicRay(ntpcosmicray,ntptrack,vldc);
00318 
00319   if ( rawrec ) { 
00320     TClonesArray& ntpshieldstriparray = *(ntpvetostparrptr);
00321     this->FillNtpShield(ntpshieldstriparray,ntpshieldsummary,ntptrack,
00322                         rawrec);
00323   }
00324 
00325   // pass record to mom to own
00326   if ( !fUseStandard ) mom -> AdoptFragment(ntpsrrec);  
00327 
00328   return result;
00329 
00330 }


Member Data Documentation

std::string NtpSRModule::fCandRecordName [private]
 

Definition at line 102 of file NtpSRModule.h.

Referenced by Config(), NtpSRModule(), and Reco().

std::map<int,int> NtpSRModule::fClusterUidMap [private]
 

Definition at line 94 of file NtpSRModule.h.

Referenced by FillNtpCluster(), FillNtpEventSummary(), FillNtpShower(), and Reco().

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

Definition at line 97 of file NtpSRModule.h.

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

Double_t NtpSRModule::fPostTrigger [private]
 

Definition at line 100 of file NtpSRModule.h.

Referenced by Config(), FillNtpShieldStrip(), and NtpSRModule().

Double_t NtpSRModule::fPreTrigger [private]
 

Definition at line 99 of file NtpSRModule.h.

Referenced by Config(), FillNtpShieldStrip(), and NtpSRModule().

std::string NtpSRModule::fRecordName [private]
 

Definition at line 103 of file NtpSRModule.h.

Referenced by Config(), NtpSRModule(), and Reco().

std::string NtpSRModule::fRecordTitle [private]
 

Definition at line 104 of file NtpSRModule.h.

Referenced by Config(), NtpSRModule(), and Reco().

ShieldGeom* NtpSRModule::fShGeom [private]
 

Definition at line 107 of file NtpSRModule.h.

Referenced by FillNtpShield(), FillNtpShieldStrip(), FillNtpTrackProjectionToShield(), and NtpSRModule().

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

Definition at line 95 of file NtpSRModule.h.

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

std::map<int,int> NtpSRModule::fSliceUidMap [private]
 

Definition at line 93 of file NtpSRModule.h.

Referenced by FillNtpCluster(), FillNtpEvent(), FillNtpEventSummary(), FillNtpShower(), FillNtpSlice(), FillNtpTrack(), and Reco().

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

Definition at line 92 of file NtpSRModule.h.

Referenced by FillNtpCluster(), FillNtpEvent(), FillNtpEventSummary(), FillNtpShower(), FillNtpSlice(), FillNtpStrip(), FillNtpTrack(), and Reco().

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

Definition at line 96 of file NtpSRModule.h.

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

bool NtpSRModule::fUseStandard [private]
 

Definition at line 105 of file NtpSRModule.h.

Referenced by Config(), and NtpSRModule().

const Double_t NtpSRModule::kCos45 = 0.70710678 [static, private]
 

Definition at line 80 of file NtpSRModule.cxx.

Referenced by FillNtpEvent(), FillNtpShower(), FillNtpTrack(), FillNtpTrackEnd(), FillNtpTrackFidAll(), FillNtpTrackLinearFit(), and FillNtpTrackVertex().


The documentation for this class was generated from the following files:
Generated on Thu Nov 1 15:57:24 2007 for loon by  doxygen 1.3.9.1