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

Detailed Description

Definition at line 9 of file AlgFarDetStripList.h.


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.

References fPairList, and fVaList.

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

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

Reimplemented from AlgBase.

Definition at line 264 of file AlgFarDetStripList.cxx.

00265 {
00266 
00267 }


Member Data Documentation

TObjArray* AlgFarDetStripList::fPairList [private]

Definition at line 20 of file AlgFarDetStripList.h.

Referenced by RunAlg(), and ~AlgFarDetStripList().

TObjArray* AlgFarDetStripList::fVaList [private]

Definition at line 21 of file AlgFarDetStripList.h.

Referenced by RunAlg(), and ~AlgFarDetStripList().

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 2 Nov 2017 for loon by  doxygen 1.6.1