SubShowerVarAna Class Reference

#include <SubShowerVarAna.h>

Inheritance diagram for SubShowerVarAna:
NueAnaBase

List of all members.

Public Member Functions

 SubShowerVarAna (SubShowerVar &sv)
virtual ~SubShowerVarAna ()
void Analyze (int evtn, RecRecordImp< RecCandHeader > *srobj)
void Analyze (RecRecordImp< RecCandHeader > *srobj, NtpSRShower *ntpShower)

Private Attributes

SubShowerVarfSubShowerVar

Detailed Description

Definition at line 14 of file SubShowerVarAna.h.


Constructor & Destructor Documentation

SubShowerVarAna::SubShowerVarAna ( SubShowerVar sv  ) 

Definition at line 25 of file SubShowerVarAna.cxx.

00025                                                 :
00026   fSubShowerVar(sv)
00027 {
00028 }

SubShowerVarAna::~SubShowerVarAna (  )  [virtual]

Definition at line 30 of file SubShowerVarAna.cxx.

00031 {}


Member Function Documentation

void SubShowerVarAna::Analyze ( RecRecordImp< RecCandHeader > *  srobj,
NtpSRShower ntpShower = 0 
)

Definition at line 49 of file SubShowerVarAna.cxx.

References NtpSRCluster::avgdev, SubShowerVar::E2to1U, SubShowerVar::E2to1V, SubShowerVar::eEMU, SubShowerVar::eEMV, SubShowerVar::eHadU, SubShowerVar::eHadV, SubShowerVar::eHalU, SubShowerVar::eHalV, SubShowerVar::eTrkU, SubShowerVar::eTrkV, SubShowerVar::eXTkU, SubShowerVar::eXTkV, fSubShowerVar, SntpHelpers::GetCluster(), NtpSRStripPulseHeight::gev, NtpSRCluster::id, ANtpDefaultValue::kDouble, SubShowerVar::ncluster, SubShowerVar::nclusterU, SubShowerVar::nclusterU_he, SubShowerVar::nclusterV, SubShowerVar::nclusterV_he, SubShowerVar::nEMU, SubShowerVar::nEMU_he, SubShowerVar::nEMV, SubShowerVar::nEMV_he, SubShowerVar::nHadU, SubShowerVar::nHadU_he, SubShowerVar::nHadV, SubShowerVar::nHadV_he, SubShowerVar::nHalU, SubShowerVar::nHalU_he, SubShowerVar::nHalV, SubShowerVar::nHalV_he, SubShowerVar::nPhysClusterU, SubShowerVar::nPhysClusterV, SubShowerVar::nstp0U, SubShowerVar::nstp0V, NtpSRCluster::nstrip, SubShowerVar::nTrkU, SubShowerVar::nTrkU_he, SubShowerVar::nTrkV, SubShowerVar::nTrkV_he, SubShowerVar::nXTkU, SubShowerVar::nXTkU_he, SubShowerVar::nXTkV, SubShowerVar::nXTkV_he, NtpSRCluster::ph, SubShowerVar::PHAvgDevU, SubShowerVar::PHAvgDevV, SubShowerVar::PHAvgIDU, SubShowerVar::PHAvgIDV, SubShowerVar::PHAvgProbEMU, SubShowerVar::PHAvgProbEMV, SubShowerVar::PHFracRMSU, SubShowerVar::PHFracRMSV, SubShowerVar::pid, NtpSRCluster::planeview, NtpSRCluster::probem, SubShowerVar::Reset(), SubShowerNN::Value(), SubShowerVar::wEMU, SubShowerVar::wEMV, SubShowerVar::wHadU, SubShowerVar::wHadV, SubShowerVar::wHalU, SubShowerVar::wHalV, SubShowerVar::wTrkU, SubShowerVar::wTrkV, SubShowerVar::wXTkU, SubShowerVar::wXTkV, and SubShowerVar::Zero().

