AlgShowerSS Class Reference

#include <AlgShowerSS.h>

Inheritance diagram for AlgShowerSS:
AlgShowerSR AlgBase AlgReco

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 14 of file AlgShowerSS.h.


Constructor & Destructor Documentation

AlgShowerSS::AlgShowerSS (  ) 

Definition at line 36 of file AlgShowerSS.cxx.

00037 {
00038 }

AlgShowerSS::~AlgShowerSS (  )  [virtual]

Definition at line 41 of file AlgShowerSS.cxx.

00042 {
00043 }


Member Function Documentation

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

Reimplemented from AlgShowerSR.

Definition at line 46 of file AlgShowerSS.cxx.

References AlgReco::Calibrate(), CandContext::GetDataIn(), CandStripHandle::GetPlane(), UgliGeomHandle::GetScintPlnHandle(), CandSubShowerSRHandle::GetSlope(), CandStripHandle::GetStripEndId(), CandHandle::GetVldContext(), CandRecoHandle::GetVtxPlane(), CandRecoHandle::GetVtxT(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), UgliPlnHandle::GetZ0(), Msg::kDebug, CalDigitType::kPE, PlaneView::kU, PlaneView::kV, MSG, and AlgShowerSR::SetUVT().

00047 {
00048 
00049   MSG("ShowerSS",Msg::kDebug) << "In AlgShowerSS::RunAlg" << endl;
00050   assert(ch.InheritsFrom("CandShowerSRHandle"));
00051   CandShowerSRHandle &csh = dynamic_cast<CandShowerSRHandle &>(ch);
00052 
00053   assert(cx.GetDataIn());
00054   assert(cx.GetDataIn()->InheritsFrom("TObjArray"));
00055   
00056   // grab parameters
00057   //Double_t MIPperGeV = ac.GetDouble("MIPperGeV");
00058 
00059   Double_t tend = 0;
00060   Double_t totEnergy = 0;
00061   Double_t maxUEnergy = 0;
00062   Double_t maxVEnergy = 0;
00063   Double_t earlyUZ = 100.;
00064   Double_t earlyVZ = 100.;
00065   Double_t earlyUend = 100.;
00066   Double_t earlyVend = 100.;
00067   Int_t earlyUPln = 500;
00068   Int_t earlyVPln = 500;
00069   Double_t earlyUPh = 0.;
00070   Double_t earlyVPh = 0.;
00071   Int_t biggestUSubShower = -1;
00072   Int_t biggestVSubShower = -1;
00073   CandStripHandle *begstrip = 0;
00074   CandStripHandle *endstrip = 0;
00075 
00076   const TObjArray *tary = dynamic_cast<const TObjArray*>(cx.GetDataIn());
00077   MSG("AlgShowerSS",Msg::kDebug) << "Passed " << tary->GetLast()+1 
00078                                  << " SubShowerSRHandles" << endl;
00079 
00080   for (Int_t i=0; i<=tary->GetLast(); i++) {
00081     TObject *tobj = tary->At(i);
00082     assert(tobj->InheritsFrom("CandSubShowerSRHandle"));
00083     CandSubShowerSRHandle *subshowerhandle = 
00084       dynamic_cast<CandSubShowerSRHandle*>(tobj);
00085     csh.AddSubShower(subshowerhandle);
00086     totEnergy += subshowerhandle->GetEnergy();
00087 
00088     MSG("AlgShowerSS",Msg::kDebug) << "Current energy " << totEnergy << endl;
00089     switch (subshowerhandle->GetPlaneView()) {
00090     case PlaneView::kU :
00091       MSG("AlgShowerSS",Msg::kDebug) << "U SubShower found" << endl;
00092       if(subshowerhandle->GetEnergy()>maxUEnergy){
00093         maxUEnergy = subshowerhandle->GetEnergy();
00094         biggestUSubShower = i;
00095       }
00096       if(subshowerhandle->GetVtxZ()<earlyUZ){
00097         earlyUZ = subshowerhandle->GetVtxZ();
00098         earlyUend = subshowerhandle->GetEndZ();
00099         earlyUPln = subshowerhandle->GetVtxPlane();
00100         earlyUPh = subshowerhandle->GetEnergy();
00101         MSG("AlgShowerSS",Msg::kDebug) <<"early U "<<earlyUZ 
00102                                        <<" end "<<earlyUend
00103                                        <<" ph "<<earlyUPh<<endl;
00104       }
00105       break;
00106     case PlaneView::kV :
00107       MSG("AlgShowerSS",Msg::kDebug) << "V SubShower found" << endl;
00108       if(subshowerhandle->GetEnergy()>maxVEnergy){
00109         maxVEnergy = subshowerhandle->GetEnergy();
00110         biggestVSubShower = i;
00111       }
00112       if(subshowerhandle->GetVtxZ()<earlyVZ){
00113         earlyVZ = subshowerhandle->GetVtxZ();
00114         earlyVend = subshowerhandle->GetEndZ();
00115         earlyVPln = subshowerhandle->GetVtxPlane();
00116         earlyVPh = subshowerhandle->GetEnergy();
00117         MSG("AlgShowerSS",Msg::kDebug) <<"early V "<<earlyVZ
00118                                        <<" end "<<earlyVend
00119                                        <<" ph "<<earlyVPh<<endl;
00120       }
00121       break;
00122     default:
00123       break;
00124     }
00125 
00126     CandStripHandleItr stripItr(subshowerhandle->GetDaughterIterator());
00127     while (CandStripHandle *strip = stripItr()) {
00128       csh.AddDaughterLink(*strip);
00129       if(strip->GetTime()>tend) tend = strip->GetTime();
00130       if (!begstrip || strip->GetPlane()<begstrip->GetPlane()) {
00131         begstrip = strip;
00132       }
00133       if (!endstrip || strip->GetPlane()>endstrip->GetPlane()) {
00134         endstrip = strip;
00135       }
00136     }
00137   }
00138 
00139   //bail if there is no subshower in either view
00140   if(biggestUSubShower==-1||biggestVSubShower==-1){
00141     MSG("AlgShowerSS", Msg::kDebug) 
00142       << "Insufficient SubShowerSR objects to form CandShowerSR" 
00143       << endl;
00144     csh.SetDirCosU(0.);
00145     csh.SetDirCosV(0.);
00146     csh.SetDirCosZ(1.);
00147     csh.SetVtxPlane(-1);
00148     csh.SetVtxZ(-1.);
00149     csh.SetVtxU(0.);
00150     csh.SetVtxV(0.);
00151     csh.SetVtxT(0.);
00152     csh.SetEndZ(-1.);
00153     csh.SetEndU(0.);
00154     csh.SetEndV(0.);
00155     csh.SetEndT(0.);
00156     csh.SetEnergy(0);
00157     return;
00158   }
00159 
00160 
00161   TObject *Uobj = tary->At(biggestUSubShower);  
00162   CandSubShowerSRHandle *bigUss = dynamic_cast<CandSubShowerSRHandle*>(Uobj);
00163   float dudz = bigUss->GetSlope();
00164 
00165   TObject *Vobj = tary->At(biggestVSubShower);  
00166   CandSubShowerSRHandle *bigVss = dynamic_cast<CandSubShowerSRHandle*>(Vobj);
00167   float dvdz = bigVss->GetSlope();
00168 
00169   float dsdz = TMath::Sqrt(1 + dudz*dudz + dvdz*dvdz);
00170   csh.SetDirCosU(dudz/dsdz);
00171   csh.SetDirCosV(dvdz/dsdz);
00172   csh.SetDirCosZ(1./dsdz);
00173 
00174   csh.SetEndDirCosU(dudz/dsdz);
00175   csh.SetEndDirCosV(dvdz/dsdz);
00176   csh.SetEndDirCosZ(1./dsdz);
00177   
00178   const VldContext *vc = begstrip->GetVldContext();
00179   UgliGeomHandle ugh(*vc);
00180   PlexStripEndId stripid = begstrip->GetStripEndId();
00181   UgliScintPlnHandle planehandle = ugh.GetScintPlnHandle(stripid);
00182 
00183   stripid = endstrip->GetStripEndId();
00184   planehandle = ugh.GetScintPlnHandle(stripid);
00185   csh.SetEndPlane(endstrip->GetPlane());
00186   csh.SetEndZ(planehandle.GetZ0());
00187   
00188   csh.SetVtxZ(bigUss->GetVtxZ());
00189   csh.SetVtxPlane(bigUss->GetVtxPlane());
00190   if(bigUss->GetVtxZ()>bigVss->GetVtxZ()) {
00191     csh.SetVtxZ(bigVss->GetVtxZ());
00192     csh.SetVtxPlane(bigVss->GetVtxPlane());
00193   }
00194 
00195   MSG("AlgShowerSS",Msg::kDebug) <<"big U Z "<<bigUss->GetVtxZ()
00196                                  <<" maxUEnergy "<<maxUEnergy
00197                                  <<" maxVEnergy "<<maxVEnergy
00198                                  <<" big V Z "<<bigVss->GetVtxZ()
00199                                  <<" early U "<<earlyUZ<<" end "
00200                                  <<earlyUend<<" ph "<<earlyUPh
00201                                  <<" early V "<<earlyVZ<<" end "
00202                                  <<earlyVend<<" ph "<<earlyVPh<<endl;
00203 
00204   //check if another high-ish energy U view subshower 
00205   //gives an earlier (but reasonable) Z vertex
00206   Double_t difUZ = csh.GetVtxZ()-earlyUZ;
00207   if(earlyUPh > 0.1*maxUEnergy && difUZ>0. && 
00208      (difUZ<0.25 || (difUZ>0.25 && difUZ<0.5 && 
00209                      bigUss->GetVtxZ() < earlyUend+0.15) ) ) {
00210     csh.SetVtxZ(earlyUZ);
00211     csh.SetVtxPlane(earlyUPln);
00212   }
00213   else difUZ = 0; //difUZ is invalid: disregard difVZ>difUZ when checking V
00214 
00215   //check if another high-ish energy V view subshower 
00216   //gives an earlier (but reasonable) Z vertex
00217   //also check that V view Z vertex is earlier than U view vertex
00218   //before changing shower vertex
00219   Double_t difVZ = csh.GetVtxZ()-earlyVZ;
00220   if(earlyVPh>0.1*maxVEnergy && difVZ>0. && difVZ>difUZ &&
00221      (difVZ<0.25 || (difUZ>0.25 && difUZ<0.5 &&
00222                      bigVss->GetVtxZ() < earlyVend+0.15 ) ) ){
00223     csh.SetVtxZ(earlyVZ);
00224     csh.SetVtxPlane(earlyVPln);
00225   }
00226 
00227   Double_t tvtx = bigUss->GetVtxT();
00228   if(bigVss->GetVtxT()<tvtx) tvtx = bigVss->GetVtxT();
00229   csh.SetVtxT(tvtx);
00230   csh.SetEndT(tend);
00231   
00232   SetUVT(&csh);
00233 
00234   if(TMath::Abs(bigUss->GetVtxU() - csh.GetU(csh.GetVtxPlane()))>0.5) {
00235     //one of these must be wrong
00236     //get ph-weighted tpos of all U strips in shower
00237     TIter stripItr(csh.GetDaughterIterator());
00238     Float_t totalCharge = 0;
00239     Float_t estimateU = 0;
00240     while (CandStripHandle *strip = 
00241            dynamic_cast<CandStripHandle*>(stripItr())) {
00242       if(strip->GetPlaneView()==PlaneView::kU) {
00243         totalCharge += strip->GetCharge(CalDigitType::kPE);
00244         estimateU += strip->GetCharge(CalDigitType::kPE) * strip->GetTPos();
00245       }
00246     }
00247     if(totalCharge>0) estimateU /= totalCharge;
00248     else estimateU = csh.GetU(csh.GetVtxPlane());
00249     MSG("AlgShowerSS",Msg::kDebug) << "estimateU = " << estimateU
00250                                    << " largest SS vtxU = " << bigUss->GetVtxU()
00251                                    << " vertex plane U = " 
00252                                    << csh.GetU(csh.GetVtxPlane()) << endl;
00253     if(TMath::Abs(estimateU - bigUss->GetVtxU()) > 
00254        TMath::Abs(estimateU - csh.GetU(csh.GetVtxPlane()))) 
00255       csh.SetVtxU(csh.GetU(csh.GetVtxPlane()));
00256     else csh.SetVtxU(bigUss->GetVtxU());
00257   }
00258   else csh.SetVtxU(csh.GetU(csh.GetVtxPlane()));
00259 
00260   if(TMath::Abs(bigVss->GetVtxV() - csh.GetV(csh.GetVtxPlane()))>0.5) {
00261     //one of these must be wrong
00262     //get ph-weighted tpos of all V strips in shower
00263     TIter stripItr(csh.GetDaughterIterator());
00264     Float_t totalCharge = 0;
00265     Float_t estimateV = 0;
00266     while (CandStripHandle *strip = 
00267            dynamic_cast<CandStripHandle*>(stripItr())) {
00268       if(strip->GetPlaneView()==PlaneView::kV) {
00269         totalCharge += strip->GetCharge(CalDigitType::kPE);
00270         estimateV += strip->GetCharge(CalDigitType::kPE) * strip->GetTPos();
00271       }
00272     }
00273     if(totalCharge>0) estimateV /= totalCharge;
00274     else estimateV = csh.GetV(csh.GetVtxPlane());
00275     MSG("AlgShowerSS",Msg::kDebug) << "estimateV = " << estimateV
00276                                    << " largest SS vtxV = " << bigVss->GetVtxV()
00277                                    << " vertex plane V = " 
00278                                    << csh.GetV(csh.GetVtxPlane()) << endl;
00279     if(TMath::Abs(estimateV - bigVss->GetVtxV()) > 
00280        TMath::Abs(estimateV - csh.GetV(csh.GetVtxPlane()))) 
00281       csh.SetVtxV(csh.GetV(csh.GetVtxPlane()));
00282     else csh.SetVtxV(bigVss->GetVtxV());
00283   }
00284   else csh.SetVtxV(csh.GetV(csh.GetVtxPlane()));
00285   
00286   csh.SetEndU(csh.GetU(csh.GetEndPlane()));
00287   csh.SetEndV(csh.GetV(csh.GetEndPlane()));
00288 
00289   Calibrate(&csh);
00290 
00291   CandTrackHandle * associatedtrk=0;
00292   csh.CalibrateEnergy(associatedtrk,ac);
00293 }

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

Reimplemented from AlgShowerSR.

Definition at line 296 of file AlgShowerSS.cxx.

00297 {
00298 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1