| 459 |
// |
// |
| 460 |
no18x = true; |
no18x = true; |
| 461 |
debug = false; |
debug = false; |
| 462 |
|
maskXE = false; |
| 463 |
|
maskXO = false; |
| 464 |
|
maskYE = false; |
| 465 |
|
maskYO = false; |
| 466 |
// |
// |
| 467 |
}; |
}; |
| 468 |
|
|
| 469 |
|
void CaloLong::MaskSection(TString sec){ |
| 470 |
|
sec.ToUpper(); |
| 471 |
|
if ( sec.Contains("XO") ) maskXO = true; |
| 472 |
|
if ( sec.Contains("YO") ) maskYO = true; |
| 473 |
|
if ( sec.Contains("XE") ) maskXE = true; |
| 474 |
|
if ( sec.Contains("YE") ) maskYE = true; |
| 475 |
|
} |
| 476 |
|
|
| 477 |
void CaloLong::Clear(){ |
void CaloLong::Clear(){ |
| 478 |
// |
// |
| 479 |
memset(eplane,0, 2*22*sizeof(Float_t)); |
memset(eplane,0, 2*22*sizeof(Float_t)); |
| 544 |
}; |
}; |
| 545 |
} |
} |
| 546 |
|
|
| 547 |
|
void CaloLong::SplitInto(Int_t NoWpreSampler, Int_t NoWcalo){ |
| 548 |
|
this->SetNoWpreSampler(0); |
| 549 |
|
this->SetNoWcalo(0); |
| 550 |
|
if ( NoWpreSampler < NoWcalo ){ |
| 551 |
|
this->SetNoWpreSampler(NoWpreSampler); |
| 552 |
|
this->SetNoWcalo(NoWcalo); |
| 553 |
|
} else { |
| 554 |
|
this->SetNoWcalo(NoWcalo); |
| 555 |
|
this->SetNoWpreSampler(NoWpreSampler); |
| 556 |
|
}; |
| 557 |
|
} |
| 558 |
|
|
| 559 |
void CaloLong::Process(){ |
void CaloLong::Process(){ |
| 560 |
// |
// |
| 561 |
if ( !L2 ){ |
if ( !L2 ){ |
| 609 |
Int_t plane = 0; |
Int_t plane = 0; |
| 610 |
Int_t strip = 0; |
Int_t strip = 0; |
| 611 |
Float_t mip = 0.; |
Float_t mip = 0.; |
| 612 |
|
Bool_t gof = true; |
| 613 |
for (Int_t i=0; i < L2->GetCaloLevel1()->istrip; i++){ |
for (Int_t i=0; i < L2->GetCaloLevel1()->istrip; i++){ |
| 614 |
mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); |
mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); |
| 615 |
eplane[view][plane] += mip; |
gof = true; |
| 616 |
|
if ( maskXE && (plane%2)==0 && view==1 ) gof = false; |
| 617 |
|
if ( maskXO && (plane%2)!=0 && view==1 ) gof = false; |
| 618 |
|
if ( maskYE && (plane%2)!=0 && view==0 ) gof = false; |
| 619 |
|
if ( maskYO && (plane%2)==0 && view==0 ) gof = false; |
| 620 |
|
if ( gof ) eplane[view][plane] += mip; |
| 621 |
}; |
}; |
| 622 |
// |
// |
| 623 |
// inclination factor (steal from Daniele's code) |
// inclination factor (stolen from Daniele's code) |
| 624 |
// |
// |
| 625 |
Float_t ytgx = 0; |
Float_t ytgx = 0; |
| 626 |
Float_t ytgy = 0; |
Float_t ytgy = 0; |
| 724 |
// th = new TH1F(thid,thid,int(NC*1.5),-0.2,xmax); |
// th = new TH1F(thid,thid,int(NC*1.5),-0.2,xmax); |
| 725 |
th = new TH1F(thid,thid,100,-0.2,xmax); |
th = new TH1F(thid,thid,100,-0.2,xmax); |
| 726 |
// |
// |
| 727 |
for (Int_t st=N;st<(N+NC);st++){ |
// AGH, BUG! |
| 728 |
|
// |
| 729 |
|
Int_t mmin = 0; |
| 730 |
|
Int_t mmax = 0; |
| 731 |
|
if ( cont ){ |
| 732 |
|
mmin = N; |
| 733 |
|
mmax = NC+N; |
| 734 |
|
} else { |
| 735 |
|
mmin = 0; |
| 736 |
|
mmax = NC; |
| 737 |
|
}; |
| 738 |
|
// |
| 739 |
|
Float_t qtotparz = 0.; |
| 740 |
|
for (Int_t st=mmin;st<mmax+1;st++){ |
| 741 |
enemip = 0.; |
enemip = 0.; |
| 742 |
xpos = (st - N) * X0pl; |
xpos = (st - mmin) * X0pl; |
| 743 |
if ( st > N && st < (N+NC-1) ){ |
if ( st > mmin && st < mmax ){ |
| 744 |
if ( no18x && ( st == 18+1 || st == mask18b+1 )){ |
if ( no18x && ( st == 18+1 || st == mask18b+1 )){ |
| 745 |
enemip = 2. * eplane[1][st]; |
enemip = 2. * eplane[1][st]; |
| 746 |
} else { |
} else { |
| 747 |
enemip = eplane[0][st-1] + eplane[1][st]; |
enemip = eplane[0][st-1] + eplane[1][st]; |
| 748 |
}; |
}; |
| 749 |
} else { |
} else { |
| 750 |
if ( st == N ) enemip = 2. * eplane[1][st]; |
if ( st == mmin ) enemip = 2. * eplane[1][st]; |
| 751 |
if ( st == (N+NC-1) ) enemip = 2. * eplane[0][st]; |
if ( st == mmax ) enemip = 2. * eplane[0][st-1]; |
| 752 |
}; |
}; |
| 753 |
// |
// |
| 754 |
|
qtotparz += enemip; |
| 755 |
if ( enemip > 0. ){ |
if ( enemip > 0. ){ |
| 756 |
th->Fill(xpos,enemip); |
th->Fill(xpos,enemip); |
| 757 |
if ( debug ) printf(" Filling: st %i xpos %f energy %f \n",st,xpos,enemip); |
if ( debug ) printf(" Filling: st %i xpos %f energy %f \n",st,xpos,enemip); |
| 782 |
}; |
}; |
| 783 |
// |
// |
| 784 |
TF1 *lfit = new TF1("lfit",ccurve,0.,xmax,3); |
TF1 *lfit = new TF1("lfit",ccurve,0.,xmax,3); |
| 785 |
E0 = L2->GetCaloLevel2()->qtot; |
if ( debug ) printf("qtot %f qtotparz %f \n",L2->GetCaloLevel2()->qtot,qtotparz); |
| 786 |
|
E0 = qtotparz; |
| 787 |
|
// E0 = L2->GetCaloLevel2()->qtot; |
| 788 |
a = 5.; |
a = 5.; |
| 789 |
b = 0.5; |
b = 0.5; |
| 790 |
if ( debug ) printf(" STARTING PARAMETERS: E0 %f a %f b %f \n",E0,a,b); |
if ( debug ) printf(" STARTING PARAMETERS: E0 %f a %f b %f \n",E0,a,b); |
| 853 |
if ( debug ) printf(" i10max == imax, asymm undefined\n"); |
if ( debug ) printf(" i10max == imax, asymm undefined\n"); |
| 854 |
asymm = -2.; |
asymm = -2.; |
| 855 |
}; |
}; |
| 856 |
|
if ( asymm != asymm ){ |
| 857 |
|
if ( debug ) printf(" asymm is nan \n"); |
| 858 |
|
asymm = -3.; |
| 859 |
|
}; |
| 860 |
//lfit->Integral(0.,tmax)/(lfit->Integral(0.,10.*tmax)-lfit->Integral(0.,tmax)); |
//lfit->Integral(0.,tmax)/(lfit->Integral(0.,10.*tmax)-lfit->Integral(0.,tmax)); |
| 861 |
if ( debug ) printf(" Asymmetry has been calculated \n"); |
if ( debug ) printf(" Asymmetry has been calculated \n"); |
| 862 |
}; |
}; |
| 863 |
// |
// |
| 864 |
|
if ( asymm < 0. || ndf <= 0. || chi2 < 0. || tmax < 0. ){ |
| 865 |
|
if ( debug ) printf(" Funny asymm||ndf||chi2||tmax values, fit failed \n"); |
| 866 |
|
fitresult = 100; |
| 867 |
|
}; |
| 868 |
|
// |
| 869 |
if ( draw ){ |
if ( draw ){ |
| 870 |
// |
// |
| 871 |
tc->cd(); |
tc->cd(); |
| 885 |
gStyle->SetLabelSize(0); |
gStyle->SetLabelSize(0); |
| 886 |
gStyle->SetNdivisions(1,"XY"); |
gStyle->SetNdivisions(1,"XY"); |
| 887 |
// |
// |
| 888 |
|
} else { |
| 889 |
|
if ( th ) th->Delete(); |
| 890 |
}; |
}; |
| 891 |
// |
// |
| 892 |
delete lfit; |
delete lfit; |