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

AlgFarDetShieldPlankList Class Reference

#include <AlgFarDetShieldPlankList.h>

Inheritance diagram for AlgFarDetShieldPlankList:

AlgBase List of all members.

Public Member Functions

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

Private Attributes

TObjArray fDigiList [500]
TObjArray * fPairList

Constructor & Destructor Documentation

AlgFarDetShieldPlankList::AlgFarDetShieldPlankList  ) 
 

Definition at line 21 of file AlgFarDetShieldPlankList.cxx.

00021                                                    :
00022   fPairList(0)
00023 {
00024   fPairList = new TObjArray();
00025 }

AlgFarDetShieldPlankList::~AlgFarDetShieldPlankList  )  [virtual]
 

Definition at line 27 of file AlgFarDetShieldPlankList.cxx.

00028 {
00029   if(fPairList) delete fPairList;
00030 }


Member Function Documentation

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

Implements AlgBase.

Definition at line 32 of file AlgFarDetShieldPlankList.cxx.

References CandHandle::AddDaughterLink(), digit(), fDigiList, fPairList, AlgFactory::GetAlgHandle(), CandContext::GetCandRecord(), CandDigitHandle::GetChannelId(), CandDigitHandle::GetCharge(), RawChannelId::GetCrate(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), PlexSEIdAltL::GetEnd(), AlgFactory::GetInstance(), CandContext::GetMom(), PlexSEIdAltL::GetPlane(), CandDigitHandle::GetPlexSEIdAltL(), CandDigitHandle::GetSubtractedTime(), CandDigitHandle::GetTime(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChannel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RawChannelId::GetVmm(), PlexSEIdAltL::IsVetoShield(), FarDetShieldPlank::MakeCandidate(), MSG, CandHandle::SetName(), and CandHandle::SetTitle().

00034 {
00035   MSG("FarDetShieldPlankList",Msg::kDebug) << " *** AlgFarDetShieldPlankList::RunAlg(...) *** "<<endl;
00036 
00037   FarDetShieldPlankListHandle& myplanklist = dynamic_cast<FarDetShieldPlankListHandle&>(ch);
00038 
00039   Int_t DigitsBefore=0,DigitsAfter=0;
00040 
00041   Int_t i,j,kn,kp;
00042   Int_t veto,pln,match;
00043   TObjArray northlist,southlist;
00044   TObjArray tmpn,tmpp,tmp1;
00045 
00046   // Unpack CandContext
00047   CandRecord* candrec = (CandRecord*)(cx.GetCandRecord());
00048   const TObjArray* inputarray = dynamic_cast<const TObjArray*>(cx.GetDataIn());
00049   const CandDigitListHandle *cdlh = dynamic_cast<const CandDigitListHandle*>(inputarray->At(0));
00050 
00051   TIter digitr(cdlh->GetDaughterIterator());
00052   while(CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(digitr())){
00053     if(cdh){
00054       veto = cdh->GetPlexSEIdAltL().IsVetoShield();
00055       pln = cdh->GetPlexSEIdAltL().GetPlane()-500;
00056       if( veto && pln>0 && pln<500 ){
00057         fDigiList[pln].Add(cdh);
00058         MSG("FarDetShieldPlank",Msg::kVerbose) << " digit : " 
00059                                                << " " << cdh->GetPlexSEIdAltL().GetPlane() 
00060                                                << " " << cdh->GetPlexSEIdAltL().GetEnd()
00061                                                << " " << cdh->GetCharge(CalDigitType::kNone) 
00062                                                << " " << 1.0e9*cdh->GetSubtractedTime(CalTimeType::kNone) << endl;
00063         DigitsBefore++;
00064       }
00065     }
00066   }
00067     
00068   // Pair up CandDigits
00069   for(i=0;i<500;i++){
00070     if(1+fDigiList[i].GetLast()>0){
00071     
00072       for(j=0;j<1+fDigiList[i].GetLast();j++){
00073         CandDigitHandle* digit = (CandDigitHandle*)(fDigiList[i].At(j));
00074         const PlexSEIdAltL& pSEIdAltL = digit->GetPlexSEIdAltL();
00075         if(pSEIdAltL.GetEnd()==StripEnd::kNegative) northlist.Add(digit);
00076         if(pSEIdAltL.GetEnd()==StripEnd::kPositive) southlist.Add(digit);
00077       }
00078 
00079       for(kn=0;kn<1+northlist.GetLast();kn++){
00080         CandDigitHandle* dign = (CandDigitHandle*)(northlist.At(kn));
00081         const PlexSEIdAltL& nSEIdAltL = dign->GetPlexSEIdAltL();
00082         match=0;
00083         for(kp=0;kp<1+southlist.GetLast();kp++){
00084           CandDigitHandle* digp = (CandDigitHandle*)(southlist.At(kp));
00085           const PlexSEIdAltL& pSEIdAltL = digp->GetPlexSEIdAltL();
00086           if( 1.0e9*(dign->GetTime(CalTimeType::kNone)-digp->GetTime(CalTimeType::kNone))>-500.0  
00087            && 1.0e9*(dign->GetTime(CalTimeType::kNone)-digp->GetTime(CalTimeType::kNone))<500.0 ){
00088             for(PlexSEIdAltL::const_iterator itern = nSEIdAltL.begin();itern!=nSEIdAltL.end(); ++itern){
00089               for(PlexSEIdAltL::const_iterator iterp = pSEIdAltL.begin();iterp!=pSEIdAltL.end(); ++iterp){
00090                 if((*itern).GetSEId().IsSameStrip((*iterp).GetSEId())) match=1;
00091               }
00092             }
00093           }
00094         }
00095         if(match) tmpn.Add(dign); else tmp1.Add(dign);
00096       }
00097 
00098       for(kp=0;kp<1+southlist.GetLast();kp++){
00099         CandDigitHandle* digp = (CandDigitHandle*)(southlist.At(kp));
00100         const PlexSEIdAltL& pSEIdAltL = digp->GetPlexSEIdAltL();
00101         match=0;
00102         for(kn=0;kn<1+northlist.GetLast();kn++){
00103           CandDigitHandle* dign = (CandDigitHandle*)(northlist.At(kn));
00104           const PlexSEIdAltL& nSEIdAltL = dign->GetPlexSEIdAltL();
00105           if( 1.0e9*(dign->GetTime(CalTimeType::kNone)-digp->GetTime(CalTimeType::kNone))>-500.0  
00106            && 1.0e9*(dign->GetTime(CalTimeType::kNone)-digp->GetTime(CalTimeType::kNone))<500.0 ){
00107             for(PlexSEIdAltL::const_iterator iterp = pSEIdAltL.begin();iterp!=pSEIdAltL.end(); ++iterp){
00108               for(PlexSEIdAltL::const_iterator itern = nSEIdAltL.begin();itern!=nSEIdAltL.end(); ++itern){
00109                 if((*iterp).GetSEId().IsSameStrip((*itern).GetSEId())) match=1;
00110               }
00111             }
00112           }
00113         }
00114         if(match) tmpp.Add(digp); else tmp1.Add(digp);
00115       }
00116 
00117       if( 1+tmpn.GetLast()>0 && 1+tmpp.GetLast()>0 ){
00118         for(kn=0;kn<1+tmpn.GetLast();kn++){
00119           CandDigitHandle* dign = (CandDigitHandle*)(tmpn.At(kn));
00120           const PlexSEIdAltL& nSEIdAltL = dign->GetPlexSEIdAltL();   
00121           for(kp=0;kp<1+tmpp.GetLast();kp++){
00122             CandDigitHandle* digp = (CandDigitHandle*)(tmpp.At(kp));
00123             const PlexSEIdAltL& pSEIdAltL = digp->GetPlexSEIdAltL();
00124             if( 1.0e9*(dign->GetTime(CalTimeType::kNone)-digp->GetTime(CalTimeType::kNone))>-500.0  
00125              && 1.0e9*(dign->GetTime(CalTimeType::kNone)-digp->GetTime(CalTimeType::kNone))<500.0 ){
00126               match=0;
00127               for(PlexSEIdAltL::const_iterator itern = nSEIdAltL.begin();itern!=nSEIdAltL.end(); ++itern){
00128                 for(PlexSEIdAltL::const_iterator iterp = pSEIdAltL.begin();iterp!=pSEIdAltL.end(); ++iterp){
00129                   if((*itern).GetSEId().IsSameStrip((*iterp).GetSEId())) match=1;
00130                 }
00131               }
00132               if(match){
00133                 TObjArray* myarray = new TObjArray();
00134                 myarray->Add(dign); DigitsAfter++; 
00135                 myarray->Add(digp); DigitsAfter++;
00136                 fPairList->Add(myarray);
00137               }
00138             }
00139           }
00140         }
00141       }
00142 
00143       for(j=0;j<1+tmp1.GetLast();j++){
00144         CandDigitHandle* dig = (CandDigitHandle*)(tmp1.At(j));
00145         TObjArray* myarray = new TObjArray();
00146         myarray->Add(dig); DigitsAfter++; 
00147         fPairList->Add(myarray);
00148       }
00149       
00150       tmpn.Clear(); tmpp.Clear(); tmp1.Clear(); 
00151       northlist.Clear(); southlist.Clear();
00152     }
00153   }
00154 
00155   // Print out list digit pairs
00156   for(Int_t i=0; i<1+fPairList->GetLast();i++){
00157     TObjArray* temparray = (TObjArray*)(fPairList->At(i));
00158     MSG("FarDetShieldPlank",Msg::kVerbose) << " " << i << ":" << endl;
00159 
00160     CandDigitHandle* dig1 = (CandDigitHandle*)(temparray->At(0));
00161     if( dig1 ){
00162       MSG("FarDetShieldPlank",Msg::kVerbose) << "  (1) " <<  dig1->GetPlexSEIdAltL().GetPlane() << " " << dig1->GetPlexSEIdAltL().GetEnd() << " " << dig1->GetCharge(CalDigitType::kNone) << " " << 1.0e9*dig1->GetSubtractedTime(CalTimeType::kNone) << " " << "(" << dig1->GetChannelId().GetCrate() << "-" << dig1->GetChannelId().GetVarcId() << "-" << dig1->GetChannelId().GetVmm() << "-" << dig1->GetChannelId().GetVaAdcSel() << "-" << dig1->GetChannelId().GetVaChip() << "-" << dig1->GetChannelId().GetVaChannel() << ")" << endl;
00163     }
00164 
00165     CandDigitHandle* dig2 = (CandDigitHandle*)(temparray->At(1));
00166     if( dig2 ){
00167       MSG("FarDetShieldPlank",Msg::kVerbose) << "  (2) " <<  dig2->GetPlexSEIdAltL().GetPlane() << " " << dig2->GetPlexSEIdAltL().GetEnd() << " " << dig2->GetCharge(CalDigitType::kNone) << " " << 1.0e9*dig2->GetSubtractedTime(CalTimeType::kNone) << " " << "(" << dig2->GetChannelId().GetCrate() << "-" << dig2->GetChannelId().GetVarcId() << "-" << dig2->GetChannelId().GetVmm() << "-" << dig2->GetChannelId().GetVaAdcSel() << "-" << dig2->GetChannelId().GetVaChip() << "-" << dig2->GetChannelId().GetVaChannel() << ")" << endl;
00168     }
00169   }
00170 
00171   // Check on number digits
00172   MSG("FarDetShieldPlank",Msg::kDebug) << "  DIGITS BEFORE = " << DigitsBefore << "  DIGITS AFTER = " << DigitsAfter << endl;
00173 
00174   // Make ShieldPlanks
00175   AlgFactory &af = AlgFactory::GetInstance();
00176   AlgHandle ahh = af.GetAlgHandle("AlgFarDetShieldPlank","default");
00177   CandContext cxx(this,cx.GetMom());
00178   cxx.SetCandRecord(candrec);
00179 
00180   for(i=0;i<1+fPairList->GetLast();i++){
00181     TObjArray* mypair = (TObjArray*)(fPairList->At(i));
00182     cxx.SetDataIn(mypair);
00183     FarDetShieldPlankHandle myplank = FarDetShieldPlank::MakeCandidate(ahh,cxx);
00184     myplank.SetName("FarDetShieldPlank");
00185     myplank.SetTitle(TString("Created by FarDetShieldPlankList"));
00186     myplanklist.AddDaughterLink(myplank);
00187   }
00188 
00189   for(i=0;i<500;i++){
00190     fDigiList[i].Clear();
00191   }
00192 
00193   fPairList->Delete();
00194 
00195   return;
00196 }

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

Reimplemented from AlgBase.

Definition at line 199 of file AlgFarDetShieldPlankList.cxx.

00200 {
00201 
00202 }


Member Data Documentation

TObjArray AlgFarDetShieldPlankList::fDigiList[500] [private]
 

Definition at line 19 of file AlgFarDetShieldPlankList.h.

Referenced by RunAlg().

TObjArray* AlgFarDetShieldPlankList::fPairList [private]
 

Definition at line 20 of file AlgFarDetShieldPlankList.h.

Referenced by RunAlg().


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