41 std::vector<float> *layers = getLayersBins();
42 std::vector<float> etabins = model.getEtaBins();
43 std::vector<float> phibins = model.getAngleBins();
44 std::vector<float> clustersizeEta = model.getClusterSizeYBins();
45 std::vector<float> clustersizePhi = model.getClusterSizeXBins();
47 unsigned int Neta = etabins.size()-1;
48 unsigned int Nphi = phibins.size()-1;
49 unsigned int NCSeta = clustersizeEta.size()-1;
50 unsigned int NCSphi = clustersizePhi.size()-1;
52 unsigned int ntotbins = Nphi + NCSphi + Neta + NCSeta + 4;
54 std::vector<float>
bins;
55 bins.reserve(ntotbins);
56 for (
unsigned int i=0; i<clustersizePhi.size(); i++) {
57 bins.push_back(clustersizePhi[i]);
59 for (
unsigned int i=0; i<clustersizeEta.size(); i++) {
60 bins.push_back(clustersizeEta[i]);
62 for (
unsigned int i=0; i<etabins.size(); i++) {
63 bins.push_back(etabins[i]);
65 for (
unsigned int i=0; i<phibins.size(); i++) {
66 bins.push_back(phibins[i]);
74 TProfile *Profmodel =
new TProfile((
"etaResVsOmega"+ tag).c_str(),
75 "#eta residual vs charge sharing", 30, 0., 1.);
77 TH2F *THmodel =
new TH2F((
"etaResVsOmegaH"+ tag).c_str(),
78 "#eta residual vs charge sharing",
79 50, 0., 1.,50,-1000,1000);
81 std::vector<std::string> binsnames(3);
82 std::vector<std::vector <float> > binsvectors(3);
94 m_OmegaEtah_model =
new TH1F((
"m_OmegaEtah"+ tag).c_str(),
"#Omega_{y} distribution",125,0,1);
98 Profmodel->SetName((
"phiResVsOmega"+ tag).c_str());
99 Profmodel->SetTitle(
"#phi residual vs charge sharing");
101 TH2F *THmodel1 =
new TH2F((
"phiResVsOmegaH"+ tag).c_str(),
102 "#phi residual vs charge balancing",
103 50, 0., 1.,50,-200,200);
113 m_OmegaPhih_model =
new TH1F((
"m_OmegaPhih"+ tag).c_str(),
"#Omega_{x} distribution",125,0,1);
151 double TrkEta,
double DeltaCol,
double reseta,
double OmegaEta,
152 double alpha,
double DeltaRow,
double resphi,
double OmegaPhi){
155 std::vector<double> Pars(3);
156 if(GeVTrkPt == 0)
return -1;
167 if(OmegaEta > 0.1 && OmegaEta < 0.9){
169 m_etaH->Fill(OmegaEta,reseta,Pars);
182 if(OmegaPhi > 0.1 && OmegaPhi < 0.9){
184 m_phiH->Fill(OmegaPhi,resphi,Pars);
200 TDirectory *histodir = (TDirectory *)gDirectory->Get(
m_etaProfile->GetName());
202 histodir = (TDirectory *)gDirectory->Get(
m_etaH->GetName());
203 readhistos +=
m_etaH->FillFromFile(histodir);
204 histodir = (TDirectory *)gDirectory->Get(
m_phiProfile->GetName());
206 histodir = (TDirectory *)gDirectory->Get(
m_phiH->GetName());
207 readhistos +=
m_phiH->FillFromFile(histodir);
233 std::ofstream &logfile){
235 logfile <<
"Fitting!" << std::endl;
238 TCanvas *c1 =
new TCanvas();
239 c1->UseCurrentStyle();
245 for(
unsigned int i = 0; i <
m_etaProfile->GetNhistos(); i++){
247 swap->UseCurrentStyle();
248 double value = 0,
error = 0;
250 logfile <<
swap->GetTitle() <<
" --> "
251 << value <<
" +/- " <<
error << std::endl;
252 }
else logfile <<
swap->GetTitle()
253 <<
" --> Failing fit!" << std::endl;
254 std::vector<int> indexes =
m_etaProfile->GetDivisionsIndexes(i);
263 if(
swap->GetEntries() < 100)
continue;
264 std::string name = std::string(
swap->GetName()) + std::string(
".pdf");
266 TH2F *swap1 =
m_etaH->GetHisto(i);
267 swap1->UseCurrentStyle();
268 swap1->SetMarkerSize(0.2);
269 swap1->GetXaxis()->SetTitle(
"Charge sharing");
270 swap1->GetYaxis()->SetTitle(
"Cluster center residuals (#mum)");
271 swap1->GetYaxis()->SetTitleOffset(1.2);
272 swap1->GetXaxis()->SetTitleOffset(1.25);
275 std::string name1 = std::string(swap1->GetName()) + std::string(
".pdf");
282 for(
unsigned int i = 0; i <
m_phiProfile->GetNhistos(); i++){
284 swap->UseCurrentStyle();
285 double value = 0,
error = 0;
287 logfile <<
swap->GetTitle() <<
" --> "
288 << value <<
" +/- " <<
error << std::endl;
289 }
else logfile <<
swap->GetTitle()
290 <<
" --> Failing fit!" << std::endl;
291 std::vector<int> indexes =
m_phiProfile->GetDivisionsIndexes(i);
300 if(
swap->GetEntries() < 100)
continue;
301 std::string name = std::string(
swap->GetName()) + std::string(
".pdf");
303 TH2 *swap1 =
m_phiH->GetHisto(i);
304 swap1->UseCurrentStyle();
305 swap1->SetMarkerSize(0.2);
306 swap1->GetXaxis()->SetTitle(
"Charge sharing");
307 swap1->GetYaxis()->SetTitle(
"Residuals from center of the cluster (#mum)");
308 swap1->GetYaxis()->SetTitleOffset(1.2);
309 swap1->GetXaxis()->SetTitleOffset(1.25);
312 std::string name1 = std::string(swap1->GetName()) + std::string(
".pdf");
330 if(
swap->GetEntries() > 100){
331 TF1 *fitfunc =
new TF1(
"fitfunc",
"[1] * x + [0]",0.15,0.85);
332 fitfunc->SetParameter(0,0);
333 fitfunc->SetParameter(1,0);
335 if(
swap->Fit(
"fitfunc",
"QR") == 0 && fitfunc->GetProb() > 0.005){
336 *value = - fitfunc->GetParameter(1);
337 *
error = fitfunc->GetParError(1);
338 if(fabs(*value) < 2*(*
error) || *value < 0){
342 swap->GetXaxis()->SetTitle(
"Charge sharing");
343 swap->GetYaxis()->SetTitle(
"Residuals from the center of the cluster (#mum)");
344 swap->GetYaxis()->SetTitleOffset(1.2);
345 swap->GetXaxis()->SetTitleOffset(1.25);
348 std::ostringstream FitString;
349 FitString.flags(std::ios::fixed);
350 FitString.precision(2);
351 FitString <<
"slope: " << *value <<
" #pm " << *
error <<
" #mum";
361 std::cout <<
swap->GetTitle() <<
" " <<
swap->Fit(
"fitfunc",
"QR") <<
" " << fitfunc->GetProb() << std::endl;
void swap(DataVector< T > &a, DataVector< T > &b)
See DataVector<T, BASE>::swap().
int Fill(int DetType, double GeVTrkPt, double TrkEta, double DeltaCol, double reseta, double OmegaEta, double alpha, double DeltaRow, double resphi, double OmegaPhi)