XTalkFilter Class Reference

#include <XTalkFilter.h>

Inheritance diagram for XTalkFilter:
JobCModule

List of all members.

Public Member Functions

 XTalkFilter ()
 ~XTalkFilter ()
JobCResult Reco (MomNavigator *mom)
void EndJob ()
void BeginJob ()
void Config (const Registry &)
const RegistryDefaultConfig () const
void Initialize ()
PMTGetPMT (std::vector< PMT > &v, int id, int create=1)
int GetHops (PMT *pmt, Pixel *startPixel)
int GetHops (PMT *pmt, std::vector< int > &pixels, int pixelID, Pixel *startPixel, std::vector< int > visited)
void DoTrueFilter (NtpStRecord *record, int ievt)

Static Public Attributes

static int printit = -1

Private Member Functions

Int_t CalculatePMTmuxID (PlexPixelSpotId &ppsid)
void GetPixelMaps ()
void SaveAdjustment (std::vector< PMT > &pmts, int side, NtpStRecord *record)
void CleanXTalk (std::vector< PMT > &pmts, NtpStRecord *record)
std::vector< std::pair< int,
int > > 
GetXTalkPixelsFar (int pixel)
std::vector< std::pair< int,
int > > 
GetXTalkPixelsNear (int pixel)

Private Attributes

PlexHandlefPlexHandle
Int_t _pixelToVaChannel [16]
Float_t _pixelSpotXTalkMap [8][9]
int method
std::vector< PMTeast
std::vector< PMTwest
std::vector< std::vector
< std::pair< int, int > > > 
pixelmaps
Detector::Detector_t lastpixelmap
Detector::Detector_t detector

Detailed Description

Definition at line 45 of file XTalkFilter.h.


Constructor & Destructor Documentation

XTalkFilter::XTalkFilter (  ) 

Definition at line 1035 of file XTalkFilter.cxx.

References detector, Initialize(), MsgService::Instance(), Msg::kDebug, Detector::kUnknown, lastpixelmap, method, and printit.

01036 {
01037         if(printit<0)
01038         {
01039                 if(MsgService::Instance()->IsActive("XTalkFilter",Msg::kDebug))printit=1;
01040                 else printit=0;
01041         }
01042 
01043         detector = Detector::kUnknown;
01044         lastpixelmap = Detector::kUnknown;
01045         method=0;
01046         Initialize();
01047 }

XTalkFilter::~XTalkFilter (  ) 

Definition at line 1081 of file XTalkFilter.cxx.

01082 {}


Member Function Documentation

void XTalkFilter::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 1085 of file XTalkFilter.cxx.

01086 {
01087 
01088 }

Int_t XTalkFilter::CalculatePMTmuxID ( PlexPixelSpotId ppsid  )  [private]

Definition at line 1199 of file XTalkFilter.cxx.

References PlexMuxBoxId::GetEastWest(), PlexMuxBoxId::GetInRack(), PlexMuxBoxId::GetRackBay(), PlexMuxBoxId::GetRackLevel(), and PlexPixelSpotId::GetTube().

Referenced by DoTrueFilter().

01199                                                           {
01200 
01201   Int_t elvalue=0;
01202   elvalue = ppsid.GetTube() + 3*ppsid.GetInRack() + 24*ppsid.GetRackBay();
01203   
01204   Char_t level = ppsid.GetRackLevel(); 
01205   Char_t ew = ppsid.GetEastWest(); 
01206   
01207   if(level=='U'){
01208     elvalue += 450;
01209   }
01210   if(ew =='E'){
01211     elvalue += 900;
01212   }
01213   
01214   return elvalue;
01215 
01216 }

void XTalkFilter::CleanXTalk ( std::vector< PMT > &  pmts,
NtpStRecord record 
) [private]

for printing out what is currently there....

for printing out what is currently there....

Definition at line 647 of file XTalkFilter.cxx.

References PixelSpot::AddE(), detector, MuELoss::e, PixelSpot::GetE(), Pixel::GetE(), GetHops(), PixelSpot::GetId(), Pixel::GetId(), PMT::GetNStrips(), PMT::GetPixel(), Pixel::GetPixelSpot(), Pixel::GetPixelSpotVector(), PMT::GetPixelVector(), PixelSpot::GetStatus(), Pixel::GetStripE(), Pixel::hopstomixed, Detector::kFar, Detector::kNear, pixelmaps, pixels, printit, Munits::second, Pixel::TakeE(), and Pixel::type.

Referenced by DoTrueFilter().

