VtxModule Class Reference

#include <VtxModule.h>

Inheritance diagram for VtxModule:
JobCModule JobCModule

List of all members.

Public Member Functions

 VtxModule ()
 ~VtxModule ()
JobCResult Reco (MomNavigator *mom)
void BeginJob ()
void EndJob ()
const RegistryDefaultConfig () const
void Config (const Registry &r)
 VtxModule ()
 ~VtxModule ()
JobCResult Reco (MomNavigator *mom)
void BeginJob ()
void EndJob ()
const RegistryDefaultConfig () const
void Config (const Registry &r)

Private Attributes

int counter
int passcounter
int passcutcounter
int failcounter
int writecounter
bool foundmeu
float SIGCORRMEU
float pot
float MEUPERGEV

Detailed Description

Definition at line 18 of file Module/VtxModule.h.


Constructor & Destructor Documentation

VtxModule::VtxModule (  ) 

Definition at line 43 of file Module/VtxModule.cxx.

00043                     :
00044    counter(0),
00045    passcounter(0),
00046    passcutcounter(0),
00047    failcounter(0),
00048    writecounter(0),
00049    foundmeu(false),
00050    SIGCORRMEU(1.),
00051    pot(0.),
00052    MEUPERGEV(25.66)
00053 {}

VtxModule::~VtxModule (  ) 

Definition at line 57 of file Module/VtxModule.cxx.

00058 {
00059 }

VtxModule::VtxModule (  ) 
VtxModule::~VtxModule (  ) 

Member Function Documentation

void VtxModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

void VtxModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 255 of file Module/VtxModule.cxx.

References Msg::kDebug, and MSG.

00256 {
00257   MSG("VtxModule",Msg::kDebug)<<"In VtxModule::BeginJob"<<endl;
00258 }

void VtxModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

void VtxModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 246 of file Module/VtxModule.cxx.

References Msg::kDebug, and MSG.

00247 {
00248 //======================================================================
00249 // Configure the module given the Registry r
00250 //======================================================================
00251   MSG("VtxModule",Msg::kDebug)<<"In VtxModule::Config"<<endl;
00252 
00253 }

const Registry& VtxModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

const Registry & VtxModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 223 of file Module/VtxModule.cxx.

References JobCModule::GetName(), Msg::kDebug, Registry::LockValues(), MSG, and Registry::UnLockValues().

00224 {
00225 //======================================================================
00226 // Supply the default configuration for the module
00227 //======================================================================
00228    MSG("VtxModule",Msg::kDebug)<<"In VtxModule::DefaultConfig"<<endl;
00229 
00230   static Registry r; // Default configuration for module
00231 
00232   // Set name of config
00233   std::string name = this->GetName();
00234   name += ".config.default";
00235   r.SetName(name.c_str());
00236 
00237   // Set values in configuration
00238   r.UnLockValues();
00239   r.LockValues();
00240 
00241   return r;
00242 }

void VtxModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

void VtxModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 260 of file Module/VtxModule.cxx.

References counter, failcounter, Msg::kInfo, MSG, passcounter, passcutcounter, pot, and writecounter.

