• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

analysis/ScEvent.cxx (r4864/r464)

Go to the documentation of this file.
00001 #include "ScDigi.h"
00002 #include "ScEvent.h"
00003 #include "nxyter/Data.h"
00004 #include "TMath.h"
00005 #include <iostream>
00006 
00007 using namespace std;
00008 
00009 
00010 ScEvent::ScEvent() : fDigis("ScDigi", 100), fAux("ScDigi", 100) {
00011   Clear();
00012 }
00013 
00014 
00015 void ScEvent::Clear() {
00016   fEpoch = fNDigis = fNAux = 0;
00017   fTstart = fTstop = fTmean = fTvar = 0.;
00018   fTsum   = fT2sum = 0.;
00019   fDigis.Clear();
00020   fAux.Clear();
00021 }
00022 
00023 
00024 void ScEvent::AddData(nxyter::Data* data, Long64_t hitTime, Int_t epoch) {
00025 
00026   // Set epoch and event start from the first hit/aux
00027   if ( IsEmpty() ) {
00028     fEpoch  = epoch;
00029     fTstart = Double_t(hitTime);
00030   }
00031 
00032   // Add hit/aux to the array; calculate new time mean and RMS
00033   if      ( data->isHitMsg() ) new(fDigis[fNDigis++]) ScDigi(data, hitTime);
00034   else if ( data->isAuxMsg() ) new(fAux[fNAux++]) ScDigi(data, hitTime);
00035   fTsum  += Double_t(hitTime);
00036   fT2sum += Double_t(hitTime) * Double_t(hitTime);
00037   fTmean = fTsum / (fNDigis+fNAux);
00038   fTvar  = TMath::Sqrt( fT2sum / Double_t(fNDigis+fNAux) - fTmean*fTmean );
00039 
00040   // Set event end time from last hit/aux
00041   fTstop = hitTime;
00042 
00043 }
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 void ScEvent::Print(Option_t* opt) const {
00052   cout << "Event time " << fTmean << " Event start " << fTstart << ", Event end " << fTstop
00053        << ", RMS " << fTvar << ", Epoch " << fEpoch << ", Hits " << fNDigis << endl;
00054  }
00055 
00056 
00057 
00058 ClassImp(ScEvent)

Generated on Tue Dec 10 2013 04:52:16 for ROCsoft by  doxygen 1.7.1