ValVtxModule Class Reference

#include <ValVtxModule.h>

Inheritance diagram for ValVtxModule:
JobCModule

List of all members.

Public Member Functions

 ValVtxModule ()
 ~ValVtxModule ()
JobCResult Reco (MomNavigator *mom)
void BeginJob ()
void EndJob ()

Private Member Functions

TString MakeIdString (VtxRecord *vr)
void FillPlots (VtxRecord *vr)

Private Attributes

int counter
int passcounter
int passcutcounter
int failcounter
int writecounter
vector< TString > names
vector< TString > classes

Detailed Description

Definition at line 23 of file ValVtxModule.h.


Constructor & Destructor Documentation

ValVtxModule::ValVtxModule (  ) 

Definition at line 26 of file ValVtxModule.cxx.

00026                           :
00027    counter(0),
00028    passcounter(0),
00029    passcutcounter(0),
00030    failcounter(0),
00031    writecounter(0)
00032 {}

ValVtxModule::~ValVtxModule (  ) 

Definition at line 36 of file ValVtxModule.cxx.

00037 {
00038 }


Member Function Documentation

void ValVtxModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 76 of file ValVtxModule.cxx.

References classes, Msg::kDebug, MSG, and names.

00077 {
00078   MSG("ValVtxModule",Msg::kDebug)<<"In ValVtxModule::BeginJob"<<endl;
00079                            
00080   names.clear();
00081   names.push_back("vfZError");   
00082   names.push_back("vfUError");
00083   names.push_back("vfVError");
00084   names.push_back("vfError");
00085   names.push_back("BestZError");
00086   names.push_back("BestUError");
00087   names.push_back("BestVError");
00088   names.push_back("BestError");
00089   names.push_back("relZError");
00090   names.push_back("relUError");
00091   names.push_back("relVError");
00092   names.push_back("relError");
00093                                                             
00094   classes.clear();
00095   classes.push_back("_far_nue");
00096   classes.push_back("_far_numu");
00097   classes.push_back("_far_bnue");
00098   classes.push_back("_far_nutau");
00099   classes.push_back("_far_nc");
00100   classes.push_back("_near_bnue");
00101   classes.push_back("_near_numu");
00102   classes.push_back("_near_nc");
00103   classes.push_back("_near_rock");
00104   classes.push_back("_far_rock");
00105   classes.push_back("_near_cosmic");
00106   classes.push_back("_far_cosmic");
00107   classes.push_back("_unknown");
00108                                                                                 
00109   Int_t nbins = 1000;
00110   Float_t beg = -25.0;
00111   Float_t end = 25.0;                                              
00112   
00113   Int_t nbins2 = 250;
00114   Float_t beg2 = -5.0;
00115   Float_t end2 = 5.0;
00116 
00117 
00118                                 
00119   for(UInt_t i = 0; i < names.size(); i++){
00120      for(UInt_t l = 0; l < classes.size(); l++){
00121            string dirstring = "vtxstats";
00122            HistMan hm2(dirstring.c_str());
00123            TString param = names[i]+classes[l];
00124 //           hm2.Book<TH1F>(param,param,nbins,beg,end);
00125            if(i%4 == 0 || i%4 == 3) hm2.Book<TH1F>(param,param,nbins,beg,end);
00126            else hm2.Book<TH1F>(param,param,nbins,beg2,end2);
00127     }
00128   }
00129 
00130   MSG("ValVtxModule",Msg::kDebug)<<"Created "<<names.size()*classes.size()
00131            <<" histogram entries in BeginJob"<<endl;                
00132 }

void ValVtxModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 134 of file ValVtxModule.cxx.

References counter, Msg::kDebug, Msg::kInfo, MSG, passcounter, passcutcounter, and HistMan::WriteOut().

00135 {
00136 
00137    MSG("ValVtxModule",Msg::kInfo)<<"Counter "<<counter
00138                               <<" passcutcounter "<<passcutcounter
00139                               <<" passcounter "<<passcounter
00140                               <<endl;
00141 
00142    TFile* file = new TFile("Results.root", "update");
00143    file->cd();
00144    HistMan hm2("vtxstats");
00145    hm2.WriteOut(*file);
00146 
00147   delete file;
00148 
00149   MSG("ValVtxModule",Msg::kDebug)<<"File output complete"<<endl;
00150                                                                                        
00151 }

void ValVtxModule::FillPlots ( VtxRecord vr  )  [private]

Definition at line 153 of file ValVtxModule.cxx.

References HistMan::Get(), ANtpDefaultValue::IsDefault(), Msg::kDebug, MakeIdString(), MSG, names, VtxFinderData::vfBestError, VtxFinderData::vfBestErrU, VtxFinderData::vfBestErrV, VtxFinderData::vfBestErrZ, VtxFinderData::vfError, VtxFinderData::vfErrU, VtxFinderData::vfErrV, VtxFinderData::vfErrZ, VtxFinderData::vfRelError, VtxFinderData::vfRelErrU, VtxFinderData::vfRelErrV, VtxFinderData::vfRelErrZ, and VtxRecord::vtxfind.

Referenced by Reco().

