CandShowerHandle Class Reference

#include <CandShowerHandle.h>

Inheritance diagram for CandShowerHandle:
CandRecoHandle CandHandle CandShowerAtNuHandle CandShowerEMHandle CandShowerSRHandle CandFitShowerEMHandle

List of all members.

Public Types

enum  EShowerType {
  kCC = 0, kWtCC = 1, kNC = 2, kWtNC = 3,
  kEM = 4, kRawCC = 5
}
typedef enum
CandShowerHandle::EShowerType 
ShowerType_t

Public Member Functions

 CandShowerHandle ()
 CandShowerHandle (const CandShowerHandle &cdh)
 CandShowerHandle (CandShower *cd)
virtual ~CandShowerHandle ()
virtual CandShowerHandleDupHandle () const
virtual void Trace (const char *c="") const
void SetU (Int_t, Float_t)
Float_t GetU (Int_t) const
void SetV (Int_t, Float_t)
Float_t GetV (Int_t) const
Float_t GetZ (Int_t) const
virtual void ClearUVT ()
Bool_t IsTPosValid (Int_t) const
Float_t GetMinU (Int_t plane, Double_t minPE=0) const
Float_t GetMaxU (Int_t plane, Double_t minPE=0) const
Float_t GetMinV (Int_t plane, Double_t minPE=0) const
Float_t GetMaxV (Int_t plane, Double_t minPE=0) const
Int_t GetNStrips (Int_t)
void SetMinStripPE (Double_t)
Double_t GetMinStripPE () const
void SetT (Int_t, StripEnd::StripEnd_t, Double_t)
Double_t GetT (Int_t) const
Double_t GetT (Int_t, StripEnd::StripEnd_t) const
Double_t GetT (StripEnd::StripEnd_t, Int_t) const
virtual Bool_t BelongsWithTrack (CandTrackHandle *trk, AlgConfig &ac, const VldContext *vldcptr, Double_t tolTPos2, Double_t tolZPos, Double_t tolTime)
virtual Bool_t BelongsWithShower (CandShowerHandle *shw, AlgConfig &ac, const VldContext *vldcptr, Double_t tolTPos2, Double_t tolZPos, Double_t tolTime)
void AddCluster (CandClusterHandle *)
void RemoveCluster (CandClusterHandle *)
const CandClusterHandleGetCluster (Int_t) const
Int_t GetLastCluster () const
bool IsContained ()
virtual Bool_t IsUnphysical (Float_t xtalkFrac=0.660, Float_t xtalkCut=2.0)
void SetEnergy (Double_t, CandShowerHandle::EShowerType=kCC)
Double_t GetEnergy (CandShowerHandle::EShowerType=kCC) const
void CalibrateEnergy (CandTrackHandle *associatedtrk, AlgConfig &ac)
double ApplyRecoTrueCCCorrection (double energy, AlgConfig &ac, Detector::Detector_t det)
Double_t DeDx (Double_t)

Static Public Member Functions

static NavKey KeyFromSlice (const CandShowerHandle *)

Detailed Description

Definition at line 28 of file CandShowerHandle.h.


Member Typedef Documentation


Member Enumeration Documentation

Enumerator:
kCC 
kWtCC 
kNC 
kWtNC 
kEM 
kRawCC 

Definition at line 40 of file CandShowerHandle.h.

00040                           {
00041     kCC=0,
00042     kWtCC=1,
00043     kNC=2,
00044     kWtNC=3,
00045     kEM=4,
00046                 kRawCC=5 // Leigh: Added to store the uncorrected CC energy
00047   }ShowerType_t;


Constructor & Destructor Documentation

CandShowerHandle::CandShowerHandle (  ) 

Definition at line 41 of file CandShowerHandle.cxx.

Referenced by DupHandle().

00042 {
00043 }

CandShowerHandle::CandShowerHandle ( const CandShowerHandle cdh  ) 

Definition at line 46 of file CandShowerHandle.cxx.

00046                                                               :
00047   CandRecoHandle(cdh)
00048 {
00049 }

CandShowerHandle::CandShowerHandle ( CandShower cd  ) 

Definition at line 52 of file CandShowerHandle.cxx.

00052                                                  :
00053   CandRecoHandle(cd)
00054 {
00055 }

CandShowerHandle::~CandShowerHandle (  )  [virtual]

Definition at line 58 of file CandShowerHandle.cxx.

00059 {
00060 }


Member Function Documentation

void CandShowerHandle::AddCluster ( CandClusterHandle cluster  ) 

Definition at line 632 of file CandShowerHandle.cxx.

References CandClusterHandle::DupHandle(), and CandHandle::GetOwnedCandBase().

Referenced by AlgEventSRList::AddStripToEvent().

00633 {
00634   const TObjArray &clusterlist =
00635                (dynamic_cast<CandShower*>(GetOwnedCandBase()))->fClusterList;
00636   Bool_t found(0);
00637   for (Int_t i=0; i<=clusterlist.GetLast() && !found; i++) {
00638     CandClusterHandle *target =
00639                     dynamic_cast<CandClusterHandle*>(clusterlist.At(i));
00640     if (*cluster == *target) found = 1;
00641   }
00642   if (!found) {                 // don't want to duplicate object in list
00643     CandClusterHandle * cl=cluster->DupHandle();
00644     (dynamic_cast<CandShower*>(GetOwnedCandBase()))->fClusterList.
00645       Add(cl);
00646   }
00647   return;
00648 }

double CandShowerHandle::ApplyRecoTrueCCCorrection ( double  energy,
AlgConfig ac,
Detector::Detector_t  det 
)

Definition at line 1038 of file CandShowerHandle.cxx.

References Registry::GetDouble(), Detector::kFar, Detector::kNear, Msg::kWarning, and MSG.

Referenced by CalibrateEnergy().

01038                                                                                                       {
01039 
01040         // Which detector are we in.
01041         std::string detName = "";
01042         if(det == Detector::kNear) detName = "Near";
01043         else if(det == Detector::kFar) detName = "Far";
01044 
01045         double correction = 1.0; // Main correction
01046         double correction2 = 1.0; // Second order correction
01047 
01048         // If for some reason we aren't in the near or far detectors, don't do anything.
01049         if(detName != ""){
01050                 Double_t p0 = ac.GetDouble(("shwRecoTrueCC"+detName+"_p0").c_str());
01051                 Double_t p1 = ac.GetDouble(("shwRecoTrueCC"+detName+"_p1").c_str());
01052                 Double_t p2 = ac.GetDouble(("shwRecoTrueCC"+detName+"_p2").c_str());
01053                 Double_t p3 = ac.GetDouble(("shwRecoTrueCC"+detName+"_p3").c_str());
01054                 Double_t p4 = ac.GetDouble(("shwRecoTrueCC"+detName+"_p4").c_str());
01055                 Double_t p5 = ac.GetDouble(("shwRecoTrueCC"+detName+"_p5").c_str());
01056         
01057                 double tempE = energy;
01058 
01059                 // Quadratic term to fit the dip which is switched off by the error function
01060                 // leaving the constant term at high energy.
01061                 correction = (p0 + p1*tempE + p2*tempE*tempE)*0.5*TMath::Erfc(p3*(tempE-p4)) + p5;
01062 
01063                 Double_t s0 = ac.GetDouble(("shwRecoTrueCC"+detName+"_s0").c_str());
01064                 Double_t s1 = ac.GetDouble(("shwRecoTrueCC"+detName+"_s1").c_str());
01065                 Double_t s2 = ac.GetDouble(("shwRecoTrueCC"+detName+"_s2").c_str());
01066 
01067                 // Secondary s0 - s1*e^-(s2*E) correction
01068                 correction2 = s0 - s1*TMath::Exp(-s2*tempE);
01069         }
01070         else MSG("RecoBase",Msg::kWarning) << "CandShowerHandle::ApplyRecoTrueCCCorrection: " << 
01071                         "Can only apply the correction to Near or Far Detector, returning the input energy." << std::endl;
01072 
01073         // Return the corrected energy
01074         return energy*correction*correction2;
01075 } 

Bool_t CandShowerHandle::BelongsWithShower ( CandShowerHandle shw,
AlgConfig ac,
const VldContext vldcptr,
Double_t  tolTPos2,
Double_t  tolZPos,
Double_t  tolTime 
) [virtual]

Definition at line 535 of file CandShowerHandle.cxx.

References VldContext::GetDetector(), CandRecoHandle::GetEndPlane(), CandRecoHandle::GetEndU(), CandRecoHandle::GetEndV(), CandRecoHandle::GetEndZ(), GetEnergy(), Registry::GetInt(), UgliGeomHandle::GetScintPlnHandle(), CandRecoHandle::GetVtxPlane(), CandRecoHandle::GetVtxT(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), UgliPlnHandle::GetZ0(), UgliScintPlnHandle::IsValid(), Msg::kDebug, Detector::kFar, and MSG.

