AlgFarDetDataQuality Class Reference

#include <AlgFarDetDataQuality.h>

Inheritance diagram for AlgFarDetDataQuality:
AlgBase

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 6 of file AlgFarDetDataQuality.h.


Constructor & Destructor Documentation

AlgFarDetDataQuality::AlgFarDetDataQuality (  ) 

Definition at line 30 of file AlgFarDetDataQuality.cxx.

00031 {
00032 
00033 }

AlgFarDetDataQuality::~AlgFarDetDataQuality (  ) 

Definition at line 35 of file AlgFarDetDataQuality.cxx.

00036 {
00037 
00038 }


Member Function Documentation

void AlgFarDetDataQuality::RunAlg ( AlgConfig ac,
CandHandle ch,
CandContext cx 
) [virtual]

Implements AlgBase.

Definition at line 40 of file AlgFarDetDataQuality.cxx.

References CandHandle::AddDaughterLink(), AlgFactory::GetAlgHandle(), LiHeader::GetBox(), VaChip::GetCrate(), SnarlHeader::GetCrateMask(), CandContext::GetDataIn(), SnarlHeader::GetDate(), VarcErrHeader::GetEtcErrors(), SnarlHeader::GetHitPlnChannels(), SnarlHeader::GetHitShldChannels(), AlgFactory::GetInstance(), LiHeader::GetLed(), SnarlHeader::GetLiChannels(), SnarlHeader::GetMicrosec(), CandContext::GetMom(), SnarlHeader::GetNanosec(), VaChip::GetNanosec(), VaChip::GetPlane(), LiHeader::GetPulseHeight(), LiHeader::GetPulseWidth(), SnarlHeader::GetRun(), VaChip::GetShld(), SnarlHeader::GetSnarl(), VarcErrHeader::GetSparsErrors(), SpillServHeader::GetSpillGpsError(), SpillServHeader::GetSpillStatus(), SpillServHeader::GetSpillType(), SnarlHeader::GetSubRun(), SnarlHeader::GetTime(), LiHeader::GetTimeFrame(), SnarlHeader::GetTimeFrame(), SpillServHeader::GetTimeFrame(), VarcErrHeader::GetTimeFrame(), VaChip::GetVaadc(), VaChip::GetVaChannel(), VaChip::GetVaChip(), VaChip::GetVaChipStatus(), VaChip::GetVarc(), VaChip::GetVmm(), id, VaChip::IsSameVmm(), VaChip::kBusy, VaChip::kCold, Msg::kDebug, VaChip::kHot, FarDetDeadChip::MakeCandidate(), MSG, FarDetDataQualityHandle::SetBusyPlnChips(), FarDetDataQualityHandle::SetBusyShldChips(), FarDetDataQualityHandle::SetColdPlnChips(), FarDetDataQualityHandle::SetColdShldChips(), FarDetDataQualityHandle::SetCrateMask(), FarDetDataQualityHandle::SetDate(), FarDetDataQualityHandle::SetDeadPlnChips(), FarDetDataQualityHandle::SetDeadShldChips(), FarDetDataQualityHandle::SetEtcErrors(), FarDetDataQualityHandle::SetHitPlnChannels(), FarDetDataQualityHandle::SetHitShldChannels(), FarDetDataQualityHandle::SetHotPlnChips(), FarDetDataQualityHandle::SetHotShldChips(), FarDetDataQualityHandle::SetLiBox(), FarDetDataQualityHandle::SetLiChannels(), FarDetDataQualityHandle::SetLiLed(), FarDetDataQualityHandle::SetLiPulseHeight(), FarDetDataQualityHandle::SetLiPulseWidth(), FarDetDataQualityHandle::SetMicrosec(), CandHandle::SetName(), FarDetDataQualityHandle::SetNanosec(), FarDetDataQualityHandle::SetRun(), FarDetDataQualityHandle::SetSnarl(), FarDetDataQualityHandle::SetSparsErrors(), FarDetDataQualityHandle::SetSpillGpsError(), FarDetDataQualityHandle::SetSpillStatus(), FarDetDataQualityHandle::SetSpillType(), FarDetDataQualityHandle::SetSubRun(), FarDetDataQualityHandle::SetTime(), FarDetDataQualityHandle::SetTimeFrame(), CandHandle::SetTitle(), FarDetDataQualityHandle::SetTpmtBox(), and FarDetDataQualityHandle::SetTpmtNanosec().

