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

ANtpInfoObjectFillerMRCC Class Reference

#include <ANtpInfoObjectFillerMRCC.h>

List of all members.

Public Member Functions

void FillEventInformation (int i, const NtpMRRecord *mrRecord, const NtpStRecord *stRecord, ANtpEventInfoMRCC *antp, ANtpTruthInfoBeam *truth) const
 Fill antp mrcc information corresponding to i using best_event.

Protected Member Functions

void FillEventInformationHelper (const NtpMREvent *mrnt, const NtpStRecord *sntp_orig, ANtpEventInfoMRCC *antp, ANtpTruthInfoBeam *truth) const
 Internal helper, copy contents of mrnt into antp.
double ABPID (const NtpSREvent *ev, const NtpStRecord *st) const
double ROPID (const NtpSREvent *ev, const NtpStRecord *st) const


Member Function Documentation

double ANtpInfoObjectFillerMRCC::ABPID const NtpSREvent ev,
const NtpStRecord st
const [protected]
 

Return the AB PID value for event ev in snarl st, reading the appropriate PDFs if necessary

Definition at line 147 of file ANtpInfoObjectFillerMRCC.cxx.

References ReleaseType::AsString(), base, MadAbID::CalcPID(), det, VldContext::GetDetector(), NtpStRecord::GetRelease(), RecRecordImp< T >::GetVldContext(), gSystem(), ReleaseType::IsCedar(), MSG, and MadAbID::ReadPDFs().

Referenced by FillEventInformationHelper().

00148 {
00149   static bool once=false;
00150   static MadAbID ABID;
00151   
00152   // Code stolen from NueAna's MuonRemovalInfoAna
00153   if(!once){
00154     once=true;
00155     string base=getenv("SRT_PRIVATE_CONTEXT");
00156      if(base!="" && base!="."){
00157        // check if directory exists in SRT_PRIVATE_CONTEXT
00158        string path = base + "/Mad/data";
00159        void* dir_ptr = gSystem->OpenDirectory(path.c_str());
00160        if(!dir_ptr){
00161          base=getenv("SRT_PUBLIC_CONTEXT");
00162        }
00163      }
00164      else{  
00165        base=getenv("SRT_PUBLIC_CONTEXT"); 
00166      }
00167      if(base=="") {
00168        MSG("ObjectFillerMRCC",Msg::kFatal)<<"No SRT_PUBLIC_CONTEXT set "
00169                                          <<"Do not know where to look "
00170                                          <<"for AB pdf files "<<std::endl;
00171        // Dummy message to make sure it exits
00172        MSG("ObjectFillerMRCC",Msg::kFatal) << "Goodbye" << endl;
00173      }
00174      base+="/Mad/data";
00175      string fname=base;
00176      string rmc="";
00177      // ARGH! Can't do this at all sensibly, since there aren't PDF
00178      // files for dogwood (I guess). Should also really check on MC
00179      // version, but this code is never going to be run on anything
00180      // other than daikon, so it doesn't matter.
00181      ReleaseType::Release_t release=st->GetRelease();
00182      if(ReleaseType::IsCedar(release)){
00183        rmc="cedar_daikon";
00184      }
00185      else{
00186        MSG("ObjectFillerMRCC",Msg::kWarning) 
00187          << "Running on release type " << ReleaseType::AsString(release)
00188          << " which has no PDFs. Using cedar_daikon instead." << endl;
00189        rmc="cedar_daikon";
00190      }
00191 
00192      string sdet="";
00193      Detector::Detector_t det=st->GetVldContext()->GetDetector();
00194      if(det==Detector::kNear){
00195        sdet="near";
00196      }
00197      else if(det==Detector::kFar){
00198        sdet="far";
00199      }
00200      else{
00201        MSG("ObjectFillerMRCC",Msg::kFatal) << "Dont know detector type."
00202                                            << " Bailing"<<endl;
00203        // Dummy message to make sure it exits
00204        MSG("ObjectFillerMRCC",Msg::kFatal) << "Goodbye" << endl;
00205      }
00206      string sbeam="le";
00207      /*
00208        Should really do this switch, but I don't know how to get the
00209        beamtype through to here to check against. Probably won't ever
00210        run it on non-LE events anyway.
00211 
00212      switch(current_beam){
00213      case BeamType::kL010z000i:
00214        sbeam="le0";
00215        break;
00216      case BeamType::kL010z170i:
00217        sbeam="le170";
00218        break;
00219      case BeamType::kL010z185i:
00220        sbeam="le";
00221        break;
00222      case BeamType::kL010z200i:
00223        sbeam="le200";
00224        break;
00225      case BeamType::kL100z200i:
00226        sbeam="pme";
00227        break;
00228      case BeamType::kL150z200i:
00229        sbeam="pme";
00230        break;
00231      case BeamType::kL250z200i:
00232        sbeam="phe";
00233        break;
00234      case BeamType::kLE:
00235        sbeam="le";
00236        break;
00237      default:
00238        MSG("ObjectFillerMRCC",Msg::kWarning)<<"Don't know beam type "
00239                                            <<" defaulting to LE"<<endl;
00240        sbeam="le";
00241        break;
00242      }
00243      */
00244                                                                                  
00245      fname+="/ab_pdf_"+sdet+"_"+sbeam+"_"+rmc+".root";
00246                                                                                  
00247      ABID.ReadPDFs(fname.c_str());
00248   }
00249                                                                                  
00250   return ABID.CalcPID(ev, st);
00251 }

