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

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

Constructor & Destructor Documentation

AlgFarDetDataQuality::AlgFarDetDataQuality  ) 
 

Definition at line 28 of file AlgFarDetDataQuality.cxx.

00029 {
00030 
00031 }

AlgFarDetDataQuality::~AlgFarDetDataQuality  ) 
 

Definition at line 33 of file AlgFarDetDataQuality.cxx.

00034 {
00035 
00036 }


Member Function Documentation

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

Implements AlgBase.

Definition at line 38 of file AlgFarDetDataQuality.cxx.

References CandHandle::AddDaughterLink(), AlgFactory::GetAlgHandle(), LiHeader::GetBox(), VaChip::GetCrate(), CandContext::GetDataIn(), SnarlHeader::GetDate(), SnarlHeader::GetHitPlnChannels(), SnarlHeader::GetHitShldChannels(), AlgFactory::GetInstance(), LiHeader::GetLed(), SnarlHeader::GetLiChannels(), SnarlHeader::GetMicrosec(), CandContext::GetMom(), VaChip::GetNanosec(), SnarlHeader::GetNanosec(), VaChip::GetPlane(), LiHeader::GetPulseHeight(), LiHeader::GetPulseWidth(), SnarlHeader::GetRun(), VaChip::GetShld(), SnarlHeader::GetSnarl(), SnarlHeader::GetTime(), LiHeader::GetTimeFrame(), SnarlHeader::GetTimeFrame(), VaChip::GetVaadc(), VaChip::GetVaChannel(), VaChip::GetVaChip(), VaChip::GetVaChipStatus(), VaChip::GetVarc(), VaChip::GetVmm(), VaChip::IsSameVmm(), FarDetDeadChip::MakeCandidate(), MSG, FarDetDataQualityHandle::SetBusyPlnChips(), FarDetDataQualityHandle::SetBusyShldChips(), FarDetDataQualityHandle::SetColdPlnChips(), FarDetDataQualityHandle::SetDate(), FarDetDataQualityHandle::SetDeadPlnChips(), FarDetDataQualityHandle::SetDeadShldChips(), FarDetDataQualityHandle::SetHitPlnChannels(), FarDetDataQualityHandle::SetHitShldChannels(), FarDetDataQualityHandle::SetHotPlnChips(), FarDetDataQualityHandle::SetLiBox(), FarDetDataQualityHandle::SetLiChannels(), FarDetDataQualityHandle::SetLiLed(), FarDetDataQualityHandle::SetLiPulseHeight(), FarDetDataQualityHandle::SetLiPulseWidth(), FarDetDataQualityHandle::SetMicrosec(), CandHandle::SetName(), FarDetDataQualityHandle::SetNanosec(), FarDetDataQualityHandle::SetRun(), FarDetDataQualityHandle::SetSnarl(), FarDetDataQualityHandle::SetTime(), FarDetDataQualityHandle::SetTimeFrame(), CandHandle::SetTitle(), FarDetDataQualityHandle::SetTpmtBox(), and FarDetDataQualityHandle::SetTpmtNanosec().

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

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

Reimplemented from AlgBase.

Definition at line 177 of file AlgFarDetDataQuality.cxx.

00178 {
00179 
00180 }


The documentation for this class was generated from the following files:
Generated on Thu Nov 1 15:55:23 2007 for loon by  doxygen 1.3.9.1