DSTUtil::ToF Namespace Reference


Functions

int BarToArray (int bar)
int ArrayToBar (int array)
void GetDiscHitMap (const MIPPEventSummary *evt, map< int, int > &hitMap)
int AdjacentHit (const MIPPEventSummary *evt, int pmtid)
bool GetCleanTracks (const MIPPEventSummary *evt, std::vector< int > &trklist)
bool GetCleanTracks (const MIPPEventSummary *evt, std::map< int, bool > &trktofmap)
bool GetCleanTracks (const MIPPEventSummary *evt, const MIPPVertexSummary *vtx, std::vector< int > &trklist)
bool GetCleanTracks (const MIPPEventSummary *evt, const MIPPVertexSummary *vtx, std::map< int, bool > &trktofmap)
void GetXTalkOffset (const MIPPToFSummary *tof, const MIPPEventSummary *evt, double &OffsetTop, double &ResTop, double &OffsetBot, double &ResBot)
void CorrectedLL (const MIPPToFSummary *itof, const MIPPEventSummary *evt, double topoff, double, double botoff, double, double &tmeas, double *CorrLL)
void GetDiscHitMap (const MIPPEventSummary *evt, std::map< int, int > &hitmap)


Function Documentation

int DSTUtil::ToF::BarToArray ( int  bar  ) 

Definition at line 1119 of file DSTUtil.cxx.

References TOFUtil::BarToArray().

Referenced by AdjacentHit(), TOFCalib2::Ana(), Ana(), TOFTempCorrector::Apply(), fcn(), GetData(), TOFTempCorrector::GraphAna(), InitParams(), main(), TOFTempCorrector::PreAna(), PreAna(), and ProcEvent().

01120 {
01121   return TOFUtil::BarToArray(bar);
01122 }

int DSTUtil::ToF::ArrayToBar ( int  array  ) 

Definition at line 1126 of file DSTUtil.cxx.

References TOFUtil::ArrayToBar().

Referenced by Book(), DoGlobalFits(), FillAdjHitTable(), FillDistHists(), FillHistos(), GetData(), GetSeedOffset(), GetSeedSlew(), GetSeedSOL(), GetSeedTempCoeffs(), LoadTOFAdjHitTable(), main(), MakeEvtHistos(), MakeGlobalPlots(), MakeResolPlots(), SaveConsts(), and SetBranches().

01127 {
01128   return TOFUtil::ArrayToBar(array);
01129 }

void DSTUtil::ToF::GetDiscHitMap ( const MIPPEventSummary evt,
map< int, int > &  hitMap 
)

Definition at line 1134 of file DSTUtil.cxx.

References CMapTOF::BartoDisc(), cmap, MIPPEventSummary::GetToFPMT(), MIPPToFPMTSummary::id, CMapTOF::Init(), CMapTOF::Instance(), MIPPEventSummary::NToFPMT(), and MIPPEventSummary::run.

Referenced by GetXTalkOffset(), and main().

01136 {
01137   hitMap.clear();
01138 
01139   int id, id2, crate, crate2, slot, slot2, chan, chan2;
01140   int ihist;
01141 
01142   CMapTOF& cmap = CMapTOF::Instance();
01143   cmap.Init((unsigned int)evt->run);
01144 
01145   for (int ipmt=0; ipmt < evt->NToFPMT(); ++ipmt) {
01146     id = evt->GetToFPMT(ipmt)->id;
01147     cmap.BartoDisc(id,crate,slot,chan);
01148     
01149     // determine surround hit pattern for this channel
01150     ihist = 0;
01151     for (int ipmt2=0; ipmt2 < evt->NToFPMT(); ++ipmt2) {
01152       id2 = evt->GetToFPMT(ipmt2)->id;
01153       if (id == id2) continue;
01154       cmap.BartoDisc(id2,crate2,slot2,chan2);
01155       if (crate == crate2 && slot == slot2) {
01156     if (chan2 == chan+2)  ihist |= 1;
01157     if (chan2 == chan+1)  ihist |= 2;
01158     if (chan2 == chan-1)  ihist |= 4;
01159     if (chan2 == chan-2)  ihist |= 8;
01160       }
01161     }
01162     hitMap[id] = ihist;
01163   }
01164 }

int DSTUtil::ToF::AdjacentHit ( const MIPPEventSummary evt,
int  pmtid 
)