void ANtpInfoObjectFillerMRCC::FillEventInformation int  i,
const NtpMRRecord mrRecord,
const NtpStRecord stRecord,
ANtpEventInfoMRCC antp,
ANtpTruthInfoBeam truth
const
 

Fill antp mrcc information corresponding to i using best_event.

Parameters:
i Index in "normal" ANtp branches we should be matching
mrRecord sntp mrcc information for this snarl
stRecord The corresponding non-MRCC sntp record for this snarl
antp Output. Will be untouched if no match found
truth The truth info branch, which is filled here because of the problem documented in docdb 6599

Definition at line 30 of file ANtpInfoObjectFillerMRCC.cxx.

References NtpMREvent::best_event, FillEventInformationHelper(), and NtpMRRecord::mrevt.

Referenced by CondensedNtpModuleNC::Ana().

00035 {
00036   assert(i >= 0);
00037   assert(mrRecord);
00038 
00039   // The number of mrcc records in this snarl
00040   const int J = mrRecord->mrevt->GetEntriesFast();
00041   // Go through all the mrcc records in this snarl
00042   for(int j = 0; j < J; ++j){
00043     const NtpMREvent* mrevt = (NtpMREvent*)(mrRecord->mrevt->At(j));
00044     assert(mrevt);
00045     // See if any of them are matched up to the current event
00046     if(mrevt->best_event == i){
00047       FillEventInformationHelper(mrevt, stRecord, antp, truth);
00048       // Assume there is only one match. If there are more then there's
00049       // nothing sensible we can do about it anyway.
00050       return;
00051     }
00052   } // end for j
00053   // No matches, leave antp alone (it should already be default)
00054 }

void ANtpInfoObjectFillerMRCC::FillEventInformationHelper const NtpMREvent mrnt,
const NtpStRecord sntp_orig,
ANtpEventInfoMRCC antp,
ANtpTruthInfoBeam truth
const [protected]
 

Internal helper, copy contents of mrnt into antp.

Definition at line 58 of file ANtpInfoObjectFillerMRCC.cxx.