Referenced by AlgEventSRList::BuildEventFromUnassoc(), and AlgEventSRList::RunAlg().

00538                                                                                                 {
00539 
00540   if(!shw)return false;
00541 
00542   Int_t pSMPlaneLast = ac.GetInt("SMPlaneLast");
00543   Int_t pSMPlaneFirst = ac.GetInt("SMPlaneFirst");
00544   VldContext vldc = *vldcptr;
00545   UgliGeomHandle ugh(vldc); 
00546   Double_t zGapSM=0;
00547 
00548   // "Fixed": MAK, Feb 8, 2005
00549   // GetScintPlnHandle was being called in the ND for planes which didn't
00550   // have any scint. This fix only stops the block below from being called
00551   // in the near detector.  It doesn't require that 
00552   // pSMPlaneLast, pSMPlaneFirst actually refer to planes with scintillator!!
00553   if(vldc.GetDetector() == Detector::kFar){
00554      // calculate Z gap between SM for later use
00555      PlexPlaneId scintlastid(vldc.GetDetector(),pSMPlaneLast,kFALSE);
00556      PlexPlaneId scintfirstid(vldc.GetDetector(),pSMPlaneFirst,kFALSE);
00557      UgliScintPlnHandle scintlast = ugh.GetScintPlnHandle(scintlastid);
00558      UgliScintPlnHandle scintfirst = ugh.GetScintPlnHandle(scintfirstid);
00559      if (scintlast.IsValid() && scintfirst.IsValid()) {  
00560         zGapSM=scintfirst.GetZ0()-scintlast.GetZ0()-0.0594;
00561      } 
00562   }
00563 
00564   MSG("RecoBase",Msg::kDebug) << " shower extents " << this->GetVtxZ() << " " << this->GetEndZ() << " " << shw->GetVtxZ() << " " << shw->GetEndZ() << endl;
00565   Double_t dz = this->GetVtxZ()-shw->GetVtxZ();
00566   Double_t dzend= this->GetEndZ()-shw->GetVtxZ();
00567   Double_t dzend2= this->GetVtxZ()-shw->GetEndZ();
00568   Double_t dzend3= this->GetEndZ()-shw->GetEndZ();
00569   Double_t du= this->GetVtxU()-shw->GetVtxU();
00570   Double_t dv= this->GetVtxV()-shw->GetVtxV();  
00571   Double_t dt= this->GetVtxT()-shw->GetVtxT();
00572  
00573   //compensate dz for SM gap if necessary
00574   if (vldcptr->GetDetector()==Detector::kFar &&
00575       this->GetVtxPlane()<=pSMPlaneLast &&
00576       shw->GetVtxPlane()>=pSMPlaneFirst) dz+=zGapSM;
00577   else if (vldcptr->GetDetector()==Detector::kFar &&
00578            this->GetVtxPlane()>=pSMPlaneLast &&
00579            shw->GetVtxPlane()<=pSMPlaneFirst) dz-=zGapSM;
00580   
00581   if (vldcptr->GetDetector()==Detector::kFar &&
00582       this->GetEndPlane()<=pSMPlaneLast &&
00583       shw->GetVtxPlane()>=pSMPlaneFirst) dzend+=zGapSM;
00584   else if (vldcptr->GetDetector()==Detector::kFar &&
00585            this->GetEndPlane()>=pSMPlaneLast &&
00586            shw->GetVtxPlane()<=pSMPlaneFirst) dzend-=zGapSM;
00587   if(fabs(dz)>fabs(dzend)){
00588     du= this->GetEndU()-shw->GetVtxU();
00589     dv= this->GetEndV()-shw->GetVtxV(); 
00590     dz=dzend;
00591   }
00592   if (vldcptr->GetDetector()==Detector::kFar &&
00593       this->GetVtxPlane()<=pSMPlaneLast &&
00594       shw->GetEndPlane()>=pSMPlaneFirst) dzend2+=zGapSM;
00595   else if (vldcptr->GetDetector()==Detector::kFar &&
00596            this->GetVtxPlane()>=pSMPlaneLast &&
00597            shw->GetEndPlane()<=pSMPlaneFirst) dzend2-=zGapSM;
00598   if(fabs(dz)>fabs(dzend2)){
00599     du= this->GetVtxU()-shw->GetEndU();
00600     dv= this->GetVtxV()-shw->GetEndV(); 
00601     dz=dzend2;
00602   }
00603   if (vldcptr->GetDetector()==Detector::kFar &&
00604       this->GetEndPlane()<=pSMPlaneLast &&
00605       shw->GetEndPlane()>=pSMPlaneFirst) dzend3+=zGapSM;
00606   else if (vldcptr->GetDetector()==Detector::kFar &&
00607            this->GetEndPlane()>=pSMPlaneLast &&
00608            shw->GetEndPlane()<=pSMPlaneFirst) dzend3-=zGapSM;
00609   if(fabs(dz)>fabs(dzend3)){
00610     du= this->GetEndU()-shw->GetEndU();
00611     dv= this->GetEndV()-shw->GetEndV(); 
00612     dz=dzend3;
00613   }
00614 
00615  Double_t tolTp=tolTPos2;
00616   Double_t tolZ=tolZPos;
00617   if(this->GetEnergy()>15.0 || shw->GetEnergy()>15.0){
00618     tolTp=tolTPos2*4;
00619   }
00620   MSG("RecoBase",Msg::kDebug)
00621     << "    dvertex shower/shower " << du
00622     << " " << dv << " " << dz <<" "  << dt*1.e9 << "\n";
00623   if(( (du*du+dv*dv<tolTp &&fabs(dz)<tolZ) ||  
00624        (du*du<tolTp/4. && dv*dv<tolTp*4. && fabs(dz)<tolZ/2.) ||
00625        (du*du<tolTp*4 && dv*dv<tolTp/4. && fabs(dz)<tolZ/2.))
00626      &&  fabs(dt)<tolTime) return true;
00627 
00628   return false;
00629 }

Bool_t CandShowerHandle::BelongsWithTrack ( CandTrackHandle trk,
AlgConfig ac,
const VldContext vldcptr,
Double_t  tolTPos2,
Double_t  tolZPos,
Double_t  tolTime 
) [virtual]

Reimplemented in CandShowerSRHandle.

Definition at line 342 of file CandShowerHandle.cxx.

References DataUtil::GetDetector(), VldContext::GetDetector(), CandRecoHandle::GetDirCosV(), CandRecoHandle::GetDirCosZ(), CandRecoHandle::GetEndDirCosU(), CandRecoHandle::GetEndDirCosV(), CandRecoHandle::GetEndDirCosZ(), CandRecoHandle::GetEndPlane(), CandRecoHandle::GetEndT(), CandRecoHandle::GetEndU(), CandRecoHandle::GetEndV(), CandRecoHandle::GetEndZ(), Registry::GetInt(), GetMaxU(), GetMaxV(), GetMinU(), GetMinV(), GetNStrips(), PlexPlaneId::GetPlaneView(), UgliGeomHandle::GetScintPlnHandle(), CandTrackHandle::GetU(), CandTrackHandle::GetV(), CandHandle::GetVldContext(), CandRecoHandle::GetVtxDirCosU(), CandRecoHandle::GetVtxDirCosV(), CandRecoHandle::GetVtxDirCosZ(), CandRecoHandle::GetVtxPlane(), CandRecoHandle::GetVtxT(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), UgliPlnHandle::GetZ0(), CandTrackHandle::IsTPosValid(), UgliScintPlnHandle::IsValid(), Msg::kDebug, Detector::kFar, PlaneView::kU, PlaneView::kV, max, min, and MSG.

Referenced by AlgEventSRList::RunAlg().

