00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #include <iostream>
00013
00014 #include "TMath.h"
00015
00016 #include "CandNtupleSR/Module/NtpSRNDAPPlaneHistory.h"
00017 #include "MessageService/MsgService.h"
00018
00019 using std::cout;
00020 using std::endl;
00021 using std::multimap;
00022
00023 CVSID("$Id: NtpSRNDAPPlaneHistory.cxx,v 1.1 2005/11/05 23:53:51 schubert Exp $");
00024
00025
00026 NtpSRNDAPPlaneHistory::NtpSRNDAPPlaneHistory() {
00027 this->Reset();
00028 fPlane=-1;
00029 }
00030
00031
00032
00033 NtpSRNDAPPlaneHistory::NtpSRNDAPPlaneHistory(Int_t plane)
00034 {
00035 MSG("NtpSRNDAPPlaneHistory",Msg::kVerbose)
00036 <<"Running NtpSRNDAPPlaneHistory constructor..."<<std::endl;
00037 this->Reset();
00038 fPlane = plane;
00039 }
00040
00041
00042
00043 NtpSRNDAPPlaneHistory::NtpSRNDAPPlaneHistory(Int_t plane,
00044 multimap<Double_t,Double_t> stripList) :
00045 fPlane(plane),
00046 fStripList(stripList)
00047 {
00048 MSG("NtpSRNDAPPlaneHistory",Msg::kVerbose)
00049 <<"Running NtpSRNDAPPlaneHistory constructor for plane "
00050 << plane <<std::endl;
00051 }
00052
00053
00054
00055 NtpSRNDAPPlaneHistory::~NtpSRNDAPPlaneHistory() {
00056 MSG("NtpSRNDAPPlaneHistory",Msg::kVerbose)
00057 <<"Running NtpSRNDAPPlaneHistory destructor..."<<std::endl;
00058 this->Reset();
00059 }
00060
00061
00062
00063 void NtpSRNDAPPlaneHistory::Reset() {
00064 fStripList.clear();
00065 }
00066
00067
00068
00069 void NtpSRNDAPPlaneHistory::AddStrip(Double_t time, Double_t adc) {
00070
00071 fStripList.insert(std::pair<Double_t,Double_t>(time,adc));
00072 }
00073
00074
00075
00076 Int_t NtpSRNDAPPlaneHistory::GetNStrips() {
00077 return fStripList.size();
00078 }
00079
00080
00081
00082 Double_t NtpSRNDAPPlaneHistory::APPrediction(Double_t time) {
00083
00084 Double_t result = 0;
00085
00086 multimap<Double_t,Double_t>::iterator pos;
00087 for (pos = fStripList.begin(); pos!=fStripList.end(); ++pos) {
00088 if (pos->first < (time-100e-9)) {
00089 Double_t deltaT = time-pos->first;
00090 result += pos->second*(1.67e-2*TMath::Exp(-deltaT/343e-9)
00091 + 8.5e-4*TMath::Exp(-deltaT/2.4e-6));
00092 }
00093 }
00094
00095 MSG("NDAPHistory",Msg::kVerbose) << "AP prediction for time "
00096 << time << ": " << result << endl;
00097
00098 return result;
00099 }