References ABPID(), NtpMREvent::best_complete, NtpMREvent::best_complete_phw, NtpMREvent::best_event, NtpMREvent::best_purity, NtpMREvent::best_purity_phw, ANtpEventInfoMRCC::bestComplete, ANtpEventInfoMRCC::bestCompletePHw, ANtpEventInfoMRCC::bestEvent, ANtpEventInfoMRCC::bestPurity, ANtpEventInfoMRCC::bestPurityPHw, ANtpEventInfoMRCC::contained, ANtpEventInfoMRCC::containedOrGoodFit, ANtpEventInfoMRCC::digits, NtpMREvent::endc, NtpMREvent::enddistance, NtpMREvent::endp, NtpMREvent::endx, NtpMREvent::endy, NtpMREvent::endz, ANtpInfoObjectFillerBeam::FillBeamMCTruthInformation(), ANtpInfoObjectFiller::FillMCTruthInformation(), ANtpEventInfoMRCC::fitMomentum, NtpMREvent::fitp, NtpStRecord::GetEventMCTruth(), NtpStRecord::GetEvents(), RecRecordImp< T >::GetHeader(), RecPhysicsHeader::GetSnarl(), NtpMREvent::index, ANtpEventInfoMRCC::index, ANtpEventInfoMRCC::maxTrackPlane, NtpMREvent::mrmEshw, NtpMREvent::mrmpmux, NtpMREvent::mrmpmuy, NtpMREvent::mrmpmuz, NtpMREvent::mrmQ2, MSG, NtpMREvent::mxpl, NtpMREvent::ndigit, NtpMREvent::npln, NtpMREvent::nstrip, NtpMREvent::orig_event, ANtpEventInfoMRCC::origABPID, ANtpEventInfoMRCC::origEvent, ANtpEventInfoMRCC::origROPID, NtpMREvent::pass, ANtpEventInfoMRCC::passedFit, NtpMREvent::pcrv, NtpMREvent::pmux, NtpMREvent::pmuy, NtpMREvent::pmuz, NtpMREvent::prng, NtpMREvent::pvdx, NtpMREvent::pvdy, NtpMREvent::pvdz, NtpMREvent::qp, ANtpEventInfoMRCC::qp, ANtpEventInfoMRCC::rangeMomentum, ANtpTruthInfoBeam::Reset(), ROPID(), ANtpEventInfoMRCC::showerCharge, ANtpEventInfoMRCC::showerEndPlane, ANtpEventInfoMRCC::showerEndX, ANtpEventInfoMRCC::showerEndY, ANtpEventInfoMRCC::showerEndZ, ANtpEventInfoMRCC::showerPlanes, ANtpEventInfoMRCC::showerVtxPlane, ANtpEventInfoMRCC::showerVtxX, ANtpEventInfoMRCC::showerVtxY, ANtpEventInfoMRCC::showerVtxZ, NtpMREvent::shwcharge, NtpMREvent::shwendplane, NtpMREvent::shwendx, NtpMREvent::shwendy, NtpMREvent::shwendz, NtpMREvent::shwnplane, NtpMREvent::shwvtxplane, NtpMREvent::shwvtxx, NtpMREvent::shwvtxy, NtpMREvent::shwvtxz, NtpStRecord::stdhep, ANtpEventInfoMRCC::strips, ANtpEventInfoMRCC::trackDcosXVtx, ANtpEventInfoMRCC::trackDcosYVtx, ANtpEventInfoMRCC::trackDcosZVtx, ANtpEventInfoMRCC::trackEndDistanceToEdge, ANtpEventInfoMRCC::trackEndPlane, ANtpEventInfoMRCC::trackEndX, ANtpEventInfoMRCC::trackEndY, ANtpEventInfoMRCC::trackEndZ, ANtpEventInfoMRCC::trackMomentumX, ANtpEventInfoMRCC::trackMomentumY, ANtpEventInfoMRCC::trackMomentumZ, ANtpEventInfoMRCC::trackPlanes, ANtpEventInfoMRCC::trackVtxDistanceToEdge, ANtpEventInfoMRCC::trackVtxPlane, ANtpEventInfoMRCC::trackVtxX, ANtpEventInfoMRCC::trackVtxY, ANtpEventInfoMRCC::trackVtxZ, ANtpEventInfoMRCC::trueMomentumX, ANtpEventInfoMRCC::trueMomentumY, ANtpEventInfoMRCC::trueMomentumZ, ANtpEventInfoMRCC::trueQ2, ANtpEventInfoMRCC::trueShowerEnergy, NtpMREvent::vtxdistance, NtpMREvent::vtxp, NtpMREvent::vtxx, NtpMREvent::vtxy, and NtpMREvent::vtxz.