00345                                                                                                 {
00346 
00347   if(!trk)return false;
00348 
00349   Int_t pSMPlaneLast = ac.GetInt("SMPlaneLast");
00350   Int_t pSMPlaneFirst = ac.GetInt("SMPlaneFirst");
00351   VldContext vldc = *vldcptr;
00352   UgliGeomHandle ugh(vldc); 
00353   Double_t zGapSM=0;
00354   // "Fixed": MAK, Feb 8, 2005
00355   // GetScintPlnHandle was being called in the ND for planes which didn't
00356   // have any scint. This fix only stops the block below from being called
00357   // in the near detector.  It doesn't require that 
00358   // pSMPlaneLast, pSMPlaneFirst actually refer to planes with scintillator!!
00359   if(vldc.GetDetector() == Detector::kFar){  
00360      // calculate Z gap between SM for later use
00361      PlexPlaneId scintlastid(vldc.GetDetector(),pSMPlaneLast,kFALSE);
00362      PlexPlaneId scintfirstid(vldc.GetDetector(),pSMPlaneFirst,kFALSE);
00363      UgliScintPlnHandle scintlast = ugh.GetScintPlnHandle(scintlastid);
00364      UgliScintPlnHandle scintfirst = ugh.GetScintPlnHandle(scintfirstid);
00365      if (scintlast.IsValid() && scintfirst.IsValid()) {  
00366         zGapSM=scintfirst.GetZ0()-scintlast.GetZ0()-0.0594;
00367      }
00368   }
00369 
00370   MSG("RecoBase",Msg::kDebug) 
00371     << " comparing shower at " 
00372     << this->GetVtxPlane() 
00373     << " " << this->GetVtxU() 
00374     << " " << this->GetVtxV() 
00375     << " with track at " << trk->GetVtxPlane() 
00376     << " " << trk->GetVtxU() 
00377     << " " << trk->GetVtxV() << endl;
00378   Float_t tolTPos = TMath::Sqrt(tolTPos2); 
00379   Int_t fwdTrkPlane=min(trk->GetVtxPlane(),trk->GetEndPlane());
00380   Int_t bckTrkPlane=max(trk->GetVtxPlane(),trk->GetEndPlane());
00381   Int_t fwdShwPlane=min(this->GetVtxPlane(),this->GetEndPlane());
00382   Int_t bckShwPlane=max(this->GetVtxPlane(),this->GetEndPlane());
00383 
00384   Double_t dt = trk->GetVtxT()-this->GetVtxT();
00385   //  if(trk->IsTPosValid(this->GetVtxPlane())){
00386   //   dt = this->GetVtxT()-trk->GetT(this->GetVtxPlane());
00387   //   }
00388 
00389   if( bckShwPlane>=fwdTrkPlane && fwdShwPlane<=bckTrkPlane && fabs(dt)<tolTime){   // trk overlaps in Z and Time
00390     MSG("RecoBase",Msg::kDebug) << " trk and shower overlap in Z and time " << endl;
00391     Bool_t matchu=false;
00392     Bool_t matchv=false;
00393     for(Int_t iloop=0;iloop<2;iloop++){      
00394       if(iloop >0 && (matchu || matchv))tolTPos=tolTPos*2;
00395       // if on second loop and no matches so far, give up
00396       if(iloop >0 && !matchu && !matchv) break;
00397       for (Int_t iplane=fwdShwPlane; iplane<=bckShwPlane;iplane++){  // look for trk passing through shower
00398         
00399         Double_t trkU(0.),trkV(0.);
00400         PlexPlaneId plnid(GetVldContext()->GetDetector(),iplane,false);
00401         if(plnid.GetPlaneView()==PlaneView::kU){
00402           trkU=trk->GetU(iplane);
00403           if(!trk->IsTPosValid(iplane)){
00404             if(abs(iplane-trk->GetVtxPlane())<abs(iplane-trk->GetEndPlane())){
00405               UgliScintPlnHandle scintpln = ugh.GetScintPlnHandle(plnid);
00406               Double_t dz=scintpln.GetZ0()-trk->GetVtxZ();
00407               trkU = trk->GetVtxU() + dz*trk->GetVtxDirCosU()/trk->GetVtxDirCosZ();
00408             }
00409             else{
00410               UgliScintPlnHandle scintpln = ugh.GetScintPlnHandle(plnid);
00411               Double_t dz=scintpln.GetZ0()-trk->GetEndZ();
00412               trkU = (trk->GetEndU() + dz*trk->GetEndDirCosU()/trk->GetEndDirCosZ());
00413             }
00414           }
00415           if(trkU>=this->GetMinU(iplane)-tolTPos && trkU<=this->GetMaxU(iplane)+tolTPos  && this->GetNStrips(iplane)>0){
00416             MSG("RecoBase", Msg::kDebug)<< " u match! (details follow)" << endl;
00417             matchu=true;
00418           }
00419         }
00420         else if(plnid.GetPlaneView()==PlaneView::kV){
00421           trkV=trk->GetV(iplane);
00422           if(!trk->IsTPosValid(iplane)){
00423             if(abs(iplane-trk->GetVtxPlane())<abs(iplane-trk->GetEndPlane())){
00424               UgliScintPlnHandle scintpln = ugh.GetScintPlnHandle(plnid);
00425               Double_t dz=scintpln.GetZ0()-trk->GetVtxZ();
00426               trkV = (trk->GetVtxV() + dz*trk->GetDirCosV()/trk->GetDirCosZ());
00427             }
00428             else{
00429               UgliScintPlnHandle scintpln = ugh.GetScintPlnHandle(plnid);
00430               Double_t dz=scintpln.GetZ0()-trk->GetEndZ();
00431               trkV= (trk->GetEndV() + dz*trk->GetEndDirCosV()/trk->GetEndDirCosZ());
00432             }
00433           }
00434           if(trkV>=this->GetMinV(iplane)-tolTPos && trkV<=this->GetMaxV(iplane)+tolTPos && this->GetNStrips(iplane)>0){
00435             MSG("RecoBase", Msg::kDebug)<< " v match! (details follow)" << endl;
00436             matchv=true;
00437           }
00438         }
00439         MSG("RecoBase",Msg::kDebug) << " plane  " << iplane 
00440                                     << " trk u " << trkU 
00441                                     << " min/max U " << this->GetMinU(iplane) 
00442                                     << "/" << this->GetMaxU(iplane) 
00443                                     << " trk v " << trkV 
00444                                     << " min/max V " << this->GetMinV(iplane) 
00445                                     << "/" << this->GetMaxV(iplane) << endl; 
00446         if(matchu && matchv) {
00447           MSG("RecoBase", Msg::kDebug)<< " 3D  match! " << endl;
00448           return true;
00449         }
00450       }
00451     }
00452   }
00453   if( this->GetVtxZ()>min(trk->GetVtxZ(),trk->GetEndZ())-tolZPos  &&
00454       this->GetVtxZ()<max(trk->GetVtxZ(),trk->GetEndZ())+tolZPos) {
00455     Double_t du= trk->GetVtxU()-this->GetVtxU();
00456     Double_t dv= trk->GetVtxV()-this->GetVtxV();        
00457     if(trk->IsTPosValid(this->GetVtxPlane())){
00458       MSG("RecoBase",Msg::kDebug) << " TPos is valid @ shower vtx " 
00459                                   << " track u/v " << trk->GetU(this->GetVtxPlane()) 
00460                                   << " " << trk->GetV(this->GetVtxPlane()) << endl;
00461       
00462       du = this->GetVtxU()-trk->GetU(this->GetVtxPlane());
00463       dv = this->GetVtxV()-trk->GetV(this->GetVtxPlane());
00464   }
00465     MSG("RecoBase",Msg::kDebug)
00466       << "    at plane " << this->GetVtxPlane() << " dt2  " 
00467       << du*du+dv*dv << "/" << tolTPos2
00468       << " dt " << dt*1.e9 
00469       << "/" << tolTime*1e9 <<  "\n";
00470     if(dt<tolTime && 
00471        du*du+dv*dv<tolTPos2) return true;   // check whether vertex within minimum distance from trk 
00472   }
00473   // finally, check distance between vertices 
00474   Double_t trkZ=trk->GetVtxZ();
00475   Double_t trkU=trk->GetVtxU();
00476   Double_t trkV=trk->GetVtxV();
00477   Double_t trkT=trk->GetVtxT();
00478   Double_t trkDirU=trk->GetVtxDirCosU();
00479   Double_t trkDirV=trk->GetVtxDirCosV();
00480   Double_t trkDirZ=trk->GetVtxDirCosZ();
00481   Int_t trkPlane=trk->GetVtxPlane();
00482   if(fabs(this->GetVtxZ()-trk->GetEndZ())<fabs(this->GetVtxZ()-trk->GetVtxZ())){
00483     trkZ=trk->GetEndZ();
00484     trkU=trk->GetEndU();
00485     trkV=trk->GetEndV();
00486     trkT=trk->GetEndT();
00487     trkPlane=trk->GetEndPlane();
00488     trkDirU=trk->GetEndDirCosU();
00489     trkDirV=trk->GetEndDirCosV();
00490     trkDirZ=trk->GetEndDirCosZ();
00491   }
00492   Double_t dz = this->GetVtxZ()-trkZ;
00493   dt = this->GetVtxT()-trkT;
00494   //compensate dz for SM gap if necessary
00495   if (vldcptr->GetDetector()==Detector::kFar &&
00496       this->GetVtxPlane()<=pSMPlaneLast &&
00497       trkPlane>=pSMPlaneFirst) dz+=zGapSM;
00498   else if (vldcptr->GetDetector()==Detector::kFar &&
00499            this->GetVtxPlane()>=pSMPlaneLast &&
00500            trkPlane<=pSMPlaneFirst) dz-=zGapSM;
00501   
00502   Double_t du = (trkU + dz*trkDirU/trkDirZ) - this->GetVtxU();
00503   Double_t dv = (trkV + dz*trkDirV/trkDirZ) - this->GetVtxV();
00504 
00505   MSG("RecoBase",Msg::kDebug)
00506     << "    dvertex shower/track " << du
00507     << " " << dv << " " << dz <<" "  << dt*1.e9 << "\n";
00508   if (du*du+dv*dv<tolTPos2 &&
00509       fabs(dz)<tolZPos && 
00510       fabs(dt)<tolTime) return true;
00511 
00512   dz = this->GetEndZ()-trkZ;
00513   dt = this->GetVtxT()-trkT;
00514   //compensate dz for SM gap if necessary
00515   if (vldcptr->GetDetector()==Detector::kFar &&
00516       this->GetVtxPlane()<=pSMPlaneLast &&
00517       trkPlane>=pSMPlaneFirst) dz+=zGapSM;
00518   else if (vldcptr->GetDetector()==Detector::kFar &&
00519            this->GetVtxPlane()>=pSMPlaneLast &&
00520            trkPlane<=pSMPlaneFirst) dz-=zGapSM;
00521   
00522   du = (trkU + dz*trkDirU/trkDirZ) - this->GetEndU();
00523   dv = (trkV + dz*trkDirV/trkDirZ) - this->GetEndV();
00524 
00525   MSG("RecoBase",Msg::kDebug)
00526     << "    dvertex shower/track " << du
00527     << " " << dv << " " << dz <<" "  << dt*1.e9 << "\n";
00528   if (du*du+dv*dv<tolTPos2 &&
00529       fabs(dz)<tolZPos && 
00530       fabs(dt)<tolTime) return true;
00531 
00532   return false;
00533 }