00154 {
00155      TString id = MakeIdString(vr);
00156 
00157      vector<Float_t> vals;
00158      vals.push_back(vr->vtxfind.vfErrZ);
00159      vals.push_back(vr->vtxfind.vfErrU);
00160      vals.push_back(vr->vtxfind.vfErrV);
00161      vals.push_back(vr->vtxfind.vfError);
00162      vals.push_back(vr->vtxfind.vfBestErrZ);
00163      vals.push_back(vr->vtxfind.vfBestErrU);
00164      vals.push_back(vr->vtxfind.vfBestErrV);
00165      vals.push_back(vr->vtxfind.vfBestError);
00166      vals.push_back(vr->vtxfind.vfRelErrZ);
00167      vals.push_back(vr->vtxfind.vfRelErrU);
00168      vals.push_back(vr->vtxfind.vfRelErrV);
00169      vals.push_back(vr->vtxfind.vfRelError);
00170 
00171      HistMan hm2("vtxstats");
00172 
00173      for(unsigned int i = 0; i < vals.size(); i++) {
00174         if(!ANtpDefVal::IsDefault(vals[i])){
00175              TString hname = names[i]+id;
00176              TH1F* hist = hm2.Get<TH1F>(hname);
00177              hist->Fill(vals[i], 1.0);
00178         }
00179      }
00180      MSG("ValVtxModule",Msg::kDebug)<<"Done filling Histograms"<<endl;
00181 }

TString ValVtxModule::MakeIdString ( VtxRecord vr  )  [private]

Definition at line 183 of file ValVtxModule.cxx.

References det, ANtpTruthInfoBeamNue::fNueClass, VldContext::GetDetector(), RecRecordImp< T >::GetHeader(), RecHeader::GetVldContext(), Detector::kFar, Detector::kNear, VtxRecord::mctrue, and ANtpTruthInfo::nuVtxZ.

Referenced by FillPlots().

00184 {
00185   Detector::Detector_t d = vr->GetHeader().GetVldContext().GetDetector();
00186                                                                                 
00187   TString det, dm;
00188   TString type;
00189                                                                                 
00190   if(d==Detector::kFar){
00191     det = "_far";
00192   }
00193   else if(d==Detector::kNear){
00194     det = "_near";
00195   }
00196   else{
00197     return "_unknown";
00198   }
00199                                                                                 
00200   if(vr->mctrue.fNueClass == 0){type = "nc";}
00201   else if(vr->mctrue.fNueClass == 1){type = "numu";}
00202   else if(vr->mctrue.fNueClass == 2){type = "nue";}
00203   else if(vr->mctrue.fNueClass == 3){type = "nutau";}
00204   else if(vr->mctrue.fNueClass == 4){type = "bnue";}
00205   else { return "_unknown";}
00206 
00207   if(vr->mctrue.nuVtxZ < 0 && vr->mctrue.fNueClass == 1)  
00208        type = "rock";
00209 
00210   TString id = det+"_" + type;
00211 
00212   return id;
00213 }

JobCResult ValVtxModule::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 42 of file ValVtxModule.cxx.

References counter, FillPlots(), MomNavigator::FragmentIter(), Msg::kDebug, Msg::kError, Msg::kInfo, JobCResult::kPassed, and MSG.

00043 {
00044 //======================================================================
00045 // Reads in sue-style ntuples from mom, calculates a bunch of useful
00046 // nue quantites
00047 //======================================================================
00048    MSG("ValVtxModule",Msg::kDebug)<<"In ValVtxModule::Reco"<<endl;
00049 
00050    if(counter%1000==0){      
00051       MSG("ValVtxModule",Msg::kInfo)<<"On entry "<<counter<<endl;
00052    }
00053    counter++;
00054 
00055    TObject *obj=0;
00056 
00057    TIter objiter = mom->FragmentIter();
00058    while((obj=objiter.Next())){
00059       VtxRecord *vr = static_cast<VtxRecord *>(obj);
00060       if(vr){
00061          MSG("ValVtxModule",Msg::kDebug)<<"Found a VtxRecord in MOM"<<endl;
00062       }
00063       else{
00064          MSG("ValVtxModule",Msg::kError)<<"Didn't find a VtxRecord in MOM"<<endl;
00065          continue;
00066       }
00067 
00068       FillPlots(vr);
00069   }
00070 
00071   return JobCResult::kPassed; // kNoDecision, kFailed, etc.       
00072 }


Member Data Documentation

vector<TString> ValVtxModule::classes [private]

Definition at line 50 of file ValVtxModule.h.

Referenced by BeginJob().

int ValVtxModule::counter [private]

Definition at line 43 of file ValVtxModule.h.

Referenced by EndJob(), and Reco().

Definition at line 46 of file ValVtxModule.h.

vector<TString> ValVtxModule::names [private]

Definition at line 49 of file ValVtxModule.h.

Referenced by BeginJob(), and FillPlots().

Definition at line 44 of file ValVtxModule.h.

Referenced by EndJob().

Definition at line 45 of file ValVtxModule.h.

Referenced by EndJob().

Definition at line 47 of file ValVtxModule.h.


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1