Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

NueRead.cxx

Go to the documentation of this file.
00001 
00002 // $Id: NueRead.cxx,v 1.1 2006/09/18 21:41:22 boehm Exp $
00003 //
00004 // FILL_IN: [Document your code!!]
00005 //
00006 // vahle@hep.ucl.ac.uk
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" // For JOBMODULE macro
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 // FILL_IN: [Document your code!!]
00044 //======================================================================
00045 }
00046 
00047 //......................................................................
00048 
00049 JobCResult NueRead::Ana(const MomNavigator* mom)
00050 {
00051    //get all NueRecords from mom 
00052    //may have more than one per go since mom reads in a snarl's worth of data
00053    //so, this is a little more complicated than just asking for a NueRecord
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       //fill histogram
00070       hpar0->Fill(nr->shwfit.par_a);
00071       passcounter++;
00072    }
00073    return JobCResult::kPassed; // kNoDecision, kFailed, etc.
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 }

Generated on Mon Feb 15 11:07:12 2010 for loon by  doxygen 1.3.9.1