Definition at line 1171 of file DSTUtil.cxx.

References BarToArray(), MIPPEventSummary::GetToFPMT(), ibar, npmt, and MIPPEventSummary::NToFPMT().

Referenced by TOFCalib2::Ana(), Ana(), GetCleanTracks(), TOFTempCorrector::GraphAna(), main(), and TOFTempCorrector::PreAna().

01171                                                                   {
01172 
01173   int npmt = evt->NToFPMT();
01174   int ibar = DSTUtil::ToF::BarToArray(pmtid % 1000);
01175 
01176   int nhit = 0;
01177 
01178   for (int ipmt=0; ipmt< npmt; ++ipmt)  // loop over pmts
01179   {
01180     MIPPToFPMTSummary* pmt;
01181     pmt = evt->GetToFPMT(ipmt);
01182     int jbar = DSTUtil::ToF::BarToArray(pmt->id % 1000);
01183 
01184     if (ibar > 0 && ibar < 53) {
01185       if (jbar == ibar-1) ++nhit;
01186       if (jbar == ibar+1) ++nhit;
01187     }
01188     if (ibar == 0)
01189       if (jbar == 1) ++nhit;
01190     if (ibar == 53)
01191       if (jbar == 52) ++nhit;
01192   }
01193   
01194   return nhit;
01195 
01196 }

bool DSTUtil::ToF::GetCleanTracks ( const MIPPEventSummary evt,
std::vector< int > &  trklist 
)

Definition at line 1200 of file DSTUtil.cxx.

References AdjacentHit(), MIPPEventSummary::GetToF(), MIPPEventSummary::GetToFPMT(), MIPPToFPMTSummary::id, MIPPEventSummary::NToF(), and MIPPEventSummary::NToFPMT().

Referenced by NuMIudst::Fill(), NuMIPID::Fill(), main(), ProcEvent(), and ProcPrevEvent().

01202 {
01203 
01204   trklist.clear();
01205 
01206   if (! evt->NToFPMT() || ! evt->NToF()) return false;
01207 
01208   std::map<int,MIPPToFPMTSummary*> pmtlist;
01209   int id;
01210 
01211   //  cout << "there are " << evt->NToFPMT() << " ToF PMT summaries" << endl;
01212   for (int ipmt=0; ipmt < evt->NToFPMT(); ++ipmt) {
01213     id = evt->GetToFPMT(ipmt)->id;
01214     pmtlist[id] = evt->GetToFPMT(ipmt);
01215   }
01216 
01217   //  cout << "there are " << evt->NToF() << " ToF summaries" << endl;
01218   for (int itof=0; itof<evt->NToF(); ++itof) {
01219     MIPPToFSummary* tof = evt->GetToF(itof);
01220     if (! pmtlist[tof->tpmt]) continue;
01221     if (! pmtlist[tof->bpmt]) continue;
01222 
01223     if (pmtlist[tof->tpmt]->ntrk > 1 || 
01224     pmtlist[tof->bpmt]->ntrk > 1) continue;
01225     
01226     if (DSTUtil::ToF::AdjacentHit(evt,tof->tpmt) ||
01227     DSTUtil::ToF::AdjacentHit(evt,tof->bpmt)) continue;
01228 
01229     trklist.push_back(tof->itrk);
01230   }
01231 
01232   if (trklist.empty()) return false;
01233 
01234   return true;
01235 }

bool DSTUtil::ToF::GetCleanTracks ( const MIPPEventSummary evt,
std::map< int, bool > &  trktofmap 
)

Definition at line 1239 of file DSTUtil.cxx.

References AdjacentHit(), MIPPEventSummary::GetToF(), MIPPEventSummary::GetToFPMT(), MIPPToFPMTSummary::id, MIPPEventSummary::NToF(), and MIPPEventSummary::NToFPMT().

