ShowerRecoPerf Class Reference

#include <ShowerRecoPerf.h>

List of all members.

Public Member Functions

 ShowerRecoPerf ()
 ShowerRecoPerf (int iter)
bool FillEvent (const AtmosEvent *evt)
void MakeHistos ()
void Reset ()
void Finish ()
int Loud ()
void Loud (int i)

Private Attributes

int fIter
int fLoud
int NEvents
TH1F ** hL10TrueNuVisE [3]
TH1F ** hTrueNuVisE [3]
TH1F ** hShowerPur
TH1F ** hShowerCom
TH1F ** hL10ShowerInPur
TH1F ** hL10ShowerInCom
TProfile ** hShowerPurvNuCosZ
TProfile ** hShowerComvNuCosZ
TProfile ** hShowerPurvNuY
TProfile ** hShowerComvNuY
TProfile ** hShowerPurvNuVtxDepth
TProfile ** hShowerComvNuVtxDepth

Detailed Description

Definition at line 8 of file ShowerRecoPerf.h.


Constructor & Destructor Documentation

ShowerRecoPerf::ShowerRecoPerf (  ) 

Definition at line 31 of file ShowerRecoPerf.cxx.

00032 {
00033   Reset();
00034 }

ShowerRecoPerf::ShowerRecoPerf ( int  iter  ) 

Definition at line 36 of file ShowerRecoPerf.cxx.

References fIter, and Reset().

00037 {
00038   Reset();
00039   fIter = iter;
00040 }


Member Function Documentation

bool ShowerRecoPerf::FillEvent ( const AtmosEvent evt  ) 

Definition at line 155 of file ShowerRecoPerf.cxx.

References copy(), TruthHelp::DeMuxFailures, AtmosMC::Ehad, AtmosMC::Enu, fLoud, AtNuAnaUtil::GetPrimaryShower(), TruthHelp::HadronHits, hL10ShowerInCom, hL10ShowerInPur, hL10TrueNuVisE, hShowerCom, hShowerComvNuCosZ, hShowerComvNuVtxDepth, hShowerComvNuY, hShowerPur, hShowerPurvNuCosZ, hShowerPurvNuVtxDepth, hShowerPurvNuY, hTrueNuVisE, UtilMisc::IType(), UtilMisc::kNuECC, UtilMisc::kNuMuCC, UtilMisc::kNuNC, UtilMisc::kNuTauCC, Msg::kVerbose, TruthHelp::LeptonHits, AtmosEvent::MCInfo, MSG, NEvents, AtmosEvent::NShowers, AtmosEvent::NTracks, AtNuAnaUtil::PrimaryShowerStripSets(), UtilStrip::SumEnergy(), th(), AtmosMC::VtxU, AtmosMC::VtxV, AtmosMC::VtxX, AtmosMC::VtxY, and AtmosMC::y.

