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

Public Member Functions | |
| AlgFilterDigitListAB () | |
| virtual | ~AlgFilterDigitListAB () |
| virtual void | RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx) |
| virtual void | Trace (const char *c) const |
Private Member Functions | |
| Bool_t | IsPmt (CandDigitHandle *cdh) const |
| Bool_t | IsTpmt (CandDigitHandle *cdh) const |
| Bool_t | IsVetoShield (CandDigitHandle *cdh) const |
Private Attributes | |
| TObjArray * | fShieldList |
| TObjArray * | fTpmtList |
| TObjArray * | fPreTrigList |
| TObjArray * | fPostTrigList |
| TObjArray * | fMyTrigList |
| TObjArray | fDigitList [500] |
|
|
Definition at line 28 of file AlgFilterDigitListAB.cxx. References fMyTrigList, fPostTrigList, fPreTrigList, fShieldList, and fTpmtList. 00029 {
00030 fTpmtList = new TObjArray();
00031 fShieldList = new TObjArray();
00032 fPreTrigList = new TObjArray();
00033 fPostTrigList = new TObjArray();
00034 fMyTrigList = new TObjArray();
00035 }
|
|
|
Definition at line 37 of file AlgFilterDigitListAB.cxx. 00038 {
00039 delete fTpmtList;
00040 delete fShieldList;
00041 delete fPreTrigList;
00042 delete fPostTrigList;
00043 delete fMyTrigList;
00044 }
|
|
|
Definition at line 367 of file AlgFilterDigitListAB.cxx. References CandDigitHandle::GetChannelId(), and RawChannelId::GetVaChannel(). Referenced by RunAlg(). 00368 {
00369 Bool_t ispmt=0;
00370 Int_t vachannel = cdh->GetChannelId().GetVaChannel();
00371 if( vachannel>=2 && vachannel<=17 ) ispmt=1;
00372 return ispmt;
00373 }
|
|
|
Definition at line 380 of file AlgFilterDigitListAB.cxx. References CandDigitHandle::GetChannelId(), RawChannelId::GetCrate(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChannel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), and RawChannelId::GetVmm(). Referenced by RunAlg(). 00381 {
00382 Bool_t istpmt=0;
00383 Int_t crate = cdh->GetChannelId().GetCrate();
00384 Int_t varc = cdh->GetChannelId().GetVarcId();
00385 Int_t vmm = cdh->GetChannelId().GetVmm();
00386 Int_t vaadc = cdh->GetChannelId().GetVaAdcSel();
00387 Int_t vachip = cdh->GetChannelId().GetVaChip();
00388 Int_t vachannel = cdh->GetChannelId().GetVaChannel();
00389 if( crate==1 && varc==2 && vmm==5 && vaadc==0 && vachip==1
00390 && vachannel>=2 && vachannel<=17 ) istpmt=1;
00391 return istpmt;
00392 }
|
|
|
Definition at line 375 of file AlgFilterDigitListAB.cxx. References CandDigitHandle::GetPlexSEIdAltL(), and PlexSEIdAltL::IsVetoShield(). Referenced by RunAlg(). 00376 {
00377 return cdh->GetPlexSEIdAltL().IsVetoShield();
00378 }
|
|
||||||||||||||||
|
Implements AlgBase. Definition at line 46 of file AlgFilterDigitListAB.cxx. References CandHandle::AddDaughterLink(), fDigitList, fMyTrigList, fPostTrigList, fPreTrigList, fShieldList, fTpmtList, CandDigitListHandle::GetAbsTime(), CandDigitHandle::GetChannelId(), RawChannelId::GetCrate(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), Registry::GetDouble(), Registry::GetInt(), CandHandle::GetNDaughters(), PlexSEIdAltL::GetPlane(), CandDigitHandle::GetPlexSEIdAltL(), CandDigitHandle::GetTime(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChannel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RawChannelId::GetVmm(), IsPmt(), IsTpmt(), IsVetoShield(), max, MSG, and CandDigitListHandle::SetAbsTime(). 00047 {
00048
00049 MSG("AlgFilterDigitListAB", Msg::kDebug) << " *** AlgFilterDigitListAB::RunAlg(...) *** " << endl;
00050
00051 CandDigitListHandle& mylist = dynamic_cast<CandDigitListHandle&>(ch);
00052
00053 /*******************************
00054 * U N P A C K S T U F F *
00055 *******************************/
00056
00057 MSG("AlgFilterDigitListAB",Msg::kDebug) << " *** UNPACK ALGCONFIG *** " << endl;
00058 Int_t fPlaneWindow=10;
00059 Double_t fPreTrigWindow=50;
00060 Double_t fPostTrigWindow=500;
00061 fPlaneWindow = ac.GetInt("PlaneWindow"); if(fPlaneWindow<0) fPlaneWindow=0;
00062 fPreTrigWindow = ac.GetDouble("PreTrigWindow"); if(fPreTrigWindow<0.0) fPreTrigWindow=0.0;
00063 fPostTrigWindow = ac.GetDouble("PostTrigWindow"); if(fPostTrigWindow<156.25) fPostTrigWindow=156.25;
00064 MSG("AlgFilterDigitListAB",Msg::kDebug) << " Configuration : " << endl
00065 << " PlaneWindow = " << fPlaneWindow << endl
00066 << " PreTrigWindow = " << fPreTrigWindow << endl
00067 << " PostTrigWindow = " << fPostTrigWindow << endl;
00068
00069 MSG("AlgFilterDigitListAB",Msg::kDebug) << " *** UNPACK CANDCONTEXT *** " << endl;
00070 const CandDigitListHandle* cdlh = dynamic_cast<const CandDigitListHandle*>(cx.GetDataIn());
00071 if( !cdlh ){
00072 MSG("AlgFilterDigitListAB", Msg::kFatal) << " CAN'T FIND CANDDIGITLIST ...AAGGGHHHH! " << endl;
00073 }
00074
00075 /*****************************
00076 * S O R T D I G I T S *
00077 *****************************/
00078
00079 MSG("AlgFilterDigitListAB", Msg::kDebug) << " *** SORTING DIGITS *** " << endl;
00080 Int_t i,j;
00081 Double_t time,abstime;
00082 Double_t timeOld,timeNew;
00083 Int_t sliceid,max,pass;
00084 Int_t ctr,ctr1,ctr2;
00085 Int_t flag,plane;
00086
00087 CandDigitHandleItr digitr(cdlh->GetDaughterIterator());
00088 CandDigitHandleKeyFunc *digkf = digitr.CreateKeyFunc();
00089 digkf->SetFun(KeyFromDigitTime);
00090 digitr.GetSet()->AdoptSortKeyFunc(digkf);
00091 digkf = 0;
00092
00093 abstime = cdlh->GetAbsTime();
00094
00095 while(CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(digitr())){
00096 if(cdh){
00097 flag = 0;
00098 time = cdh->GetTime(CalTimeType::kNone);
00099 plane = cdh->GetPlexSEIdAltL().GetPlane();
00100 if( this->IsPmt(cdh) ){
00101 if( this->IsTpmt(cdh) ){ fTpmtList->Add(cdh); flag=1; }
00102 if( this->IsVetoShield(cdh) ){ fShieldList->Add(cdh); flag=1; }
00103 if( plane>0 && plane<500 && 1.0e9*(time-abstime)>=-156.25 ){ fPostTrigList->Add(cdh); flag=1; }
00104 if( plane>0 && plane<500 && 1.0e9*(time-abstime)<-156.25 ){ fPreTrigList->Add(cdh); flag=1; }
00105 if( flag==0 ){
00106 MSG("AlgFilterDigitListAB", Msg::kVerbose) << " Digit not assigned: " << cdh->GetChannelId().GetCrate() << " " << cdh->GetChannelId().GetVarcId() << " " << cdh->GetChannelId().GetVmm() << " " << cdh->GetChannelId().GetVaAdcSel() << " " << cdh->GetChannelId().GetVaChip() << " " << cdh->GetChannelId().GetVaChannel() << endl;
00107 }
00108 }
00109 }
00110 }
00111
00112
00113 MSG("AlgFilterDigitListAB", Msg::kDebug) << " Digits Before=" << cdlh->GetNDaughters() << " Digits After=" << 4+fPreTrigList->GetLast()+fPostTrigList->GetLast()+fShieldList->GetLast()+fTpmtList->GetLast() << endl;
00114 MSG("AlgFilterDigitListAB", Msg::kDebug) << " PRE-TRIGGER=" << 1+fPreTrigList->GetLast() << " POST-TRIGGER=" << 1+fPostTrigList->GetLast() << " SHIELD=" << 1+fShieldList->GetLast() << " TPMT=" << 1+fTpmtList->GetLast() << endl;
00115
00116 MSG("AlgFilterDigitListAB", Msg::kVerbose) << " Pre-Trigger Window : " << endl;
00117 for(i=0;i<1+fPreTrigList->GetLast();i++){
00118 CandDigitHandle* cdh = (CandDigitHandle*)(fPreTrigList->At(i));
00119 MSG("AlgFilterDigitListAB", Msg::kVerbose) << " " << cdh->GetPlexSEIdAltL().GetPlane() << " " << 1.0e9*(cdh->GetTime(CalTimeType::kNone)-abstime) << endl;
00120 }
00121
00122 MSG("AlgFilterDigitListAB", Msg::kVerbose) << " Post-Trigger Window : " << endl;
00123 for(i=0;i<1+fPostTrigList->GetLast();i++){
00124 CandDigitHandle* cdh = (CandDigitHandle*)(fPostTrigList->At(i));
00125 MSG("AlgFilterDigitListAB", Msg::kVerbose) << " " << cdh->GetPlexSEIdAltL().GetPlane() << " " << 1.0e9*(cdh->GetTime(CalTimeType::kNone)-abstime) << endl;
00126 }
00127
00128 MSG("AlgFilterDigitListAB", Msg::kVerbose) << " Shield Hits : " << endl;
00129 for(i=0;i<1+fShieldList->GetLast();i++){
00130 CandDigitHandle* cdh = (CandDigitHandle*)(fShieldList->At(i));
00131 MSG("AlgFilterDigitListAB", Msg::kVerbose) << " " << cdh->GetPlexSEIdAltL().GetPlane() << " " << 1.0e9*(cdh->GetTime(CalTimeType::kNone)-abstime) << endl;
00132 }
00133
00134 MSG("AlgFilterDigitListAB", Msg::kVerbose) << " Tpmt Hits : " << endl;
00135 for(i=0;i<1+fTpmtList->GetLast();i++){
00136 CandDigitHandle* cdh = (CandDigitHandle*)(fTpmtList->At(i));
00137 MSG("AlgFilterDigitListAB", Msg::kVerbose) << " TPMT " << 1.0e9*(cdh->GetTime(CalTimeType::kNone)-abstime) << endl;
00138 }
00139
00140 /*****************************************
00141 * A P P L Y G A P T R I G G E R *
00142 *****************************************/
00143
00144 MSG("AlgFilterDigitListAB", Msg::kDebug) << " *** APPLYING GAP TRIGGER *** " << endl;
00145 TObjArray* myslice = 0;
00146 timeOld=-99999;
00147
00148 for(i=0;i<1+fPostTrigList->GetLast();i++){
00149 CandDigitHandle* cdh = (CandDigitHandle*)(fPostTrigList->At(i));
00150 timeNew=1.0e9*(cdh->GetTime(CalTimeType::kNone)-abstime);
00151 if( timeNew-timeOld>157 ){
00152 MSG("AlgFilterDigitListAB", Msg::kVerbose) << " ... NEW SLICE: " << endl;
00153 myslice = new TObjArray();
00154 fMyTrigList->Add(myslice);
00155 }
00156 MSG("AlgFilterDigitListAB", Msg::kVerbose) << " Old=" << timeOld << " New=" << timeNew << " New-Old=" << timeNew-timeOld << endl;
00157 myslice->Add(cdh);
00158 timeOld=timeNew;
00159 }
00160
00161 MSG("AlgFilterDigitListAB", Msg::kDebug) << " FOUND " << 1+fMyTrigList->GetLast() << " SLICES : " << endl;
00162 for(i=0;i<1+fMyTrigList->GetLast();i++){
00163 myslice = (TObjArray*)(fMyTrigList->At(i));
00164 MSG("AlgFilterDigitListAB", Msg::kDebug) << " slice " << i << " : " << 1+myslice->GetLast() << " digits " << endl;
00165 }
00166
00167 sliceid=-1; max=-1;
00168 for(i=0;i<1+fMyTrigList->GetLast();i++){
00169 myslice = (TObjArray*)(fMyTrigList->At(i));
00170
00171 CandDigitHandle* myfirst = (CandDigitHandle*)(myslice->First());
00172 CandDigitHandle* mylast = (CandDigitHandle*)(myslice->Last());
00173
00174 pass=1;
00175 for(j=0;j<fTpmtList->GetLast();j++){
00176 CandDigitHandle* mytpmt = (CandDigitHandle*)(fTpmtList->At(j));
00177 if( 1.0e9*(mytpmt->GetTime(CalTimeType::kNone)-myfirst->GetTime(CalTimeType::kNone))>-312.50
00178 && 1.0e9*(mytpmt->GetTime(CalTimeType::kNone)-mylast->GetTime(CalTimeType::kNone))<+156.25 ){
00179 pass=0;
00180 }
00181 }
00182
00183 if( pass==1 && 1+myslice->GetLast()>max ){
00184 sliceid=i; max=1+myslice->GetLast();
00185 }
00186 }
00187
00188 if( sliceid<0 ){
00189 MSG("AlgFilterDigitListAB",Msg::kWarning) << " WARNING : EVENT FAILS GAP TRIGGER " << endl;
00190 }
00191
00192 /*****************************************************
00193 * A P P L Y 4 / 5 P L A N E T R I G G E R *
00194 *****************************************************/
00195
00196 MSG("AlgFilterDigitListAB", Msg::kDebug) << " *** APPLYING 4/5 PLANE TRIGGER *** " << endl;
00197
00198 Int_t minplane = -999, maxplane = -999;
00199 Int_t mintrigplane,maxtrigplane;
00200 Double_t newabstime;
00201
00202 newabstime=-99999;
00203 mintrigplane=-99999; maxtrigplane=-99999;
00204
00205 if( sliceid>=0 ){
00206 MSG("AlgFilterDigitListAB", Msg::kDebug) << " ... using slice: " << sliceid << endl;
00207 myslice = (TObjArray*)(fMyTrigList->At(sliceid));
00208
00209 minplane=-999; maxplane=-999;
00210 for(i=0;i<1+myslice->GetLast();i++){
00211 CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(myslice->At(i));
00212 plane = cdh->GetPlexSEIdAltL().GetPlane();
00213 if( minplane<0 || plane<minplane ) minplane=plane;
00214 if( maxplane<0 || plane>maxplane ) maxplane=plane;
00215 fDigitList[plane].Add(cdh);
00216 }
00217
00218 if( minplane>=0 && maxplane>=0 ){
00219 MSG("AlgFilterDigitListAB",Msg::kDebug) << " MinPlane=" << minplane
00220 << " MaxPlane=" << maxplane << endl;
00221 }
00222
00223 if( minplane>=0 && maxplane>=0 ){
00224 for(plane=minplane;plane<=maxplane;plane++){
00225 if( 1+fDigitList[plane].GetLast()>0 ){
00226 pass=0;
00227 for(i=-4;i<=0;i++){
00228 if( !pass ){
00229 ctr=0;
00230 for(j=0;j<5;j++){
00231 if( plane+i+j>=minplane && plane+i+j<=maxplane
00232 && 1+fDigitList[plane+i+j].GetLast()>0 ) ctr++;
00233 }
00234 if( ctr>=4 ) pass=1;
00235 }
00236 }
00237 if( pass ){
00238 if( mintrigplane<0 || plane<mintrigplane ) mintrigplane=plane;
00239 if( maxtrigplane<0 || plane>maxtrigplane ) maxtrigplane=plane;
00240 }
00241 }
00242 }
00243 }
00244
00245 if( mintrigplane>=0 && maxtrigplane>=0 ){
00246 MSG("AlgFilterDigitListAB",Msg::kDebug) << " MinTrigPlane=" << mintrigplane
00247 << " MaxTrigPlane=" << maxtrigplane << endl;
00248 }
00249
00250 if( mintrigplane>=0 && maxtrigplane>=0 ){
00251 for(plane=mintrigplane;plane<=maxtrigplane;plane++){
00252 for(i=0;i<1+fDigitList[plane].GetLast();i++){
00253 CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(fDigitList[plane].At(i));
00254 time = cdh->GetTime(CalTimeType::kNone);
00255 if( newabstime<0 || time<newabstime ) newabstime=time;
00256 }
00257 }
00258 }
00259
00260 if( newabstime>=0 ){
00261 MSG("AlgFilterDigitListAB",Msg::kDebug) << " OldAbsTime=" << (Int_t)(1.0e9*abstime)
00262 << " NewAbsTime=" << (Int_t)(1.0e9*newabstime)
00263 << " (shift=" << (Int_t)(1.0e9*(newabstime-abstime)) << ")" << endl;
00264 }
00265
00266 if( newabstime>=0 ){
00267 abstime=newabstime;
00268 }
00269 }
00270
00271 if( mintrigplane<0 && maxtrigplane<0 ){
00272 MSG("AlgFilterDigitListAB",Msg::kWarning) << " WARNING : EVENT FAILS 4/5 PLANE TRIGGER " << endl;
00273 }
00274
00275 /*************************************************
00276 * A D D I N G D I G I T S T O L I S T *
00277 *************************************************/
00278
00279 MSG("AlgFilterDigitListAB",Msg::kDebug) << " *** ADDING DIGITS TO LIST *** " << endl;
00280
00281 MSG("AlgFilterDigitListAB",Msg::kDebug) << " Adding Post-Trigger hits ... " << endl;
00282 ctr1=0; ctr2=0;
00283 for(i=0;i<1+fPostTrigList->GetLast();i++){
00284 CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(fPostTrigList->At(i));
00285 plane = cdh->GetPlexSEIdAltL().GetPlane();
00286 time = cdh->GetTime(CalTimeType::kNone);
00287 pass = 0;
00288 if( mintrigplane>=0 && maxtrigplane>=0
00289 && plane-mintrigplane>=-fPlaneWindow && plane-maxtrigplane<=+fPlaneWindow
00290 && 1.0e9*(time-abstime)>=-fPreTrigWindow && 1.0e9*(time-abstime)<=+fPostTrigWindow ){
00291 pass = 1;
00292 }
00293 MSG("AlgFilterDigitListAB",Msg::kVerbose) << " "
00294 << " " << plane
00295 << " " << (Int_t)(1.0e9*(time-abstime))
00296 << " filter=" << pass << endl;
00297 if( pass ){
00298 mylist.AddDaughterLink(*cdh);
00299 ctr1++;
00300 }
00301 ctr2++;
00302 }
00303 MSG("AlgFilterDigitListAB",Msg::kDebug) << " ... Added " << ctr1 << "/" << ctr2 << " Hits " << endl;
00304
00305 MSG("AlgFilterDigitListAB",Msg::kDebug) << " Adding Pre-Trigger hits ... " << endl;
00306 ctr1=0; ctr2=0;
00307 for(i=0;i<1+fPreTrigList->GetLast();i++){
00308 CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(fPreTrigList->At(i));
00309 plane = cdh->GetPlexSEIdAltL().GetPlane();
00310 time = cdh->GetTime(CalTimeType::kNone);
00311 pass = 0;
00312 if( mintrigplane>=0 && maxtrigplane>=0
00313 && plane-mintrigplane>=-fPlaneWindow && plane-maxtrigplane<=+fPlaneWindow
00314 && 1.0e9*(time-abstime)>=-fPreTrigWindow && 1.0e9*(time-abstime)<=+fPostTrigWindow ){
00315 pass = 1;
00316 }
00317 MSG("AlgFilterDigitListAB",Msg::kVerbose) << " "
00318 << " " << plane
00319 << " " << (Int_t)(1.0e9*(time-abstime))
00320 << " filter=" << pass << endl;
00321 if( pass ){
00322 mylist.AddDaughterLink(*cdh);
00323 ctr1++;
00324 }
00325 ctr2++;
00326 }
00327 MSG("AlgFilterDigitListAB",Msg::kDebug) << " ... Added " << ctr1 << "/" << ctr2 << " Hits " << endl;
00328
00329 MSG("AlgFilterDigitListAB",Msg::kDebug) << " Adding Shield hits ... " << endl;
00330 ctr=0;
00331 for(i=0;i<1+fShieldList->GetLast();i++){
00332 CandDigitHandle* cdh = dynamic_cast<CandDigitHandle*>(fShieldList->At(i));
00333 mylist.AddDaughterLink(*cdh);
00334 ctr++;
00335 }
00336 MSG("AlgFilterDigitListAB",Msg::kDebug) << " ... Added " << ctr << " Hits " << endl;
00337
00338 mylist.SetAbsTime(abstime);
00339
00340
00341 // Clear Arrays
00342 MSG("AlgFilterDigitListAB",Msg::kDebug) << " *** CLEARING ARRAYS *** " << endl;
00343
00344 fPreTrigList->Clear();
00345 fPostTrigList->Clear();
00346 fShieldList->Clear();
00347 fTpmtList->Clear();
00348
00349 if( minplane>=0 && maxplane>=0 ){
00350 for(i=minplane;i<=maxplane;i++){
00351 fDigitList[i].Clear();
00352 }
00353 }
00354 MSG("AlgFilterDigitListAB",Msg::kVerbose) << " ... delete ... " << endl;
00355 fMyTrigList->Delete();
00356 MSG("AlgFilterDigitListAB",Msg::kVerbose) << " ... return ... " << endl;
00357
00358
00359 return;
00360 }
|
|
|
Reimplemented from AlgBase. Definition at line 362 of file AlgFilterDigitListAB.cxx. 00363 {
00364
00365 }
|
|
|
Definition at line 24 of file AlgFilterDigitListAB.h. Referenced by RunAlg(). |
|
|
Definition at line 23 of file AlgFilterDigitListAB.h. Referenced by AlgFilterDigitListAB(), and RunAlg(). |
|
|
Definition at line 22 of file AlgFilterDigitListAB.h. Referenced by AlgFilterDigitListAB(), and RunAlg(). |
|
|
Definition at line 21 of file AlgFilterDigitListAB.h. Referenced by AlgFilterDigitListAB(), and RunAlg(). |
|
|
Definition at line 19 of file AlgFilterDigitListAB.h. Referenced by AlgFilterDigitListAB(), and RunAlg(). |
|
|
Definition at line 20 of file AlgFilterDigitListAB.h. Referenced by AlgFilterDigitListAB(), and RunAlg(). |
1.3.9.1