/[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.3 by mocchiut, Thu Dec 18 21:05:53 2008 UTC revision 1.4 by mocchiut, Wed Jun 10 13:00:23 2009 UTC
# Line 602  void CaloLong::Process(){ Line 602  void CaloLong::Process(){
602      eplane[view][plane] += mip;      eplane[view][plane] += mip;
603    };    };
604    //    //
605    // inclination factor (steal from Daniele's code)    // inclination factor (stolen from Daniele's code)
606    //    //
607    Float_t ytgx = 0;    Float_t ytgx = 0;
608    Float_t ytgy = 0;    Float_t ytgy = 0;
# Line 706  void CaloLong::Fit(Bool_t draw){ Line 706  void CaloLong::Fit(Bool_t draw){
706    //  th = new TH1F(thid,thid,int(NC*1.5),-0.2,xmax);    //  th = new TH1F(thid,thid,int(NC*1.5),-0.2,xmax);
707    th = new TH1F(thid,thid,100,-0.2,xmax);    th = new TH1F(thid,thid,100,-0.2,xmax);
708    //    //
709    for (Int_t st=N;st<(N+NC);st++){    // AGH, BUG!
710      //
711      Int_t mmin = 0;
712      Int_t mmax = 0;
713      if ( cont ){
714        mmin = N;
715        mmax = NC+N;
716      } else {
717        mmin = 0;
718        mmax = NC;
719      };
720      //
721      Float_t qtotparz = 0.;
722      for (Int_t st=mmin;st<mmax+1;st++){
723      enemip = 0.;      enemip = 0.;
724      xpos = (st - N) * X0pl;      xpos = (st - mmin) * X0pl;
725      if ( st > N && st < (N+NC-1) ){            if ( st > mmin && st < mmax ){      
726        if ( no18x && ( st == 18+1 || st == mask18b+1 )){        if ( no18x && ( st == 18+1 || st == mask18b+1 )){
727          enemip = 2. * eplane[1][st];          enemip = 2. * eplane[1][st];
728        } else {        } else {
729          enemip = eplane[0][st-1] + eplane[1][st];          enemip = eplane[0][st-1] + eplane[1][st];
730        };        };
731      } else {      } else {
732        if ( st == N ) enemip = 2. * eplane[1][st];        if ( st == mmin ) enemip = 2. * eplane[1][st];
733        if ( st == (N+NC-1) ) enemip = 2. * eplane[0][st];        if ( st == mmax ) enemip = 2. * eplane[0][st-1];
734      };      };
735      //      //
736        qtotparz += enemip;
737      if ( enemip > 0. ){      if ( enemip > 0. ){
738        th->Fill(xpos,enemip);        th->Fill(xpos,enemip);
739        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);
# Line 750  void CaloLong::Fit(Bool_t draw){ Line 764  void CaloLong::Fit(Bool_t draw){
764    };    };
765    //    //
766    TF1 *lfit = new TF1("lfit",ccurve,0.,xmax,3);    TF1 *lfit = new TF1("lfit",ccurve,0.,xmax,3);
767    E0 = L2->GetCaloLevel2()->qtot;    if ( debug ) printf("qtot %f qtotparz %f \n",L2->GetCaloLevel2()->qtot,qtotparz);
768      E0 = qtotparz;
769      //  E0 = L2->GetCaloLevel2()->qtot;
770    a = 5.;    a = 5.;
771    b = 0.5;    b = 0.5;
772    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);
# Line 819  void CaloLong::Fit(Bool_t draw){ Line 835  void CaloLong::Fit(Bool_t draw){
835        if ( debug ) printf(" i10max == imax, asymm undefined\n");        if ( debug ) printf(" i10max == imax, asymm undefined\n");
836        asymm = -2.;        asymm = -2.;
837      };      };
838        if ( asymm != asymm ){
839          if ( debug ) printf(" asymm is nan \n");      
840          asymm = -3.;
841        };
842      //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));
843      if ( debug ) printf(" Asymmetry has been calculated \n");      if ( debug ) printf(" Asymmetry has been calculated \n");
844    };    };
845    //    //
846      if ( asymm < 0. || ndf <= 0. || chi2 < 0. || tmax < 0. ){
847        if ( debug ) printf(" Funny asymm||ndf||chi2||tmax values, fit failed \n");
848        fitresult = 100;
849      };
850      //
851    if ( draw ){    if ( draw ){
852      //      //
853      tc->cd();          tc->cd();    
# Line 842  void CaloLong::Fit(Bool_t draw){ Line 867  void CaloLong::Fit(Bool_t draw){
867      gStyle->SetLabelSize(0);      gStyle->SetLabelSize(0);
868      gStyle->SetNdivisions(1,"XY");      gStyle->SetNdivisions(1,"XY");
869      //      //
870      } else {
871        if ( th ) th->Delete();
872    };    };
873    //    //
874    delete lfit;    delete lfit;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.23