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

AlgFarDetEvent Class Reference

#include <AlgFarDetEvent.h>

Inheritance diagram for AlgFarDetEvent:

AlgBase List of all members.

Public Member Functions

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

Private Attributes

TObjArray fStrpList [500]
TObjArray fTrkList [500]
TObjArray fShwList [500]

Constructor & Destructor Documentation

AlgFarDetEvent::AlgFarDetEvent  ) 
 

Definition at line 26 of file AlgFarDetEvent.cxx.

00027 {
00028 
00029 }   

AlgFarDetEvent::~AlgFarDetEvent  )  [virtual]
 

Definition at line 31 of file AlgFarDetEvent.cxx.

00032 {
00033 
00034 }


Member Function Documentation

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

Implements AlgBase.

Definition at line 36 of file AlgFarDetEvent.cxx.

References fShwList, fStrpList, fTrkList, CandStripHandle::GetCharge(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), CandRecoHandle::GetDirCosU(), CandRecoHandle::GetDirCosV(), CandRecoHandle::GetDirCosZ(), CandFitTrackHandle::GetEMCharge(), CandTrackHandle::GetMomentum(), CandFitTrackHandle::GetMomentumCurve(), CandStripHandle::GetPlane(), CandStripHandle::GetPlaneView(), CandStripHandle::GetStrip(), CandStripHandle::GetTPos(), CandRecoHandle::GetVtxPlane(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), CandStripHandle::GetZPos(), MSG, FarDetEventHandle::SetEMCharge(), FarDetEventHandle::SetMaxPlane(), FarDetEventHandle::SetMaxZ(), FarDetEventHandle::SetMinPlane(), FarDetEventHandle::SetMinZ(), FarDetEventHandle::SetMuDirCosU(), FarDetEventHandle::SetMuDirCosV(), FarDetEventHandle::SetMuDirCosZ(), FarDetEventHandle::SetMuMomentumCurve(), FarDetEventHandle::SetMuMomentumRange(), FarDetEventHandle::SetMuReco(), FarDetEventHandle::SetShwDirCosU(), FarDetEventHandle::SetShwDirCosV(), FarDetEventHandle::SetShwDirCosZ(), FarDetEventHandle::SetShwEnergyGeV(), FarDetEventHandle::SetShwEnergyPE(), FarDetEventHandle::SetShwEnergyPEcorr(), FarDetEventHandle::SetShwReco(), FarDetEventHandle::SetVtxPlane(), FarDetEventHandle::SetVtxU(), FarDetEventHandle::SetVtxV(), and FarDetEventHandle::SetVtxZ().

