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

NCExtractionANN.cxx

Go to the documentation of this file.
00001 
00002 //
00003 //
00004 //NCExtractionANN.cxx
00005 //
00006 //Module for analyzing beam data for nc analysis
00007 //
00008 //R. Pittam 04/2007
00010 
00011 #include <cassert>
00012 
00013 #include "NCUtils/NCType.h"
00014 
00015 #include "NCUtils/Extraction/NCExtractionANN.h"
00016 #include "NCUtils/Extraction/RPTrackANN.h"
00017 #include "NCUtils/Extraction/RPnearTrackANN.h"
00018 #include "NCUtils/Extraction/RPnearTrackLowEANN.h"
00019 #include "NCUtils/Extraction/RPfarTrackANN.h"
00020 #include "NCUtils/Extraction/RPfarTrackLowEANN.h"
00021 
00022 #include "NCUtils/Cuts/NCAnalysisCuts.h"
00023 #include "NCUtils/Cuts/NCAnalysisCutsNC.h"
00024 
00025 #include "MessageService/MsgService.h"
00026 #include "Conventions/Detector.h"
00027 #include "Conventions/SimFlag.h"
00028 
00029 ClassImp(NCExtractionANN)
00030 ClassImp(NCExtractionANNNear)
00031 ClassImp(NCExtractionANNFar)
00032 
00033 CVSID("$Id: NCExtractionANN.cxx,v 1.8 2009/09/23 14:03:49 bckhouse Exp $");
00034 
00035 #include "NCUtils/Extraction/MicroDSTMaker.h"
00036 REGISTER_NCEXTRACTION(NCExtractionANN, ANN)
00037 REGISTER_NCEXTRACTION(NCExtractionANNNear, ANNNear)
00038 REGISTER_NCEXTRACTION(NCExtractionANNFar, ANNFar)
00039 
00040 
00041 //......................................................................
00042 NCExtractionANN::NCExtractionANN(NCAnalysisCuts* cuts,
00043                                  const Registry& r) :
00044   NCExtraction(cuts, r),
00045   fDetector(Detector::kUnknown),
00046   fRPannUseLowETrain(false)
00047 {
00048   int         tmpb;
00049   if (r.Get("RPAnnUseLowETrain",tmpb)) fRPannUseLowETrain = tmpb;
00050 }
00051 
00052 //-----------------------------------------------------------------------
00053 double NCExtractionANN::GetIdProbability(NCEventInfo& evtInfo, int /*beamType*/)
00054 {
00055   MAXMSG("NCExtractionANN", Msg::kDebug,1) << "GetIdProbabilty from ANN"
00056                                              << endl;
00057 
00058   // set up ANN input parameters from info objects
00059   // all ANN inputs must be doubles for some reason
00060 
00061   Double_t evtPlanes = evtInfo.event->planes;
00062   Double_t evtPHperPlane = evtInfo.event->phPerPlane;
00063   Double_t evtPHperStrip = evtInfo.event->phPerStrip;
00064   Double_t nshowers = evtInfo.event->showers;
00065 
00066   Double_t shwPlanes = 0.;
00067   if (nshowers>0) {
00068     shwPlanes = (Double_t) evtInfo.shower->planes;
00069   }
00070 
00071   // if longer than 40 planes, assign 1.5 (very CC like)
00072   if (evtPlanes>40) return 1.5;
00073 
00074   // now get the ANN values
00075   if (evtInfo.event->tracks>0) {
00076     Double_t trkPlanes = (Double_t) evtInfo.track->planes;
00077     Double_t trackExtension = (Double_t) trkPlanes - shwPlanes;
00078     Double_t trkdCosZvtx = evtInfo.track->dcosZVtx;
00079     Double_t trkredChi2 = evtInfo.track->reducedChi2;
00080     Double_t trkStrips = evtInfo.track->totalStrips;
00081     Double_t trkPHFraction = evtInfo.track->trackSigCorFraction;
00082 
00083     Detector::Detector_t det=(Detector::Detector_t)evtInfo.header->detector;
00084     assert(det==Detector::kNear || det==Detector::kFar);
00085 
00086     RPTrackANN* ann=0;
00087 
00088     // This is which detector we should actually use. If fDetector is
00089     // unset, we use the detector of the files we're running on,
00090     // otherwise we use the value of fDetector
00091     Detector::Detector_t detToUse=(fDetector==Detector::kUnknown) ? det : fDetector;
00092 
00093     if(fRPannUseLowETrain){
00094       MAXMSG("NCExtractionANN", Msg::kInfo, 1) 
00095         << "Using Low Energy Trained ANNs" << endl;
00096       // Boo, the ternary operator won't implicitly upcast here
00097 
00098       if(detToUse==Detector::kNear) ann=new RPnearTrackLowEANN;
00099       else                          ann=new RPfarTrackLowEANN;
00100       
00101     } 
00102     else{
00103       MAXMSG("NCExtractionANN", Msg::kInfo, 1) 
00104         << "Using All Energy Trained ANNs" << endl;
00105       if(detToUse==Detector::kNear) ann=new RPnearTrackANN;
00106       else                          ann=new RPfarTrackANN;
00107     }
00108     
00109     double ret = ann->value(0,
00110                             evtPHperPlane,
00111                             evtPHperStrip,
00112                             trkPHFraction,
00113                             trkStrips,
00114                             trkdCosZvtx,
00115                             trackExtension,
00116                             trkredChi2);
00117     // Make sure not to leak the ann
00118     delete ann;
00119     return ret;
00120     
00121   }//if tracks > 0
00122   else return 0; //no tracks
00123 
00124 }

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