00648 {
00649         //int print=1;
00650         
00651         double xtalke=0;
00652         double totale=0;
00653         
00654         int xtalkstrips=0;
00655         int xtalkpmts=0;
00656 
00657 
00658         //double xtalkthreshold=1.0;  //xtalk if meus in this side less than this number
00659         //double xtalksinglethreshold=2.0;  //xtalk if all strip meus on this side and meus less than this number
00660         //double contribFrac=0.1; //less than x % of possible contributing energy indicated crosstalk?
00661 
00662 
00663         for(unsigned int i=0;i<pmts.size();i++)
00664         {
00665                 PMT* pmt = &pmts[i];
00666                 if(pmt->GetNStrips()<2)continue;//no need to look for XTalk here...
00667         
00668                 xtalkpmts++;
00669                 xtalkstrips+=pmt->GetNStrips();
00670                 
00671            //     if(printit)printf("\n/////////////////////////////////\nPMT id %d\n",pmt->GetId());
00672 
00673 
00674 
00675                 
00676                 std::vector<int>pixels=pmt->GetPixelVector();
00677 
00678                 //iterate over xtalk pixels, and add back in this pixels energy to those pixels by fraction of what we expect....
00679                 //perhaps than just a below a certain energy xtalk check... also require energy of pixel to be larger than some frac of energy of pixels that could have made this xtalk
00680                         
00681                         
00682 
00683                         
00684                         //make a multimap of xtalks to consider (energy, pixel idx)
00685                  //       multimap<float, int> xtalkcandidate;
00686 
00687 
00688                 //attempt to classify the pixel as crosstalk only or mixed
00689                 
00690                 //Far det
00691                 //crosstalk is defined as all strip energy only on this side of the detector
00692                 //mixed is defined as energy on both sides of the detector (ie may contain xtalk)
00693 
00694                 if(detector==Detector::kFar)
00695                 {
00696                         for(unsigned int j=0;j<pixels.size();j++)
00697                         {
00698                                 Pixel* p = pmt->GetPixel(pixels[j],0);
00699                                 if(!p)continue;
00700                         
00701                         
00702                                 if(fabs(p->GetE() - p->GetStripE() )<1e-5)
00703                                 {
00704                                         //is xtalk
00705                                         p->type=0;
00706                                 }else{
00707                                         //is mixed
00708                                         p->type=1;
00709                                 }
00710                         }       
00711                 }
00712 
00713 
00714                 //Near det
00715                 //since it is single sided... define an xtalk pixel as one that is surrounded by other pixels with an energy less than some fraction of the summed energy of the surrounding pixels
00716         
00717                 double nearthresh=0.1;
00718 
00719                 if(detector==Detector::kNear)
00720                 {
00721                         for(unsigned int j=0;j<pixels.size();j++)
00722                         {
00723                                 Pixel* p = pmt->GetPixel(pixels[j],0);
00724                                 if(!p)continue;
00725                                 double neighborE=0;
00726 
00727 
00728 
00729                                 std::vector<std::pair<int,int> > * pmap=&pixelmaps[p->GetId()];
00730                                 for(unsigned int k=0;k<pmap->size();k++)
00731                                 {
00732                                         int pid = (*pmap)[k].first;
00733 
00734                                         Pixel *pn = pmt->GetPixel(pid,0);
00735                                         if(!pn)continue;                                        
00736                                         neighborE+=pn->GetE();
00737                                 }
00738 
00739                                 if(neighborE)
00740                                 {
00741                                         if((p->GetE()/neighborE)<nearthresh)p->type=0;
00742                                         else p->type=1;
00743                                 }else{
00744                                         p->type=1;
00745                                 }
00746                         }
00747                 }
00748 
00749 
00750 /*
00751                 for(unsigned int j=0;j<pixels.size();j++)
00752                 {
00753                         Pixel* p = pmt->GetPixel(pixels[j],0);
00754                         if(!p)continue;
00755                         
00756                         double e=p->GetE();
00757                         if(e==0)continue;
00758                         
00759                         totale+=e;
00760                         
00761                 //      if(e<xtalkthreshold || (e<xtalksinglethreshold && e == p->GetStripE()))
00762                 //              xtalkcandidate.insert(std::pair<float,int>(e,p->GetId()));
00763 
00764                         //see what the energy of the pixels that could have contribued to xtalk here are
00765                         std::vector<std::pair<int,int> > * pmap=&pixelmaps[p->GetId()];
00766 
00767                 
00768                         double contribE=0;
00769                         for(unsigned int k=0;k<pmap->size();k++)
00770                         {
00771                                 int pid = (*pmap)[k].first;
00772                                 Pixel * q = pmt->GetPixel(pid,0);
00773                                 if(!q)continue;
00774                                 contribE+=q->GetE();
00775                         }
00776                         
00777                 
00778                         //single sided energy strip
00779                         if( (e<xtalksinglethreshold && e == p->GetStripE()))
00780                                 xtalkcandidate.insert(std::pair<float,int>(e,p->GetId()));
00781                 
00782                         //above some fraction of contributor energy
00783                         else if(e<contribE * contribFrac)
00784                                 xtalkcandidate.insert(std::pair<float,int>(e,p->GetId()));
00785                 
00786                 
00787                 }
00788 
00789 */
00790                 std::multimap<int,int>hops;
00791                                                 
00792                 for(unsigned int j=0;j<pixels.size();j++)
00793                 {
00794                         Pixel* p = pmt->GetPixel(pixels[j],0);
00795                         if(!p)continue;
00796                        totale+=p->GetE(); 
00797                         int nhops = GetHops(pmt,p); //how far to a mixed pixel?
00798                         p->hopstomixed=nhops;
00799                         hops.insert(std::pair<int,int>(nhops,pixels[j]));       
00800           //              if(printit)printf("minhops pixeld id %d hops %d\n",pixels[j],nhops);
00801                 }       
00802                         
00803         
00804                         
00805                 
00807 
00808 //              for(unsigned int j=0;j<pixels.size();j++)
00809 //              {
00810 //                      Pixel* p = pmt->GetPixel(pixels[j],0);
00811 
00812 //order of hops....
00813 
00814 
00815 
00816 
00817 
00818                 std::multimap<int,int>::reverse_iterator ith;
00819                 for(ith=hops.rbegin();ith!=hops.rend();ith++)
00820                 {
00821                         Pixel *p = pmt->GetPixel(ith->second,0);
00822                         if(!p)continue;
00823                         
00824                         
00825                         double e=p->GetE();
00826                         if(e==0)continue;
00827 
00828                         
00829                         
00830                        // if(printit)printf("\t pixel id %d addr %p with e %f strips(%d) e %f type %d hops %d\n",p->GetId(),(void*)p,p->GetE(),p->GetNStrips(),p->GetStripE(),p->type,p->hopstomixed);
00831                         
00832                         //see what the energy of the pixels that could have contribued to xtalk here are
00833                         std::vector<std::pair<int,int> > * pmap=&pixelmaps[p->GetId()];
00834                         
00835                         std::vector<std::pair<int, int> > toadj; //pixel, pixelspot of possible contributers
00836                         std::vector<double> contribe; //current e of possible contributors
00837                         
00838                         double sum_e=0;
00839                         for(unsigned int k=0;k<pmap->size();k++)
00840                         {
00841                                 int pid = (*pmap)[k].first;
00842 
00843                          //       if(printit)printf("\t\t xtalks to pixel %d\n",pid);
00844 
00845                                 Pixel * q = pmt->GetPixel(pid,0);
00846                                 if(!q)continue;
00847                                 
00848                                 //int dir = (*pmap)[k].second;
00849                                 
00850                                 std::vector<int>  psv = q->GetPixelSpotVector();
00851 
00852                                 
00853                                 for(unsigned int l=0;l<psv.size();l++)
00854                                 {
00855                                         PixelSpot * ps=q->GetPixelSpot(psv[l],0);
00856                                         if(!ps)continue;
00857                                 
00858                                 
00859                                         double xe = ps->GetE() ;//* _pixelSpotXTalkMap[ps->GetId()-1][8-dir];//reverse the dir
00860                                 
00861                                         toadj.push_back(std::pair<int,int>(pid,ps->GetId()));
00862                                         contribe.push_back(xe);
00863                                         sum_e+=xe;
00864 
00865                            //             if(printit)printf("\t\t\t pixelspot %d addr %p dir %d with xe %f    e %f  psxtm %f stripE %f\n",ps->GetId(),(void*)ps,8-dir,xe,ps->GetE(), _pixelSpotXTalkMap[ps->GetId()-1][8-dir],ps->GetStripE());
00866                                 }
00867                         }
00868                         
00869                                         
00870                 }
00871 
00872 
00873 
00875 
00876                 
00877                 
00878 
00879 
00880                 //for(unsigned int j=0;j<pixels->size();j++)
00881                 //{
00882                 //      Pixel* p = &(*pixels)[j];
00883 
00884 //              multimap<float, int>::iterator it;
00885 //              for(it=xtalkcandidate.begin();it!=xtalkcandidate.end();it++)
00886 //              {
00887 //                      Pixel * p = pmt->GetPixel(it->second,0);
00888 
00889 
00890                 for(ith=hops.rbegin();ith!=hops.rend();ith++)
00891                 {
00892                         Pixel *p = pmt->GetPixel(ith->second,0);
00893                         if(!p)continue;
00894                         
00895                         double pixelE=p->GetE();
00896                         if(pixelE<=0)continue;
00897                         
00898                         if(p->hopstomixed<0)continue;//it doesn't connect to other pixels...
00899                         if(p->type==1)continue;//its not xtalk only... so we wouldn't know what to share...!
00900                         
00901                     //    if(printit)printf("considering pixel id %d addr %p with e %f\n",p->GetId(),(void*)p,p->GetE());
00902                         
00903                         //see what the energy of the pixels that could have contribued to xtalk here are
00904                         std::vector<std::pair<int,int> > * pmap=&pixelmaps[p->GetId()];
00905                         
00906                         std::vector<std::pair<int, int> > toadj; //pixel, pixelspot of possible contributers
00907                         std::vector<double> contribe; //current e of possible contributors
00908                         
00909                         double sum_e=0;
00910                         for(unsigned int k=0;k<pmap->size();k++)
00911                         {
00912                                 int pid = (*pmap)[k].first;
00913 
00914 
00915                                 Pixel * q = pmt->GetPixel(pid,0);
00916                                 if(!q)continue;
00917                                 
00918                                 double qe=q->GetE();
00919                                 if(qe<1e-5)continue; //don't pass xtalk back to now empty xtalk hit
00920                                 
00921                                 //only pass up the chain
00922                                 if(q->hopstomixed>p->hopstomixed)continue;
00923                                 
00924                                 
00925                 //              if((qe<xtalksinglethreshold && qe == q->GetStripE() ) )continue;
00926 
00927                       //          if(printit)printf("\t\t xtalks to pixel %d\n",pid);
00928 
00929                                 
00930                                 //int dir = (*pmap)[k].second;
00931                                 
00932                                 std::vector<int>  psv = q->GetPixelSpotVector();
00933 
00934                                 
00935                                 for(unsigned int l=0;l<psv.size();l++)
00936                                 {
00937                                         PixelSpot*ps = q->GetPixelSpot(psv[l],0);
00938                                         if(!ps)continue;
00939                                         
00940                                         if(ps->GetStatus())continue;
00941                                 
00942                                         double xe = ps->GetE();//*_pixelSpotXTalkMap[ps->GetId()-1][8-dir];//reverse the dir
00943                                 
00944                                         toadj.push_back(std::pair<int,int>(pid,ps->GetId()));
00945                                         contribe.push_back(xe);
00946                                         sum_e+=xe;
00947 
00948                         //                if(printit)printf("\t\t\t pixelspot %d addr %p dir %d with xe %f    e %f  psxtm %f stripE %f\n",ps->GetId(),(void*)ps,8-dir,xe,ps->GetE(), _pixelSpotXTalkMap[ps->GetId()-1][8-dir],ps->GetStripE());
00949                                 }
00950                         }
00951                         
00952                         if(sum_e>0)
00953                         for(unsigned int k=0;k<toadj.size();k++)
00954                         {
00955                                 
00956                                 double toadd=contribe[k]/sum_e*pixelE;
00957                                 p->TakeE(toadd);
00958                                 Pixel * q = pmt->GetPixel(toadj[k].first,0);
00959                                 Pixel oldp = *q;
00960                                 
00961                                 if(!q)continue;
00962                                 PixelSpot *ps = q->GetPixelSpot(toadj[k].second,0);
00963                                 if(!ps)continue;
00964                                 ps->AddE(toadd);
00965                           //      if(printit)printf("q addr %p\n",(void*)q);
00966                                 
00967                             //    if(printit)printf("adjusting pixel id %d by %f  e %f %f stripe %f %f type %d\n",q->GetId(),toadd,oldp.GetE(),q->GetE(),oldp.GetStripE(),q->GetStripE(),q->type);
00968                                 xtalke+=toadd;
00969                         }
00970                         
00971                                         
00972                 }
00973                 
00974                 
00975 
00977 /*
00978                 for(ith=hops.rbegin();ith!=hops.rend();ith++)
00979                 {
00980                         Pixel *p = pmt->GetPixel(ith->second,0);
00981                         if(!p)continue;
00982 
00983                         
00984                         double e=p->GetE();
00985                         if(e==0)continue;
00986                         
00987                         
00988                         if(printit)printf("\t pixel id %d with e %f strips(%d) e %f type %d hops %d\n",p->GetId(),p->GetE(),p->GetNStrips(),p->GetStripE(),p->type,p->hopstomixed);
00989                         
00990                         //see what the energy of the pixels that could have contribued to xtalk here are
00991                         std::vector<std::pair<int,int> > * pmap=&pixelmaps[p->GetId()];
00992                         
00993                         
00994                         double sum_e=0;
00995                         for(unsigned int k=0;k<pmap->size();k++)
00996                         {
00997                                 int pid = (*pmap)[k].first;
00998 
00999                                 if(printit)printf("\t\t xtalks to pixel %d\n",pid);
01000 
01001                                 Pixel * q = pmt->GetPixel(pid,0);
01002                                 if(!q)continue;
01003                                 
01004                                 int dir = (*pmap)[k].second;
01005                                 
01006                                 std::vector<int> psv = q->GetPixelSpotVector();
01007 
01008                                 
01009                                 for(unsigned int l=0;l<psv.size();l++)
01010                                 {
01011                                         PixelSpot *ps = q->GetPixelSpot(psv[l],0);
01012                                         if(!ps)continue;
01013                                         
01014   //                                      double xe = ps->GetE()*_pixelSpotXTalkMap[ps->GetId()-1][8-dir];//reverse the dir
01015 
01016     //                                    sum_e+=xe;
01017 
01018                                         if(printit)printf("\t\t\t pixelspot %d addr %p dir %d with xe %f    e %f  psxtm %f stripE %f\n",ps->GetId(),(void*)ps,8-dir,xe,ps->GetE(), _pixelSpotXTalkMap[ps->GetId()-1][8-dir],ps->GetStripE());
01019                                 }
01020                         }
01021                 }
01022 */
01024         }
01025 
01026         if(printit)printf("found %d strips in %d pmts with total %f energy and %f redistributed\n",xtalkstrips, xtalkpmts,totale,xtalke);
01027 
01028 }

