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, const RawRecord *rawrec)
void FillNtpSubShowerSummary (NtpSRShower *ntpshw, const CandShowerSRHandle *shw, const CandTrackListHandle *tracklist)
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 FillNtpBleach (NtpSRBleach &ntpbleach, const CandEventHandle *cndevt, const CandRecord *cndrec, const RawRecord *rawrec)
void FillNtpWindow (NtpSREvent *ntpevent, const CandRecord *cndrec)
void FillNtpDataQuality (NtpSRDataQuality &ntpdataquality, TClonesArray &ntpdeadchips, const CandRecord *cndrec)
void FillNtpDmxStatus (NtpSRDmxStatus &ntpdmxstatus, const CandRecord *cndrec)
void FillNtpDetStatus (NtpSRDetStatus &ntpdetstatus, const VldContext &vldc)
void FillNtpTimeStatus (NtpSRTimeStatus &ntptimestatus, MomNavigator *mom)
void FillNtpCalStatus (NtpSRCalStatus &ntpcalstatus, const VldContext &vldc)
void FillNtpEventSummary (NtpSREventSummary &ntpeventsummary, const CandRecord *cndrec, const RawRecord *rawrec)
void FillNtpShield (TClonesArray &ntpshieldstriparray, TClonesArray &ntpshieldexpected, NtpSRShieldSummary &ntpshieldsummary, const NtpSRTrack *ntptrack, const RawRecord *rawrec)
void FillNtpShieldStrip (TClonesArray &ntpshieldstriparray, TClonesArray &ntpshieldexpected, NtpSRShieldSummary &ntpshieldsummary, const NtpSRTrack *ntptrack, const RawRecord *rawrec)
void FillNtpShieldExpected (TClonesArray &ntpshieldexpected, const CandShieldSR &cssh)
void FillNtpTrackProjectionToShield (NtpSRShieldSummary &ntpshieldsummary, const NtpSRTrack *ntptrack, const CandShieldSR &cssh)

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 fSimSnarlRecordName
std::string fRecordName
std::string fRecordTitle
Int_t fHvSinglesTask
bool fUseStandard
ShieldGeomfShGeom
Int_t fWindowPlaneExtn
Double_t fWindowTimeExtn
std::map< int, bool > fUnassocStripUidMap
NtpSRBleachFillerfBleachFiller

Static Private Attributes

static const Double_t kCos45 = 0.70710678

Detailed Description

Definition at line 46 of file NtpSRModule.h.


Constructor & Destructor Documentation

NtpSRModule::NtpSRModule (  )  [inline]

Definition at line 49 of file NtpSRModule.h.

NtpSRModule::~NtpSRModule (  )  [inline]

Definition at line 53 of file NtpSRModule.h.

References fBleachFiller, and fShGeom.

00053                  { if ( fShGeom ) delete fShGeom; fShGeom = 0; 
00054                    if ( fBleachFiller ) delete fBleachFiller; 
00055                                         fBleachFiller = 0; }


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 152 of file NtpSRModule.cxx.

References MuELoss::e, fCandRecordName, fHvSinglesTask, fPostTrigger, fPreTrigger, fRecordName, fRecordTitle, fSimSnarlRecordName, fUseStandard, fWindowPlaneExtn, fWindowTimeExtn, Registry::Get(), Msg::kDebug, and MSG.

00152                                           {
00153   //
00154   // Purpose: Configure the module given a registry.
00155   //
00156   // Arguments: Registry to use to configure the module.
00157   //
00158   // Return: none.
00159   //
00160 
00161   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::Config" << endl;
00162   
00163   Int_t tmpi;
00164   Double_t tmpd;
00165   const Char_t* tmps;
00166 
00167   if ( r.Get("PreTrigger",tmpd) ) fPreTrigger = fabs(tmpd*1.e-9);
00168   if ( r.Get("PostTrigger",tmpd)) fPostTrigger = fabs(tmpd*1.e-9);
00169 
00170   if ( r.Get("CandRecordName",tmps) ) fCandRecordName = tmps;
00171   if ( r.Get("SimSnarlRecordName",tmps) ) fSimSnarlRecordName = tmps;
00172   if ( r.Get("RecordName", tmps) )  fRecordName = tmps;
00173   if ( r.Get("RecordTitle", tmps) ) fRecordTitle = tmps;
00174 
00175   if ( r.Get("HvSinglesTask", tmpi) ) fHvSinglesTask = tmpi;
00176 
00177   if ( r.Get("UseStandard",tmpi) ) fUseStandard = tmpi;
00178 
00179   if ( r.Get("WindowPlaneExtn",tmpi) ) fWindowPlaneExtn = tmpi;
00180   if ( r.Get("WindowTimeExtn",tmpd) ) fWindowTimeExtn = tmpd;
00181   
00182 }

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

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

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

Reimplemented from JobCModule.

Definition at line 117 of file NtpSRModule.cxx.

References MuELoss::e, JobCModule::GetName(), Msg::kDebug, Registry::LockValues(), MSG, Registry::Set(), and Registry::UnLockValues().

00117                                                  {
00118   //
00119   // Purpose: Method to return default configuration.
00120   // 
00121   // Arguments: none.
00122   //
00123   // Return: Registry containing default configuration
00124   //
00125 
00126   MSG("NtpSR",Msg::kDebug) << 
00127     "NtpSRModule::DefaultConfig" << endl;
00128 
00129   static Registry r; 
00130   std::string name = this->JobCModule::GetName();
00131   name += ".config.default";
00132   r.SetName(name.c_str());
00133 
00134   r.UnLockValues();
00135   r.Set("PreTrigger",50.);
00136   r.Set("PostTrigger",150.);
00137   r.Set("CandRecordName", "PrimaryCandidateRecord");
00138   r.Set("SimSnarlRecordName","");
00139   r.Set("RecordName", "Primary");
00140   r.Set("RecordTitle", "Created by NtpSRModule");
00141   r.Set("HvSinglesTask",1);
00142   r.Set("UseStandard",0);
00143   r.Set("WindowPlaneExtn",10);  //10 planes
00144   r.Set("WindowTimeExtn",100e-9);  //100 ns
00145   r.LockValues();
00146 
00147   return r;
00148 }

void NtpSRModule::FillNtpBleach ( NtpSRBleach ntpbleach,
const CandEventHandle cndevt,
const CandRecord cndrec,
const RawRecord rawrec 
) [private]

Definition at line 2547 of file NtpSRModule.cxx.

References NtpSRBleach::eventDuration, fBleachFiller, NtpSRBleach::fixedWindowPH, NtpSRBleach::lateBucketPHFraction, and NtpSRBleach::straightPHFraction.

Referenced by FillNtpEvent().

02550                                                          {
02551   //  Purpose:  Private method used to fill NtpSRBleach bleach 
02552   //            data member.
02553   //
02554   //  Return: none.
02555   // 
02556 
02557   if ( fBleachFiller == NULL ) fBleachFiller = new NtpSRBleachFiller(cndrec);
02558 
02559   bleach.lateBucketPHFraction 
02560          = fBleachFiller -> GetlateBucketPHFraction(cndevt,rawrec);
02561   bleach.straightPHFraction   
02562          = fBleachFiller -> GetstraightPHFraction(cndevt);
02563   bleach.fixedWindowPH        
02564          = fBleachFiller -> GetFixedWindowPH(cndevt,cndrec);
02565   bleach.eventDuration        
02566          = fBleachFiller -> GetEventDuration(cndevt);
02567   return;
02568 
02569 }

void NtpSRModule::FillNtpCalStatus ( NtpSRCalStatus ntpcalstatus,
const VldContext vldc 
) [private]

Definition at line 2903 of file NtpSRModule.cxx.

References get_gevpermip(), VldContext::GetDetector(), NtpSRCalStatus::gevpermip, Msg::kDebug, and MSG.

Referenced by Reco().

02904                                                            {
02905   //  Purpose:  Private method used to fill cal status portion of ntuple 
02906   //            record.
02907 
02908   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpCalStatus" << endl;
02909 
02910   // GeVPerMip
02911   Detector::Detector_t dettype = vldc.GetDetector();
02912   ntpcalstatus.gevpermip = get_gevpermip(dettype);
02913   
02914   MSG("NtpSR",Msg::kDebug) << ntpcalstatus << endl;
02915   
02916   return;
02917 
02918 }

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

Definition at line 1028 of file NtpSRModule.cxx.

References NtpSRCluster::AddStripAt(), NtpSRCluster::avgdev, NtpSRCluster::begplane, NtpSRCluster::endplane, fClusterUidMap, fSliceUidMap, fStripUidMap, CandHandle::GetDaughterIterator(), CandHandle::GetUidInt(), NtpSRStripPulseHeight::gev, NtpSRCluster::id, NtpSRCluster::index, Msg::kDebug, Msg::kError, CandSubShowerSRHandle::KeyFromViewEnergy(), CalStripType::kMIP, CalStripType::kNone, CalStripType::kPE, CalStripType::kSigCorr, CalStripType::kSigLin, CalStripType::kSigMapped, PlaneView::kU, ClusterType::kUnknown, PlaneView::kV, Msg::kWarning, PlaneView::kX, PlaneView::kY, 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().

01029                                                           {
01030   //
01031   //  Purpose:  Private method used to fill cluster portion of ntuple record.
01032   //
01033   //  Arguments: reference to TClonesArray of NtpSRClusters & CandRecord ptr
01034   //  
01035   //  Return: none.
01036   // 
01037 
01038   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpCluster" << endl;
01039 
01040   Int_t ncluster = 0;
01041   
01042   const CandSubShowerSRListHandle *clusterlisthandle 
01043     = dynamic_cast <const CandSubShowerSRListHandle*> 
01044     (cndrec -> FindCandHandle("CandSubShowerSRListHandle"));
01045   
01046   if ( !clusterlisthandle ) {
01047     //look for CandClusterListHandle instead and fill NtpSRCluster
01048     //as well as possible
01049     const CandClusterListHandle *clulisthandle
01050       = dynamic_cast <const CandClusterListHandle*>
01051       (cndrec -> FindCandHandle("CandClusterListHandle"));
01052     if( !clulisthandle ) return; //nothing to do here
01053     
01054     TIter cluItr(clulisthandle->GetDaughterIterator());
01055     while (CandClusterHandle* clus=dynamic_cast<CandClusterHandle*>(cluItr())){
01056       Int_t uid = clus->GetUidInt();
01057       fClusterUidMap.insert(std::make_pair(uid,ncluster));
01058 
01059       // Uses new with placement to efficiently create cluster ntp
01060       NtpSRCluster* ntpcluster 
01061         = new(ntpclusterarray[ncluster++])NtpSRCluster(clus->GetNStrip()); 
01062       
01063       // Fill indices of associated strips in cluster tree
01064       ntpcluster->index = ncluster - 1;
01065       
01066       // index to associated slice in slice array
01067       const CandSliceHandle* clusterslice = clus -> GetCandSlice();
01068       if ( clusterslice ) {
01069         std::map<int,int>::iterator uidItr 
01070                       = fSliceUidMap.find(clusterslice->GetUidInt());
01071         if ( uidItr == fSliceUidMap.end() ) {
01072           MSG("NtpSR",Msg::kError)
01073             << "Cluster slice w/Uid " << clusterslice->GetUidInt()
01074             << " does not match any in slice list." 
01075             << "\n clu slc will not be properly filled." << endl;
01076         }
01077         else {
01078           ntpcluster->slc = uidItr->second;
01079         }
01080       }
01081       else {
01082         MSG("NtpSR",Msg::kWarning) << "No associated Slice found for cluster"
01083                                    << endl;
01084         ntpcluster->slc = -1;
01085       }
01086       
01087       TIter clusterstripItr(clus->GetDaughterIterator());
01088       Int_t nclusterstrip = 0;
01089       while ( CandStripHandle *clusterstrip = dynamic_cast<CandStripHandle*>
01090               (clusterstripItr()) ) {
01091         std::map<int,int>::iterator uidItr
01092                     = fStripUidMap.find(clusterstrip->GetUidInt());
01093         if ( uidItr == fStripUidMap.end() ) {
01094           MSG("NtpSR",Msg::kError)
01095             << "Cluster strip w/Uid " << clusterstrip->GetUidInt() 
01096             << " does not match any in strip list."
01097             << "\n clu stp entry will not be properly filled." << endl;
01098         }
01099         else {
01100           Int_t stripindex = uidItr->second;
01101           ntpcluster->AddStripAt(stripindex,nclusterstrip); // add ind to strip
01102         }
01103         nclusterstrip++;
01104       }
01105       
01106       ntpcluster->planeview = clus->GetPlaneView();
01107       ntpcluster->nplane    = clus->GetNPlane();
01108       ntpcluster->begplane  = clus->GetBegPlane();
01109       ntpcluster->endplane  = clus->GetEndPlane();
01110       ntpcluster->id = ClusterType::kUnknown;
01111       
01112       // Set summed charge in cluster
01113       ntpcluster->ph.raw = clus->GetCharge();
01114       ntpcluster->ph.siglin = 0.;
01115       ntpcluster->ph.sigcor = 0.;
01116       ntpcluster->ph.pe = 0.;
01117       ntpcluster->ph.sigmap = 0.;
01118       ntpcluster->ph.mip = 0.;
01119       ntpcluster->ph.gev = 0.;
01120       MSG("NtpSR",Msg::kDebug) << "CandCluster uid " 
01121                                << clus -> GetUidInt() << "\n"  
01122                                << (*ntpcluster) << endl;
01123     }
01124     return;
01125   }
01126 
01127   //otherwise, we have CandSubShowerSRListHandle
01128   CandSubShowerSRHandleItr clusterItr(clusterlisthandle->GetDaughterIterator());
01129   CandSubShowerSRHandleKeyFunc *engKF = clusterItr.CreateKeyFunc();
01130   engKF->SetFun(CandSubShowerSRHandle::KeyFromViewEnergy);
01131   clusterItr.GetSet()->AdoptSortKeyFunc(engKF);
01132   engKF = 0;
01133   while (CandSubShowerSRHandle* cluster=dynamic_cast<CandSubShowerSRHandle*>
01134                                                     (clusterItr())) {
01135     Int_t uid = cluster->GetUidInt();
01136     fClusterUidMap.insert(std::make_pair(uid,ncluster));
01137     
01138     // Uses new with placement to efficiently create cluster ntp
01139     NtpSRCluster* ntpcluster 
01140       = new(ntpclusterarray[ncluster++])NtpSRCluster(cluster->GetNStrip()); 
01141 
01142     // Fill indices of associated strips in cluster tree
01143     ntpcluster->index = ncluster - 1;
01144 
01145     // Fill index to associated slice in slice array
01146     const CandSliceHandle* clusterslice = cluster -> GetCandSlice();
01147     if ( clusterslice ) {
01148       std::map<int,int>::iterator uidItr 
01149                     = fSliceUidMap.find(clusterslice->GetUidInt());
01150       if ( uidItr == fSliceUidMap.end() ) {
01151         MSG("NtpSR",Msg::kError)
01152           << "Cluster slice w/Uid " << clusterslice->GetUidInt()
01153           << " does not match any in slice list." 
01154           << "\n clu slc will not be properly filled." << endl;
01155       }
01156       else {
01157         ntpcluster->slc = uidItr->second;
01158       }
01159     }
01160     else {
01161       MSG("NtpSR",Msg::kWarning) << "No associated Slice found for cluster"
01162                            << endl;
01163       ntpcluster->slc = -1;
01164     }
01165     
01166     ntpcluster->ndigit = cluster->GetNDigit();
01167 
01168     TIter clusterstripItr(cluster->GetDaughterIterator());
01169     Int_t nclusterstrip = 0;
01170     while ( CandStripHandle *clusterstrip = dynamic_cast<CandStripHandle*>
01171                                                     (clusterstripItr()) ) {
01172       std::map<int,int>::iterator uidItr
01173                     = fStripUidMap.find(clusterstrip->GetUidInt());
01174       if ( uidItr == fStripUidMap.end() ) {
01175         MSG("NtpSR",Msg::kError)
01176           << "Cluster strip w/Uid " << clusterstrip->GetUidInt() 
01177           << " does not match any in strip list."
01178           << "\n clu stp entry will not be properly filled." << endl;
01179       }
01180       else {
01181         Int_t stripindex = uidItr->second;
01182         ntpcluster->AddStripAt(stripindex,nclusterstrip); // add ind to strip
01183       }
01184       nclusterstrip++;
01185     }
01186 
01187     ntpcluster->planeview = cluster->GetPlaneView();
01188     ntpcluster->nplane = cluster->GetNPlane();
01189     ntpcluster->begplane = cluster->GetBegPlane();
01190     ntpcluster->endplane = cluster->GetEndPlane();
01191 
01192     ntpcluster->zvtx = cluster->GetVtxZ();
01193     if(ntpcluster->planeview==PlaneView::kU || 
01194        ntpcluster->planeview==PlaneView::kX) ntpcluster->tposvtx = cluster->GetVtxU();
01195     else if(ntpcluster->planeview==PlaneView::kV || 
01196             ntpcluster->planeview==PlaneView::kY) ntpcluster->tposvtx = cluster->GetVtxV();
01197 
01198     ntpcluster->slope = cluster->GetSlope();    
01199     ntpcluster->avgdev = cluster->GetAvgDev();
01200     ntpcluster->id = cluster->GetClusterID();    
01201     ntpcluster->probem = cluster->GetProbEM();
01202 
01203     // Set summed charge in cluster
01204     ntpcluster->ph.raw = cluster->GetCharge(CalStripType::kNone);
01205     ntpcluster->ph.siglin = cluster->GetCharge(CalStripType::kSigLin);
01206     ntpcluster->ph.sigcor = cluster->GetCharge(CalStripType::kSigCorr);
01207     ntpcluster->ph.pe = cluster->GetCharge(CalStripType::kPE);
01208     ntpcluster->ph.sigmap = cluster->GetCharge(CalStripType::kSigMapped);
01209     ntpcluster->ph.mip = cluster->GetCharge(CalStripType::kMIP);
01210     ntpcluster->ph.gev = cluster->GetEnergy();
01211     MSG("NtpSR",Msg::kDebug) << "CandSubShowerSR uid " 
01212                              << cluster -> GetUidInt() << "\n"
01213                              << (*ntpcluster) << endl;
01214   }
01215 
01216   return;
01217 }

void NtpSRModule::FillNtpDataQuality ( NtpSRDataQuality ntpdataquality,
TClonesArray &  ntpdeadchips,
const CandRecord cndrec 
) [private]

Definition at line 2571 of file NtpSRModule.cxx.

References NtpSRDataQuality::busychips, NtpSRDeadChip::channelid, NtpSRDataQuality::coldchips, NtpSRDataQuality::cratemask, NtpSRDataQuality::dataqualityword, NtpSRDataQuality::errorcode, NtpSRDeadChip::errorcode, CandRecord::FindCandHandle(), CandDataQualityHandle::GetBusyChips(), CandDataQualityHandle::GetColdChips(), RawChannelId::GetCrate(), CandDataQualityHandle::GetCrateMask(), CandDataQualityHandle::GetDataQuality(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), RawChannelId::GetElecType(), CandDataQualityHandle::GetErrorCode(), CandDataQualityHandle::GetHotChips(), CandDataQualityHandle::GetLiCalibPoint(), CandDataQualityHandle::GetLiCalibType(), CandDataQualityHandle::GetLiPulseHeight(), CandDataQualityHandle::GetLiPulserBox(), CandDataQualityHandle::GetLiPulserLed(), CandDataQualityHandle::GetLiPulseWidth(), CandDataQualityHandle::GetLiRelativeTime(), CandDataQualityHandle::GetLiSubtractedTime(), CandDataQualityHandle::GetLiTime(), CandDataQualityHandle::GetLiTrigger(), RawChannelId::GetMaster(), RawChannelId::GetMenu(), RawChannelId::GetMinder(), PlexSEIdAltL::GetPlane(), CandDataQualityHandle::GetPostTriggerDigits(), CandDataQualityHandle::GetPreTriggerDigits(), CandDataQualityHandle::GetReadoutErrors(), PlexHandle::GetSEIdAltL(), CandDataQualityHandle::GetSnarlMultiplicity(), CandDataQualityHandle::GetSpillStatus(), CandDataQualityHandle::GetSpillTimeError(), CandDataQualityHandle::GetSpillType(), CandDataQualityHandle::GetTriggerSource(), CandDataQualityHandle::GetTriggerTime(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), CandHandle::GetVldContext(), RawChannelId::GetVmm(), NtpSRDataQuality::hotchips, PlexSEIdAltL::IsValid(), PlexSEIdAltL::IsVetoShield(), Msg::kDebug, Detector::kFar, Detector::kNear, ElecType::kQIE, ElecType::kVA, NtpSRDataQuality::libox, NtpSRDataQuality::licalibpoint, NtpSRDataQuality::licalibtype, NtpSRDataQuality::liled, NtpSRDataQuality::lipulseheight, NtpSRDataQuality::lipulsewidth, NtpSRDataQuality::lirelativetime, NtpSRDataQuality::lisubtractedtime, NtpSRDataQuality::litime, NtpSRDataQuality::litrigger, MSG, NtpSRDeadChip::plane0, NtpSRDeadChip::plane1, NtpSRDataQuality::posttrigdigits, NtpSRDataQuality::pretrigdigits, NtpSRDataQuality::readouterrors, NtpSRDeadChip::shield, NtpSRDataQuality::snarlmultiplicity, NtpSRDataQuality::spillstatus, NtpSRDataQuality::spilltimeerror, NtpSRDataQuality::spilltype, NtpSRDeadChip::status, NtpSRDataQuality::trigsource, and NtpSRDataQuality::trigtime.

Referenced by Reco().

