CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
MrpcCalibSvc.cxx
Go to the documentation of this file.
1//********************************************************
2//
3// MRPC Reconstruction Service - Provides Calibration constants
4// Matthias Ullrich - <[email protected]>
5//
6// Description:
7// Class Provides Calibration constant, which are use in MRPC Reconstruction:
8// - Time-Amplitude Correlation is used in TofRawDataProviderSvc
9// - Sigma is used in MrpcRec and MrpcDBSRec
10// - Energy-Calibration is used in TofEnergyRec
11//*********************************************************
12
13
14#include "GaudiKernel/Kernel.h"
15#include "GaudiKernel/IInterface.h"
16#include "GaudiKernel/IIncidentSvc.h"
17#include "GaudiKernel/Incident.h"
18#include "GaudiKernel/IIncidentListener.h"
19#include "GaudiKernel/StatusCode.h"
20#include "GaudiKernel/SvcFactory.h"
21#include "GaudiKernel/MsgStream.h"
22#include "GaudiKernel/IDataProviderSvc.h"
23#include "GaudiKernel/SmartDataPtr.h"
24#include "GaudiKernel/DataSvc.h"
25
27
29
30
31using namespace std;
32
33
34
35
36
37
38
39
40//Time Amplitude Correction extracted in BOSS 6.6.4a
41double MrpcCalibSvc::Time_Amplitude_Correction(unsigned int tdcChannel, unsigned int tdc2Channel)
42{
43
44 double pulse_length=RawDataUtil::TofTime(tdc2Channel-tdcChannel);
45
46
47 //Calculate the correction:
48 double correction_ta=0;
49
50 if(pulse_length < 4.164){correction_ta=-100000.;} // 4.164 ns = 10 fC; Everything smaller is expected to be noise! ->Deposit charge =0;
51
52 //This function has been extracted with a fit on MC data
53 if(pulse_length>=4.164 && pulse_length<=14.0)
54 {
55 correction_ta=278.03; //value of the function below at pulselength=14.0 as it is ~constant.
56 }
57 else if(pulse_length>14.0 && 15.793)
58 {
59 correction_ta = 1152674.673-307911.4654*pulse_length+30788.47591*pulse_length*pulse_length-1365.232906*pulse_length*pulse_length*pulse_length+22.64702791*pulse_length*pulse_length*pulse_length*pulse_length;
60 if(correction_ta<0)correction_ta=0;
61 }
62 else if(pulse_length >= 15.793)
63 {
64 6104.055949-375.6901764*pulse_length; // Linear fit for the last part of the spectra. The x^4 - polynom was not able to describe this part satisfying.
65 if(correction_ta<0)correction_ta=0;
66 }
67
68 return (correction_ta/1000.);
69
70}
71
72
73
74
75
76
77// All the folloqing values have been extracted in BOSS 6.6.2
78
79//Get the resolution of (t_measured-t_estimated-t_expected-t_tacorrection-t_transitiontime) <--- This should be the correct distribution
80// which should be used for the PID!
81//The correction for ta is done in TOF-RawDataProvider, the correction for transitiontime in MRPRREC
82// The time --- t_measured --- stored in the files eventually is the time corrected for transition time, TA correction and t_estimated.
83//DBS is true, when one use the double-sided-readout version of MRPC
84
85double MrpcCalibSvc::GetSigma(double momentum, unsigned tof_id, int particle_species, bool dbs)
86{
87 //paricle species: 0=Electron, 1=Muon, 2=Pion, 3=Kaon, 4 = Proton
88
89 double sigma=0;
90
91 if(particle_species==0) sigma=GetSigmaElectron(momentum,tof_id,dbs);
92 if(particle_species==1) sigma=GetSigmaMuon(momentum,tof_id,dbs);
93 if(particle_species==2) sigma=GetSigmaPion(momentum,tof_id,dbs);
94 if(particle_species==3) sigma=GetSigmaKaon(momentum,tof_id,dbs);
95 if(particle_species==4) sigma=GetSigmaProton(momentum,tof_id,dbs);
96
97 return sigma;
98}
99
100
101
102double MrpcCalibSvc::GetSigmaElectron(double momentum, unsigned tof_id, bool dbs)
103{
104 double sigma=0.08;
105
106 if(!dbs) sigma =0.0864116*exp(-momentum/0.329858)+0.0898002;
107 if(dbs) sigma =0.103841*exp(-momentum/0.252881)+0.0840766;
108
109 return sigma;
110}
111
112
113double MrpcCalibSvc::GetSigmaMuon(double momentum, unsigned tof_id, bool dbs)
114{
115 double sigma=0.08;
116
117 if(!dbs) sigma=0.165892*exp(-momentum/0.25094)+0.0718477;
118 if(dbs) sigma=0.166412*exp(-momentum/0.203065)+0.0718146;
119
120 return sigma;
121}
122
123
124
125double MrpcCalibSvc::GetSigmaPion(double momentum, unsigned tof_id, bool dbs)
126{
127 double sigma=0.08;
128
129 if(!dbs) sigma =0.338622*exp(-momentum/0.187429)+0.0802867;
130 if(dbs) sigma =0.448576*exp(-momentum/0.147072)+0.078237;
131
132 return sigma;
133}
134
135
136
137double MrpcCalibSvc::GetSigmaKaon(double momentum, unsigned tof_id, bool dbs)
138{
139 double sigma=0.08;
140
141 if(!dbs) sigma =0.174625*exp(-momentum/0.201226+1.13756+1.10314*momentum*momentum)+0.0752667;
142 if(dbs) sigma =0.581175*exp(-momentum/0.141733+0.581804+1.75623*momentum*momentum)+0.0767948;
143
144 return sigma;
145}
146
147
148
149double MrpcCalibSvc::GetSigmaProton(double momentum, unsigned tof_id, bool dbs)
150{
151 double sigma=0.08;
152
153 if(!dbs) sigma=0.8125*exp(-momentum/0.276857)+0.0828829;
154 if(dbs) sigma=1.1716*exp(-momentum/0.227311)+0.0823852;
155
156 return sigma;
157}
158
159
160
161
162
163//Calibration value for TofEnergyRec
164
165double MrpcCalibSvc::GetEnergyCalibration(double charge_ns, bool neutral , bool neighborhood)
166{
167
168 double energy=0;
169
170 if(neutral==true)
171 {
172 // The values are from photons simulated with geant4!
173 if(charge_ns<15.0716) energy = 326.35-10.6284*15.0716-1.4169*15.0716*15.0716-0.0514292*15.0716*15.0716*15.0716+0.00645421*15.0716*15.0716*15.0716*15.0716;//in MeV: Below this value we assume a constant energyloss!
174 else if(charge_ns>15.9131) energy = -7.91205+0.814588*charge_ns; //Over this value we expect the energyloss to be the same as for charged particles!
175 else energy = 326.35-10.6284*charge_ns-1.4169*charge_ns*charge_ns-0.0514292*charge_ns*charge_ns*charge_ns+0.00645421*charge_ns*charge_ns*charge_ns*charge_ns;// in MeV
176 }
177 else //charged tracks, (combined electrons/positrons in geant4)
178 {
179 if(neighborhood==false) energy = -7.91205+0.814588*charge_ns;// in MeV
180 else
181 {
182 if(15.16>= charge_ns) energy= -72550.7+14230.9*15.16-930.499*15.16*15.16+20.2818*15.16*15.16*15.16;//Minimal loss from fit!
183 if(15.16< charge_ns &&charge_ns<15.7633) energy= -72550.7+14230.9*charge_ns-930.499*charge_ns*charge_ns+20.2818*charge_ns*charge_ns*charge_ns;
184 else energy = -7.91205+0.814588*charge_ns; //Else we will use the not neighborhood distribution as our fit will begin to fall
185 }
186
187 }
188
189 return energy;
190
191}
192
193
194
195
196
197
198
199
200
201
202
**********INTEGER nmxhep !maximum number of particles DOUBLE PRECISION vhep INTEGER jdahep COMMON hepevt $ !serial number $ !number of particles $ !status code $ !particle ident KF $ !parent particles $ !childreen particles $ !four momentum
EvtComplex exp(const EvtComplex &c)
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition KK2f.h:50
double GetSigmaMuon(double, unsigned, bool)
double GetSigmaPion(double, unsigned, bool)
double GetSigmaProton(double, unsigned, bool)
double GetEnergyCalibration(double, bool, bool)
double GetSigmaKaon(double, unsigned, bool)
double Time_Amplitude_Correction(unsigned int tdcChannel, unsigned int tdc2Channel)
double GetSigma(double, unsigned, int, bool)
double GetSigmaElectron(double, unsigned, bool)
static double TofTime(unsigned int timeChannel)
Definition RawDataUtil.h:69