--- calo/flight/CaloProfile/src/CaloProfile.cpp 2009/08/19 07:25:34 1.13 +++ calo/flight/CaloProfile/src/CaloProfile.cpp 2010/05/13 13:55:37 1.18 @@ -283,6 +283,7 @@ // suf = ""; debug = false; + usepl18x = false; // }; @@ -300,6 +301,7 @@ // suf = ""; debug = false; + usepl18x = false; // }; @@ -527,6 +529,9 @@ // for (Int_t i=0; iGetCaloLevel1()->istrip ; i++){ mip1 = L2->GetCaloLevel1()->DecodeEstrip(i,view1,plane1,strip1); + // + if ( !usepl18x && view1==0 && plane1==18 ) mip1 = 0.; + // estrip[view1][plane1][strip1] = mip1; }; // @@ -574,6 +579,9 @@ // for (Int_t i=0; iGetCaloLevel1()->istrip ; i++){ mip1 = L2->GetCaloLevel1()->DecodeEstrip(i,view1,plane1,strip1); + // + if ( !usepl18x && view1==0 && plane1==18 ) mip1 = 0.; + // es[view1][plane1][strip1] = mip1; }; // @@ -663,6 +671,7 @@ mask18b = -1; // no18x = true; + usepl18x = !no18x; debug = false; maskXE = false; maskXO = false; @@ -676,8 +685,20 @@ suf = ""; xyaverage = true; // + letmax = -1; + heavytail = false; + // lmipth = 100.; + lmipth = 0.; + // }; +TF1 *CaloLong::GetFit(){ + TString fnam=Form("lfit%s",suf.Data()); + TF1 *lfit = dynamic_cast(gDirectory->FindObject(fnam)); + if ( lfit ) return lfit; + return NULL; +} + void CaloLong::MaskSection(TString sec){ sec.ToUpper(); if ( sec.Contains("XO") ) maskXO = true; @@ -700,6 +721,8 @@ void CaloLong::Clear(){ // + if ( debug ) printf(" Clear called \n"); + // memset(eplane,0, 2*22*sizeof(Float_t)); // chi2 = 0.; @@ -842,6 +865,9 @@ Bool_t gof = true; for (Int_t i=0; i < L2->GetCaloLevel1()->istrip; i++){ mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); + // + if ( !usepl18x && view==0 && plane==18 ) mip = 0.; + // gof = true; if ( maskXE && (plane%2)==0 && view==1 ) gof = false; if ( maskXO && (plane%2)!=0 && view==1 ) gof = false; @@ -852,8 +878,8 @@ // // inclination factor (stolen from Daniele's code) // - Float_t ytgx = 0; - Float_t ytgy = 0; + Float_t ytgx = 0.; + Float_t ytgy = 0.; ytgx = 0.76 * clp->tanx[0]; ytgy = 0.76 * clp->tany[0]; X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) ); @@ -947,13 +973,16 @@ }; }; // + if ( !clp && debug ) printf(" ERROR!! no CaloLevel2 obj!!\n"); + // // inclination factor (stolen from Daniele's code) // - Float_t ytgx = 0; - Float_t ytgy = 0; + Float_t ytgx = 0.; + Float_t ytgy = 0.; ytgx = 0.76 * clp->tanx[0]; ytgy = 0.76 * clp->tany[0]; X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) ); + if ( debug ) printf(" X0pl %f tanx %f tany %f \n",X0pl,ytgx,ytgy); // // Find experimental plane of maximum // @@ -974,6 +1003,7 @@ // if ( vmax == 0 ) pmax++; etmax = pmax * X0pl; + letmax = etmax; // if ( debug ) this->Print(); if ( debug ) printf(" exit \n"); @@ -1155,9 +1185,14 @@ exx[numpo] = 0.1; yyy[numpo] = enemip; eyy[numpo] = sqrt(enemip*3.)+sqrt(5.); + //if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = (sqrt(enemip*3.)+sqrt(5.))/numpo; + if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = sqrt(enemip)/5.; + if ( xpos > letmax-1 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 5.; + //if ( xpos > letmax-2 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 7.; + if ( xpos < 3. && heavytail ) eyy[numpo] /= 5.; numpo++; // th->Fill(xpos,enemip); - if ( debug ) printf(" AVE Filling: st %i xpos %f energy %f \n",st,xpos,enemip); + if ( debug ) printf(" AVE Filling: st %i xpos %f energy %f error %f letmax %f lmpith %f \n",st,xpos,enemip,eyy[numpo-1],letmax,lmipth); }; } else { for (Int_t jj=0; jj<2; jj++){ @@ -1187,6 +1222,12 @@ exx[numpo] = 0.1; yyy[numpo] = enemip; eyy[numpo] = sqrt(enemip*3.)+sqrt(5.); + //if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = (sqrt(enemip*3.)+sqrt(5.))/numpo; + //if ( xpos > letmax && enemip > lmipth && heavytail ) eyy[numpo] = (sqrt(enemip*3.)+sqrt(5.))/numpo; + if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = sqrt(enemip)/5.; + if ( xpos > letmax-1 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 5.; + //if ( xpos > letmax-2 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 7.; + if ( xpos < 3. && heavytail ) eyy[numpo] /= 5.; // eyy[numpo] = sqrt(enemip)/(st*0.95); numpo++; // th->Fill(xpos,enemip); @@ -1227,6 +1268,14 @@ TF1 *lfit = dynamic_cast(gDirectory->FindObject(fnam)); if ( lfit ) lfit->Delete(); lfit = new TF1(fnam,ccurve,0.,xmax,3); +// if ( !lfit ){ +// lfit = new TF1(fnam,ccurve,0.,xmax,3); +// }; +// lfit->Clear(); +// lfit->SetName(fnam); +// lfit->SetRange(0.,xmax); +// lfit->Print(); + // if ( debug ) printf("qtot %f qtotparz %f \n",clp->qtot,qtotparz); E0 = qtotparz; // E0 = clp->qtot; @@ -1237,7 +1286,7 @@ // lfit->SetParLimits(0,0.,1000.); // lfit->SetParLimits(1,-1.,80.); // lfit->SetParLimits(2,-1.,10.); - // TString optio = "ROW"; // "RO" + // TString optio = "ROW"; // "RO" TString optio = "RO"; // "RO" if ( debug ){ optio += "NV"; @@ -1247,10 +1296,12 @@ if ( draw ) optio += "Q"; }; // - if ( debug ) printf(" OK, start the fitting procedure...\n"); + if ( debug ) printf(" OK, start the fitting procedure... options: %s \n",optio.Data()); // // fitresult = th->Fit("lfit",optio); + // lfit->Update(); fitresult = gh->Fit("lfit",optio); + // fitresult = gh->Fit("lfit","ROQW"); // if ( debug ) printf(" the fit is done! result: %i \n",fitresult); // @@ -1294,6 +1345,8 @@ delete w; delete xp; delete wp; + delete xpp; + delete wpp; // Float_t i10max = lfit->Integral(0.,10.*tmax); if ( debug ) printf(" Integral: %f \n",i10max); // @@ -1344,6 +1397,15 @@ if ( th ) th->Delete(); }; // +// gMinuit->SetPrintLevel(1); +// gMinuit->mnamin(); +// // gMinuit->mnfree(0); +// gMinuit->mncler(); +// gMinuit->mnrset(1); + // gMinuit->Delete(); + //ROOT::Math::Minimizer::Clear(); + // gMinuit->mnhelp("*"); + // // delete lfit; // };