02571                                                                                                                            {
02572 
02573   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpDataQuality" << endl;
02574 
02575   const CandDataQualityHandle *dqhandle 
02576    = dynamic_cast <const CandDataQualityHandle*> 
02577      (cndrec->FindCandHandle("CandDataQualityHandle"));
02578   if ( !dqhandle ) return; // no handle => done
02579 
02580   ntpdataquality.trigsource = dqhandle->GetTriggerSource();        
02581   ntpdataquality.trigtime = dqhandle->GetTriggerTime();          
02582   ntpdataquality.errorcode = dqhandle->GetErrorCode();         
02583   ntpdataquality.cratemask = dqhandle->GetCrateMask();         
02584   ntpdataquality.pretrigdigits = dqhandle->GetPreTriggerDigits();     
02585   ntpdataquality.posttrigdigits = dqhandle->GetPostTriggerDigits();    
02586   ntpdataquality.snarlmultiplicity = dqhandle->GetSnarlMultiplicity(); 
02587   ntpdataquality.spillstatus = dqhandle->GetSpillStatus();       
02588   ntpdataquality.spilltype = dqhandle->GetSpillType();         
02589   ntpdataquality.spilltimeerror = dqhandle->GetSpillTimeError();    
02590   ntpdataquality.litrigger = dqhandle->GetLiTrigger();         
02591   ntpdataquality.litime = dqhandle->GetLiTime();            
02592   ntpdataquality.lisubtractedtime = dqhandle->GetLiSubtractedTime();  
02593   ntpdataquality.lirelativetime = dqhandle->GetLiRelativeTime();    
02594   ntpdataquality.licalibpoint = dqhandle->GetLiCalibPoint();      
02595   ntpdataquality.licalibtype = dqhandle->GetLiCalibType();       
02596   ntpdataquality.libox = dqhandle->GetLiPulserBox();             
02597   ntpdataquality.liled = dqhandle->GetLiPulserLed();             
02598   ntpdataquality.lipulseheight = dqhandle->GetLiPulseHeight();     
02599   ntpdataquality.lipulsewidth = dqhandle->GetLiPulseWidth();      
02600   ntpdataquality.coldchips = dqhandle->GetColdChips();         
02601   ntpdataquality.hotchips = dqhandle->GetHotChips();          
02602   ntpdataquality.busychips = dqhandle->GetBusyChips();         
02603   ntpdataquality.readouterrors = dqhandle->GetReadoutErrors();     
02604   ntpdataquality.dataqualityword = (Int_t)dqhandle->GetDataQuality();
02605 
02606   MSG("NtpSR",Msg::kDebug) << ntpdataquality << endl;
02607   
02608   Int_t ndeadchips = 0;
02609   TIter DeadChipItr(dqhandle->GetDaughterIterator());
02610   while ( CandDeadChipHandle* deadchip=dynamic_cast<CandDeadChipHandle*>(DeadChipItr())) {
02611 
02612     // Uses new with placement to fill TClonesArray
02613     NtpSRDeadChip* ntpdeadchip = new((ntpdeadchips)[ndeadchips++])NtpSRDeadChip();
02614     VldContext* vldc = (VldContext*)(dqhandle->GetVldContext());
02615     RawChannelId rawch = deadchip->GetChannelId();
02616     PlexHandle plex(*vldc);
02617 
02618     Int_t tempchannelid=-1;
02619     Int_t plane0=-1;
02620     Int_t plane1=-1;
02621     Int_t shield=-1;
02622 
02623     if( rawch.GetElecType()==ElecType::kVA 
02624      && vldc->GetDetector()==Detector::kFar ){
02625 
02626       Int_t crate = rawch.GetCrate();
02627       Int_t varc = rawch.GetVarcId();
02628       Int_t vmm = rawch.GetVmm();
02629       Int_t vaadc = rawch.GetVaAdcSel();
02630       Int_t vachip = rawch.GetVaChip();
02631    
02632       tempchannelid=108*crate+36*varc+6*vmm+3*vaadc+vachip;
02633 
02634       RawChannelId rcidCheck = RawChannelId(Detector::kFar,ElecType::kVA,
02635                                             crate, varc, vmm, vaadc, vachip, 
02636                                             10);
02637  
02638       if( plex.GetSEIdAltL(rcidCheck).IsValid() 
02639        && plex.GetSEIdAltL(rcidCheck).GetPlane()>=0 
02640        && plex.GetSEIdAltL(rcidCheck).GetPlane()<1000 ){
02641 
02642         if( plex.GetSEIdAltL(rcidCheck).IsVetoShield() ){
02643           shield = plex.GetSEIdAltL(rcidCheck).GetPlane();
02644         }
02645 
02646         if( !plex.GetSEIdAltL(rcidCheck).IsVetoShield() ){
02647           RawChannelId rcidLow = RawChannelId(Detector::kFar,ElecType::kVA,
02648                                               crate,varc,vmm,vaadc,0,2);
02649 
02650           RawChannelId rcidHigh = RawChannelId(Detector::kFar,ElecType::kVA,
02651                                                crate,varc,vmm,vaadc,1,17);
02652 
02653           if(vachip!=1) plane0 = plex.GetSEIdAltL(rcidLow).GetPlane();
02654           if(vachip!=0) plane1 = plex.GetSEIdAltL(rcidHigh).GetPlane();
02655         }
02656       }
02657         
02658     }
02659 
02660     if( rawch.GetElecType()==ElecType::kQIE 
02661      && vldc->GetDetector()==Detector::kNear ){
02662 
02663       Int_t crate = rawch.GetCrate();
02664       Int_t master = rawch.GetMaster();
02665       Int_t minder = rawch.GetMinder();
02666       Int_t menu = rawch.GetMenu();
02667 
02668       plane0 = plex.GetSEIdAltL(rawch).GetPlane();
02669       tempchannelid=2560*crate+128*master+16*minder+menu;
02670     }
02671 
02672     // Transport information from CandDeadChip to ntpdeadchip
02673     ntpdeadchip->channelid = tempchannelid;
02674     ntpdeadchip->plane0 = plane0;
02675     ntpdeadchip->plane1 = plane1;
02676     ntpdeadchip->shield = shield;
02677     ntpdeadchip->errorcode = deadchip->GetErrorCode();
02678     ntpdeadchip->status = (Int_t)deadchip->GetChipStatus();
02679 
02680   }
02681   
02682 }

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

Definition at line 2760 of file NtpSRModule.cxx.

References NtpSRDetStatus::coilcurrent1, NtpSRDetStatus::coilcurrent2, NtpSRDetStatus::coilstatus, NtpSRDetStatus::coldchips1, NtpSRDetStatus::coldchips2, NtpSRDetStatus::dbuhvstatus, NtpSRDetStatus::dcscoilstatus, fHvSinglesTask, DbuHvFromSingles::GetColdChips(), BfldDbiCoilState::GetCurrent(), VldContext::GetDetector(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), DbuHvFromSingles::GetStatus(), BfldDbiCoilState::GetStatus(), BfldDbiCoilState::GetSupermodule(), DbuHvFromSingles::GetSupermodule(), CoilTools::IsOK(), CoilTools::IsReverse(), CoilStatus::kBad, Msg::kDebug, Detector::kFar, Detector::kNear, CoilStatus::kOK, CoilStatus::kReverse, CoilStatus::kUnknown, and MSG.

Referenced by Reco().

02761                                                            {
02762   //
02763   //  Purpose:  Private method used to fill det status portion of ntuple 
02764   //            record.
02765   //
02766   //  Arguments: pointers to NtpSRRecord and vldc
02767   //  
02768   //  Return: none.
02769   // 
02770 
02771 
02772   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpSRDetStatus" << endl;
02773 
02774   // Dcs Coil Status
02775   ntpdetstatus.coilstatus = 0; // unknown, use of this variable is deprecated
02776   ntpdetstatus.dcscoilstatus = CoilStatus::kUnknown;
02777   ntpdetstatus.coilcurrent1 = -999.9;
02778   ntpdetstatus.coilcurrent2 = -999.9;
02779 
02780   switch (vldc.GetDetector()) {
02781 
02782   case Detector::kFar: 
02783     {  
02784       DbiResultPtr<BfldDbiCoilState> farcoilTable(vldc);
02785       Int_t nrow = farcoilTable.GetNumRows();
02786       for ( Int_t irow = 0; irow < nrow; irow++ ) {
02787         const BfldDbiCoilState* farcoilState = farcoilTable.GetRow(irow);
02788         if ( irow==0 ) ntpdetstatus.dcscoilstatus = farcoilState->GetStatus();
02789         else {
02790           // For fardet, agreement is required for two SM, else set Unknown
02791           if (ntpdetstatus.dcscoilstatus != (Short_t)farcoilState->GetStatus())
02792             ntpdetstatus.dcscoilstatus = CoilStatus::kUnknown;
02793         }
02794         // current by supermodule
02795         if( farcoilState->GetSupermodule()==1 )
02796                         ntpdetstatus.coilcurrent1 = farcoilState->GetCurrent();
02797         else if ( farcoilState->GetSupermodule()==2 )
02798                         ntpdetstatus.coilcurrent2 = farcoilState->GetCurrent();
02799       }
02800     }
02801     break;
02802 
02803   case Detector::kNear: 
02804     {  
02805       if ( CoilTools::IsOK(vldc) )
02806            ntpdetstatus.dcscoilstatus = CoilStatus::kOK;
02807       else ntpdetstatus.dcscoilstatus = CoilStatus::kBad;
02808       if ( CoilTools::IsReverse(vldc) )
02809            ntpdetstatus.dcscoilstatus |= CoilStatus::kReverse;
02810 
02811       // Fill current
02812       DbiResultPtr<Dcs_Mag_Near> nearcoilTable(vldc);
02813       if ( nearcoilTable.GetNumRows() > 0 ) {
02814         const Dcs_Mag_Near* nearcoilState = nearcoilTable.GetRow(0);
02815         ntpdetstatus.coilcurrent1 = nearcoilState -> GetCurrent();
02816       }
02817     }
02818     break;
02819     
02820   default:
02821     break;
02822   }
02823   
02824   
02825   // Dbu HV Status
02826   ntpdetstatus.dbuhvstatus = -1; // unknown by default
02827   ntpdetstatus.coldchips1 = -1;
02828   ntpdetstatus.coldchips2 = -1;
02829 
02830   DbiResultPtr<DbuHvFromSingles> hvTable(vldc,fHvSinglesTask);
02831   Int_t nrows = hvTable.GetNumRows();
02832   
02833   for( Int_t irows = 0; irows < nrows; irows++ ){
02834     const DbuHvFromSingles* hvState = hvTable.GetRow(irows);
02835    
02836     // cold chips in supermodule 1
02837     if( hvState->GetSupermodule()==1
02838      && hvState->GetColdChips()>ntpdetstatus.coldchips1 ){
02839       ntpdetstatus.coldchips1 = hvState->GetColdChips();
02840     }
02841   
02842     // cold chips in supermodule 2 (if it exists)
02843     if( hvState->GetSupermodule()==2
02844      && hvState->GetColdChips()>ntpdetstatus.coldchips2 ){
02845       ntpdetstatus.coldchips2 = hvState->GetColdChips();
02846     }
02847     
02848     // GOOD    (SM1,SM2) = (1,1) 
02849     // UNKNOWN (SM1,SM2) = (-1,1) or (1,-1) or (-1,-1)
02850     // BAD     (SM1,SM2) = (0,X) or (X,0)
02851     if( ( hvState->GetStatus()==0 )
02852      || ( hvState->GetStatus()==1 && ntpdetstatus.dbuhvstatus==-1 ) ) {
02853       ntpdetstatus.dbuhvstatus=hvState->GetStatus();
02854     }
02855   }
02856 
02857   MSG("NtpSR",Msg::kDebug) << ntpdetstatus << endl;
02858   
02859   return;
02860 
02861 }

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

Definition at line 2921 of file NtpSRModule.cxx.

References NtpSRDmxStatus::avgtimeoffset, CandDeMuxDigitListHandle::GetAvgTimeOffset(), CandDeMuxDigitListHandle::GetDeMuxDigitListFlagWord(), CandDeMuxDigitListHandle::GetNumStrayPlanesU(), CandDeMuxDigitListHandle::GetNumStrayPlanesV(), CandDeMuxDigitListHandle::GetNumValidPlanesU(), CandDeMuxDigitListHandle::GetNumValidPlanesV(), NtpSRDmxStatus::ismultimuon, Msg::kDebug, CandDeMuxDigitList::kMultipleMuonEvent, CandDeMuxDigitList::kNonPhysicalStripSolution, CandDeMuxDigitList::kNoVertex, CandDeMuxDigitList::kTooFewValidPlanes, MSG, NtpSRDmxStatus::nonphysicalfail, NtpSRDmxStatus::ustrayplanes, NtpSRDmxStatus::uvalidplanes, NtpSRDmxStatus::validplanesfail, NtpSRDmxStatus::vertexplanefail, NtpSRDmxStatus::vstrayplanes, and NtpSRDmxStatus::vvalidplanes.

Referenced by Reco().

02922                                                              {
02923   //
02924   //  Purpose:  Private method used to fill dmx status portion of ntuple 
02925   //            record.
02926   //
02927   //  Arguments: pointers to NtpSRRecord and CandRecord
02928   //  
02929   //  Return: none.
02930   // 
02931 
02932 
02933   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpDmxStatus" << endl;
02934 
02935   const CandDeMuxDigitListHandle *dlh 
02936    = dynamic_cast <const CandDeMuxDigitListHandle*> 
02937      (cndrec -> FindCandHandle("CandDeMuxDigitListHandle"));
02938   if ( !dlh ) return;
02939 
02940   Int_t demuxflagword = dlh->GetDeMuxDigitListFlagWord();
02941   if (demuxflagword & CandDeMuxDigitList::kMultipleMuonEvent)
02942     ntpdmxstatus.ismultimuon = 1; 
02943 
02944   if (demuxflagword & CandDeMuxDigitList::kNonPhysicalStripSolution)
02945     ntpdmxstatus.nonphysicalfail = 1; 
02946 
02947   if (demuxflagword & CandDeMuxDigitList::kTooFewValidPlanes)
02948     ntpdmxstatus.validplanesfail = 1;
02949  
02950   if (demuxflagword & CandDeMuxDigitList::kNoVertex)
02951     ntpdmxstatus.vertexplanefail = 1; 
02952 
02953   ntpdmxstatus.ustrayplanes = dlh->GetNumStrayPlanesU();
02954   ntpdmxstatus.vstrayplanes = dlh->GetNumStrayPlanesV();
02955   ntpdmxstatus.uvalidplanes = dlh->GetNumValidPlanesU();
02956   ntpdmxstatus.vvalidplanes = dlh->GetNumValidPlanesV();
02957   ntpdmxstatus.avgtimeoffset = dlh->GetAvgTimeOffset();
02958 
02959   MSG("NtpSR",Msg::kDebug) << ntpdmxstatus << endl;
02960   
02961   return;
02962 
02963 }

void NtpSRModule::FillNtpEvent ( TClonesArray &  ntpevtarray,
const CandRecord cndrec,
const RawRecord rawrec 
) [private]

Definition at line 1443 of file NtpSRModule.cxx.

References NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, NtpSREvent::bleach, NtpSREvent::contained, NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, NtpSRPlane::end, NtpSREvent::end, NtpSRPlane::endu, NtpSRPlane::endv, fEventUidMap, FillNtpBleach(), FillNtpWindow(), fShowerUidMap, fSliceUidMap, fStripUidMap, fTrackUidMap, CandHandle::GetDaughterIterator(), CandHandle::GetUidInt(), NtpSRStripPulseHeight::gev, NtpSREvent::index, kCos45, Msg::kDebug, Msg::kError, CalStripType::kGeV, CalStripType::kMIP, StripEnd::kNegative, CalStripType::kNone, CalStripType::kPE, StripEnd::kPositive, CalStripType::kSigCorr, CalStripType::kSigLin, CalStripType::kSigMapped, PlaneView::kU, PlaneView::kV, Msg::kWarning, NtpSRStripPulseHeight::mip, MSG, NtpSRPlane::n, NtpSREvent::ndigit, NtpSRPlane::nu, NtpSRPlane::nv, NtpSRPulseHeight::pe, NtpSREvent::ph, NtpSRVertex::plane, NtpSREvent::plane, NtpSREvent::primshw, NtpSREvent::primtrk, NtpSRPulseHeight::raw, NtpSREvent::SetPh(), 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().

01445                                                         {
01446   //
01447   //  Purpose:  Private method used to fill event portion of ntuple record.
01448   //
01449   //  Arguments: pointers to NtpSRRecord and CandRecord
01450   //  
01451   //  Return: status.
01452   // 
01453 
01454   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpEvent" << endl;
01455 
01456   const CandEventListHandle *eventlisthandle 
01457    = dynamic_cast <const CandEventListHandle*> 
01458      (cndrec -> FindCandHandle("CandEventListHandle"));
01459   if (!eventlisthandle) return; // all done
01460 
01461   Int_t nevent = 0;
01462   TIter eventItr(eventlisthandle->GetDaughterIterator());
01463   while (CandEventHandle* event=dynamic_cast<CandEventHandle*>
01464                                                       (eventItr())) {
01465     Int_t uid = event->GetUidInt();
01466     fEventUidMap.insert(std::make_pair(uid,nevent));
01467     // Uses new with placement to efficiently create event ntp
01468 
01469     NtpSREvent* ntpevent 
01470 
01471     = new(ntpeventarray[nevent++])NtpSREvent(event->GetNStrip(),
01472                       event->GetLastShower()+1,event->GetLastTrack()+1);
01473     ntpevent->index = nevent-1;
01474     // index to associated slice in slice array
01475     const CandSliceHandle* eventslice = event -> GetCandSlice();
01476 
01477     if ( eventslice ) {
01478       std::map<int,int>::iterator uidItr;
01479       uidItr = fSliceUidMap.find(eventslice->GetUidInt());
01480       if ( uidItr == fSliceUidMap.end() ) {
01481         MSG("NtpSR",Msg::kError)
01482           << "Event slice w/Uid "
01483           << eventslice->GetUidInt()
01484           << " does not match any in slice list."
01485           << "\n evt slc will not be properly filled." << endl;
01486       }
01487       else {
01488         ntpevent->slc = uidItr->second;
01489       }
01490     }
01491     else {
01492       MSG("NtpSR",Msg::kWarning) << "No associated Slice found for event"
01493                                  << endl;
01494       ntpevent->slc = -1;
01495     }
01496 
01497     ntpevent->ndigit = event->GetNDigit();
01498 
01499     TIter eventstripItr(event->GetDaughterIterator());
01500     Int_t neventstrip = 0;
01501     // Fill indices of associated strips,showers,tracks in event ntuple
01502     std::map<int,int>::iterator uidItr;
01503   
01504     int istrip=0;
01505     while ( CandStripHandle *eventstrip = dynamic_cast<CandStripHandle*>
01506                                                       (eventstripItr())) {
01507       uidItr = fStripUidMap.find(eventstrip->GetUidInt());
01508       istrip++;
01509       if ( uidItr == fStripUidMap.end() ) {
01510         MSG("NtpSR",Msg::kError)
01511            << "Event strip w/Uid " 
01512            << eventstrip->GetUidInt() 
01513            << " does not match any in strip list."
01514            << "\nevt stp array will not be properly filled." << endl;        
01515       } 
01516       else {
01517         Int_t stripindex = uidItr->second;
01518         ntpevent -> AddStripAt(stripindex,neventstrip);
01519       }
01520 
01521       for (UInt_t iend = 0; iend < 2; iend++ ) {
01522         StripEnd::EStripEnd stripend = StripEnd::kNegative;
01523         if (iend == 1) stripend = StripEnd::kPositive;
01524         if ( eventstrip->GetNDigit(stripend) > 0 ) {
01525           Float_t sigmap = event->GetStripCharge(eventstrip,
01526                            CalStripType::kSigMapped,stripend);
01527           Float_t mip = event->GetStripCharge(eventstrip,
01528                            CalStripType::kMIP,stripend);
01529           Float_t gev = event->GetStripCharge(eventstrip,
01530                            CalStripType::kGeV,stripend);
01531       
01532           ntpevent->SetPh(sigmap,mip,gev,neventstrip,iend);
01533         }
01534       }
01535 
01536       neventstrip++;
01537     }
01538 
01539     for (Int_t i = 0; i <= event->GetLastTrack(); i++ ) {
01540       const CandTrackHandle* track = event->GetTrack(i);
01541   
01542       uidItr = fTrackUidMap.find(track->GetUidInt());
01543       if ( uidItr == fTrackUidMap.end() ) {
01544         MSG("NtpSR",Msg::kError) 
01545            << "Event track w/Uid " 
01546            << track->GetUidInt() << " does not match any in track list."
01547            << "\nevt trk array will not be properly filled." << endl;        
01548       } 
01549       else {
01550         Int_t trackindex = uidItr->second;
01551         ntpevent -> AddTrackAt(trackindex,i);
01552       }
01553     }
01554     for (Int_t i = 0; i <= event->GetLastShower(); i++ ) {
01555       const CandShowerHandle* shower = event->GetShower(i);
01556       uidItr = fShowerUidMap.find(shower->GetUidInt());
01557       if ( uidItr == fShowerUidMap.end() ) {
01558         MSG("NtpSR",Msg::kError) 
01559            << "Event shower w/Uid " 
01560            << shower->GetUidInt() << " does not match any in shower list."
01561            << "\nevt shw array will not be properly filled." << endl;        
01562       } 
01563       else {
01564         Int_t showerindex = uidItr->second;
01565         ntpevent -> AddShowerAt(showerindex,i);
01566       }
01567     }
01568     ntpevent->primtrk = event->GetPrimaryTrackIndex();
01569     ntpevent->primshw = event->GetPrimaryShowerIndex();
01570 
01571     // Set range of planes included in event
01572     ntpevent->plane.n = event->GetNPlane();
01573     ntpevent->plane.nu = event->GetNPlane(PlaneView::kU);
01574     ntpevent->plane.nv = event->GetNPlane(PlaneView::kV);
01575     ntpevent->plane.beg = event->GetBegPlane();
01576     ntpevent->plane.begu = event->GetBegPlane(PlaneView::kU);
01577     ntpevent->plane.begv = event->GetBegPlane(PlaneView::kV);
01578     ntpevent->plane.end = event->GetEndPlane();
01579     ntpevent->plane.endu = event->GetEndPlane(PlaneView::kU);
01580     ntpevent->plane.endv = event->GetEndPlane(PlaneView::kV);
01581     ntpevent->contained = event->IsContained();
01582     // Set summed charge in event
01583     ntpevent->ph.raw    = event->GetCharge(CalStripType::kNone);
01584     ntpevent->ph.siglin = event->GetCharge(CalStripType::kSigLin);
01585     ntpevent->ph.sigcor = event->GetCharge(CalStripType::kSigCorr);
01586     ntpevent->ph.pe     = event->GetCharge(CalStripType::kPE);
01587     ntpevent->ph.sigmap = event->GetCharge(CalStripType::kSigMapped);
01588     ntpevent->ph.mip    = event->GetCharge(CalStripType::kMIP);
01589 
01590     ntpevent->ph.gev = event->GetEnergy();
01591 
01592     // Set event vertex & end 
01593     NtpSRVertex& vtx = ntpevent->vtx;
01594     vtx.u     = event->GetVtxU();
01595     vtx.v     = event->GetVtxV();
01596     vtx.x     = kCos45*(vtx.u - vtx.v);
01597     vtx.y     = kCos45*(vtx.u + vtx.v);
01598     vtx.z     = event->GetVtxZ();
01599     vtx.t     = event->GetVtxT();
01600     vtx.plane = event->GetVtxPlane();
01601     vtx.dcosu = event->GetVtxDirCosU();
01602     vtx.dcosv = event->GetVtxDirCosV();
01603     vtx.dcosx = kCos45*(vtx.dcosu - vtx.dcosv);
01604     vtx.dcosy = kCos45*(vtx.dcosu + vtx.dcosv);
01605     vtx.dcosz = event->GetVtxDirCosZ();
01606     
01607     NtpSRVertex& end = ntpevent->end;
01608     end.u = event->GetEndU();
01609     end.v = event->GetEndV();
01610     end.x = kCos45*(end.u - end.v);
01611     end.y = kCos45*(end.u + end.v);
01612     end.z = event->GetEndZ();
01613     end.t = event->GetEndT();
01614     end.plane = event->GetEndPlane();
01615     end.dcosu = event->GetEndDirCosU();
01616     end.dcosv = event->GetEndDirCosV();
01617     end.dcosx = kCos45*(end.dcosu - end.dcosv);
01618     end.dcosy = kCos45*(end.dcosu + end.dcosv);
01619     end.dcosz = event->GetEndDirCosZ();
01620 
01621     NtpSRBleach& bleach = ntpevent->bleach;
01622     FillNtpBleach(bleach,event,cndrec,rawrec);
01623     
01624     FillNtpWindow(ntpevent,cndrec);
01625     
01626     MSG("NtpSR",Msg::kDebug) << (*ntpevent) << endl;
01627   }
01628 
01629   
01630   return;
01631 }

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

