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

AlgFarDetStripList Class Reference

#include <AlgFarDetStripList.h>

Inheritance diagram for AlgFarDetStripList:

AlgBase List of all members.

Public Member Functions

 AlgFarDetStripList ()
virtual ~AlgFarDetStripList ()
virtual void RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx)
virtual void Trace (const char *c) const

Private Attributes

TObjArray fVfbList [300]
TObjArray * fPairList
TObjArray * fVaList

Constructor & Destructor Documentation

AlgFarDetStripList::AlgFarDetStripList  ) 
 

Definition at line 25 of file AlgFarDetStripList.cxx.

00025                                        :
00026   fPairList(0),
00027   fVaList(0)
00028 {
00029   fPairList = new TObjArray();
00030   fVaList = new TObjArray();
00031 }   

AlgFarDetStripList::~AlgFarDetStripList  )  [virtual]
 

Definition at line 33 of file AlgFarDetStripList.cxx.

00034 {
00035   if(fPairList) delete fPairList;
00036   if(fVaList) delete fVaList;
00037 }


Member Function Documentation

void AlgFarDetStripList::RunAlg AlgConfig ac,
CandHandle ch,
CandContext cx
[virtual]
 

Implements AlgBase.

Definition at line 39 of file AlgFarDetStripList.cxx.

