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

AlgFilterDigitListAB Class Reference

#include <AlgFilterDigitListAB.h>

Inheritance diagram for AlgFilterDigitListAB:

AlgBase List of all members.

Public Member Functions

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

Private Attributes

TObjArray * fPostTrigList
TObjArray * fPreTrigList
TObjArray * fShieldList
TObjArray fDigitList [500]

Constructor & Destructor Documentation

AlgFilterDigitListAB::AlgFilterDigitListAB  ) 
 

Definition at line 21 of file AlgFilterDigitListAB.cxx.

00022 {
00023   fPostTrigList = new TObjArray();
00024   fPreTrigList = new TObjArray();
00025   fShieldList = new TObjArray();
00026 }

AlgFilterDigitListAB::~AlgFilterDigitListAB  )  [virtual]
 

Definition at line 28 of file AlgFilterDigitListAB.cxx.

00029 {
00030   delete fPostTrigList;
00031   delete fPreTrigList;
00032   delete fShieldList;
00033 }


Member Function Documentation

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

Implements AlgBase.

Definition at line 35 of file AlgFilterDigitListAB.cxx.

References CandHandle::AddDaughterLink(), fDigitList, fPostTrigList, fPreTrigList, fShieldList, CandDigitListHandle::GetAbsTime(), CandDigitHandle::GetChannelId(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), Registry::GetDouble(), Registry::GetInt(), PlexSEIdAltL::GetPlane(), CandDigitHandle::GetPlexSEIdAltL(), CandDigitHandle::GetTime(), RawChannelId::GetVaChannel(), PlexSEIdAltL::IsVetoShield(), MSG, and CandDigitListHandle::SetAbsTime().

