/[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.8 by mocchiut, Tue Aug 11 14:23:09 2009 UTC revision 1.13 by mocchiut, Wed Aug 19 07:25:34 2009 UTC
# Line 4  ClassImp(CaloLat); Line 4  ClassImp(CaloLat);
4  ClassImp(CaloLong);  ClassImp(CaloLong);
5  ClassImp(Calo2D);  ClassImp(Calo2D);
6    
7    
8    int isempty(struct stack *s){
9      return (s->top == EMPTY) ? 1 : 0;
10    }
11    
12    void emptystack(struct stack* s){
13      s->top=EMPTY;
14      strcpy(s->data,"                                                 ");
15    }
16    
17    void push(struct stack* s,int item){
18      if(s->top == (MAX-1)){
19        printf("\n ERROR! STACK FULL (too many digits in SetLower/UpperLimit)\n");
20      } else {
21        s->data[++s->top]=(char)item;
22      };
23    }
24    
25    char pop(struct stack* s){
26      char ret=(char)EMPTY;
27      if(!isempty(s)){
28        ret= s->data[s->top--];
29      };
30      return ret;
31    }
32    
33    
34    int ipop(struct stack* s){
35      int ret=EMPTY;
36      if(s->top == EMPTY)
37        printf("\n ERROR! STACK EMPTY (too few digits in SetLower/UpperLimit)\n");
38      else {
39        ret= s->data[s->top--];
40      };
41      return ret;
42    }
43    
44    
45    void display(struct stack s){
46      int ss = s.top;
47      while(s.top != EMPTY){
48        printf("\n%d",s.data[s.top--]);
49      };
50      printf(" s.top %i \n",ss);
51    }
52    
53    int isoperator(char e){
54      if(e == '+' || e == '-' || e == '*' || e == '/' || e == '%')
55        return 1;
56      else
57        return 0;
58    }
59    
60    
61    int priority(char e){
62      int pri = 0;
63      if(e == '*' || e == '/' || e =='%')
64        pri = 2;
65      else {
66        if(e == '+' || e == '-') pri = 1;
67      };
68      return pri;
69    }
70    
71    void infix2postfix(char* infix, char * postfix, int insertspace){
72      char *i,*p;
73      struct stack X;
74      char n1;
75      emptystack(&X);
76      i = &infix[0];
77      p = &postfix[0];  
78      while(*i){
79        while(*i == ' ' || *i == '\t' ){
80          i++;
81        };    
82        TString c=i;
83        if( isdigit(*i) || isalpha(*i) || c.BeginsWith(".") ){
84          while( isdigit(*i) || isalpha(*i) ||  c.BeginsWith(".") ){
85            *p = *i;
86            p++;
87            i++;
88            c=i;
89          };
90          /*SPACE CODE*/
91          if(insertspace){
92            *p = ' ';
93            p++;
94          };
95          /*END SPACE CODE*/
96        };    
97        if( *i == '(' ){
98          push(&X,*i);
99          i++;
100        };
101        if( *i == ')'){
102          n1 = pop(&X);
103          while( n1 != '(' ){
104            *p = n1;
105            p++;
106            /*SPACE CODE*/
107            if(insertspace){
108              *p = ' ';
109              p++;
110            };
111            /*END SPACE CODE*/
112            n1 = pop(&X);
113          };
114          i++;
115        };    
116        if( isoperator(*i) ){
117          if(isempty(&X)){
118            push(&X,*i);
119          } else {
120            n1 = pop(&X);
121            while( priority(n1) >= priority(*i) ){
122              *p = n1;
123              p++;
124              /*SPACE CODE*/
125              if(insertspace){
126                *p = ' ';
127                p++;
128              };
129              /*END SPACE CODE*/
130              n1 = pop(&X);
131            };
132            push(&X,n1);
133            push(&X,*i);
134          };
135          i++;
136        };
137      };
138      while(!isempty(&X)){
139        n1 = pop(&X);
140        *p = n1;
141        p++;
142        /*SPACE CODE*/
143        if(insertspace){
144          *p = ' ';
145          p++;
146        };
147        /*END SPACE CODE*/
148      };
149      *p = '\0';
150    }
151    
152    
153    Float_t evaluate(char *postfix){
154      //
155      Float_t op1 = 0.;
156      Float_t op2 = 0.;
157      Float_t result = 0.;
158      //
159      TString e = postfix;
160      Float_t st[50];
161      memset(st,0,50*sizeof(Float_t));
162      TObjArray *ae = e.Tokenize(" ");
163      Int_t o = 0;
164      Int_t a = 0;    
165      Int_t ap = 0;    
166      //
167      while ( o < ae->GetEntries() ){
168        if (  ((TString)(((TObjString*)ae->At(o))->GetString())).IsFloat() ){
169          st[a] = (Float_t)((TString)(((TObjString*)ae->At(o))->GetString())).Atof();;
170          a++;
171        } else {      
172          ap = a-1;
173          op1 = st[ap--];
174          op2 = st[ap];
175          const char *p=((TString)(((TObjString*)ae->At(o))->GetString())).Data();
176          switch(*p){
177           case '+':
178            result = op2 + op1;
179            break;
180          case '-':
181            result = op2 - op1;
182            break;
183          case '/':
184            result = op2 / op1;
185            break;
186          case '*':
187            result = op2 * op1;
188            break;
189          case '%':
190            result = (Int_t)round(op2) % (Int_t)round(op1);
191            break;
192          default:
193            printf("\nInvalid Operator: %s \n",((TString)(((TObjString*)ae->At(o))->GetString())).Data());
194            return 0;
195          };
196          st[ap] = result;
197          a = ap+1;
198          //
199        };
200        o++;
201      };
202      return result;
203      //
204    }
205    
206    
207    
208  ////////////////////////////////////////////////////////////////////////              ////////////////////////////////////////////////////////////////////////            
209  /**  /**
210   * 1-dimension function describing lateral distribution of the   * 1-dimension function describing lateral distribution of the
# Line 80  CaloLat::CaloLat(PamLevel2 *l2p){   Line 281  CaloLat::CaloLat(PamLevel2 *l2p){  
281    PKT = 0;    PKT = 0;
282    atime = 0;    atime = 0;
283    //    //
284      suf = "";
285    debug = false;    debug = false;
286    //    //
287  };  };
# Line 96  Calo2D::Calo2D(PamLevel2 *l2p){   Line 298  Calo2D::Calo2D(PamLevel2 *l2p){  
298    PKT = 0;    PKT = 0;
299    atime = 0;    atime = 0;
300    //    //
301      suf = "";
302    debug = false;    debug = false;
303    //    //
304  };  };
# Line 174  void CaloLat::Draw(Int_t view,Int_t plan Line 377  void CaloLat::Draw(Int_t view,Int_t plan
377    //    //
378    for (Int_t v=minv; v<maxv;v++){    for (Int_t v=minv; v<maxv;v++){
379       for (Int_t p=minp; p<maxp;p++){       for (Int_t p=minp; p<maxp;p++){
380          TString hid = Form("clatv%ip%i",v,p);           TString hid = Form("clatv%ip%i%s",v,p,suf.Data());      
381          TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid));          TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid));
382          if ( tc ){          if ( tc ){
383  //       tc->Clear();  //       tc->Clear();
# Line 182  void CaloLat::Draw(Int_t view,Int_t plan Line 385  void CaloLat::Draw(Int_t view,Int_t plan
385           tc = new TCanvas(hid,hid);           tc = new TCanvas(hid,hid);
386          };          };
387          //          //
388          TString thid = Form("hlatv%ip%i",v,p);            TString thid = Form("hlatv%ip%i%s",v,p,suf.Data());    
389          TH1F *th  = dynamic_cast<TH1F*>(gDirectory->FindObject(thid));          TH1F *th  = dynamic_cast<TH1F*>(gDirectory->FindObject(thid));
390          if ( th ) th->Delete();          if ( th ) th->Delete();
391  //       th->Clear();  //       th->Clear();
# Line 225  void Calo2D::Draw(Int_t plane){ Line 428  void Calo2D::Draw(Int_t plane){
428    gStyle->SetNdivisions(510,"XY");    gStyle->SetNdivisions(510,"XY");
429    //    //
430    for (Int_t p=minp; p<maxp;p++){    for (Int_t p=minp; p<maxp;p++){
431      TString hid = Form("c2dp%i",p);          TString hid = Form("c2dp%i%s",p,suf.Data());        
432      TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid));      TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid));
433      if ( tc ){      if ( tc ){
434        //         tc->Clear();        //         tc->Clear();
# Line 233  void Calo2D::Draw(Int_t plane){ Line 436  void Calo2D::Draw(Int_t plane){
436        tc = new TCanvas(hid,hid);        tc = new TCanvas(hid,hid);
437      };      };
438      //      //
439      TString thid = Form("h2dp%i",p);          TString thid = Form("h2dp%i%s",p,suf.Data());      
440      TH2F *th  = dynamic_cast<TH2F*>(gDirectory->FindObject(thid));      TH2F *th  = dynamic_cast<TH2F*>(gDirectory->FindObject(thid));
441      if ( th ) th->Delete();      if ( th ) th->Delete();
442      //   th->Clear();      //   th->Clear();
# Line 466  CaloLong::CaloLong(PamLevel2 *l2p){   Line 669  CaloLong::CaloLong(PamLevel2 *l2p){  
669    maskYE = false;    maskYE = false;
670    maskYO = false;    maskYO = false;
671    //    //
672      lmax = 0.;
673      umax = 100.;
674      slmax = "";
675      sumax = "";
676      suf = "";
677      xyaverage = true;
678      //
679  };  };
680    
681  void CaloLong::MaskSection(TString sec){  void CaloLong::MaskSection(TString sec){
# Line 495  void CaloLong::Clear(){ Line 705  void CaloLong::Clear(){
705    chi2 = 0.;    chi2 = 0.;
706    ndf = 0.;    ndf = 0.;
707    E0 = 0.;    E0 = 0.;
708      defE0 = 0.;
709    a = 0.;    a = 0.;
710    b = 0.;    b = 0.;
711    errE0 = 0.;    errE0 = 0.;
# Line 520  void CaloLong::Print(){ Line 731  void CaloLong::Print(){
731    printf(" nchi2    :.. %f\n",chi2/ndf);    printf(" nchi2    :.. %f\n",chi2/ndf);
732    printf(" E0       :.. %f\n",E0);    printf(" E0       :.. %f\n",E0);
733    printf(" E0/260.  :.. %f\n",E0/260.);    printf(" E0/260.  :.. %f\n",E0/260.);
734      printf(" defE0    :.. %f\n",defE0);
735      printf(" lower    :.. %f\n",lmax);
736      printf(" upper    :.. %f\n",umax);
737      printf(" s lower  :.. %s\n",slmax.Data());
738      printf(" s upper  :.. %s\n",sumax.Data());
739    printf(" a        :.. %f\n",a);    printf(" a        :.. %f\n",a);
740    printf(" b        :.. %f\n",b);    printf(" b        :.. %f\n",b);
741    printf(" errE0    :.. %f\n",errE0);    printf(" errE0    :.. %f\n",errE0);
# Line 782  void CaloLong::Fit(){ Line 998  void CaloLong::Fit(){
998    this->Fit(false);    this->Fit(false);
999  };  };
1000    
1001    Float_t CaloLong::Evaluate(TString s, Float_t tmax, Float_t X0pl){
1002      /* SAMPLE OUTPUT:
1003         Enter Infix Expression : A + B + C / (E - F)
1004         Postfix Expression is : A B + C E F - / +  
1005      */  
1006      if ( !s.Contains("tmax") && !s.Contains("X0pl") ){
1007        printf(" ERROR, the input formula must contain \"t\"\n");
1008        return 0.;
1009      };
1010      if ( tmax != tmax ){
1011        printf(" ERROR, tmax is nan! \n");
1012        return 0.;
1013      };
1014      TString g=Form("%f",tmax);
1015      TString h=Form("%f",X0pl);
1016      TString *ts= new TString("");
1017      ts->Prepend(s.Data());
1018      ts->ReplaceAll("tmax",4,g.Data(),g.Capacity());
1019      ts->ReplaceAll("X0pl",4,h.Data(),h.Capacity());
1020      ts->Prepend("(");
1021      ts->Append(")");
1022      if ( debug )  printf(" ts %s tssize %i capac %i s %s g %s \n",ts->Data(),ts->Sizeof(),ts->Capacity(),s.Data(),g.Data());
1023      char in[50],post[50];  
1024      strcpy(&in[0],"                                                 ");
1025      strcpy(&in[0],ts->Data());
1026      strcpy(&post[0],"                                                 ");
1027      if ( debug ) printf("Infix Expression is : ##%s##\n",&in[0]);
1028      infix2postfix(&in[0],&post[0],1);
1029      if ( debug ) printf("Postfix Expression is : ##%s##\n",&post[0]);
1030      /* SAMPLE OUTPUT:
1031         Enter Postfix Expression : 3 5 + 2 /
1032         3 5 + 2 / EQUALS 4
1033      */
1034      Float_t res = evaluate(&post[0]);
1035      if ( debug ) printf("%s EQUALS %f\n",post,res);
1036      return res;
1037    }
1038    
1039  void CaloLong::Fit(Bool_t draw){  void CaloLong::Fit(Bool_t draw){
1040    //    //
1041    Process();    Process();
# Line 815  void CaloLong::Fit(Bool_t draw){ Line 1069  void CaloLong::Fit(Bool_t draw){
1069      gStyle->SetNdivisions(510,"XY");      gStyle->SetNdivisions(510,"XY");
1070    };    };
1071    //    //
1072    TString hid = Form("clongfit");          TString hid = Form("clongfit%s",suf.Data());  
1073    TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid));    TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid));
1074    //  if ( tc ) tc->Delete();    //  if ( tc ) tc->Delete();
1075    //  if ( tc ) tc->Close();    //  if ( tc ) tc->Close();
# Line 825  void CaloLong::Fit(Bool_t draw){ Line 1079  void CaloLong::Fit(Bool_t draw){
1079      if ( tc ) tc->cd();      if ( tc ) tc->cd();
1080    };    };
1081    //    //
1082    TString thid = Form("hlongfit");          TString thid = Form("hlongfit%s",suf.Data());
1083    TH1F *th  = dynamic_cast<TH1F*>(gDirectory->FindObject(thid));    TH2F *th  = dynamic_cast<TH2F*>(gDirectory->FindObject(thid));
1084    if ( th ) th->Delete();    if ( th ) th->Delete();
1085      //
1086      TString ghid = Form("glongfit%s",suf.Data());
1087      TGraphErrors *gh  = dynamic_cast<TGraphErrors*>(gDirectory->FindObject(ghid));
1088      if ( gh ) gh->Delete();
1089      //
1090    Float_t xpos = 0.;    Float_t xpos = 0.;
1091    Float_t enemip = 0.;    Float_t enemip = 0.;
1092    Float_t xmax = NC * X0pl + 0.2;    Float_t xmax = NC * X0pl + 0.2;
1093    //  th = new TH1F(thid,thid,int(NC*1.5),-0.2,xmax);    //
1094    th = new TH1F(thid,thid,100,-0.2,xmax);    Double_t xxx[50];
1095      Double_t exx[50];
1096      Double_t yyy[50];
1097      Double_t eyy[50];
1098      Int_t numpo = 0;
1099      memset(xxx,0,50*sizeof(Double_t));
1100      memset(exx,0,50*sizeof(Double_t));
1101      memset(yyy,0,50*sizeof(Double_t));
1102      memset(eyy,0,50*sizeof(Double_t));
1103    //    //
1104    // AGH, BUG!    // AGH, BUG!
1105    //    //
# Line 846  void CaloLong::Fit(Bool_t draw){ Line 1113  void CaloLong::Fit(Bool_t draw){
1113      mmax = NC;      mmax = NC;
1114    };    };
1115    //    //
1116      Float_t emax = 0.;
1117    Float_t qtotparz = 0.;    Float_t qtotparz = 0.;
1118    for (Int_t st=mmin;st<mmax+1;st++){    for (Int_t st=mmin;st<mmax+1;st++){
1119      enemip = 0.;      enemip = 0.;
1120      xpos = (st - mmin) * X0pl;      xpos = (st - mmin) * X0pl;
1121      if ( st > mmin && st < mmax ){            //
1122        if ( no18x && ( st == 18+1 || st == mask18b+1 )){      if ( xyaverage ){
1123          if ( !maskYO ){        //
1124            enemip = 2. * eplane[1][st];        if ( st > mmin && st < mmax ){      
1125            if ( no18x && ( st == 18+1 || st == mask18b+1 )){
1126              if ( !maskYO ){
1127                enemip = 2. * eplane[1][st];
1128              } else {
1129                enemip = eplane[1][st];
1130              };
1131          } else {          } else {
1132            enemip = eplane[1][st];            enemip = eplane[0][st-1] + eplane[1][st];
1133          };          };
1134        } else {        } else {
1135          enemip = eplane[0][st-1] + eplane[1][st];          if ( st == mmin ){
1136              if ( !maskYE ){
1137                enemip = 2. * eplane[1][st];
1138              } else {
1139                enemip = eplane[1][st];
1140              };
1141            };
1142            if ( st == mmax ){
1143              if ( !maskXE ){
1144                enemip = 2. * eplane[0][st-1];
1145              } else {
1146                enemip = eplane[0][st-1];
1147              };
1148            };
1149          };
1150          //
1151          qtotparz += enemip;
1152          if ( enemip > emax ) emax = enemip;
1153          if ( enemip > 0. ){
1154            xxx[numpo] = xpos;
1155            exx[numpo] = 0.1;
1156            yyy[numpo] = enemip;
1157            eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);
1158            numpo++;
1159            //      th->Fill(xpos,enemip);
1160            if ( debug ) printf(" AVE Filling: st %i xpos %f energy %f \n",st,xpos,enemip);
1161        };        };
1162      } else {      } else {
1163        if ( st == mmin ){        for (Int_t jj=0; jj<2; jj++){
1164          if ( !maskYE ){          if ( st > mmin && st < mmax ){
1165            enemip = 2. * eplane[1][st];            if ( jj == 0 && no18x && ( st == 18+1 || st == mask18b+1 )){
1166                enemip = eplane[1][st];
1167              } else {
1168                if ( jj == 0 ){
1169                  enemip = eplane[jj][st-1];
1170                } else {
1171                  enemip = eplane[jj][st];
1172                };        
1173              };
1174          } else {          } else {
1175            enemip = eplane[1][st];            if ( st == mmin && jj == 1 ){
1176                enemip = eplane[jj][st];
1177              };
1178              if ( st == mmax && jj == 0){
1179                enemip = eplane[jj][st-1];
1180              };
1181          };          };
1182        };          //
1183        if ( st == mmax ){          qtotparz += enemip;
1184          if ( !maskXE ){        if ( enemip > emax ) emax = enemip;
1185            enemip = 2. * eplane[0][st-1];          if ( enemip > 0. ){
1186          } else {            xxx[numpo] = xpos;
1187            enemip = eplane[0][st-1];            exx[numpo] = 0.1;
1188              yyy[numpo] = enemip;
1189              eyy[numpo] = sqrt(enemip*3.)+sqrt(5.);
1190              //      eyy[numpo] = sqrt(enemip)/(st*0.95);
1191              numpo++;
1192              //      th->Fill(xpos,enemip);
1193              if ( debug ) printf(" XY Filling: st %i xpos %f energy %f \n",st,xpos,enemip);
1194          };          };
1195        };        };        
     };  
     //  
     qtotparz += enemip;  
     if ( enemip > 0. ){  
       th->Fill(xpos,enemip);  
       if ( debug ) printf(" Filling: st %i xpos %f energy %f \n",st,xpos,enemip);  
1196      };      };
1197    
1198      //      //
1199      //    for (Int_t v=1; v>=0;v--)// {      //    for (Int_t v=1; v>=0;v--)// {
1200  //       //  //       //
# Line 907  void CaloLong::Fit(Bool_t draw){ Line 1220  void CaloLong::Fit(Bool_t draw){
1220  //     };  //     };
1221    };    };
1222    //    //
1223    TF1 *lfit = new TF1("lfit",ccurve,0.,xmax,3);    //  th = new TH2F(thid,thid,int(NC*1.5),-0.2,xmax);
1224      th = new TH2F(thid,thid,1000,-0.2,xmax,1000,0.,emax*1.2);
1225      gh = new TGraphErrors(numpo,xxx,yyy,exx,eyy);
1226      TString fnam=Form("lfit%s",suf.Data());
1227      TF1 *lfit  = dynamic_cast<TF1*>(gDirectory->FindObject(fnam));
1228      if ( lfit ) lfit->Delete();
1229      lfit = new TF1(fnam,ccurve,0.,xmax,3);
1230    if ( debug ) printf("qtot %f qtotparz %f \n",clp->qtot,qtotparz);    if ( debug ) printf("qtot %f qtotparz %f \n",clp->qtot,qtotparz);
1231    E0 = qtotparz;    E0 = qtotparz;
1232    //  E0 = clp->qtot;    //  E0 = clp->qtot;
# Line 918  void CaloLong::Fit(Bool_t draw){ Line 1237  void CaloLong::Fit(Bool_t draw){
1237    //  lfit->SetParLimits(0,0.,1000.);    //  lfit->SetParLimits(0,0.,1000.);
1238    //  lfit->SetParLimits(1,-1.,80.);    //  lfit->SetParLimits(1,-1.,80.);
1239    //  lfit->SetParLimits(2,-1.,10.);    //  lfit->SetParLimits(2,-1.,10.);
1240    TString optio;    //  TString optio = "ROW"; // "RO"
1241      TString optio = "RO"; // "RO"
1242    if ( debug ){    if ( debug ){
1243      //    optio = "MERBOV";      optio += "NV";
1244      //    optio = "MEROV";      if ( draw ) optio += "V";
     //    optio = "EROV";  
     optio = "RNOV";  
     if ( draw ) optio = "ROV";  
1245    } else {    } else {
1246      //    optio = "MERNOQ";      optio += "NQ";
1247      //    optio = "ERNOQ";      if ( draw ) optio += "Q";
     optio = "RNOQ";  
     if ( draw ) optio = "ROQ";  
1248    };    };
1249    //    //
1250    if ( debug ) printf(" OK, start the fitting procedure...\n");    if ( debug ) printf(" OK, start the fitting procedure...\n");
1251    //    //
1252    fitresult = th->Fit("lfit",optio);    //  fitresult = th->Fit("lfit",optio);
1253      fitresult = gh->Fit("lfit",optio);
1254    //    //
1255    if ( debug ) printf(" the fit is done! result: %i \n",fitresult);    if ( debug ) printf(" the fit is done! result: %i \n",fitresult);
1256    //    //
# Line 953  void CaloLong::Fit(Bool_t draw){ Line 1269  void CaloLong::Fit(Bool_t draw){
1269    if ( fitresult != 0 ){    if ( fitresult != 0 ){
1270      if ( debug ) printf(" The fit failed, no integrals calculation and asymm is set to -1. \n");      if ( debug ) printf(" The fit failed, no integrals calculation and asymm is set to -1. \n");
1271      asymm = -1.;      asymm = -1.;
1272        defE0 = -1.;
1273    } else {    } else {
1274        if ( slmax.MaybeRegexp() ) lmax = this->Evaluate(slmax,tmax,X0pl);
1275        if ( sumax.MaybeRegexp() ) umax = this->Evaluate(sumax,tmax,X0pl);
1276      Int_t npp = 1000;      Int_t npp = 1000;
1277        double *xpp=new double[npp];
1278        double *wpp=new double[npp];
1279        lfit->CalcGaussLegendreSamplingPoints(npp,xpp,wpp,1e-12);
1280        defE0 = lfit->IntegralFast(npp,xpp,wpp,lmax,umax);
1281        //
1282      double *xp=new double[npp];      double *xp=new double[npp];
1283      double *wp=new double[npp];      double *wp=new double[npp];
1284      lfit->CalcGaussLegendreSamplingPoints(npp,xp,wp,1e-12);      lfit->CalcGaussLegendreSamplingPoints(npp,xp,wp,1e-12);
# Line 1003  void CaloLong::Fit(Bool_t draw){ Line 1327  void CaloLong::Fit(Bool_t draw){
1327      // axis titles      // axis titles
1328      th->SetXTitle("Depth [X0]");      th->SetXTitle("Depth [X0]");
1329      th->SetYTitle("Energy [MIP]");      th->SetYTitle("Energy [MIP]");
1330      th->DrawCopy("Perror");      //    th->DrawCopy("Perror");
1331        th->DrawCopy();
1332        gh->SetMarkerSize(1.);
1333        gh->SetMarkerStyle(21);
1334        //    gh->SetMarkerColor(kRed);
1335        gh->Draw("Psame");
1336      lfit->Draw("same");      lfit->Draw("same");
1337      tc->Modified();      tc->Modified();
1338      tc->Update();      tc->Update();
# Line 1015  void CaloLong::Fit(Bool_t draw){ Line 1344  void CaloLong::Fit(Bool_t draw){
1344      if ( th ) th->Delete();      if ( th ) th->Delete();
1345    };    };
1346    //    //
1347    delete lfit;    //  delete lfit;
1348    //    //
1349  };  };
1350    
# Line 1044  void CaloLong::Draw(Int_t view){ Line 1373  void CaloLong::Draw(Int_t view){
1373    //    //
1374    if ( maxv != -1 ){    if ( maxv != -1 ){
1375      for (Int_t v=minv; v<maxv;v++){      for (Int_t v=minv; v<maxv;v++){
1376        TString hid = Form("clongv%i",v);        TString hid = Form("clongv%i%s",v,suf.Data());    
1377        TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid));        TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid));
1378        if ( tc ){        if ( tc ){
1379          //       tc->Clear();          //       tc->Clear();
# Line 1052  void CaloLong::Draw(Int_t view){ Line 1381  void CaloLong::Draw(Int_t view){
1381          tc = new TCanvas(hid,hid);          tc = new TCanvas(hid,hid);
1382        };        };
1383        //        //
1384        TString thid = Form("hlongv%i",v);                TString thid = Form("hlongv%i%s",v,suf.Data());  
1385        TH1F *th  = dynamic_cast<TH1F*>(gDirectory->FindObject(thid));        TH1F *th  = dynamic_cast<TH1F*>(gDirectory->FindObject(thid));
1386        if ( th ) th->Delete();        if ( th ) th->Delete();
1387        //         th->Clear();        //         th->Clear();
# Line 1071  void CaloLong::Draw(Int_t view){ Line 1400  void CaloLong::Draw(Int_t view){
1400      };      };
1401    } else {    } else {
1402      //      //
1403      TString hid = Form("clongvyvx");          TString hid = Form("clongvyvx%s",suf.Data());      
1404      TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid));      TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid));
1405      if ( tc ){      if ( tc ){
1406      } else {      } else {
1407        tc = new TCanvas(hid,hid);        tc = new TCanvas(hid,hid);
1408      };      };
1409      //      //
1410      TString thid = Form("hlongvyvx");        TString thid = Form("hlongvyvx%s",suf.Data());      
1411      TH1F *th  = dynamic_cast<TH1F*>(gDirectory->FindObject(thid));      TH1F *th  = dynamic_cast<TH1F*>(gDirectory->FindObject(thid));
1412      if ( th ) th->Delete();      if ( th ) th->Delete();
1413      th = new TH1F(thid,thid,44,-0.5,43.5);      th = new TH1F(thid,thid,44,-0.5,43.5);
# Line 1106  void CaloLong::Delete(){ Line 1435  void CaloLong::Delete(){
1435    Clear();    Clear();
1436    //delete this;    //delete this;
1437  };  };
1438    
1439    
1440    
1441    
1442    
1443    
1444    
1445    
1446    
1447    
1448    
1449    
1450    
1451    
1452    
1453    
1454    
1455    
1456    
1457    

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

  ViewVC Help
Powered by ViewVC 1.1.23