00155                                                       {
00156   MSG("ShwPerf",Msg::kVerbose) << "ShowerRecoPerf::FillEvent" << endl;
00157   assert(event);
00158 
00159   int itype = UtilMisc::IType(event);
00160 
00161   // Only interested in neutrinos
00162   if(! (itype == UtilMisc::kNuNC ||
00163         itype == UtilMisc::kNuECC ||
00164         itype == UtilMisc::kNuMuCC ||
00165         itype == UtilMisc::kNuTauCC) ) return false;
00166 
00167   //A Safe Gaurd
00168   if(event->MCInfo.Enu == 0) return false;
00169 
00170   double TrueNuVisE = fabs(event->MCInfo.Enu);
00171   double TrueNuCosZ = event->MCInfo.PnuZ/fabs(event->MCInfo.Enu);
00172   if (itype==UtilMisc::kNuNC) {
00173     TrueNuVisE = fabs(event->MCInfo.Ehad);
00174     TrueNuCosZ = event->MCInfo.PhadZ / event->MCInfo.Ehad;
00175   }
00176 
00177   hL10TrueNuVisE[0][itype]->Fill(TrueNuVisE);
00178   hTrueNuVisE[0][itype]->Fill(TrueNuVisE);
00179 
00180   //Previous condition to call event shower-like
00181   if (event->NShowers == 1 && event->NTracks == 0) {
00182     hL10TrueNuVisE[1][itype]->Fill(TrueNuVisE);
00183     hTrueNuVisE[1][itype]->Fill(TrueNuVisE);
00184   }
00185 
00186   //New condition to call event shower-like
00187   const AtmosShower* shower =
00188     AtNuAnaUtil::GetPrimaryShower(const_cast<AtmosEvent*>(event));
00189   if( !shower ) return false;
00190 
00191   hL10TrueNuVisE[2][itype]->Fill(TrueNuVisE);
00192   hTrueNuVisE[2][itype]->Fill(TrueNuVisE);
00193 
00194   TruthHelp th(event);
00195 
00196   //Reco shower strip set
00197   set<SetStrip> ShowerStrips = AtNuAnaUtil::PrimaryShowerStripSets(event);
00198   
00199   //True shower strip set
00200   set<SetStrip> TrueShowerStrips;
00201   insert_iterator<set<SetStrip> >
00202     insiter(TrueShowerStrips, TrueShowerStrips.begin());
00203 
00204   if (itype == UtilMisc::kNuECC) {
00205     std::set_union(th.LeptonHits.begin(), th.LeptonHits.end(),
00206       th.HadronHits.begin(), th.HadronHits.end(), insiter);
00207   }
00208   if (itype==UtilMisc::kNuMuCC || itype==UtilMisc::kNuNC) {
00209     std::copy(th.HadronHits.begin(), th.HadronHits.end(), insiter);
00210   }
00211 
00212   //True shower strips associated with the reconstructed shower
00213   set<SetStrip> TrueStripsInRecoShower;
00214   insert_iterator<set<SetStrip> >
00215     insiter2(TrueStripsInRecoShower, TrueStripsInRecoShower.begin());
00216 
00217   std::set_intersection(ShowerStrips.begin(), ShowerStrips.end(),
00218     TrueShowerStrips.begin(), TrueShowerStrips.end(), insiter2);
00219 
00220   //Demux failures associated with the reconstructed shower
00221   set<SetStrip> DemuxFailureInRecoShower;
00222   insert_iterator<set<SetStrip> >
00223     insiter3(DemuxFailureInRecoShower, DemuxFailureInRecoShower.begin());
00224 
00225   std::set_intersection(ShowerStrips.begin(), ShowerStrips.end(),
00226     th.DeMuxFailures.begin(), th.DeMuxFailures.end(), insiter3);
00227 
00228   double TrueShwQ = UtilStrip::SumEnergy(TrueShowerStrips);
00229   double RecoShwQ = UtilStrip::SumEnergy(ShowerStrips);
00230   double TrueRecoShwQ = UtilStrip::SumEnergy(TrueStripsInRecoShower) -
00231     UtilStrip::SumEnergy(DemuxFailureInRecoShower);
00232 
00233   if (fLoud >= 3) {
00234     cout << "Event " << event->Snarl << "(" << itype << ")";
00235     cout << " TrueRecoShwQ = " << TrueRecoShwQ;
00236     cout << " TrueShwQ = " << TrueShwQ;
00237     cout << " RecoShwQ = " << RecoShwQ << endl;
00238   }
00239 
00240   if (TrueRecoShwQ > TrueShwQ && fLoud > 1) {
00241     cout << "Broken event " << event->Snarl << endl;
00242     cout << " TrueRecoShwQ = " << TrueRecoShwQ << endl;
00243     cout << " TrueShwQ = " << TrueShwQ << endl;
00244   }
00245 
00246   if (TrueRecoShwQ > RecoShwQ && fLoud > 1) {
00247     cout << "Broken event " << event->Snarl << endl;
00248     cout << " TrueRecoShwQ = " << TrueRecoShwQ << endl;
00249     cout << " RecoShwQ = " << RecoShwQ << endl;
00250   }
00251 
00252   if (TrueRecoShwQ > 0) {
00253     if (RecoShwQ > 0) {
00254       double ShwPurity  = TrueRecoShwQ / RecoShwQ;
00255       hShowerPur[itype]->Fill(ShwPurity);
00256       hL10ShowerInPur[itype]->Fill(1.0 - ShwPurity);
00257       hShowerPurvNuCosZ[itype]->Fill(TrueNuCosZ, ShwPurity);
00258       hShowerPurvNuY[itype]->Fill(event->MCInfo.y, ShwPurity);
00259       hShowerPurvNuVtxDepth[itype]->Fill(4.0 - TMath::Max(
00260           TMath::Max(event->MCInfo.VtxU, event->MCInfo.VtxV),
00261           TMath::Max(event->MCInfo.VtxX, event->MCInfo.VtxY)), ShwPurity);
00262       if(ShwPurity < 0.7 && fLoud > 1)
00263         cout << "Low Shower Purity (" << ShwPurity << ") on event "
00264              << event->Snarl << " itype = " << itype <<  endl;
00265     }
00266     if (TrueShwQ > 0) {
00267       double ShwCompleteness  = TrueRecoShwQ / TrueShwQ;
00268       hShowerCom[itype]->Fill(ShwCompleteness);
00269       hL10ShowerInCom[itype]->Fill(1.0 - ShwCompleteness);
00270       hShowerComvNuCosZ[itype]->Fill(TrueNuCosZ, ShwCompleteness);
00271       hShowerComvNuY[itype]->Fill(event->MCInfo.y, ShwCompleteness);
00272       hShowerComvNuVtxDepth[itype]->Fill(4.0 - TMath::Max(
00273           TMath::Max(event->MCInfo.VtxU, event->MCInfo.VtxV),
00274           TMath::Max(event->MCInfo.VtxX, event->MCInfo.VtxY)), ShwCompleteness);
00275       if(ShwCompleteness < 0.7 && fLoud > 1)
00276         cout << "Low Shower Completeness (" << ShwCompleteness << ") on event "
00277              << event->Snarl << " itype = " << itype <<  endl;
00278     }
00279   }
00280 
00281   NEvents++;
00282 
00283   return(true);
00284 }