Referenced by FillEventInformation().

00062 {
00063   assert(mrnt);
00064   assert(sntp_orig);
00065   assert(antp);
00066 
00067   antp->index = mrnt->index;
00068   antp->digits = mrnt->ndigit;
00069   antp->strips = mrnt->nstrip;
00070 
00071   antp->origEvent = mrnt->orig_event;
00072   antp->bestEvent = mrnt->best_event;
00073   antp->bestPurity = mrnt->best_purity;
00074   antp->bestComplete = mrnt->best_complete;
00075   antp->bestPurityPHw = mrnt->best_purity_phw;
00076   antp->bestCompletePHw = mrnt->best_complete_phw;
00077 
00078   MSG("ObjectFillerMRCC",Msg::kDebug) 
00079     << "orig_event=" << mrnt->orig_event << endl
00080     //<< "mrnt->snarl=" << mrnt->GetHeader().GetSnarl() << endl
00081     << "sntp_orig->snarl=" << sntp_orig->GetHeader().GetSnarl() << endl;
00082 
00083   vector<const NtpSREvent*> orig_evts=sntp_orig->GetEvents();
00084   assert(mrnt->orig_event < (int)orig_evts.size());
00085 
00086   const NtpSREvent* orig_event=orig_evts[mrnt->orig_event];
00087   antp->origABPID = ABPID(orig_event, sntp_orig);
00088   antp->origROPID = ROPID(orig_event, sntp_orig);
00089 
00090   // Fill the truth information. This code copied from
00091   // ANtpInfoObjectFillerNC::FillMCInformation
00092   truth->Reset();
00093   // Gah, const correctness, or lack of it
00094   NtpMCTruth* ntpMCTruth=const_cast<NtpMCTruth*>(sntp_orig->GetEventMCTruth(mrnt->orig_event));
00095 
00096   ANtpInfoObjectFiller::FillMCTruthInformation(ntpMCTruth, truth);
00097   ANtpInfoObjectFillerBeam::FillBeamMCTruthInformation(ntpMCTruth, sntp_orig->stdhep, 
00098                                                        truth);
00099 
00100   antp->showerVtxX = mrnt->shwvtxx;
00101   antp->showerVtxY = mrnt->shwvtxy;
00102   antp->showerVtxZ = mrnt->shwvtxz;
00103   antp->showerEndX = mrnt->shwendx;
00104   antp->showerEndY = mrnt->shwendy;
00105   antp->showerEndZ = mrnt->shwendz;
00106   antp->showerVtxPlane = mrnt->shwvtxplane;
00107   antp->showerEndPlane = mrnt->shwendplane;
00108   antp->showerPlanes = mrnt->shwnplane;
00109   antp->showerCharge = mrnt->shwcharge;
00110 
00111   antp->trackVtxX = mrnt->vtxx;
00112   antp->trackVtxY = mrnt->vtxy;
00113   antp->trackVtxZ = mrnt->vtxz;
00114   antp->trackVtxDistanceToEdge = mrnt->vtxdistance;
00115   antp->trackEndX = mrnt->endx;
00116   antp->trackEndY = mrnt->endy;
00117   antp->trackEndZ = mrnt->endz;
00118   antp->trackEndDistanceToEdge = mrnt->enddistance;
00119 
00120   antp->trackVtxPlane = mrnt->vtxp;
00121   antp->trackEndPlane = mrnt->endp;
00122   antp->trackPlanes = mrnt->npln;
00123   antp->rangeMomentum = mrnt->prng;
00124   antp->fitMomentum = mrnt->pcrv;
00125   antp->trackDcosXVtx = mrnt->pvdx;
00126   antp->trackDcosYVtx = mrnt->pvdy;
00127   antp->trackDcosZVtx = mrnt->pvdz;
00128 
00129   antp->passedFit = mrnt->fitp;
00130   antp->contained = mrnt->endc;
00131   antp->containedOrGoodFit = mrnt->pass;
00132   antp->trackMomentumX = mrnt->pmux;
00133   antp->trackMomentumY = mrnt->pmuy;
00134   antp->trackMomentumZ = mrnt->pmuz;
00135   antp->maxTrackPlane = mrnt->mxpl;
00136   antp->qp = mrnt->qp;
00137 
00138   antp->trueMomentumX = mrnt->mrmpmux;
00139   antp->trueMomentumY = mrnt->mrmpmuy;
00140   antp->trueMomentumZ = mrnt->mrmpmuz;
00141   antp->trueQ2 = mrnt->mrmQ2;
00142   antp->trueShowerEnergy = mrnt->mrmEshw;
00143 
00144 }

