00001
00002
00003
00004
00005
00006
00008 #include "TH1F.h"
00009 #include "TFile.h"
00010 #include "NueAna/NueRead.h"
00011 #include "NueAna/NueRecord.h"
00012 #include "MessageService/MsgService.h"
00013 #include "MinosObjectMap/MomNavigator.h"
00014 #include "MessageService/MsgService.h"
00015 #include "JobControl/JobCModuleRegistry.h"
00016
00017 JOBMODULE(NueRead, "NueRead",
00018 "Reads in ana_nue ntuples");
00019 CVSID("$Id:");
00020
00021
00022 NueRead::NueRead():
00023 counter(0),
00024 passcounter(0)
00025 {
00026 f=new TFile("testfile.root","RECREATE");
00027 f->cd();
00028 hpar0=new TH1F("hpar0","hpar0",100,0,100);
00029 }
00030
00031
00032
00033 NueRead::~NueRead()
00034 {
00035 if(f){
00036 if(f->IsOpen()){
00037 f->Write();
00038 f->Close();
00039 }
00040 }
00041
00042
00043
00044
00045 }
00046
00047
00048
00049 JobCResult NueRead::Ana(const MomNavigator* mom)
00050 {
00051
00052
00053
00054 TObject *obj=0;
00055 TIter objiter = mom->FragmentIter();
00056 while((obj=objiter.Next())){
00057 NueRecord *nr = static_cast<NueRecord *>(obj);
00058 if(nr){
00059 MSG("NueRead",Msg::kDebug)<<"Found a NueRecord in MOM"<<endl;
00060 }
00061 else{
00062 MSG("NueRead",Msg::kError)<<"Didn't find a NueRecord in MOM"<<endl;
00063 counter++;
00064 continue;
00065 }
00066 MSG("NueRead",Msg::kDebug)<<"Found a NueRecord "<<nr<<endl;
00067 counter++;
00068
00069
00070 hpar0->Fill(nr->shwfit.par_a);
00071 passcounter++;
00072 }
00073 return JobCResult::kPassed;
00074 }
00075
00077 void NueRead::EndJob()
00078 {
00079 MSG("NueRead",Msg::kInfo)<<"Counter "<<counter<<" passcounter "<<passcounter<<endl;
00080 MSG("NueRead",Msg::kInfo)<<"Entries in histogram "<<hpar0->GetEntries()<<endl;
00081 }