void CandShowerHandle::CalibrateEnergy ( CandTrackHandle associatedtrk,
AlgConfig ac 
)

Definition at line 809 of file CandShowerHandle.cxx.

References ApplyRecoTrueCCCorrection(), DeDx(), CandHandle::FindDaughter(), CandRecoHandle::GetCharge(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), CandRecoHandle::GetDirCosZ(), Registry::GetDouble(), CandTrackHandle::GetMomentum(), CandRecoHandle::GetStripCharge(), CandHandle::GetVldContext(), kCC, kEM, CalStripType::kMIP, kNC, Detector::kNear, kRawCC, StripEnd::kWhole, kWtCC, kWtNC, and SetEnergy().

Referenced by AlgEventSSList::ReConstructShowers(), and AlgEventSRList::ReConstructShowers().

00810                                         {
00811 
00812   CandStripHandleItr sItr(GetDaughterIterator());
00813   CandStripHandle * begstrip = sItr();
00814   const VldContext * vld = begstrip->GetVldContext();
00815 
00816   Double_t fCCWtLowScale = ac.GetDouble("CCWtLowScale");
00817   Double_t fCCWtLowC1 = ac.GetDouble("CCWtLowC1");
00818   Double_t fCCWtLowC2 = ac.GetDouble("CCWtLowC2");
00819   Double_t fCCWtLowC3 = ac.GetDouble("CCWtLowC3");
00820   Double_t fCCWtLowC4 = ac.GetDouble("CCWtLowC4");
00821   Double_t fCCWtHiC0 = ac.GetDouble("CCWtHiC0");
00822   Double_t fCCWtHiC1 = ac.GetDouble("CCWtHiC1");
00823 
00824   Double_t fCCLinLowScale = ac.GetDouble("CCLinLowScale");
00825   Double_t fCCLinLowC1 = ac.GetDouble("CCLinLowC1");
00826   Double_t fCCLinLowC2 = ac.GetDouble("CCLinLowC2");
00827   Double_t fCCLinHiC0 = ac.GetDouble("CCLinHiC0");
00828   Double_t fCCLinHiC1 = ac.GetDouble("CCLinHiC1");
00829 
00830   Double_t fNCWtLowScale = ac.GetDouble("NCWtLowScale");
00831   Double_t fNCWtMidScale = ac.GetDouble("NCWtMidScale");
00832   Double_t fNCWtLowC1 = ac.GetDouble("NCWtLowC1");
00833   Double_t fNCWtLowC2 = ac.GetDouble("NCWtLowC2");
00834   Double_t fNCWtLowC3 = ac.GetDouble("NCWtLowC3");
00835   Double_t fNCWtMidC0 = ac.GetDouble("NCWtMidC0");
00836   Double_t fNCWtMidC1 = ac.GetDouble("NCWtMidC1");
00837   Double_t fNCWtMidC2 = ac.GetDouble("NCWtMidC2");
00838   Double_t fNCWtMidC3 = ac.GetDouble("NCWtMidC3");
00839   Double_t fNCWtHiC0 = ac.GetDouble("NCWtHiC0");
00840   Double_t fNCWtHiC1 = ac.GetDouble("NCWtHiC1");
00841 
00842   Double_t fNCLinLowScale = ac.GetDouble("NCLinLowScale");
00843   Double_t fNCLinLowC1 = ac.GetDouble("NCLinLowC1");
00844   Double_t fNCLinLowC2 = ac.GetDouble("NCLinLowC2");
00845   Double_t fNCLinHiC0 = ac.GetDouble("NCLinHiC0");
00846   Double_t fNCLinHiC1 = ac.GetDouble("NCLinHiC1");
00847 
00848   Double_t fEMLowScale = ac.GetDouble("EMLowScale");
00849   Double_t fEMLowC1 = ac.GetDouble("EMLowC1");
00850   Double_t fEMLowC2 = ac.GetDouble("EMLowC2");
00851   Double_t fEMHiC0 = ac.GetDouble("EMHiC0");
00852   Double_t fEMHiC1 = ac.GetDouble("EMHiC1");
00853 
00854   Double_t shw_linmipsum=GetCharge(CalStripType::kMIP);
00855   Double_t shw_wtmipsum=0;
00856   Double_t totshw_wtmipsum=0;
00857   Double_t totshw_linmipsum = GetCharge(CalStripType::kMIP);
00858 
00859   // loop through strips once, getting linear version of shower sum, used
00860   // to obtain deweighting factors as well
00861 
00862   Int_t maxpln = 0;
00863   Int_t minpln = 999;
00864   Int_t shared_planes = 0;
00865   Int_t shared_strips = 0;
00866   Int_t nshwstp = 0;
00867   Double_t dedx_1 = 0.;
00868   Double_t dedx_2 = 0.;
00869   Double_t avg_dedx = 0.;
00870   Double_t reco_emu = 0.;
00871   Double_t reco_dircosz = 0.;
00872   Double_t reco_emu_endshw=0.;
00873 
00874   if (trk) {
00875     reco_dircosz = fabs(trk->GetDirCosZ());
00876     CandFitTrackHandle* fittrk = dynamic_cast<CandFitTrackHandle*>(trk); // if there is a fitted track then use it for improved tracking + direction in the shower
00877     reco_emu = sqrt(trk->GetMomentum()*trk->GetMomentum()+ 0.10566*0.10566);
00878     if(fittrk){
00879       reco_dircosz = fabs(fittrk->GetDirCosZ());
00880       if(fittrk->GetMomentum()>0.) {reco_emu = sqrt(fittrk->GetMomentum()*fittrk->GetMomentum()+ 0.10566*0.10566);}
00881     }
00882    
00883     CandStripHandleItr stripItr(GetDaughterIterator());
00884     // check all strips in shower,and see determine length of track through shower
00885     while (CandStripHandle *strip = dynamic_cast<CandStripHandle*>(stripItr())) {
00886       if (strip) {
00887         nshwstp++;
00888         if((!fittrk && trk->FindDaughter(strip)) || (fittrk && fittrk->FindDaughter(strip))){     
00889           shared_strips++;
00890           if(strip->GetPlane()>maxpln) maxpln = strip->GetPlane();
00891           if(strip->GetPlane()<minpln) minpln = strip->GetPlane(); 
00892         }
00893       }
00894     }
00895     shared_planes = maxpln - minpln + 1;
00896     
00897     reco_emu_endshw = reco_emu-shared_planes/(30.*reco_dircosz);
00898     
00899     if(fittrk && fittrk->GetPlaneQP(maxpln)!=0.){
00900       Double_t pln_qp = fittrk->GetPlaneQP(maxpln)*(1.013*fabs(fittrk->GetPlaneQP(maxpln)));
00901       reco_emu_endshw = sqrt(1./pln_qp*1./pln_qp + 0.10566*0.10566);
00902     }
00903 
00904     if(reco_emu_endshw>reco_emu){reco_emu_endshw = reco_emu-shared_planes/(30.*reco_dircosz);}// get best estimate for muon energy at the end of the shw using fittrk info if present
00905 
00906      dedx_1 = DeDx(reco_emu*1000)/1.985; // get dedx at vtx, normalised to MIPs
00907     if(reco_emu_endshw>0.106){ // stop non-physical situations where more energy is lost than initially present
00908       dedx_2 = DeDx(reco_emu_endshw*1000)/1.985; // get approx dedx at end of shw
00909       avg_dedx = (dedx_1 > dedx_2)? 0.5*(dedx_1+dedx_2):dedx_1; // stop muons which stop in the shw from skewing the dedx factor
00910     }
00911     else{avg_dedx = dedx_1;}
00912     shw_linmipsum -= avg_dedx*shared_strips/reco_dircosz; // remove muon chg from shw
00913   }
00914   else{
00915     shw_linmipsum=totshw_linmipsum;
00916   }
00917 
00918   Double_t CCEnergyLin = (shw_linmipsum<fCCLinLowScale) ? shw_linmipsum*fCCLinLowC1 + shw_linmipsum*shw_linmipsum*fCCLinLowC2: fCCLinHiC0 +  shw_linmipsum*fCCLinHiC1;
00919   if(shw_linmipsum<=0) CCEnergyLin=0;
00920         
00921   Double_t NCEnergyLin = (totshw_linmipsum<fNCLinLowScale) ? totshw_linmipsum*fNCLinLowC1 + totshw_linmipsum*totshw_linmipsum*fNCLinLowC2: fNCLinHiC0 +  totshw_linmipsum*fNCLinHiC1;
00922   if(totshw_linmipsum<=0) NCEnergyLin=0;
00923         
00924   Double_t EMEnergy = (totshw_linmipsum<fEMLowScale) ? totshw_linmipsum*fEMLowC1  + totshw_linmipsum*totshw_linmipsum*fEMLowC2: fEMHiC0 +  totshw_linmipsum*fEMHiC1;
00925   if(totshw_linmipsum<=0) EMEnergy=0;
00926 
00927   // for old software, exponential deweighting function is used.  For SS, use cubic
00928 
00929   Double_t deweightfactorCC = 1.0;
00930   Double_t deweightfactorNC = 1.0;
00931  
00932   Double_t fdeweightLowScale = ac.GetDouble("deweightLowScale");
00933   Double_t fdeweightC0 = ac.GetDouble("deweightC0");
00934   Double_t fdeweightC1 = ac.GetDouble("deweightC1");
00935   Double_t fdeweightC2 = ac.GetDouble("deweightC2");
00936   Double_t fdeweightC3 = ac.GetDouble("deweightC3");
00937   /*  
00938   if(CCEnergyLin < fdeweightLowScale){
00939     deweightfactorCC =  fdeweightC0 + 
00940       fdeweightC1 * CCEnergyLin +
00941       fdeweightC2 * CCEnergyLin * CCEnergyLin +
00942       fdeweightC3 * CCEnergyLin * CCEnergyLin * CCEnergyLin;
00943   }
00944   */
00945   // Find final deweight power
00946   double SigHalfPoint = 8.0;
00947   double SigGrad = 0.5;      
00948   deweightfactorCC = 0.25 + 0.75/(1. + exp(-(CCEnergyLin-SigHalfPoint)*SigGrad));
00949  
00950   if(NCEnergyLin < fdeweightLowScale){
00951     deweightfactorNC =  fdeweightC0 + 
00952       fdeweightC1 * NCEnergyLin +
00953       fdeweightC2 * NCEnergyLin * NCEnergyLin +
00954       fdeweightC3 * NCEnergyLin * NCEnergyLin * NCEnergyLin;
00955   }
00956   
00957   // now that deweighting factors are known, calculated de-weighted sum 
00958     CandStripHandleItr stripItr(GetDaughterIterator());
00959   // check all strips in shower,and see whether they are shared with the track 
00960   while (CandStripHandle *strip = dynamic_cast<CandStripHandle*>(stripItr())) {
00961     if (strip) {
00962       totshw_wtmipsum+=pow(GetStripCharge(strip,StripEnd::kWhole),deweightfactorNC);
00963       Double_t trackEloss = 0;  
00964       // if track crosses strip, subtract chg dependent on dedx factor (calc earlier) and direction
00965       if(trk){
00966         CandFitTrackHandle* fittrk = dynamic_cast<CandFitTrackHandle*>(trk);
00967         if((!fittrk && trk->FindDaughter(strip)) || (fittrk && fittrk->FindDaughter(strip))){     
00968           trackEloss=avg_dedx/reco_dircosz;
00969         }
00970       }
00971       if(GetStripCharge(strip,StripEnd::kWhole) - trackEloss > 0){
00972         shw_wtmipsum+=pow(GetStripCharge(strip,StripEnd::kWhole)-trackEloss,deweightfactorCC);
00973       }
00974     }
00975   }
00976   
00977   Double_t CCEnergyWt =  fCCWtHiC0 +  shw_wtmipsum*fCCWtHiC1;
00978   if( shw_wtmipsum<fCCWtLowScale){
00979     CCEnergyWt =  shw_wtmipsum*fCCWtLowC1 + 
00980       shw_wtmipsum*shw_wtmipsum*fCCWtLowC2 + 
00981       shw_wtmipsum*shw_wtmipsum*shw_wtmipsum*fCCWtLowC3 + 
00982       shw_wtmipsum*shw_wtmipsum*shw_wtmipsum*shw_wtmipsum*fCCWtLowC4;
00983   }
00984   if(shw_wtmipsum<=0) CCEnergyWt=0;
00985   
00986   Double_t NCEnergyWt = fNCWtHiC0 + totshw_wtmipsum*fNCWtHiC1;
00987   if(totshw_wtmipsum<fNCWtLowScale){ 
00988     NCEnergyWt = totshw_wtmipsum*fNCWtLowC1 + 
00989       totshw_wtmipsum*totshw_wtmipsum*fNCWtLowC2 + 
00990       totshw_wtmipsum*totshw_wtmipsum*totshw_wtmipsum*fNCWtLowC3; 
00991   }
00992 
00993   if(totshw_wtmipsum>=fNCWtLowScale && totshw_wtmipsum<fNCWtMidScale){
00994     NCEnergyWt =  fNCWtMidC0 +  totshw_wtmipsum*fNCWtMidC1 + totshw_wtmipsum*totshw_wtmipsum*fNCWtMidC2 + totshw_wtmipsum*totshw_wtmipsum*totshw_wtmipsum*fNCWtMidC3;
00995   }
00996 
00997   if(totshw_wtmipsum<=0) NCEnergyWt=0;
00998 
00999 // cout << " CC deweightmips = " << shw_wtmipsum << " NC deweight_mips = " <<totshw_wtmipsum  << endl;
01000 //  cout << " CC deweight E = " << CCEnergyWt << " NC dwewightE = " << NCEnergyWt<< endl;
01001   
01002   // for near detector, compensate for near/far shower completeness difference
01003   // and observed difference between near/far mip scale on muon tracks
01004 
01005  if (vld && vld->GetDetector()==Detector::kNear){
01006     CCEnergyWt *= (.97 + exp(-(CCEnergyWt+11.6)/9.3)); 
01007     CCEnergyLin *= (.99 + exp(-(CCEnergyLin+28.2)/11.8)); 
01008     NCEnergyWt *= (1.01 + exp(-(NCEnergyWt+4.33)/5.)); 
01009     NCEnergyLin *= (1. + exp(-(NCEnergyLin+10.1)/5.)); 
01010     EMEnergy *= 1.06; 
01011  }
01012 
01013  // now apply energy corrections, corresponding to EnergyCorrections::MasakiMay17thCGScaled.
01014  
01015  // make sure we keep the uncorrected energy as the gev pulse height.
01016  float uncorrCC = CCEnergyLin;
01017  
01018  if(vld){
01019    float etemplin = CCEnergyLin;
01020 //   CCEnergyLin = EnergyCorrections::ShowerEnergyConversionDogwood(etemplin,*vld);
01021         CCEnergyLin = this->ApplyRecoTrueCCCorrection(etemplin,ac,vld->GetDetector());
01022    etemplin = CCEnergyWt;
01023 //  CCEnergyWt = EnergyCorrections::WeightedShowerEnergyConversionDogwood(etemplin,*vld);
01024         CCEnergyWt = this->ApplyRecoTrueCCCorrection(etemplin,ac,vld->GetDetector());
01025  }
01026 
01027 //      std::cout << "SHW: " << uncorrCC << ", " << CCEnergyLin << ", " << uncorrCC - CCEnergyLin << ", " << std::endl;
01028  
01029 // SetEnergy(CCEnergyWt);
01030  SetEnergy(uncorrCC,kRawCC);
01031  SetEnergy(CCEnergyWt,kWtCC);
01032  SetEnergy(CCEnergyLin,kCC);
01033  SetEnergy(NCEnergyWt,kWtNC);
01034  SetEnergy(NCEnergyLin,kNC);
01035  SetEnergy(EMEnergy,kEM);
01036 }