References VaDigit::AddCrossTalk(), CandHandle::AddDaughterLink(), fPairList, fVaList, fVfbList, AlgFactory::GetAlgHandle(), CandContext::GetCandRecord(), CandDigitHandle::GetChannelId(), CandDigitHandle::GetCharge(), RawChannelId::GetCrate(), VaDigit::GetCrossTalk(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), CandDeMuxDigitHandle::GetDeMuxDigitFlagWord(), PlexSEIdAltL::GetEnd(), AlgFactory::GetInstance(), Registry::GetInt(), CandContext::GetMom(), PlexSEIdAltL::GetPlane(), CandDigitHandle::GetPlexSEIdAltL(), CandDigitHandle::GetSubtractedTime(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChannel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RawChannelId::GetVmm(), VaDigit::IsSamePmt(), VaDigit::IsSameStrip(), VaDigit::IsSameTime(), FarDetStrip::MakeCandidate(), MSG, CandHandle::SetName(), and CandHandle::SetTitle().

00040 {
00041   MSG("FarDetStrip",Msg::kDebug) << " AlgFarDetStripList::RunAlg(...) " << endl;
00042 
00043   FarDetStripListHandle& mystriplist = dynamic_cast<FarDetStripListHandle&>(ch);
00044 
00045   Int_t fRemoveCrossTalk;
00046   fRemoveCrossTalk = ac.GetInt("RemoveCrossTalk");
00047   MSG("FarDetStrip",Msg::kVerbose) << " RemoveCrossTalk=" << fRemoveCrossTalk << endl;
00048 
00049   Int_t DigitsBefore=0,DigitsAfter=0;
00050 
00051   Double_t overlap;
00052   Int_t i,j,ie,iw,je,jw,ke,kw;
00053   Int_t pln,bin,match,xtalk;
00054   Int_t crate,varc,vmm,vaadc,vachip,vachannel;
00055   TObjArray tmpe,tmpw,tmps;
00056   TObjArray eastlist,westlist,tmplist;  
00057   TObjArray eastxtalklist,westxtalklist;
00058 
00059   // Unpack CandContext
00060   const CandDigitListHandle* cdlh = dynamic_cast<const CandDigitListHandle*>(cx.GetDataIn());
00061   TIter digitr(cdlh->GetDaughterIterator());
00062   while(CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(digitr())){
00063     if(cdh){
00064       pln = cdh->GetPlexSEIdAltL().GetPlane();
00065       if( pln>0 && pln<500 ){
00066         RawChannelId rawch = cdh->GetChannelId();    
00067         crate = rawch.GetCrate();
00068         varc = rawch.GetVarcId();
00069         vmm = rawch.GetVmm();
00070         vaadc = rawch.GetVaAdcSel();
00071         vachip = rawch.GetVaChip();
00072         vachannel = rawch.GetVaChannel();
00073         if( crate<16 && varc<3 && vmm<6 && vaadc<2 && vachip<3 
00074          && vachannel>=2 && vachannel<=17 ){
00075           if(cdh->GetPlexSEIdAltL().GetEnd()==StripEnd::kPositive){ // west (odd)
00076             bin = 36*(crate/2)+12*(1+(1-varc))+2*(vmm)+(vaadc);
00077           }
00078           if(cdh->GetPlexSEIdAltL().GetEnd()==StripEnd::kNegative){ // east (even)
00079             bin = 36*(crate/2)+12*(1-(1-varc))+2*(vmm)+(vaadc);
00080           }
00081           if( bin>=0 && bin<300 ){
00082             fVfbList[bin].Add(cdh);
00083 
00084             CandDeMuxDigitHandle* cddh = dynamic_cast<CandDeMuxDigitHandle*>(cdh);
00085             xtalk=0;
00086             if( ( cddh->GetDeMuxDigitFlagWord()<8 )
00087              && ( (cddh->GetDeMuxDigitFlagWord() & CandDeMuxDigit::kXTalk)==(CandDeMuxDigit::kXTalk) ) ){
00088               xtalk=1; 
00089             }
00090 
00091             MSG("FarDetStrip",Msg::kVerbose) << " digit : "
00092                                              << " " << cdh->GetPlexSEIdAltL().GetPlane() 
00093                                              << " " << cdh->GetPlexSEIdAltL().GetEnd()
00094                                              << " " << cdh->GetCharge(CalDigitType::kNone) 
00095                                              << " " << 1.0e9*cdh->GetSubtractedTime(CalTimeType::kNone) 
00096                                              << " " << xtalk << endl;
00097 
00098             DigitsBefore++; 
00099           }
00100         }
00101       }
00102     } 
00103   }
00104 
00105   // Loop over Vfbs
00106   for(i=0;i<300;i++){
00107     if(1+fVfbList[i].GetLast()>0){
00108 
00109       // Deal with Crosstalk
00110       for(j=0;j<1+fVfbList[i].GetLast();j++){
00111         CandDeMuxDigitHandle* digit = (CandDeMuxDigitHandle*)(fVfbList[i].At(j));
00112         xtalk=0;
00113         if( fRemoveCrossTalk
00114          && ( digit->GetDeMuxDigitFlagWord()<8 )
00115          && ( (digit->GetDeMuxDigitFlagWord() & CandDeMuxDigit::kXTalk)==(CandDeMuxDigit::kXTalk) ) ){
00116           xtalk=1; 
00117         }
00118         if(digit->GetPlexSEIdAltL().GetEnd()==StripEnd::kPositive){ 
00119           if(!xtalk){
00120             VaDigit* vadigit = new VaDigit(digit);
00121             westlist.Add(vadigit); fVaList->Add(vadigit);
00122           } 
00123           else westxtalklist.Add(digit); 
00124         }
00125         if(digit->GetPlexSEIdAltL().GetEnd()==StripEnd::kNegative){ 
00126           if(!xtalk){
00127             VaDigit* vadigit = new VaDigit(digit);
00128             eastlist.Add(vadigit); fVaList->Add(vadigit);
00129           }
00130           else eastxtalklist.Add(digit); 
00131         }
00132       }
00133 
00134       for(iw=0;iw<1+westxtalklist.GetLast();iw++){
00135         CandDigitHandle* xtalkdigit = (CandDigitHandle*)(westxtalklist.At(iw));
00136         tmplist.Clear();
00137         for(jw=0;jw<1+westlist.GetLast();jw++){
00138           VaDigit* vadigit = (VaDigit*)(westlist.At(jw)); 
00139           if(vadigit->IsSamePmt(xtalkdigit)) tmplist.Add(vadigit);
00140         }
00141         if( 1+tmplist.GetLast()>0 ){
00142           overlap=0.0;
00143           for(jw=0;jw<1+tmplist.GetLast();jw++){
00144             VaDigit* vadigit = (VaDigit*)(tmplist.At(jw));
00145             overlap += vadigit->GetCrossTalk(xtalkdigit);
00146           }
00147           if( overlap>0.0){
00148             for(jw=0;jw<1+tmplist.GetLast();jw++){
00149               VaDigit* vadigit = (VaDigit*)(tmplist.At(jw));
00150               vadigit->AddCrossTalk(xtalkdigit,overlap);
00151             }
00152           }
00153         }
00154         DigitsAfter++; 
00155       }
00156 
00157       for(ie=0;ie<1+eastxtalklist.GetLast();ie++){
00158         CandDigitHandle* xtalkdigit = (CandDigitHandle*)(eastxtalklist.At(ie));
00159         tmplist.Clear();
00160         for(je=0;je<1+eastlist.GetLast();je++){
00161           VaDigit* vadigit = (VaDigit*)(eastlist.At(je));  
00162           if(vadigit->IsSamePmt(xtalkdigit)) tmplist.Add(vadigit);
00163         }
00164         if( 1+tmplist.GetLast()>0 ){
00165           overlap = 0.0;
00166           for(je=0;je<1+tmplist.GetLast();je++){
00167             VaDigit* vadigit = (VaDigit*)(tmplist.At(je));      
00168             overlap += vadigit->GetCrossTalk(xtalkdigit);
00169           }
00170           if( overlap>0.0 ){
00171             for(je=0;je<1+tmplist.GetLast();je++){
00172               VaDigit* vadigit = (VaDigit*)(tmplist.At(je));
00173               vadigit->AddCrossTalk(xtalkdigit,overlap);
00174             }
00175           }
00176         }
00177         DigitsAfter++;
00178       }
00179 
00180       // Match up Digits
00181       for(kw=0;kw<1+westlist.GetLast();kw++){
00182         VaDigit* digw = (VaDigit*)(westlist.At(kw));
00183         match=0;
00184         for(ke=0;ke<1+eastlist.GetLast();ke++){
00185           VaDigit* dige = (VaDigit*)(eastlist.At(ke));
00186           if( digw->IsSameStrip(dige) 
00187            && digw->IsSameTime(dige) ) match=1;
00188         }
00189         if(match) tmpw.Add(digw); else tmps.Add(digw);
00190       }
00191 
00192       for(ke=0;ke<1+eastlist.GetLast();ke++){
00193         VaDigit* dige = (VaDigit*)(eastlist.At(ke));
00194         match=0;
00195         for(kw=0;kw<1+westlist.GetLast();kw++){
00196           VaDigit* digw = (VaDigit*)(westlist.At(kw));
00197           if( dige->IsSameStrip(digw) 
00198            && dige->IsSameTime(digw) ) match=1;
00199         }
00200         if(match) tmpe.Add(dige); else tmps.Add(dige);
00201       }
00202 
00203       if( 1+tmpe.GetLast()>0 && 1+tmpw.GetLast()>0 ){
00204         for(ke=0;ke<1+tmpe.GetLast();ke++){
00205           VaDigit* dige = (VaDigit*)(tmpe.At(ke));
00206           for(kw=0;kw<1+tmpw.GetLast();kw++){
00207             VaDigit* digw = (VaDigit*)(tmpw.At(kw));
00208             if( dige->IsSameStrip(digw) 
00209              && dige->IsSameTime(digw) ){
00210               TObjArray* myarray = new TObjArray();
00211               myarray->Add(dige); DigitsAfter++;
00212               myarray->Add(digw); DigitsAfter++;
00213 
00214               fPairList->Add(myarray);
00215             }
00216           }
00217         }
00218       }
00219 
00220       for(j=0;j<1+tmps.GetLast();j++){
00221         VaDigit* dig = (VaDigit*)(tmps.At(j));
00222         TObjArray* myarray = new TObjArray();
00223         myarray->Add(dig); DigitsAfter++; 
00224         fPairList->Add(myarray);
00225       }
00226       
00227       tmpe.Clear(); tmpw.Clear(); tmps.Clear();
00228       eastxtalklist.Clear(); westxtalklist.Clear(); 
00229       eastlist.Clear(); westlist.Clear();
00230     }
00231   }
00232 
00233   // Digit Check
00234   MSG("FarDetStrip",Msg::kDebug) << "  DIGITS BEFORE = " << DigitsBefore << "  DIGITS AFTER = " << DigitsAfter << endl;
00235 
00236   // Make CandStrips
00237   AlgFactory &af = AlgFactory::GetInstance();
00238   AlgHandle ahh = af.GetAlgHandle("AlgFarDetStrip","default");
00239   CandContext cxx(this,cx.GetMom());
00240   cxx.SetCandRecord(cx.GetCandRecord());
00241 
00242   for(i=0;i<1+fPairList->GetLast();i++){
00243     TObjArray* myarray = (TObjArray*)(fPairList->At(i));
00244 
00245     cxx.SetDataIn(myarray);
00246     FarDetStripHandle mystrip = FarDetStrip::MakeCandidate(ahh,cxx);
00247     mystrip.SetName("FarDetStrip");
00248     mystrip.SetTitle(TString("Created by AlgFarDetStripList"));
00249 
00250     mystriplist.AddDaughterLink(mystrip);
00251   }
00252 
00253   for(i=0;i<300;i++){
00254     fVfbList[i].Clear();
00255   }
00256 
00257   fPairList->Delete();
00258   fVaList->Delete();
00259 
00260 }

void AlgFarDetStripList::Trace const char *  c  )  const [virtual]
 

Reimplemented from AlgBase.

Definition at line 262 of file AlgFarDetStripList.cxx.

00263 {
00264 
00265 }


Member Data Documentation

TObjArray* AlgFarDetStripList::fPairList [private]
 

Definition at line 20 of file AlgFarDetStripList.h.

Referenced by RunAlg().

TObjArray* AlgFarDetStripList::fVaList [private]
 

Definition at line 21 of file AlgFarDetStripList.h.

Referenced by RunAlg().

TObjArray AlgFarDetStripList::fVfbList[300] [private]
 

Definition at line 19 of file AlgFarDetStripList.h.

Referenced by RunAlg().


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