TrackRecoPerf Class Reference

#include <TrackRecoPerf.h>

List of all members.

Public Member Functions

 TrackRecoPerf ()
 TrackRecoPerf (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 ** hTrackPur
TH1F ** hTrackCom
TH1F ** hL10TrackInPur
TH1F ** hL10TrackInCom
TProfile ** hTrackPurvNuCosZ
TProfile ** hTrackComvNuCosZ
TProfile ** hTrackPurvNuY
TProfile ** hTrackComvNuY
TProfile ** hTrackPurvNuVtxDepth
TProfile ** hTrackComvNuVtxDepth


Detailed Description

Definition at line 8 of file TrackRecoPerf.h.


Constructor & Destructor Documentation

TrackRecoPerf::TrackRecoPerf (  ) 

Definition at line 31 of file TrackRecoPerf.cxx.

00032 {
00033   Reset();
00034 }

TrackRecoPerf::TrackRecoPerf ( int  iter  ) 

Definition at line 36 of file TrackRecoPerf.cxx.

References fIter, and Reset().

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


Member Function Documentation

bool TrackRecoPerf::FillEvent ( const AtmosEvent evt  ) 

Definition at line 155 of file TrackRecoPerf.cxx.

References copy(), AtmosMC::Ehad, AtmosMC::Enu, fLoud, AtNuAnaUtil::GetPrimaryShower(), hL10TrackInCom, hL10TrackInPur, hL10TrueNuVisE, hTrackCom, hTrackComvNuCosZ, hTrackComvNuVtxDepth, hTrackComvNuY, hTrackPur, hTrackPurvNuCosZ, hTrackPurvNuVtxDepth, hTrackPurvNuY, hTrueNuVisE, UtilMisc::IType(), UtilMisc::kNuECC, UtilMisc::kNuMuCC, UtilMisc::kNuNC, UtilMisc::kNuTauCC, Msg::kVerbose, AtmosEvent::MCInfo, MSG, NEvents, AtmosEvent::NShowers, AtmosEvent::NTracks, AtmosMC::PhadZ, AtmosMC::PnuZ, AtNuAnaUtil::PrimaryShowerStripSets(), UtilStrip::SumEnergy(), and th().

00155                                                      {
00156   MSG("ShwPerf",Msg::kVerbose) << "TrackRecoPerf::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       hTrackPur[itype]->Fill(ShwPurity);
00256       hL10TrackInPur[itype]->Fill(1.0 - ShwPurity);
00257       hTrackPurvNuCosZ[itype]->Fill(TrueNuCosZ, ShwPurity);
00258       hTrackPurvNuY[itype]->Fill(event->MCInfo.y, ShwPurity);
00259       hTrackPurvNuVtxDepth[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       hTrackCom[itype]->Fill(ShwCompleteness);
00269       hL10TrackInCom[itype]->Fill(1.0 - ShwCompleteness);
00270       hTrackComvNuCosZ[itype]->Fill(TrueNuCosZ, ShwCompleteness);
00271       hTrackComvNuY[itype]->Fill(event->MCInfo.y, ShwCompleteness);
00272       hTrackComvNuVtxDepth[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 TrackRecoPerf::Finish (  ) 

Definition at line 286 of file TrackRecoPerf.cxx.

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

00286                            {
00287   MSG("ShwPerf",Msg::kVerbose) << "TrackRecoPerf::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 TrackRecoPerf::Loud ( int  i  )  [inline]

Definition at line 21 of file TrackRecoPerf.h.

References fLoud.

00021 {fLoud=i;}

int TrackRecoPerf::Loud (  )  [inline]

Definition at line 20 of file TrackRecoPerf.h.

References fLoud.

00020 {return fLoud;}

void TrackRecoPerf::MakeHistos (  ) 

Definition at line 51 of file TrackRecoPerf.cxx.

References HistMan::Adopt(), HistMan::Book(), Form(), Nav::GetName(), hL10TrackInCom, hL10TrackInPur, hL10TrueNuVisE, hTrackCom, hTrackComvNuCosZ, hTrackComvNuVtxDepth, hTrackComvNuY, hTrackPur, hTrackPurvNuCosZ, hTrackPurvNuVtxDepth, hTrackPurvNuY, hTrueNuVisE, Msg::kVerbose, LDisp, MSG, and UtilHist::TH1FLogX().

00051                                {
00052   MSG("ShwPerf",Msg::kVerbose) << "TrackRecoPerf::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   hTrackPur = new TH1F*[NTypes];
00073   for (unsigned int itype=0; itype<NTypes; itype++) {
00074     hTrackPur[itype] = HMBase.Book<TH1F>
00075       (Form("TrackPur%s",hsuf[itype]),"", 100,0.0+0.0001,1.0+0.0001);
00076     hTrackPur[itype]->GetXaxis()->SetTitle("Track Purity");
00077     hTrackPur[itype]->GetYaxis()->SetTitle("Events / 0.005");
00078   }
00079 
00080   hTrackCom = new TH1F*[NTypes];
00081   for (unsigned int itype=0; itype<NTypes; itype++) {
00082     hTrackCom[itype] = HMBase.Book<TH1F>
00083       (Form("TrackCom%s",hsuf[itype]),"", 100,0.0+0.0001,1.0+0.0001);
00084     hTrackCom[itype]->GetXaxis()->SetTitle("Track Completeness");
00085     hTrackCom[itype]->GetYaxis()->SetTitle("Events / 0.005");
00086   }
00087 
00088   hL10TrackInPur = new TH1F*[NTypes];
00089   for (unsigned int itype=0; itype<NTypes; itype++) {
00090     hL10TrackInPur[itype] = UtilHist::TH1FLogX
00091       (Form("L10TrackInPur%s",hsuf[itype]),"", 40,0.0001*LDisp,1.0*LDisp);
00092     hL10TrackInPur[itype]->GetXaxis()->SetTitle("1.0 - Track Purity");
00093     hL10TrackInPur[itype]->GetYaxis()->SetTitle("Events / log_{10} = 0.1");
00094     HMBase.Adopt(".", hL10TrackInPur[itype]);
00095   }
00096 
00097   hL10TrackInCom = new TH1F*[NTypes];
00098   for (unsigned int itype=0; itype<NTypes; itype++) {
00099     hL10TrackInCom[itype] = UtilHist::TH1FLogX
00100       (Form("L10TrackInCom%s",hsuf[itype]),"", 40,0.0001*LDisp,1.0*LDisp);
00101     hL10TrackInCom[itype]->GetXaxis()->SetTitle("1.0 - Track Completeness");
00102     hL10TrackInCom[itype]->GetYaxis()->SetTitle("Events / log_{10} = 0.1");
00103     HMBase.Adopt(".", hL10TrackInCom[itype]);
00104   }
00105 
00106   hTrackPurvNuCosZ = new TProfile*[NTypes];
00107   for (unsigned int itype=0; itype<NTypes; itype++) {
00108     hTrackPurvNuCosZ[itype] = HMBase.Book<TProfile>
00109       (Form("TrackPurvNuCosZ%s",hsuf[itype]),"", 41,-1.025,1.025);
00110     hTrackPurvNuCosZ[itype]->GetXaxis()->SetTitle("Neutrino cos #theta_{z}");
00111     hTrackPurvNuCosZ[itype]->GetYaxis()->SetTitle("Track Purity");
00112   }
00113 
00114   hTrackComvNuCosZ = new TProfile*[NTypes];
00115   for (unsigned int itype=0; itype<NTypes; itype++) {
00116     hTrackComvNuCosZ[itype] = HMBase.Book<TProfile>
00117       (Form("TrackComvNuCosZ%s",hsuf[itype]),"", 41,-1.025,1.025);
00118     hTrackComvNuCosZ[itype]->GetXaxis()->SetTitle("Neutrino cos #theta_{z}");
00119     hTrackComvNuCosZ[itype]->GetYaxis()->SetTitle("Track Completeness");
00120   }
00121 
00122   hTrackPurvNuY = new TProfile*[NTypes];
00123   for (unsigned int itype=0; itype<NTypes; itype++) {
00124     hTrackPurvNuY[itype] = HMBase.Book<TProfile>
00125       (Form("TrackPurvNuY%s",hsuf[itype]),"", 40,0.0,1.0);
00126     hTrackPurvNuY[itype]->GetXaxis()->SetTitle("Neutrino Kinematic Y");
00127     hTrackPurvNuY[itype]->GetYaxis()->SetTitle("Track Purity");
00128   }
00129 
00130   hTrackComvNuY = new TProfile*[NTypes];
00131   for (unsigned int itype=0; itype<NTypes; itype++) {
00132     hTrackComvNuY[itype] = HMBase.Book<TProfile>
00133       (Form("TrackComvNuY%s",hsuf[itype]),"", 40,0.0,1.0);
00134     hTrackComvNuY[itype]->GetXaxis()->SetTitle("Neutrino Kinematic Y");
00135     hTrackComvNuY[itype]->GetYaxis()->SetTitle("Track Completeness");
00136   }
00137 
00138   hTrackPurvNuVtxDepth = new TProfile*[NTypes];
00139   for (unsigned int itype=0; itype<NTypes; itype++) {
00140     hTrackPurvNuVtxDepth[itype] = HMBase.Book<TProfile>
00141       (Form("TrackPurvNuVtxDepth%s",hsuf[itype]),"", 40,0.0,4.0);
00142     hTrackPurvNuVtxDepth[itype]->GetXaxis()->SetTitle("Neutrino Vertex Depth");
00143     hTrackPurvNuVtxDepth[itype]->GetYaxis()->SetTitle("Track Purity");
00144   }
00145 
00146   hTrackComvNuVtxDepth = new TProfile*[NTypes];
00147   for (unsigned int itype=0; itype<NTypes; itype++) {
00148     hTrackComvNuVtxDepth[itype] = HMBase.Book<TProfile>
00149       (Form("TrackComvNuVtxDepth%s",hsuf[itype]),"", 40,0.0,4.0);
00150     hTrackComvNuVtxDepth[itype]->GetXaxis()->SetTitle("Neutrino Vertex Depth");
00151     hTrackComvNuVtxDepth[itype]->GetYaxis()->SetTitle("Track Completeness");
00152   }
00153 }

void TrackRecoPerf::Reset (  ) 

Definition at line 42 of file TrackRecoPerf.cxx.

References fIter, fLoud, and NEvents.

Referenced by TrackRecoPerf().

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


Member Data Documentation

int TrackRecoPerf::fIter [private]

Definition at line 24 of file TrackRecoPerf.h.

Referenced by Reset(), and TrackRecoPerf().

int TrackRecoPerf::fLoud [private]

Definition at line 26 of file TrackRecoPerf.h.

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

TH1F** TrackRecoPerf::hL10TrackInCom [private]

Definition at line 38 of file TrackRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TH1F** TrackRecoPerf::hL10TrackInPur [private]

Definition at line 37 of file TrackRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

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

Definition at line 31 of file TrackRecoPerf.h.

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

TH1F** TrackRecoPerf::hTrackCom [private]

Definition at line 36 of file TrackRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TProfile** TrackRecoPerf::hTrackComvNuCosZ [private]

Definition at line 41 of file TrackRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TProfile** TrackRecoPerf::hTrackComvNuVtxDepth [private]

Definition at line 45 of file TrackRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TProfile** TrackRecoPerf::hTrackComvNuY [private]

Definition at line 43 of file TrackRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TH1F** TrackRecoPerf::hTrackPur [private]

Definition at line 35 of file TrackRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TProfile** TrackRecoPerf::hTrackPurvNuCosZ [private]

Definition at line 40 of file TrackRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TProfile** TrackRecoPerf::hTrackPurvNuVtxDepth [private]

Definition at line 44 of file TrackRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

TProfile** TrackRecoPerf::hTrackPurvNuY [private]

Definition at line 42 of file TrackRecoPerf.h.

Referenced by FillEvent(), and MakeHistos().

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

Definition at line 32 of file TrackRecoPerf.h.

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

int TrackRecoPerf::NEvents [private]

Definition at line 28 of file TrackRecoPerf.h.

Referenced by FillEvent(), and Reset().


The documentation for this class was generated from the following files:
Generated on Wed Dec 10 22:50:38 2014 for loon by  doxygen 1.4.7