00050 {    
00051   
00052   fSubShowerVar.Reset();
00053   
00054   if(srobj==0){
00055     return;
00056   }
00057   
00058   if (ntpShower==0) {
00059     return;
00060   }
00061   
00062   if(((dynamic_cast<NtpStRecord *>(srobj))==0)&&
00063      ((dynamic_cast<NtpSRRecord *>(srobj))==0)){
00064     return;
00065   }
00066   
00067   fSubShowerVar.Zero();
00068   
00069   fSubShowerVar.ncluster = ntpShower->ncluster;
00070   fSubShowerVar.nclusterU = ntpShower->nUcluster;
00071   fSubShowerVar.nclusterV = ntpShower->nVcluster;
00072   
00073   Double_t totphU = 0.;
00074   Double_t totphV = 0.;
00075   Double_t E0U = 0.;
00076   Double_t E0V = 0.;
00077   Double_t maxU = 0.;
00078   Double_t maxV = 0.;
00079   Double_t phystotphU = 0.;
00080   Double_t phystotphV = 0.;
00081   
00082   for(int k=0; k<fSubShowerVar.ncluster; k++){
00083     Int_t index = ntpShower->clu[k];
00084     NtpSRCluster *ntpCluster = SntpHelpers::GetCluster(index,srobj);
00085     
00086     if(ntpCluster->planeview==2){
00087       
00088       totphU += ntpCluster->ph.gev;
00089       fSubShowerVar.PHAvgIDU += (ntpCluster->id)*ntpCluster->ph.gev;
00090       fSubShowerVar.PHAvgProbEMU += (ntpCluster->probem)*ntpCluster->ph.gev;
00091       fSubShowerVar.PHAvgDevU += (ntpCluster->avgdev)*ntpCluster->ph.gev;
00092       
00093       if(ntpCluster->ph.gev>0.5) fSubShowerVar.nclusterU_he += 1;
00094       
00095       if(ntpCluster->id==0||ntpCluster->id==1||ntpCluster->id==3) {
00096         fSubShowerVar.nPhysClusterU+=1;
00097         fSubShowerVar.PHFracRMSU += (ntpCluster->ph.gev*ntpCluster->ph.gev);
00098         phystotphU += ntpCluster->ph.gev;
00099       }
00100       if(ntpCluster->ph.gev>maxU){
00101         maxU = ntpCluster->ph.gev;
00102         fSubShowerVar.nstp0U = ntpCluster->nstrip;
00103         E0U = maxU;
00104       }
00105       
00106       if(ntpCluster->id==0) {
00107         fSubShowerVar.nEMU+=1;
00108         if(ntpCluster->ph.gev>0.5) fSubShowerVar.nEMU_he+=1;
00109         fSubShowerVar.eEMU+=ntpCluster->ph.gev;
00110       }
00111       else if(ntpCluster->id==1) {
00112         fSubShowerVar.nHadU+=1;
00113         if(ntpCluster->ph.gev>0.5) fSubShowerVar.nHadU_he+=1;
00114         fSubShowerVar.eHadU+=ntpCluster->ph.gev;
00115       }
00116       else if(ntpCluster->id==3) {
00117         fSubShowerVar.nTrkU+=1;
00118         if(ntpCluster->ph.gev>0.5) fSubShowerVar.nTrkU_he+=1;
00119         fSubShowerVar.eTrkU+=ntpCluster->ph.gev;
00120       }
00121       else if(ntpCluster->id==2) {
00122         fSubShowerVar.nXTkU+=1;
00123         if(ntpCluster->ph.gev>0.5) fSubShowerVar.nXTkU_he+=1;
00124         fSubShowerVar.eXTkU+=ntpCluster->ph.gev;
00125       }
00126       else if(ntpCluster->id==4 || ntpCluster->id==5) {
00127         fSubShowerVar.nHalU+=1;
00128         if(ntpCluster->ph.gev>0.5) fSubShowerVar.nHalU_he+=1;
00129         fSubShowerVar.eHalU+=ntpCluster->ph.gev;
00130       }
00131       
00132     }
00133     else if(ntpCluster->planeview==3){
00134       
00135       totphV += ntpCluster->ph.gev;
00136       fSubShowerVar.PHAvgIDV += (ntpCluster->id)*ntpCluster->ph.gev;
00137       fSubShowerVar.PHAvgProbEMV += (ntpCluster->probem)*ntpCluster->ph.gev;
00138       fSubShowerVar.PHAvgDevV += (ntpCluster->avgdev)*ntpCluster->ph.gev;
00139       
00140       if(ntpCluster->ph.gev>0.5) fSubShowerVar.nclusterV_he += 1;
00141       
00142       if(ntpCluster->id==0||ntpCluster->id==1||ntpCluster->id==3) {
00143         fSubShowerVar.nPhysClusterV+=1;
00144         fSubShowerVar.PHFracRMSV += (ntpCluster->ph.gev*ntpCluster->ph.gev);
00145         phystotphV += ntpCluster->ph.gev;
00146       }
00147       if(ntpCluster->ph.gev>maxV){
00148         maxV = ntpCluster->ph.gev;
00149         fSubShowerVar.nstp0V = ntpCluster->nstrip;
00150         E0V = maxV;
00151       }
00152       
00153       if(ntpCluster->id==0) {
00154         fSubShowerVar.nEMV+=1;
00155         if(ntpCluster->ph.gev>0.5) fSubShowerVar.nEMV_he+=1;
00156         fSubShowerVar.eEMV+=ntpCluster->ph.gev;
00157       }
00158       else if(ntpCluster->id==1) {
00159         fSubShowerVar.nHadV+=1;
00160         if(ntpCluster->ph.gev>0.5) fSubShowerVar.nHadV_he+=1;
00161         fSubShowerVar.eHadV+=ntpCluster->ph.gev;
00162       }
00163       else if(ntpCluster->id==3) {
00164         fSubShowerVar.nTrkV+=1;
00165         if(ntpCluster->ph.gev>0.5) fSubShowerVar.nTrkV_he+=1;
00166         fSubShowerVar.eTrkV+=ntpCluster->ph.gev;
00167       }
00168       else if(ntpCluster->id==2) {
00169         fSubShowerVar.nXTkV+=1;
00170         if(ntpCluster->ph.gev>0.5) fSubShowerVar.nXTkV_he+=1;
00171         fSubShowerVar.eXTkV+=ntpCluster->ph.gev;
00172       }
00173       else if(ntpCluster->id==4 || ntpCluster->id==5) {
00174         fSubShowerVar.nHalV+=1;
00175         if(ntpCluster->ph.gev>0.5) fSubShowerVar.nHalV_he+=1;
00176         fSubShowerVar.eHalV+=ntpCluster->ph.gev;
00177       }    
00178     }
00179   }
00180   if(totphU>0){
00181     fSubShowerVar.PHAvgIDU /= totphU;
00182     fSubShowerVar.PHAvgProbEMU /= totphU;
00183     fSubShowerVar.PHAvgDevU /= totphU;
00184   }
00185   else{
00186     fSubShowerVar.PHAvgIDU = ANtpDefVal::kDouble;
00187     fSubShowerVar.PHAvgProbEMU = ANtpDefVal::kDouble;
00188     fSubShowerVar.PHAvgDevU = ANtpDefVal::kDouble;
00189   }
00190   if(totphV>0){
00191     fSubShowerVar.PHAvgIDV /= totphV;
00192     fSubShowerVar.PHAvgProbEMV /= totphV;
00193     fSubShowerVar.PHAvgDevV /= totphV;
00194   }
00195   else{
00196     fSubShowerVar.PHAvgIDV = ANtpDefVal::kDouble;
00197     fSubShowerVar.PHAvgProbEMV = ANtpDefVal::kDouble;
00198     fSubShowerVar.PHAvgDevV = ANtpDefVal::kDouble;
00199   }
00200   
00201   Double_t maxU1 = 0.;
00202   Double_t maxV1 = 0.;
00203   for(int k=0; k<fSubShowerVar.ncluster; k++){
00204     Int_t index = ntpShower->clu[k];
00205     NtpSRCluster *ntpCluster = SntpHelpers::GetCluster(index,srobj);
00206     if(ntpCluster->planeview==2 && E0U>0){
00207       if(ntpCluster->ph.gev>maxU1&&ntpCluster->ph.gev<E0U){
00208         fSubShowerVar.E2to1U = ntpCluster->ph.gev/E0U;
00209         maxU1 = ntpCluster->ph.gev;
00210       }
00211     }
00212     else if(ntpCluster->planeview==3 && E0V>0){
00213       if(ntpCluster->ph.gev>maxV1&&ntpCluster->ph.gev<E0V){
00214         fSubShowerVar.E2to1V = ntpCluster->ph.gev/E0V;
00215         maxV1 = ntpCluster->ph.gev;
00216       }
00217     }
00218   }
00219   
00220   if(ntpShower->nUcluster>0&&phystotphU>0){
00221     fSubShowerVar.PHFracRMSU /= (phystotphU*phystotphU*fSubShowerVar.nclusterU);
00222     fSubShowerVar.PHFracRMSU -= TMath::Power(1./fSubShowerVar.nclusterU,2);
00223     if(fSubShowerVar.PHFracRMSU>0) 
00224       fSubShowerVar.PHFracRMSU  = TMath::Sqrt(fSubShowerVar.PHFracRMSU);
00225     else fSubShowerVar.PHFracRMSU = 0;
00226   }
00227   else{
00228     fSubShowerVar.PHFracRMSU = ANtpDefVal::kDouble;
00229   }
00230   
00231   if(ntpShower->nVcluster>0&&phystotphV>0){
00232     fSubShowerVar.PHFracRMSV /= (phystotphV*phystotphV*fSubShowerVar.nclusterV);
00233     fSubShowerVar.PHFracRMSV -= TMath::Power(1./fSubShowerVar.nclusterV,2);
00234     if(fSubShowerVar.PHFracRMSV>0) 
00235       fSubShowerVar.PHFracRMSV  = TMath::Sqrt(fSubShowerVar.PHFracRMSV);
00236     else fSubShowerVar.PHFracRMSV = 0;
00237   }
00238   else{
00239     fSubShowerVar.PHFracRMSV = ANtpDefVal::kDouble;
00240   }
00241   
00242   //calculate SS pid...
00243   if(phystotphU>0&&phystotphV>0){
00244     SubShowerNN snn;
00245     Double_t params[4];
00246     params[0] = fSubShowerVar.PHFracRMSU + fSubShowerVar.PHFracRMSV;
00247     params[1] = (fSubShowerVar.PHAvgProbEMU*fSubShowerVar.PHAvgProbEMU + 
00248                  fSubShowerVar.PHAvgProbEMV*fSubShowerVar.PHAvgProbEMV)/2.;
00249     params[2] = (fSubShowerVar.PHAvgIDU + fSubShowerVar.PHAvgIDV)/2.;
00250     params[3] = fSubShowerVar.PHAvgDevU + fSubShowerVar.PHAvgDevV;
00251     fSubShowerVar.pid = snn.Value(0,params[0],params[1],params[2],params[3]);
00252   }
00253   else { 
00254    fSubShowerVar.pid = ANtpDefVal::kDouble;
00255   }
00256 
00257   //effective number:
00258   if(maxU>0) {
00259     fSubShowerVar.wEMU  = fSubShowerVar.eEMU/maxU;
00260     fSubShowerVar.wHadU = fSubShowerVar.eHadU/maxU;
00261     fSubShowerVar.wTrkU = fSubShowerVar.eTrkU/maxU;
00262     fSubShowerVar.wXTkU = fSubShowerVar.eXTkU/maxU;
00263     fSubShowerVar.wHalU = fSubShowerVar.eHalU/maxU;
00264   }
00265   if(maxV>0) {
00266     fSubShowerVar.wEMV  = fSubShowerVar.eEMV/maxV;
00267     fSubShowerVar.wHadV = fSubShowerVar.eHadV/maxV;
00268     fSubShowerVar.wTrkV = fSubShowerVar.eTrkV/maxV;
00269     fSubShowerVar.wXTkV = fSubShowerVar.eXTkV/maxV;
00270     fSubShowerVar.wHalV = fSubShowerVar.eHalV/maxV;
00271   }
00272 }

void SubShowerVarAna::Analyze ( int  evtn,
RecRecordImp< RecCandHeader > *  srobj 
) [virtual]

Implements NueAnaBase.

Definition at line 33 of file SubShowerVarAna.cxx.

References AtNuAnaUtil::GetPrimaryShower().

Referenced by NueRecordAna::Analyze().

00034 {
00035   if(srobj==0){
00036     return;
00037   }
00038   
00039   if(((dynamic_cast<NtpStRecord *>(srobj))==0)&&
00040      ((dynamic_cast<NtpSRRecord *>(srobj))==0)){
00041     return;
00042   }
00043   
00044   NtpSRShower *shower = SntpHelpers::GetPrimaryShower(evtn,srobj);
00045   Analyze(srobj,shower);
00046   
00047 }


Member Data Documentation

Definition at line 26 of file SubShowerVarAna.h.

Referenced by Analyze().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1