void ShowerRecoPerf::Finish (  ) 

Definition at line 286 of file ShowerRecoPerf.cxx.

References HistMan::Adopt(), Form(), Nav::GetName(), hL10TrueNuVisE, hTrueNuVisE, Msg::kInfo, Msg::kVerbose, and MSG.

00286                             {
00287   MSG("ShwPerf",Msg::kVerbose) << "ShowerRecoPerf::Finish" << endl;
00288   HistMan HMBase(Form("%s/RecoEff", GetName()));
00289 
00290   const char* hsuf[] = {"NueCC", "NumuCC", "NutauCC", "NuNC"};
00291   const unsigned int NTypes = 4;
00292 
00293   //Create the efficiency plots
00294   TH1F *hEff = 0;
00295   for (unsigned int itype=0; itype<NTypes; itype++) {
00296     if(hTrueNuVisE[1][itype]->GetEntries() == 0) continue;
00297     MSG("ShwPerf",Msg::kInfo) << "itype = " << itype << endl;
00298     MSG("ShwPerf",Msg::kInfo) << "  Overall Reco0 Eff = "
00299       << hTrueNuVisE[2][itype]->GetEntries() /
00300          (double)hTrueNuVisE[0][itype]->GetEntries() << endl;
00301     MSG("ShwPerf",Msg::kInfo) << "  Overall Reco1 Eff = "
00302       << hTrueNuVisE[2][itype]->GetEntries() /
00303          (double)hTrueNuVisE[1][itype]->GetEntries() << endl;
00304 
00305     hL10TrueNuVisE[0][itype]->Sumw2();
00306     hL10TrueNuVisE[1][itype]->Sumw2();
00307     hL10TrueNuVisE[2][itype]->Sumw2();
00308     hEff = dynamic_cast<TH1F*>(hL10TrueNuVisE[2][itype]->Clone(
00309       Form("ShwEff0vL10TrueNuVisE%s", hsuf[itype])));
00310     hEff->Reset("ICE");
00311     hEff->Divide(hL10TrueNuVisE[1][itype],hL10TrueNuVisE[0][itype],1,1,"B");
00312     HMBase.Adopt(".", hEff);
00313     hEff = dynamic_cast<TH1F*>(hL10TrueNuVisE[2][itype]->Clone(
00314       Form("ShwEff1vL10TrueNuVisE%s", hsuf[itype])));
00315     hEff->Reset("ICE");
00316     hEff->Divide(hL10TrueNuVisE[2][itype],hL10TrueNuVisE[0][itype],1,1,"B");
00317     HMBase.Adopt(".", hEff);
00318 
00319     hTrueNuVisE[0][itype]->Sumw2();
00320     hTrueNuVisE[1][itype]->Sumw2();
00321     hTrueNuVisE[2][itype]->Sumw2();
00322     hEff = dynamic_cast<TH1F*>(hTrueNuVisE[2][itype]->Clone(
00323       Form("ShwEff0vTrueNuVisE%s", hsuf[itype])));
00324     hEff->Reset("ICE");
00325     hEff->Divide(hTrueNuVisE[1][itype],hTrueNuVisE[0][itype],1,1,"B");
00326     HMBase.Adopt(".", hEff);
00327     hEff = dynamic_cast<TH1F*>(hTrueNuVisE[2][itype]->Clone(
00328       Form("ShwEff1vTrueNuVisE%s", hsuf[itype])));
00329     hEff->Reset("ICE");
00330     hEff->Divide(hTrueNuVisE[2][itype],hTrueNuVisE[0][itype],1,1,"B");
00331     HMBase.Adopt(".", hEff);
00332   }
00333 }