void CandShowerHandle::ClearUVT (  )  [virtual]

Definition at line 160 of file CandShowerHandle.cxx.

References CandShower::fTime, CandShower::fUPos, CandShower::fVPos, and CandHandle::GetOwnedCandBase().

00161 {
00162   CandShower *shower = dynamic_cast<CandShower*>(GetOwnedCandBase());
00163   shower->fUPos.clear();
00164   shower->fVPos.clear();
00165   shower->fTime[0].clear();
00166   shower->fTime[1].clear();
00167 }

Double_t CandShowerHandle::DeDx ( Double_t  emu  ) 

Definition at line 1079 of file CandShowerHandle.cxx.

References MuELoss::a, MuELoss::a_2, Munits::m, Munits::mm, MuELoss::Na, and Mphysical::pi.

Referenced by CalibrateEnergy().

01079                                            {
01080   
01081   Double_t dedx = 0.; 
01082   Double_t mm = 105.658389;
01083   Double_t mm_2 = mm*mm;
01084 
01085   if(emu*emu-mm_2<0.){return 0.;}
01086 
01087   Double_t a_2     = 1./(137.036*137.036);
01088   Double_t pi = 3.141;
01089   Double_t Na = 6.023;
01090   Double_t lamda_2 = 3.8616*3.8616;
01091   Double_t Z_A = 0.5377;
01092   Double_t me  = 0.51099906;
01093   Double_t me_2 = me*me;  
01094   Double_t beta = sqrt(emu*emu-mm_2)/emu;
01095   Double_t beta_2 = beta*beta;
01096   Double_t gamma = emu/105.658389;
01097   Double_t gamma_2 = gamma*gamma;
01098   Double_t I = 68.7e-6;
01099   Double_t I_2 = I*I;
01100   Double_t p = sqrt(emu*emu-mm_2);
01101   Double_t p_2 = p*p;
01102   Double_t Em = 2 * me * p_2 / ( me_2 + mm_2 + 2*me*emu );
01103   Double_t Em_2= Em*Em;
01104   Double_t emu_2 = emu*emu;
01105   Double_t X0 = 0.165;
01106   Double_t X1 = 2.503;
01107   Double_t X = log10(beta*gamma);
01108   Double_t a = 0.165;
01109   Double_t C = -3.3;
01110   Double_t m = 3.222;
01111   Double_t d = 0;
01112   if(X0 < X && X < X1){d = 4.6052 * X + a * pow(X1-X,m) + C;}
01113   if(X > X1){d = 4.6052 * X + C;}
01114 
01115   dedx =  a_2 * 2*pi * Na * lamda_2 * Z_A * (me / beta_2) *( log( 2*me*beta_2*gamma_2*Em/I_2 ) - 2*beta_2 + 0.25*(Em_2/emu_2) - d );
01116 
01117   return 10*dedx;
01118 
01119 }