01241 {
01242 
01243   trktofmap.clear();
01244 
01245   if (! evt->NToFPMT() || ! evt->NToF()) return false;
01246 
01247   std::map<int,MIPPToFPMTSummary*> pmtlist;
01248   
01249   for (int ipmt=0; ipmt < evt->NToFPMT(); ++ipmt) {
01250     pmtlist[evt->GetToFPMT(ipmt)->id] = evt->GetToFPMT(ipmt);
01251   }
01252 
01253   for (int itof=0; itof<evt->NToF(); ++itof) {
01254     MIPPToFSummary* tof = evt->GetToF(itof);
01255     if (! pmtlist[tof->tpmt]) continue;
01256     if (! pmtlist[tof->bpmt]) continue;
01257 
01258     if (pmtlist[tof->tpmt]->ntrk > 1 || 
01259     pmtlist[tof->bpmt]->ntrk > 1) continue;
01260     
01261     if (DSTUtil::ToF::AdjacentHit(evt,tof->tpmt) ||
01262     DSTUtil::ToF::AdjacentHit(evt,tof->bpmt)) continue;
01263 
01264     trktofmap[tof->itrk]= true;
01265   }
01266 
01267   return true;
01268 }

bool DSTUtil::ToF::GetCleanTracks ( const MIPPEventSummary evt,
const MIPPVertexSummary vtx,
std::vector< int > &  trklist 
)

Definition at line 1272 of file DSTUtil.cxx.

References AdjacentHit(), MIPPEventSummary::GetToF(), MIPPEventSummary::GetToFPMT(), MIPPToFPMTSummary::id, MIPPEventSummary::NToF(), MIPPEventSummary::NToFPMT(), MIPPVertexSummary::ntrk, and MIPPVertexSummary::trkindex.

01275 {
01276 
01277   trklist.clear();
01278 
01279   if (! evt->NToFPMT() || ! evt->NToF()) return false;
01280 
01281   std::map<int,MIPPToFPMTSummary*> pmtlist;
01282   
01283   for (int ipmt=0; ipmt < evt->NToFPMT(); ++ipmt)
01284     pmtlist[evt->GetToFPMT(ipmt)->id] = evt->GetToFPMT(ipmt);
01285   
01286   for (int itof=0; itof<evt->NToF(); ++itof) {
01287     MIPPToFSummary* tof = evt->GetToF(itof);
01288     if (! pmtlist[tof->tpmt]) continue;
01289     if (! pmtlist[tof->bpmt]) continue;
01290     
01291     if (pmtlist[tof->tpmt]->ntrk > 1 || 
01292     pmtlist[tof->bpmt]->ntrk > 1) continue;
01293 
01294     if (DSTUtil::ToF::AdjacentHit(evt,tof->tpmt) ||
01295     DSTUtil::ToF::AdjacentHit(evt,tof->bpmt)) continue;
01296     
01297     int ioff = vtx->trkindex;
01298 
01299     for (int itrk=0; itrk < vtx->ntrk; ++itrk)
01300       if (ioff+itrk == tof->itrk) {
01301     trklist.push_back(tof->itrk);
01302     break;
01303       }
01304     
01305   }
01306 
01307   if (trklist.empty()) return false;
01308 
01309   return true;
01310 }

bool DSTUtil::ToF::GetCleanTracks ( const MIPPEventSummary evt,
const MIPPVertexSummary vtx,
std::map< int, bool > &  trktofmap 
)

Definition at line 1314 of file DSTUtil.cxx.

References AdjacentHit(), MIPPEventSummary::GetToF(), MIPPEventSummary::GetToFPMT(), MIPPToFPMTSummary::id, MIPPEventSummary::NToF(), MIPPEventSummary::NToFPMT(), MIPPVertexSummary::ntrk, and MIPPVertexSummary::trkindex.

01317 {
01318 
01319   trktofmap.clear();
01320 
01321   if (! evt->NToFPMT() || ! evt->NToF()) return false;
01322 
01323   std::map<int,MIPPToFPMTSummary*> pmtlist;
01324   
01325   for (int ipmt=0; ipmt < evt->NToFPMT(); ++ipmt)
01326     pmtlist[evt->GetToFPMT(ipmt)->id] = evt->GetToFPMT(ipmt);
01327   
01328   for (int itof=0; itof<evt->NToF(); ++itof) {
01329     MIPPToFSummary* tof = evt->GetToF(itof);
01330     if (! pmtlist[tof->tpmt]) continue;
01331     if (! pmtlist[tof->bpmt]) continue;
01332     
01333     if (pmtlist[tof->tpmt]->ntrk > 1 || 
01334     pmtlist[tof->bpmt]->ntrk > 1) continue;
01335 
01336     if (DSTUtil::ToF::AdjacentHit(evt,tof->tpmt) ||
01337     DSTUtil::ToF::AdjacentHit(evt,tof->bpmt)) continue;
01338     
01339     int ioff = vtx->trkindex;
01340 
01341     for (int itrk=0; itrk < vtx->ntrk; ++itrk)
01342       if (ioff+itrk == tof->itrk) {
01343     trktofmap[tof->itrk]=true;
01344     break;
01345       }
01346     
01347   }
01348 
01349   return true;
01350 }