00036 {
00037 
00038   MSG("AlgFilterDigitListAB", Msg::kDebug) << "AlgFilterDigitListAB::RunAlg(...)" << endl;
00039 
00040   CandDigitListHandle& mylist = dynamic_cast<CandDigitListHandle&>(ch);
00041 
00042   // Unpack AlgConfig 
00043   Int_t fPlaneWindow=10;
00044   Double_t fPreTrigWindow=50;
00045   Double_t fPostTrigWindow=500;
00046   fPlaneWindow = ac.GetInt("PlaneWindow"); if(fPlaneWindow<0) fPlaneWindow=0;
00047   fPreTrigWindow = ac.GetDouble("PreTrigWindow"); if(fPreTrigWindow<0.0) fPreTrigWindow=0.0;
00048   fPostTrigWindow = ac.GetDouble("PostTrigWindow"); if(fPostTrigWindow<150.0) fPostTrigWindow=150.0;
00049   MSG("AlgFilterDigitListAB",Msg::kDebug) << " PlaneWindow = " << fPlaneWindow << endl;
00050   MSG("AlgFilterDigitListAB", Msg::kDebug) << "  PreTrigWindow = " << fPreTrigWindow << endl;
00051   MSG("AlgFilterDigitListAB", Msg::kDebug) << "  PostTrigWindow = " << fPostTrigWindow << endl;
00052 
00053   // Unpack CandContext
00054   const CandDigitListHandle* cdlh = dynamic_cast<const CandDigitListHandle*>(cx.GetDataIn());
00055   if( !cdlh ){
00056     MSG("AlgFilterDigitListAB", Msg::kFatal) << " CAN'T FIND CANDDIGITLIST ... GOING TO DIE!" << endl;
00057   }
00058 
00059   Int_t i,j;
00060   Int_t plane,vachannel,isshield;
00061   Double_t time,abstime;
00062 
00063   abstime = cdlh->GetAbsTime();
00064   TIter digitr(cdlh->GetDaughterIterator());
00065   while(CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(digitr())){
00066     if(cdh){
00067       time = cdh->GetTime(CalTimeType::kNone);
00068       plane = cdh->GetPlexSEIdAltL().GetPlane();
00069       isshield = cdh->GetPlexSEIdAltL().IsVetoShield();
00070       vachannel = cdh->GetChannelId().GetVaChannel();
00071       if( vachannel>=2 && vachannel<=17 
00072        && plane>0 && plane<1000 ){
00073         if( isshield ) fShieldList->Add(cdh);
00074         if( plane<500 && 1.0e9*(time-abstime)>-150.0 ) fPostTrigList->Add(cdh);
00075         if( plane<500 && 1.0e9*(time-abstime)<-150.0 ) fPreTrigList->Add(cdh);
00076       }
00077     }
00078   }
00079   MSG("AlgFilterDigitListAB", Msg::kVerbose) << " Digits added : " 
00080                                                  << " Pre-Trig=" << 1+fPreTrigList->GetLast()
00081                                                  << " Post-Trig=" << 1+fPostTrigList->GetLast()
00082                                                  << " Shield=" << 1+fShieldList->GetLast() << endl;
00083 
00084   // Apply 4/5 Plane Trigger
00085   Int_t pass,ctr,ctr1,ctr2;
00086   Int_t minplane=-999,maxplane=-999;   
00087   Int_t mintrigplane=-999,maxtrigplane=-999;
00088   Double_t newabstime=-999.9;
00089 
00090   for(i=0;i<1+fPostTrigList->GetLast();i++){
00091     CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(fPostTrigList->At(i));
00092     plane = cdh->GetPlexSEIdAltL().GetPlane();
00093     if( minplane<0 || plane<minplane ) minplane=plane;
00094     if( maxplane<0 || plane>maxplane ) maxplane=plane;
00095     fDigitList[plane].Add(cdh);
00096   }
00097   if( minplane<0 && maxplane<0 ){
00098     minplane=1; maxplane=485;
00099   }
00100 
00101   MSG("AlgFilterDigitListAB",Msg::kDebug) << " MinPlane=" << minplane 
00102                                               << " MaxPlane=" << maxplane << endl;
00103 
00104   for(plane=minplane;plane<=maxplane;plane++){
00105     if( 1+fDigitList[plane].GetLast()>0 ){
00106       pass=0;
00107       for(i=-4;i<=0;i++){
00108         if( !pass ){
00109           ctr=0;
00110           for(j=0;j<5;j++){
00111             if( plane+i+j>=minplane && plane+i+j<=maxplane 
00112              && 1+fDigitList[plane+i+j].GetLast()>0 ) ctr++;
00113           }
00114           if( ctr>=4 ) pass=1;
00115         }
00116       }
00117       if( pass ){
00118         if( mintrigplane<0 || plane<mintrigplane ) mintrigplane=plane;
00119         if( maxtrigplane<0 || plane>maxtrigplane ) maxtrigplane=plane;
00120       }
00121     }
00122   }
00123   if( mintrigplane<0 && maxtrigplane<0 ){
00124     MSG("AlgFilterDigitListAB",Msg::kWarning) << " WARNING : EVENT FAILS 4/5 PLANE TRIGGER " << endl; 
00125     mintrigplane=minplane; maxtrigplane=maxplane;
00126   }
00127 
00128   MSG("AlgFilterDigitListAB",Msg::kDebug) << " MinTrigPlane=" << mintrigplane 
00129                                               << " MaxTrigPlane=" << maxtrigplane << endl;
00130   
00131   for(i=0;i<1+fPostTrigList->GetLast();i++){
00132     CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(fPostTrigList->At(i));
00133     plane = cdh->GetPlexSEIdAltL().GetPlane();
00134     time = cdh->GetTime(CalTimeType::kNone);
00135     if( plane>=mintrigplane && plane<=maxtrigplane ){
00136       if( newabstime<0 || time<newabstime ) newabstime=time;
00137     }
00138   }
00139   if( newabstime<0 ){
00140     newabstime=abstime;    
00141   }
00142 
00143   MSG("AlgFilterDigitListAB",Msg::kDebug) << " OldAbsTime=" << (Int_t)(1.0e9*abstime) 
00144                                               << " NewAbsTime=" << (Int_t)(1.0e9*newabstime)
00145                                               << " (shift=" << (Int_t)(1.0e9*(newabstime-abstime)) << ")" << endl;
00146 
00147   // Add Digits to List
00148   MSG("AlgFilterDigitListAB",Msg::kVerbose) << " Adding Post-Trigger hits ... " << endl;
00149   ctr1=0; ctr2=0;
00150   for(i=0;i<1+fPostTrigList->GetLast();i++){
00151     CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(fPostTrigList->At(i));
00152     plane = cdh->GetPlexSEIdAltL().GetPlane();
00153     time = cdh->GetTime(CalTimeType::kNone);
00154     pass = 0;
00155     if( plane-mintrigplane>=-fPlaneWindow && plane-maxtrigplane<=+fPlaneWindow
00156      && 1.0e9*(time-newabstime)>=-fPreTrigWindow && 1.0e9*(time-newabstime)<=+fPostTrigWindow ){
00157       pass = 1;
00158     }
00159     MSG("AlgFilterDigitListAB",Msg::kVerbose) << " "
00160                                                   << " " << plane
00161                                                   << " " << (Int_t)(1.0e9*(time-newabstime)) 
00162                                                   << " filter=" << pass << endl;
00163     if( pass ){
00164       mylist.AddDaughterLink(*cdh);
00165       ctr1++;
00166     }
00167     ctr2++;
00168   }
00169   MSG("AlgFilterDigitListAB",Msg::kVerbose) << "          ... Added " << ctr1 << " / " << ctr2 << " Hits " << endl;
00170 
00171   MSG("AlgFilterDigitListAB",Msg::kVerbose) << " Adding Pre-Trigger hits ... " << endl;
00172   ctr1=0; ctr2=0;
00173   for(i=0;i<1+fPreTrigList->GetLast();i++){
00174     CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(fPreTrigList->At(i));
00175     plane = cdh->GetPlexSEIdAltL().GetPlane();
00176     time = cdh->GetTime(CalTimeType::kNone);
00177     pass = 0;
00178     if( plane-mintrigplane>=-fPlaneWindow && plane-maxtrigplane<=+fPlaneWindow
00179      && 1.0e9*(time-newabstime)>=-fPreTrigWindow && 1.0e9*(time-newabstime)<=+fPostTrigWindow ){
00180       pass = 1;
00181     }
00182     MSG("AlgFilterDigitListAB",Msg::kVerbose) << " "
00183                                                   << " " << plane
00184                                                   << " " << (Int_t)(1.0e9*(time-newabstime)) 
00185                                                   << " filter=" << pass << endl;
00186     if( pass ){
00187       mylist.AddDaughterLink(*cdh);
00188       ctr1++;
00189     }
00190     ctr2++;
00191   }
00192   MSG("AlgFilterDigitListAB",Msg::kVerbose) << "          ... Added " << ctr1 << " / " << ctr2 << " Hits " << endl;
00193 
00194   MSG("AlgFilterDigitListAB",Msg::kVerbose) << " Adding Shield hits ... " << endl;
00195   ctr=0;
00196   for(i=0;i<1+fShieldList->GetLast();i++){
00197     CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(fShieldList->At(i));    
00198     mylist.AddDaughterLink(*cdh);
00199     ctr++;
00200   }
00201   MSG("AlgFilterDigitListAB",Msg::kVerbose) << "          ... Added " << ctr << " Hits " << endl;
00202 
00203   mylist.SetAbsTime(newabstime);  
00204 
00205 
00206   // Clear Arrays
00207   fPreTrigList->Clear();
00208   fPostTrigList->Clear();
00209   fShieldList->Clear();
00210 
00211   for(i=minplane;i<=maxplane;i++){
00212     fDigitList[i].Clear();
00213   }
00214 
00215   return;
00216 }

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

Reimplemented from AlgBase.

Definition at line 218 of file AlgFilterDigitListAB.cxx.

00219 {
00220 
00221 }


Member Data Documentation

TObjArray AlgFilterDigitListAB::fDigitList[500] [private]
 

Definition at line 20 of file AlgFilterDigitListAB.h.

Referenced by RunAlg().

TObjArray* AlgFilterDigitListAB::fPostTrigList [private]
 

Definition at line 17 of file AlgFilterDigitListAB.h.

Referenced by RunAlg().

TObjArray* AlgFilterDigitListAB::fPreTrigList [private]
 

Definition at line 18 of file AlgFilterDigitListAB.h.

Referenced by RunAlg().

TObjArray* AlgFilterDigitListAB::fShieldList [private]
 

Definition at line 19 of file AlgFilterDigitListAB.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