double ANtpInfoObjectFillerMRCC::ROPID const NtpSREvent ev,
const NtpStRecord st
const [protected]
 

Return the RO PID value for event ev in snarl st, reading the appropriate training files if necessary

Definition at line 254 of file ANtpInfoObjectFillerMRCC.cxx.

Referenced by FillEventInformationHelper().

00255 {
00256   // ***********
00257   // Don't calculate the kNN stuff. It's too slow
00258   // ***********
00259   return -1;
00260 
00261   /*
00262   // TODO: This code copied wholesale from ANtpInfoObjectFillerNC. Should rationalize.
00263 
00264   static bool once=false;
00265   static Anp::Interface anpint;
00266 
00267   if(!once){
00268     once=true;
00269     //set the location of the weight files based on the detector
00270     TString weightFileName = "knn.train.far.cedar.daikon.root";
00271     Detector::Detector_t det=st->GetVldContext()->GetDetector();
00272     if(det == Detector::kNear) weightFileName = "knn.train.near.cedar.daikon.root";
00273 
00274     TString base = getenv("SRT_PRIVATE_CONTEXT");
00275     TString ncutils = "/NCUtils/data/";
00276     if(base != "" && base != "."){
00277       //check that the private context director exists, if not use public context
00278       void *dirptr = gSystem->OpenDirectory(base+ncutils);
00279       if(!dirptr){
00280         base = getenv("SRT_PUBLIC_CONTEXT");
00281       }//end if private context doesnt exist
00282     }//end if private context is defined
00283     else base = getenv("SRT_PUBLIC_CONTEXT");
00284 
00285     //check that the public context exists, if not assert false
00286     if(base == ""){
00287       MSG("ObjectFillerMRCC", Msg::kFatal) << "no SRT_PUBLIC_CONTEXT set"
00288                                                  << endl;
00289       assert(false);
00290     }
00291 
00292     TString weightFilePath = base+ncutils+weightFileName;
00293     TString baseConf = getenv("SRT_PUBLIC_CONTEXT");
00294 
00295     Registry reg;
00296     reg.Set("InterfaceConfigPath", 
00297             baseConf+"/PhysicsNtuple/Config/Config2007Real.txt");
00298     reg.Set("FillkNNFilePath", weightFilePath);
00299     
00300     anpint.Config(reg);
00301   }
00302 
00303   static int prevSnarl=-1;
00304   int thisSnarl=st->GetHeader().GetSnarl();
00305   // Only refill the Anp interface once per snarl
00306   if(thisSnarl!=prevSnarl){
00307     prevSnarl=thisSnarl;
00308     // Gah, I wish const correctness wasn't such a pain
00309     if(!anpint.FillSnarl(const_cast<NtpStRecord*>(st))){
00310       MSG("ObjectFillerMRCC", Msg::kFatal) << "Couldn't set up Anp::Interface" << endl;
00311       // Dummy message to make sure it exits here
00312       MSG("ObjectFillerMRCC", Msg::kFatal) << "Goodbye" << endl;
00313     }
00314   }
00315 
00316   // Gah, I wish const correctness wasn't such a pain
00317   return anpint.GetVar("knn_pid", const_cast<NtpSREvent*>(ev));
00318   */
00319 }


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 05:30:18 2009 for loon by  doxygen 1.3.9.1