Definition at line 2965 of file NtpSRModule.cxx.

References NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, NtpSREventSummary::date, NtpSRDate::day, Munits::day, digit(), NtpSRPlane::end, NtpSRPlane::endu, NtpSRPlane::endv, fClusterUidMap, fEventUidMap, CandRecord::FindCandHandle(), fShowerUidMap, fSliceUidMap, fStripUidMap, fTrackUidMap, CandDigitListHandle::GetAbsTime(), RawDigit::GetADC(), RawDigit::GetChannel(), VldTimeStamp::GetDate(), PlexHandle::GetReadoutType(), VldTimeStamp::GetSec(), RawDigit::GetTDC(), VldTimeStamp::GetTime(), Calibrator::GetTimeFromTDC(), VldContext::GetTimeStamp(), RecMinos::GetVldContext(), Munits::hour, NtpSRDate::hour, Calibrator::Instance(), Msg::kDebug, ReadoutType::kFlashTrigPMT, StripEnd::kNegative, CalDigitType::kNone, CalDigitType::kPE, StripEnd::kPositive, CalDigitType::kSigCorr, CalDigitType::kSigLin, PlaneView::kU, PlaneView::kV, Msg::kVerbose, Msg::kWarning, NtpSREventSummary::litime, Munits::minute, NtpSRDate::minute, month, 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, NtpSRDate::year, and Munits::year.

Referenced by Reco().

02967                                                                {
02968   //
02969   //  Purpose:  Private method used to fill event summary portion of ntuple 
02970   //            record.
02971   //
02972   //  Arguments: pointers to NtpSRRecord and CandRecord
02973   //  
02974   //  Return: none.
02975   // 
02976 
02977 
02978   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpEventSummary" << endl;
02979 
02980   ntpeventsummary.nstrip  = fStripUidMap.size();
02981   ntpeventsummary.nslice  = fSliceUidMap.size();
02982   ntpeventsummary.ncluster = fClusterUidMap.size();
02983   ntpeventsummary.nshower = fShowerUidMap.size();
02984   ntpeventsummary.ntrack  = fTrackUidMap.size();
02985   ntpeventsummary.nevent  = fEventUidMap.size();
02986 
02987 
02988   const VldContext& vld = *(cndrec->GetVldContext());
02989   PlexHandle plex(vld);
02990   
02991   Double_t maxliTime = -1;
02992   if ( rawrec ) {
02993     TIter blockIter = rawrec -> GetRawBlockIter();
02994     TObject* blockobj = 0;
02995     while ( ( blockobj = blockIter.Next() ) ) {
02996       const RawDigitDataBlock* rddb 
02997         = dynamic_cast<const RawDigitDataBlock*>(blockobj);
02998       if ( rddb != 0 ) {
02999         TIter digititer = rddb -> GetDatumIter();
03000         TObject* digitobj = 0;
03001         while ( ( digitobj = digititer.Next() ) ) {
03002           RawDigit* rawdigit = dynamic_cast<RawDigit*>(digitobj);
03003           if ( rawdigit ) {
03004             RawChannelId rcid = rawdigit->GetChannel();
03005             ReadoutType::Readout_t type = plex.GetReadoutType(rcid);
03006             if ( type == ReadoutType::kFlashTrigPMT ) {
03007               if ( rawdigit->GetADC() > 100 ) {
03008                 Double_t liTime = 
03009                 Calibrator::Instance().GetTimeFromTDC(rawdigit->GetTDC(),
03010                                                   rawdigit->GetChannel());
03011                 maxliTime = TMath::Max(liTime,maxliTime);
03012               }
03013             }
03014           }       
03015         }       
03016       }      
03017     }    
03018   }
03019   else {
03020     MSG("NtpSR",Msg::kWarning) << "Missing RawRecord!"
03021                    << "\n evthdr.litime will not be properly filled." << endl;
03022   }
03023   ntpeventsummary.litime = maxliTime;
03024 
03025   
03026   // Fill the NtpSRDate portion of the NtpSREventSummary object
03027   UInt_t year,month,day,hour,minute,sec;
03028   vld.GetTimeStamp().GetDate(kTRUE,0,&year,&month,&day);
03029   vld.GetTimeStamp().GetTime(kTRUE,0,&hour,&minute,&sec);
03030   ntpeventsummary.date.year   = (UShort_t)year;  
03031   ntpeventsummary.date.month  = (Char_t)month;   
03032   ntpeventsummary.date.day    = (Char_t)day;     
03033   ntpeventsummary.date.hour   = (Char_t)hour;  
03034   ntpeventsummary.date.minute = (Char_t)minute; 
03035   ntpeventsummary.date.sec    =  (Double_t)sec; 
03036   ntpeventsummary.date.utc = vld.GetTimeStamp().GetSec();
03037 
03038   const CandDigitListHandle *dlh = dynamic_cast <const CandDigitListHandle*> 
03039      (cndrec->FindCandHandle("CandDigitListHandle"));
03040   if ( !dlh ) return; // no digits => done
03041 
03042   ntpeventsummary.trigtime = dlh->GetAbsTime();
03043   ntpeventsummary.date.sec   += ntpeventsummary.trigtime; 
03044 
03045   Int_t minplaneall  = -1;
03046   Int_t minplaneallu = -1;
03047   Int_t minplaneallv = -1;
03048   Int_t maxplaneall  = -1;
03049   Int_t maxplaneallu = -1;
03050   Int_t maxplaneallv = -1;
03051   std::map<Int_t,Bool_t> planeoccupancyall; 
03052   std::map<Int_t,Bool_t> planeoccupancyallu;
03053   std::map<Int_t,Bool_t> planeoccupancyallv;
03054   Float_t planepe[1000][2] = {{0},{0}}; // initializes all members to 0
03055 
03056   // Loop over all digits
03057   TIter digitItr(dlh -> GetDaughterIterator());
03058   while (CandDigitHandle* digit = dynamic_cast<CandDigitHandle*>(digitItr())) {
03059     // Calculate the summed pulse height of all digits (non-shield) in 
03060     // the entire event
03061     PlexSEIdAltL pseid(digit->GetPlexSEIdAltL());
03062     if (pseid.IsVetoShield()) continue;
03063     ntpeventsummary.ndigit++;
03064 
03065     ntpeventsummary.ph.raw += digit->GetCharge(CalDigitType::kNone);
03066     Float_t calcharge[3] = {0};
03067     if ( pseid.GetDemuxVetoFlag() == 0 ) { 
03068       // demux successful
03069       calcharge[0] = digit->GetCharge(CalDigitType::kSigLin);
03070       calcharge[1] = digit->GetCharge(CalDigitType::kSigCorr);
03071       calcharge[2] = digit->GetCharge(CalDigitType::kPE);
03072     }
03073     else if ( pseid.GetSize() > 0 ) {
03074       // if it wasn't demuxed, then simply use first entry
03075       calcharge[0] = pseid[0].GetSigLin();
03076       calcharge[1] = pseid[0].GetSigCorr();
03077       calcharge[2] = pseid[0].GetPE();
03078     }
03079     ntpeventsummary.ph.siglin += calcharge[0];
03080     ntpeventsummary.ph.sigcor += calcharge[1];
03081     ntpeventsummary.ph.pe     += calcharge[2];
03082 
03083     // Now determine the range of planes.  In the first case, the range of
03084     // planes is determined as the min/max plane with any digit.  
03085     Int_t iplane = pseid.GetPlane();
03086     if ( iplane < 0 || iplane >= 1000 ) continue;
03087 
03088     if ( minplaneall < 0 || iplane < minplaneall ) minplaneall = iplane;
03089     if ( maxplaneall < 0 || iplane > maxplaneall ) maxplaneall = iplane;
03090     planeoccupancyall[iplane] = kTRUE; // at least one digit on this plane
03091 
03092     switch (pseid.GetPlaneView()) {
03093     case PlaneView::kU:
03094       if (minplaneallu < 0 || iplane < minplaneallu) minplaneallu = iplane;
03095       if (maxplaneallu < 0 || iplane > maxplaneallu) maxplaneallu = iplane;
03096       planeoccupancyallu[iplane] = kTRUE; // at least one digit on this u-plane
03097       break;
03098     case PlaneView::kV:
03099       if (minplaneallv < 0 || iplane < minplaneallv) minplaneallv = iplane;
03100       if (maxplaneallv < 0 || iplane > maxplaneallv) maxplaneallv = iplane;
03101       planeoccupancyallv[iplane] = kTRUE; // at least one digit on this v-plane
03102       break;
03103     default:
03104       break;
03105     }
03106     
03107     // In the second case, the range of plane requires determining which planes
03108     // have a summed ph (over both readout ends) of > 3 pe. Store the plane
03109     // pe sum now and use it below.
03110     switch (pseid.GetEnd()) {
03111     case StripEnd::kNegative:
03112       planepe[iplane][0] += calcharge[2];  // CalDigitType::kPE
03113       break;
03114     case StripEnd::kPositive:
03115       planepe[iplane][1] += calcharge[2];  // CalDigitType::kPE
03116       break;
03117     default:
03118       break;
03119     }
03120   } // end of digit while loop
03121 
03122   ntpeventsummary.planeall.beg  = minplaneall;
03123   ntpeventsummary.planeall.end  = maxplaneall;
03124   ntpeventsummary.planeall.begu = minplaneallu;
03125   ntpeventsummary.planeall.endu = maxplaneallu;
03126   ntpeventsummary.planeall.begv = minplaneallv;
03127   ntpeventsummary.planeall.endv = maxplaneallv;
03128   std::map<Int_t,Bool_t>::iterator iter;
03129   for ( Int_t iplane = minplaneall; iplane <= maxplaneall; iplane ++ ) {
03130     iter = planeoccupancyall.find(iplane); // at least one digit
03131     if ( iter != planeoccupancyall.end() ) ntpeventsummary.planeall.n++;
03132     iter = planeoccupancyallu.find(iplane); // at least one digit u
03133     if ( iter != planeoccupancyallu.end() ) ntpeventsummary.planeall.nu++;
03134     iter = planeoccupancyallv.find(iplane); // at least one digit v
03135     if ( iter != planeoccupancyallv.end() ) ntpeventsummary.planeall.nv++;
03136   }
03137 
03138   // plane.beg/end is determined by first testing for 4 contiguous planes
03139   // with a summed ph > 3 pe across both ends. The minimum plane of the first 
03140   // such group and the maximum plane of the last such group form plane.beg 
03141   // and plane.end respectively.
03142   Int_t minplane  = -1;
03143   Int_t maxplane  = -1;
03144   bool found(0);
03145   for (Int_t iplane=minplaneall;iplane<=maxplaneall-3 && !found; iplane++) {
03146     if ( !found && (planepe[iplane][0] + planepe[iplane][1]) > 3.  
03147                 && (planepe[iplane+1][0] + planepe[iplane+1][1]) > 3. 
03148                 && (planepe[iplane+2][0] + planepe[iplane+2][1]) > 3. 
03149                 && (planepe[iplane+3][0] + planepe[iplane+3][1]) > 3. ) {
03150       found = 1;
03151       minplane = iplane;
03152     }
03153   }
03154   found = 0;
03155   for (Int_t iplane=maxplaneall;iplane>=minplaneall+3 && !found; iplane--) {
03156     if ( !found && (planepe[iplane][0] + planepe[iplane][1]) > 3.  
03157                 && (planepe[iplane-1][0] + planepe[iplane-1][1]) > 3. 
03158                 && (planepe[iplane-2][0] + planepe[iplane-2][1]) > 3. 
03159                 && (planepe[iplane-3][0] + planepe[iplane-3][1]) > 3. ) {
03160       found = 1;
03161       maxplane = iplane;
03162     }
03163   }
03164 
03165   Int_t minplaneu = -1;
03166   Int_t minplanev = -1;
03167   Int_t maxplaneu = -1;
03168   Int_t maxplanev = -1;
03169   for (Int_t iplane = minplane; iplane <= maxplane; iplane++ ) {
03170     if ( iplane >= 0 ) {
03171       if ( planepe[iplane][0] + planepe[iplane][1] > 0. ) {
03172         ntpeventsummary.plane.n++;  // non-zero readout at either end
03173         iter = planeoccupancyallu.find(iplane);
03174         if ( iter != planeoccupancyallu.end() ) {
03175           ntpeventsummary.plane.nu++; // non-zero readout on u plane
03176           if ( minplaneu < 0 || iplane < minplaneu ) minplaneu = iplane;
03177           if ( maxplaneu < 0 || iplane > maxplaneu ) maxplaneu = iplane;
03178         }
03179         iter = planeoccupancyallv.find(iplane);
03180         if ( iter != planeoccupancyallv.end() ) {
03181           ntpeventsummary.plane.nv++;
03182           if ( minplanev < 0 || iplane < minplanev ) minplanev = iplane;
03183           if ( maxplanev < 0 || iplane > maxplanev ) maxplanev = iplane;
03184         }
03185       }
03186     }
03187   }
03188 
03189   ntpeventsummary.plane.beg = minplane;
03190   ntpeventsummary.plane.end = maxplane;
03191   ntpeventsummary.plane.begu = minplaneu;
03192   ntpeventsummary.plane.endu = maxplaneu;
03193   ntpeventsummary.plane.begv = minplanev;
03194   ntpeventsummary.plane.endv = maxplanev;
03195 
03196   MSG("NtpSR",Msg::kDebug) << ntpeventsummary << endl;
03197   
03198   return;
03199 
03200 }

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

Definition at line 1875 of file NtpSRModule.cxx.

References PlaneOutline::DistanceToEdge(), NtpSRFiducial::dr, NtpSRFiducial::dz, VldContext::GetDetector(), PlexPlaneId::GetPlaneCoverage(), PlexPlaneId::GetPlaneView(), UgliGeomHandle::GetZExtent(), PlexPlaneId::IsValid(), min, NtpSRVertex::plane, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

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

01877                                                                  {
01878   //
01879   //  Purpose:  Private method used to fill NtpSRFiducial dr and dz
01880   //            data members  given a point defined by NtpSRVertex and 
01881   //            the detector type.
01882   //
01883   //  Return: none.
01884   // 
01885 
01886   UgliGeomHandle ugh(vld);
01887   Float_t zextent[2];
01888   ugh.GetZExtent(zextent[0],zextent[1]);
01889   Detector::Detector_t Detector = vld.GetDetector();
01890   PlaneOutline pl;
01891   PlexPlaneId plnid(Detector,vtx.plane,false);
01892   float dist=-1; float xedge=0; float yedge=0;
01893   if(plnid.IsValid()){
01894     pl.DistanceToEdge(vtx.x, vtx.y,
01895                       plnid.GetPlaneView(),
01896                       plnid.GetPlaneCoverage(),
01897                       dist, xedge, yedge);  
01898   }
01899   fid.dr=dist;
01900   if ( fid.dr < 0. ) fid.dr = 0;
01901   fid.dz = min(vtx.z-zextent[0],zextent[1]-vtx.z);
01902 }

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

Definition at line 911 of file NtpSRModule.cxx.

References NtpSRTrack::end, FillNtpShieldExpected(), FillNtpShieldStrip(), FillNtpTrackProjectionToShield(), fShGeom, RecMinos::GetVldContext(), Msg::kDebug, MSG, ShieldGeom::Reinitialize(), and NtpSRTrack::vtx.

Referenced by Reco().

00915                                                          {
00916   //
00917   //  Purpose:  Private method used to fill shield portion of ntuple.
00918   //
00919   //  Arguments: NtpSRRecord 
00920   //  
00921   //  Return: none.
00922   // 
00923   //  Notes: Should be called post-filling of ntp tracks
00924   //
00925 
00926   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpShield" << endl;
00927 
00928   //Getting the Shield geometry. Not reloaded unless VldContext obtained from rawrec is out of VldRange of ShieldGeom object (that's what "Reinitialize" does)
00929   const VldContext& vldc = *(rawrec->GetVldContext());
00930   if( !fShGeom ){
00931     fShGeom = new ShieldGeom(vldc);
00932   }
00933   else{
00934     fShGeom->Reinitialize(vldc);
00935   }
00936   if( ntptrack ){
00937     const NtpSRVertex& vtx = ntptrack->vtx;
00938     const NtpSRVertex& end = ntptrack->end;
00939     const CandShieldSR cssh(vtx,end,fShGeom);
00940 
00941     // Fill results of projecting track to shield in shield summary first
00942     // The result of projection is used to correct timing data in shield strips
00943     // for the propagation time along the z-direction of strip
00944     this -> FillNtpTrackProjectionToShield(ntpshieldsummary,ntptrack,cssh);
00945     this -> FillNtpShieldExpected(ntpshieldexpected,cssh);
00946   }
00947   this -> FillNtpShieldStrip(ntpshieldstriparray,ntpshieldexpected,ntpshieldsummary,ntptrack,rawrec); 
00948 
00949   MSG("NtpSR",Msg::kDebug) << ntpshieldsummary << endl;
00950   
00951   return;
00952 
00953 }

void NtpSRModule::FillNtpShieldExpected ( TClonesArray &  ntpshieldexpected,
const CandShieldSR cssh 
) [private]

Definition at line 877 of file NtpSRModule.cxx.

References NtpSRShieldExpected::centerdis, CandShieldSR::GetCandShieldInter_X(), CandShieldSR::GetCandShieldInter_Y(), CandShieldSR::GetCandShieldInter_Z(), CandShieldSR::GetCandShieldPlane(), CandShieldSR::GetCandShieldStrip0(), CandShieldSR::GetInterCenterDis(), CandShieldSR::GetStripInPlank(), CandShieldSR::HitsInShield(), NtpSRShieldExpected::index, NtpSRShieldExpected::isfound, Msg::kVerbose, MSG, NtpSRShieldExpected::plane, NtpSRShieldExpected::plank, NtpSRShieldExpected::projx, NtpSRShieldExpected::projy, NtpSRShieldExpected::projz, NtpSRShieldExpected::stripdigit, and NtpSRShieldExpected::stripinplank.

Referenced by FillNtpShield().

00878                                               {
00879   //
00880   //  Purpose:  Private method used to fill information concerning the expected 
00881   //            hits in the shield
00882   //
00883   //  Arguments: Reference to NtpSRShieldExpected and to primary CandShieldSR object
00884   //  
00885   //  Return: none.
00886   // 
00887   //  Notes: Most of NtpSRShieldExpected is filled here, but part also in FillNtpShieldStrip
00888 
00889   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpShieldExpected" 
00890                              << endl;
00891   
00892   Int_t cont=0;
00893   for(int ii=1;ii<=cssh.HitsInShield();ii++){
00894     cont+=1;
00895     NtpSRShieldExpected* ntpshexp = new((ntpshieldexpected)[cont-1])NtpSRShieldExpected();
00896     ntpshexp->plane=cssh.GetCandShieldPlane(ii);   
00897     ntpshexp->plank=cssh.GetCandShieldStrip0(ii);
00898     ntpshexp->stripinplank[0]=cssh.GetStripInPlank(ii,0);
00899     ntpshexp->stripinplank[1]=cssh.GetStripInPlank(ii,1);
00900     ntpshexp->projx=cssh.GetCandShieldInter_X(ii);
00901     ntpshexp->projy=cssh.GetCandShieldInter_Y(ii);   
00902     ntpshexp->projz=cssh.GetCandShieldInter_Z(ii);
00903     ntpshexp->centerdis=cssh.GetInterCenterDis(ii);
00904     ntpshexp->index=cont-1;  
00905     ntpshexp->isfound=0;
00906     ntpshexp->stripdigit=-1;
00907     
00908  }
00909 }

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

Definition at line 504 of file NtpSRModule.cxx.