00261 {
00262 
00263    MSG("VtxModule",Msg::kInfo)<<"Counter "<<counter
00264                               <<" passcutcounter "<<passcutcounter
00265                               <<" passcounter "<<passcounter
00266                               <<" failcounter "<<failcounter
00267                               <<" writecounter "<<writecounter<<endl;
00268    MSG("VtxModule",Msg::kInfo)<<"Number of POT in this run: "<<pot<<endl;
00269 
00270 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 63 of file Module/VtxModule.cxx.

References MomNavigator::AdoptFragment(), VtxRecordAna::Analyze(), VtxRecordAna::aneia, VtxRecordAna::ansia, VtxRecordAna::antia, counter, NtpStRecord::evthdr, failcounter, VtxRecordAna::FillReco(), VtxRecordAna::FillTrue(), foundmeu, SntpHelpers::GetEvent(), MomNavigator::GetFragment(), RecRecordImp< T >::GetHeader(), CalMIPCalibration::GetMIP(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), RecDataHeader::GetRun(), RecPhysicsHeader::GetSnarl(), RecDataHeader::GetSubRun(), SntpHelpers::GetTrack(), SntpHelpers::GetTrackIndex(), RecHeader::GetVldContext(), Msg::kDebug, JobCResult::kFailed, Msg::kInfo, JobCResult::kPassed, Msg::kWarning, Munits::m, MEUPERGEV, MSG, NtpSRPlane::n, NtpSREventSummary::nevent, passcounter, passcutcounter, NtpSRTrack::plane, NueHeader::SetEventNo(), NueHeader::SetEvents(), NueHeader::SetFoundBits(), NueAnaBase::SetParams(), NueHeader::SetRun(), NueHeader::SetSnarl(), NueHeader::SetSubRun(), NueHeader::SetTrackLength(), SIGCORRMEU, and writecounter.

00064 {
00065 //======================================================================
00066 // Reads in sue-style ntuples from mom, calculates a bunch of useful
00067 // nue quantites
00068 //======================================================================
00069    MSG("VtxModule",Msg::kDebug)<<"In VtxModule::Reco"<<endl;
00070 
00071    if(counter%1000==0){      
00072       MSG("VtxModule",Msg::kInfo)<<"On entry "<<counter<<endl;
00073    }
00074    counter++;
00075    bool foundST=false;
00076       
00077    VldContext vc;
00078    //first ask mom for a NtpStRecord
00079    NtpStRecord *str=dynamic_cast<NtpStRecord *>(mom->GetFragment("NtpStRecord"));
00080    if(str){
00081      foundST=true;
00082      vc=str->GetHeader().GetVldContext();
00083    }
00084 
00085    //if we didn't find a NtpStRecord, it could be because we're reading an 
00086    //old tree, check for the other records
00087                                                 
00088    if(!foundST){
00089       //got nothing useful from mom
00090       MSG("VtxModule",Msg::kWarning)<<"Got Nothing from mom"<<endl;
00091       failcounter++;
00092       return JobCResult::kFailed;
00093    }
00094    
00095    //UGLY!!!!
00096    //need to be able to compare single strip 
00097    //pulseheight between ND and FD, but we can't
00098    //in the ntuple.  Will ask the db for the
00099    //conversion from sigcor to MEU 
00100    //on the first event, and use throughout.  
00101    //Since sigcorrs are already corrected for all strip variations, 
00102    //it's ok to ask for 1 number.  
00103    //Should be ok for MC, maybe ok for 1 run of data at a time, but will
00104    //definitely be wrong if many weeks worth of data are strung together
00105    //we should revisit this and make it better in the future!!!!!!!
00106    if(!foundmeu){
00107      DbiResultPtr<CalMIPCalibration> dbp(vc);
00108      if(dbp.GetNumRows()>0){
00109        const CalMIPCalibration *m = dbp.GetRow(0);
00110        float mip=m->GetMIP(1.); 
00111        if(mip>0){
00112          SIGCORRMEU=1./mip;
00113          foundmeu=true;
00114        }
00115      }
00116    }
00117 
00118    if(foundST){
00119      //find number of events in the snarl
00120       int evtn=str->evthdr.nevent;
00121       MSG("VtxModule",Msg::kDebug)<<"Events in this snarl: "<<evtn<<endl;
00122       
00123       //find vldcontext to make the header
00124       VldContext vc = str->GetHeader().GetVldContext();
00125       
00126       if(evtn==0){
00127         //we found an SR, but nothing got reco'ed in it
00128         
00129         //make a header
00130         NueHeader h(vc);
00131       
00132       //fill header info
00133         h.SetSnarl(str->GetHeader().GetSnarl());
00134         h.SetRun(str->GetHeader().GetRun());
00135         h.SetSubRun(str->GetHeader().GetSubRun());
00136         h.SetEventNo(-1);
00137         h.SetEvents(0);
00138         h.SetTrackLength(0);
00139         h.SetFoundBits(false,true,false, false);
00140       
00141         //make an ana_nue object
00142         VtxRecord *vtxRec = new VtxRecord(h);
00143         vtxRec->SetName("VtxRecord");
00144 
00145         //make a nuerecordana object
00146         VtxRecordAna ana_vtx(*vtxRec);
00147         
00148         //fill the truth info
00149         //if it's data, we can also do beam mon analyze
00150         ana_vtx.FillTrue(0,str);
00151 
00152         //give the ana_nue object to mom, she'll write it to the file
00153          mom->AdoptFragment(vtxRec);
00154          writecounter++;
00155          failcounter++;
00156         
00157          return JobCResult::kPassed;
00158       }      
00159       
00160       //if events were reco'd, loop over events in a snarl
00161       for(int i=0;i<evtn;i++){
00162               
00163         //make a header
00164         NueHeader h(vc);
00165         
00166         //fill header info
00167         h.SetSnarl(str->GetHeader().GetSnarl());
00168         h.SetRun(str->GetHeader().GetRun());
00169         h.SetSubRun(str->GetHeader().GetSubRun());
00170         h.SetEventNo(i);
00171         h.SetEvents(evtn);
00172         h.SetFoundBits(true,true,true,false);
00173         
00174         MSG("VtxModule",Msg::kDebug)<<"Getting event"<<endl;
00175         NtpSREvent *event = SntpHelpers::GetEvent(i,str);
00176       
00177         //loop over tracks in this event, find longest
00178         int longtrack=0;
00179         for(int j=0;j<event->ntrack;j++){
00180           int tindex = SntpHelpers::GetTrackIndex(j,event);
00181           NtpSRTrack *track = SntpHelpers::GetTrack(tindex,str);
00182           if(longtrack<track->plane.n){
00183             longtrack = track->plane.n;
00184           }
00185         }
00186         h.SetTrackLength(longtrack);
00187         
00188         VtxRecord *vtxRec = new VtxRecord(h);
00189         vtxRec->SetName("VtxRecord");
00190 
00191         //make a nuerecordana object
00192         VtxRecordAna ana_vtx(*vtxRec);
00193 
00194         //configure BeamMonAna
00195          passcutcounter++;
00196           //analyze calculates everybodies
00197           //variables, then calls the Truth and Reco Object Fillers
00198           //configure MSTCalcAna routine
00199          ana_vtx.ansia.SetParams(SIGCORRMEU, MEUPERGEV);
00200          ana_vtx.antia.SetParams(SIGCORRMEU, MEUPERGEV);          
00201          ana_vtx.aneia.SetParams(SIGCORRMEU, MEUPERGEV);
00202           //analysize
00203          ana_vtx.FillTrue(i,str);
00204          ana_vtx.FillReco(i,str);                        
00205          ana_vtx.Analyze(i,str);
00206         
00207         //give the ana_nue object to mom, she'll write it to the file
00208         MSG("VtxModule",Msg::kDebug)<<"Giving Fragment to mom"<<endl;
00209         writecounter++;
00210         mom->AdoptFragment(vtxRec);
00211         MSG("VtxModule",Msg::kDebug)<<"Mom took it"<<endl;
00212       }
00213       MSG("VtxModule",Msg::kDebug)<<"Done with snarl"<<endl;
00214       passcounter++;
00215       return JobCResult::kPassed; // kNoDecision, kFailed, etc.       
00216    }
00217 
00218    return JobCResult::kFailed;
00219 }


Member Data Documentation

int VtxModule::counter [private]

Definition at line 35 of file Module/VtxModule.h.

Referenced by EndJob(), and Reco().

int VtxModule::failcounter [private]

Definition at line 38 of file Module/VtxModule.h.

Referenced by EndJob(), and Reco().

bool VtxModule::foundmeu [private]

Definition at line 40 of file Module/VtxModule.h.

Referenced by Reco().

float VtxModule::MEUPERGEV [private]

Definition at line 45 of file Module/VtxModule.h.

Referenced by Reco().

int VtxModule::passcounter [private]

Definition at line 36 of file Module/VtxModule.h.

Referenced by EndJob(), and Reco().

Definition at line 37 of file Module/VtxModule.h.

Referenced by EndJob(), and Reco().

float VtxModule::pot [private]

Definition at line 44 of file Module/VtxModule.h.

Referenced by EndJob().

float VtxModule::SIGCORRMEU [private]

Definition at line 42 of file Module/VtxModule.h.

Referenced by Reco().

int VtxModule::writecounter [private]

Definition at line 39 of file Module/VtxModule.h.

Referenced by EndJob(), and Reco().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1