void XTalkFilter::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 1172 of file XTalkFilter.cxx.

References Registry::Get(), JobCModule::GetConfig(), Msg::kDebug, Registry::LockValues(), method, MSG, Registry::UnLockValues(), and Registry::ValuesLocked().

Referenced by MinosCompactEvent::MinosCompactEvent().

01173 {
01174 //======================================================================
01175 // Configure the module given the Registry r
01176 //======================================================================
01177   MSG("XTalkFilter",Msg::kDebug)<<"In Trimmer::Config"<<endl;
01178                                                                                
01179   bool islocked = this->GetConfig().ValuesLocked();
01180   if (islocked) this->GetConfig().UnLockValues();
01181  
01182   int valint;
01183   if(r.Get("Method", valint)) 
01184   {
01185     method=valint;
01186   }
01187 
01188   if (islocked) this->GetConfig().LockValues();
01189 
01190         MSG("XTalkFilter",Msg::kDebug)<< "Using method "<<method<<endl;
01191 
01192 }

const Registry & XTalkFilter::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 1150 of file XTalkFilter.cxx.

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

Referenced by MinosCompactEvent::MinosCompactEvent().

01151 {
01152 //======================================================================
01153 // Supply the default configuration for the module
01154 //======================================================================
01155    MSG("XTalkFilter",Msg::kDebug)<<"In Trimmer::DefaultConfig"<<endl;
01156 
01157   
01158   static Registry r;
01159   std::string name = this->JobCModule::GetName();
01160   name += ".config.default";
01161   r.SetName(name.c_str());
01162 
01163   r.UnLockValues();
01164   r.Set("Method",0);         
01165 
01166   r.LockValues();             
01167                
01168                                                                               
01169   return r;
01170 }

