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

VHS.h

Go to the documentation of this file.
00001 
00002 // $Id: VHS.h,v 1.2 2007/04/27 16:40:45 arms Exp $
00003 //
00004 // VHS : Namespace containing functions useful for training
00005 //       and analysis of event images
00006 //
00007 // arms@physics.umn.edu
00009 #ifndef VHS_H
00010 #define VHS_H
00011 #include "TROOT.h"
00012 
00013 #include <sstream>
00014 #include <string>
00015 #include <vector>
00016 
00017 #include "TTree.h"
00018 
00019 class MomNavigator;
00020 class NtpSREvent;
00021 class NtpStRecord;
00022 class TClonesArray;
00023 class TH2D;
00024 class VHSevent;
00025 
00026 namespace VHS
00027 {
00028   enum evtType { vhsNC=0, vhsCCe=1, vhsCCmu=2, vhsCCtau=3, vhsUnknown=4 };
00029 
00030   bool                     DrawEvent( int nEntry,  const char* treeName,
00031                                       int nPlanes, int         nStrips );
00032   void                     FillDiscriminants(NtpSREvent*          evt,
00033                                              TClonesArray*        stp,
00034                                              std::vector<double>  avgNC,
00035                                              std::vector<double>  avgCCe,
00036                                              std::vector<double>  avgCCmu,
00037                                              std::vector<double>  avgCCtau,
00038                                              std::vector<double>  varNC,
00039                                              std::vector<double>  varCCe,
00040                                              std::vector<double>  varCCmu,
00041                                              std::vector<double>  varCCtau,
00042                                              std::vector<double>  pNC,
00043                                              std::vector<double>  pCCe,
00044                                              std::vector<double>  pCCmu,
00045                                              std::vector<double>  pCCtau,
00046                                              const int            nPlanes,
00047                                              const int            nStrips,
00048                                              const bool           bUnit,
00049                                              VHSevent*&           vhsevt);
00050   std::vector<double>      FindMedian(std::vector< std::vector<double> > pts,
00051                                       std::vector< double >              avg,
00052                                       bool bUnit=true,
00053                                       bool bVerbose=true                    );
00054   std::vector<double>      FullVec(std::vector<double> image,
00055                                    std::vector<int>    index,
00056                                    int                 nPlanes,
00057                                    int                 nStrips);
00058   double                   GetDistance(std::vector<double> vec0,
00059                                        std::vector<double> vec1);
00060   VHS::evtType             GetEvtType(int inu, int iaction);
00061   void                     GetImage(int*                 index,
00062                                     int                  nstp,
00063                                     TClonesArray*        stp,
00064                                     int                  nPlanes,
00065                                     int                  nStrips,
00066                                     std::vector<double>& image,
00067                                     std::vector<int>&    vecInd,
00068                                     std::vector<double>& theta);
00069   double                   GetLL(std::vector<double> fullImage,
00070                                  std::vector<double> pHit,
00071                                  std::vector<double> avg,
00072                                  std::vector<double> var);
00073   int                      GetPlane(int vecInd, int nPlanes);
00074   int                      GetStrip(int vecInd, int nPlanes);
00075   void                     GetThetaAxis(TClonesArray*     stp,
00076                                         std::vector<int>  index,
00077                                         double&           theta,
00078                                         std::vector<int>& center);
00079   std::vector<std::string> ParseNmList(const char* cstr);
00080   void                     ReadFile(TFile*                inFile,
00081                                     std::vector<double>&  avgNC,
00082                                     std::vector<double>&  avgCCe,
00083                                     std::vector<double>&  avgCCmu,
00084                                     std::vector<double>&  avgCCtau,
00085                                     std::vector<double>&  varNC,
00086                                     std::vector<double>&  varCCe,
00087                                     std::vector<double>&  varCCmu,
00088                                     std::vector<double>&  varCCtau,
00089                                     std::vector<double>&  pNChit,
00090                                     std::vector<double>&  pCCehit,
00091                                     std::vector<double>&  pCCmuhit,
00092                                     std::vector<double>&  pCCtauhit,
00093                                     const int             nPlanes);
00094   void                     RotatePixel(int&         plane,
00095                                        int&         strip,
00096                                        const int    avgPlane,
00097                                        const int    avgStrip,
00098                                        const double theta   );
00099   void                     SeparateViews(int*              index,
00100                                          int               nstp,
00101                                          TClonesArray*     stp,
00102                                          std::vector<int>& ustp,
00103                                          std::vector<int>& vstp );
00104   std::vector< VHSevent* > Skim(NtpStRecord*         ntpst,
00105                                 std::vector<double>  avgNC,
00106                                 std::vector<double>  avgCCe,
00107                                 std::vector<double>  avgCCmu,
00108                                 std::vector<double>  avgCCtau,
00109                                 std::vector<double>  varNC,
00110                                 std::vector<double>  varCCe,
00111                                 std::vector<double>  varCCmu,
00112                                 std::vector<double>  varCCtau,
00113                                 std::vector<double>  pNC,
00114                                 std::vector<double>  pCCe,
00115                                 std::vector<double>  pCCmu,
00116                                 std::vector<double>  pCCtau,
00117                                 const int            nPlanes=20,
00118                                 const int            nStrips=20,
00119                                 const bool           bUnit=true);
00120   std::vector<double>      SubtractVec(std::vector<double> image0,
00121                                        std::vector<double> image1);
00122   template<class T>
00123     std::string            ToString(const T& thing, int w = 0, int p = 0);
00124   void                     ToTH2D(std::vector<double> vec,
00125                                   int         nPlanes, int         nStrips,
00126                                   std::string name,    std::string title,
00127                                   TH2D*&      Uview,   TH2D*&      Vview  );
00128   std::vector<double>      ToVector(TH2D* hist, int nPlanes);
00129   int                      Train(NtpStRecord*          ntpst,
00130                                  std::vector<double>&  avgNC,
00131                                  std::vector<double>&  avgCCe,
00132                                  std::vector<double>&  avgCCmu,
00133                                  std::vector<double>&  avgCCtau,
00134                                  std::vector<double>&  varNC,
00135                                  std::vector<double>&  varCCe,
00136                                  std::vector<double>&  varCCmu,
00137                                  std::vector<double>&  varCCtau,
00138                                  std::vector<int>&     numNC,
00139                                  std::vector<int>&     numCCe,
00140                                  std::vector<int>&     numCCmu,
00141                                  std::vector<int>&     numCCtau,
00142                                  int&                  NCevts,
00143                                  int&                  eCCevts,
00144                                  int&                  muCCevts,
00145                                  int&                  tauCCevts,
00146                                  const int             maxTrain=1000,
00147                                  const int             nPlanes=20,
00148                                  const int             nStrips=20,
00149                                  const int             cutPlanes=40,
00150                                  const double          eRecoMax=999.,
00151                                  const double          eTrueMax=999.);
00152   void                     TrainPost(TFile*                outFile,
00153                                      std::vector<double>&  avgNC,
00154                                      std::vector<double>&  avgCCe,
00155                                      std::vector<double>&  avgCCmu,
00156                                      std::vector<double>&  avgCCtau,
00157                                      std::vector<double>&  varNC,
00158                                      std::vector<double>&  varCCe,
00159                                      std::vector<double>&  varCCmu,
00160                                      std::vector<double>&  varCCtau,
00161                                      std::vector<int>&     numNC,
00162                                      std::vector<int>&     numCCe,
00163                                      std::vector<int>&     numCCmu,
00164                                      std::vector<int>&     numCCtau,
00165                                      int                   NCevts,
00166                                      int                   eCCevts,
00167                                      int                   muCCevts,
00168                                      int                   tauCCevts,
00169                                      const int             nPlanes=20,
00170                                      const int             nStrips=20);
00171   void                     UnitVector(std::vector<double>& vec);
00172   int                      VecIndex(int ipln, int istp, int nPlanes);
00173   void                     WriteFile(TFile*                outFile,
00174                                      std::vector<double>&  avgNC,
00175                                      std::vector<double>&  avgCCe,
00176                                      std::vector<double>&  avgCCmu,
00177                                      std::vector<double>&  avgCCtau,
00178                                      std::vector<double>&  varNC,
00179                                      std::vector<double>&  varCCe,
00180                                      std::vector<double>&  varCCmu,
00181                                      std::vector<double>&  varCCtau,
00182                                      std::vector<double>&  pNChit,
00183                                      std::vector<double>&  pCCehit,
00184                                      std::vector<double>&  pCCmuhit,
00185                                      std::vector<double>&  pCCtauhit,
00186                                      const int             nPlanes,
00187                                      const int             nStrips);
00188 }
00189 #endif // VHS_H
00190 

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