00038 {
00039   MSG("FarDetEvent",Msg::kDebug) << " AlgFarDetEvent::RunAlg(...) " << endl;
00040 
00041   FarDetEventHandle& myevent = dynamic_cast<FarDetEventHandle&>(ch);
00042 
00043   //unused:CandRecord* candrec = (CandRecord*)(cx.GetCandRecord());
00044   //unused:const VldContext *vldc = candrec->GetVldContext();
00045 
00046   // Unpack CandContext
00047   const TObjArray* myarray = dynamic_cast<const TObjArray*>(cx.GetDataIn());
00048 
00049   CandFitTrackListHandle* fitlist = (CandFitTrackListHandle*)(myarray->At(0));
00050   CandTrackListHandle* trklist = (CandTrackListHandle*)(myarray->At(1));
00051   CandShowerListHandle* shwlist = (CandShowerListHandle*)(myarray->At(2));
00052   CandStripListHandle* strplist = (CandStripListHandle*)(myarray->At(3));
00053 
00054   Double_t fMyTrkPE = 12.0; // muon PE per STRIP 
00055   Double_t fMyShwPE = 160.0; // shower GeV per PE 
00056 
00057   Int_t i,j,k;
00058   Double_t emcharge=0.0;
00059   Double_t vtxu=0.0,vtxv=0.0,vtxz=0.0;
00060   Int_t vtxpln=-999;
00061 
00062 
00063   // Strip Reconstruction
00064   Int_t minpln=-999,maxpln=-999;
00065   Double_t minz=-999.9,maxz=-999.9;
00066   Double_t Uwt=0.0,Uw=0.0,Vwt=0.0,Vw=0.0,Zwz=0.0,Zw=0.0;
00067 
00068   if( strplist ){
00069     TIter strpitr(strplist->GetDaughterIterator());
00070     while(CandStripHandle* strp = (CandStripHandle*)(strpitr())){
00071       if( strp ){
00072         if( strp->GetPlane()>0 && strp->GetPlane()<500 ){
00073           fStrpList[strp->GetPlane()].Add(strp);
00074         }
00075  
00076         if( strp->GetCharge()>2.0 ){
00077           if( minpln<0 || strp->GetPlane()<minpln ) minpln=strp->GetPlane();
00078           if( maxpln<0 || strp->GetPlane()>maxpln ) maxpln=strp->GetPlane();
00079           if( minz<0.0 || strp->GetZPos()<minz ) minz=strp->GetZPos();
00080           if( maxz<0.0 || strp->GetZPos()>maxz ) maxz=strp->GetZPos();
00081         }
00082 
00083         if( strp->GetPlaneView()==PlaneView::kU ){
00084           Uwt+=strp->GetCharge()*strp->GetTPos(); Uw+=strp->GetCharge();
00085           Zwz+=strp->GetCharge()*strp->GetZPos(); Zw+=strp->GetCharge();
00086         }
00087 
00088         if( strp->GetPlaneView()==PlaneView::kV ){
00089           Vwt+=strp->GetCharge()*strp->GetTPos(); Vw+=strp->GetCharge();
00090           Zwz+=strp->GetCharge()*strp->GetZPos(); Zw+=strp->GetCharge();
00091         }
00092       }
00093     }
00094 
00095     if( minpln<0 && maxpln<0 ){
00096       minpln=-999;
00097       maxpln=999;
00098       minz=-9999.9;
00099       maxz=9999.9;
00100     }
00101     
00102     if( Uw>0.0 ) vtxu=Uwt/Uw; if( Vw>0.0 ) vtxv=Vwt/Vw; if( Zw>0.0 ) vtxz=Zwz/Zw;
00103   }
00104 
00105   // Track Reconstruction
00106   Int_t trkflag=0,fitflag=0;
00107   Double_t diru=0.0, dirv=0.0, dirz=0.0;
00108   Double_t erange=0.0, ecurve=0.0;
00109 
00110   if( trklist ){
00111     TIter trkitr(trklist->GetDaughterIterator());
00112     while(CandTrackHandle* trk = (CandTrackHandle*)(trkitr())){
00113       if( trk ){
00114         if( trkflag==0 ){
00115           vtxpln = trk->GetVtxPlane();
00116           vtxu = trk->GetVtxU();
00117           vtxv = trk->GetVtxV();
00118           vtxz = trk->GetVtxZ();
00119           diru = trk->GetDirCosU();
00120           dirv = trk->GetDirCosV();
00121           dirz = trk->GetDirCosZ();
00122           erange = trk->GetMomentum();
00123         }
00124 
00125         if( trkflag==0 ){
00126           TIter strpitr(trk->GetDaughterIterator());
00127           while(CandStripHandle* strp = (CandStripHandle*)(strpitr())){
00128             if( strp->GetPlane()>0 && strp->GetPlane()<500 ){
00129               fTrkList[strp->GetPlane()].Add(strp);
00130             }
00131           }
00132         }
00133 
00134         if( trkflag==0 ) trkflag=1;
00135       }
00136     }
00137   }
00138 
00139   if( fitlist ){
00140     TIter fititr(fitlist->GetDaughterIterator());
00141     while(CandFitTrackHandle* fit = (CandFitTrackHandle*)(fititr())){
00142       if( fit ){
00143         if( fitflag==0 ){
00144           emcharge = fit->GetEMCharge();
00145           ecurve = fit->GetMomentumCurve();
00146         }
00147 
00148         if( fitflag==0 ) fitflag=1;
00149       }
00150     }
00151   }
00152 
00153 
00154   // Shower Reconstruction
00155   Int_t shwflag=0;
00156   Double_t qpe=0.0,qpecorr=0.0,qgev=0.0;
00157 
00158   if( shwlist ){
00159     TIter shwitr(shwlist->GetDaughterIterator());
00160     while(CandShowerHandle* shw = (CandShowerHandle*)(shwitr())){
00161       if( shw ){
00162         if( shwflag==0 ){
00163           if( trkflag==0 ) vtxpln = shw->GetVtxPlane();
00164         }
00165 
00166         if( ( trkflag==0 )
00167          || ( trkflag==1 && shw->GetVtxPlane()-vtxpln>-5 && shw->GetVtxPlane()-vtxpln<5 ) ){
00168           TIter strpitr(shw->GetDaughterIterator());
00169           while(CandStripHandle* strp = (CandStripHandle*)(strpitr())){
00170             if( strp->GetPlane()>0 && strp->GetPlane()<500 ){
00171               fShwList[strp->GetPlane()].Add(strp);
00172             }
00173           }
00174         }
00175 
00176         if( shwflag==0 ) shwflag=1;
00177       }
00178     }
00179   }
00180 
00181   Double_t trkpe=0.0,shwpe=0.0,shwpecorr=0.0;
00182   for(i=0;i<500;i++){
00183     for(j=0;j<1+fShwList[i].GetLast();j++){
00184       CandStripHandle* shwstrp = (CandStripHandle*)(fShwList[i].At(j));
00185       for(k=0;k<1+fTrkList[i].GetLast();k++){
00186         CandStripHandle* trkstrp = (CandStripHandle*)(fTrkList[i].At(k));
00187         if( shwstrp->GetPlane()==trkstrp->GetPlane()
00188          && shwstrp->GetStrip()==trkstrp->GetStrip() ){
00189 
00190           trkpe += fMyTrkPE;
00191 
00192         }
00193       }
00194       shwpe += shwstrp->GetCharge(CalDigitType::kPE);
00195       shwpecorr += shwstrp->GetCharge(CalDigitType::kSigCorr);
00196     }
00197   }
00198   qpe=shwpe-trkpe; qpecorr=shwpecorr-trkpe; qgev=qpecorr/fMyShwPE;
00199  
00200 
00201   // Clear Banks
00202   for(i=0;i<500;i++){
00203     fStrpList[i].Clear(); fTrkList[i].Clear(); fShwList[i].Clear();
00204   }
00205 
00206 
00207   // SetEvent Parameters
00208   myevent.SetMuReco(trkflag);
00209   myevent.SetMuDirCosU(diru);
00210   myevent.SetMuDirCosV(dirv);
00211   myevent.SetMuDirCosZ(dirz);
00212   myevent.SetMuMomentumRange(erange);
00213   myevent.SetMuMomentumCurve(ecurve);
00214 
00215   myevent.SetShwReco(shwflag);
00216   myevent.SetShwDirCosU(diru);
00217   myevent.SetShwDirCosV(dirv);
00218   myevent.SetShwDirCosZ(dirz);
00219   myevent.SetShwEnergyPE(qpe);
00220   myevent.SetShwEnergyPEcorr(qpecorr);
00221   myevent.SetShwEnergyGeV(qgev); 
00222 
00223   myevent.SetEMCharge(emcharge);
00224 
00225   myevent.SetVtxPlane(vtxpln);
00226   myevent.SetVtxU(vtxu);
00227   myevent.SetVtxV(vtxv);
00228   myevent.SetVtxZ(vtxz);
00229 
00230   myevent.SetMinPlane(minpln);
00231   myevent.SetMaxPlane(maxpln);
00232   myevent.SetMinZ(minz);
00233   myevent.SetMaxZ(maxz);
00234 
00235   return;
00236 }

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

Reimplemented from AlgBase.

Definition at line 238 of file AlgFarDetEvent.cxx.

00239 {
00240 
00241 }


Member Data Documentation

TObjArray AlgFarDetEvent::fShwList[500] [private]
 

Definition at line 20 of file AlgFarDetEvent.h.

Referenced by RunAlg().

TObjArray AlgFarDetEvent::fStrpList[500] [private]
 

Definition at line 18 of file AlgFarDetEvent.h.

Referenced by RunAlg().

TObjArray AlgFarDetEvent::fTrkList[500] [private]
 

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