/[PAMELA software]/calo/flight/CaloProfile/src/CaloProfile.cpp
ViewVC logotype

Diff of /calo/flight/CaloProfile/src/CaloProfile.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by mocchiut, Wed Aug 19 07:25:34 2009 UTC revision 1.15 by mocchiut, Mon Sep 14 13:56:50 2009 UTC
# Line 676  CaloLong::CaloLong(PamLevel2 *l2p){   Line 676  CaloLong::CaloLong(PamLevel2 *l2p){  
676    suf = "";    suf = "";
677    xyaverage = true;    xyaverage = true;
678    //    //
679      letmax = -1;
680      heavytail = false;
681      lmipth = 100.;
682      //
683  };  };
684    
685  void CaloLong::MaskSection(TString sec){  void CaloLong::MaskSection(TString sec){
# Line 700  void CaloLong::UnMaskSection(TString sec Line 704  void CaloLong::UnMaskSection(TString sec
704    
705  void CaloLong::Clear(){  void CaloLong::Clear(){
706    //    //
707      if ( debug ) printf(" Clear called \n");
708      //
709    memset(eplane,0, 2*22*sizeof(Float_t));    memset(eplane,0, 2*22*sizeof(Float_t));
710    //    //
711    chi2 = 0.;    chi2 = 0.;
# Line 852  void CaloLong::Process(){ Line 858  void CaloLong::Process(){
858    //    //
859    // inclination factor (stolen from Daniele's code)    // inclination factor (stolen from Daniele's code)
860    //    //
861    Float_t ytgx = 0;    Float_t ytgx = 0.;
862    Float_t ytgy = 0;    Float_t ytgy = 0.;
863    ytgx = 0.76 * clp->tanx[0];    ytgx = 0.76 * clp->tanx[0];
864    ytgy = 0.76 * clp->tany[0];      ytgy = 0.76 * clp->tany[0];  
865    X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) );    X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) );
# Line 947  void CaloLong::SetEnergies(Float_t myene Line 953  void CaloLong::SetEnergies(Float_t myene
953      };      };
954    };    };
955    //    //
956      if ( !clp && debug ) printf(" ERROR!! no CaloLevel2 obj!!\n");
957      //
958    // inclination factor (stolen from Daniele's code)    // inclination factor (stolen from Daniele's code)
959    //    //
960    Float_t ytgx = 0;    Float_t ytgx = 0.;
961    Float_t ytgy = 0;    Float_t ytgy = 0.;
962    ytgx = 0.76 * clp->tanx[0];    ytgx = 0.76 * clp->tanx[0];
963    ytgy = 0.76 * clp->tany[0];      ytgy = 0.76 * clp->tany[0];  
964    X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) );    X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) );
965      if ( debug ) printf(" X0pl %f tanx %f tany %f \n",X0pl,ytgx,ytgy);
966    //    //
967    // Find experimental plane of maximum    // Find experimental plane of maximum
968    //    //
# Line 974  void CaloLong::SetEnergies(Float_t myene Line 983  void CaloLong::SetEnergies(Float_t myene
983    //    //
984    if ( vmax == 0 ) pmax++;    if ( vmax == 0 ) pmax++;
985    etmax = pmax * X0pl;    etmax = pmax * X0pl;
986      letmax = etmax;
987    //    //
988    if ( debug ) this->Print();    if ( debug ) this->Print();
989    if ( debug ) printf(" exit \n");    if ( debug ) printf(" exit \n");
# Line 1155  void CaloLong::Fit(Bool_t draw){ Line 1165  void CaloLong::Fit(Bool_t draw){
1165          exx[numpo] = 0.1;          exx[numpo] = 0.1;
1166          yyy[numpo] = enemip;          yyy[numpo] = enemip;
1167          eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);          eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);
1168            if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = (sqrt(enemip*3.)+sqrt(5.))/numpo;
1169          numpo++;          numpo++;
1170          //      th->Fill(xpos,enemip);          //      th->Fill(xpos,enemip);
1171          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);
1172        };        };
1173      } else {      } else {
1174        for (Int_t jj=0; jj<2; jj++){        for (Int_t jj=0; jj<2; jj++){
# Line 1187  void CaloLong::Fit(Bool_t draw){ Line 1198  void CaloLong::Fit(Bool_t draw){
1198            exx[numpo] = 0.1;            exx[numpo] = 0.1;
1199            yyy[numpo] = enemip;            yyy[numpo] = enemip;
1200            eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);            eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);
1201            if ( xpos > letmax && enemip > lmipth && heavytail ) eyy[numpo] = (sqrt(enemip*3.)+sqrt(5.))/numpo;
1202            //      eyy[numpo] = sqrt(enemip)/(st*0.95);            //      eyy[numpo] = sqrt(enemip)/(st*0.95);
1203            numpo++;            numpo++;
1204            //      th->Fill(xpos,enemip);            //      th->Fill(xpos,enemip);
# Line 1227  void CaloLong::Fit(Bool_t draw){ Line 1239  void CaloLong::Fit(Bool_t draw){
1239    TF1 *lfit  = dynamic_cast<TF1*>(gDirectory->FindObject(fnam));    TF1 *lfit  = dynamic_cast<TF1*>(gDirectory->FindObject(fnam));
1240    if ( lfit ) lfit->Delete();    if ( lfit ) lfit->Delete();
1241    lfit = new TF1(fnam,ccurve,0.,xmax,3);    lfit = new TF1(fnam,ccurve,0.,xmax,3);
1242    //   if ( !lfit ){
1243    //     lfit = new TF1(fnam,ccurve,0.,xmax,3);
1244    //   };
1245    //   lfit->Clear();
1246    //   lfit->SetName(fnam);
1247    //   lfit->SetRange(0.,xmax);
1248    //  lfit->Print();
1249      //
1250    if ( debug ) printf("qtot %f qtotparz %f \n",clp->qtot,qtotparz);    if ( debug ) printf("qtot %f qtotparz %f \n",clp->qtot,qtotparz);
1251    E0 = qtotparz;    E0 = qtotparz;
1252    //  E0 = clp->qtot;    //  E0 = clp->qtot;
# Line 1237  void CaloLong::Fit(Bool_t draw){ Line 1257  void CaloLong::Fit(Bool_t draw){
1257    //  lfit->SetParLimits(0,0.,1000.);    //  lfit->SetParLimits(0,0.,1000.);
1258    //  lfit->SetParLimits(1,-1.,80.);    //  lfit->SetParLimits(1,-1.,80.);
1259    //  lfit->SetParLimits(2,-1.,10.);    //  lfit->SetParLimits(2,-1.,10.);
1260    //  TString optio = "ROW"; // "RO"    // TString optio = "ROW"; // "RO"
1261    TString optio = "RO"; // "RO"    TString optio = "RO"; // "RO"
1262    if ( debug ){    if ( debug ){
1263      optio += "NV";      optio += "NV";
# Line 1247  void CaloLong::Fit(Bool_t draw){ Line 1267  void CaloLong::Fit(Bool_t draw){
1267      if ( draw ) optio += "Q";      if ( draw ) optio += "Q";
1268    };    };
1269    //    //
1270    if ( debug ) printf(" OK, start the fitting procedure...\n");    if ( debug ) printf(" OK, start the fitting procedure... options: %s \n",optio.Data());
1271    //    //
1272    //  fitresult = th->Fit("lfit",optio);    //  fitresult = th->Fit("lfit",optio);
1273      //  lfit->Update();
1274    fitresult = gh->Fit("lfit",optio);    fitresult = gh->Fit("lfit",optio);
1275      //  fitresult = gh->Fit("lfit","ROQW");
1276    //    //
1277    if ( debug ) printf(" the fit is done! result: %i \n",fitresult);    if ( debug ) printf(" the fit is done! result: %i \n",fitresult);
1278    //    //
# Line 1294  void CaloLong::Fit(Bool_t draw){ Line 1316  void CaloLong::Fit(Bool_t draw){
1316      delete w;      delete w;
1317      delete xp;      delete xp;
1318      delete wp;      delete wp;
1319        delete xpp;
1320        delete wpp;
1321      //    Float_t i10max = lfit->Integral(0.,10.*tmax);      //    Float_t i10max = lfit->Integral(0.,10.*tmax);
1322      if ( debug ) printf(" Integral: %f \n",i10max);      if ( debug ) printf(" Integral: %f \n",i10max);
1323      //      //
# Line 1344  void CaloLong::Fit(Bool_t draw){ Line 1368  void CaloLong::Fit(Bool_t draw){
1368      if ( th ) th->Delete();      if ( th ) th->Delete();
1369    };    };
1370    //    //
1371    //   gMinuit->SetPrintLevel(1);
1372    //   gMinuit->mnamin();
1373    //   //  gMinuit->mnfree(0);
1374    //   gMinuit->mncler();
1375    //   gMinuit->mnrset(1);
1376      //  gMinuit->Delete();
1377      //ROOT::Math::Minimizer::Clear();
1378      //  gMinuit->mnhelp("*");
1379      //
1380    //  delete lfit;    //  delete lfit;
1381    //    //
1382  };  };

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.23