/[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.16 by mocchiut, Fri Nov 27 10:30:29 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      lmipth = 0.;
683      //
684  };  };
685    
686  void CaloLong::MaskSection(TString sec){  void CaloLong::MaskSection(TString sec){
# Line 700  void CaloLong::UnMaskSection(TString sec Line 705  void CaloLong::UnMaskSection(TString sec
705    
706  void CaloLong::Clear(){  void CaloLong::Clear(){
707    //    //
708      if ( debug ) printf(" Clear called \n");
709      //
710    memset(eplane,0, 2*22*sizeof(Float_t));    memset(eplane,0, 2*22*sizeof(Float_t));
711    //    //
712    chi2 = 0.;    chi2 = 0.;
# Line 852  void CaloLong::Process(){ Line 859  void CaloLong::Process(){
859    //    //
860    // inclination factor (stolen from Daniele's code)    // inclination factor (stolen from Daniele's code)
861    //    //
862    Float_t ytgx = 0;    Float_t ytgx = 0.;
863    Float_t ytgy = 0;    Float_t ytgy = 0.;
864    ytgx = 0.76 * clp->tanx[0];    ytgx = 0.76 * clp->tanx[0];
865    ytgy = 0.76 * clp->tany[0];      ytgy = 0.76 * clp->tany[0];  
866    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 954  void CaloLong::SetEnergies(Float_t myene
954      };      };
955    };    };
956    //    //
957      if ( !clp && debug ) printf(" ERROR!! no CaloLevel2 obj!!\n");
958      //
959    // inclination factor (stolen from Daniele's code)    // inclination factor (stolen from Daniele's code)
960    //    //
961    Float_t ytgx = 0;    Float_t ytgx = 0.;
962    Float_t ytgy = 0;    Float_t ytgy = 0.;
963    ytgx = 0.76 * clp->tanx[0];    ytgx = 0.76 * clp->tanx[0];
964    ytgy = 0.76 * clp->tany[0];      ytgy = 0.76 * clp->tany[0];  
965    X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) );    X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) );
966      if ( debug ) printf(" X0pl %f tanx %f tany %f \n",X0pl,ytgx,ytgy);
967    //    //
968    // Find experimental plane of maximum    // Find experimental plane of maximum
969    //    //
# Line 974  void CaloLong::SetEnergies(Float_t myene Line 984  void CaloLong::SetEnergies(Float_t myene
984    //    //
985    if ( vmax == 0 ) pmax++;    if ( vmax == 0 ) pmax++;
986    etmax = pmax * X0pl;    etmax = pmax * X0pl;
987      letmax = etmax;
988    //    //
989    if ( debug ) this->Print();    if ( debug ) this->Print();
990    if ( debug ) printf(" exit \n");    if ( debug ) printf(" exit \n");
# Line 1155  void CaloLong::Fit(Bool_t draw){ Line 1166  void CaloLong::Fit(Bool_t draw){
1166          exx[numpo] = 0.1;          exx[numpo] = 0.1;
1167          yyy[numpo] = enemip;          yyy[numpo] = enemip;
1168          eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);          eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);
1169            //      if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = (sqrt(enemip*3.)+sqrt(5.))/numpo;
1170            if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = sqrt(enemip)/5.;
1171            if ( xpos > letmax-1 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 5.;
1172            //if ( xpos > letmax-2 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 7.;
1173            if ( xpos < 3. && heavytail ) eyy[numpo] /= 5.;
1174          numpo++;          numpo++;
1175          //      th->Fill(xpos,enemip);          //      th->Fill(xpos,enemip);
1176          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);
1177        };        };
1178      } else {      } else {
1179        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 1203  void CaloLong::Fit(Bool_t draw){
1203            exx[numpo] = 0.1;            exx[numpo] = 0.1;
1204            yyy[numpo] = enemip;            yyy[numpo] = enemip;
1205            eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);            eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);
1206            if ( xpos > letmax && enemip > lmipth && heavytail ) eyy[numpo] = (sqrt(enemip*3.)+sqrt(5.))/numpo;
1207            //      eyy[numpo] = sqrt(enemip)/(st*0.95);            //      eyy[numpo] = sqrt(enemip)/(st*0.95);
1208            numpo++;            numpo++;
1209            //      th->Fill(xpos,enemip);            //      th->Fill(xpos,enemip);
# Line 1227  void CaloLong::Fit(Bool_t draw){ Line 1244  void CaloLong::Fit(Bool_t draw){
1244    TF1 *lfit  = dynamic_cast<TF1*>(gDirectory->FindObject(fnam));    TF1 *lfit  = dynamic_cast<TF1*>(gDirectory->FindObject(fnam));
1245    if ( lfit ) lfit->Delete();    if ( lfit ) lfit->Delete();
1246    lfit = new TF1(fnam,ccurve,0.,xmax,3);    lfit = new TF1(fnam,ccurve,0.,xmax,3);
1247    //   if ( !lfit ){
1248    //     lfit = new TF1(fnam,ccurve,0.,xmax,3);
1249    //   };
1250    //   lfit->Clear();
1251    //   lfit->SetName(fnam);
1252    //   lfit->SetRange(0.,xmax);
1253    //  lfit->Print();
1254      //
1255    if ( debug ) printf("qtot %f qtotparz %f \n",clp->qtot,qtotparz);    if ( debug ) printf("qtot %f qtotparz %f \n",clp->qtot,qtotparz);
1256    E0 = qtotparz;    E0 = qtotparz;
1257    //  E0 = clp->qtot;    //  E0 = clp->qtot;
# Line 1237  void CaloLong::Fit(Bool_t draw){ Line 1262  void CaloLong::Fit(Bool_t draw){
1262    //  lfit->SetParLimits(0,0.,1000.);    //  lfit->SetParLimits(0,0.,1000.);
1263    //  lfit->SetParLimits(1,-1.,80.);    //  lfit->SetParLimits(1,-1.,80.);
1264    //  lfit->SetParLimits(2,-1.,10.);    //  lfit->SetParLimits(2,-1.,10.);
1265    //  TString optio = "ROW"; // "RO"    // TString optio = "ROW"; // "RO"
1266    TString optio = "RO"; // "RO"    TString optio = "RO"; // "RO"
1267    if ( debug ){    if ( debug ){
1268      optio += "NV";      optio += "NV";
# Line 1247  void CaloLong::Fit(Bool_t draw){ Line 1272  void CaloLong::Fit(Bool_t draw){
1272      if ( draw ) optio += "Q";      if ( draw ) optio += "Q";
1273    };    };
1274    //    //
1275    if ( debug ) printf(" OK, start the fitting procedure...\n");    if ( debug ) printf(" OK, start the fitting procedure... options: %s \n",optio.Data());
1276    //    //
1277    //  fitresult = th->Fit("lfit",optio);    //  fitresult = th->Fit("lfit",optio);
1278      //  lfit->Update();
1279    fitresult = gh->Fit("lfit",optio);    fitresult = gh->Fit("lfit",optio);
1280      //  fitresult = gh->Fit("lfit","ROQW");
1281    //    //
1282    if ( debug ) printf(" the fit is done! result: %i \n",fitresult);    if ( debug ) printf(" the fit is done! result: %i \n",fitresult);
1283    //    //
# Line 1294  void CaloLong::Fit(Bool_t draw){ Line 1321  void CaloLong::Fit(Bool_t draw){
1321      delete w;      delete w;
1322      delete xp;      delete xp;
1323      delete wp;      delete wp;
1324        delete xpp;
1325        delete wpp;
1326      //    Float_t i10max = lfit->Integral(0.,10.*tmax);      //    Float_t i10max = lfit->Integral(0.,10.*tmax);
1327      if ( debug ) printf(" Integral: %f \n",i10max);      if ( debug ) printf(" Integral: %f \n",i10max);
1328      //      //
# Line 1344  void CaloLong::Fit(Bool_t draw){ Line 1373  void CaloLong::Fit(Bool_t draw){
1373      if ( th ) th->Delete();      if ( th ) th->Delete();
1374    };    };
1375    //    //
1376    //   gMinuit->SetPrintLevel(1);
1377    //   gMinuit->mnamin();
1378    //   //  gMinuit->mnfree(0);
1379    //   gMinuit->mncler();
1380    //   gMinuit->mnrset(1);
1381      //  gMinuit->Delete();
1382      //ROOT::Math::Minimizer::Clear();
1383      //  gMinuit->mnhelp("*");
1384      //
1385    //  delete lfit;    //  delete lfit;
1386    //    //
1387  };  };

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

  ViewVC Help
Powered by ViewVC 1.1.23