/[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.14 by mocchiut, Thu Sep 10 12:53:57 2009 UTC revision 1.17 by mocchiut, Mon Dec 14 14:49:16 2009 UTC
# Line 283  CaloLat::CaloLat(PamLevel2 *l2p){   Line 283  CaloLat::CaloLat(PamLevel2 *l2p){  
283    //    //
284    suf = "";    suf = "";
285    debug = false;    debug = false;
286      usepl18x = false;
287    //    //
288  };  };
289    
# Line 300  Calo2D::Calo2D(PamLevel2 *l2p){   Line 301  Calo2D::Calo2D(PamLevel2 *l2p){  
301    //    //
302    suf = "";    suf = "";
303    debug = false;    debug = false;
304      usepl18x = false;
305    //    //
306  };  };
307    
# Line 527  void CaloLat::Process(){ Line 529  void CaloLat::Process(){
529    //    //
530    for (Int_t i=0; i<L2->GetCaloLevel1()->istrip ; i++){    for (Int_t i=0; i<L2->GetCaloLevel1()->istrip ; i++){
531      mip1 = L2->GetCaloLevel1()->DecodeEstrip(i,view1,plane1,strip1);      mip1 = L2->GetCaloLevel1()->DecodeEstrip(i,view1,plane1,strip1);
532        //
533        if ( !usepl18x && view1==0 && plane1==18 ) mip1 = 0.;
534        //
535      estrip[view1][plane1][strip1] = mip1;      estrip[view1][plane1][strip1] = mip1;
536    };    };
537    //    //
# Line 574  void Calo2D::Process(){ Line 579  void Calo2D::Process(){
579    //    //
580    for (Int_t i=0; i<L2->GetCaloLevel1()->istrip ; i++){    for (Int_t i=0; i<L2->GetCaloLevel1()->istrip ; i++){
581      mip1 = L2->GetCaloLevel1()->DecodeEstrip(i,view1,plane1,strip1);      mip1 = L2->GetCaloLevel1()->DecodeEstrip(i,view1,plane1,strip1);
582        //
583        if ( !usepl18x && view1==0 && plane1==18 ) mip1 = 0.;
584        //
585      es[view1][plane1][strip1] = mip1;      es[view1][plane1][strip1] = mip1;
586    };    };
587    //    //
# Line 663  CaloLong::CaloLong(PamLevel2 *l2p){   Line 671  CaloLong::CaloLong(PamLevel2 *l2p){  
671    mask18b = -1;    mask18b = -1;
672    //    //
673    no18x = true;    no18x = true;
674      usepl18x = !no18x;
675    debug = false;    debug = false;
676    maskXE = false;    maskXE = false;
677    maskXO = false;    maskXO = false;
# Line 678  CaloLong::CaloLong(PamLevel2 *l2p){   Line 687  CaloLong::CaloLong(PamLevel2 *l2p){  
687    //    //
688    letmax = -1;    letmax = -1;
689    heavytail = false;    heavytail = false;
690    lmipth = 100.;    //  lmipth = 100.;
691      lmipth = 0.;
692    //    //
693  };  };
694    
# Line 704  void CaloLong::UnMaskSection(TString sec Line 714  void CaloLong::UnMaskSection(TString sec
714    
715  void CaloLong::Clear(){  void CaloLong::Clear(){
716    //    //
717      if ( debug ) printf(" Clear called \n");
718      //
719    memset(eplane,0, 2*22*sizeof(Float_t));    memset(eplane,0, 2*22*sizeof(Float_t));
720    //    //
721    chi2 = 0.;    chi2 = 0.;
# Line 846  void CaloLong::Process(){ Line 858  void CaloLong::Process(){
858    Bool_t gof = true;    Bool_t gof = true;
859    for (Int_t i=0; i < L2->GetCaloLevel1()->istrip; i++){    for (Int_t i=0; i < L2->GetCaloLevel1()->istrip; i++){
860      mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip);      mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip);
861        //
862        if ( !usepl18x && view==0 && plane==18 ) mip = 0.;
863        //
864      gof = true;      gof = true;
865      if ( maskXE && (plane%2)==0 && view==1 ) gof = false;      if ( maskXE && (plane%2)==0 && view==1 ) gof = false;
866      if ( maskXO && (plane%2)!=0 && view==1 ) gof = false;      if ( maskXO && (plane%2)!=0 && view==1 ) gof = false;
# Line 856  void CaloLong::Process(){ Line 871  void CaloLong::Process(){
871    //    //
872    // inclination factor (stolen from Daniele's code)    // inclination factor (stolen from Daniele's code)
873    //    //
874    Float_t ytgx = 0;    Float_t ytgx = 0.;
875    Float_t ytgy = 0;    Float_t ytgy = 0.;
876    ytgx = 0.76 * clp->tanx[0];    ytgx = 0.76 * clp->tanx[0];
877    ytgy = 0.76 * clp->tany[0];      ytgy = 0.76 * clp->tany[0];  
878    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 951  void CaloLong::SetEnergies(Float_t myene Line 966  void CaloLong::SetEnergies(Float_t myene
966      };      };
967    };    };
968    //    //
969      if ( !clp && debug ) printf(" ERROR!! no CaloLevel2 obj!!\n");
970      //
971    // inclination factor (stolen from Daniele's code)    // inclination factor (stolen from Daniele's code)
972    //    //
973    Float_t ytgx = 0;    Float_t ytgx = 0.;
974    Float_t ytgy = 0;    Float_t ytgy = 0.;
975    ytgx = 0.76 * clp->tanx[0];    ytgx = 0.76 * clp->tanx[0];
976    ytgy = 0.76 * clp->tany[0];      ytgy = 0.76 * clp->tany[0];  
977    X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) );    X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) );
978      if ( debug ) printf(" X0pl %f tanx %f tany %f \n",X0pl,ytgx,ytgy);
979    //    //
980    // Find experimental plane of maximum    // Find experimental plane of maximum
981    //    //
# Line 978  void CaloLong::SetEnergies(Float_t myene Line 996  void CaloLong::SetEnergies(Float_t myene
996    //    //
997    if ( vmax == 0 ) pmax++;    if ( vmax == 0 ) pmax++;
998    etmax = pmax * X0pl;    etmax = pmax * X0pl;
999    if ( letmax < 0. ) letmax = etmax;    letmax = etmax;
1000    //    //
1001    if ( debug ) this->Print();    if ( debug ) this->Print();
1002    if ( debug ) printf(" exit \n");    if ( debug ) printf(" exit \n");
# Line 1160  void CaloLong::Fit(Bool_t draw){ Line 1178  void CaloLong::Fit(Bool_t draw){
1178          exx[numpo] = 0.1;          exx[numpo] = 0.1;
1179          yyy[numpo] = enemip;          yyy[numpo] = enemip;
1180          eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);          eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);
1181          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;
1182            if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = sqrt(enemip)/5.;
1183            if ( xpos > letmax-1 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 5.;
1184            //if ( xpos > letmax-2 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 7.;
1185            if ( xpos < 3. && heavytail ) eyy[numpo] /= 5.;
1186          numpo++;          numpo++;
1187          //      th->Fill(xpos,enemip);          //      th->Fill(xpos,enemip);
1188          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);
1189        };        };
1190      } else {      } else {
1191        for (Int_t jj=0; jj<2; jj++){        for (Int_t jj=0; jj<2; jj++){
# Line 1193  void CaloLong::Fit(Bool_t draw){ Line 1215  void CaloLong::Fit(Bool_t draw){
1215            exx[numpo] = 0.1;            exx[numpo] = 0.1;
1216            yyy[numpo] = enemip;            yyy[numpo] = enemip;
1217            eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);            eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);
1218          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;
1219              //if ( xpos > letmax && enemip > lmipth && heavytail ) eyy[numpo] = (sqrt(enemip*3.)+sqrt(5.))/numpo;
1220              if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = sqrt(enemip)/5.;
1221              if ( xpos > letmax-1 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 5.;
1222            //if ( xpos > letmax-2 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 7.;
1223              if ( xpos < 3. && heavytail ) eyy[numpo] /= 5.;        
1224            //      eyy[numpo] = sqrt(enemip)/(st*0.95);            //      eyy[numpo] = sqrt(enemip)/(st*0.95);
1225            numpo++;            numpo++;
1226            //      th->Fill(xpos,enemip);            //      th->Fill(xpos,enemip);
# Line 1234  void CaloLong::Fit(Bool_t draw){ Line 1261  void CaloLong::Fit(Bool_t draw){
1261    TF1 *lfit  = dynamic_cast<TF1*>(gDirectory->FindObject(fnam));    TF1 *lfit  = dynamic_cast<TF1*>(gDirectory->FindObject(fnam));
1262    if ( lfit ) lfit->Delete();    if ( lfit ) lfit->Delete();
1263    lfit = new TF1(fnam,ccurve,0.,xmax,3);    lfit = new TF1(fnam,ccurve,0.,xmax,3);
1264    //   if ( !lfit ){
1265    //     lfit = new TF1(fnam,ccurve,0.,xmax,3);
1266    //   };
1267    //   lfit->Clear();
1268    //   lfit->SetName(fnam);
1269    //   lfit->SetRange(0.,xmax);
1270    //  lfit->Print();
1271      //
1272    if ( debug ) printf("qtot %f qtotparz %f \n",clp->qtot,qtotparz);    if ( debug ) printf("qtot %f qtotparz %f \n",clp->qtot,qtotparz);
1273    E0 = qtotparz;    E0 = qtotparz;
1274    //  E0 = clp->qtot;    //  E0 = clp->qtot;
# Line 1257  void CaloLong::Fit(Bool_t draw){ Line 1292  void CaloLong::Fit(Bool_t draw){
1292    if ( debug ) printf(" OK, start the fitting procedure... options: %s \n",optio.Data());    if ( debug ) printf(" OK, start the fitting procedure... options: %s \n",optio.Data());
1293    //    //
1294    //  fitresult = th->Fit("lfit",optio);    //  fitresult = th->Fit("lfit",optio);
1295      //  lfit->Update();
1296    fitresult = gh->Fit("lfit",optio);    fitresult = gh->Fit("lfit",optio);
1297      //  fitresult = gh->Fit("lfit","ROQW");
1298    //    //
1299    if ( debug ) printf(" the fit is done! result: %i \n",fitresult);    if ( debug ) printf(" the fit is done! result: %i \n",fitresult);
1300    //    //
# Line 1301  void CaloLong::Fit(Bool_t draw){ Line 1338  void CaloLong::Fit(Bool_t draw){
1338      delete w;      delete w;
1339      delete xp;      delete xp;
1340      delete wp;      delete wp;
1341        delete xpp;
1342        delete wpp;
1343      //    Float_t i10max = lfit->Integral(0.,10.*tmax);      //    Float_t i10max = lfit->Integral(0.,10.*tmax);
1344      if ( debug ) printf(" Integral: %f \n",i10max);      if ( debug ) printf(" Integral: %f \n",i10max);
1345      //      //
# Line 1351  void CaloLong::Fit(Bool_t draw){ Line 1390  void CaloLong::Fit(Bool_t draw){
1390      if ( th ) th->Delete();      if ( th ) th->Delete();
1391    };    };
1392    //    //
1393    //   gMinuit->SetPrintLevel(1);
1394    //   gMinuit->mnamin();
1395    //   //  gMinuit->mnfree(0);
1396    //   gMinuit->mncler();
1397    //   gMinuit->mnrset(1);
1398      //  gMinuit->Delete();
1399      //ROOT::Math::Minimizer::Clear();
1400      //  gMinuit->mnhelp("*");
1401      //
1402    //  delete lfit;    //  delete lfit;
1403    //    //
1404  };  };

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.23