void DSTUtil::ToF::GetXTalkOffset ( const MIPPToFSummary tof,
const MIPPEventSummary evt,
double &  OffsetTop,
double &  ResTop,
double &  OffsetBot,
double &  ResBot 
)

Definition at line 1354 of file DSTUtil.cxx.

References adjhit, MIPPToFSummary::bpmt, GetDiscHitMap(), TOFAdjHit::Init(), TOFAdjHit::Instance(), TOFAdjHit::Offset(), TOFAdjHit::Res(), and MIPPToFSummary::tpmt.

01358 {
01359   int chanidTop = tof->tpmt;
01360   int chanidBot = tof->bpmt;
01361   map<int,int> hitMap;
01362   DSTUtil::ToF::GetDiscHitMap(evt,hitMap);
01363   int hitsTop = hitMap[chanidTop];
01364   int hitsBot = hitMap[chanidBot];
01365   TOFAdjHit& adjhit = TOFAdjHit::Instance();
01366   adjhit.Init((unsigned int)14500);
01367   OffsetTop = adjhit.Offset(chanidTop,hitsTop);
01368   ResTop = adjhit.Res(chanidTop,hitsTop);
01369   OffsetBot = adjhit.Offset(chanidBot,hitsBot);
01370   ResBot = adjhit.Res(chanidBot,hitsBot);
01371 }

void DSTUtil::ToF::CorrectedLL ( const MIPPToFSummary itof,
const MIPPEventSummary evt,
double  topoff,
double  topres,
double  botoff,
double  botres,
double &  tmeas,
double *  CorrLL 
)

Definition at line 1375 of file DSTUtil.cxx.

References TOFBarResol::BotRes(), MIPPToFSummary::bpmt, MIPPToFSummary::exptof, TOFBarResol::Init(), TOFBarResol::Instance(), PIDDef::kNPID, offset, MIPPToFSummary::res, MIPPEventSummary::run, MIPPToFSummary::tbot, MIPPToFSummary::tmeas, TOFBarResol::TopRes(), MIPPToFSummary::tpmt, and MIPPToFSummary::ttop.

01380 {
01381   if(itof->ttop < 0 && itof->tbot < 0) {
01382     tmeas = -1e+9;
01383     for(int i=0; i<PIDDef::kNPID; ++i){
01384       CorrLL[i] = -1e+9;
01385     }
01386   }
01387   else{
01388     TOFBarResol& barRes = TOFBarResol::Instance();
01389 
01390     barRes.Init(evt->run);
01391 
01392     double offset = 0;
01393 
01394     double sumw = 0;
01395 
01396     double topresx = barRes.TopRes(itof->tpmt);
01397     double botresx = barRes.BotRes(itof->bpmt);
01398 
01399     if(itof->ttop > 0 ) {
01400       offset += topoff/topresx;
01401       sumw += 1./topresx;
01402     }
01403     if(itof->tbot > 0 ) {
01404       offset += botoff/botresx;
01405       sumw += 1./botresx;
01406     }
01407 
01408     offset = offset/sumw;
01409 
01410     double tmeasured = itof->tmeas + offset;
01411 
01412     for(int j=0; j<PIDDef::kNPID; ++j){
01413       double LL = (tmeasured - itof->exptof[j])/itof->res;
01414       LL *= -0.5*LL;
01415       LL -=log(2*TMath::Pi()*itof->res);
01416       CorrLL[j] = LL;
01417 
01418     }
01419 
01420     tmeas = tmeasured;
01421   }
01422 
01423 }

void DSTUtil::ToF::GetDiscHitMap ( const MIPPEventSummary evt,
std::map< int, int > &  hitmap 
)


Generated on Mon Nov 23 08:05:25 2009 for MIPP(E907) by  doxygen 1.4.7