References NtpSRShieldSummary::adc, NtpSRShieldStrip::adc, NtpSRShieldStrip::clearlen, ShieldGeom::ClosestTwoSections(), NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, NtpSRShieldSummary::dx, NtpSRShieldSummary::dxvetostp, NtpSRShieldSummary::exphits, NtpSRShieldSummary::found2sect, fPostTrigger, fPreTrigger, fShGeom, RawDigit::GetADC(), ShieldGeom::GetAssociatedPlank(), Calibrator::GetCalibratedTime(), RawDigit::GetChannel(), RawChannelId::GetCrate(), RawDigitDataBlock::GetDatumIter(), PlexStripEndId::GetEnd(), PlexPlaneId::GetPlane(), ShieldGeom::GetPlaneClearFiber(), ShieldGeom::GetPlank_X(), ShieldGeom::GetPlank_Y(), ShieldGeom::GetPlank_Z(), ShieldProj::GetProjDis(), ShieldProj::GetProjInter_X(), ShieldProj::GetProjInter_Y(), ShieldProj::GetProjInter_Z(), RawRecord::GetRawBlockIter(), PlexHandle::GetSEIdAltL(), PlexSEIdAltL::GetSize(), PlexStripEndId::GetStrip(), UgliGeomHandle::GetStripHandle(), ShieldGeom::GetStripWls(), RawDigit::GetTDC(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChannel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RecMinos::GetVldContext(), RawChannelId::GetVmm(), NtpSRShieldStrip::index, Calibrator::Instance(), NtpSRShieldExpected::isfound, ShieldGeom::IsVertical(), PlexSEIdAltL::IsVetoShield(), Msg::kDebug, StripEnd::kNegative, StripEnd::kPositive, max, min, MSG, NtpSRShieldStrip::ndigit, NtpSRShieldSummary::ndigit, NtpSRShieldSummary::nplank, NtpSRShieldExpected::plane, NtpSRShieldStrip::plank, NtpSRShieldExpected::plank, NtpSRShieldStrip::pln, NtpSRShieldStrip::pmtindex, NtpSRShieldStrip::pmtpixel, NtpSRShieldExpected::projz, NtpSRShieldSummary::projz, PlexVetoShieldHack::RenumberMuxToMdl(), NtpSRShieldExpected::stripdigit, NtpSRShieldExpected::stripinplank, NtpSRVertex::t, NtpSRShieldStrip::time, NtpSRShieldStrip::timeraw, PropagationVelocity::Velocity(), NtpSRTrack::vtx, ShieldGeom::WhatSection(), NtpSRShieldStrip::wlspigtail, NtpSRVertex::x, NtpSRVertex::y, NtpSRVertex::z, and NtpSRShieldStrip::z.

Referenced by FillNtpShield().

00508                                                               {
00509   //
00510   //  Purpose:  Private method used to fill shield strip portion of ntuple 
00511   //            record.
00512   //
00513   //  Arguments: TClonesArray& of NtpSRShieldStrip's and CandRecord ptr
00514   //  
00515   //  Return: status.
00516   // 
00517 
00518   const VldContext& vldc = *(rawrec->GetVldContext());
00519   PlexHandle plexhandle(vldc);
00520   UgliGeomHandle ugh(vldc);
00521 
00522   Int_t minend = TMath::Min(StripEnd::kNegative,StripEnd::kPositive); 
00523 
00524   Bool_t wasExpected=false;
00525   Int_t hitstrip[2] = { 0, 0 };
00526   Double_t zproj = 0;
00527 
00528   Double_t propagation_velocity = PropagationVelocity::Velocity();
00529 
00530   Double_t tracktime = 0;
00531   if ( ntptrack ) tracktime = ntptrack->vtx.t;
00532 
00533   PlexVetoShieldHack plexvetoshieldhack;
00534   TIter rdbit = rawrec->GetRawBlockIter();
00535   TObject* tobject;
00536   // filled with NtpSRShieldStrip objects organized by time period
00537   std::vector<NtpSRShieldStrip*> shieldlist[3]; 
00538   while ((tobject = rdbit())) {
00539     RawDigitDataBlock *rdb = dynamic_cast<RawDigitDataBlock*>(tobject);
00540     if ( !rdb ) continue;
00541     TIter rdit = rdb->GetDatumIter();
00542     RawDigit* rd;
00543     while ((rd = dynamic_cast<RawDigit*>(rdit()))) {
00544       RawChannelId rawch = rd->GetChannel();
00545       PlexSEIdAltL plexaltl = plexhandle.GetSEIdAltL(rawch);
00546       Int_t stripend = 0;
00547       if ( plexaltl.IsVetoShield() ) {
00548         PlexStripEndId oldseid = plexaltl[0].GetSEId();
00549         const PlexStripEndId& newseid 
00550           = plexvetoshieldhack.RenumberMuxToMdl(vldc,oldseid);
00551         stripend = 1 - (Int_t)(newseid.GetEnd()-minend); // so that S=0,N=1
00552         assert(stripend >= 0 && stripend < 2);
00553             
00554         NtpSRShieldStrip* ntpshieldstrip = new NtpSRShieldStrip();
00555         ntpshieldstrip->ndigit++;
00556         ntpshieldstrip->pln = fShGeom->GetAssociatedPlank(newseid.GetPlane(),newseid.GetStrip(),0);
00557         ntpshieldstrip->plank = fShGeom->GetAssociatedPlank(newseid.GetPlane(),newseid.GetStrip(),1);
00558 
00559         //Checking if hit was expected 
00560         wasExpected=false;
00561         NtpSRShieldExpected *ntpshexp;
00562         for(int ii=1;ii<=ntpshieldsummary.exphits;ii++){
00563           ntpshexp = dynamic_cast<NtpSRShieldExpected *>(ntpshieldexpected[ii-1]);
00564           if(ntpshexp->plane==ntpshieldstrip->pln && ntpshexp->plank==ntpshieldstrip->plank){
00565             ntpshexp->isfound=1;
00566             wasExpected=true;
00567             hitstrip[0]=ntpshexp->stripinplank[0];
00568             hitstrip[1]=ntpshexp->stripinplank[1];
00569             zproj=ntpshexp->projz;
00570           }
00571         }
00572 
00573         ntpshieldstrip->adc[stripend] = rd->GetADC();
00574         ntpshieldstrip->pmtindex[stripend] = rawch.GetCrate()*108
00575               + rawch.GetVarcId()*36 + rawch.GetVmm()*6 + rawch.GetVaAdcSel()*3
00576               + rawch.GetVaChip(); 
00577         Int_t vach2pixel[18]={0,0,15,1,16,2,11,5,12,6,7,9,8,10,3,14,4,13};
00578         if ( rawch.GetVaChannel() >= 2 && rawch.GetVaChannel() <= 17 ) {
00579           ntpshieldstrip->pmtpixel[stripend]
00580                     = vach2pixel[rawch.GetVaChannel()];
00581         }
00582         ntpshieldstrip->timeraw[stripend] 
00583            = rd->GetTDC()*1.5625e-9 + 26.e-9; // ?RWH/BR 26ns is a historical mystery
00584 
00585         // Correct for time walks (Andy Blake tw and Pedro Ochoa tw), and T0. 
00586         ntpshieldstrip->time[stripend] = Calibrator::Instance().GetCalibratedTime(ntpshieldstrip->timeraw[stripend],ntpshieldstrip->adc[stripend],newseid);
00587 
00588         UgliStripHandle ush(ugh.GetStripHandle(newseid));
00589         if ( ush.IsValid() ) {
00590           TVector3 stripxyz0(ush.GlobalPos(-ush.GetHalfLength()));
00591           TVector3 stripxyz1(ush.GlobalPos(ush.GetHalfLength()));
00592           ntpshieldstrip -> x = fShGeom->GetPlank_X(ntpshieldstrip->pln,ntpshieldstrip->plank);
00593           ntpshieldstrip -> y = fShGeom->GetPlank_Y(ntpshieldstrip->pln,ntpshieldstrip->plank);
00594           ntpshieldstrip -> z[0] = min(stripxyz0[2],stripxyz1[2]);
00595           ntpshieldstrip -> z[1] = max(stripxyz0[2],stripxyz1[2]);
00596 
00597           // Correct for wls and clear fiber
00598           if(wasExpected==false){
00599             // Average wlspigtail and clearlen over all strip ends
00600             for ( int i = 0; i < plexaltl.GetSize(); i++ ) {
00601               PlexStripEndId stpoldseid=plexaltl[i].GetSEId();
00602               const PlexStripEndId& stpnewseid 
00603                 = plexvetoshieldhack.RenumberMuxToMdl(vldc,stpoldseid);
00604               UgliStripHandle stpush(ugh.GetStripHandle(stpnewseid));
00605               Int_t stpstripend 
00606                 = 1 - (Int_t)(stpnewseid.GetEnd()-minend); // S=0,N=1
00607               assert(stpstripend >= 0 && stpstripend < 2);
00608               ntpshieldstrip -> wlspigtail[1] 
00609                 += stpush.WlsPigtail(StripEnd::kNegative);
00610               ntpshieldstrip -> wlspigtail[0] 
00611                 += stpush.WlsPigtail(StripEnd::kPositive);
00612               ntpshieldstrip -> clearlen[1] 
00613                 += stpush.ClearFiber(StripEnd::kNegative);
00614               ntpshieldstrip -> clearlen[0] 
00615                 += stpush.ClearFiber(StripEnd::kPositive);
00616             }
00617             if ( plexaltl.GetSize() > 0 ) {
00618               for ( int iend = 0; iend < 2; iend++ ) {
00619                 ntpshieldstrip->wlspigtail[iend] /=(Float_t)(plexaltl.GetSize());
00620                 ntpshieldstrip->clearlen[iend] /= (Float_t)(plexaltl.GetSize());
00621               }
00622             }
00623           }else{
00624             ntpshieldstrip->wlspigtail[0]=fShGeom->GetStripWls(hitstrip[0],hitstrip[1],0);
00625             ntpshieldstrip->wlspigtail[1]=fShGeom->GetStripWls(hitstrip[0],hitstrip[1],1);
00626             ntpshieldstrip->clearlen[0]=fShGeom->GetPlaneClearFiber(hitstrip[0],0);
00627             ntpshieldstrip->clearlen[1]=fShGeom->GetPlaneClearFiber(hitstrip[0],1);
00628           }
00629 
00630           
00631           // correct for wlspigtail + clear fiber
00632           Double_t fiberlen = ntpshieldstrip->wlspigtail[stripend] 
00633             + ntpshieldstrip->clearlen[stripend];
00634           if ( fiberlen > 20. ) fiberlen = 20.; // limit bad lengths
00635           ntpshieldstrip->time[stripend] -= fiberlen/propagation_velocity;
00636         }
00637 
00638         // Time is corrected for propagation length along strip
00639         if(wasExpected==false){
00640           if ( ntptrack && ntpshieldsummary.projz >= ntpshieldstrip->z[0] &&
00641                ntpshieldsummary.projz <= ntpshieldstrip->z[1] ) {
00642             ntpshieldstrip->time[stripend] -= fabs(ntpshieldsummary.projz
00643                                                    -ntpshieldstrip->z[stripend])/propagation_velocity;
00644           }
00645         } else{
00646           if(stripend==0){
00647             ntpshieldstrip->time[stripend] -= fabs(zproj-fShGeom->GetPlank_Z(ntpshieldstrip->pln,ntpshieldstrip->plank)+4.)/propagation_velocity;
00648           }else if(stripend==1){
00649             ntpshieldstrip->time[stripend] -= fabs(4.+fShGeom->GetPlank_Z(ntpshieldstrip->pln,ntpshieldstrip->plank)-zproj)/propagation_velocity;
00650           }       
00651         }
00652 
00653         //Look for CR bkgd
00654         if( ntptrack ){
00655           if((fShGeom->WhatSection(ntpshieldstrip->pln)==fShGeom->ClosestTwoSections(ntptrack->vtx.z,0) && 1.e9*fabs(ntptrack->vtx.t-ntpshieldstrip->time[stripend])<100) || (fShGeom->WhatSection(ntpshieldstrip->pln)==fShGeom->ClosestTwoSections(ntptrack->vtx.z,1) && 1.e9*fabs(ntptrack->vtx.t-ntpshieldstrip->time[stripend])<100)){
00656             ntpshieldsummary.found2sect=true;
00657           }
00658         }
00659         
00660         // determine which shield window the time of this strip fell:
00661         // pretrigger,trigger or posttrigger
00662         Int_t ishieldtime = 1;
00663         if ( (ntpshieldstrip->time[stripend]-tracktime)< -1.*fabs(fPreTrigger))
00664           ishieldtime = 0;
00665         else if((ntpshieldstrip->time[stripend]-tracktime)>fabs(fPostTrigger)) 
00666           ishieldtime = 2;
00667         ntpshieldsummary.ndigit[ishieldtime]++;
00668         ntpshieldsummary.adc[ishieldtime] += rd->GetADC();;
00669         
00670         // Search through list of shield strips in this time window to
00671         // determine if new shield strip should be merged with existing
00672         // shield strip (same plane,plank).
00673         bool isFound = false;
00674         std::vector<NtpSRShieldStrip*>::iterator vsItr;
00675         for ( vsItr = shieldlist[ishieldtime].begin(); 
00676               vsItr!= shieldlist[ishieldtime].end() && !isFound; vsItr++) {
00677           NtpSRShieldStrip* liststrip = *vsItr;
00678           if ( liststrip->pln == ntpshieldstrip->pln && 
00679                liststrip->plank == ntpshieldstrip->plank  ) {
00680             isFound = true;
00681             liststrip->ndigit += ntpshieldstrip->ndigit;
00682             if ( liststrip->adc[stripend] == 0 ) {
00683               liststrip->timeraw[stripend] = ntpshieldstrip->timeraw[stripend];
00684               liststrip->time[stripend]    = ntpshieldstrip->time[stripend];
00685               liststrip->wlspigtail[stripend] 
00686                 = ntpshieldstrip->wlspigtail[stripend];
00687               liststrip->clearlen[stripend]=ntpshieldstrip->clearlen[stripend];
00688               liststrip->pmtindex[stripend]=ntpshieldstrip->pmtindex[stripend];
00689               liststrip->pmtpixel[stripend]=ntpshieldstrip->pmtpixel[stripend];
00690             }
00691             liststrip->adc[stripend] += ntpshieldstrip->adc[stripend];
00692             delete ntpshieldstrip; ntpshieldstrip = 0;
00693           }
00694         }
00695         if ( !isFound ) {
00696           shieldlist[ishieldtime].push_back(ntpshieldstrip);
00697           ntpshieldsummary.nplank[ishieldtime]++;
00698         }
00699       }
00700     }
00701     
00702     // Finally, loop over all strips, grouped by time interval, and produce
00703     // TClonesArray of shield strips.  Entries in TClonesArray are timeordered
00704     // such that pre-trigger strips appear first, then trigger, 
00705     // then post-trigger.
00706     Int_t nshieldstrip = 0;
00707       for ( int ishieldtime = 0; ishieldtime < 3; ishieldtime++ ) {
00708         std::vector<NtpSRShieldStrip*>::iterator vsItr;
00709         for ( vsItr = shieldlist[ishieldtime].begin(); 
00710               vsItr!= shieldlist[ishieldtime].end(); vsItr++) {
00711           NtpSRShieldStrip* liststrip = *vsItr;
00712           // Invoke copy constructor to add strip to TClonesArray
00713           NtpSRShieldStrip& ntpstrip = 
00714             *(new(ntpshieldstriparray[nshieldstrip++])NtpSRShieldStrip(*liststrip));
00715           ntpstrip.index = nshieldstrip - 1;
00716           
00717           //If hit was expected save its ntpshieldstrip index in ntpshieldexpected array 
00718           NtpSRShieldExpected *ntpshexp;
00719           for(int ii=1;ii<=ntpshieldsummary.exphits;ii++){
00720             ntpshexp = dynamic_cast<NtpSRShieldExpected *>(ntpshieldexpected[ii-1]);
00721             if(ntpshexp->plane==ntpstrip.pln && ntpshexp->plank==ntpstrip.plank){
00722               ntpshexp->stripdigit=ntpstrip.index;
00723             }
00724           }
00725           
00726           if ( ntptrack ) {
00727             // Project track back to shield hit and determine distance of closest
00728             // approach to any shield hit
00729             const NtpSRVertex& vtx = ntptrack -> vtx;
00730             
00731             Float_t dx;
00732             Int_t sign=1;
00733             ShieldProj sp(vtx.x,vtx.y,vtx.z,vtx.dcosx,vtx.dcosy,vtx.dcosz,ntpstrip.pln,ntpstrip.plank,fShGeom);
00734             if(sp.GetProjInter_Z() >= ntpstrip.z[0] && sp.GetProjInter_Z() <= ntpstrip.z[1]){
00735               if(fShGeom->IsVertical(ntpstrip.pln)){
00736              if(sp.GetProjInter_Y()-(fShGeom->GetPlank_Y(ntpstrip.pln,ntpstrip.plank)) < 0){
00737                sign=-1;
00738              }
00739            } else{
00740              if(sp.GetProjInter_X()-(fShGeom->GetPlank_X(ntpstrip.pln,ntpstrip.plank)) < 0){
00741                sign=-1;
00742              }
00743            }        
00744            dx=sp.GetProjDis()*sign;
00745            for(Int_t ie = 0; ie<2; ie++){
00746              if(fabs(dx)<fabs(ntpshieldsummary.dx[ishieldtime])){
00747                ntpshieldsummary.dx[ishieldtime] = dx;
00748                ntpshieldsummary.dxvetostp[ishieldtime] = nshieldstrip-1;
00749              }
00750            }
00751          }         
00752         } // ntptrack exists
00753         delete liststrip; liststrip = 0; // done with temporary liststrip
00754         MSG("NtpSR",Msg::kDebug) << ntpstrip << endl;
00755       }
00756     }
00757   }
00758 
00759   return;
00760 
00761 }

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

Definition at line 1219 of file NtpSRModule.cxx.

References NtpSRShower::AddStripAt(), NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, NtpSRShower::contained, NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, Calibrator::DecalStripToStrip(), Calibrator::DecalTime(), NtpSRShowerPulseHeight::EMgev, NtpSRPlane::end, NtpSRPlane::endu, NtpSRPlane::endv, fClusterUidMap, FillNtpSubShowerSummary(), fShowerUidMap, fSliceUidMap, fStripUidMap, CandHandle::GetDaughterIterator(), CandShowerSRHandle::GetLastSubShower(), CandRecoHandle::GetNStrip(), CandShowerSRHandle::GetNumSubShowersU(), CandShowerSRHandle::GetNumSubShowersV(), CandClusterHandle::GetPlaneView(), CandShowerSRHandle::GetSubShower(), CandHandle::GetUidInt(), NtpSRStripPulseHeight::gev, NtpSRShower::index, Calibrator::Instance(), CandShowerHandle::kCC, kCos45, Msg::kDebug, CandShowerHandle::kEM, Msg::kError, CalStripType::kGeV, CalStripType::kMIP, CandShowerHandle::kNC, StripEnd::kNegative, CalStripType::kNone, CalDigitType::kNone, CalStripType::kPE, StripEnd::kPositive, CandShowerHandle::kRawCC, CalStripType::kSigCorr, CalStripType::kSigLin, CalStripType::kSigMapped, PlaneView::kU, PlaneView::kV, Msg::kWarning, CandShowerHandle::kWtCC, CandShowerHandle::kWtNC, 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, NtpSRShower::plane, NtpSRVertex::plane, NtpSRPulseHeight::raw, NtpSRShower::SetAttnC0(), NtpSRShower::SetCalT0(), NtpSRShower::SetPh(), NtpSRShower::SetTime(), NtpSRShower::shwph, NtpSRPulseHeight::sigcor, NtpSRPulseHeight::siglin, NtpSRStripPulseHeight::sigmap, NtpSRShower::slc, NtpSRShower::stpu, NtpSRShower::stpv, NtpSRShower::stpx, NtpSRShower::stpy, NtpSRShower::stpz, NtpSRVertex::t, NtpSRVertex::u, NtpSRVertex::v, NtpSRShower::vtx, NtpSRShowerPulseHeight::wtCCgev, NtpSRShowerPulseHeight::wtNCgev, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by Reco().

01220                                                           {
01221   //
01222   //  Purpose:  Private method used to fill shower portion of ntuple record.
01223   //
01224   //  Arguments: reference to TClonesArray of NtpSRShowers and CandRecord ptr
01225   //  
01226   //  Return: status.
01227   // 
01228 
01229   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpShower" << endl;
01230 
01231   const CandShowerListHandle *showerlisthandle 
01232     = dynamic_cast <const CandShowerListHandle*> 
01233     (cndrec -> FindCandHandle("CandShowerListHandle"));
01234   if ( !showerlisthandle ) return; // all done
01235 
01236   const CandTrackListHandle *tracklisthandle 
01237     = dynamic_cast <const CandTrackListHandle*> 
01238     (cndrec -> FindCandHandle("CandTrackListHandle"));
01239 
01240   Int_t nshower = 0;
01241   TIter showerItr(showerlisthandle->GetDaughterIterator());
01242   while (CandShowerHandle* shower=dynamic_cast<CandShowerHandle*>
01243                                                       (showerItr())) {
01244     Int_t uid = shower->GetUidInt();
01245     fShowerUidMap.insert(std::make_pair(uid,nshower));
01246     // Uses new with placement to efficiently create slice ntp
01247     NtpSRShower* ntpshower = 0;
01248     if (shower -> InheritsFrom("CandShowerSRHandle")) {
01249       CandShowerSRHandle* showerSR = dynamic_cast<CandShowerSRHandle*>(shower);
01250       ntpshower 
01251       = new(ntpshowerarray[nshower++])NtpSRShower(showerSR->GetNStrip(),
01252                   showerSR->GetNumSubShowersU()+showerSR->GetNumSubShowersV());
01253     }
01254     else {
01255       ntpshower=new(ntpshowerarray[nshower++])NtpSRShower(shower->GetNStrip(),
01256                                                  shower->GetLastCluster()+1);
01257     }
01258     ntpshower -> nstpcnt = shower->GetNStrip();
01259     
01260     // Fill indices of associated strips in shower tree
01261     ntpshower->index = nshower - 1;
01262 
01263     // index to associated slice in slice array
01264     const CandSliceHandle* showerslice = shower -> GetCandSlice();
01265     if ( showerslice ) {
01266       std::map<int,int>::iterator uidItr;
01267       uidItr = fSliceUidMap.find(showerslice->GetUidInt());
01268       if ( uidItr == fSliceUidMap.end() ) {
01269         MSG("NtpSR",Msg::kError)
01270           << "Shower slice w/Uid "
01271           << showerslice->GetUidInt()
01272           << " does not match any in slice list."
01273           << "\n shw slc will not be properly filled." << endl;
01274       }
01275       else {
01276         ntpshower->slc = uidItr->second;
01277       }
01278     }
01279     else {
01280       MSG("NtpSR",Msg::kWarning) << "No associated Slice found for shower"
01281                                  << endl;
01282       ntpshower->slc = -1;
01283     }
01284 
01285     ntpshower->ndigit = shower->GetNDigit();
01286     TIter showerstripItr(shower->GetDaughterIterator());
01287     Int_t nshowerstrip = 0;
01288     while ( CandStripHandle *showerstrip = dynamic_cast<CandStripHandle*>
01289                                                         (showerstripItr()) ) {
01290       Int_t uid = showerstrip->GetUidInt();
01291       std::map<int,int>::iterator uidItr;
01292       uidItr = fStripUidMap.find(uid);
01293       if ( uidItr == fStripUidMap.end() ) {
01294         MSG("NtpSR",Msg::kError)
01295           << "Shower strip w/Uid " << uid
01296           << " does not match any in strip list."
01297           << "\n shw stp entry will not be properly filled." << endl;
01298       }
01299       else {
01300         Int_t stripindex = uidItr->second;
01301         ntpshower->AddStripAt(stripindex,nshowerstrip); // add index to strip
01302       }
01303 
01304       // Shower positional information at plane associated with each strip
01305       Int_t iplane = showerstrip->GetPlane();
01306       ntpshower->stpu[nshowerstrip] = shower->GetU(iplane);
01307       ntpshower->stpv[nshowerstrip] = shower->GetV(iplane);
01308       ntpshower->stpx[nshowerstrip] = kCos45*(ntpshower->stpu[nshowerstrip]
01309                                               -ntpshower->stpv[nshowerstrip]);
01310       ntpshower->stpy[nshowerstrip] = kCos45*(ntpshower->stpu[nshowerstrip]
01311                                               +ntpshower->stpv[nshowerstrip]);
01312       ntpshower->stpz[nshowerstrip] = showerstrip->GetZPos();
01313       
01314       for (UInt_t iend = 0; iend < 2; iend++ ) {
01315         StripEnd::EStripEnd stripend = StripEnd::kNegative;
01316         if (iend == 1) stripend = StripEnd::kPositive;
01317         if ( showerstrip->GetNDigit(stripend) > 0 ) {
01318           Float_t sigmap = shower->GetStripCharge(showerstrip,
01319                                                   CalStripType::kSigMapped,stripend);
01320           Float_t mip = shower->GetStripCharge(showerstrip,
01321                                                CalStripType::kMIP,stripend);
01322           Float_t gev = shower->GetStripCharge(showerstrip,
01323                                                CalStripType::kGeV,stripend);
01324           ntpshower->SetPh(sigmap,mip,gev,nshowerstrip,iend);
01325           ntpshower->SetTime(shower->GetT(iplane,stripend),nshowerstrip,iend);
01326           double c0 = Calibrator::Instance().DecalStripToStrip(1.0,
01327                       showerstrip->GetStripEndId(stripend));
01328           ntpshower->SetAttnC0(c0,nshowerstrip,iend);
01329           // Use DecalTime on input time 0 to get time offset
01330           double t0 = Calibrator::Instance().DecalTime(0.0,
01331                       showerstrip->GetCharge(CalDigitType::kNone,stripend),
01332                       showerstrip->GetStripEndId(stripend));
01333           ntpshower->SetCalT0(t0,nshowerstrip,iend);
01334         }
01335       }
01336       nshowerstrip++;
01337     }
01338 
01339     // cluster stuff:
01340     ntpshower->ncluster = 0;
01341     ntpshower->nUcluster = 0;
01342     ntpshower->nVcluster = 0;
01343     
01344     if (shower->InheritsFrom("CandShowerSRHandle")) {      
01345       CandShowerSRHandle* showerSR = dynamic_cast<CandShowerSRHandle*>(shower);
01346       ntpshower->ncluster = showerSR->GetLastSubShower()+1;
01347       if ( showerSR->GetLastSubShower()+1 > 0 ) {
01348         ntpshower->nUcluster = showerSR->GetNumSubShowersU();
01349         ntpshower->nVcluster = showerSR->GetNumSubShowersV();
01350         for (int i = 0; i < ntpshower->ncluster; i++) {
01351           const CandSubShowerSRHandle* showercluster=showerSR->GetSubShower(i);
01352           Int_t uid = showercluster->GetUidInt();
01353           std::map<int,int>::iterator uidItr = fClusterUidMap.find(uid);
01354           if ( uidItr == fClusterUidMap.end() ) {
01355             MSG("NtpSR",Msg::kError)
01356               << "Shower CandSubShowerSR w/Uid " << uid
01357               << " does not match any in cluster list."
01358               << " shw clu entry will not be properly filled." << endl;
01359           }
01360           else {
01361             Int_t clusterindex = uidItr->second;
01362             ntpshower -> AddClusterAt(clusterindex,i);
01363           }
01364         }
01365         this->FillNtpSubShowerSummary(ntpshower,showerSR,tracklisthandle);
01366       }
01367     }
01368     else {
01369       ntpshower->ncluster = shower->GetLastCluster()+1;
01370       for (int i = 0; i < ntpshower->ncluster; i++ ) {
01371         const CandClusterHandle* showercluster = shower->GetCluster(i);
01372         Int_t uid = showercluster->GetUidInt();
01373         std::map<int,int>::iterator uidItr = fClusterUidMap.find(uid);
01374         if ( uidItr == fClusterUidMap.end() ) {
01375           MSG("NtpSR",Msg::kError)
01376             << "\nShower CandCluster of index " << i << " (of " 
01377             << ntpshower->ncluster << " clusters) w/Uid " << uid
01378             << " does not match any in cluster list." 
01379             << "\nshw clu entry for CandShower of index "
01380             << ntpshower->index << " w/Uid " << shower->GetUidInt() 
01381             << " will not be properly filled!" << endl;
01382         }
01383         else {
01384           Int_t clusterindex = uidItr->second;
01385           ntpshower -> AddClusterAt(clusterindex,i);
01386         }
01387         if ( showercluster->GetPlaneView() == PlaneView::kU )
01388            ntpshower->nUcluster += 1;
01389         else if (showercluster->GetPlaneView() == PlaneView::kV )
01390            ntpshower->nVcluster += 1;
01391       }
01392     }
01393  
01394     // Set range of planes included in slice
01395     ntpshower->plane.n = shower->GetNPlane();
01396     ntpshower->plane.nu = shower->GetNPlane(PlaneView::kU);
01397     ntpshower->plane.nv = shower->GetNPlane(PlaneView::kV);
01398     ntpshower->plane.beg = shower->GetBegPlane();
01399     ntpshower->plane.begu = shower->GetBegPlane(PlaneView::kU);
01400     ntpshower->plane.begv = shower->GetBegPlane(PlaneView::kV);
01401     ntpshower->plane.end = shower->GetEndPlane();
01402     ntpshower->plane.endu = shower->GetEndPlane(PlaneView::kU);
01403     ntpshower->plane.endv = shower->GetEndPlane(PlaneView::kV);
01404     ntpshower->contained = shower->IsContained();
01405     // Set summed charge in shower
01406     ntpshower->ph.raw = shower->GetCharge(CalStripType::kNone);
01407     ntpshower->ph.siglin = shower->GetCharge(CalStripType::kSigLin);
01408     ntpshower->ph.sigcor = shower->GetCharge(CalStripType::kSigCorr);
01409     ntpshower->ph.pe = shower->GetCharge(CalStripType::kPE);
01410     ntpshower->ph.sigmap = shower->GetCharge(CalStripType::kSigMapped);
01411     ntpshower->ph.mip = shower->GetCharge(CalStripType::kMIP);
01412 //    ntpshower->ph.gev = shower->GetEnergy(CandShowerHandle::kWtCC);
01413     ntpshower->ph.gev = shower->GetEnergy(CandShowerHandle::kRawCC); // Set this to the uncorrected CC energy...
01414     ntpshower->shwph.wtCCgev = shower->GetEnergy(CandShowerHandle::kWtCC);
01415     ntpshower->shwph.linCCgev = shower->GetEnergy(CandShowerHandle::kCC);
01416     ntpshower->shwph.wtNCgev = shower->GetEnergy(CandShowerHandle::kWtNC);
01417     ntpshower->shwph.linNCgev = shower->GetEnergy(CandShowerHandle::kNC);
01418     ntpshower->shwph.EMgev = shower->GetEnergy(CandShowerHandle::kEM);
01419 
01420     // Set vertex of shower
01421     NtpSRVertex& vtx = ntpshower->vtx;
01422     vtx.u = shower->GetVtxU();
01423     vtx.v = shower->GetVtxV();
01424     vtx.x = kCos45*(vtx.u-vtx.v);
01425     vtx.y = kCos45*(vtx.u+vtx.v);
01426     vtx.z = shower->GetVtxZ();
01427     vtx.t = shower->GetVtxT();
01428     vtx.plane = shower->GetVtxPlane();
01429     vtx.dcosu = shower->GetDirCosU();
01430     vtx.dcosv = shower->GetDirCosV();
01431     vtx.dcosx = kCos45*(vtx.dcosu-vtx.dcosv);
01432     vtx.dcosy = kCos45*(vtx.dcosu+vtx.dcosv);
01433     vtx.dcosz = shower->GetDirCosZ();
01434     MSG("NtpSR",Msg::kDebug) << "CandShower uid " 
01435                              << shower -> GetUidInt() << "\n"
01436                              << (*ntpshower) << endl;
01437   }
01438 
01439   return;
01440 }

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

Definition at line 955 of file NtpSRModule.cxx.

References NtpSRSlice::AddStripAt(), NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, NtpSRPlane::end, NtpSRPlane::endu, NtpSRPlane::endv, fSliceUidMap, fStripUidMap, CandHandle::GetDaughterIterator(), NtpSRSlice::index, Msg::kDebug, Msg::kError, CalDigitType::kNone, CalDigitType::kPE, CalDigitType::kSigCorr, CalDigitType::kSigLin, PlaneView::kU, PlaneView::kV, 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().

00956                                                          {
00957   //
00958   //  Purpose:  Private method used to fill slice portion of ntuple record.
00959   //
00960   //  Arguments: reference to TClonesArray of NtpSRSlice's and CandRecord ptr
00961   //  
00962   //  Return: status.
00963   // 
00964 
00965   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpSlice" << endl;
00966 
00967   const CandSliceListHandle *slicelisthandle 
00968    = dynamic_cast <const CandSliceListHandle*> 
00969      (cndrec -> FindCandHandle("CandSliceListHandle"));
00970   if ( !slicelisthandle ) return; // all done
00971 
00972   Int_t nslice = 0;
00973   TIter sliceItr(slicelisthandle->GetDaughterIterator());
00974   while ( CandSliceHandle* slice=dynamic_cast<CandSliceHandle*>(sliceItr())) {
00975     Int_t uid = slice->GetUidInt();
00976     
00977     fSliceUidMap.insert(std::make_pair(uid,nslice));
00978     // Uses new with placement to efficiently create slice ntp
00979     NtpSRSlice* ntpslice = new(ntpslicearray[nslice++])
00980                         NtpSRSlice(slice->GetNStrip());
00981     ntpslice->index  = nslice-1; // index is number of slices - 1
00982     ntpslice->ndigit = slice->GetNDigit();
00983     // Fill indices of associated strips in slice tree
00984     TIter slicestripItr(slice->GetDaughterIterator());
00985     Int_t nslicestrip = 0;
00986     while ( CandStripHandle *slicestrip = dynamic_cast<CandStripHandle*>
00987                                                       (slicestripItr())) {
00988       Int_t uid = slicestrip->GetUidInt();
00989       std::map<int,int>::iterator uidItr;
00990       uidItr = fStripUidMap.find(uid);
00991       if ( uidItr == fStripUidMap.end() ) {
00992         MSG("NtpSR",Msg::kError)
00993           << "Slice strip w/Uid " << uid
00994           << " does not match any in strip list."
00995           << "\n slc stp entry will not be properly filled." << endl;
00996       }
00997       else {
00998         Int_t stripindex = uidItr->second;
00999         ntpslice->AddStripAt(stripindex,nslicestrip); // add index to strip
01000       }
01001       nslicestrip++;
01002     }
01003 
01004     // Set summed charge in slice
01005     ntpslice->ph.raw = slice->GetCharge(CalDigitType::kNone);
01006     ntpslice->ph.siglin = slice->GetCharge(CalDigitType::kSigLin);
01007     ntpslice->ph.sigcor = slice->GetCharge(CalDigitType::kSigCorr);
01008     ntpslice->ph.pe = slice->GetCharge(CalDigitType::kPE);
01009 
01010     // Set range of planes included in slice
01011     ntpslice->plane.n   =slice->GetNPlane();
01012     ntpslice->plane.beg = slice->GetBegPlane();
01013     ntpslice->plane.end = slice->GetEndPlane();
01014     ntpslice->plane.nu   = slice->GetNPlane(PlaneView::kU);
01015     ntpslice->plane.begu = slice->GetBegPlane(PlaneView::kU);
01016     ntpslice->plane.endu = slice->GetEndPlane(PlaneView::kU);
01017     ntpslice->plane.nv   = slice->GetNPlane(PlaneView::kV);
01018     ntpslice->plane.begv = slice->GetBegPlane(PlaneView::kV);
01019     ntpslice->plane.endv = slice->GetEndPlane(PlaneView::kV);
01020    
01021     MSG("NtpSR",Msg::kDebug) << "CandSlice uid " << slice-> GetUidInt() 
01022                              << "\n" << (*ntpslice) << endl;
01023   }
01024 
01025   return;
01026 }

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

Definition at line 406 of file NtpSRModule.cxx.

References NtpSRStrip::demuxveto, digit(), CandRecord::FindCandHandle(), fStripUidMap, fUnassocStripUidMap, RawChannelId::GetCrate(), CandHandle::GetDaughterIterator(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RawChannelId::GetVmm(), NtpSRStrip::index, Msg::kDebug, StripEnd::kNegative, CalDigitType::kNone, CalDigitType::kPE, StripEnd::kPositive, CalDigitType::kSigCorr, CalDigitType::kSigLin, Msg::kVerbose, 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().

00407                                                          {
00408   //
00409   //  Purpose:  Private method used to fill strip portion of ntuple record.
00410   //
00411   //  Arguments: NtpSRRecord and CandRecord
00412   //  
00413   //  Return: status.
00414   // 
00415 
00416   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpStrip" << endl;
00417 
00418   const CandStripListHandle *striplisthandle 
00419    = dynamic_cast <const CandStripListHandle*> 
00420      (cndrec->FindCandHandle("CandStripListHandle"));
00421   if ( !striplisthandle ) return; // no strips => done
00422   
00423   const CandEventListHandle *eventlisthandle 
00424     = dynamic_cast <const CandEventListHandle*> 
00425     (cndrec -> FindCandHandle("CandEventListHandle"));
00426   
00427   Int_t nstrip = 0;
00428   TIter stripItr(striplisthandle->GetDaughterIterator());
00429   while ( CandStripHandle* strip=dynamic_cast<CandStripHandle*>(stripItr())) {
00430     Int_t uid = strip->GetUidInt();
00431     fStripUidMap.insert(std::make_pair(uid,nstrip));
00432 
00433     //look for unmatched strips:
00434     if (eventlisthandle) {
00435       Bool_t gotMatch = false;
00436       TIter eventItr(eventlisthandle->GetDaughterIterator());
00437       while(CandEventHandle* event = 
00438             dynamic_cast<CandEventHandle*> (eventItr())) {
00439         TIter eventstripItr(event->GetDaughterIterator());
00440         while(CandStripHandle *eventstrip = 
00441               dynamic_cast<CandStripHandle*>(eventstripItr())) {
00442           if(eventstrip->IsEquivalent(strip)) {
00443             gotMatch = true;
00444             break;
00445           }
00446         }
00447         if(gotMatch) break;
00448       }
00449       fUnassocStripUidMap.insert(std::make_pair(uid,!gotMatch));
00450     }
00451 
00452     // Uses new with placement to efficiently create strip ntp
00453     NtpSRStrip* ntpstrip = new((ntpstriparray)[nstrip++])NtpSRStrip();
00454     // Transport information from CandStrip to strip ntp
00455     ntpstrip->index = nstrip-1;
00456     ntpstrip->planeview = strip->GetPlaneView(); // plane view
00457     ntpstrip->ndigit = strip->GetNDigit();
00458     ntpstrip->demuxveto = strip->GetDemuxVetoFlag();
00459     ntpstrip->strip = strip->GetStrip(); // strip number
00460     ntpstrip->plane = strip->GetPlane(); // plane number
00461     ntpstrip->tpos = strip->GetTPos();  // tpos
00462     ntpstrip->z = strip->GetZPos();  // zpos
00463 
00464     // Raw channel id of first digit associated with each end
00465     bool negEndDone = false;
00466     bool posEndDone = false;
00467     TIter digitItr(strip -> GetDaughterIterator());
00468     while (CandDigitHandle* digit=dynamic_cast<CandDigitHandle*>(digitItr())) {
00469       const RawChannelId& rawch = digit->GetChannelId();
00470       Int_t pmtindex = rawch.GetCrate()*108 + rawch.GetVarcId()*36
00471                   +rawch.GetVmm()*6 + rawch.GetVaAdcSel()*3+rawch.GetVaChip();
00472       if ( !negEndDone && 
00473            digit -> GetPlexSEIdAltL().GetEnd()==StripEnd::kNegative) { 
00474         ntpstrip->SetPmtIndex(pmtindex,0); negEndDone = true;  
00475       }
00476       else if( !posEndDone && 
00477               digit -> GetPlexSEIdAltL().GetEnd()==StripEnd::kPositive) {
00478         ntpstrip->SetPmtIndex(pmtindex,1); posEndDone = true;
00479       }  
00480     }
00481 
00482     // Strip end dependent quantities
00483     for (UInt_t i = 0; i < 2; i++ ) {
00484       StripEnd::EStripEnd stripend = StripEnd::kNegative;
00485       if (i == 1) stripend = StripEnd::kPositive;
00486       if ( strip->GetNDigit(stripend) > 0 ) {
00487         NtpSRPulseHeight ph;
00488         ph.raw = strip->GetCharge(CalDigitType::kNone,stripend);
00489         ph.siglin = strip->GetCharge(CalDigitType::kSigLin,stripend);
00490         ph.sigcor = strip->GetCharge(CalDigitType::kSigCorr,stripend);
00491         ph.pe = strip->GetCharge(CalDigitType::kPE,stripend);
00492         ntpstrip->SetPh(ph,i); 
00493         ntpstrip->SetTime(strip->GetTime(stripend),i);
00494       }
00495     }
00496     MSG("NtpSR",Msg::kVerbose) << (*ntpstrip) << endl;
00497   } // done with all strips
00498 
00499  
00500   return;
00501 
00502 }

void NtpSRModule::FillNtpSubShowerSummary ( NtpSRShower ntpshw,
const CandShowerSRHandle shw,
const CandTrackListHandle tracklist 
) [private]

Definition at line 2446 of file NtpSRModule.cxx.

References NtpSRSubShowerSummary::compactU, NtpSRSubShowerSummary::compactV, CandRecoHandle::GetCandSlice(), CandSubShowerSRHandle::GetClusterID(), CandHandle::GetDaughterIterator(), CandSubShowerSRHandle::GetEnergy(), CandShowerSRHandle::GetLastSubShower(), CandRecoHandle::GetNStrip(), CandSubShowerSRHandle::GetPlaneView(), CandSubShowerSRHandle::GetProbEM(), CandShowerSRHandle::GetSubShower(), ClusterType::kEMLike, ClusterType::kTrkLike, PlaneView::kU, PlaneView::kV, Msg::kVerbose, MSG, NtpSRSubShowerSummary::nRecoTrkU, NtpSRSubShowerSummary::nRecoTrkV, NtpSRSubShowerSummary::nTrkLikeU, NtpSRSubShowerSummary::nTrkLikeV, NtpSRShower::nUcluster, NtpSRShower::nVcluster, NtpSRSubShowerSummary::phTrkLikeU, NtpSRSubShowerSummary::phTrkLikeV, NtpSRSubShowerSummary::probEMU, NtpSRSubShowerSummary::probEMV, NtpSRShower::sss, and NtpSRSubShowerSummary::Zero().

Referenced by FillNtpShower().

02449 {
02450   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpSubShowerSummary" << endl;
02451   
02452   Float_t totChargeU = 0, totChargeV = 0;
02453   ntpshower->sss.Zero();
02454   
02455   for (int i = 0; i<showerSR->GetLastSubShower()+1; i++) {
02456     const CandSubShowerSRHandle* showercluster=showerSR->GetSubShower(i);
02457     
02458     if(showercluster->GetPlaneView()==PlaneView::kU) {
02459       totChargeU += showercluster->GetEnergy();
02460       ntpshower->sss.compactU += TMath::Power(showercluster->GetEnergy(),2);
02461     }
02462     if(showercluster->GetPlaneView()==PlaneView::kV) {
02463       totChargeV += showercluster->GetEnergy();
02464       ntpshower->sss.compactV += TMath::Power(showercluster->GetEnergy(),2);
02465     }
02466 
02467     if(showercluster->GetClusterID()==ClusterType::kTrkLike &&
02468        showercluster->GetNStrip()>2) {
02469       if(showercluster->GetPlaneView()==PlaneView::kU) {
02470         ntpshower->sss.nTrkLikeU += showercluster->GetNStrip();
02471         ntpshower->sss.phTrkLikeU += showercluster->GetEnergy();        
02472       }
02473       else if(showercluster->GetPlaneView()==PlaneView::kV) {
02474         ntpshower->sss.nTrkLikeV += showercluster->GetNStrip();
02475         ntpshower->sss.phTrkLikeV += showercluster->GetEnergy();
02476       }
02477     }
02478     else if(showercluster->GetClusterID()==ClusterType::kEMLike) {
02479       if(showercluster->GetPlaneView()==PlaneView::kU) {
02480         ntpshower->sss.probEMU += ( showercluster->GetProbEM() * 
02481                                     showercluster->GetEnergy() );
02482       }
02483       else if(showercluster->GetPlaneView()==PlaneView::kV) {
02484         ntpshower->sss.probEMV += ( showercluster->GetProbEM() * 
02485                                     showercluster->GetEnergy() );
02486       }
02487     }
02488   }
02489 
02490   if(totChargeU>0) {
02491     ntpshower->sss.probEMU  /= totChargeU;
02492     if(ntpshower->nUcluster==1) ntpshower->sss.compactU = 1;
02493     else {
02494       ntpshower->sss.compactU /= (totChargeU*totChargeU*float(ntpshower->nUcluster));
02495       ntpshower->sss.compactU -= TMath::Power(1./float(ntpshower->nUcluster),2);
02496       if(ntpshower->sss.compactU>0) 
02497         ntpshower->sss.compactU = 2.*TMath::Sqrt(ntpshower->sss.compactU);
02498       else ntpshower->sss.compactU = 0;
02499     }
02500   }
02501   if(totChargeV>0) {
02502     ntpshower->sss.probEMV  /= totChargeV;
02503     if(ntpshower->nVcluster==1) ntpshower->sss.compactV = 1;
02504     else {
02505       ntpshower->sss.compactV /= (totChargeV*totChargeV*float(ntpshower->nVcluster));
02506       ntpshower->sss.compactV -= TMath::Power(1./float(ntpshower->nVcluster),2);
02507       if(ntpshower->sss.compactV>0) 
02508         ntpshower->sss.compactV = 2.*TMath::Sqrt(ntpshower->sss.compactV);
02509       else ntpshower->sss.compactV = 0;
02510     }
02511   }
02512 
02513   if(tracklist) {
02514     TIter trkItr(tracklist->GetDaughterIterator());
02515     for(int i=0;i<showerSR->GetLastSubShower()+1;i++) {
02516       const CandSubShowerSRHandle* showercluster = showerSR->GetSubShower(i);
02517       if(!(showercluster->GetClusterID()==ClusterType::kTrkLike && 
02518            showercluster->GetNStrip()>2)) continue;
02519       TIter clustpItr(showercluster->GetDaughterIterator());
02520       while(CandStripHandle *clustrip = 
02521             dynamic_cast<CandStripHandle*>(clustpItr())){
02522         Bool_t foundStrip = false;
02523         trkItr.Reset();
02524         while(CandTrackHandle *track = 
02525               dynamic_cast<CandTrackHandle*>(trkItr())){
02526           if(!track->GetCandSlice()->
02527              IsEquivalent(showerSR->GetCandSlice())) continue;
02528           TIter stpItr(track->GetDaughterIterator());
02529           while(CandStripHandle *strip = 
02530                 dynamic_cast<CandStripHandle*>(stpItr())){
02531             if(strip->IsEquivalent(clustrip)) {
02532               if(strip->GetPlaneView()==PlaneView::kU) 
02533                 ntpshower->sss.nRecoTrkU += 1;
02534               else if(strip->GetPlaneView()==PlaneView::kV)
02535                 ntpshower->sss.nRecoTrkV += 1;        
02536               foundStrip = true;
02537               break;
02538             }         
02539           }
02540           if(foundStrip) break;
02541         }
02542       }
02543     }
02544   }
02545 }

void NtpSRModule::FillNtpTimeStatus ( NtpSRTimeStatus ntptimestatus,
MomNavigator mom 
) [private]

Definition at line 2864 of file NtpSRModule.cxx.

References RawDigitDataBlock::At(), NtpSRTimeStatus::crate_t0_ns, RawDigit::GetCrateT0(), RawVtmTimeInfoBlock::GetLastRFClock(), RawVtmTimeInfoBlock::GetLastRFClockFromPrevTF(), VldTimeStamp::GetNanoSec(), RawVtmTimeInfoBlock::GetSpillTimeGPS(), RawVtmTimeInfoBlock::GetSpillTimeRF(), RawVtmTimeInfoBlock::GetTimeFrameNum(), Msg::kWarning, MAXMSG, NtpSRTimeStatus::rollover_53mhz, NtpSRTimeStatus::rollover_last_53mhz, NtpSRTimeStatus::sgate_10mhz, NtpSRTimeStatus::sgate_53mhz, and NtpSRTimeStatus::timeframe.

Referenced by Reco().

02865                                                        {
02866 
02867   // MC + Data overlay might mean more than one of these blocks
02868   // loop over them to find a valid crateT0
02869   std::vector<const RawDigitDataBlock*> rddbv = 
02870     DataUtil::GetRawBlocks<RawDigitDataBlock>(mom);
02871   for (size_t irddb=0; irddb < rddbv.size(); ++irddb ) {
02872     const RawDigitDataBlock* rddb = rddbv[irddb];
02873     if ( rddb != 0 ) {
02874       // Pull offset data from raw digit data block.
02875       const RawDigit* rawdigit = rddb->At(0);
02876       if ( rawdigit ) {
02877         ntptimestatus.crate_t0_ns =  rawdigit->GetCrateT0().GetNanoSec();
02878         // only need one ...
02879         break;
02880       } else {
02881         MAXMSG("NtpSR",Msg::kWarning,10)
02882           << "FillNtpTimeStatus saw RawDigitDataBlock with no digits "
02883           << irddb << " of " << rddbv.size() << std::endl;
02884       }
02885     }
02886   }
02887 
02888   const std::vector<const RawVtmTimeInfoBlock*> vtmBlocks = DataUtil::GetRawBlocks<RawVtmTimeInfoBlock>(mom);
02889   if( vtmBlocks.size()>0) {
02890        const RawVtmTimeInfoBlock* vtmb = vtmBlocks[0];
02891        // Pull ND info from VTM time info block.
02892        // We really only need this from one crate; but I'll let it pull from whichever it finds.
02893        ntptimestatus.sgate_10mhz         = vtmb->GetSpillTimeGPS();
02894        ntptimestatus.sgate_53mhz         = vtmb->GetSpillTimeRF();
02895        ntptimestatus.rollover_53mhz      = vtmb->GetLastRFClock();
02896        ntptimestatus.rollover_last_53mhz = vtmb->GetLastRFClockFromPrevTF();       
02897        ntptimestatus.timeframe           = vtmb->GetTimeFrameNum();
02898   }
02899 }

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

Definition at line 1633 of file NtpSRModule.cxx.

References NtpSRTrack::AddStripAt(), NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, NtpSRMomentum::best, NtpSRTrack::contained, NtpSRTrack::cputime, NtpSRTrack::cr, Calibrator::DecalStripToStrip(), Calibrator::DecalTime(), NtpSRTrack::ds, NtpSRPlane::end, NtpSRTrack::end, NtpSRPlane::endu, NtpSRPlane::endv, FillNtpTrackCosmicRay(), FillNtpTrackEnd(), FillNtpTrackFidAll(), FillNtpTrackFidEnd(), FillNtpTrackFidVtx(), FillNtpTrackFit(), FillNtpTrackLinearFit(), FillNtpTrackMomentum(), FillNtpTrackTime(), FillNtpTrackVertex(), CandRecord::FindCandHandle(), fSliceUidMap, fStripUidMap, fTrackUidMap, CandFitTrackSRHandle::GetBadFit(), CandTrackSRListHandle::GetCPUTime(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), CandFitTrackHandle::GetMomentumCurve(), CandFitTrackHandle::GetPass(), CandFitTrackHandle::GetPlaneChi2(), CandFitTrackSRHandle::GetPlanePreChi2(), CandFitTrackHandle::GetPlaneQP(), CandHandle::GetUidInt(), RecMinos::GetVldContext(), NtpSRStripPulseHeight::gev, NtpSRTrack::index, Calibrator::Instance(), kCos45, Msg::kDebug, Msg::kError, CalStripType::kGeV, CalStripType::kMIP, Detector::kNear, StripEnd::kNegative, CalStripType::kNone, CalDigitType::kNone, CalStripType::kPE, StripEnd::kPositive, CalStripType::kSigCorr, CalStripType::kSigLin, CalStripType::kSigMapped, PlaneView::kU, PlaneView::kV, Msg::kWarning, NtpSRStripPulseHeight::mip, NtpSRTrack::momentum, 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, NtpSRTrack::stpz, NtpSRVertex::x, and NtpSRVertex::y.

Referenced by Reco().

01634                                                          {
01635   //
01636   //  Purpose:  Private method used to fill track portion of ntuple record.
01637   //
01638   //  Arguments: TClonesArray of NtpSRTrack's and CandRecord ptr
01639   //  
01640   //  Return: none.
01641   // 
01642 
01643 
01644   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::FillNtpTrack" << endl;
01645 
01646   const CandTrackListHandle *tracklisthandle 
01647      = dynamic_cast <const CandTrackListHandle*> 
01648      (cndrec -> FindCandHandle("CandFitTrackListHandle"));
01649   if ( !tracklisthandle ) {
01650     tracklisthandle = dynamic_cast <const CandTrackListHandle*>
01651       (cndrec -> FindCandHandle("CandTrackListHandle"));
01652   }
01653   if ( !tracklisthandle ) return;
01654 
01655   CandTrackSRListHandle* tracksrlisthandle=dynamic_cast<CandTrackSRListHandle*>
01656                       (cndrec->FindCandHandle("CandTrackSRListHandle"));
01657 
01658   const VldContext& vld = *(cndrec->GetVldContext());
01659   
01660   TIter trackItr(tracklisthandle->GetDaughterIterator());
01661   Int_t ntrack = 0;
01662   while (CandTrackHandle* track = dynamic_cast<CandTrackHandle*>(trackItr())){
01663     if(track->GetNDaughters()==0 && 
01664        track->InheritsFrom("CandFitTrackHandle") &&  
01665        dynamic_cast<CandFitTrackHandle*>(track)->GetFinderTrack()){
01666       track = dynamic_cast<CandFitTrackHandle*>(track)->GetFinderTrack();
01667     }
01668     Int_t uid = track->GetUidInt();
01669     fTrackUidMap.insert(std::make_pair(uid,ntrack));
01670     // Uses new with placement to efficiently create event ntp
01671     NtpSRTrack* ntptrack 
01672              = new(ntptrackarray[ntrack++])NtpSRTrack(track->GetNStrip());
01673     ntptrack->index = ntrack-1;
01674 
01675     // index to associated slice in slice array
01676     const CandSliceHandle* trackslice = track -> GetCandSlice();
01677     if ( trackslice ) {
01678       std::map<int,int>::iterator uidItr;
01679       uidItr = fSliceUidMap.find(trackslice->GetUidInt());
01680       if ( uidItr == fSliceUidMap.end() ) {
01681         MSG("NtpSR",Msg::kError)
01682           << "Track slice w/Uid "
01683           << trackslice->GetUidInt()
01684           << " does not match any in slice list."
01685           << "\n trk slc will not be properly filled." << endl;
01686       }
01687       else {
01688         ntptrack->slc = uidItr->second;
01689       }
01690     }
01691     else {
01692       MSG("NtpSR",Msg::kWarning) << "No associated Slice found for track"
01693                                  << endl;
01694       ntptrack->slc = -1;
01695     }
01696 
01697     ntptrack->ndigit = track->GetNDigit();
01698     CandFitTrackSRHandle *fittracksr
01699                                 =dynamic_cast<CandFitTrackSRHandle*>(track);
01700     CandFitTrackHandle *fittrack
01701                                 =dynamic_cast<CandFitTrackHandle*>(track);
01702 
01703     // Set range of planes included in track
01704     NtpSRTrackPlane& plane = ntptrack->plane;
01705     plane.n = track->GetNPlane();
01706     plane.nu = track->GetNPlane(PlaneView::kU);
01707     plane.nv = track->GetNPlane(PlaneView::kV);
01708     plane.beg = track->GetBegPlane();
01709     plane.begu = track->GetBegPlane(PlaneView::kU);
01710     plane.begv = track->GetBegPlane(PlaneView::kV);
01711     plane.end = track->GetEndPlane();
01712     plane.endu = track->GetEndPlane(PlaneView::kU);
01713     plane.endv = track->GetEndPlane(PlaneView::kV);
01714     plane.ntrklike = track->GetNTrackPlane();
01715 
01716     // Set summed pulse height information for track
01717     NtpSRStripPulseHeight& ph = ntptrack->ph;
01718     ph.raw = track->GetCharge(CalStripType::kNone);
01719     ph.siglin = track->GetCharge(CalStripType::kSigLin);
01720     ph.sigcor = track->GetCharge(CalStripType::kSigCorr);
01721     ph.pe = track->GetCharge(CalStripType::kPE);
01722     ph.sigmap = track->GetCharge(CalStripType::kSigMapped);
01723     ph.mip = track->GetCharge(CalStripType::kMIP);
01724     ph.gev = track->GetCharge(CalStripType::kGeV);
01725     
01726     ntptrack->ds = track->GetdS(); // distance from vertex to end
01727     ntptrack->range = track->GetRange(); // g/cm**2 from vertex to end
01728     // CPU to create track list
01729     if (tracksrlisthandle) ntptrack->cputime = tracksrlisthandle->GetCPUTime();
01730 
01731     this->FillNtpTrackVertex(ntptrack,track);
01732     this->FillNtpTrackEnd(ntptrack,track);
01733     this->FillNtpTrackLinearFit(ntptrack,track);
01734 
01735     this->FillNtpTrackFidVtx(ntptrack,track,vld);
01736     this->FillNtpTrackFidEnd(ntptrack,track,vld);
01737     this->FillNtpTrackFidAll(ntptrack,track,vld);
01738 
01739     this->FillNtpTrackFit(ntptrack,track);
01740     this->FillNtpTrackMomentum(ntptrack,track);
01741     this->FillNtpTrackTime(ntptrack,track);
01742     ntptrack->contained = track->IsContained();
01743 
01744     // Leigh: In the MINOS+ era we have problems at the calorimeter / spectrometer
01745     // boundary for the ND. We should use curvature for these planes at all times.
01746     if(vld.GetDetector()==Detector::kNear){
01747       int endPlane = track->GetEndPlane();
01748       // Set containment as false for the back two calorimeter planes
01749       // Also set the best momentum to curvature
01750       if(endPlane == 119 || endPlane == 120){
01751         ntptrack->contained = false;
01752         if(fittrack){
01753           if(fittrack->GetPass()){
01754             ntptrack->momentum.best = fittrack->GetMomentumCurve();
01755           }
01756         }
01757       }
01758                         // We have also disabled tracking in the spectrometer coil hole region.
01759                         // Tracks are truncated once they reach r <= 0.6m, meaning that tracks
01760                         // now stopping in the range 0.6m to 0.8m in radius are likely to have
01761                         // been truncated by the fitter, and hence we should use curvature
01762                         // to measure the muon energy.
01763                         if(endPlane > 120){
01764                                 double endX = ntptrack->end.x;
01765                                 double endY = ntptrack->end.y;
01766                                 double endR = sqrt(endX*endX + endY*endY);
01767                                 if(endR < 0.8){
01768                                         ntptrack->contained = false;
01769                                         if(fittrack){
01770                 if(fittrack->GetPass()){
01771                 ntptrack->momentum.best = fittrack->GetMomentumCurve();
01772                 }
01773                 }
01774                                 }
01775                         } // End ND momentum modification
01776         
01777     }
01778 
01779 
01780     NtpSRCosmicRay& ntpcosmicray = ntptrack->cr;
01781     this->FillNtpTrackCosmicRay(ntpcosmicray,ntptrack,vld);
01782 
01783     // Loop over strips associated with track
01784     TIter trackstripItr(track->GetDaughterIterator());
01785     Int_t ntrackstrip = 0;
01786     // Fill indices of associated strips in track ntuple
01787     while ( CandStripHandle *trackstrip = dynamic_cast<CandStripHandle*>
01788                                                       (trackstripItr())) {
01789       Int_t uid = trackstrip->GetUidInt();
01790       std::map<int,int>::iterator uidItr;
01791       uidItr = fStripUidMap.find(uid);
01792       if ( uidItr == fStripUidMap.end() ) {
01793         MSG("NtpSR",Msg::kError)
01794           << "Track strip w/Uid " << uid
01795           << " does not match any in strip list."
01796           << "\n trk stp entry will not be properly filled." << endl;
01797       }
01798       else {
01799         Int_t stripindex = uidItr->second;
01800         ntptrack->AddStripAt(stripindex,ntrackstrip); // add index to strip
01801       }
01802 
01803       // Track positional information at plane associated with each strip
01804       Int_t iplane = trackstrip->GetPlane();
01805       ntptrack->stpu[ntrackstrip] = track->GetU(iplane);
01806       ntptrack->stpv[ntrackstrip] = track->GetV(iplane);
01807       ntptrack->stpx[ntrackstrip] = kCos45*(ntptrack->stpu[ntrackstrip]
01808                                           -ntptrack->stpv[ntrackstrip]);
01809       ntptrack->stpy[ntrackstrip] = kCos45*(ntptrack->stpu[ntrackstrip]
01810                                           +ntptrack->stpv[ntrackstrip]);
01811       ntptrack->stpz[ntrackstrip] = track->GetZ(iplane);
01812       // dS is travel distance from vertex
01813       ntptrack->stpds[ntrackstrip] = track->GetdS(iplane);
01814  
01815       // Fit track dependent quantities
01816 
01817       if ( fittrack ) {
01818         ntptrack->stpfitchi2[ntrackstrip] = fittrack->GetPlaneChi2(iplane);
01819         ntptrack->stpfitqp[ntrackstrip] = fittrack->GetPlaneQP(iplane);
01820       }
01821       else{
01822         ntptrack->stpfitchi2[ntrackstrip] = 0;
01823         ntptrack->stpfitqp[ntrackstrip] = 0;
01824       }
01825 
01826       if ( fittracksr ) {
01827          ntptrack->stpfitprechi2[ntrackstrip] 
01828                                        = fittracksr->GetPlanePreChi2(iplane);
01829         if ( fittracksr->GetBadFit(iplane) ) ntptrack->stpfit[ntrackstrip] = 0;
01830       }
01831       else{
01832         ntptrack->stpfitprechi2[ntrackstrip] =0;
01833         ntptrack->stpfit[ntrackstrip] = 0;
01834       }
01835 
01836       // Strip end dependent quantities
01837       for (UInt_t i = 0; i < 2; i++ ) {
01838         StripEnd::EStripEnd stripend = StripEnd::kNegative;
01839         if (i == 1) stripend = StripEnd::kPositive;
01840         if ( trackstrip->GetNDigit(stripend) > 0 ) {
01841           Float_t sigmap = track->GetStripCharge(trackstrip,
01842                                           CalStripType::kSigMapped,stripend);
01843           Float_t mip = track->GetStripCharge(trackstrip,
01844                                           CalStripType::kMIP,stripend);
01845           Float_t gev = track->GetStripCharge(trackstrip,
01846                                           CalStripType::kGeV,stripend);
01847           ntptrack->SetPh(sigmap,mip,gev,ntrackstrip,i); 
01848           ntptrack->SetTime(track->GetT(iplane,stripend),ntrackstrip,i);
01849 
01850           // New, NJT 07/04
01851           // Will now fill with default values if real ones don't exist.
01852           // Uses Calibrator configuration, not a custom thing.
01853           // Use DecalStripToStrip on input charge 1 to get muon C0
01854           double c0 = Calibrator::Instance().DecalStripToStrip(1.0,
01855                                  trackstrip->GetStripEndId(stripend));
01856           ntptrack->SetAttnC0(c0,ntrackstrip,i);
01857           // Use DecalTime on input time 0 to get time offset
01858           double t0 = Calibrator::Instance().DecalTime(0.0,
01859                  trackstrip->GetCharge(CalDigitType::kNone,stripend),
01860                  trackstrip->GetStripEndId(stripend));
01861           ntptrack->SetCalT0(t0,ntrackstrip,i);
01862         }
01863       } 
01864       ntrackstrip++;
01865     } // loop over all track strips
01866     
01867     MSG("NtpSR",Msg::kDebug) << (*ntptrack) << endl;
01868         
01869   }
01870 
01871   return;
01872 
01873 }

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

Definition at line 1948 of file NtpSRModule.cxx.

References NtpSRCosmicRay::azimuth, AstUtil::CalendarToJulian(), Munits::day, 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(), Munits::hour, NtpSRCosmicRay::juliandate, AstUtil::JulianToGAST(), Msg::kVerbose, AstUtil::LocalToHorizon(), NtpSRCosmicRay::locsiderialtime, month, MSG, NtpSRCosmicRay::ra, NtpSRCosmicRay::rahourangle, NtpSRTrack::vtx, Munits::year, and NtpSRCosmicRay::zenith.

Referenced by FillNtpTrack(), and Reco().

01950                                                                 {
01951   //
01952   //  Purpose:  Private method used to fill NtpSRTrack cr data member
01953   //            given a pointer to the ntuple track and a pointer to the
01954   //            associated CandTrackHandle.
01955   //
01956   //  Return: none.
01957   // 
01958 
01959 
01960   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackCosmicRay" << endl;
01961   if ( !ntptrack ) return;
01962 
01963   Detector::Detector_t dettype = vldc.GetDetector();
01964 
01965  // Reverse sign for pointing track back up to source
01966   Float_t dcosx = -(ntptrack->vtx.dcosx);
01967   Float_t dcosy = -(ntptrack->vtx.dcosy);
01968   Float_t dcosz = -(ntptrack->vtx.dcosz);
01969 
01970   Double_t altitude,azimuth;
01971   AstUtil::LocalToHorizon(dcosx,dcosy,dcosz,dettype,altitude,azimuth);
01972   // Zenith = 90 - altitude
01973   ntpcosmicray.zenith = 90. - altitude;
01974   ntpcosmicray.azimuth = azimuth;
01975 
01976   UInt_t dyear,dmonth,dday,dhour,dminute,dsec;
01977   vldc.GetTimeStamp().GetDate(kTRUE,0,&dyear,&dmonth,&dday);
01978   vldc.GetTimeStamp().GetTime(kTRUE,0,&dhour,&dminute,&dsec);
01979   
01980   int year    = dyear;
01981   int month   = dmonth;
01982   int day     = dday;
01983   double hour = dhour + (dminute + (dsec)/60.)/60.;
01984 
01985   AstUtil::CalendarToJulian(year,month,day,hour,ntpcosmicray.juliandate);
01986   double longitude = AstUtil::GetDetLongitude(dettype);
01987   double latitude = AstUtil::GetDetLatitude(dettype);
01988 
01989   double gast;  // in hours
01990   AstUtil::JulianToGAST(ntpcosmicray.juliandate,gast);
01991   double last;
01992   AstUtil::GSTToLST(gast,longitude,last);
01993   // sidereal time misspelled here for historical consistency
01994   ntpcosmicray.locsiderialtime = last; 
01995   double hourangle, declination;
01996   AstUtil::HorizonToEquatorial(altitude,azimuth,latitude,hourangle,
01997                                                          declination);
01998   ntpcosmicray.dec = declination;
01999   double ra;
02000   AstUtil::EquatorialToCelestial(hourangle,gast,longitude,ra);
02001   ntpcosmicray.ra = ra;
02002 
02003   ntpcosmicray.rahourangle = ntpcosmicray.ra*12./180.; // hours
02004 
02005   return;
02006 
02007 }

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

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

Referenced by FillNtpTrack().

02297                                                                 {
02298   //
02299   //  Purpose:  Private method used to fill end portion of ntuple track.
02300   //
02301   //  Arguments: NtpSRTrack to fill and const CandTrackHandle pointer.
02302   //  
02303   //  Return: status.
02304   // 
02305 
02306 
02307   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackEnd" << endl;
02308 
02309   NtpSRVertex& end = ntptrack->end;
02310 
02311   end.u = track->GetEndU();
02312   end.v = track->GetEndV();
02313   end.x = kCos45*(end.u-end.v);
02314   end.y = kCos45*(end.u+end.v);
02315   end.z = track->GetEndZ();
02316   end.t = track->GetEndT();
02317   end.plane = track->GetEndPlane();
02318   end.dcosu = track->GetEndDirCosU();
02319   end.dcosv = track->GetEndDirCosV();
02320   end.dcosx = kCos45*(end.dcosu-end.dcosv);
02321   end.dcosy = kCos45*(end.dcosu+end.dcosv);
02322   end.dcosz = track->GetEndDirCosZ();
02323   const CandFitTrackHandle* fittrack
02324                     =dynamic_cast<const CandFitTrackHandle*>(track);
02325   if ( fittrack ) {
02326     end.eu = fittrack->GetEndUError();
02327     end.ev = fittrack->GetEndVError();
02328     end.ex = kCos45*sqrt(end.eu*end.eu+end.ev*end.ev);
02329     end.ey = kCos45*sqrt(end.eu*end.eu+end.ev*end.ev);
02330     Double_t edudz = fittrack->GetEnddUError();
02331     Double_t edvdz = fittrack->GetEnddVError();
02332     // These calculations should include the dudz and dvdz covariance terms
02333     // but currently the covariance terms are not accessible
02334     end.edcosz = fabs(end.dcosz)*sqrt(pow(end.dcosu*edudz,2)+
02335                                       pow(end.dcosv*edvdz,2));
02336     
02337     end.edcosu = sqrt(fabs(end.dcosz))*sqrt(pow(end.dcosu*end.dcosv*edvdz,2)
02338                + pow((pow(end.dcosz,2)+pow(end.dcosv,2))*edudz,2));
02339     end.edcosv = sqrt(fabs(end.dcosz))*sqrt(pow(end.dcosu*end.dcosv*edudz,2)
02340                + pow((pow(end.dcosz,2)+pow(end.dcosu,2))*edvdz,2));
02341     end.edcosx = kCos45*sqrt(end.edcosu*end.edcosu+end.edcosv*end.edcosv);
02342     end.edcosy = kCos45*sqrt(end.edcosu*end.edcosu+end.edcosv*end.edcosv);
02343   }
02344 
02345   return;
02346 
02347 }

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

Definition at line 2194 of file NtpSRModule.cxx.

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

Referenced by FillNtpTrack().

02196                                                             {
02197   //
02198   //  Purpose:  Private method used to fill NtpSRTrack fidall data member
02199   //            given a pointer to the ntuple track, a pointer to the
02200   //            associated CandTrackHandle, and the vldcontext of the
02201   //            event.
02202   //
02203   //  Return: none.
02204   //
02205   //  Notes: This method should be called after FillNtpTrackFidAll
02206   //         and FillNtpFiducialEnd 
02207 
02208 
02209   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpFiducialAll" << endl;
02210 
02211   NtpSRFiducial& fidall = ntptrack->fidall;
02212 
02213   NtpSRFiducial fidtmp;
02214   NtpSRVertex vtxtmp;
02215   fidall.dr = min(ntptrack->fidvtx.dr,ntptrack->fidend.dr);
02216   fidall.dz = min(ntptrack->fidvtx.dz,ntptrack->fidend.dz);
02217   fidall.trace   = min(ntptrack->fidvtx.trace,ntptrack->fidend.trace);
02218   fidall.tracez  = min(ntptrack->fidvtx.tracez,ntptrack->fidend.tracez);
02219   fidall.nplane  = min(ntptrack->fidvtx.nplane,ntptrack->fidend.nplane);
02220 
02221   TIter trackstripItr(track->GetDaughterIterator());
02222   while(CandStripHandle* trackstrip = dynamic_cast<CandStripHandle*>
02223         (trackstripItr())) {
02224     // For all strips calculate closest approach to boundaries
02225     Int_t iplane = trackstrip->GetPlane();
02226     vtxtmp.plane = iplane;
02227     vtxtmp.u = track->GetU(iplane);
02228     vtxtmp.v = track->GetV(iplane);
02229     vtxtmp.x = kCos45*(vtxtmp.u-vtxtmp.v);
02230     vtxtmp.y = kCos45*(vtxtmp.u+vtxtmp.v);
02231     vtxtmp.z = track->GetZ(iplane);
02232     this->FillNtpFiducialDistance(fidtmp,vtxtmp,vld); // fills dr,dz
02233     fidall.dr = min(fidtmp.dr,fidall.dr);
02234     fidall.dz = min(fidtmp.dz,fidall.dz);
02235   }
02236 
02237   return;
02238 
02239 }

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

Definition at line 2168 of file NtpSRModule.cxx.

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

Referenced by FillNtpTrack().

02170                                                             {
02171   //
02172   //  Purpose:  Private method used to fill NtpSRTrack fidend data member
02173   //            given a pointer to the ntuple track, a pointer to the
02174   //            associated CandTrackHandle, and the vldcontext of the
02175   //            event.
02176   //
02177   //  Return: none.
02178   // 
02179 
02180 
02181   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackFidEnd" << endl;
02182 
02183   NtpSRFiducial& fid = ntptrack->fidend;
02184   NtpSRVertex& end = ntptrack->end;
02185   this->FillNtpFiducialDistance(fid,end,vld); // fills dr,dz
02186 
02187   fid.trace   = track->GetEndTrace();
02188   fid.tracez  = track->GetEndTraceZ();
02189   fid.nplane = track->GetEndnActiveDownstream();
02190   return;
02191 
02192 }

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

Definition at line 2143 of file NtpSRModule.cxx.

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

Referenced by FillNtpTrack().

02145                                                             {
02146   //
02147   //  Purpose:  Private method used to fill NtpSRTrack fidvtx data member
02148   //            given a pointer to the ntuple track, a pointer to the
02149   //            associated CandTrackHandle, and the vldcontext of the
02150   //            event.
02151   //
02152   //  Return: none.
02153   // 
02154 
02155 
02156   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackFidVtx" << endl;
02157 
02158   NtpSRFiducial& fid = ntptrack->fidvtx;
02159   NtpSRVertex& vtx = ntptrack->vtx;
02160   this->FillNtpFiducialDistance(fid,vtx,vld); // fills dr,dz
02161 
02162   fid.trace   = track->GetVtxTrace();
02163   fid.tracez  = track->GetVtxTraceZ();
02164   fid.nplane = track->GetVtxnActiveUpstream();
02165   return;
02166 }

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

Definition at line 2112 of file NtpSRModule.cxx.

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

Referenced by FillNtpTrack().

02113                                                                 {
02114   //
02115   //  Purpose:  Private method used to fill NtpSRTrack fit data member
02116   //            given a pointer to the ntuple track and a pointer to the
02117   //            associated CandTrackHandle.
02118   //
02119   //  Return: none.
02120   // 
02121 
02122 
02123   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackFit" << endl;
02124 
02125   NtpSRFitTrack& fit = ntptrack->fit;
02126 
02127   const CandFitTrackHandle* fittrack 
02128     = dynamic_cast<const CandFitTrackHandle*>(track);
02129   if ( fittrack ) {
02130     fit.chi2 = fittrack->GetChi2();
02131     fit.pass = fittrack->GetPass();
02132     fit.ndof      = fittrack->GetNDOF();
02133     fit.niterate  = fittrack->GetNIterate();
02134     fit.cputime   = fittrack->GetCPUTime();
02135     fit.nswimfail = fittrack->GetNSwimFail();
02136     fit.bave = fittrack->GetBave();
02137   }
02138 
02139   return;
02140 
02141 }

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

Definition at line 2349 of file NtpSRModule.cxx.

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

Referenced by FillNtpTrack().

02350                                                                       {
02351   //
02352   //  Purpose:  Private method used to fill linar fit track portion of 
02353   //            ntuple track.
02354   //
02355   //  Arguments: NtpSRTrack to fill and const CandTrackHandle pointer.
02356   //  
02357   //  Return: status.
02358   // 
02359 
02360 
02361   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackLinearFit" << endl;
02362 
02363   // First array dimension is view (u or v)
02364   // Second array dimension is plane number
02365   const Int_t nplane = 1000;
02366   Double_t uzfit[nplane]={0},vzfit[nplane]={0},ufit[nplane]={0};
02367   Double_t vfit[nplane]={0},uwfit[nplane]={0},vwfit[nplane]={0};
02368   Double_t uph[nplane]={0},vph[nplane]={0};
02369 
02370   // Loop over all strips on track
02371   TIter trackstripItr(track->GetDaughterIterator());
02372   while(CandStripHandle* trackstrip = dynamic_cast<CandStripHandle*>
02373         (trackstripItr())) {
02374 
02375     Float_t tpos = trackstrip->GetTPos();
02376     Float_t phend[2]  = {trackstrip->GetCharge(StripEnd::kNegative),
02377                          trackstrip->GetCharge(StripEnd::kPositive)};
02378     Float_t phsum   = phend[0] + phend[1];
02379 
02380     Int_t iplane = trackstrip->GetPlane();
02381     assert(iplane >= 0 && iplane < nplane);
02382 
02383     if ( trackstrip->GetPlaneView()==PlaneView::kU ) {
02384       uzfit[iplane] = trackstrip->GetZPos();
02385       ufit[iplane] += tpos*phsum; // pulse height weighted average of tpos
02386       uph[iplane]  += phsum;  // summed pulse height both ends 
02387       uwfit[iplane] = 1;   // weight assigned for use in fit
02388     }
02389     else if ( trackstrip->GetPlaneView()==PlaneView::kV ) {
02390       vzfit[iplane] = trackstrip->GetZPos();
02391       vfit[iplane] += tpos*phsum; // pulse height weighted average of tpos
02392       vph[iplane]  += phsum;  // summed pulse height both ends 
02393       vwfit[iplane] = 1;   // weight assigned for use in fit
02394     }
02395 
02396   }
02397 
02398   // Finished with loop over all strips, calculate fit results
02399   NtpSRVertex& lin = ntptrack->lin;
02400   lin.z = track->GetVtxZ();
02401   lin.t = track->GetVtxT();
02402   Int_t timesign = 1;
02403   if ( track->GetTimeSlope() < 0. ) timesign = -1;
02404  
02405   Int_t nhitplane[2] = {0};
02406   for ( Int_t ip = 0; ip < nplane; ip++ ) {
02407     if ( uph[ip] > 0 ) { nhitplane[0]++; ufit[ip] /= uph[ip]; }
02408     if ( vph[ip] > 0 ) { nhitplane[1]++; vfit[ip] /= vph[ip]; }
02409   }
02410 
02411   Double_t uparm[2]={0},ueparm[2]={0},vparm[2]={0},veparm[2]={0};
02412   if ( nhitplane[0] > 1 ) {
02413      LinearFit::Weighted(nplane,uzfit,ufit,uwfit,uparm,ueparm);
02414   }
02415   if ( nhitplane[1] > 1 ) {
02416     LinearFit::Weighted(nplane,vzfit,vfit,vwfit,vparm,veparm);
02417   }
02418 
02419   if ( nhitplane[0] > 1 || nhitplane[1] > 1 ) {
02420     // Need at least one of two views to make attempt at filling direction
02421     Double_t dvdz = vparm[1];
02422     lin.v = vparm[0]+lin.z*dvdz;
02423     Double_t dudz = uparm[1];
02424     lin.u = uparm[0]+lin.z*dudz;
02425     Double_t anorm = sqrt(1.+dudz*dudz+dvdz*dvdz);
02426     lin.dcosu = timesign*dudz/anorm;
02427     lin.dcosv = timesign*dvdz/anorm;
02428     lin.dcosz = timesign*1./anorm;
02429   }
02430 
02431   if ( nhitplane[0] > 1 && nhitplane[1] > 1 ) {
02432     // Need both u&z views fit to rotate to x,y
02433     Double_t dxdz = kCos45*(uparm[1]-vparm[1]);
02434     Double_t dydz = kCos45*(uparm[1]+vparm[1]);
02435     Double_t anorm = sqrt(1.+dxdz*dxdz+dydz*dydz);
02436     lin.dcosx = timesign*dxdz/anorm;
02437     lin.dcosy = timesign*dydz/anorm;
02438     lin.x = kCos45*(uparm[0]-vparm[0])+lin.z*dxdz; // Xv = Xint + dx/dz * Zv
02439     lin.y = kCos45*(uparm[0]+vparm[0])+lin.z*dydz;
02440   }
02441 
02442   return;
02443 
02444 }

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

Definition at line 1904 of file NtpSRModule.cxx.

References NtpSRMomentum::best, NtpSRMomentum::eqp, NtpSRMomentum::eqp_rangebiased, CandFitTrackHandle::GetEMCharge(), CandTrackHandle::GetMomentum(), CandFitTrackHandle::GetMomentumCurve(), CandFitTrackHandle::GetMomentumRange(), CandFitTrackCamHandle::GetRangeBiasedEQP(), CandFitTrackCamHandle::GetRangeBiasedQP(), CandFitTrackHandle::GetVtxQPError(), Msg::kVerbose, max, NtpSRTrack::momentum, MSG, NtpSRMomentum::qp, NtpSRMomentum::qp_rangebiased, and NtpSRMomentum::range.

Referenced by FillNtpTrack().

01905                                                                      {
01906   //
01907   //  Purpose:  Private method used to fill NtpSRTrack momentum data member
01908   //            given a pointer to the ntuple track and a pointer to the
01909   //            associated CandTrackHandle.
01910   //
01911   //  Return: none.
01912   // 
01913 
01914 
01915   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackMomentum" << endl;
01916   const CandFitTrackHandle *fittrack
01917     =dynamic_cast<const CandFitTrackHandle*>(track);
01918 
01919   NtpSRMomentum& momentum = ntptrack->momentum;
01920   if ( fittrack ) {
01921     // Guard against divide by 0
01922     momentum.range = fittrack->GetMomentumRange();
01923     momentum.best =  fittrack->GetMomentum();
01924     Double_t pcurve = max(fittrack->GetMomentumCurve(),0.001);
01925     //if ( ntptrack->fit.pass ) momentum.qp = fittrack->GetEMCharge()/pcurve;
01926     momentum.qp = fittrack->GetEMCharge()/pcurve;
01927     momentum.qp_rangebiased = 0;
01928     momentum.eqp_rangebiased = 0;
01929 
01930     const CandFitTrackCamHandle *fittrackcam
01931       =dynamic_cast<const CandFitTrackCamHandle*>(track);
01932 
01933     if(fittrackcam){
01934       momentum.qp_rangebiased = fittrackcam->GetRangeBiasedQP();
01935       momentum.eqp_rangebiased = fittrackcam->GetRangeBiasedEQP();
01936     }
01937     momentum.eqp = fittrack->GetVtxQPError();
01938   }
01939   else{
01940     momentum.range = track->GetMomentum();
01941     momentum.best =  track->GetMomentum();
01942   }
01943 
01944   return;
01945 
01946 }

void NtpSRModule::FillNtpTrackProjectionToShield ( NtpSRShieldSummary ntpshieldsummary,
const NtpSRTrack ntptrack,
const CandShieldSR cssh 
) [private]

Definition at line 763 of file NtpSRModule.cxx.

References NtpSRShieldSummary::dcos, NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, NtpSRShieldSummary::exphits, CandShieldSR::GetCandShieldInter_X(), CandShieldSR::GetCandShieldInter_Y(), CandShieldSR::GetCandShieldInter_Z(), CandShieldSR::HitsInShield(), NtpSRShieldSummary::ishit, CandShieldSR::IsVetoHit(), Msg::kVerbose, MSG, NtpSRShieldSummary::projx, NtpSRShieldSummary::projy, NtpSRShieldSummary::projz, NtpSRVertex::u, NtpSRVertex::v, NtpSRTrack::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillNtpShield().

00764                                                                                      {
00765   //
00766   //  Purpose:  Private method used to fill projection of track intercept
00767   //            with shield portion of shield summary ntuple.
00768   //
00769   //  Arguments: Reference to NtpSRShieldSummary and ptr to primary track
00770   //  
00771   //  Return: none.
00772   // 
00773   //  Notes: Should be called before ntp veto shield strips and
00774   //         post-filling of ntp tracks
00775   //         If multiple tracks, projection is calculated using first of
00776   //         tracks.
00777 
00778   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackProjectionToShield" 
00779                              << endl;
00780 
00781   if ( ! ntptrack ) return;  // no track to project
00782  
00783   const NtpSRVertex& vtx = ntptrack->vtx;
00784  
00785   ntpshieldsummary.ishit  = 0;
00786   if(cssh.IsVetoHit() == true){
00787     ntpshieldsummary.ishit = 1;   
00788   }
00789    ntpshieldsummary.projx=cssh.GetCandShieldInter_X();
00790    ntpshieldsummary.projy=cssh.GetCandShieldInter_Y();
00791    ntpshieldsummary.projz=cssh.GetCandShieldInter_Z();
00792 
00793    ntpshieldsummary.exphits=cssh.HitsInShield();
00794 
00795    Float_t xzproj[2] = {-999.,-999.};
00796    Int_t ishit=0;
00797    if ( vtx.dcosy != 0. ) {
00798     xzproj[0] = vtx.x + vtx.dcosx/vtx.dcosy*(4.37-vtx.y);
00799     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosy*(4.37-vtx.y);
00800     if (fabs(xzproj[0])<2.03 && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00801       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00802       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {
00803         ntpshieldsummary.dcos = vtx.dcosy;
00804       }
00805     }
00806     xzproj[0] = vtx.x + vtx.dcosx/vtx.dcosy*(3.06-vtx.y);
00807     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosy*(3.06-vtx.y);
00808     if (fabs(xzproj[0])>3.34 && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00809       if (fabs(xzproj[0])<6.05&&xzproj[1]>0.0&&xzproj[1]<30.) 
00810         ishit = 1;
00811       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {       
00812         ntpshieldsummary.dcos = vtx.dcosy;
00813       }
00814     }
00815   }
00816   if (vtx.dcosu!=0.) {
00817     xzproj[0] = vtx.v + vtx.dcosv/vtx.dcosu*(4.45-vtx.u);
00818     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosu*(4.45-vtx.u);
00819     if (xzproj[0]>-.22624&&xzproj[0]<1.5554 
00820     && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00821       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00822       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {
00823         ntpshieldsummary.dcos = vtx.dcosu;
00824       }
00825     }
00826   }
00827   if (vtx.dcosv!=0.) {
00828     xzproj[0] = vtx.u +vtx.dcosu/vtx.dcosv*(4.45-vtx.v);
00829     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosv*(4.45-vtx.v);
00830     if (xzproj[0]>-.22624&&xzproj[0]<1.5554 
00831     && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00832       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00833       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {       
00834         ntpshieldsummary.dcos = vtx.dcosv;
00835       }
00836     }
00837   }
00838   if (vtx.dcosx!=0.) {
00839     xzproj[0] = vtx.y + vtx.dcosy/vtx.dcosx*(6.7-vtx.x);
00840     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosx*(6.7-vtx.x);
00841     if (xzproj[0]>1.20&&xzproj[0]<4.64 && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00842       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00843       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {
00844         ntpshieldsummary.dcos = vtx.dcosx;
00845       }
00846     }
00847     xzproj[0] = vtx.y + vtx.dcosy/vtx.dcosx*(-6.7-vtx.x);
00848     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosx*(-6.7-vtx.x);
00849     if (xzproj[0]>1.20&&xzproj[0]<4.64 && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00850       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00851       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {       
00852         ntpshieldsummary.dcos = vtx.dcosx;
00853       }
00854     }
00855     xzproj[0] = vtx.y + vtx.dcosy/vtx.dcosx*(4.3-vtx.x);
00856     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosx*(4.3-vtx.x);
00857     if (xzproj[0]>-1.5&&xzproj[0]<0.5 && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00858       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00859       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {       
00860         ntpshieldsummary.dcos = vtx.dcosx;
00861       }
00862     }
00863     xzproj[0] = vtx.y + vtx.dcosy/vtx.dcosx*(-4.3-vtx.x);
00864     xzproj[1] = vtx.z + vtx.dcosz/vtx.dcosx*(-4.3-vtx.x);
00865     if (xzproj[0]>-1.5&&xzproj[0]<0.5 && (xzproj[1]-vtx.z)*vtx.dcosz<0.) {
00866       if (xzproj[1]>0.0&&xzproj[1]<30.) ishit = 1;
00867       if ((xzproj[1]>0.0&&xzproj[1]<30.) || !ishit) {       
00868         ntpshieldsummary.dcos = vtx.dcosx;
00869       }
00870     }
00871   }
00872 
00873   return;
00874 
00875 }

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

Definition at line 2009 of file NtpSRModule.cxx.

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

Referenced by FillNtpTrack().

02010                                                                  {
02011   //
02012   //  Purpose:  Private method used to fill NtpSRTrack time data member
02013   //            given a pointer to the ntuple track and a pointer to the
02014   //            associated CandTrackHandle.
02015   //
02016   //  Return: none.
02017   // 
02018 
02019 
02020   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackTime" << endl;
02021 
02022   NtpSRTrackTime& time = ntptrack->time;
02023 
02024   time.ndigit = track->GetNTimeFitDigit();
02025   time.chi2   = track->GetTimeFitChi2();
02026 
02027   time.cdtds = fabs(track->GetTimeSlope())*3.e8;
02028   time.dtds = track->GetTimeSlope();
02029   time.t0   = track->GetTimeOffset();
02030 
02031   time.forwardRMS = track->GetTimeForwardFitRMS();
02032   time.forwardNDOF = track->GetTimeForwardFitNDOF();
02033   time.backwardRMS = track->GetTimeBackwardFitRMS();
02034   time.backwardNDOF = track->GetTimeBackwardFitNDOF();
02035   
02036   Double_t totuph[2] = {0}, totvph[2] = {0};
02037   Int_t    ndutimespace[1000] = {0}, ndvtimespace[1000] = {0};
02038   Double_t dutimespace[1000]  = {0}, dvtimespace[1000] = {0};
02039 
02040   TIter trackstripItr(track->GetDaughterIterator());
02041   while (CandStripHandle* trackstrip = dynamic_cast<CandStripHandle*>
02042                                                    (trackstripItr())) {
02043     Int_t iplane = trackstrip -> GetPlane();
02044     assert(iplane >= 0 && iplane < 1000);
02045     Double_t ph0 = trackstrip -> GetCharge(StripEnd::kNegative);
02046     Double_t ph1 = trackstrip -> GetCharge(StripEnd::kPositive);
02047     Double_t t0  = track->GetT(iplane,StripEnd::kNegative);
02048     Double_t t1  = track->GetT(iplane,StripEnd::kPositive);
02049 
02050     if ( trackstrip -> GetPlaneView() == PlaneView::kU ) {
02051       if ( trackstrip -> GetNDigit(StripEnd::kNegative) > 0 ) {
02052         totuph[0] += ph0;
02053         time.u0   += ph0*t0;
02054       }
02055       if ( trackstrip -> GetNDigit(StripEnd::kPositive) > 0 ) {
02056         totuph[1] += ph1;
02057         time.u1   += ph1*t1;
02058       }
02059       if ( trackstrip->GetNDigit(StripEnd::kNegative) > 0 && 
02060            trackstrip->GetNDigit(StripEnd::kPositive) > 0 ) {
02061         Double_t dapos = .5*(t0-t1)*PropagationVelocity::VelocityPosErr();
02062         if (!ndutimespace[iplane] || fabs(dapos)<fabs(dutimespace[iplane])) {
02063           dutimespace[iplane] = dapos;
02064           ndutimespace[iplane] = 1;
02065         }
02066       }
02067     }
02068 
02069     if ( trackstrip -> GetPlaneView() == PlaneView::kV ) {
02070       if ( trackstrip -> GetNDigit(StripEnd::kNegative) > 0 ) {
02071         totvph[0] += ph0;
02072         time.v0   += ph0*t0;
02073       }
02074       if ( trackstrip -> GetNDigit(StripEnd::kPositive) > 0 ) {
02075         totvph[1] += ph1;
02076         time.v1   += ph1*t1;
02077       }
02078       if ( trackstrip -> GetNDigit(StripEnd::kNegative) > 0 &&
02079            trackstrip -> GetNDigit(StripEnd::kPositive) > 0 ) {
02080         Double_t dapos = .5*(t0-t1)*PropagationVelocity::VelocityPosErr();
02081         if (!ndvtimespace[iplane] || fabs(dapos) < fabs(dvtimespace[iplane])) {
02082           dvtimespace[iplane] = dapos;
02083           ndvtimespace[iplane] = 1;
02084         }
02085       }
02086     }
02087   }
02088 
02089   Int_t ndu = 0;
02090   Int_t ndv = 0;
02091   for (int ip = 0; ip < 1000; ip++ ) {
02092     if ( ndutimespace[ip] > 0 ) {
02093       ndu++;
02094       time.du += dutimespace[ip];
02095     }
02096     if ( ndvtimespace[ip] > 0 ) {
02097       ndv++;
02098       time.dv += dvtimespace[ip];
02099     }
02100   }
02101   if ( totuph[0] > 0. ) time.u0 /= totuph[0];
02102   if ( totvph[0] > 0. ) time.v0 /= totvph[0];
02103   if ( totuph[1] > 0. ) time.u1 /= totuph[1];
02104   if ( totvph[1] > 0. ) time.v1 /= totvph[1];
02105   if ( ndu ) time.du /= (Double_t)ndu;
02106   if ( ndv ) time.dv /= (Double_t)ndv;
02107 
02108   return;
02109 
02110 }

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

Definition at line 2241 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::kVerbose, MSG, NtpSRVertex::plane, NtpSRVertex::t, NtpSRVertex::u, NtpSRVertex::v, NtpSRTrack::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillNtpTrack().

02242                                                                    {
02243   //
02244   //  Purpose:  Private method used to fill vertex portion of ntuple track.
02245   //
02246   //  Arguments: NtpSRTrack to fill and const CandTrackHandle pointer.
02247   //  
02248   //  Return: status.
02249   // 
02250 
02251 
02252   MSG("NtpSR",Msg::kVerbose) << "NtpSRModule::FillNtpTrackVertex" << endl;
02253 
02254   NtpSRVertex& vtx = ntptrack->vtx;
02255 
02256   vtx.u = track->GetVtxU();
02257   vtx.v = track->GetVtxV();
02258   vtx.x = kCos45*(vtx.u-vtx.v);
02259   vtx.y = kCos45*(vtx.u+vtx.v);
02260   vtx.z = track->GetVtxZ();
02261   vtx.t = track->GetVtxT();
02262   vtx.plane = track->GetVtxPlane();
02263   vtx.dcosu = track->GetDirCosU();
02264   vtx.dcosv = track->GetDirCosV();
02265   vtx.dcosx = kCos45*(vtx.dcosu-vtx.dcosv);
02266   vtx.dcosy = kCos45*(vtx.dcosu+vtx.dcosv);
02267   vtx.dcosz = track->GetDirCosZ();
02268 
02269   const CandFitTrackHandle* fittrack
02270                         = dynamic_cast<const CandFitTrackHandle*>(track);
02271   if ( fittrack ) {
02272     vtx.eu = fittrack->GetVtxUError();
02273     vtx.ev = fittrack->GetVtxVError();
02274     vtx.ex = kCos45*sqrt(vtx.eu*vtx.eu+vtx.ev*vtx.ev);
02275     vtx.ey = kCos45*sqrt(vtx.eu*vtx.eu+vtx.ev*vtx.ev);
02276     Double_t edudz = fittrack->GetVtxdUError();
02277     Double_t edvdz = fittrack->GetVtxdVError();
02278     // These calculations should include the dudz and dvdz covariance terms
02279     // but currently the covariance terms are not accessible
02280     vtx.edcosz = fabs(vtx.dcosz)*sqrt(pow(vtx.dcosu*edudz,2)+
02281                                       pow(vtx.dcosv*edvdz,2));
02282     vtx.edcosu = sqrt(fabs(vtx.dcosz))*sqrt(pow(vtx.dcosu*vtx.dcosv*edvdz,2)
02283                           + pow((pow(vtx.dcosz,2)+pow(vtx.dcosv,2))*edudz,2));
02284     vtx.edcosv = sqrt(fabs(vtx.dcosz))*sqrt(pow(vtx.dcosu*vtx.dcosv*edudz,2)
02285                           + pow((pow(vtx.dcosz,2)+pow(vtx.dcosu,2))*edvdz,2));
02286 
02287 
02288     vtx.edcosx = kCos45*sqrt(vtx.edcosu*vtx.edcosu+vtx.edcosv*vtx.edcosv);
02289     vtx.edcosy = kCos45*sqrt(vtx.edcosu*vtx.edcosu+vtx.edcosv*vtx.edcosv);
02290   }
02291 
02292   return;
02293 
02294 }

void NtpSRModule::FillNtpWindow ( NtpSREvent ntpevent,
const CandRecord cndrec 
) [private]

Definition at line 2684 of file NtpSRModule.cxx.

References NtpSRWindow::begplane, NtpSRWindow::begtime, NtpSREvent::end, NtpSRWindow::endplane, NtpSRWindow::endtime, CandRecord::FindCandHandle(), FIRST_FULL_PINST_STRIP_U, FIRST_ND_SPECTROMETER_PLANE, FIRST_PINST_STRIP_V, fUnassocStripUidMap, fWindowPlaneExtn, fWindowTimeExtn, CandHandle::GetDaughterIterator(), VldContext::GetDetector(), RecMinos::GetVldContext(), Detector::kNear, PlaneCoverage::kNearFull, CalDigitType::kSigCorr, PlaneView::kU, PlaneView::kV, LAST_FULL_PINST_STRIP_U, LAST_PINST_STRIP_V, NtpSRWindow::pinstQ, NtpSRVertex::plane, NtpSRWindow::specQ, NtpSRVertex::t, NtpSRWindow::totalQ, NtpSRWindow::upinstQ, NtpSRWindow::uspecQ, NtpSRWindow::utotalQ, NtpSREvent::vtx, NtpSREvent::win, and win.

Referenced by FillNtpEvent().

02685                                                           {
02686 
02687   const VldContext& vld = *(cndrec->GetVldContext());
02688   Bool_t isND = false;
02689   if(vld.GetDetector()==Detector::kNear) isND = true;
02690 
02691   ntpevent->win.begplane = ntpevent->vtx.plane - fWindowPlaneExtn;
02692   ntpevent->win.endplane = ntpevent->end.plane + fWindowPlaneExtn;
02693   ntpevent->win.begtime = ntpevent->vtx.t - fWindowTimeExtn;
02694   ntpevent->win.endtime = ntpevent->end.t + fWindowTimeExtn;
02695 
02696   ntpevent->win.totalQ = 0;
02697   ntpevent->win.specQ = 0;
02698   ntpevent->win.pinstQ = 0;
02699   ntpevent->win.utotalQ = 0;
02700   ntpevent->win.uspecQ = 0;
02701   ntpevent->win.upinstQ = 0;
02702 
02703   const CandStripListHandle *striplisthandle 
02704     = dynamic_cast <const CandStripListHandle*> 
02705     (cndrec->FindCandHandle("CandStripListHandle"));
02706   if(!striplisthandle) return;  
02707 
02708   TIter stripItr(striplisthandle->GetDaughterIterator());
02709   while ( CandStripHandle* strip=dynamic_cast<CandStripHandle*>(stripItr())) {
02710     Int_t uid = strip->GetUidInt();
02711     Int_t cur_plane = strip->GetPlane();
02712     Double_t cur_time = strip->GetTime();
02713     //if strip is within window:
02714     if(cur_plane>=ntpevent->win.begplane &&
02715        cur_plane<=ntpevent->win.endplane &&
02716        cur_time>=ntpevent->win.begtime &&
02717        cur_time<=ntpevent->win.endtime){
02718       Int_t cur_strip = strip->GetStrip();
02719       Float_t cur_charge = strip->GetCharge(CalDigitType::kSigCorr);
02720       Bool_t isSpec = false;
02721       Bool_t isPInst = false;
02722       if(isND){
02723         if(cur_plane>FIRST_ND_SPECTROMETER_PLANE) isSpec = true;      
02724         if(strip->GetPlaneView()==PlaneView::kU) {        
02725           PlexPlaneId ppid(Detector::kNear,strip->GetPlane(),kFALSE);
02726           if(ppid.GetPlaneCoverage()==PlaneCoverage::kNearFull){
02727             if(cur_strip>=FIRST_FULL_PINST_STRIP_U &&
02728                cur_strip<=LAST_FULL_PINST_STRIP_U) isPInst = true;
02729           }
02730           else isPInst = true; // it's a partial plane
02731         }
02732         else if(strip->GetPlaneView()==PlaneView::kV) {
02733           //V planes have same strip counting for full/partial
02734           if(cur_strip>=FIRST_PINST_STRIP_V &&
02735              cur_strip<=LAST_PINST_STRIP_V) isPInst = true;
02736         }
02737       }
02738       //add charge:
02739       ntpevent->win.totalQ += cur_charge;
02740       if(isND) {
02741         if(isSpec) ntpevent->win.specQ += cur_charge;
02742         else if(isPInst) ntpevent->win.pinstQ += cur_charge;
02743       }
02744       //is strip unmatched:
02745       std::map<int,bool>::iterator uidItr = fUnassocStripUidMap.find(uid);
02746       if ( uidItr != fUnassocStripUidMap.end() ) {
02747         if(uidItr->second){
02748           //add charge:
02749           ntpevent->win.utotalQ += cur_charge;
02750           if(isND) {
02751             if(isSpec) ntpevent->win.uspecQ += cur_charge;
02752             else if(isPInst) ntpevent->win.upinstQ += cur_charge;
02753           }
02754         }
02755       }
02756     }
02757   }
02758 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 186 of file NtpSRModule.cxx.

References NtpSRRecord::calstatus, NtpStRecord::calstatus, NtpSRRecord::crhdr, NtpStRecord::crhdr, NtpSRRecord::dataquality, NtpStRecord::dataquality, NtpSRRecord::deadchips, NtpStRecord::deadchips, NtpSRRecord::detstatus, NtpStRecord::detstatus, NtpSRRecord::dmxstatus, NtpStRecord::dmxstatus, NtpSRRecord::evthdr, NtpStRecord::evthdr, fBleachFiller, fCandRecordName, fClusterUidMap, fEventUidMap, FillNtpCalStatus(), FillNtpCluster(), FillNtpDataQuality(), FillNtpDetStatus(), FillNtpDmxStatus(), FillNtpEvent(), FillNtpEventSummary(), FillNtpShield(), FillNtpShower(), FillNtpSlice(), FillNtpStrip(), FillNtpTimeStatus(), FillNtpTrack(), FillNtpTrackCosmicRay(), fRecordName, fRecordTitle, fShowerUidMap, fSimSnarlRecordName, fSliceUidMap, fStripUidMap, fTrackUidMap, fUnassocStripUidMap, fUseStandard, DataUtil::GetCandHeader(), VldContext::GetDetector(), RawDaqSnarlHeader::GetErrorCode(), RecDataHeader::GetErrorCode(), CandHeader::GetEvent(), MomNavigator::GetFragment(), RecMinos::GetJobHistory(), RecRecordImp< T >::GetJobHistory(), 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::kDebug, Detector::kFar, RecJobHistory::kNtpSR, JobCResult::kPassed, Msg::kWarning, MSG, NtpSREventSummary::ntrack, CalScheme::Reset(), JobCResult::SetFailed(), JobCResult::SetWarning(), NtpStRecord::timestatus, NtpSRRecord::vetoexp, NtpStRecord::vetoexp, NtpSRRecord::vetohdr, NtpStRecord::vetohdr, NtpSRRecord::vetostp, and NtpStRecord::vetostp.

00186                                               {
00187   //
00188   //  Purpose:  Create and fill ntuple record.
00189   //
00190   //  Arguments: mom.
00191   //  
00192   //  Return: status.
00193   // 
00194 
00195   JobCResult result(JobCResult::kPassed);  
00196   MSG("NtpSR",Msg::kDebug) << "NtpSRModule::Reco" << endl;
00197 
00198   // Reset maps used to associate uid of reconstructed object with array index
00199   fStripUidMap.clear();
00200   fSliceUidMap.clear();
00201   fClusterUidMap.clear();
00202   fShowerUidMap.clear();
00203   fTrackUidMap.clear();
00204   fEventUidMap.clear();
00205   fUnassocStripUidMap.clear();
00206   if ( fBleachFiller ) delete fBleachFiller; fBleachFiller = NULL;
00207 
00208   // Check that mom exists.
00209   assert(mom);
00210 
00211   // CandRecord will be extracted by name to match record name of NtpSRRecord
00212   const CandRecord* cndrec = dynamic_cast<const CandRecord*>
00213           (mom->GetFragment("CandRecord",fCandRecordName.c_str()));
00214   const SimSnarlRecord* simrec = dynamic_cast<const SimSnarlRecord*>
00215           (mom->GetFragment("SimSnarlRecord",fSimSnarlRecordName.c_str()));
00216   const RawRecord* rawrec = dynamic_cast<const RawRecord*>
00217           (mom->GetFragment("RawRecord","","DaqSnarl"));
00218 
00219   if (!cndrec && !simrec ) {
00220     MSG("NtpSR",Msg::kWarning) 
00221       << "No CandRecord of name " << fRecordName 
00222       << " or SimSnarlRecord in Mom" << endl;
00223     result.SetWarning().SetFailed();
00224     return result;
00225   }
00226  
00227   TClonesArray* ntpstparrptr = 0;
00228   TClonesArray* ntpexparrptr = 0;
00229   TClonesArray* ntpslcarrptr = 0;
00230   TClonesArray* ntpcluarrptr = 0;
00231   TClonesArray* ntpshwarrptr = 0;
00232   TClonesArray* ntptrkarrptr = 0;
00233   TClonesArray* ntpevtarrptr = 0;
00234   TClonesArray* ntpvetostparrptr = 0;
00235   TClonesArray* ntpdeadchipsptr = 0;
00236   NtpSREventSummary* ntpeventsummaryptr = 0;
00237   NtpSRShieldSummary* ntpshieldsummaryptr = 0;
00238   NtpSRCosmicRay* ntpcosmicrayptr = 0;
00239   NtpSRDmxStatus* ntpdmxstatusptr = 0;
00240   NtpSRDetStatus* ntpdetstatusptr = 0;
00241   NtpSRTimeStatus* ntptimestatusptr = 0;
00242   NtpSRCalStatus* ntpcalstatusptr = 0;
00243   NtpSRDataQuality* ntpdataqualityptr = 0;
00244   
00245   NtpSRRecord* ntpsrrec = 0;
00246   NtpStRecord* ntpstrec = 0;
00247   const VldContext* ntpvldcptr = 0;
00248   if ( fUseStandard ) {
00249     
00250     ntpstrec = dynamic_cast<NtpStRecord*>(mom->GetFragment("NtpStRecord",
00251                                           fRecordName.c_str()));
00252     if ( !ntpstrec ) {
00253       MSG("NtpSR",Msg::kWarning) 
00254         << "No NtpStRecord in Mom of name " << fRecordName.c_str() 
00255         << "\nMust call NtpStModule::Get first." << endl;
00256       result.SetWarning().SetFailed();
00257       return result;
00258     }
00259     if ( !cndrec ) return result; // Test for triggerless snarl
00260     ntpstparrptr = ntpstrec -> stp;
00261     ntpslcarrptr = ntpstrec -> slc;
00262     ntpcluarrptr = ntpstrec -> clu;
00263     ntpshwarrptr = ntpstrec -> shw;
00264     ntptrkarrptr = ntpstrec -> trk;
00265     ntpevtarrptr = ntpstrec -> evt;
00266     ntpvetostparrptr = ntpstrec->vetostp;
00267     ntpexparrptr = ntpstrec->vetoexp;
00268     ntpdeadchipsptr = ntpstrec->deadchips;
00269     ntpeventsummaryptr = &(ntpstrec->evthdr);
00270     ntpshieldsummaryptr = &(ntpstrec->vetohdr);
00271     ntpcosmicrayptr = &(ntpstrec->crhdr);
00272     ntpdmxstatusptr = &(ntpstrec->dmxstatus);
00273     ntpdetstatusptr = &(ntpstrec->detstatus);
00274     ntptimestatusptr = &(ntpstrec->timestatus);
00275     ntpcalstatusptr = &(ntpstrec->calstatus);
00276     ntpdataqualityptr = &(ntpstrec->dataquality);
00277     ntpvldcptr = ntpstrec->GetVldContext();
00278   }
00279   else {
00280     if ( !cndrec ) {
00281       // Use SimSnarlRecord header - presumably a triggerless mc event
00282       const SimSnarlHeader* simhdr = simrec->GetSimSnarlHeader();
00283 
00284       RecCandHeader ntphdr(simhdr->GetVldContext(),simhdr->GetRun(),
00285            simhdr->GetSubRun(),simhdr->GetRunType(),simhdr->GetErrorCode(),
00286            simhdr->GetSnarl(),simhdr->GetTrigSrc(),
00287            simhdr->GetTimeFrame(),simhdr->GetRemoteSpillType(),-1);
00288       ntpsrrec = new NtpSRRecord(ntphdr);
00289       ntpsrrec -> SetName(fRecordName.c_str());
00290       ntpsrrec -> SetTitle(fRecordTitle.c_str());
00291 
00292       RecJobHistory& jobhist 
00293         = const_cast<RecJobHistory&>(ntpsrrec->GetJobHistory());
00294       jobhist.Append(simrec->GetJobHistory());
00295       jobhist.CreateJobRecord(RecJobHistory::kNtpSR);
00296 
00297       mom -> AdoptFragment(ntpsrrec); // pass record to mom to own
00298       return result; // a triggerless event
00299     }
00300 
00301     // Extract header from CandRecord and use this to create RecCandHeader
00302     // and NtpSRRecord.
00303     const CandHeader* cndhdr = cndrec -> GetCandHeader();
00304     if (!rawrec) {
00305       MSG("NtpSR",Msg::kWarning) << "No DaqSnarl RawRecord in Mom"
00306          <<"\nShield data will not be filled and header will be incomplete." 
00307          << endl;
00308       result.SetWarning();
00309     }
00310     if (rawrec) {  
00311       const RawDaqSnarlHeader* rawhdr = dynamic_cast<const RawDaqSnarlHeader*>
00312                                         (rawrec -> GetRawHeader());
00313       RecCandHeader ntphdr(rawhdr->GetVldContext(),rawhdr->GetRun(),
00314            rawhdr->GetSubRun(),rawhdr->GetRunType(),rawhdr->GetErrorCode(),
00315            rawhdr->GetSnarl(),rawhdr->GetTrigSrc(),rawhdr->GetTimeFrameNum(),
00316            rawhdr->GetRemoteSpillType(),cndhdr->GetEvent());
00317       ntpsrrec = new NtpSRRecord(ntphdr);
00318     }
00319     else {
00320       // This dependency is terrible, but is because CandRecord never made
00321       // the transition to new base class and CandHeader is incomplete
00322       RecCandHeader ntphdr(cndhdr->GetVldContext(),cndhdr->GetRun(),
00323              -1,-1,0,cndhdr->GetSnarl(),0,-1,-1,cndhdr->GetEvent());
00324       ntpsrrec = new NtpSRRecord(ntphdr);
00325     }
00326     ntpsrrec -> SetName(fRecordName.c_str());
00327     ntpsrrec -> SetTitle(fRecordTitle.c_str());
00328 
00329     RecJobHistory& jobhist 
00330                    = const_cast<RecJobHistory&>(ntpsrrec->GetJobHistory());
00331     jobhist.Append(cndrec->GetJobHistory());
00332     jobhist.CreateJobRecord(RecJobHistory::kNtpSR);
00333     
00334     ntpstparrptr = ntpsrrec -> stp;
00335     ntpslcarrptr = ntpsrrec -> slc;
00336     ntpcluarrptr = ntpsrrec -> clu;
00337     ntpshwarrptr = ntpsrrec -> shw;
00338     ntptrkarrptr = ntpsrrec -> trk;
00339     ntpevtarrptr = ntpsrrec -> evt;
00340     ntpdeadchipsptr = ntpsrrec->deadchips;
00341     ntpvetostparrptr = ntpsrrec->vetostp;
00342     ntpexparrptr = ntpsrrec->vetoexp;
00343     ntpeventsummaryptr = &(ntpsrrec->evthdr);
00344     ntpshieldsummaryptr = &(ntpsrrec->vetohdr);
00345     ntpcosmicrayptr = &(ntpsrrec->crhdr);
00346     ntpdmxstatusptr = &(ntpsrrec->dmxstatus);
00347     ntpdetstatusptr = &(ntpsrrec->detstatus);
00348     ntpcalstatusptr = &(ntpsrrec->calstatus);
00349     ntpdataqualityptr = &(ntpsrrec->dataquality);
00350     ntpvldcptr = ntpsrrec->GetVldContext();
00351   }
00352   
00353   TClonesArray& ntpstriparray = *(ntpstparrptr);
00354   TClonesArray& ntpslicearray = *(ntpslcarrptr);
00355   TClonesArray& ntpshieldexpected = *(ntpexparrptr);
00356   TClonesArray& ntpclusterarray = *(ntpcluarrptr);
00357   TClonesArray& ntpshowerarray = *(ntpshwarrptr);
00358   TClonesArray& ntptrackarray = *(ntptrkarrptr);
00359   TClonesArray& ntpeventarray = *(ntpevtarrptr);
00360   TClonesArray& ntpdeadchips = *(ntpdeadchipsptr);
00361   NtpSREventSummary& ntpeventsummary = *(ntpeventsummaryptr);
00362   NtpSRShieldSummary& ntpshieldsummary = *(ntpshieldsummaryptr);
00363   NtpSRCosmicRay& ntpcosmicray = *(ntpcosmicrayptr);
00364   NtpSRDmxStatus& ntpdmxstatus = *(ntpdmxstatusptr);
00365   NtpSRDetStatus& ntpdetstatus = *(ntpdetstatusptr);
00366   NtpSRTimeStatus& ntptimestatus = *(ntptimestatusptr);
00367   NtpSRCalStatus& ntpcalstatus = *(ntpcalstatusptr);
00368   NtpSRDataQuality& ntpdataquality = *(ntpdataqualityptr);
00369   const VldContext& vldc = *(ntpvldcptr);
00370   
00371   // Calibrator is used by FillNtpTrack
00372   Calibrator::Instance().Reset(vldc);
00373   
00374   this -> FillNtpStrip(ntpstriparray,cndrec);
00375   this -> FillNtpSlice(ntpslicearray,cndrec);
00376   this -> FillNtpCluster(ntpclusterarray,cndrec);
00377   this -> FillNtpShower(ntpshowerarray,cndrec);
00378   this -> FillNtpTrack(ntptrackarray,cndrec);
00379   this -> FillNtpEvent(ntpeventarray,cndrec,rawrec);
00380 
00381   this -> FillNtpDmxStatus(ntpdmxstatus,cndrec);
00382   this -> FillNtpDetStatus(ntpdetstatus,vldc);
00383   this -> FillNtpTimeStatus(ntptimestatus,mom);
00384   this -> FillNtpCalStatus(ntpcalstatus,vldc);
00385   this -> FillNtpDataQuality(ntpdataquality,ntpdeadchips,cndrec);
00386   this -> FillNtpEventSummary(ntpeventsummary,cndrec,rawrec);
00387   
00388   const NtpSRTrack* ntptrack = 0;
00389   if(ntpeventsummary.ntrack > 0) ntptrack 
00390                      = dynamic_cast<NtpSRTrack*>(ntptrackarray.At(0));
00391   if ( ntptrack ) this->FillNtpTrackCosmicRay(ntpcosmicray,ntptrack,vldc);
00392 
00393   Detector::Detector_t dettype = vldc.GetDetector();
00394   if ( rawrec && dettype == Detector::kFar ) { 
00395     TClonesArray& ntpshieldstriparray = *(ntpvetostparrptr);
00396     this->FillNtpShield(ntpshieldstriparray,ntpshieldexpected,ntpshieldsummary,ntptrack,rawrec);
00397   }
00398 
00399   // pass record to mom to own
00400   if ( !fUseStandard ) mom -> AdoptFragment(ntpsrrec);  
00401 
00402   return result;
00403 
00404 }


Member Data Documentation

Definition at line 155 of file NtpSRModule.h.

Referenced by FillNtpBleach(), Reco(), and ~NtpSRModule().

std::string NtpSRModule::fCandRecordName [private]

Definition at line 145 of file NtpSRModule.h.

Referenced by Config(), and Reco().

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

Definition at line 138 of file NtpSRModule.h.

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

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

Definition at line 141 of file NtpSRModule.h.

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

Int_t NtpSRModule::fHvSinglesTask [private]

Definition at line 149 of file NtpSRModule.h.

Referenced by Config(), and FillNtpDetStatus().

Double_t NtpSRModule::fPostTrigger [private]

Definition at line 143 of file NtpSRModule.h.

Referenced by Config(), and FillNtpShieldStrip().

Double_t NtpSRModule::fPreTrigger [private]

Definition at line 142 of file NtpSRModule.h.

Referenced by Config(), and FillNtpShieldStrip().

std::string NtpSRModule::fRecordName [private]

Definition at line 147 of file NtpSRModule.h.

Referenced by Config(), and Reco().

std::string NtpSRModule::fRecordTitle [private]

Definition at line 148 of file NtpSRModule.h.

Referenced by Config(), and Reco().

Definition at line 151 of file NtpSRModule.h.

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

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

Definition at line 139 of file NtpSRModule.h.

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

std::string NtpSRModule::fSimSnarlRecordName [private]

Definition at line 146 of file NtpSRModule.h.

Referenced by Config(), and Reco().

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

Definition at line 140 of file NtpSRModule.h.

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

std::map<int,bool> NtpSRModule::fUnassocStripUidMap [private]

Definition at line 154 of file NtpSRModule.h.

Referenced by FillNtpStrip(), FillNtpWindow(), and Reco().

bool NtpSRModule::fUseStandard [private]

Definition at line 150 of file NtpSRModule.h.

Referenced by Config(), and Reco().

Definition at line 152 of file NtpSRModule.h.

Referenced by Config(), and FillNtpWindow().

Double_t NtpSRModule::fWindowTimeExtn [private]

Definition at line 153 of file NtpSRModule.h.

Referenced by Config(), and FillNtpWindow().

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

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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1