void XTalkFilter::DoTrueFilter ( NtpStRecord record,
int  ievt 
)

Definition at line 395 of file XTalkFilter.cxx.

References CalculatePMTmuxID(), CleanXTalk(), detector, east, NtpStRecord::evt, fPlexHandle, VldContext::GetDetector(), RecRecordImp< T >::GetHeader(), PlexPixelSpotId::GetPixel(), PMT::GetPixel(), GetPixelMaps(), PlexHandle::GetPixelSpotId(), GetPMT(), PlexPixelSpotId::GetSpot(), RecHeader::GetVldContext(), PlexPlaneId::IsVetoShield(), StripEnd::kEast, StripEnd::kWest, MAX_NUMBER_OF_PMTS, NtpSRPulseHeight::pe, NtpSRStrip::ph0, NtpSRStrip::ph1, NtpSRStrip::plane, printit, SaveAdjustment(), NtpSRPulseHeight::sigcor, NtpStRecord::stp, NtpSRStrip::strip, and west.

Referenced by MinosCompactEvent::MinosCompactEvent(), and Reco().

00395                                                             {
00396 
00397 // clear the pmt vectors
00398         east.clear();
00399         west.clear();
00400 
00401         detector = record->GetHeader().GetVldContext().GetDetector();
00402 
00403         //make sure we are using the maps for the correct detector
00404         GetPixelMaps();
00405 
00406    NtpSREvent* event = dynamic_cast<NtpSREvent*>(record->evt->At(ievt));  
00407    int nstrips=event->nstrip;
00408 
00409 // Getting a handle on the plex
00410    fPlexHandle = new PlexHandle(record->GetHeader().GetVldContext());
00411 
00412    if (record!=NULL){
00413     
00414 // -->strips loop
00415      for(int istp = 0; istp< nstrips; istp++){
00416 
00417 // Getting east and west strip-ends and PMT pixels
00418      const NtpSRStrip* strip = dynamic_cast<const NtpSRStrip*>
00419                           (record->stp->At(event->stp[istp]));
00420 
00421      if (!strip)
00422                 {
00423        printf("missing strip!!! idx %d total %d\n",event->stp[istp],
00424                                          record->stp->GetEntries());
00425                 
00426                 }
00427 
00428       PlexStripEndId pseid_east(detector,
00429                      strip->plane,strip->strip,StripEnd::kEast);
00430       PlexStripEndId pseid_west(detector,
00431                      strip->plane,strip->strip,StripEnd::kWest);
00432 
00433       PlexPixelSpotId ppsid_east = fPlexHandle->GetPixelSpotId(pseid_east); 
00434       PlexPixelSpotId ppsid_west = fPlexHandle->GetPixelSpotId(pseid_west);
00435 
00436       Int_t PMTmuxID_east = CalculatePMTmuxID(ppsid_east);
00437       Int_t PMTmuxID_west = CalculatePMTmuxID(ppsid_west);
00438 
00439       Float_t strip_e = (strip->ph0.sigcor+strip->ph1.sigcor)/60.;
00440 
00441 // East
00442 //----
00443       Float_t q  = strip->ph0.pe;
00444       Float_t qc = strip->ph0.sigcor/60.;
00445       if(q!=0){
00446         if(PMTmuxID_east<MAX_NUMBER_OF_PMTS && !pseid_east.IsVetoShield()){
00447  
00448 // if(qc/q<0.1 || qc/q > 10.0){
00449 //   qc=q;
00450 // }
00451 // UpdatePixelMap(PMTmuxID_east,ppsid_east.GetPixel(),qc);
00452 // UpdateXTalkMap(PMTmuxID_east,ppsid_east.GetPixel(), ppsid_east.GetSpot(),qc);         
00453                 PMT * pmte = GetPMT(east,PMTmuxID_east);
00454                 pmte->GetPixel(ppsid_east.GetPixel())->GetPixelSpot(ppsid_east.GetSpot())->AddStrip(event->stp[istp], qc, strip_e);
00455  
00456         } else {
00457           cout << "Warning in XTalkRemover: Had a PMTmuxID higher than MAX_NUMBER_OF_PMTS and/or a veto shield hit" << endl;
00458         }//<--not bigger than MAX_NUMBER_OF_PMTS, and not veto shield
00459       }//<--no charge on east side
00460 
00461       //West
00462       //----
00463       q  = strip->ph1.pe;
00464       qc = strip->ph1.sigcor/60.;
00465       if(q!=0){
00466         if(PMTmuxID_west<MAX_NUMBER_OF_PMTS && !pseid_west.IsVetoShield()){       
00467 //        if(qc/q<0.1 || qc/q > 10.0){
00468 //          qc=q;
00469 //        }
00470 //        UpdatePixelMap(PMTmuxID_west,ppsid_west.GetPixel(),qc);
00471 //        UpdateXTalkMap(PMTmuxID_west,ppsid_west.GetPixel(), ppsid_west.GetSpot(),qc);
00472                 PMT * pmtw = GetPMT(west,PMTmuxID_west);
00473                 pmtw->GetPixel(ppsid_west.GetPixel())->GetPixelSpot(ppsid_west.GetSpot())->AddStrip(event->stp[istp], qc, strip_e);
00474 
00475         } else {
00476           cout << "Warning in XTalkRemover: Had a PMTmuxID higher than MAX_NUMBER_OF_PMTS and/or a veto shield hit" << endl;
00477         }//<--not bigger than MAX_NUMBER_OF_PMTS, and not veto shield
00478       }//<--no charge on west side
00479       
00480     }//strips loop
00481     
00482   } else {//<--not empty record
00483     cout << "Warning: Passed empty record to MakePixelMap in XTalkRemover" << endl;
00484   }
00485 
00486 
00487 /*
00488         printf("--------------------------\nEast PMTs\n");
00489         for(unsigned int i=0;i<east.size();i++)
00490         {
00491                 east[i].Dump();
00492         }
00493         printf("--------------------------\n");
00494 
00495 
00496 
00497         printf("--------------------------\nWest PMTs\n");
00498         for(unsigned int i=0;i<west.size();i++)
00499         {
00500                 west[i].Dump();
00501         }
00502         printf("--------------------------\n");
00503 */      
00504         
00505        if(printit)printf("CleanXTalk east\n"); 
00506         CleanXTalk(east,record);
00507        if(printit)printf("CleanXTalk west\n"); 
00508         CleanXTalk(west,record);        
00509         
00510         SaveAdjustment(east,0,record);
00511         SaveAdjustment(west,1,record);
00512         
00513 }

void XTalkFilter::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 1091 of file XTalkFilter.cxx.

