NueReadwPID Class Reference

#include <NueReadwPID.h>

Inheritance diagram for NueReadwPID:
JobCModule

List of all members.

Public Member Functions

 NueReadwPID ()
 ~NueReadwPID ()
JobCResult Ana (const MomNavigator *mom)

Detailed Description

Definition at line 17 of file NueReadwPID.h.


Constructor & Destructor Documentation

NueReadwPID::NueReadwPID (  ) 

Definition at line 23 of file NueReadwPID.cxx.

00024  {}

NueReadwPID::~NueReadwPID (  ) 

Definition at line 28 of file NueReadwPID.cxx.

00029 {}


Member Function Documentation

JobCResult NueReadwPID::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 33 of file NueReadwPID.cxx.

References HistMan::Book(), HistMan::Fill1d(), MomNavigator::FragmentIter(), NuePIDHeader::GetEventNo(), NueHeader::GetEventNo(), RecRecordImp< T >::GetHeader(), NueHeader::GetSnarl(), NuePIDHeader::GetSnarl(), Msg::kDebug, Msg::kError, JobCResult::kPassed, and MSG.

00034 {
00035    //get all NueRecords from mom 
00036    //may have more than one per go since mom reads in a snarl's worth of data
00037    //so, this is a little more complicated than just asking for a NueRecord
00038    MSG("NueReadwPID",Msg::kDebug)<<"***********IN ANA*****************"<<endl;
00039    
00040    TObject *obj=0;
00041    TIter objiter = mom->FragmentIter();
00042    vector<NueRecord *> vr;
00043    vector<NuePID *> vpid;
00044    while((obj=objiter.Next())){
00045       const char *cn=obj->ClassName();
00046       if(strcmp(cn,"NueRecord")==0){
00047          NueRecord *nr = dynamic_cast<NueRecord *>(obj);
00048          MSG("NueReadwPID",Msg::kDebug)<<"Found a NueRecord in MOM"
00049                                        <<" Snarl "<<nr->GetHeader().GetSnarl()
00050                                        <<" Event "<<nr->GetHeader().GetEventNo()<<endl;
00051          vr.push_back(nr);
00052       }
00053       else if(strcmp(cn,"NuePID")==0){
00054          NuePID *npid  = dynamic_cast<NuePID *>(obj);
00055          MSG("NueReadwPID",Msg::kDebug)<<"Found a NuePID in MOM"
00056                                        <<" Snarl "<<npid->GetHeader().GetSnarl()
00057                                        <<" Event "<<npid->GetHeader().GetEventNo()<<endl;
00058          vpid.push_back(npid);
00059       }
00060       else{
00061          continue;
00062       }
00063    }
00064 
00065 
00066    //use HistMan to plot something for events that pass/fail
00067 
00068    static HistMan *hm = new HistMan("nueana");
00069    static TH1F *h1=0;
00070    static TH1F *h2=0;
00071    static TH1F *h3=0;
00072    static TH1F *h4=0;
00073    static TH1F *h5=0;
00074    static TH1F *h6=0;
00075    static TH1F *h7=0;
00076    static TH1F *h8=0;
00077    static TH1F *h9=0;
00078 
00079    h1=hm->Book<TH1F>("par_a_pass","par_a_pass",200,0,50);
00080    h2=hm->Book<TH1F>("par_b_pass","par_b_pass",200,0,50);
00081    h3=hm->Book<TH1F>("par_e0_pass","par_e0_pass",200,0,50);
00082    h4=hm->Book<TH1F>("par_a_fail","par_a_fail",200,0,50);
00083    h5=hm->Book<TH1F>("par_b_fail","par_b_fail",200,0,50);
00084    h6=hm->Book<TH1F>("par_e0_fail","par_e0_fail",200,0,50);
00085    h7=hm->Book<TH1F>("par_a_hmmm","par_a_hmmm",200,0,50);
00086    h8=hm->Book<TH1F>("par_b_hmmm","par_b_hmmm",200,0,50);
00087    h9=hm->Book<TH1F>("par_e0_hmmm","par_e0_hmmm",200,0,50);
00088 
00089    
00090    //so, mom will match up snarls for us,
00091    //but, we have to match up events for ourselves.
00092    for(unsigned int i=0;i<vr.size();i++){
00093       int event = vr[i]->GetHeader().GetEventNo();
00094       bool foundmatch=false;
00095       for(unsigned int j=0;j<vpid.size();j++){
00096          if(vpid[j]->GetHeader().GetEventNo()==event){
00097             int pass = vpid[j]->IsNue;
00098             MSG("NueReadwPID",Msg::kDebug)<<"Found match!"<<endl
00099                                           <<" Record snarl: "<<vr[i]->GetHeader().GetSnarl()
00100                                           <<" event: "<<vr[i]->GetHeader().GetEventNo()<<endl
00101                                           <<" PID snarl: "<<vpid[j]->GetHeader().GetSnarl()
00102                                           <<" event: "<<vpid[j]->GetHeader().GetEventNo()<<endl;
00103             MSG("NueReadwPID",Msg::kDebug)<<"pass "<<pass<<" j "<<j<<" "<<vpid[j]->IsNue<<endl;
00104 
00105             if(pass==1){
00106                hm->Fill1d("par_a_pass",vr[i]->shwfit.par_a);
00107                hm->Fill1d("par_b_pass",vr[i]->shwfit.par_b);
00108                hm->Fill1d("par_e0_pass",vr[i]->shwfit.par_e0);
00109             }
00110             else if(pass==-1){
00111                hm->Fill1d("par_a_fail",vr[i]->shwfit.par_a);
00112                hm->Fill1d("par_b_fail",vr[i]->shwfit.par_b);
00113                hm->Fill1d("par_e0_fail",vr[i]->shwfit.par_e0);
00114             }
00115             else{
00116                hm->Fill1d("par_a_hmmm",vr[i]->shwfit.par_a);
00117                hm->Fill1d("par_b_hmmm",vr[i]->shwfit.par_b);
00118                hm->Fill1d("par_e0_hmmm",vr[i]->shwfit.par_e0);
00119             }
00120          }
00121          //delete pid from vector so we don't loop over it next time
00122          vector<NuePID *>::iterator vi(&(vpid[j]));
00123          vpid.erase(vi);
00124          foundmatch=true;
00125          break;
00126       }
00127       if(!foundmatch){
00128          MSG("NueReadwPID",Msg::kError)<<"Could not find PID match for"
00129                                        <<" Snarl "<<vr[i]->GetHeader().GetSnarl()
00130                                        <<" Event "<<vr[i]->GetHeader().GetEventNo()<<endl;
00131       }
00132    }
00133 
00134    MSG("NueReadwPID",Msg::kDebug)<<"**********************************"<<endl;
00135 
00136    return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00137 }


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1