void ShowerRecoPerf::Loud ( int  i  )  [inline]

Definition at line 21 of file ShowerRecoPerf.h.

References fLoud.

00021 {fLoud=i;}

int ShowerRecoPerf::Loud (  )  [inline]

Definition at line 20 of file ShowerRecoPerf.h.

References fLoud.

00020 {return fLoud;}

void ShowerRecoPerf::MakeHistos (  ) 

Definition at line 51 of file ShowerRecoPerf.cxx.

References HistMan::Adopt(), HistMan::Book(), Form(), Nav::GetName(), hL10ShowerInCom, hL10ShowerInPur, hL10TrueNuVisE, hShowerCom, hShowerComvNuCosZ, hShowerComvNuVtxDepth, hShowerComvNuY, hShowerPur, hShowerPurvNuCosZ, hShowerPurvNuVtxDepth, hShowerPurvNuY, hTrueNuVisE, Msg::kVerbose, LDisp, MSG, and UtilHist::TH1FLogX().

00051                                 {
00052   MSG("ShwPerf",Msg::kVerbose) << "ShowerRecoPerf::MakeHistos" << endl;
00053   HistMan HMBase(Form("%s/RecoEff", GetName()));
00054 
00055   const char* hsuf[] = {"NueCC", "NumuCC", "NutauCC", "NuNC"};
00056   const unsigned int NTypes = 4;
00057 
00058   for(int ieff=0; ieff<3; ieff++) {
00059     hL10TrueNuVisE[ieff] = new TH1F*[NTypes];
00060     for (unsigned int itype=0; itype<NTypes; itype++) {
00061       hL10TrueNuVisE[ieff][itype] = UtilHist::TH1FLogX
00062         (Form("L10TrueNuVisE%d%s",ieff,hsuf[itype]),"", 30,0.1,100.0);
00063     }
00064 
00065     hTrueNuVisE[ieff] = new TH1F*[NTypes];
00066     for (unsigned int itype=0; itype<NTypes; itype++) {
00067       hTrueNuVisE[ieff][itype] = new TH1F
00068         (Form("TrueNuVisE%d%s",ieff,hsuf[itype]),"", 60,0.0,30.0);
00069     }
00070   }
00071 
00072   hShowerPur = new TH1F*[NTypes];
00073   for (unsigned int itype=0; itype<NTypes; itype++) {
00074     hShowerPur[itype] = HMBase.Book<TH1F>
00075       (Form("ShowerPur%s",hsuf[itype]),"", 100,0.0+0.0001,1.0+0.0001);
00076     hShowerPur[itype]->GetXaxis()->SetTitle("Shower Purity");
00077     hShowerPur[itype]->GetYaxis()->SetTitle("Events / 0.005");
00078   }
00079 
00080   hShowerCom = new TH1F*[NTypes];
00081   for (unsigned int itype=0; itype<NTypes; itype++) {
00082     hShowerCom[itype] = HMBase.Book<TH1F>
00083       (Form("ShowerCom%s",hsuf[itype]),"", 100,0.0+0.0001,1.0+0.0001);
00084     hShowerCom[itype]->GetXaxis()->SetTitle("Shower Completeness");
00085     hShowerCom[itype]->GetYaxis()->SetTitle("Events / 0.005");
00086   }
00087 
00088   hL10ShowerInPur = new TH1F*[NTypes];
00089   for (unsigned int itype=0; itype<NTypes; itype++) {
00090     hL10ShowerInPur[itype] = UtilHist::TH1FLogX
00091       (Form("L10ShowerInPur%s",hsuf[itype]),"", 40,0.0001*LDisp,1.0*LDisp);
00092     hL10ShowerInPur[itype]->GetXaxis()->SetTitle("1.0 - Shower Purity");
00093     hL10ShowerInPur[itype]->GetYaxis()->SetTitle("Events / log_{10} = 0.1");
00094     HMBase.Adopt(".", hL10ShowerInPur[itype]);
00095   }
00096 
00097   hL10ShowerInCom = new TH1F*[NTypes];
00098   for (unsigned int itype=0; itype<NTypes; itype++) {
00099     hL10ShowerInCom[itype] = UtilHist::TH1FLogX
00100       (Form("L10ShowerInCom%s",hsuf[itype]),"", 40,0.0001*LDisp,1.0*LDisp);
00101     hL10ShowerInCom[itype]->GetXaxis()->SetTitle("1.0 - Shower Completeness");
00102     hL10ShowerInCom[itype]->GetYaxis()->SetTitle("Events / log_{10} = 0.1");
00103     HMBase.Adopt(".", hL10ShowerInCom[itype]);
00104   }
00105 
00106   hShowerPurvNuCosZ = new TProfile*[NTypes];
00107   for (unsigned int itype=0; itype<NTypes; itype++) {
00108     hShowerPurvNuCosZ[itype] = HMBase.Book<TProfile>
00109       (Form("ShowerPurvNuCosZ%s",hsuf[itype]),"", 41,-1.025,1.025);
00110     hShowerPurvNuCosZ[itype]->GetXaxis()->SetTitle("Neutrino cos #theta_{z}");
00111     hShowerPurvNuCosZ[itype]->GetYaxis()->SetTitle("Shower Purity");
00112   }
00113 
00114   hShowerComvNuCosZ = new TProfile*[NTypes];
00115   for (unsigned int itype=0; itype<NTypes; itype++) {
00116     hShowerComvNuCosZ[itype] = HMBase.Book<TProfile>
00117       (Form("ShowerComvNuCosZ%s",hsuf[itype]),"", 41,-1.025,1.025);
00118     hShowerComvNuCosZ[itype]->GetXaxis()->SetTitle("Neutrino cos #theta_{z}");
00119     hShowerComvNuCosZ[itype]->GetYaxis()->SetTitle("Shower Completeness");
00120   }
00121 
00122   hShowerPurvNuY = new TProfile*[NTypes];
00123   for (unsigned int itype=0; itype<NTypes; itype++) {
00124     hShowerPurvNuY[itype] = HMBase.Book<TProfile>
00125       (Form("ShowerPurvNuY%s",hsuf[itype]),"", 40,0.0,1.0);
00126     hShowerPurvNuY[itype]->GetXaxis()->SetTitle("Neutrino Kinematic Y");
00127     hShowerPurvNuY[itype]->GetYaxis()->SetTitle("Shower Purity");
00128   }
00129 
00130   hShowerComvNuY = new TProfile*[NTypes];
00131   for (unsigned int itype=0; itype<NTypes; itype++) {
00132     hShowerComvNuY[itype] = HMBase.Book<TProfile>
00133       (Form("ShowerComvNuY%s",hsuf[itype]),"", 40,0.0,1.0);
00134     hShowerComvNuY[itype]->GetXaxis()->SetTitle("Neutrino Kinematic Y");
00135     hShowerComvNuY[itype]->GetYaxis()->SetTitle("Shower Completeness");
00136   }
00137 
00138   hShowerPurvNuVtxDepth = new TProfile*[NTypes];
00139   for (unsigned int itype=0; itype<NTypes; itype++) {
00140     hShowerPurvNuVtxDepth[itype] = HMBase.Book<TProfile>
00141       (Form("ShowerPurvNuVtxDepth%s",hsuf[itype]),"", 40,0.0,4.0);
00142     hShowerPurvNuVtxDepth[itype]->GetXaxis()->SetTitle("Neutrino Vertex Depth");
00143     hShowerPurvNuVtxDepth[itype]->GetYaxis()->SetTitle("Shower Purity");
00144   }
00145 
00146   hShowerComvNuVtxDepth = new TProfile*[NTypes];
00147   for (unsigned int itype=0; itype<NTypes; itype++) {
00148     hShowerComvNuVtxDepth[itype] = HMBase.Book<TProfile>
00149       (Form("ShowerComvNuVtxDepth%s",hsuf[itype]),"", 40,0.0,4.0);
00150     hShowerComvNuVtxDepth[itype]->GetXaxis()->SetTitle("Neutrino Vertex Depth");
00151     hShowerComvNuVtxDepth[itype]->GetYaxis()->SetTitle("Shower Completeness");
00152   }
00153 }