01092 {
01093 }

int XTalkFilter::GetHops ( PMT pmt,
std::vector< int > &  pixels,
int  pixelID,
Pixel startPixel,
std::vector< int >  visited 
)

Definition at line 613 of file XTalkFilter.cxx.

References GetHops(), Pixel::GetId(), PMT::GetPixel(), pixelmaps, and Pixel::type.

00614 {
00615 
00616         if(pixelID==startPixel->GetId())return 1000; //circular loop... check for this value before using hops!.
00617         if(pixelID<0)pixelID=startPixel->GetId();
00618         visited.push_back(pixelID);
00619 
00620         Pixel* p = pmt->GetPixel(pixelID,0);
00621 
00622         if(p->type==1)return 0;
00623         
00624         int minhops=1000;
00625         std::vector<std::pair<int,int> > * pmap=&pixelmaps[pixelID];
00626         for(unsigned int k=0;k<pmap->size();k++)
00627         {
00628                 int pid = (*pmap)[k].first;
00629                 Pixel * q = 0;
00630                 
00631                 //don't infinitely loop!
00632                 int alreadydid=0;
00633                 for(unsigned int j=0;j<visited.size();j++)
00634                 if(visited[j]==pid){alreadydid=1;break;}
00635                 if(alreadydid)continue;
00636                 
00637                 q=pmt->GetPixel(pid,0);
00638                 if(!q)continue;
00639                 
00640                 int hops = GetHops(pmt,pixels,q->GetId(),startPixel,visited);
00641 //              printf("hops %d start %d to %d from %d\n",hops,startPixel->GetId(), q->GetId(),pixelID);
00642                 if(hops<minhops)minhops=hops;   
00643         }
00644         return minhops+1;
00645 }

int XTalkFilter::GetHops ( PMT pmt,
Pixel startPixel 
)

Definition at line 602 of file XTalkFilter.cxx.

References PMT::GetPixelVector(), and pixels.

Referenced by CleanXTalk(), and GetHops().

00603 {
00604         std::vector<int>pixels=pmt->GetPixelVector();
00605         std::vector<int>visited;
00606         int nhops= GetHops(pmt, pixels,-1,startPixel,visited);
00607         if(nhops>=1000)nhops=-1; //not possible to get to mixed pixel!
00608         return nhops;
00609 }

void XTalkFilter::GetPixelMaps (  )  [private]

Definition at line 1050 of file XTalkFilter.cxx.

References detector, GetXTalkPixelsFar(), GetXTalkPixelsNear(), Detector::kFar, Detector::kNear, lastpixelmap, and pixelmaps.

Referenced by DoTrueFilter().

01051 {
01052         if(lastpixelmap != detector)
01053         {
01054                 pixelmaps.clear();
01055                 if(detector==Detector::kFar)
01056                 {
01057                         for(int i=0;i<16;i++)
01058                         {
01059                                 pixelmaps.push_back(GetXTalkPixelsFar(i));
01060                         }
01061                 }
01062                 if(detector==Detector::kNear)
01063                 {
01064                         for(int i=0;i<64;i++)
01065                         {
01066                                 pixelmaps.push_back(GetXTalkPixelsNear(i));
01067                         }
01068                 }
01069 
01070 
01071                 lastpixelmap=detector;
01072 
01073         }
01074 
01075 
01076 }

PMT * XTalkFilter::GetPMT ( std::vector< PMT > &  v,
int  id,
int  create = 1 
)

Definition at line 379 of file XTalkFilter.cxx.

Referenced by DoTrueFilter().

00380 {
00381         for(unsigned int i=0;i<v.size();i++)
00382         {
00383                 if(v[i].GetId()==id)return &(v[i]);
00384         }
00385         
00386         if(!create)return 0;
00387         
00388         //if its not there... create it
00389         PMT newpmt(id);
00390         v.push_back(newpmt);
00391         return & (v[v.size()-1]);
00392 
00393 }

std::vector< std::pair< int, int > > XTalkFilter::GetXTalkPixelsFar ( int  pixel  )  [private]

Definition at line 136 of file XTalkFilter.cxx.

Referenced by GetPixelMaps().