00041 {
00042   MSG("AlgFarDetDataQuality", Msg::kDebug) << " AlgFarDetDataQuality::RunAlg(...) " << endl;
00043 
00044   FarDetDataQualityHandle& fardet = dynamic_cast<FarDetDataQualityHandle&>(ch);
00045   const TObjArray* arr = dynamic_cast<const TObjArray*>(cx.GetDataIn()); 
00046 
00047   TObjArray* fChipList = new TObjArray(); 
00048 
00049   AlgFactory &af = AlgFactory::GetInstance();
00050   AlgHandle ahh = af.GetAlgHandle("AlgFarDetDeadChip", "default");
00051   CandContext cxx(this, cx.GetMom());
00052   cxx.SetCandRecord(cxx.GetCandRecord());
00053 
00054   Int_t crate,varc,vmm;
00055   Int_t hotplnchips,coldplnchips,busyplnchips;
00056   Int_t hotshldchips,coldshldchips,busyshldchips;
00057   Int_t tpmtbox,tpmtnanosec;  
00058   Int_t id,time;
00059   Int_t tot,tot0,tot1,tot2;
00060   Int_t i,j;
00061 
00062   SnarlHeader* snarlheader = (SnarlHeader*)(arr->At(0)); 
00063   TObjArray* badlist = (TObjArray*)(arr->At(1));
00064   TObjArray* busylist = (TObjArray*)(arr->At(2));
00065 
00066   if( snarlheader->GetHitPlnChannels()>0 ){
00067     fardet.SetRun(snarlheader->GetRun());
00068     fardet.SetSubRun(snarlheader->GetSubRun());
00069     fardet.SetSnarl(snarlheader->GetSnarl());
00070     fardet.SetDate(snarlheader->GetDate());
00071     fardet.SetTime(snarlheader->GetTime());
00072     fardet.SetTimeFrame(snarlheader->GetTimeFrame());
00073     fardet.SetMicrosec(snarlheader->GetMicrosec());
00074     fardet.SetNanosec(snarlheader->GetNanosec());
00075     fardet.SetLiChannels(snarlheader->GetLiChannels());
00076     fardet.SetHitPlnChannels(snarlheader->GetHitPlnChannels());
00077     fardet.SetHitShldChannels(snarlheader->GetHitShldChannels());
00078     fardet.SetCrateMask(snarlheader->GetCrateMask());
00079 
00080     coldplnchips=0; hotplnchips=0; coldshldchips=0; hotshldchips=0;
00081     for(i=0;i<1+badlist->GetLast();i++){
00082       VaChip* mychip = (VaChip*)(badlist->At(i));
00083       if( mychip->GetVaChipStatus()==VaChip::kCold ){
00084         fChipList->Add(mychip);
00085         if(mychip->GetPlane()>=0) coldplnchips++; if(mychip->GetShld()>=0) coldshldchips++; 
00086       }
00087       if( mychip->GetVaChipStatus()==VaChip::kHot ){
00088         fChipList->Add(mychip);
00089         if(mychip->GetPlane()>=0) hotplnchips++; if(mychip->GetShld()>=0) hotshldchips++;
00090       }
00091     }
00092 
00093     busyplnchips=0; busyshldchips=0; 
00094     for(i=0;i<1+busylist->GetLast();i++){
00095       VaChip* mychip = (VaChip*)(busylist->At(i));
00096       if( mychip->GetVaChipStatus()==VaChip::kBusy ){ 
00097         tot=0; tot0=0; tot1=0; tot2=0;
00098         for(j=0;j<1+busylist->GetLast();j++){
00099           VaChip* mychip2 = (VaChip*)(busylist->At(j));
00100           crate=mychip2->GetCrate(); varc=mychip2->GetVarc(); vmm=mychip2->GetVmm();
00101           if(mychip->IsSameVmm(crate,varc,vmm)){
00102             if( mychip->GetPlane()>=0 ){
00103               if( mychip2->GetNanosec()-mychip->GetNanosec()>=-500
00104                && mychip2->GetNanosec()-mychip->GetNanosec()<500 
00105                && 3*mychip2->GetVaadc()+mychip2->GetVaChip()<=3*mychip->GetVaadc()+mychip->GetVaChip() ) tot0++;
00106               if( mychip2->GetNanosec()-mychip->GetNanosec()<-500
00107                && mychip2->GetNanosec()-mychip->GetNanosec()>=-5000 ) tot1++;
00108               if( mychip2->GetNanosec()-mychip->GetNanosec()<-5000
00109                && mychip2->GetNanosec()-mychip->GetNanosec()>=-10000 ) tot2++;
00110             }
00111             if( mychip->GetShld()>=0 ){
00112               if( mychip2->GetNanosec()-mychip->GetNanosec()>=-5
00113                && mychip2->GetNanosec()-mychip->GetNanosec()<5 
00114                && 3*mychip2->GetVaadc()+mychip2->GetVaChip()<=3*mychip->GetVaadc()+mychip->GetVaChip() ) tot0++;
00115               if( mychip2->GetNanosec()-mychip->GetNanosec()<-5
00116                && mychip2->GetNanosec()-mychip->GetNanosec()>=-5000 ) tot1++;
00117               if( mychip2->GetNanosec()-mychip->GetNanosec()<-5000
00118                && mychip2->GetNanosec()-mychip->GetNanosec()>=-10000 ) tot2++;
00119             }
00120           }
00121         }
00122         tot=tot0; if(tot1>=1) tot+=tot1; if(tot1+tot2>=2) tot+=tot2;
00123         if( mychip->GetNanosec()-snarlheader->GetNanosec()>-tot*5000 ){
00124           fChipList->Add(mychip);      
00125           if(mychip->GetPlane()>=0) busyplnchips++; if(mychip->GetShld()>=0) busyshldchips++; 
00126        }
00127       } 
00128     }
00129 
00130     if(1+fChipList->GetLast()>0){
00131       for(i=0;i<1+fChipList->GetLast();i++){
00132         VaChip* mychip = (VaChip*)(fChipList->At(i));
00133         cxx.SetDataIn(mychip);
00134         FarDetDeadChipHandle mydeadchip = FarDetDeadChip::MakeCandidate(ahh,cxx);
00135         mydeadchip.SetName(TString("FarDetDeadChipHandle"));
00136         mydeadchip.SetTitle(TString("Created by FarDetDataQualityModule"));
00137         fardet.AddDaughterLink(mydeadchip);
00138       }
00139     }
00140 
00141     fardet.SetDeadPlnChips(coldplnchips);
00142     fardet.SetHotPlnChips(hotplnchips);
00143     fardet.SetColdPlnChips(coldplnchips);
00144     fardet.SetBusyPlnChips(busyplnchips);
00145 
00146     fardet.SetDeadShldChips(coldshldchips);
00147     fardet.SetHotShldChips(hotshldchips);
00148     fardet.SetColdShldChips(coldshldchips);
00149     fardet.SetBusyShldChips(busyshldchips);
00150     
00151   }
00152 
00153   LiHeader* liheader = (LiHeader*)(arr->At(3));
00154   TObjArray* tpmtlist = (TObjArray*)(arr->At(4));
00155   if( liheader->GetTimeFrame()==snarlheader->GetTimeFrame() ){
00156 
00157     fardet.SetLiBox(liheader->GetBox());
00158     fardet.SetLiLed(liheader->GetLed());
00159     fardet.SetLiPulseHeight(liheader->GetPulseHeight());
00160     fardet.SetLiPulseWidth(liheader->GetPulseWidth());
00161 
00162     id=-1; time=-1000000000;
00163     tpmtbox=-1; tpmtnanosec=0;  
00164     for(i=0;i<1+tpmtlist->GetLast();i++){
00165       VaChip* mychip = (VaChip*)(tpmtlist->At(i));   
00166       if( mychip->GetNanosec()-snarlheader->GetNanosec()<1000
00167        && mychip->GetNanosec()-snarlheader->GetNanosec()>time ){
00168         id=i; time=mychip->GetNanosec()-snarlheader->GetNanosec();
00169       }
00170     }
00171     if(id>-1){
00172       VaChip* mychip = (VaChip*)(tpmtlist->At(id));   
00173       tpmtbox=mychip->GetVaChannel();
00174       tpmtnanosec=mychip->GetNanosec()-snarlheader->GetNanosec();
00175     }
00176   
00177     fardet.SetTpmtBox(tpmtbox);
00178     fardet.SetTpmtNanosec(tpmtnanosec);
00179   }
00180 
00181   VarcErrHeader* varcerrheader = (VarcErrHeader*)(arr->At(5));
00182   if( varcerrheader->GetTimeFrame()==snarlheader->GetTimeFrame() ){
00183     fardet.SetSparsErrors(varcerrheader->GetSparsErrors());
00184     fardet.SetEtcErrors(varcerrheader->GetEtcErrors());
00185   }
00186 
00187   SpillServHeader* spillservheader = (SpillServHeader*)(arr->At(6));
00188   if( spillservheader->GetTimeFrame()==snarlheader->GetTimeFrame() ){
00189     fardet.SetSpillStatus(spillservheader->GetSpillStatus());
00190     fardet.SetSpillType(spillservheader->GetSpillType());
00191     fardet.SetSpillGpsError(spillservheader->GetSpillGpsError());
00192   }
00193 
00194   delete fChipList;
00195 
00196   return;
00197 }

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

Reimplemented from AlgBase.

Definition at line 199 of file AlgFarDetDataQuality.cxx.

00200 {
00201 
00202 }


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1