10 unsigned int Locate(vector<double>&xx,
double x){
12 if (x==xx[0])
return 0;
13 else if (x==xx[n-1])
return n-2;
17 int ascnd=(xx[n-1]>=xx[0]);
20 if ( (x>=xx[jm])==ascnd)
53 double sqrt_t=
sqrt(my_t);
54 double t3=my_t*my_t*my_t;
55 double delta_mag=fabs(delta);
56 double a=a1+a2*delta_mag;
57 double b=b1+b2*delta_mag;
58 double c=c1+c2*delta_mag+c3*delta*delta;
59 f_delta=a*sqrt_t+b*my_t+c*t3;
60 f_0=a1*sqrt_t+b1*my_t+c1*t3;
65 double sqrt_t=
sqrt(my_t);
66 double delta_mag=fabs(delta);
78 double delta_sq=delta*delta;
79 double a=a1+a2*delta_mag+a3*delta_sq;
80 double b=b1+b2*delta_mag+b3*delta_sq;
81 f_delta=a*sqrt_t+b*my_t;
82 f_0=a1*sqrt_t+b1*my_t;
95 double frac=(t-cdc_drift_table[
index])/dt;
96 double d_0=0.01*(double(index)+frac);
103 d=f_delta*(d_0/f_0*P+1.-P);
112 TProfile *constants = (TProfile *) gDirectory->Get(
"/CDC_TimeToDistance/CDC_TD_Constants");
136 for (
unsigned int i=1; i<=78; i++){
140 Double_t parameters[18] =
142 long_drift_func[1][0], long_drift_func[1][1], long_drift_func[1][2],
143 long_drift_func[2][0], long_drift_func[2][1], long_drift_func[2][2],
145 short_drift_func[1][0], short_drift_func[1][1], short_drift_func[1][2],
146 short_drift_func[2][0], short_drift_func[2][1], short_drift_func[2][2]};
148 f->SetParameters(parameters);
150 TCanvas *
c =
new TCanvas(
"c_TD",
"CDC TD", 1200, 550);
155 TProfile2D *profile = (TProfile2D *) gDirectory->Get(
"/CDC_TimeToDistance/Predicted Drift Distance Vs Delta Vs t_drift");
157 gStyle->SetOptStat(0);
159 Double_t contours[21] =
160 { 0.00, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45,
161 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0};
163 profile->SetContour(21, contours);
164 profile->Draw(
"colz");
165 profile->GetXaxis()->SetRangeUser(0,1200);
166 profile->GetYaxis()->SetRangeUser(-0.22,0.22);
167 profile->GetYaxis()->SetTitleOffset(1.15);
168 f->SetContour(21, contours);
169 profile->Draw(
"cont2 list same");
170 f->Draw(
"cont2 list same");
173 TH2I *
hist = (TH2I *) gDirectory->Get(
"/CDC_TimeToDistance/Residual Vs. Drift Time");
175 hist->GetXaxis()->SetRangeUser(0,1200);
176 hist->GetYaxis()->SetTitleOffset(1.40);
177 c->cd(2)->SetGridx();
178 c->cd(2)->SetGridy();
unsigned int Locate(vector< double > &xx, double x)
double short_drift_func[3][3]
static char index(char c)
Double_t TimeToDistance(Double_t *x, Double_t *par)
double long_drift_func[3][3]
void HistMacro_CDCTimeToDistance()
vector< double > cdc_drift_table
double magnet_correction[2][2]