| 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 | 
| 281 | PKT = 0; | PKT = 0; | 
| 282 | atime = 0; | atime = 0; | 
| 283 | // | // | 
| 284 |  | suf = ""; | 
| 285 | debug = false; | debug = false; | 
| 286 | // | // | 
| 287 | }; | }; | 
| 298 | PKT = 0; | PKT = 0; | 
| 299 | atime = 0; | atime = 0; | 
| 300 | // | // | 
| 301 |  | suf = ""; | 
| 302 | debug = false; | debug = false; | 
| 303 | // | // | 
| 304 | }; | }; | 
| 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(); | 
| 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(); | 
| 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(); | 
| 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(); | 
| 654 | PKT = 0; | PKT = 0; | 
| 655 | atime = 0; | atime = 0; | 
| 656 | // | // | 
| 657 |  | clp = L2->GetCaloLevel2(); | 
| 658 |  | // | 
| 659 | sel = true; | sel = true; | 
| 660 | cont = false; | cont = false; | 
| 661 | N = 0; | N = 0; | 
| 664 | // | // | 
| 665 | no18x = true; | no18x = true; | 
| 666 | debug = false; | debug = false; | 
| 667 |  | maskXE = false; | 
| 668 |  | maskXO = false; | 
| 669 |  | maskYE = false; | 
| 670 |  | maskYO = false; | 
| 671 |  | // | 
| 672 |  | lmax = 0.; | 
| 673 |  | umax = 100.; | 
| 674 |  | slmax = ""; | 
| 675 |  | sumax = ""; | 
| 676 |  | suf = ""; | 
| 677 |  | xyaverage = true; | 
| 678 |  | // | 
| 679 |  | letmax = -1; | 
| 680 |  | heavytail = false; | 
| 681 |  | //  lmipth = 100.; | 
| 682 |  | lmipth = 0.; | 
| 683 | // | // | 
| 684 | }; | }; | 
| 685 |  |  | 
| 686 |  | void CaloLong::MaskSection(TString sec){ | 
| 687 |  | sec.ToUpper(); | 
| 688 |  | if ( sec.Contains("XO") ) maskXO = true; | 
| 689 |  | if ( sec.Contains("YO") ) maskYO = true; | 
| 690 |  | if ( sec.Contains("XE") ) maskXE = true; | 
| 691 |  | if ( sec.Contains("YE") ) maskYE = true; | 
| 692 |  | } | 
| 693 |  |  | 
| 694 |  | void CaloLong::UnMaskSections(){ | 
| 695 |  | this->UnMaskSection("XEXOYEYO"); | 
| 696 |  | } | 
| 697 |  |  | 
| 698 |  | void CaloLong::UnMaskSection(TString sec){ | 
| 699 |  | sec.ToUpper(); | 
| 700 |  | if ( sec.Contains("XO") ) maskXO = false; | 
| 701 |  | if ( sec.Contains("YO") ) maskYO = false; | 
| 702 |  | if ( sec.Contains("XE") ) maskXE = false; | 
| 703 |  | if ( sec.Contains("YE") ) maskYE = false; | 
| 704 |  | } | 
| 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.; | 
| 713 | ndf = 0.; | ndf = 0.; | 
| 714 | E0 = 0.; | E0 = 0.; | 
| 715 |  | defE0 = 0.; | 
| 716 | a = 0.; | a = 0.; | 
| 717 | b = 0.; | b = 0.; | 
| 718 | errE0 = 0.; | errE0 = 0.; | 
| 728 |  |  | 
| 729 | void CaloLong::Print(){ | void CaloLong::Print(){ | 
| 730 | // | // | 
| 731 | Process(); | Fit(); | 
| 732 | // | // | 
| 733 | printf("==================== Calorimeter Longitudinal Profile =======================\n"); | printf("==================== Calorimeter Longitudinal Profile =======================\n"); | 
| 734 | printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime); | printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime); | 
| 738 | printf(" nchi2    :.. %f\n",chi2/ndf); | printf(" nchi2    :.. %f\n",chi2/ndf); | 
| 739 | printf(" E0       :.. %f\n",E0); | printf(" E0       :.. %f\n",E0); | 
| 740 | printf(" E0/260.  :.. %f\n",E0/260.); | printf(" E0/260.  :.. %f\n",E0/260.); | 
| 741 |  | printf(" defE0    :.. %f\n",defE0); | 
| 742 |  | printf(" lower    :.. %f\n",lmax); | 
| 743 |  | printf(" upper    :.. %f\n",umax); | 
| 744 |  | printf(" s lower  :.. %s\n",slmax.Data()); | 
| 745 |  | printf(" s upper  :.. %s\n",sumax.Data()); | 
| 746 | printf(" a        :.. %f\n",a); | printf(" a        :.. %f\n",a); | 
| 747 | printf(" b        :.. %f\n",b); | printf(" b        :.. %f\n",b); | 
| 748 | printf(" errE0    :.. %f\n",errE0); | printf(" errE0    :.. %f\n",errE0); | 
| 781 | }; | }; | 
| 782 | } | } | 
| 783 |  |  | 
| 784 |  | void CaloLong::SplitInto(Int_t NoWpreSampler, Int_t NoWcalo){ | 
| 785 |  | this->SetNoWpreSampler(0); | 
| 786 |  | this->SetNoWcalo(0); | 
| 787 |  | if ( NoWpreSampler < NoWcalo ){ | 
| 788 |  | this->SetNoWpreSampler(NoWpreSampler); | 
| 789 |  | this->SetNoWcalo(NoWcalo); | 
| 790 |  | } else { | 
| 791 |  | this->SetNoWcalo(NoWcalo); | 
| 792 |  | this->SetNoWpreSampler(NoWpreSampler); | 
| 793 |  | }; | 
| 794 |  | } | 
| 795 |  |  | 
| 796 | void CaloLong::Process(){ | void CaloLong::Process(){ | 
| 797 | // | // | 
| 798 | if ( !L2 ){ | if ( !L2 ){ | 
| 846 | Int_t plane = 0; | Int_t plane = 0; | 
| 847 | Int_t strip = 0; | Int_t strip = 0; | 
| 848 | Float_t mip = 0.; | Float_t mip = 0.; | 
| 849 |  | Bool_t gof = true; | 
| 850 | for (Int_t i=0; i < L2->GetCaloLevel1()->istrip; i++){ | for (Int_t i=0; i < L2->GetCaloLevel1()->istrip; i++){ | 
| 851 | mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); | mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); | 
| 852 | eplane[view][plane] += mip; | gof = true; | 
| 853 |  | if ( maskXE && (plane%2)==0 && view==1 ) gof = false; | 
| 854 |  | if ( maskXO && (plane%2)!=0 && view==1 ) gof = false; | 
| 855 |  | if ( maskYE && (plane%2)!=0 && view==0 ) gof = false; | 
| 856 |  | if ( maskYO && (plane%2)==0 && view==0 ) gof = false; | 
| 857 |  | if ( gof ) eplane[view][plane] += mip; | 
| 858 | }; | }; | 
| 859 | // | // | 
| 860 | // inclination factor (steal 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 * L2->GetCaloLevel2()->tanx[0]; | ytgx = 0.76 * clp->tanx[0]; | 
| 865 | ytgy = 0.76 * L2->GetCaloLevel2()->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.) ); | 
| 867 | // | // | 
| 868 | // Find experimental plane of maximum | // Find experimental plane of maximum | 
| 890 | // | // | 
| 891 | }; | }; | 
| 892 |  |  | 
| 893 |  | void CaloLong::SetEnergies(Float_t myene[][22]){ | 
| 894 |  | // | 
| 895 |  | if ( !L2 ){ | 
| 896 |  | printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); | 
| 897 |  | printf(" ERROR: CaloHough variables not filled \n"); | 
| 898 |  | return; | 
| 899 |  | }; | 
| 900 |  | // | 
| 901 |  | Bool_t newentry = false; | 
| 902 |  | // | 
| 903 |  | if ( L2->IsORB() ){ | 
| 904 |  | if ( L2->GetOrbitalInfo()->pkt_num != PKT || L2->GetOrbitalInfo()->OBT != OBT || L2->GetOrbitalInfo()->absTime != atime ){ | 
| 905 |  | newentry = true; | 
| 906 |  | OBT = L2->GetOrbitalInfo()->OBT; | 
| 907 |  | PKT = L2->GetOrbitalInfo()->pkt_num; | 
| 908 |  | atime = L2->GetOrbitalInfo()->absTime; | 
| 909 |  | }; | 
| 910 |  | } else { | 
| 911 |  | newentry = true; | 
| 912 |  | }; | 
| 913 |  | // | 
| 914 |  | if ( !newentry ) return; | 
| 915 |  | // | 
| 916 |  | if ( debug ) printf(" SET ENERGIES Start processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime); | 
| 917 |  | // | 
| 918 |  | Clear(); | 
| 919 |  | // | 
| 920 |  | // let's start | 
| 921 |  | // | 
| 922 |  | if ( cont ){ | 
| 923 |  | for (Int_t i=0; i<22; i++){ | 
| 924 |  | if ( i == (18+N) ){ | 
| 925 |  | mask18b =  18 + N; | 
| 926 |  | break; | 
| 927 |  | }; | 
| 928 |  | }; | 
| 929 |  | }; | 
| 930 |  | // | 
| 931 |  | if ( sel ){ | 
| 932 |  | for (Int_t i=0; i<22; i++){ | 
| 933 |  | if ( i == (18-N) ){ | 
| 934 |  | mask18b =  18 - N; | 
| 935 |  | break; | 
| 936 |  | }; | 
| 937 |  | }; | 
| 938 |  | }; | 
| 939 |  | // | 
| 940 |  | //  if ( mask18b == 18 ) mask18b = -1; | 
| 941 |  | // | 
| 942 |  | Int_t view = 0; | 
| 943 |  | Int_t plane = 0; | 
| 944 |  | Bool_t gof = true; | 
| 945 |  | for (view=0; view < 2; view++){ | 
| 946 |  | for (plane=0; plane < 22; plane++){ | 
| 947 |  | gof = true; | 
| 948 |  | if ( maskXE && (plane%2)==0 && view==1 ) gof = false; | 
| 949 |  | if ( maskXO && (plane%2)!=0 && view==1 ) gof = false; | 
| 950 |  | if ( maskYE && (plane%2)!=0 && view==0 ) gof = false; | 
| 951 |  | if ( maskYO && (plane%2)==0 && view==0 ) gof = false; | 
| 952 |  | if ( gof ) eplane[view][plane] = myene[view][plane]; | 
| 953 |  | if ( debug ) printf(" XE %i XO %i YE %i YO %i eplane %i %i = %f ........... myene %i %i = %f\n", maskXE, maskXO, maskYE, maskYO,view,plane,eplane[view][plane],view,plane,myene[view][plane]); | 
| 954 |  | }; | 
| 955 |  | }; | 
| 956 |  | // | 
| 957 |  | if ( !clp && debug ) printf(" ERROR!! no CaloLevel2 obj!!\n"); | 
| 958 |  | // | 
| 959 |  | // inclination factor (stolen from Daniele's code) | 
| 960 |  | // | 
| 961 |  | Float_t ytgx = 0.; | 
| 962 |  | Float_t ytgy = 0.; | 
| 963 |  | ytgx = 0.76 * clp->tanx[0]; | 
| 964 |  | ytgy = 0.76 * clp->tany[0]; | 
| 965 |  | 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 | 
| 969 |  | // | 
| 970 |  | Int_t pmax = 0; | 
| 971 |  | Int_t vmax = 0; | 
| 972 |  | Float_t emax = 0.; | 
| 973 |  | for (Int_t v=0; v<2; v++){ | 
| 974 |  | for (Int_t i=0; i<22; i++){ | 
| 975 |  | if ( eplane[v][i] > emax ){ | 
| 976 |  | emax = eplane[v][i]; | 
| 977 |  | vmax = v; | 
| 978 |  | pmax = i; | 
| 979 |  | }; | 
| 980 |  | }; | 
| 981 |  | }; | 
| 982 |  | // | 
| 983 |  | // | 
| 984 |  | // | 
| 985 |  | if ( vmax == 0 ) pmax++; | 
| 986 |  | etmax = pmax * X0pl; | 
| 987 |  | letmax = etmax; | 
| 988 |  | // | 
| 989 |  | if ( debug ) this->Print(); | 
| 990 |  | if ( debug ) printf(" exit \n"); | 
| 991 |  | // | 
| 992 |  | }; | 
| 993 |  |  | 
| 994 | Double_t ccurve(Double_t *ti,Double_t *par){ | Double_t ccurve(Double_t *ti,Double_t *par){ | 
| 995 | // | // | 
| 1009 | this->Fit(false); | this->Fit(false); | 
| 1010 | }; | }; | 
| 1011 |  |  | 
| 1012 |  | Float_t CaloLong::Evaluate(TString s, Float_t tmax, Float_t X0pl){ | 
| 1013 |  | /* SAMPLE OUTPUT: | 
| 1014 |  | Enter Infix Expression : A + B + C / (E - F) | 
| 1015 |  | Postfix Expression is : A B + C E F - / + | 
| 1016 |  | */ | 
| 1017 |  | if ( !s.Contains("tmax") && !s.Contains("X0pl") ){ | 
| 1018 |  | printf(" ERROR, the input formula must contain \"t\"\n"); | 
| 1019 |  | return 0.; | 
| 1020 |  | }; | 
| 1021 |  | if ( tmax != tmax ){ | 
| 1022 |  | printf(" ERROR, tmax is nan! \n"); | 
| 1023 |  | return 0.; | 
| 1024 |  | }; | 
| 1025 |  | TString g=Form("%f",tmax); | 
| 1026 |  | TString h=Form("%f",X0pl); | 
| 1027 |  | TString *ts= new TString(""); | 
| 1028 |  | ts->Prepend(s.Data()); | 
| 1029 |  | ts->ReplaceAll("tmax",4,g.Data(),g.Capacity()); | 
| 1030 |  | ts->ReplaceAll("X0pl",4,h.Data(),h.Capacity()); | 
| 1031 |  | ts->Prepend("("); | 
| 1032 |  | ts->Append(")"); | 
| 1033 |  | if ( debug )  printf(" ts %s tssize %i capac %i s %s g %s \n",ts->Data(),ts->Sizeof(),ts->Capacity(),s.Data(),g.Data()); | 
| 1034 |  | char in[50],post[50]; | 
| 1035 |  | strcpy(&in[0],"                                                 "); | 
| 1036 |  | strcpy(&in[0],ts->Data()); | 
| 1037 |  | strcpy(&post[0],"                                                 "); | 
| 1038 |  | if ( debug ) printf("Infix Expression is : ##%s##\n",&in[0]); | 
| 1039 |  | infix2postfix(&in[0],&post[0],1); | 
| 1040 |  | if ( debug ) printf("Postfix Expression is : ##%s##\n",&post[0]); | 
| 1041 |  | /* SAMPLE OUTPUT: | 
| 1042 |  | Enter Postfix Expression : 3 5 + 2 / | 
| 1043 |  | 3 5 + 2 / EQUALS 4 | 
| 1044 |  | */ | 
| 1045 |  | Float_t res = evaluate(&post[0]); | 
| 1046 |  | if ( debug ) printf("%s EQUALS %f\n",post,res); | 
| 1047 |  | return res; | 
| 1048 |  | } | 
| 1049 |  |  | 
| 1050 | void CaloLong::Fit(Bool_t draw){ | void CaloLong::Fit(Bool_t draw){ | 
| 1051 | // | // | 
| 1052 | Process(); | Process(); | 
| 1080 | gStyle->SetNdivisions(510,"XY"); | gStyle->SetNdivisions(510,"XY"); | 
| 1081 | }; | }; | 
| 1082 | // | // | 
| 1083 | TString hid = Form("clongfit"); | TString hid = Form("clongfit%s",suf.Data()); | 
| 1084 | TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); | TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); | 
| 1085 | //  if ( tc ) tc->Delete(); | //  if ( tc ) tc->Delete(); | 
| 1086 | //  if ( tc ) tc->Close(); | //  if ( tc ) tc->Close(); | 
| 1090 | if ( tc ) tc->cd(); | if ( tc ) tc->cd(); | 
| 1091 | }; | }; | 
| 1092 | // | // | 
| 1093 | TString thid = Form("hlongfit"); | TString thid = Form("hlongfit%s",suf.Data()); | 
| 1094 | TH1F *th  = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); | TH2F *th  = dynamic_cast<TH2F*>(gDirectory->FindObject(thid)); | 
| 1095 | if ( th ) th->Delete(); | if ( th ) th->Delete(); | 
| 1096 |  | // | 
| 1097 |  | TString ghid = Form("glongfit%s",suf.Data()); | 
| 1098 |  | TGraphErrors *gh  = dynamic_cast<TGraphErrors*>(gDirectory->FindObject(ghid)); | 
| 1099 |  | if ( gh ) gh->Delete(); | 
| 1100 |  | // | 
| 1101 | Float_t xpos = 0.; | Float_t xpos = 0.; | 
| 1102 | Float_t enemip = 0.; | Float_t enemip = 0.; | 
| 1103 | Float_t xmax = NC * X0pl + 0.2; | Float_t xmax = NC * X0pl + 0.2; | 
|  | //  th = new TH1F(thid,thid,int(NC*1.5),-0.2,xmax); |  | 
|  | th = new TH1F(thid,thid,100,-0.2,xmax); |  | 
| 1104 | // | // | 
| 1105 | for (Int_t st=N;st<(N+NC);st++){ | Double_t xxx[50]; | 
| 1106 |  | Double_t exx[50]; | 
| 1107 |  | Double_t yyy[50]; | 
| 1108 |  | Double_t eyy[50]; | 
| 1109 |  | Int_t numpo = 0; | 
| 1110 |  | memset(xxx,0,50*sizeof(Double_t)); | 
| 1111 |  | memset(exx,0,50*sizeof(Double_t)); | 
| 1112 |  | memset(yyy,0,50*sizeof(Double_t)); | 
| 1113 |  | memset(eyy,0,50*sizeof(Double_t)); | 
| 1114 |  | // | 
| 1115 |  | // AGH, BUG! | 
| 1116 |  | // | 
| 1117 |  | Int_t mmin = 0; | 
| 1118 |  | Int_t mmax = 0; | 
| 1119 |  | if ( cont ){ | 
| 1120 |  | mmin = N; | 
| 1121 |  | mmax = NC+N; | 
| 1122 |  | } else { | 
| 1123 |  | mmin = 0; | 
| 1124 |  | mmax = NC; | 
| 1125 |  | }; | 
| 1126 |  | // | 
| 1127 |  | Float_t emax = 0.; | 
| 1128 |  | Float_t qtotparz = 0.; | 
| 1129 |  | for (Int_t st=mmin;st<mmax+1;st++){ | 
| 1130 | enemip = 0.; | enemip = 0.; | 
| 1131 | xpos = (st - N) * X0pl; | xpos = (st - mmin) * X0pl; | 
| 1132 | if ( st > N && st < (N+NC-1) ){ | // | 
| 1133 | if ( no18x && ( st == 18+1 || st == mask18b+1 )){ | if ( xyaverage ){ | 
| 1134 | enemip = 2. * eplane[1][st]; | // | 
| 1135 |  | if ( st > mmin && st < mmax ){ | 
| 1136 |  | if ( no18x && ( st == 18+1 || st == mask18b+1 )){ | 
| 1137 |  | if ( !maskYO ){ | 
| 1138 |  | enemip = 2. * eplane[1][st]; | 
| 1139 |  | } else { | 
| 1140 |  | enemip = eplane[1][st]; | 
| 1141 |  | }; | 
| 1142 |  | } else { | 
| 1143 |  | enemip = eplane[0][st-1] + eplane[1][st]; | 
| 1144 |  | }; | 
| 1145 | } else { | } else { | 
| 1146 | enemip = eplane[0][st-1] + eplane[1][st]; | if ( st == mmin ){ | 
| 1147 |  | if ( !maskYE ){ | 
| 1148 |  | enemip = 2. * eplane[1][st]; | 
| 1149 |  | } else { | 
| 1150 |  | enemip = eplane[1][st]; | 
| 1151 |  | }; | 
| 1152 |  | }; | 
| 1153 |  | if ( st == mmax ){ | 
| 1154 |  | if ( !maskXE ){ | 
| 1155 |  | enemip = 2. * eplane[0][st-1]; | 
| 1156 |  | } else { | 
| 1157 |  | enemip = eplane[0][st-1]; | 
| 1158 |  | }; | 
| 1159 |  | }; | 
| 1160 |  | }; | 
| 1161 |  | // | 
| 1162 |  | qtotparz += enemip; | 
| 1163 |  | if ( enemip > emax ) emax = enemip; | 
| 1164 |  | if ( enemip > 0. ){ | 
| 1165 |  | xxx[numpo] = xpos; | 
| 1166 |  | exx[numpo] = 0.1; | 
| 1167 |  | yyy[numpo] = enemip; | 
| 1168 |  | 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++; | 
| 1175 |  | //      th->Fill(xpos,enemip); | 
| 1176 |  | 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 | if ( st == N ) enemip = 2. * eplane[1][st]; | for (Int_t jj=0; jj<2; jj++){ | 
| 1180 | if ( st == (N+NC-1) ) enemip = 2. * eplane[0][st]; | if ( st > mmin && st < mmax ){ | 
| 1181 | }; | if ( jj == 0 && no18x && ( st == 18+1 || st == mask18b+1 )){ | 
| 1182 | // | enemip = eplane[1][st]; | 
| 1183 | if ( enemip > 0. ){ | } else { | 
| 1184 | th->Fill(xpos,enemip); | if ( jj == 0 ){ | 
| 1185 | if ( debug ) printf(" Filling: st %i xpos %f energy %f \n",st,xpos,enemip); | enemip = eplane[jj][st-1]; | 
| 1186 |  | } else { | 
| 1187 |  | enemip = eplane[jj][st]; | 
| 1188 |  | }; | 
| 1189 |  | }; | 
| 1190 |  | } else { | 
| 1191 |  | if ( st == mmin && jj == 1 ){ | 
| 1192 |  | enemip = eplane[jj][st]; | 
| 1193 |  | }; | 
| 1194 |  | if ( st == mmax && jj == 0){ | 
| 1195 |  | enemip = eplane[jj][st-1]; | 
| 1196 |  | }; | 
| 1197 |  | }; | 
| 1198 |  | // | 
| 1199 |  | qtotparz += enemip; | 
| 1200 |  | if ( enemip > emax ) emax = enemip; | 
| 1201 |  | if ( enemip > 0. ){ | 
| 1202 |  | xxx[numpo] = xpos; | 
| 1203 |  | exx[numpo] = 0.1; | 
| 1204 |  | yyy[numpo] = enemip; | 
| 1205 |  | 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); | 
| 1208 |  | numpo++; | 
| 1209 |  | //      th->Fill(xpos,enemip); | 
| 1210 |  | if ( debug ) printf(" XY Filling: st %i xpos %f energy %f \n",st,xpos,enemip); | 
| 1211 |  | }; | 
| 1212 |  | }; | 
| 1213 | }; | }; | 
| 1214 |  |  | 
| 1215 | // | // | 
| 1216 | //    for (Int_t v=1; v>=0;v--)// { | //    for (Int_t v=1; v>=0;v--)// { | 
| 1217 | //       // | //       // | 
| 1237 | //     }; | //     }; | 
| 1238 | }; | }; | 
| 1239 | // | // | 
| 1240 | TF1 *lfit = new TF1("lfit",ccurve,0.,xmax,3); | //  th = new TH2F(thid,thid,int(NC*1.5),-0.2,xmax); | 
| 1241 | E0 = L2->GetCaloLevel2()->qtot; | th = new TH2F(thid,thid,1000,-0.2,xmax,1000,0.,emax*1.2); | 
| 1242 |  | gh = new TGraphErrors(numpo,xxx,yyy,exx,eyy); | 
| 1243 |  | TString fnam=Form("lfit%s",suf.Data()); | 
| 1244 |  | TF1 *lfit  = dynamic_cast<TF1*>(gDirectory->FindObject(fnam)); | 
| 1245 |  | if ( lfit ) lfit->Delete(); | 
| 1246 |  | 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); | 
| 1256 |  | E0 = qtotparz; | 
| 1257 |  | //  E0 = clp->qtot; | 
| 1258 | a = 5.; | a = 5.; | 
| 1259 | b = 0.5; | b = 0.5; | 
| 1260 | 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); | 
| 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; | // TString optio = "ROW"; // "RO" | 
| 1266 |  | TString optio = "RO"; // "RO" | 
| 1267 | if ( debug ){ | if ( debug ){ | 
| 1268 | //    optio = "MERBOV"; | optio += "NV"; | 
| 1269 | //    optio = "MEROV"; | if ( draw ) optio += "V"; | 
|  | //    optio = "EROV"; |  | 
|  | optio = "RNOV"; |  | 
|  | if ( draw ) optio = "ROV"; |  | 
| 1270 | } else { | } else { | 
| 1271 | //    optio = "MERNOQ"; | optio += "NQ"; | 
| 1272 | //    optio = "ERNOQ"; | if ( draw ) optio += "Q"; | 
|  | optio = "RNOQ"; |  | 
|  | if ( draw ) optio = "ROQ"; |  | 
| 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); | 
| 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 | // | // | 
| 1296 | if ( fitresult != 0 ){ | if ( fitresult != 0 ){ | 
| 1297 | 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"); | 
| 1298 | asymm = -1.; | asymm = -1.; | 
| 1299 |  | defE0 = -1.; | 
| 1300 | } else { | } else { | 
| 1301 |  | if ( slmax.MaybeRegexp() ) lmax = this->Evaluate(slmax,tmax,X0pl); | 
| 1302 |  | if ( sumax.MaybeRegexp() ) umax = this->Evaluate(sumax,tmax,X0pl); | 
| 1303 | Int_t npp = 1000; | Int_t npp = 1000; | 
| 1304 |  | double *xpp=new double[npp]; | 
| 1305 |  | double *wpp=new double[npp]; | 
| 1306 |  | lfit->CalcGaussLegendreSamplingPoints(npp,xpp,wpp,1e-12); | 
| 1307 |  | defE0 = lfit->IntegralFast(npp,xpp,wpp,lmax,umax); | 
| 1308 |  | // | 
| 1309 | double *xp=new double[npp]; | double *xp=new double[npp]; | 
| 1310 | double *wp=new double[npp]; | double *wp=new double[npp]; | 
| 1311 | lfit->CalcGaussLegendreSamplingPoints(npp,xp,wp,1e-12); | lfit->CalcGaussLegendreSamplingPoints(npp,xp,wp,1e-12); | 
| 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 | // | // | 
| 1332 | if ( debug ) printf(" i10max == imax, asymm undefined\n"); | if ( debug ) printf(" i10max == imax, asymm undefined\n"); | 
| 1333 | asymm = -2.; | asymm = -2.; | 
| 1334 | }; | }; | 
| 1335 |  | if ( asymm != asymm ){ | 
| 1336 |  | if ( debug ) printf(" asymm is nan \n"); | 
| 1337 |  | asymm = -3.; | 
| 1338 |  | }; | 
| 1339 | //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)); | 
| 1340 | if ( debug ) printf(" Asymmetry has been calculated \n"); | if ( debug ) printf(" Asymmetry has been calculated \n"); | 
| 1341 | }; | }; | 
| 1342 | // | // | 
| 1343 |  | if ( asymm < 0. || ndf <= 0. || chi2 < 0. || tmax < 0. ){ | 
| 1344 |  | if ( debug ) printf(" Funny asymm||ndf||chi2||tmax values, fit failed \n"); | 
| 1345 |  | fitresult = 100; | 
| 1346 |  | }; | 
| 1347 |  | // | 
| 1348 | if ( draw ){ | if ( draw ){ | 
| 1349 | // | // | 
| 1350 | tc->cd(); | tc->cd(); | 
| 1356 | // axis titles | // axis titles | 
| 1357 | th->SetXTitle("Depth [X0]"); | th->SetXTitle("Depth [X0]"); | 
| 1358 | th->SetYTitle("Energy [MIP]"); | th->SetYTitle("Energy [MIP]"); | 
| 1359 | th->DrawCopy("Perror"); | //    th->DrawCopy("Perror"); | 
| 1360 |  | th->DrawCopy(); | 
| 1361 |  | gh->SetMarkerSize(1.); | 
| 1362 |  | gh->SetMarkerStyle(21); | 
| 1363 |  | //    gh->SetMarkerColor(kRed); | 
| 1364 |  | gh->Draw("Psame"); | 
| 1365 | lfit->Draw("same"); | lfit->Draw("same"); | 
| 1366 | tc->Modified(); | tc->Modified(); | 
| 1367 | tc->Update(); | tc->Update(); | 
| 1369 | gStyle->SetLabelSize(0); | gStyle->SetLabelSize(0); | 
| 1370 | gStyle->SetNdivisions(1,"XY"); | gStyle->SetNdivisions(1,"XY"); | 
| 1371 | // | // | 
| 1372 |  | } else { | 
| 1373 |  | if ( th ) th->Delete(); | 
| 1374 | }; | }; | 
| 1375 | // | // | 
| 1376 | delete lfit; | //   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; | 
| 1386 | // | // | 
| 1387 | }; | }; | 
| 1388 |  |  | 
| 1411 | // | // | 
| 1412 | if ( maxv != -1 ){ | if ( maxv != -1 ){ | 
| 1413 | for (Int_t v=minv; v<maxv;v++){ | for (Int_t v=minv; v<maxv;v++){ | 
| 1414 | TString hid = Form("clongv%i",v); | TString hid = Form("clongv%i%s",v,suf.Data()); | 
| 1415 | TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); | TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); | 
| 1416 | if ( tc ){ | if ( tc ){ | 
| 1417 | //       tc->Clear(); | //       tc->Clear(); | 
| 1419 | tc = new TCanvas(hid,hid); | tc = new TCanvas(hid,hid); | 
| 1420 | }; | }; | 
| 1421 | // | // | 
| 1422 | TString thid = Form("hlongv%i",v); | TString thid = Form("hlongv%i%s",v,suf.Data()); | 
| 1423 | TH1F *th  = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); | TH1F *th  = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); | 
| 1424 | if ( th ) th->Delete(); | if ( th ) th->Delete(); | 
| 1425 | //         th->Clear(); | //         th->Clear(); | 
| 1438 | }; | }; | 
| 1439 | } else { | } else { | 
| 1440 | // | // | 
| 1441 | TString hid = Form("clongvyvx"); | TString hid = Form("clongvyvx%s",suf.Data()); | 
| 1442 | TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); | TCanvas *tc  = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); | 
| 1443 | if ( tc ){ | if ( tc ){ | 
| 1444 | } else { | } else { | 
| 1445 | tc = new TCanvas(hid,hid); | tc = new TCanvas(hid,hid); | 
| 1446 | }; | }; | 
| 1447 | // | // | 
| 1448 | TString thid = Form("hlongvyvx"); | TString thid = Form("hlongvyvx%s",suf.Data()); | 
| 1449 | TH1F *th  = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); | TH1F *th  = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); | 
| 1450 | if ( th ) th->Delete(); | if ( th ) th->Delete(); | 
| 1451 | th = new TH1F(thid,thid,44,-0.5,43.5); | th = new TH1F(thid,thid,44,-0.5,43.5); | 
| 1473 | Clear(); | Clear(); | 
| 1474 | //delete this; | //delete this; | 
| 1475 | }; | }; | 
| 1476 |  |  | 
| 1477 |  |  | 
| 1478 |  |  | 
| 1479 |  |  | 
| 1480 |  |  | 
| 1481 |  |  | 
| 1482 |  |  | 
| 1483 |  |  | 
| 1484 |  |  | 
| 1485 |  |  | 
| 1486 |  |  | 
| 1487 |  |  | 
| 1488 |  |  | 
| 1489 |  |  | 
| 1490 |  |  | 
| 1491 |  |  | 
| 1492 |  |  | 
| 1493 |  |  | 
| 1494 |  |  | 
| 1495 |  |  |