1 |
|
|
2 |
|
|
3 |
– |
|
4 |
– |
|
5 |
– |
////152, not xyz of xtal ,read from 167 root file |
3 |
|
void get_xyzEBrechits(){ |
4 |
|
TChain *ch = new TChain("Analysis"); |
5 |
< |
// ch->Add("/afs/cern.ch/user/y/yangyong/w0/cmssw167.xyzEB.root"); |
9 |
< |
ch->Add("/afs/cern.ch/user/y/yangyong/w0/xyzECAL.GR_R_42_V20.root"); |
10 |
< |
//ch->Add("/uscms_data/d2/yongy/calib/backup/cmssw217.xyzECAL.root"); |
5 |
> |
ch->Add("xyzECAL.root"); |
6 |
|
|
12 |
– |
|
13 |
– |
|
7 |
|
ch->SetBranchAddress("xEBAll",xEBAll); |
8 |
|
ch->SetBranchAddress("yEBAll",yEBAll); |
9 |
|
ch->SetBranchAddress("zEBAll",zEBAll); |
107 |
|
return mdiff; |
108 |
|
} |
109 |
|
|
117 |
– |
|
118 |
– |
|
119 |
– |
void sortPtvector(vector<float> pt, vector<int> &ind){ |
120 |
– |
|
121 |
– |
ind.clear(); |
122 |
– |
|
123 |
– |
int n = int( pt.size()); |
124 |
– |
|
125 |
– |
vector<float> pt0; |
126 |
– |
for(int j=0; j< n ; j++){ |
127 |
– |
pt0.push_back(pt[j]); |
128 |
– |
} |
129 |
– |
|
130 |
– |
sort(pt.begin(),pt.end()); |
131 |
– |
|
132 |
– |
for(int j = n -1; j>=0; j--){ |
133 |
– |
|
134 |
– |
float dptmin = 0.1; |
135 |
– |
int jmin = -1; |
136 |
– |
for(int k=0; k< n; k++){ |
137 |
– |
|
138 |
– |
float dpt = fabs( pt[j] - pt0[k]); |
139 |
– |
vector<int>::iterator it = find( ind.begin(),ind.end(),k); |
140 |
– |
if( it != ind.end()) continue; |
141 |
– |
|
142 |
– |
if( dpt < dptmin){ |
143 |
– |
dptmin = dpt; |
144 |
– |
jmin = k; |
145 |
– |
} |
146 |
– |
|
147 |
– |
} |
148 |
– |
ind.push_back(jmin); |
149 |
– |
|
150 |
– |
} |
151 |
– |
|
152 |
– |
if(int(ind.size()) != n){ |
153 |
– |
cout<<"erorr_sortPtvector.."<<endl; |
154 |
– |
exit(1); |
155 |
– |
} |
156 |
– |
|
157 |
– |
} |
158 |
– |
|
159 |
– |
|
160 |
– |
float calculateS4(int nn, float en[],int ieta[], int iphi[]){ |
161 |
– |
///shower-shape |
162 |
– |
Float_t S4_0 =0.; Float_t S4_1 =0.; |
163 |
– |
Float_t S4_2 =0.; Float_t S4_3 =0.; |
164 |
– |
|
165 |
– |
|
166 |
– |
for(int n=0; n< nn; n++){ |
167 |
– |
float energy = en[n]; |
168 |
– |
int deta = diff_neta_s(ieta[0],ieta[n]); |
169 |
– |
int dphi = diff_nphi_s(iphi[0],iphi[n]); |
170 |
– |
if( abs(deta) <=1 && abs(dphi) <= 1){ |
171 |
– |
if( dphi <= 0 && deta <= 0) S4_0+=energy; |
172 |
– |
if( dphi >= 0 && deta <= 0) S4_1+=energy; |
173 |
– |
if( dphi <= 0 && deta >= 0) S4_2+=energy; |
174 |
– |
if( dphi >= 0 && deta >= 0) S4_3+=energy; |
175 |
– |
} |
176 |
– |
} |
177 |
– |
Float_t S4max=S4_0; |
178 |
– |
if(S4_1 > S4max) S4max=S4_1; |
179 |
– |
if(S4_2 > S4max) S4max=S4_2; |
180 |
– |
if(S4_3 > S4max) S4max=S4_3; |
181 |
– |
|
182 |
– |
return S4max; |
183 |
– |
|
184 |
– |
} |
185 |
– |
|
186 |
– |
void calculateS4_v1(int nn, float en[],int ieta[], int iphi[],float res[]){ |
187 |
– |
///shower-shape |
188 |
– |
Float_t S4_0 =0.; Float_t S4_1 =0.; |
189 |
– |
Float_t S4_2 =0.; Float_t S4_3 =0.; |
190 |
– |
|
191 |
– |
float S9 = 0; |
192 |
– |
|
193 |
– |
for(int n=0; n< nn; n++){ |
194 |
– |
float energy = en[n]; |
195 |
– |
int deta = diff_neta_s(ieta[0],ieta[n]); |
196 |
– |
int dphi = diff_nphi_s(iphi[0],iphi[n]); |
197 |
– |
if( abs(deta) <=1 && abs(dphi) <= 1){ |
198 |
– |
|
199 |
– |
S9 += energy; |
200 |
– |
|
201 |
– |
if( dphi <= 0 && deta <= 0) S4_0+=energy; |
202 |
– |
if( dphi >= 0 && deta <= 0) S4_1+=energy; |
203 |
– |
if( dphi <= 0 && deta >= 0) S4_2+=energy; |
204 |
– |
if( dphi >= 0 && deta >= 0) S4_3+=energy; |
205 |
– |
} |
206 |
– |
} |
207 |
– |
Float_t S4max=S4_0; |
208 |
– |
if(S4_1 > S4max) S4max=S4_1; |
209 |
– |
if(S4_2 > S4max) S4max=S4_2; |
210 |
– |
if(S4_3 > S4max) S4max=S4_3; |
211 |
– |
|
212 |
– |
//// return S4max; |
213 |
– |
|
214 |
– |
res[0] = S4max; |
215 |
– |
res[1] = S9; |
216 |
– |
|
217 |
– |
|
218 |
– |
} |
219 |
– |
|
220 |
– |
|
221 |
– |
///input ieta iphi originall |
222 |
– |
|
223 |
– |
void calculateS4_v2(int nn, float en[],int ieta[], int iphi[],float res[]){ |
224 |
– |
///shower-shape |
225 |
– |
Float_t S4_0 =0.; Float_t S4_1 =0.; |
226 |
– |
Float_t S4_2 =0.; Float_t S4_3 =0.; |
227 |
– |
|
228 |
– |
float S9 = 0; |
229 |
– |
|
230 |
– |
int ieta_seed = ieta[0]; |
231 |
– |
int iphi_seed = iphi[0]; |
232 |
– |
|
233 |
– |
convxtalid(iphi_seed,ieta_seed); |
234 |
– |
|
235 |
– |
|
236 |
– |
|
237 |
– |
for(int n=0; n< nn; n++){ |
238 |
– |
float energy = en[n]; |
239 |
– |
|
240 |
– |
int eta = ieta[n]; |
241 |
– |
int phi = iphi[n]; |
242 |
– |
convxtalid(phi,eta); |
243 |
– |
|
244 |
– |
int deta = diff_neta_s(ieta_seed,eta); |
245 |
– |
int dphi = diff_nphi_s(iphi_seed,phi); |
246 |
– |
|
247 |
– |
if( abs(deta) <=1 && abs(dphi) <= 1){ |
248 |
– |
|
249 |
– |
S9 += energy; |
250 |
– |
|
251 |
– |
if( dphi <= 0 && deta <= 0) S4_0+=energy; |
252 |
– |
if( dphi >= 0 && deta <= 0) S4_1+=energy; |
253 |
– |
if( dphi <= 0 && deta >= 0) S4_2+=energy; |
254 |
– |
if( dphi >= 0 && deta >= 0) S4_3+=energy; |
255 |
– |
} |
256 |
– |
} |
257 |
– |
Float_t S4max=S4_0; |
258 |
– |
if(S4_1 > S4max) S4max=S4_1; |
259 |
– |
if(S4_2 > S4max) S4max=S4_2; |
260 |
– |
if(S4_3 > S4max) S4max=S4_3; |
261 |
– |
|
262 |
– |
//// return S4max; |
263 |
– |
|
264 |
– |
res[0] = S4max; |
265 |
– |
res[1] = S9; |
266 |
– |
|
267 |
– |
|
268 |
– |
} |