CandShowerHandle * CandShowerHandle::DupHandle (  )  const [virtual]

Reimplemented from CandRecoHandle.

Reimplemented in CandShowerAtNuHandle, CandFitShowerEMHandle, CandShowerEMHandle, and CandShowerSRHandle.

Definition at line 63 of file CandShowerHandle.cxx.

References CandShowerHandle().

Referenced by CandEventHandle::AddShower(), and CandEventHandle::SetPrimaryShower().

00064 {
00065    return (new CandShowerHandle(*this));
00066 }

const CandClusterHandle * CandShowerHandle::GetCluster ( Int_t  i  )  const

Definition at line 726 of file CandShowerHandle.cxx.

References CandHandle::GetCandBase().

Referenced by AlgEventSRList::AddStripToEvent(), and AlgEventSRList::ReConstructShowers().

00727 {
00728   const TObjArray *fClusterList = &(dynamic_cast<const CandShower*>
00729     (GetCandBase())->fClusterList);
00730   if (i>fClusterList->GetLast()) {
00731     return 0;
00732   }
00733   return dynamic_cast<const CandClusterHandle*>(fClusterList->At(i));
00734 }

Double_t CandShowerHandle::GetEnergy ( CandShowerHandle::EShowerType  = kCC  )  const
Int_t CandShowerHandle::GetLastCluster (  )  const

Definition at line 738 of file CandShowerHandle.cxx.

References CandHandle::GetCandBase().

Referenced by AlgEventSRList::AddStripToEvent(), and AlgEventSRList::ReConstructShowers().

00739 {
00740   return dynamic_cast<const CandShower*>(GetCandBase())->fClusterList.
00741                                                               GetLast();
00742 }

Float_t CandShowerHandle::GetMaxU ( Int_t  plane,
Double_t  minPE = 0 
) const

Definition at line 228 of file CandShowerHandle.cxx.

References CandRecoHandle::GetBegPlane(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), CandRecoHandle::GetEndPlane(), CandHandle::GetVldContext(), CandStripHandle::KeyFromPlane(), CalDigitType::kPE, and PlaneView::kU.

Referenced by CandTrackHandle::BelongsWithShower(), CandShowerSRHandle::BelongsWithTrack(), BelongsWithTrack(), CandShowerSRHandle::BuriedTrack(), and AlgEventSRList::RemoveTracksinShowers().

00228                                                                    {
00229   CandStripHandleItr sItr(GetDaughterIterator());
00230   CandStripHandle * begstrip = sItr();
00231   if(!begstrip)return 999;
00232   const VldContext * vld = begstrip->GetVldContext();
00233   if(!vld)return 999;
00234   PlexPlaneId plnid(vld->GetDetector(),iplane,false);
00235   if(plnid.GetPlaneView()!=PlaneView::kU)return 999.;
00236   if(iplane<GetBegPlane() || iplane > GetEndPlane()) return 0.;
00237 
00238   CandStripHandleItr stripItr(GetDaughterIterator());
00239   CandStripHandleKeyFunc *stripKf = stripItr.CreateKeyFunc();
00240   stripKf->SetFun(CandStripHandle::KeyFromPlane);
00241   stripItr.GetSet()->AdoptSortKeyFunc(stripKf);
00242   stripKf = 0;
00243   stripItr.GetSet()->Slice(iplane);
00244  
00245   Float_t maxU=-999.;
00246   while (const CandStripHandle *strip =
00247          dynamic_cast<const CandStripHandle*>(stripItr())) {
00248     if(strip->GetTPos() > maxU&& strip->GetCharge(CalDigitType::kPE) > minPE ) maxU=strip->GetTPos();
00249   }
00250   if(maxU==-999.)maxU=0;
00251   return maxU;
00252 }

Float_t CandShowerHandle::GetMaxV ( Int_t  plane,
Double_t  minPE = 0 
) const

Definition at line 256 of file CandShowerHandle.cxx.

References CandRecoHandle::GetBegPlane(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), CandRecoHandle::GetEndPlane(), CandHandle::GetVldContext(), CandStripHandle::KeyFromPlane(), CalDigitType::kPE, and PlaneView::kV.

Referenced by CandTrackHandle::BelongsWithShower(), CandShowerSRHandle::BelongsWithTrack(), BelongsWithTrack(), CandShowerSRHandle::BuriedTrack(), and AlgEventSRList::RemoveTracksinShowers().

00256                                                                     {
00257   CandStripHandleItr sItr(GetDaughterIterator());
00258   CandStripHandle * begstrip = sItr();
00259   if(!begstrip)return 999;
00260   const VldContext * vld = begstrip->GetVldContext();
00261   if(!vld)return 999;
00262   PlexPlaneId plnid(vld->GetDetector(),iplane,false);
00263   if(plnid.GetPlaneView()!=PlaneView::kV)return 999.;
00264   if(iplane<GetBegPlane() || iplane > GetEndPlane()) return 0.;
00265 
00266   CandStripHandleItr stripItr(GetDaughterIterator());
00267   CandStripHandleKeyFunc *stripKf = stripItr.CreateKeyFunc();
00268   stripKf->SetFun(CandStripHandle::KeyFromPlane);
00269   stripItr.GetSet()->AdoptSortKeyFunc(stripKf);
00270   stripKf = 0;
00271   stripItr.GetSet()->Slice(iplane);
00272   Float_t maxV=-999.;
00273   while (const CandStripHandle *strip =
00274          dynamic_cast<const CandStripHandle*>(stripItr())) {
00275     if(strip->GetTPos()>maxV && strip->GetCharge(CalDigitType::kPE)  > minPE)
00276        maxV=strip->GetTPos();
00277   }
00278   if(maxV==-999)maxV=0;
00279   return maxV;
00280 }

Double_t CandShowerHandle::GetMinStripPE (  )  const