00137 {
00138         std::vector<std::pair<int,int> > ret;
00139 
00140   switch(pixel){
00141     case 0:
00142         ret.push_back(std::pair<int,int>(1,5));
00143         ret.push_back(std::pair<int,int>(4,7));
00144         ret.push_back(std::pair<int,int>(5,8));
00145       break;
00146     case 1:
00147         ret.push_back(std::pair<int,int>(0,3));
00148         ret.push_back(std::pair<int,int>(2,5));
00149         ret.push_back(std::pair<int,int>(4,6));
00150         ret.push_back(std::pair<int,int>(5,7));
00151         ret.push_back(std::pair<int,int>(6,8));
00152       break;
00153     case 2:
00154                 ret.push_back(std::pair<int,int>(1,3));
00155         ret.push_back(std::pair<int,int>(3,5));
00156         ret.push_back(std::pair<int,int>(5,6));
00157         ret.push_back(std::pair<int,int>(6,7));
00158         ret.push_back(std::pair<int,int>(7,8));
00159       break;
00160     case 3:
00161                 ret.push_back(std::pair<int,int>(2,3));
00162         ret.push_back(std::pair<int,int>(6,6));
00163         ret.push_back(std::pair<int,int>(7,7));
00164       break;
00165     case 4:
00166                 ret.push_back(std::pair<int,int>(0,1));
00167         ret.push_back(std::pair<int,int>(1,2));
00168         ret.push_back(std::pair<int,int>(5,5));
00169         ret.push_back(std::pair<int,int>(8,7));
00170         ret.push_back(std::pair<int,int>(9,8));
00171       break;
00172     case 5:
00173                 ret.push_back(std::pair<int,int>(0,0));
00174         ret.push_back(std::pair<int,int>(1,1));
00175         ret.push_back(std::pair<int,int>(2,2));
00176         ret.push_back(std::pair<int,int>(4,3));
00177         ret.push_back(std::pair<int,int>(6,5));
00178         ret.push_back(std::pair<int,int>(8,6));
00179         ret.push_back(std::pair<int,int>(9,7));
00180         ret.push_back(std::pair<int,int>(10,8));
00181       break;
00182     case 6:
00183                 ret.push_back(std::pair<int,int>(1,0));
00184         ret.push_back(std::pair<int,int>(2,1));
00185         ret.push_back(std::pair<int,int>(3,2));
00186         ret.push_back(std::pair<int,int>(5,3));
00187         ret.push_back(std::pair<int,int>(7,5));
00188         ret.push_back(std::pair<int,int>(9,6));
00189         ret.push_back(std::pair<int,int>(10,7));
00190         ret.push_back(std::pair<int,int>(11,8));
00191         break;
00192     case 7:
00193                 ret.push_back(std::pair<int,int>(2,0));
00194         ret.push_back(std::pair<int,int>(3,1));
00195         ret.push_back(std::pair<int,int>(6,3));
00196         ret.push_back(std::pair<int,int>(10,6));
00197         ret.push_back(std::pair<int,int>(11,7));
00198       break;
00199     case 8:
00200                 ret.push_back(std::pair<int,int>(4,1));
00201         ret.push_back(std::pair<int,int>(5,2));
00202         ret.push_back(std::pair<int,int>(9,5));
00203         ret.push_back(std::pair<int,int>(12,7));
00204         ret.push_back(std::pair<int,int>(13,8));
00205       break;
00206     case 9:
00207                 ret.push_back(std::pair<int,int>(4,0));
00208         ret.push_back(std::pair<int,int>(5,1));
00209         ret.push_back(std::pair<int,int>(6,2));
00210         ret.push_back(std::pair<int,int>(8,3));
00211         ret.push_back(std::pair<int,int>(10,5));
00212         ret.push_back(std::pair<int,int>(12,6));
00213         ret.push_back(std::pair<int,int>(13,7));
00214         ret.push_back(std::pair<int,int>(14,8));
00215       break;
00216     case 10:
00217                 ret.push_back(std::pair<int,int>(5,0));
00218         ret.push_back(std::pair<int,int>(6,1));
00219         ret.push_back(std::pair<int,int>(7,2));
00220         ret.push_back(std::pair<int,int>(9,3));
00221         ret.push_back(std::pair<int,int>(11,5));
00222         ret.push_back(std::pair<int,int>(13,6));
00223         ret.push_back(std::pair<int,int>(14,7));
00224         ret.push_back(std::pair<int,int>(15,8));
00225       break;
00226     case 11:
00227                 ret.push_back(std::pair<int,int>(6,0));
00228         ret.push_back(std::pair<int,int>(7,1));
00229         ret.push_back(std::pair<int,int>(10,3));
00230         ret.push_back(std::pair<int,int>(14,6));
00231         ret.push_back(std::pair<int,int>(15,7));
00232       break;
00233     case 12:
00234                 ret.push_back(std::pair<int,int>(8,1));
00235         ret.push_back(std::pair<int,int>(9,2));
00236         ret.push_back(std::pair<int,int>(13,5));
00237       break;
00238     case 13:
00239                 ret.push_back(std::pair<int,int>(8,0));
00240         ret.push_back(std::pair<int,int>(9,1));
00241         ret.push_back(std::pair<int,int>(10,2));
00242         ret.push_back(std::pair<int,int>(12,3));
00243         ret.push_back(std::pair<int,int>(14,5));
00244       break;
00245     case 14:
00246                 ret.push_back(std::pair<int,int>(9,0));
00247         ret.push_back(std::pair<int,int>(10,1));
00248         ret.push_back(std::pair<int,int>(11,2));
00249         ret.push_back(std::pair<int,int>(13,3));
00250         ret.push_back(std::pair<int,int>(15,5));
00251       break;
00252     case 15:
00253                 ret.push_back(std::pair<int,int>(10,0));
00254         ret.push_back(std::pair<int,int>(11,1));
00255         ret.push_back(std::pair<int,int>(14,3));
00256       break;
00257     default:
00258       break;
00259         }
00260 
00261         return ret;
00262 }

std::vector< std::pair< int, int > > XTalkFilter::GetXTalkPixelsNear ( int  pixel  )  [private]

Definition at line 52 of file XTalkFilter.cxx.

Referenced by GetPixelMaps().

00053 {     
00054         std::vector<std::pair<int,int> > ret;
00055                 
00056 
00057 
00058   if(pixel==0)
00059   {
00060         ret.push_back(std::pair<int,int>(1,5));
00061         ret.push_back(std::pair<int,int>(8,7));
00062         ret.push_back(std::pair<int,int>(9,8));
00063   }else if(pixel==7){
00064         ret.push_back(std::pair<int,int>(6,3));
00065         ret.push_back(std::pair<int,int>(14,6));
00066         ret.push_back(std::pair<int,int>(15,7));
00067   }else if(pixel==56){
00068         ret.push_back(std::pair<int,int>(48,1));
00069         ret.push_back(std::pair<int,int>(49,2));
00070         ret.push_back(std::pair<int,int>(57,5));
00071   }else if(pixel==63){
00072         ret.push_back(std::pair<int,int>(62,3));
00073         ret.push_back(std::pair<int,int>(54,0));
00074         ret.push_back(std::pair<int,int>(55,1));
00075   }
00076 
00077   //first row
00078   else if(pixel>0 && pixel<7)
00079   {  
00080         ret.push_back(std::pair<int,int>(pixel-1,3));
00081         ret.push_back(std::pair<int,int>(pixel+1,5));
00082         ret.push_back(std::pair<int,int>(pixel+7,6));
00083         ret.push_back(std::pair<int,int>(pixel+8,7));
00084         ret.push_back(std::pair<int,int>(pixel+9,8));
00085   }
00086 
00087   //last orw
00088   else if(pixel>56 && pixel<63)
00089   { 
00090         ret.push_back(std::pair<int,int>(pixel-1,3));
00091         ret.push_back(std::pair<int,int>(pixel+1,5));
00092         ret.push_back(std::pair<int,int>(pixel-7,2));
00093         ret.push_back(std::pair<int,int>(pixel-8,1));
00094         ret.push_back(std::pair<int,int>(pixel-9,0));
00095   }   
00096     
00097   //left column
00098 
00099   else if(pixel%8==0 && pixel>0 && pixel<56)
00100   { 
00101         ret.push_back(std::pair<int,int>(pixel-8,1));
00102         ret.push_back(std::pair<int,int>(pixel-7,2));
00103         ret.push_back(std::pair<int,int>(pixel+1,5));
00104         ret.push_back(std::pair<int,int>(pixel+8,7));
00105         ret.push_back(std::pair<int,int>(pixel+9,8));
00106   }   
00107     
00108   //right column
00109   else if((pixel+1)%8==0 && pixel>7 && pixel<63)
00110   {
00111         ret.push_back(std::pair<int,int>(pixel-8,1));
00112         ret.push_back(std::pair<int,int>(pixel-9,0));
00113         ret.push_back(std::pair<int,int>(pixel-1,3));
00114         ret.push_back(std::pair<int,int>(pixel+7,6));
00115         ret.push_back(std::pair<int,int>(pixel+8,7));
00116   }
00117 
00118   //interior pixel
00119   else{
00120         ret.push_back(std::pair<int,int>(pixel-9,0));
00121         ret.push_back(std::pair<int,int>(pixel-8,1));
00122         ret.push_back(std::pair<int,int>(pixel-7,2));
00123         ret.push_back(std::pair<int,int>(pixel-1,3));
00124         ret.push_back(std::pair<int,int>(pixel+1,5));
00125         ret.push_back(std::pair<int,int>(pixel+7,6));
00126         ret.push_back(std::pair<int,int>(pixel+8,7));
00127         ret.push_back(std::pair<int,int>(pixel+9,8));
00128   }  
00129         return ret;
00130 }       

void XTalkFilter::Initialize (  ) 

Definition at line 266 of file XTalkFilter.cxx.

References _pixelToVaChannel.

Referenced by XTalkFilter().

