StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
BetheBlochCalibrator.C
1 /***************************************************************************
2  *
3  * $Id: BetheBlochCalibrator.C,v 1.6 2006/08/15 21:41:40 jeromel Exp $
4  *
5  * Author:Aihong Tang Kent State University
6  * Send questions to aihong@cnr.physics.kent.edu
7  ***************************************************************************
8  *
9  * A macro that calibrate the bethe-bloch curve.
10  *
11  ***************************************************************************
12  *
13  * $Log: BetheBlochCalibrator.C,v $
14  * Revision 1.6 2006/08/15 21:41:40 jeromel
15  * Fix rhic -> rhic.bnl.gov
16  *
17  * Revision 1.5 2003/08/18 19:10:08 aihong
18  * update default pars
19  *
20  * Revision 1.2 2000/08/10 20:52:56 aihong
21  * change directory of Ntuples
22  *
23  * Revision 1.1 2000/08/09 15:55:23 aihong
24  * initial version
25  *
26  *
27  **************************************************************************/
28 
29 // Algorithm and Usage:
30 
31 // Currently BetheBlochFunction takes 7 aprameters:
32 // { pars[0],pars[1], pars[2], pars[3](charge), pars[4](mass), pars[5],pars[6]}
33 
34 // where "charge" and "mass" are charge and mass for a perticular particle type
35 // by setting both of them to 1 will give you dE/dx_beta*gamma instead of
36 // dE/dx_rigidity(p/z)
37 
38 
39 // Those parameters are got from fitting dE/dx_beta*gamma from the combination
40 // of clean pieces on the dE/dx_P plot.
41 
42 // After the dE/dx_beta*gamma fitting is done, the shape of the curve
43 // almost settles down except for two effects, which appear slightly
44 // different from run to run and need to be adjudged on individual data set.
45 // The two effects are: dE/dx uniform shift, dE/dx squeeze or enlarge.
46 
47 // There are two parameters (pars[2] & pars[5]) describing (controlling) these
48 // two effects. What this macro does is to adjudge these two parameters
49 // for a perticular data set.
50 
51 // A set of calibrated parameters will appear at the end of the run.
52 
53 
54 
55 
56 // User might modify the code to let it run for his/her own NTuple.
57 // Two blocks in the code need to be modified for their own NTuple,
58 // they are marked by "******"
59 
60 
61 
62 #include <strstream.h>
63 #include "/afs/rhic.bnl.gov/star/packages/SL02i/StRoot/StEventUtilities/BetheBlochFunction.hh"
64 
65 
66 void BetheBlochCalibrator(){
67 
68 
69 
70  gROOT->Reset();
71 
72  gSystem->Load("St_base");
73  gSystem->Load("St_Tables");
74  gSystem->Load("StUtilities");
75  gSystem->Load("StarClassLibrary");
76  gSystem->Load("StEvent");
77  gSystem->Load("StEventUtilities");
78 
79 
80  bool monitorFitting=true;
81 
82  //***********************************************************************
83  //**********change the name to the corresponding name in your NTuple.****
84  char* dedxMean="mDedx";
85  char* NTpcHitsOnTrack="mNdedxPts";
86  char* momentum="(mPt/sqrt(1-(tanh(mEta)*tanh(mEta))))";
87  //***********end of block
88  //***********************************************************************
89 
90 
91 
92  // double pars[NParameters]={1.09344, 0.0199,-2.34802e-07, 1.,1.,3.98625e-07,5.0e-4};//for mean70
93  //we need to adjudge pars[2] and pars[5].
94  //pars[2] describe uniform dE/dx shift.
95  //pars[5] describe dE/dx squeeze or enlarge.
96 
97  //double pars[NParameters]={1.072,0.3199,1.26349e-07,1,1,2.39688e-07,5.0e-4};//for mean55
98  const int NParameters=7;
99  const double pars[NParameters]={1.09344, 0.0199, -4.46121e-08, 1., 1., 4.12976e-07, 0.0005};
100 
101  double theCalib=pars[5];
102 
103 
104  double minimumIonizingPionStart=0.475;
105  double minimumIonizingPionEnd =0.525;
106 
107  double mimimumIonizingPionPosition
108  =(minimumIonizingPionEnd+minimumIonizingPionStart)/2.;
109 
110 
111  double protonTestStart = 0.525;
112  double protonTestEnd = 0.575;
113  double protonTestPosition
114  =(protonTestStart+protonTestEnd)/2.;
115 
116 
117  TF1* pionPlusBandCenter
118  =new TF1("pionPlusBandCenter",BetheBlochFunction, 0.02,5, NParameters);
119  pionPlusBandCenter->SetParameters(&pars[0]);
120  pionPlusBandCenter->SetParameter(4,0.13957); //pion mass
121 
122 
123  TF1* protonBandCenter
124  =new TF1("protonBandCenter",BetheBlochFunction, 0.02,5, NParameters);
125  protonBandCenter->SetParameters(&pars[0]);
126  protonBandCenter->SetParameter(4, 0.93827); //proton mass
127 
128 
129 double delta(double calib, double pionPosition, double protonPosition){
130 
131  pionPlusBandCenter->SetParameter(5,calib);
132  protonBandCenter->SetParameter(5,calib);
133 
134  return (protonBandCenter->Eval(protonPosition,0,0)-
135  pionPlusBandCenter->Eval(pionPosition,0,0));
136 }
137 
138 
139 double minimumIonizingdEdx(double calib, double pionPosition){
140  pionPlusBandCenter->SetParameter(5,calib);
141 
142  return pionPlusBandCenter->Eval(pionPosition,0,0);
143 }
144 
145 double look4MinDeltaDiff(double calibStart, double calibEnd, int calibSteps, double pionPosition, double protonPosition, double DeltaRef){
146 
147  double calibSeg=(calibEnd-calibStart)/double(calibSteps);
148  double thisCalib=calibStart;
149  double minDeltaDiffCalib=5000;//calib associated with minDeltaDiff.
150  double minDeltaDiff=5000;
151 
152  do {
153 
154  double myDelta=delta(thisCalib,pionPosition,protonPosition);
155  double diff=TMath::Abs(myDelta-DeltaRef);
156  if (diff<minDeltaDiff) {
157  minDeltaDiff=diff;
158  minDeltaDiffCalib=thisCalib;
159  }
160 
161  thisCalib=thisCalib+calibSeg;
162  }while(thisCalib<calibEnd);
163 
164  return minDeltaDiffCalib;
165 }
166 
167 
168 //now get delta and minimumIonizingdEdx from data.
169 //then use them as our reference to adjudge pars[2] and pars[5].
170 
171 
172 
173 
174  // initialize chain.
175 
176 
177 //*************************************************************************
178 //************** change the file name and branch name as yours ***********
179  TChain chain("FlowTree");
180 
181 
182 
183 
184 
185 
186 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010010.flowpicoevent.root");
187 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010020.flowpicoevent.root");
188 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010030.flowpicoevent.root");
189 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010040.flowpicoevent.root");
190 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010050.flowpicoevent.root");
191 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010060.flowpicoevent.root");
192 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010070.flowpicoevent.root");
193 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010080.flowpicoevent.root");
194 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010090.flowpicoevent.root");
195 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010100.flowpicoevent.root");
196 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010110.flowpicoevent.root");
197 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010120.flowpicoevent.root");
198 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010130.flowpicoevent.root");
199 
200 
201 
202 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010140.flowpicoevent.root");
203 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0010150.flowpicoevent.root");
204 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020010.flowpicoevent.root");
205 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020020.flowpicoevent.root");
206 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020030.flowpicoevent.root");
207 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020040.flowpicoevent.root");
208 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020050.flowpicoevent.root");
209 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020060.flowpicoevent.root");
210 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020070.flowpicoevent.root");
211 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020080.flowpicoevent.root");
212 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020090.flowpicoevent.root");
213 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020100.flowpicoevent.root");
214 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020110.flowpicoevent.root");
215 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020120.flowpicoevent.root");
216 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020130.flowpicoevent.root");
217 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020140.flowpicoevent.root");
218 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020150.flowpicoevent.root");
219 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0020160.flowpicoevent.root");
220 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030010.flowpicoevent.root");
221 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030020.flowpicoevent.root");
222 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030030.flowpicoevent.root");
223 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030040.flowpicoevent.root");
224 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030050.flowpicoevent.root");
225 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030070.flowpicoevent.root");
226 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030080.flowpicoevent.root");
227 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030090.flowpicoevent.root");
228 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030100.flowpicoevent.root");
229 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030110.flowpicoevent.root");
230 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030120.flowpicoevent.root");
231 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030130.flowpicoevent.root");
232 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030140.flowpicoevent.root");
233 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0030150.flowpicoevent.root");
234 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040010.flowpicoevent.root");
235 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040020.flowpicoevent.root");
236 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040030.flowpicoevent.root");
237 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040040.flowpicoevent.root");
238 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040050.flowpicoevent.root");
239 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040060.flowpicoevent.root");
240 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040070.flowpicoevent.root");
241 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040080.flowpicoevent.root");
242 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040090.flowpicoevent.root");
243 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040100.flowpicoevent.root");
244 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040110.flowpicoevent.root");
245 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040120.flowpicoevent.root");
246 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040130.flowpicoevent.root");
247 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040140.flowpicoevent.root");
248 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034002_raw_0040150.flowpicoevent.root");
249 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034004_raw_0020010.flowpicoevent.root");
250 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034004_raw_0030010.flowpicoevent.root");
251 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034004_raw_0040010.flowpicoevent.root");
252 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0010010.flowpicoevent.root");
253 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0010020.flowpicoevent.root");
254 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0010030.flowpicoevent.root");
255 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0010040.flowpicoevent.root");
256 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0010050.flowpicoevent.root");
257 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0010060.flowpicoevent.root");
258 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0010070.flowpicoevent.root");
259 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0010080.flowpicoevent.root");
260 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0020010.flowpicoevent.root");
261 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0020020.flowpicoevent.root");
262 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0020030.flowpicoevent.root");
263 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0020040.flowpicoevent.root");
264 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0020050.flowpicoevent.root");
265 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0020060.flowpicoevent.root");
266 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0020070.flowpicoevent.root");
267 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0020080.flowpicoevent.root");
268 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0030010.flowpicoevent.root");
269 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0030020.flowpicoevent.root");
270 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0030030.flowpicoevent.root");
271 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0030040.flowpicoevent.root");
272 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0030050.flowpicoevent.root");
273 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0030060.flowpicoevent.root");
274 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0030070.flowpicoevent.root");
275 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0030080.flowpicoevent.root");
276 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0040010.flowpicoevent.root");
277 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0040020.flowpicoevent.root");
278 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0040030.flowpicoevent.root");
279 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0040040.flowpicoevent.root");
280 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0040050.flowpicoevent.root");
281 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0040060.flowpicoevent.root");
282 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0040070.flowpicoevent.root");
283 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034005_raw_0040080.flowpicoevent.root");
284 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010010.flowpicoevent.root");
285 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010020.flowpicoevent.root");
286 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010030.flowpicoevent.root");
287 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010040.flowpicoevent.root");
288 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010050.flowpicoevent.root");
289 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010060.flowpicoevent.root");
290 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010070.flowpicoevent.root");
291 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010080.flowpicoevent.root");
292 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010090.flowpicoevent.root");
293 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010100.flowpicoevent.root");
294 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010110.flowpicoevent.root");
295 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010120.flowpicoevent.root");
296 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010130.flowpicoevent.root");
297 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010140.flowpicoevent.root");
298 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0010150.flowpicoevent.root");
299 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020010.flowpicoevent.root");
300 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020020.flowpicoevent.root");
301 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020030.flowpicoevent.root");
302 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020040.flowpicoevent.root");
303 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020050.flowpicoevent.root");
304 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020060.flowpicoevent.root");
305 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020070.flowpicoevent.root");
306 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020080.flowpicoevent.root");
307 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020090.flowpicoevent.root");
308 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020100.flowpicoevent.root");
309 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020110.flowpicoevent.root");
310 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020120.flowpicoevent.root");
311 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020130.flowpicoevent.root");
312 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020140.flowpicoevent.root");
313 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0020150.flowpicoevent.root");
314 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030010.flowpicoevent.root");
315 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030020.flowpicoevent.root");
316 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030030.flowpicoevent.root");
317 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030040.flowpicoevent.root");
318 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030050.flowpicoevent.root");
319 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030060.flowpicoevent.root");
320 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030070.flowpicoevent.root");
321 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030080.flowpicoevent.root");
322 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030090.flowpicoevent.root");
323 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030100.flowpicoevent.root");
324 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030110.flowpicoevent.root");
325 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030120.flowpicoevent.root");
326 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030130.flowpicoevent.root");
327 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0030140.flowpicoevent.root");
328 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040010.flowpicoevent.root");
329 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040020.flowpicoevent.root");
330 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040030.flowpicoevent.root");
331 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040040.flowpicoevent.root");
332 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040050.flowpicoevent.root");
333 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040060.flowpicoevent.root");
334 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040070.flowpicoevent.root");
335 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040080.flowpicoevent.root");
336 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040090.flowpicoevent.root");
337 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040100.flowpicoevent.root");
338 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040110.flowpicoevent.root");
339 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040120.flowpicoevent.root");
340 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040130.flowpicoevent.root");
341 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034028_raw_0040140.flowpicoevent.root");
342 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034033_raw_0010010.flowpicoevent.root");
343 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034033_raw_0020010.flowpicoevent.root");
344 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034033_raw_0020020.flowpicoevent.root");
345 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034033_raw_0020030.flowpicoevent.root");
346 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034033_raw_0020040.flowpicoevent.root");
347 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034033_raw_0030010.flowpicoevent.root");
348 chain->Add("/afs/rhic.bnl.gov/star/users/aihong/ebye/Pico_P03iadAuTest/st_physics_4034033_raw_0040010.flowpicoevent.root");
349 
350 
351 
352 
353 
354 
355 
356  //**********end of block************************************
357  //**********************************************************
358 
359 
360 
361 
362 
363 
364  TH1D* pionHisto= new TH1D("pionHisto","dE/dx histo. for minimum ionizing pions",100,0.022e-4,0.03e-4);
365 
366  double protonHistoCenter=protonBandCenter->Eval(protonTestPosition,0,0);
367  double protonHistoHalfRange=0.24e-5;
368 
369 
370  TH1D* protonHisto= new TH1D("protonHisto","dE/dx histo. for proton",100,(protonHistoCenter-protonHistoHalfRange),(protonHistoCenter+protonHistoHalfRange));
371 
372 
373 
374 
375  //dump to pionHisto
376  strstream pionMtmCutStr;
377 
378  pionMtmCutStr<<momentum<<"<"<<minimumIonizingPionEnd<<" && "<<momentum<<">"<<minimumIonizingPionStart;
379  //m_pmag is momentum.
380 
381  TCut pionMtmCut=pionMtmCutStr.str();
382 
383  strstream pionMeanCutStr;
384  pionMeanCutStr<<dedxMean<<"<5.0e-5";
385 
386  TCut pionMeanCut=pionMeanCutStr.str();
387 
388  strstream tpcpointsCutStr;
389  tpcpointsCutStr<<NTpcHitsOnTrack<<">15";
390 
391 
392  TCut tpcpointsCut=tpcpointsCutStr.str();
393 
394 
395  TCut totalPionCut=pionMtmCut+pionMeanCut+tpcpointsCut;
396 
397  strstream pionHistoDump;
398  pionHistoDump<<dedxMean<<">>pionHisto";
399 
400  chain->Draw(pionHistoDump.str(),totalPionCut.GetTitle());
401 
402 
403  //dump to protonHisto
404  strstream protonMtmCutStr;
405 
406  protonMtmCutStr<<momentum<<"<"<<protonTestEnd<<" && "<<momentum<<">"<<protonTestStart;
407 
408  TCut protonMtmCut=protonMtmCutStr.str();
409 
410  strstream protonMeanCutStr;
411  protonMeanCutStr<<dedxMean<<"<5.0e-5";
412 
413  TCut protonMeanCut=protonMeanCutStr.str();
414 
415  TCut totalProtonCut=protonMtmCut+protonMeanCut+tpcpointsCut;
416  strstream protonHistoDump;
417  protonHistoDump<<dedxMean<<">>protonHisto";
418 
419  chain->Draw(protonHistoDump.str(),totalProtonCut.GetTitle());
420 
421 
422  //fitting.
423 TF1* protonGaus= new TF1("protonGaus","gaus",(protonHistoCenter-protonHistoHalfRange*0.7),(protonHistoCenter+protonHistoHalfRange*0.8));
424  protonGaus->SetParLimits(1,protonHistoCenter*0.7,protonHistoCenter*1.3);
425  protonHisto->Fit("protonGaus","R");
426  double protonReference=protonGaus->GetParameter(1);
427 
428 
429  double pionPeakPosition
430  =pionHisto->GetBinCenter(pionHisto->GetMaximumBin());
431  double pionFitHalfRange=0.025e-5;
432 TF1* pionGaus=new TF1("pionGaus","gaus",(pionPeakPosition-pionFitHalfRange),(pionPeakPosition+pionFitHalfRange));
433  pionHisto->Fit("pionGaus","R");
434  double pionReference=pionGaus->GetParameter(1);
435 
436 
437  if (monitorFitting){
438  TCanvas* pionCanvas=new TCanvas("pion");
439  pionCanvas->cd();
440  pionHisto->Draw();
441  TCanvas* protonCanvas=new TCanvas("proton");
442  protonCanvas->cd();
443  protonHisto->Draw();
444  }
445 
446 
447  double deltaReference=protonReference-pionReference;
448 
449 
450  //now do the calibration...
451 
452  double calibResult=look4MinDeltaDiff(theCalib*0.7, theCalib*1.3, 100,mimimumIonizingPionPosition ,protonTestPosition , deltaReference);
453 
454 
455 
456  double pars[2] = pars[2]+minimumIonizingdEdx(calibResult,mimimumIonizingPionPosition )-pionReference;
457 
458  double pars[5]=calibResult;
459 
460  cout<<endl;
461  cout<<" *************************************"<<endl;
462  cout<<" * the calibrated parameters are: *"<<endl;
463  cout<<" *************************************"<<endl;
464  cout<<endl;
465  cout<<" ";
466  cout<<"{ ";
467  for (int j=0; j<3; j++)
468  cout<<pars[j]<<", ";
469  cout<<"charge, mass, ";
470  cout<<pars[5]<<", "<<pars[6]<<" }"<<endl<<endl;
471 
472 }
473