void ShowerRecoPerf::Reset (  ) 

Definition at line 42 of file ShowerRecoPerf.cxx.

References fIter, fLoud, and NEvents.

Referenced by ShowerRecoPerf().

00043 {
00044   fIter = 1;
00045 
00046   fLoud = 0;
00047 
00048   NEvents = 0;
00049 }


Member Data Documentation

int ShowerRecoPerf::fIter [private]

Definition at line 24 of file ShowerRecoPerf.h.

Referenced by Reset(), and ShowerRecoPerf().

int ShowerRecoPerf::fLoud [private]

Definition at line 26 of file ShowerRecoPerf.h.

Referenced by FillEvent(), Loud(), and Reset().

Definition at line 38 of file ShowerRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

Definition at line 37 of file ShowerRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TH1F** ShowerRecoPerf::hL10TrueNuVisE[3] [private]

Definition at line 31 of file ShowerRecoPerf.h.

Referenced by FillEvent(), Finish(), and MakeHistos().

TH1F** ShowerRecoPerf::hShowerCom [private]

Definition at line 36 of file ShowerRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TProfile** ShowerRecoPerf::hShowerComvNuCosZ [private]

Definition at line 41 of file ShowerRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

Definition at line 45 of file ShowerRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TProfile** ShowerRecoPerf::hShowerComvNuY [private]

Definition at line 43 of file ShowerRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TH1F** ShowerRecoPerf::hShowerPur [private]

Definition at line 35 of file ShowerRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TProfile** ShowerRecoPerf::hShowerPurvNuCosZ [private]

Definition at line 40 of file ShowerRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

Definition at line 44 of file ShowerRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TProfile** ShowerRecoPerf::hShowerPurvNuY [private]

Definition at line 42 of file ShowerRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TH1F** ShowerRecoPerf::hTrueNuVisE[3] [private]

Definition at line 32 of file ShowerRecoPerf.h.

Referenced by FillEvent(), Finish(), and MakeHistos().

int ShowerRecoPerf::NEvents [private]

Definition at line 28 of file ShowerRecoPerf.h.

Referenced by FillEvent(), and Reset().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1