00267 {
00268 
00269 // Necessary arrays (obtained from AltDeMux)
00270   _pixelToVaChannel[0]  = 3;
00271   _pixelToVaChannel[1]  = 5;
00272   _pixelToVaChannel[2]  = 14;
00273   _pixelToVaChannel[3]  = 16;
00274   _pixelToVaChannel[4]  = 7;
00275   _pixelToVaChannel[5]  = 9;
00276   _pixelToVaChannel[6]  = 10;
00277   _pixelToVaChannel[7]  = 12;
00278   _pixelToVaChannel[8]  = 11;
00279   _pixelToVaChannel[9]  = 13;
00280   _pixelToVaChannel[10] = 6;
00281   _pixelToVaChannel[11] = 8;
00282   _pixelToVaChannel[12] = 17;
00283   _pixelToVaChannel[13] = 15;
00284   _pixelToVaChannel[14] = 2;
00285   _pixelToVaChannel[15] = 4;
00286 
00287 
00288 //not actually using _pixelSpotXTalkMap now...
00289 /*
00290 
00291   //-->spot 0
00292   _pixelSpotXTalkMap[2][0] = 0.007; 
00293   _pixelSpotXTalkMap[2][1] = 0.025;
00294   _pixelSpotXTalkMap[2][2] = 0.002;
00295   _pixelSpotXTalkMap[2][3] = 0.025;
00296   _pixelSpotXTalkMap[2][5] = 0.003;
00297   _pixelSpotXTalkMap[2][6] = 0.001;
00298   _pixelSpotXTalkMap[2][7] = 0.003;
00299   _pixelSpotXTalkMap[2][8] = 0.002;
00300   
00301   //-->spot 1
00302   _pixelSpotXTalkMap[1][0] = 0.003; 
00303   _pixelSpotXTalkMap[1][1] = 0.025;
00304   _pixelSpotXTalkMap[1][2] = 0.003;
00305   _pixelSpotXTalkMap[1][3] = 0.006;
00306   _pixelSpotXTalkMap[1][5] = 0.006;
00307   _pixelSpotXTalkMap[1][6] = 0.001;
00308   _pixelSpotXTalkMap[1][7] = 0.004;
00309   _pixelSpotXTalkMap[1][8] = 0.001;
00310   
00311 
00312   //-->spot 2
00313   _pixelSpotXTalkMap[0][0] = 0.002; 
00314   _pixelSpotXTalkMap[0][1] = 0.025;
00315   _pixelSpotXTalkMap[0][2] = 0.007;
00316   _pixelSpotXTalkMap[0][3] = 0.003;
00317   _pixelSpotXTalkMap[0][5] = 0.025;
00318   _pixelSpotXTalkMap[0][6] = 0.001;
00319   _pixelSpotXTalkMap[0][7] = 0.003;
00320   _pixelSpotXTalkMap[0][8] = 0.002;
00321   
00322   //-->spot 3
00323   _pixelSpotXTalkMap[4][0] = 0.002; 
00324   _pixelSpotXTalkMap[4][1] = 0.008;
00325   _pixelSpotXTalkMap[4][2] = 0.001;
00326   _pixelSpotXTalkMap[4][3] = 0.011;
00327   _pixelSpotXTalkMap[4][5] = 0.004;
00328   _pixelSpotXTalkMap[4][6] = 0.002;
00329   _pixelSpotXTalkMap[4][7] = 0.008;
00330   _pixelSpotXTalkMap[4][8] = 0.001;
00331   
00332 
00333   //-->spot 4
00334   _pixelSpotXTalkMap[3][0] = 0.001; 
00335   _pixelSpotXTalkMap[3][1] = 0.008;
00336   _pixelSpotXTalkMap[3][2] = 0.002;
00337   _pixelSpotXTalkMap[3][3] = 0.004;
00338   _pixelSpotXTalkMap[3][5] = 0.011;
00339   _pixelSpotXTalkMap[3][6] = 0.001;
00340   _pixelSpotXTalkMap[3][7] = 0.008;
00341   _pixelSpotXTalkMap[3][8] = 0.002;
00342   
00343   //-->spot 5
00344   _pixelSpotXTalkMap[7][0] = 0.002; 
00345   _pixelSpotXTalkMap[7][1] = 0.003;
00346   _pixelSpotXTalkMap[7][2] = 0.001;
00347   _pixelSpotXTalkMap[7][3] = 0.025;
00348   _pixelSpotXTalkMap[7][5] = 0.003;
00349   _pixelSpotXTalkMap[7][6] = 0.007;
00350   _pixelSpotXTalkMap[7][7] = 0.025;
00351   _pixelSpotXTalkMap[7][8] = 0.002;
00352   
00353   //-->spot 6
00354   _pixelSpotXTalkMap[6][0] = 0.001; 
00355   _pixelSpotXTalkMap[6][1] = 0.004;
00356   _pixelSpotXTalkMap[6][2] = 0.001;
00357   _pixelSpotXTalkMap[6][3] = 0.006;
00358   _pixelSpotXTalkMap[6][5] = 0.006;
00359   _pixelSpotXTalkMap[6][6] = 0.003;
00360   _pixelSpotXTalkMap[6][7] = 0.025;
00361   _pixelSpotXTalkMap[6][8] = 0.003;
00362   
00363   //-->spot 7
00364   _pixelSpotXTalkMap[5][0] = 0.001; 
00365   _pixelSpotXTalkMap[5][1] = 0.003;
00366   _pixelSpotXTalkMap[5][2] = 0.002;
00367   _pixelSpotXTalkMap[5][3] = 0.003;
00368   _pixelSpotXTalkMap[5][5] = 0.025;
00369   _pixelSpotXTalkMap[5][6] = 0.002;
00370   _pixelSpotXTalkMap[5][7] = 0.025;
00371   _pixelSpotXTalkMap[5][8] = 0.007;
00372 
00373 */  
00374  
00375 
00376 
00377 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 1095 of file XTalkFilter.cxx.

References DoTrueFilter(), NtpStRecord::evthdr, MomNavigator::GetFragmentList(), JobCResult::kPassed, method, and NtpSREventSummary::nevent.

01096 {
01097    bool foundST=false;
01098                                                                                
01099 //   VldContext vc;
01100    //first ask mom for a NtpStRecord
01101 
01102 //iterate over all NtpStRecords in MOM
01103 
01104 std::vector<TObject*> records = mom->GetFragmentList("NtpStRecord");
01105 
01106 
01107 for(unsigned int i=0;i<records.size();i++)
01108 {
01109 
01110    NtpStRecord *str=dynamic_cast<NtpStRecord *>(records[i]); //(mom->GetFragment("NtpStRecord","Primary"));
01111    if(str){
01112      foundST=true;
01113   //   vc=str->GetHeader().GetVldContext();
01114    }else{
01115         continue;
01116    }
01117    //cout<<"Running over "<<str->GetName()<<endl;
01118 
01119         NtpSREventSummary * evthdr = dynamic_cast<NtpSREventSummary *>(&str->evthdr);
01120 
01121         for(int ievt=0;ievt<evthdr->nevent;ievt++)
01122         {
01123         
01124         
01125 /*              for(int j=0;j<str->stp->GetEntries();j++)
01126                 {
01127                         NtpSRStrip* strip = (NtpSRStrip*)(str->stp->At(j));
01128                         strip->ph0.pe=5;
01129                         strip->ph0.sigcor=5;
01130                     strip->ph0.siglin=5;
01131                     strip->ph0.raw=5;
01132 
01133                         strip->ph1.pe=5;
01134                         strip->ph1.sigcor=5;
01135                     strip->ph1.siglin=5;
01136                     strip->ph1.raw=5;
01137 
01138                 }continue;              
01139 */      
01140                 if(method==0)DoTrueFilter(str,ievt);    
01141         }
01142 }
01143    
01144    return JobCResult::kPassed; // kNoDecision, kFailed, etc.
01145 }

void XTalkFilter::SaveAdjustment ( std::vector< PMT > &  pmts,
int  side,
NtpStRecord record 
) [private]

Definition at line 515 of file XTalkFilter.cxx.

References MuELoss::e, PixelSpot::GetE(), PMT::GetId(), PixelSpot::GetId(), Pixel::GetId(), PMT::GetPixel(), Pixel::GetPixelSpot(), Pixel::GetPixelSpotVector(), PMT::GetPixelVector(), Pixel::GetStatus(), PixelSpot::GetStatus(), PMT::GetStatus(), PixelSpot::GetStrips(), Munits::m, NtpSRPulseHeight::pe, NtpSRStrip::ph0, NtpSRStrip::ph1, pixels, printit, NtpSRPulseHeight::raw, NtpSRPulseHeight::sigcor, NtpSRPulseHeight::siglin, and NtpStRecord::stp.

Referenced by DoTrueFilter().

00516 {
00517 
00518 // iterate over pmts that have changed spots
00519         for(unsigned int i=0;i<pmts.size();i++)
00520         {
00521                 PMT* pmt = &pmts[i];
00522                 if(!pmt->GetStatus())continue; //not changed
00523 
00524                 std::vector<int>pixels=pmt->GetPixelVector();
00525                 for(unsigned int j=0;j<pixels.size();j++)
00526                 {
00527                         Pixel* p = pmt->GetPixel(pixels[j],0);
00528                         if(!p)continue;
00529                         if(!p->GetStatus())continue;
00530                                 
00531                         std::vector<int>  psv = p->GetPixelSpotVector();
00532                         for(unsigned int l=0;l<psv.size();l++)
00533                         {
00534                                 PixelSpot * ps=p->GetPixelSpot(psv[l],0);
00535                                 if(!ps)continue;
00536                                 if(!ps->GetStatus())continue;
00537                                         
00538 
00539                                 double adjfrac=0;
00540                                 double totalstrippe=0;
00541                                 std::vector<int> strips = ps->GetStrips();
00542                                 for(unsigned int m=0;m<strips.size();m++)
00543                                 {                             
00544                                         NtpSRStrip* strip = (NtpSRStrip*)(record->stp->At(strips[m]));  
00545                                         totalstrippe += side==0?strip->ph0.sigcor/60.:strip->ph1.sigcor/60.;
00546                                 }
00547 
00548                                 double thispe = ps->GetE();
00549                                 adjfrac = totalstrippe>0?thispe / totalstrippe : 0;
00550                                 if(adjfrac<1e-5)adjfrac=0; //don't want small energy... don't want <0 energy
00551                         
00552 
00553 
00554 if(printit)printf("adj pmt %d p %d ps %d ee %f adjfrac %f stripe %f\n",pmt->GetId(), p->GetId(), ps->GetId(), thispe, adjfrac, totalstrippe);
00555                                 
00556                                 for(unsigned int m=0;m<strips.size();m++)
00557                                 {                               
00558 
00559 
00560         
00561                                 NtpSRStrip* strip = (NtpSRStrip*)(record->stp->At(strips[m]));
00562                                 
00563                                 if(!strip)
00564                                 {
00565                                         printf("CANT FIND STRIP AT IDX %d\n",strips[m]);
00566                                         continue;
00567                                         
00568                                 }
00569                                 
00570                                     
00571                                    
00572                       
00573         
00574         
00575                                         //if(printit)printf("adjfrac %f  from old pe %f new pe %f\n",adjfrac,strippe,thispe);
00576                                         if(side==0)
00577                                         {
00578                                                 if(printit)printf("adjusting frac %f strip %d pe %f to %f sc %f to %f\n",adjfrac,strips[m],strip->ph0.pe,strip->ph0.pe*adjfrac,strip->ph0.sigcor,strip->ph0.sigcor*adjfrac);
00579                                         
00580                                                 strip->ph0.pe*=adjfrac;
00581                                                 strip->ph0.siglin*=adjfrac;
00582                                                 strip->ph0.sigcor*=adjfrac;
00583                                                 strip->ph0.raw*=adjfrac;
00584                                         }else{
00585                                                 if(printit)printf("adjusting frac %f strip %d pe %f to %f sc %f to %f\n",adjfrac,strips[m],strip->ph1.pe,strip->ph1.pe*adjfrac,strip->ph1.sigcor,strip->ph1.sigcor*adjfrac);
00586                                                 
00587                                                 strip->ph1.pe*=adjfrac;
00588                                                 strip->ph1.siglin*=adjfrac;
00589                                                 strip->ph1.sigcor*=adjfrac;
00590                                                 strip->ph1.raw*=adjfrac;
00591                                         }
00592                                         
00593                                         
00594                                 }
00595                         }
00596                 }
00597         }       
00598 
00599 
00600 }


Member Data Documentation

Float_t XTalkFilter::_pixelSpotXTalkMap[8][9] [private]

Definition at line 79 of file XTalkFilter.h.

Int_t XTalkFilter::_pixelToVaChannel[16] [private]

Definition at line 78 of file XTalkFilter.h.

Referenced by Initialize().

Definition at line 105 of file XTalkFilter.h.

Referenced by CleanXTalk(), DoTrueFilter(), GetPixelMaps(), and XTalkFilter().

std::vector<PMT> XTalkFilter::east [private]

Definition at line 84 of file XTalkFilter.h.

Referenced by DoTrueFilter().

Definition at line 77 of file XTalkFilter.h.

Referenced by DoTrueFilter().

Definition at line 89 of file XTalkFilter.h.

Referenced by GetPixelMaps(), and XTalkFilter().

int XTalkFilter::method [private]

Definition at line 82 of file XTalkFilter.h.

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

std::vector<std::vector<std::pair<int, int> > > XTalkFilter::pixelmaps [private]

Definition at line 87 of file XTalkFilter.h.

Referenced by CleanXTalk(), GetHops(), and GetPixelMaps().

int XTalkFilter::printit = -1 [static]

Definition at line 71 of file XTalkFilter.h.

Referenced by CleanXTalk(), DoTrueFilter(), SaveAdjustment(), and XTalkFilter().

std::vector<PMT> XTalkFilter::west [private]

Definition at line 85 of file XTalkFilter.h.

Referenced by DoTrueFilter().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1