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

DmxRMSStat.cxx

Go to the documentation of this file.
00001 
00002 //$Id: DmxRMSStat.cxx,v 1.19 2003/05/16 14:02:44 brebel Exp $
00003 //
00004 //DmxRMSStat.cxx
00005 //
00006 //DmxRMSStat is a Statistic class returning an RMS statistic for the
00007 //demuxing of signal/strip possibilities
00008 //
00009 //Author:  B. Rebel 6/2000
00011 
00012 #include "TMath.h"
00013 #include "DeMux/DmxRMSStat.h"
00014 #include "MessageService/MsgService.h"
00015 
00016 ClassImp(DmxRMSStat)
00017 
00018 //______________________________________________________________________
00019 //CVSID("$Id: DmxRMSStat.cxx,v 1.19 2003/05/16 14:02:44 brebel Exp $");
00020 
00021 //------------------------------------------------------------------
00022 DmxRMSStat::DmxRMSStat()
00023 {
00024 }
00025 
00026 //------------------------------------------------------------------
00027 DmxRMSStat::DmxRMSStat(Float_t *SignalW, Float_t *SignalE, Float_t CoG) :
00028   fRms(0.)
00029 {
00030   Float_t numerator = 0.;
00031   Float_t denominator = 0.;
00032   Float_t totalHits = 0.;
00033 
00034   for(Int_t i = 0; i < 192; i++){
00035     if( SignalW[i] > 0.){ 
00036       totalHits += 1.; 
00037       numerator += SignalW[i] * ((1. * i) - CoG) * ((1. * i) - CoG);
00038       denominator += SignalW[i];
00039     }
00040     if( SignalE[i] > 0.){ 
00041       totalHits += 1.; 
00042       numerator += SignalE[i] * ((1. * i) - CoG) * ((1. * i) - CoG);
00043       denominator += SignalE[i];
00044     }
00045   }
00046     
00047   //find the RMS and return it
00048 
00049   if(denominator != 0. && totalHits > 1.){
00050     Float_t rmssqr = (numerator / denominator) * (totalHits/(totalHits - 1.));
00051     fRms = TMath::Sqrt(rmssqr);
00052     //MSG("Dmx", Msg::kVerbose)  << "rms = " << rms << endl;
00053   }
00054   
00055   return;
00056 }
00057 
00058 //------------------------------------------------------------------
00059 DmxRMSStat::~DmxRMSStat()
00060 {
00061   //  MSG("Dmx", Msg::kVerbose) << "deleting DmxRMSStat object" << endl;
00062 }
00063 
00064 //------------------------------------------------------------------
00065 //the rms of a reconstruction is defined by
00066 //
00067 //rms^2 = ((SUM[S * (x - x_avg)^2]) / (SUM[signal])) * (N / (N -1))
00068 //
00069 //where S is the ADC signal, x the strip number, x_avg the cog, and
00070 //N the number of hits.
00071 
00072 Float_t DmxRMSStat::GetGoodness() const
00073 {
00074   
00075   return fRms;
00076 }
00077 
00078 //------------------------------------------------------------------
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 

Generated on Mon Feb 15 11:06:38 2010 for loon by  doxygen 1.3.9.1