Definition at line 122 of file CandShowerHandle.cxx.

References CandShower::fMinStripPE, and CandHandle::GetCandBase().

Referenced by TruthHelper::EventCompletenessImp(), and TruthHelper::ShowerCompletenessImp().

00123 {
00124   const CandShower *shower = dynamic_cast<const CandShower*>(GetCandBase());
00125   return shower->fMinStripPE;
00126 }

Float_t CandShowerHandle::GetMinU ( Int_t  plane,
Double_t  minPE = 0 
) const

Definition at line 171 of file CandShowerHandle.cxx.

References CandRecoHandle::GetBegPlane(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), CandRecoHandle::GetEndPlane(), CandHandle::GetVldContext(), CandStripHandle::KeyFromPlane(), CalDigitType::kPE, and PlaneView::kU.

Referenced by CandTrackHandle::BelongsWithShower(), CandShowerSRHandle::BelongsWithTrack(), BelongsWithTrack(), CandShowerSRHandle::BuriedTrack(), and AlgEventSRList::RemoveTracksinShowers().

00171                                                                    {
00172   CandStripHandleItr sItr(GetDaughterIterator());
00173   CandStripHandle * begstrip = sItr();
00174   if(!begstrip)return -999;
00175   const VldContext * vld = begstrip->GetVldContext();
00176   if(!vld)return -999;
00177   PlexPlaneId plnid(vld->GetDetector(),iplane,false);
00178   if(plnid.GetPlaneView()!=PlaneView::kU)return -999.;
00179   CandStripHandleItr stripItr(GetDaughterIterator());
00180   CandStripHandleKeyFunc *stripKf = stripItr.CreateKeyFunc();
00181   stripKf->SetFun(CandStripHandle::KeyFromPlane);
00182   stripItr.GetSet()->AdoptSortKeyFunc(stripKf);
00183   stripKf = 0;
00184   stripItr.GetSet()->Slice(iplane);
00185 
00186   Float_t minU=999.;
00187   while (const CandStripHandle *strip =
00188          dynamic_cast<const CandStripHandle*>(stripItr())) {
00189     
00190     if(iplane<GetBegPlane() || iplane > GetEndPlane()) return 0.;
00191     
00192     if(strip->GetTPos() < minU && strip->GetCharge(CalDigitType::kPE) > minPE )
00193        minU=strip->GetTPos();
00194   }
00195   if(minU==999)minU=0;
00196   return minU;
00197 }

Float_t CandShowerHandle::GetMinV ( Int_t  plane,
Double_t  minPE = 0 
) const

Definition at line 200 of file CandShowerHandle.cxx.

References CandRecoHandle::GetBegPlane(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), CandRecoHandle::GetEndPlane(), CandHandle::GetVldContext(), CandStripHandle::KeyFromPlane(), CalDigitType::kPE, and PlaneView::kV.

Referenced by CandTrackHandle::BelongsWithShower(), CandShowerSRHandle::BelongsWithTrack(), BelongsWithTrack(), CandShowerSRHandle::BuriedTrack(), and AlgEventSRList::RemoveTracksinShowers().

00200                                                                    {
00201   CandStripHandleItr sItr(GetDaughterIterator());
00202   CandStripHandle * begstrip = sItr();
00203   if(!begstrip)return -999;
00204   const VldContext * vld = begstrip->GetVldContext();
00205   if(!vld)return -999;
00206   PlexPlaneId plnid(vld->GetDetector(),iplane,false);
00207   if(plnid.GetPlaneView()!=PlaneView::kV)return -999.;
00208   if(iplane<GetBegPlane() || iplane > GetEndPlane()) return 0.;
00209   CandStripHandleItr stripItr(GetDaughterIterator());
00210   CandStripHandleKeyFunc *stripKf = stripItr.CreateKeyFunc();
00211   stripKf->SetFun(CandStripHandle::KeyFromPlane);
00212   stripItr.GetSet()->AdoptSortKeyFunc(stripKf);
00213   stripKf = 0;
00214   stripItr.GetSet()->Slice(iplane);
00215  
00216   Float_t minV=999.;
00217   while (const CandStripHandle *strip =
00218          dynamic_cast<const CandStripHandle*>(stripItr())) {
00219     if(strip->GetTPos()<minV && strip->GetCharge(CalDigitType::kPE) > minPE )
00220        minV=strip->GetTPos();
00221   }
00222   if(minV==999.)minV=0;
00223   return minV;
00224 }

Int_t CandShowerHandle::GetNStrips ( Int_t  iplane  ) 

Definition at line 283 of file CandShowerHandle.cxx.

References CandHandle::GetDaughterIterator().

Referenced by CandTrackHandle::BelongsWithShower(), and BelongsWithTrack().

00283                                               {
00284   Int_t nstrips=0;
00285   CandStripHandleItr stripItr(GetDaughterIterator());
00286   while (const CandStripHandle *strip =
00287          dynamic_cast<const CandStripHandle*>(stripItr())) {
00288     if(strip->GetPlane()==iplane)nstrips++;
00289   }
00290   return nstrips;
00291 }

Double_t CandShowerHandle::GetT ( StripEnd::StripEnd_t  stripend_t,
Int_t  plane 
) const

Definition at line 322 of file CandShowerHandle.cxx.

References GetT().

00323 {
00324   return this->GetT(plane,stripend_t);
00325 }

Double_t CandShowerHandle::GetT ( Int_t  plane,
StripEnd::StripEnd_t  stripend_t 
) const

Definition at line 295 of file CandShowerHandle.cxx.

References count, CandShower::fTime, CandHandle::GetCandBase(), StripEnd::kNegative, StripEnd::kPositive, and min.

00296 {
00297   const CandShower *shower = dynamic_cast<const CandShower*>(GetCandBase());
00298   if (stripend_t==StripEnd::kNegative) {
00299     if ((shower->fTime[0]).count(plane)) {
00300       return shower->fTime[0][plane];
00301     }
00302     return -99999.;
00303   }
00304   if (stripend_t==StripEnd::kPositive) {
00305     if ((shower->fTime[1]).count(plane)) {
00306       return shower->fTime[1][plane];
00307     }
00308     return -99999.;
00309   }
00310   if ((shower->fTime[0]).count(plane) && (shower->fTime[1]).count(plane)) {
00311     return min(shower->fTime[0][plane],shower->fTime[1][plane]);
00312   }
00313   else if ((shower->fTime[0]).count(plane)) {
00314     return shower->fTime[0][plane];
00315   }
00316   else if ((shower->fTime[1]).count(plane)) {
00317     return shower->fTime[1][plane];
00318   }
00319   return -99999.;
00320 }

Double_t CandShowerHandle::GetT ( Int_t  plane  )  const

Definition at line 327 of file CandShowerHandle.cxx.

References StripEnd::kWhole.

Referenced by GetT().

00328 {
00329   return this->GetT(plane,StripEnd::kWhole);
00330 }

Float_t CandShowerHandle::GetU ( Int_t  plane  )  const

Definition at line 91 of file CandShowerHandle.cxx.

References CandShower::fUPos, and CandHandle::GetCandBase().

Referenced by AlgReco::Calibrate(), AlgShowerSR::FindTimingDirection(), GfxShower::GetCandShowerData(), AlgFarDetEvent::GetShower(), IsContained(), AlgShowerSR::SetT(), and AlgShowerSR::SetUV().

00092 {
00093   const CandShower *shower = dynamic_cast<const CandShower*>(GetCandBase());
00094   if ((shower->fUPos).count(plane)) return shower->fUPos[plane];
00095   return -99999.;
00096 }

Float_t CandShowerHandle::GetV ( Int_t  plane  )  const

Definition at line 106 of file CandShowerHandle.cxx.

References CandShower::fVPos, and CandHandle::GetCandBase().

Referenced by AlgReco::Calibrate(), AlgShowerSR::FindTimingDirection(), GfxShower::GetCandShowerData(), AlgFarDetEvent::GetShower(), IsContained(), AlgShowerSR::SetT(), and AlgShowerSR::SetUV().

00107 {
00108   const CandShower *shower = dynamic_cast<const CandShower*>(GetCandBase());
00109   if ((shower->fVPos).count(plane)) return shower->fVPos[plane];
00110   return -99999.;
00111 }

Float_t CandShowerHandle::GetZ ( Int_t  plane  )  const

Definition at line 130 of file CandShowerHandle.cxx.

References CandHandle::GetDaughterIterator().

Referenced by AlgShowerSR::SetUV().

00131 {
00132   TIter stripItr(GetDaughterIterator());
00133   while (CandStripHandle *strip =
00134                            dynamic_cast<CandStripHandle*>(stripItr())) {
00135     if (strip->GetPlane()==plane) return strip->GetZPos();
00136   }
00137   return -1.;
00138 }

