FilterPID Class Reference

#include <FilterPID.h>

Inheritance diagram for FilterPID:
JobCModule

List of all members.

Public Member Functions

 FilterPID ()
 ~FilterPID ()
JobCResult Reco (MomNavigator *mom)

Detailed Description

Definition at line 17 of file FilterPID.h.


Constructor & Destructor Documentation

FilterPID::FilterPID (  ) 

Definition at line 23 of file FilterPID.cxx.

00024  {}

FilterPID::~FilterPID (  ) 

Definition at line 28 of file FilterPID.cxx.

00029 {}


Member Function Documentation

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 33 of file FilterPID.cxx.

References MomNavigator::AdoptFragment(), 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("FilterPID",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       MSG("FilterPID",Msg::kDebug)<<"Found a "<<cn<<endl;
00047       if(strcmp(cn,"NueRecord")==0){
00048          NueRecord *nr = dynamic_cast<NueRecord *>(obj);
00049          MSG("FilterPID",Msg::kDebug)<<"Found a NueRecord in MOM"
00050                                        <<" Snarl "<<nr->GetHeader().GetSnarl()
00051                                        <<" Event "<<nr->GetHeader().GetEventNo()<<endl;
00052          vr.push_back(nr);
00053       }
00054       else if(strcmp(cn,"NuePID")==0){
00055          NuePID *npid  = dynamic_cast<NuePID *>(obj);
00056          MSG("FilterPID",Msg::kDebug)<<"Found a NuePID in MOM"
00057                                        <<" Snarl "<<npid->GetHeader().GetSnarl()
00058                                        <<" Event "<<npid->GetHeader().GetEventNo()<<endl;
00059          vpid.push_back(npid);
00060       }
00061       else{
00062          continue;
00063       }
00064    }
00065 
00066    
00067    //so, mom will match up snarls for us,
00068    //but, we have to match up events for ourselves.
00069    for(unsigned int i=0;i<vr.size();i++){
00070       int event = vr[i]->GetHeader().GetEventNo();
00071       bool foundmatch=false;
00072       for(unsigned int j=0;j<vpid.size();j++){
00073          if(vpid[j]->GetHeader().GetEventNo()==event){
00074             int pass = vpid[j]->IsNue;
00075             MSG("FilterPID",Msg::kDebug)<<"Found match!"<<endl
00076                                         <<" Record snarl: "
00077                                         <<vr[i]->GetHeader().GetSnarl()
00078                                         <<" event: "
00079                                         <<vr[i]->GetHeader().GetEventNo()<<endl
00080                                         <<" PID snarl: "
00081                                         <<vpid[j]->GetHeader().GetSnarl()
00082                                         <<" event: "
00083                                         <<vpid[j]->GetHeader().GetEventNo()<<endl;
00084             MSG("FilterPID",Msg::kDebug)<<"pass "<<pass<<" j "<<j
00085                                         <<" "<<vpid[j]->IsNue<<endl;
00086             if(pass==1){
00087               MSG("FilterPID",Msg::kDebug)<<"Gave to mom"<<endl;
00088               NueRecord *passnr = new NueRecord(*(vr[i]));
00089               //              NueHeader passh(vr[i]->GetHeader().GetVldContext());
00090               //              NueRecord *passnr = new NueRecord(passh);
00091               //              cout<<"passnr "<<passnr<<" vr[i] "<<vr[i]<<endl;
00092               //              passnr->Print();
00093               passnr->SetName("NueRecord_filt");
00094               mom->AdoptFragment(passnr);
00095               //              mom->Print();
00096             }
00097 
00098          }
00099          //delete pid from vector so we don't loop over it next time
00100          vector<NuePID *>::iterator vi(&(vpid[j]));
00101          vpid.erase(vi);
00102          foundmatch=true;
00103          break;
00104       }
00105       if(!foundmatch){
00106          MSG("FilterPID",Msg::kError)<<"Could not find PID match for"
00107                                        <<" Snarl "<<vr[i]->GetHeader().GetSnarl()
00108                                        <<" Event "<<vr[i]->GetHeader().GetEventNo()<<endl;
00109       }
00110    }
00111 
00112    MSG("FilterPID",Msg::kDebug)<<"**********************************"<<endl;
00113 
00114    return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00115 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1