#include <AlgFarDetShieldPlankList.h>
Inheritance diagram for AlgFarDetShieldPlankList:

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 |
|
|
Definition at line 21 of file AlgFarDetShieldPlankList.cxx.
|
|
|
Definition at line 27 of file AlgFarDetShieldPlankList.cxx. 00028 {
00029 if(fPairList) delete fPairList;
00030 }
|
|
||||||||||||||||
|
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(), PlexSEIdAltL::GetCurrentSEId(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), PlexSEIdAltL::GetEnd(), AlgFactory::GetInstance(), CandContext::GetMom(), PlexPlaneId::GetPlane(), PlexSEIdAltL::GetPlane(), CandDigitHandle::GetPlexSEIdAltL(), CandDigitHandle::GetSubtractedTime(), CandDigitHandle::GetTime(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChannel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RawChannelId::GetVmm(), PlexSEIdAltL::IsValid(), PlexSEIdAltL::IsVetoShield(), FarDetShieldPlank::MakeCandidate(), MSG, PlexSEIdAltL::Next(), PlexSEIdAltL::SetFirst(), 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
00056 //Find the lowest Plane value in the AltList to set as the key
00057 pln = cdh->GetPlexSEIdAltL().GetPlane();
00058 cdh->GetPlexSEIdAltL().SetFirst();
00059 while ( cdh->GetPlexSEIdAltL().IsValid() ) {
00060 if( cdh->GetPlexSEIdAltL().GetCurrentSEId().GetPlane() < pln )
00061 pln = cdh->GetPlexSEIdAltL().GetCurrentSEId().GetPlane();
00062 cdh->GetPlexSEIdAltL().Next();
00063 }
00064 cdh->GetPlexSEIdAltL().SetFirst();
00065 pln -= 500;
00066
00067 if( veto && pln>0 && pln<500 ){
00068 fDigiList[pln].Add(cdh);
00069 MSG("FarDetShieldPlank",Msg::kVerbose) << " digit : "
00070 << " " << cdh->GetPlexSEIdAltL().GetPlane()
00071 << " " << cdh->GetPlexSEIdAltL().GetEnd()
00072 << " " << cdh->GetCharge(CalDigitType::kNone)
00073 << " " << 1.0e9*cdh->GetSubtractedTime(CalTimeType::kNone) << endl;
00074 DigitsBefore++;
00075 }
00076 }
00077 }
00078
00079 // Pair up CandDigits
00080 for(i=0;i<500;i++){
00081 if(1+fDigiList[i].GetLast()>0){
00082
00083 for(j=0;j<1+fDigiList[i].GetLast();j++){
00084 CandDigitHandle* digit = (CandDigitHandle*)(fDigiList[i].At(j));
00085 const PlexSEIdAltL& pSEIdAltL = digit->GetPlexSEIdAltL();
00086 if(pSEIdAltL.GetEnd()==StripEnd::kNegative) northlist.Add(digit);
00087 if(pSEIdAltL.GetEnd()==StripEnd::kPositive) southlist.Add(digit);
00088 }
00089
00090 for(kn=0;kn<1+northlist.GetLast();kn++){
00091 CandDigitHandle* dign = (CandDigitHandle*)(northlist.At(kn));
00092 const PlexSEIdAltL& nSEIdAltL = dign->GetPlexSEIdAltL();
00093 match=0;
00094 for(kp=0;kp<1+southlist.GetLast();kp++){
00095 CandDigitHandle* digp = (CandDigitHandle*)(southlist.At(kp));
00096 const PlexSEIdAltL& pSEIdAltL = digp->GetPlexSEIdAltL();
00097 if( 1.0e9*(dign->GetTime(CalTimeType::kNone)-digp->GetTime(CalTimeType::kNone))>-500.0
00098 && 1.0e9*(dign->GetTime(CalTimeType::kNone)-digp->GetTime(CalTimeType::kNone))<500.0 ){
00099 for(PlexSEIdAltL::const_iterator itern = nSEIdAltL.begin();itern!=nSEIdAltL.end(); ++itern){
00100 for(PlexSEIdAltL::const_iterator iterp = pSEIdAltL.begin();iterp!=pSEIdAltL.end(); ++iterp){
00101 if((*itern).GetSEId().IsSameStrip((*iterp).GetSEId())) match=1;
00102 }
00103 }
00104 }
00105 }
00106 if(match) tmpn.Add(dign); else tmp1.Add(dign);
00107 }
00108
00109 for(kp=0;kp<1+southlist.GetLast();kp++){
00110 CandDigitHandle* digp = (CandDigitHandle*)(southlist.At(kp));
00111 const PlexSEIdAltL& pSEIdAltL = digp->GetPlexSEIdAltL();
00112 match=0;
00113 for(kn=0;kn<1+northlist.GetLast();kn++){
00114 CandDigitHandle* dign = (CandDigitHandle*)(northlist.At(kn));
00115 const PlexSEIdAltL& nSEIdAltL = dign->GetPlexSEIdAltL();
00116 if( 1.0e9*(dign->GetTime(CalTimeType::kNone)-digp->GetTime(CalTimeType::kNone))>-500.0
00117 && 1.0e9*(dign->GetTime(CalTimeType::kNone)-digp->GetTime(CalTimeType::kNone))<500.0 ){
00118 for(PlexSEIdAltL::const_iterator iterp = pSEIdAltL.begin();iterp!=pSEIdAltL.end(); ++iterp){
00119 for(PlexSEIdAltL::const_iterator itern = nSEIdAltL.begin();itern!=nSEIdAltL.end(); ++itern){
00120 if((*iterp).GetSEId().IsSameStrip((*itern).GetSEId())) match=1;
00121 }
00122 }
00123 }
00124 }
00125 if(match) tmpp.Add(digp); else tmp1.Add(digp);
00126 }
00127
00128 if( 1+tmpn.GetLast()>0 && 1+tmpp.GetLast()>0 ){
00129 for(kn=0;kn<1+tmpn.GetLast();kn++){
00130 CandDigitHandle* dign = (CandDigitHandle*)(tmpn.At(kn));
00131 const PlexSEIdAltL& nSEIdAltL = dign->GetPlexSEIdAltL();
00132 for(kp=0;kp<1+tmpp.GetLast();kp++){
00133 CandDigitHandle* digp = (CandDigitHandle*)(tmpp.At(kp));
00134 const PlexSEIdAltL& pSEIdAltL = digp->GetPlexSEIdAltL();
00135 if( 1.0e9*(dign->GetTime(CalTimeType::kNone)-digp->GetTime(CalTimeType::kNone))>-500.0
00136 && 1.0e9*(dign->GetTime(CalTimeType::kNone)-digp->GetTime(CalTimeType::kNone))<500.0 ){
00137 match=0;
00138 for(PlexSEIdAltL::const_iterator itern = nSEIdAltL.begin();itern!=nSEIdAltL.end(); ++itern){
00139 for(PlexSEIdAltL::const_iterator iterp = pSEIdAltL.begin();iterp!=pSEIdAltL.end(); ++iterp){
00140 if((*itern).GetSEId().IsSameStrip((*iterp).GetSEId())) match=1;
00141 }
00142 }
00143 if(match){
00144 TObjArray* myarray = new TObjArray();
00145 myarray->Add(dign); DigitsAfter++;
00146 myarray->Add(digp); DigitsAfter++;
00147 fPairList->Add(myarray);
00148 }
00149 }
00150 }
00151 }
00152 }
00153
00154 for(j=0;j<1+tmp1.GetLast();j++){
00155 CandDigitHandle* dig = (CandDigitHandle*)(tmp1.At(j));
00156 TObjArray* myarray = new TObjArray();
00157 myarray->Add(dig); DigitsAfter++;
00158 fPairList->Add(myarray);
00159 }
00160
00161 tmpn.Clear(); tmpp.Clear(); tmp1.Clear();
00162 northlist.Clear(); southlist.Clear();
00163 }
00164 }
00165
00166 // Print out list digit pairs
00167 for(Int_t i=0; i<1+fPairList->GetLast();i++){
00168 TObjArray* temparray = (TObjArray*)(fPairList->At(i));
00169 MSG("FarDetShieldPlank",Msg::kVerbose) << " " << i << ":" << endl;
00170
00171 CandDigitHandle* dig1 = (CandDigitHandle*)(temparray->At(0));
00172 if( dig1 ){
00173 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;
00174 }
00175
00176 CandDigitHandle* dig2 = (CandDigitHandle*)(temparray->At(1));
00177 if( dig2 ){
00178 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;
00179 }
00180 }
00181
00182 // Check on number digits
00183 MSG("FarDetShieldPlank",Msg::kDebug) << " DIGITS BEFORE = " << DigitsBefore << " DIGITS AFTER = " << DigitsAfter << endl;
00184
00185 // Make ShieldPlanks
00186 AlgFactory &af = AlgFactory::GetInstance();
00187 AlgHandle ahh = af.GetAlgHandle("AlgFarDetShieldPlank","default");
00188 CandContext cxx(this,cx.GetMom());
00189 cxx.SetCandRecord(candrec);
00190
00191 for(i=0;i<1+fPairList->GetLast();i++){
00192 TObjArray* mypair = (TObjArray*)(fPairList->At(i));
00193 cxx.SetDataIn(mypair);
00194 FarDetShieldPlankHandle myplank = FarDetShieldPlank::MakeCandidate(ahh,cxx);
00195 myplank.SetName("FarDetShieldPlank");
00196 myplank.SetTitle(TString("Created by FarDetShieldPlankList"));
00197 myplanklist.AddDaughterLink(myplank);
00198 }
00199
00200 for(i=0;i<500;i++){
00201 fDigiList[i].Clear();
00202 }
00203
00204 fPairList->Delete();
00205
00206 return;
00207 }
|
|
|
Reimplemented from AlgBase. Definition at line 210 of file AlgFarDetShieldPlankList.cxx. 00211 {
00212
00213 }
|
|
|
Definition at line 19 of file AlgFarDetShieldPlankList.h. Referenced by RunAlg(). |
|
|
Definition at line 20 of file AlgFarDetShieldPlankList.h. Referenced by RunAlg(). |
1.3.9.1