bool CandShowerHandle::IsContained (  ) 

Definition at line 671 of file CandShowerHandle.cxx.

References PlaneOutline::DistanceToEdge(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), GetU(), GetV(), CandHandle::GetVldContext(), UgliGeomHandle::GetZExtent(), PlaneOutline::IsInside(), PlaneView::kU, PlaneView::kV, and Munits::m.

00671                                   {
00672   // determine whether shower is contained.
00673 
00674   CandStripHandleItr sItr(GetDaughterIterator());
00675   CandStripHandle * begstrip = sItr();
00676   if(!begstrip)return true;
00677   const VldContext * vld = begstrip->GetVldContext();
00678   if(!vld)return true;
00679 
00680   Bool_t contained =true;
00681   double totcharge = 0;
00682   double containedcharge = 0;
00683   UgliGeomHandle ugh(*vld); 
00684   PlaneOutline pl;
00685   float detzmin=0;
00686   float detzmax=999;
00687   ugh.GetZExtent(detzmin,detzmax,-1);
00688   float u=0,v=0;
00689   float xedge,yedge,dist;
00690 
00691   while(CandStripHandle * strip = sItr()){
00692     float z = strip->GetZPos();
00693     if(z<detzmin+0.1*Munits::m ||
00694        z>detzmax-0.1*Munits::m) contained=false;
00695     PlexPlaneId plnid(vld->GetDetector(),strip->GetPlane(),false);
00696     if(plnid.GetPlaneView()==PlaneView::kV){
00697       v=strip->GetTPos();
00698       u=GetU(strip->GetPlane());
00699     }
00700     else if(plnid.GetPlaneView()==PlaneView::kU){
00701       u=strip->GetTPos();
00702       v=GetV(strip->GetPlane());
00703     }
00704     float x = 0.707*(u-v);
00705     float y = 0.707*(u+v);
00706     pl.DistanceToEdge(x, y,
00707                       plnid.GetPlaneView(),
00708                       plnid.GetPlaneCoverage(),
00709                       dist, xedge, yedge);
00710     bool isInside = pl.IsInside( x, y,
00711                                  plnid.GetPlaneView(),
00712                                  plnid.GetPlaneCoverage());
00713     
00714     totcharge += strip->GetCharge();
00715     isInside &= dist>0.1*Munits::m;
00716     if(isInside) {
00717       containedcharge +=strip->GetCharge();
00718     }
00719   }
00720   if(totcharge>0) contained = containedcharge/totcharge>0.9;
00721   return contained;
00722 }

Bool_t CandShowerHandle::IsTPosValid ( Int_t  plane  )  const

Definition at line 333 of file CandShowerHandle.cxx.

References count, CandShower::fUPos, CandShower::fVPos, and CandHandle::GetCandBase().

00334 {
00335   const CandShower *shower = dynamic_cast<const CandShower*>(GetCandBase());
00336   if ((shower->fUPos).count(plane) && (shower->fVPos).count(plane)) {
00337     return kTRUE;
00338   }
00339   return kFALSE;
00340 }

Bool_t CandShowerHandle::IsUnphysical ( Float_t  xtalkFrac = 0.660,
Float_t  xtalkCut = 2.0 
) [virtual]

Reimplemented in CandShowerSRHandle.

Definition at line 746 of file CandShowerHandle.cxx.

References CandHandle::GetDaughterIterator(), CandRecoHandle::GetNStrip(), and CalDigitType::kPE.

00747 {
00748   if(this->GetNStrip()<=0) return true;
00749   Float_t nxtalk = 0;
00750   CandStripHandleItr stripItr(GetDaughterIterator());
00751   while (const CandStripHandle *strip =
00752          dynamic_cast<const CandStripHandle*>(stripItr())) {
00753     if(strip->GetCharge(CalDigitType::kPE) < xtalkCut) nxtalk+=1;      
00754   }
00755   if(nxtalk/Float_t(this->GetNStrip())>xtalkFrac) return true;
00756   return false;
00757 }

NavKey CandShowerHandle::KeyFromSlice ( const CandShowerHandle reco  )  [static]

Reimplemented from CandRecoHandle.

Reimplemented in CandFitShowerEMHandle.

Definition at line 1126 of file CandShowerHandle.cxx.

References CandRecoHandle::GetCandSlice(), and CandHandle::GetUidInt().

Referenced by AlgEventSRList::RunAlg(), and AlgEventSSList::RunAlg().

01127 {
01128   if (reco->GetCandSlice()) {
01129     return static_cast<Int_t>(reco->GetCandSlice()->GetUidInt());
01130   }
01131   return 0;
01132 
01133 }

void CandShowerHandle::RemoveCluster ( CandClusterHandle cluster  ) 

Definition at line 650 of file CandShowerHandle.cxx.

References CandHandle::GetOwnedCandBase().

Referenced by AlgEventSRList::AddStripToEvent().

00651 {
00652   const TObjArray &clusterlist =
00653                (dynamic_cast<CandShower*>(GetOwnedCandBase()))->fClusterList;
00654   Bool_t found(0);
00655   for (Int_t i=0; i<=clusterlist.GetLast() && !found; i++) {
00656     CandClusterHandle *target =
00657                     dynamic_cast<CandClusterHandle*>(clusterlist.At(i));
00658     if (*cluster == *target){
00659       (dynamic_cast<CandShower*>(GetOwnedCandBase()))->fClusterList.
00660         RemoveAt(i);
00661       delete target;
00662       (dynamic_cast<CandShower*>(GetOwnedCandBase()))->fClusterList.
00663                                               Compress();
00664      return;
00665     }
00666   }
00667   return;
00668 }

void CandShowerHandle::SetEnergy ( Double_t  ,
CandShowerHandle::EShowerType  = kCC 
)
void CandShowerHandle::SetMinStripPE ( Double_t  minstrippe  ) 

Definition at line 116 of file CandShowerHandle.cxx.

References CandShower::fMinStripPE, and CandHandle::GetOwnedCandBase().

00117 {
00118   CandShower *shower = dynamic_cast<CandShower*>(GetOwnedCandBase());
00119   shower->fMinStripPE=minstrippe;
00120 }

void CandShowerHandle::SetT ( Int_t  plane,
StripEnd::StripEnd_t  stripend_t,
Double_t  time 
)

Definition at line 142 of file CandShowerHandle.cxx.

References CandShower::fTime, CandHandle::GetOwnedCandBase(), StripEnd::kNegative, and StripEnd::kPositive.

Referenced by AlgShowerSR::SetT().

00143 {
00144   CandShower *shower = dynamic_cast<CandShower*>(GetOwnedCandBase());
00145   switch (stripend_t) {
00146   case StripEnd::kNegative:
00147     shower->fTime[0][plane] = time;
00148     break;
00149   case StripEnd::kPositive:
00150     shower->fTime[1][plane] = time;
00151     break;
00152   default:
00153     shower->fTime[0][plane] = time;
00154     break;
00155   }
00156 }

void CandShowerHandle::SetU ( Int_t  plane,
Float_t  tpos 
)

Definition at line 85 of file CandShowerHandle.cxx.

References CandShower::fUPos, and CandHandle::GetOwnedCandBase().

Referenced by AlgShowerAtNu::RunAlg(), AlgShowerCam::SetShowerCoordinates(), and AlgShowerSR::SetUV().

00086 {
00087   CandShower *shower = dynamic_cast<CandShower*>(GetOwnedCandBase());
00088   shower->fUPos[plane] = tpos;
00089 }

void CandShowerHandle::SetV ( Int_t  plane,
Float_t  tpos 
)

Definition at line 100 of file CandShowerHandle.cxx.

References CandShower::fVPos, and CandHandle::GetOwnedCandBase().

Referenced by AlgShowerAtNu::RunAlg(), AlgShowerCam::SetShowerCoordinates(), and AlgShowerSR::SetUV().

00101 {
00102   CandShower *shower = dynamic_cast<CandShower*>(GetOwnedCandBase());
00103   shower->fVPos[plane] = tpos;
00104 }

void CandShowerHandle::Trace ( const char *  c = ""  )  const [virtual]

Reimplemented from CandRecoHandle.

Reimplemented in CandShowerAtNuHandle, CandFitShowerEMHandle, CandShowerEMHandle, and CandShowerSRHandle.

Definition at line 69 of file CandShowerHandle.cxx.

References Msg::kDebug, and MSG.

00070 {
00071   MSG("Cand", Msg::kDebug)
00072     << "**********Begin CandShowerHandle::Trace(\"" << c << "\")" << endl
00073            << "Information from CandShowerHandle's CandHandle: " << endl;
00074   CandHandle::Trace(c);
00075   MSG("Cand", Msg::kDebug)
00076      << "**********End CandShowerHandle::Trace(\"" << c << "\")" << endl;
00077 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1