00001
00002
00003
00004
00005
00006
00007
00008
00010
00011 #ifndef __TMARJETCAL
00012 #include "Marana/TMarJetCal.h"
00013 #endif
00014
00015 #define MARJETCALDEBUG 0
00016
00017
00018
00019
00020
00021
00022 TMarJetCal::TMarJetCal()
00023 {
00024 for(Int_t i=0;i<NBTHETABINS;i++) {
00025 fStep1Coef[i].val=1.;
00026 fStep2CoefData[i].val[0]=1.;
00027 fStep2CoefData[i].val[1]=0.;
00028 fStep2CoefData[i].val[2]=0.0000001;
00029 fStep2CoefMC[i].val[0]=1.;
00030 fStep2CoefMC[i].val[1]=0.;
00031 fStep2CoefMC[i].val[2]=0.0000001;
00032 }
00033
00034 }
00035
00036
00037 TMarJetCal::TMarJetCal(Char_t *FileStep1,Char_t *FileStep2Data,Char_t *FileStep2MC)
00038 {
00040
00042
00043
00044 for(Int_t i=0;i<NBTHETABINS;i++) {
00045 fStep1Coef[i].val=1.;
00046 fStep2CoefData[i].val[0]=1.;
00047 fStep2CoefData[i].val[1]=0.;
00048 fStep2CoefData[i].val[2]=0.0000001;
00049 fStep2CoefMC[i].val[0]=1.;
00050 fStep2CoefMC[i].val[1]=0.;
00051 fStep2CoefMC[i].val[2]=0.0000001;
00052 }
00053
00054 printf(">>> JetCalibration from %s ... \n",FileStep1);
00055
00056 ifstream in(FileStep1,ios::in);
00057 if(!in) {
00058 cerr<<">> MarJetCal : File "<<FileStep1<<" for step 1 not found"<<endl;
00059 return;
00060 }
00061 Int_t ientries=0;
00062 while(1) {
00063 in >> fStep1Coef[ientries].min >> fStep1Coef[ientries].max >> fStep1Coef[ientries].val;
00064 printf("%f < Theta < %f : %f \n",fStep1Coef[ientries].min,fStep1Coef[ientries].max,fStep1Coef[ientries].val);
00065 if (!in.good()||ientries>=NBTHETABINS) break;
00066 ientries++;
00067 }
00068 in.close();
00069
00070
00071 printf(">>> JetCalibration from %s ... \n",FileStep2Data);
00072 ifstream in2d(FileStep2Data,ios::in);
00073 if(!in2d) {
00074 cerr<<">> MarJetCal : File "<<FileStep2Data<<" for step 2 not found"<<endl;
00075 return;
00076 }
00077 ientries=0;
00078 while(1) {
00079 in2d >> fStep2CoefData[ientries].min >> fStep2CoefData[ientries].max
00080 >> fStep2CoefData[ientries].val[0] >> fStep2CoefData[ientries].val[1]
00081 >> fStep2CoefData[ientries].val[2];
00082 printf("%f < Theta < %f : A=%f B=%f C=%f D=%f E=%f\n",fStep2CoefData[ientries].min,fStep2CoefData[ientries].max,
00083 fStep2CoefData[ientries].val[0],fStep2CoefData[ientries].val[1],fStep2CoefData[ientries].val[2]);
00084 if (!in2d.good()||ientries>=NBTHETABINS) break;
00085 ientries++;
00086 }
00087 in2d.close();
00088
00089
00090 printf(">>> JetCalibration from %s ... \n",FileStep2MC);
00091 ifstream in2mc(FileStep2MC,ios::in);
00092 if(!in2mc) {
00093 cerr<<">> MarJetCal : File "<<FileStep2Data<<" for step 2 not found"<<endl;
00094 return;
00095 }
00096 ientries=0;
00097 while(1) {
00098 in2mc >> fStep2CoefMC[ientries].min >> fStep2CoefMC[ientries].max
00099 >> fStep2CoefMC[ientries].val[0] >> fStep2CoefMC[ientries].val[1]
00100 >> fStep2CoefMC[ientries].val[2] ;
00101 printf("%f < Theta < %f : A=%f B=%f C=%f D=%f E=%f\n",fStep2CoefMC[ientries].min,fStep2CoefMC[ientries].max,
00102 fStep2CoefMC[ientries].val[0],fStep2CoefMC[ientries].val[1],fStep2CoefMC[ientries].val[2]
00103 ,fStep2CoefMC[ientries].val[3],fStep2CoefMC[ientries].val[4],fStep2CoefMC[ientries].val[5]);
00104 if (!in2mc.good()||ientries>=NBTHETABINS) break;
00105 ientries++;
00106 }
00107 in2mc.close();
00108
00109 }
00110
00111
00112 TMarJetCal::TMarJetCal(Char_t *FileStep2Data,Char_t *FileStep2MC)
00113 {
00115
00117
00118
00119 for(Int_t i=0;i<NBTHETABINS;i++) {
00120 fStep2CoefData[i].val[0]=1.;
00121 fStep2CoefData[i].val[1]=1.;
00122 fStep2CoefData[i].val[2]=10.;
00123 fStep2CoefMC[i].val[0]=1.;
00124 fStep2CoefMC[i].val[1]=1.;
00125 fStep2CoefMC[i].val[2]=10.;
00126 }
00127
00128 printf(">>> JetCalibration from %s ... \n",FileStep2Data);
00129
00130 ifstream in2d(FileStep2Data,ios::in);
00131 if(!in2d) {
00132 cerr<<">> MarJetCal : File "<<FileStep2Data<<" for step 2 not found"<<endl;
00133 return;
00134 }
00135 Int_t ientries=0;
00136 while(1) {
00137 in2d >> fStep2CoefData[ientries].min >> fStep2CoefData[ientries].max
00138 >> fStep2CoefData[ientries].val[0] >> fStep2CoefData[ientries].val[1]
00139 >> fStep2CoefData[ientries].val[2];
00140 printf("%f < Theta < %f : A=%f B=%f C=%f\n",fStep2CoefData[ientries].min,fStep2CoefData[ientries].max,
00141 fStep2CoefData[ientries].val[0],fStep2CoefData[ientries].val[1],fStep2CoefData[ientries].val[2]);
00142 if (!in2d.good()||ientries>=NBTHETABINS) break;
00143 ientries++;
00144 }
00145 in2d.close();
00146
00147
00148 printf(">>> JetCalibration from %s ... \n",FileStep2MC);
00149 ifstream in2mc(FileStep2MC,ios::in);
00150 if(!in2mc) {
00151 cerr<<">> MarJetCal : File "<<FileStep2Data<<" for step 2 not found"<<endl;
00152 return;
00153 }
00154 ientries=0;
00155 while(1) {
00156 in2mc >> fStep2CoefMC[ientries].min >> fStep2CoefMC[ientries].max
00157 >> fStep2CoefMC[ientries].val[0] >> fStep2CoefMC[ientries].val[1]
00158 >> fStep2CoefMC[ientries].val[2] ;
00159 printf("%f < Theta < %f : A=%f B=%f C=%f\n",fStep2CoefMC[ientries].min,fStep2CoefMC[ientries].max,
00160 fStep2CoefMC[ientries].val[0],fStep2CoefMC[ientries].val[1],fStep2CoefMC[ientries].val[2]);
00161 if (!in2mc.good()||ientries>=NBTHETABINS) break;
00162 ientries++;
00163 }
00164 in2mc.close();
00165
00166 }
00167
00168
00169
00170 TMarJetCal::TMarJetCal(Char_t *FileStep2Data,Char_t *FileStep2MC,Char_t *FileStep2DataRatio, Char_t *FileStep2MCRatio)
00171 {
00173
00175
00176
00177 for(Int_t i=0;i<NBTHETABINS;i++) {
00178 fStep2CoefData[i].val[0]=1.;
00179 fStep2CoefData[i].val[1]=1.;
00180 fStep2CoefData[i].val[2]=10.;
00181 fStep2CoefMC[i].val[0]=1.;
00182 fStep2CoefMC[i].val[1]=1.;
00183 fStep2CoefMC[i].val[2]=10.;
00184 fStep2CoefDataRatio[i].val[0]=1.;
00185 fStep2CoefDataRatio[i].val[1]=1.;
00186 fStep2CoefDataRatio[i].val[2]=10.;
00187 fStep2CoefMCRatio[i].val[0]=1.;
00188 fStep2CoefMCRatio[i].val[1]=1.;
00189 fStep2CoefMCRatio[i].val[2]=10.;
00190 }
00191
00192 printf(">>> JetCalibration from %s ... \n",FileStep2Data);
00193
00194 ifstream in2d(FileStep2Data,ios::in);
00195 if(!in2d) {
00196 cerr<<">> MarJetCal : File "<<FileStep2Data<<" for step 2 not found"<<endl;
00197 return;
00198 }
00199 Int_t ientries=0;
00200
00201 while(1) {
00202
00203 in2d >> fStep2CoefData[ientries].min >> fStep2CoefData[ientries].max
00204 >> fStep2CoefData[ientries].val[0] >> fStep2CoefData[ientries].val[1]
00205 >> fStep2CoefData[ientries].val[2];
00206 printf("%f < Theta < %f : A=%f B=%f C=%f\n",fStep2CoefData[ientries].min,fStep2CoefData[ientries].max,
00207 fStep2CoefData[ientries].val[0],fStep2CoefData[ientries].val[1],fStep2CoefData[ientries].val[2]);
00208
00209 ientries++;
00210 if (!in2d.good()||ientries>=NBTHETABINS) break;
00211
00212 }
00213 in2d.close();
00214
00215 printf(">>> JetCalibration from %s ... \n",FileStep2DataRatio);
00216
00217 ifstream in2dratio(FileStep2DataRatio,ios::in);
00218 if(!in2dratio) {
00219 cerr<<">> MarJetCal : File "<<FileStep2DataRatio<<" for step 2 not found"<<endl;
00220 return;
00221 }
00222 Int_t ientries2=0;
00223 while(1) {
00224 in2dratio >> fStep2CoefDataRatio[ientries2].min >> fStep2CoefDataRatio[ientries2].max
00225 >> fStep2CoefDataRatio[ientries2].val[0] >> fStep2CoefDataRatio[ientries2].val[1]
00226 >> fStep2CoefDataRatio[ientries2].val[2];
00227 printf("%f < Theta < %f : A=%f B=%f C=%f\n",fStep2CoefDataRatio[ientries2].min,fStep2CoefDataRatio[ientries2].max,
00228 fStep2CoefDataRatio[ientries2].val[0],fStep2CoefDataRatio[ientries2].val[1],fStep2CoefDataRatio[ientries2].val[2]);
00229 ientries2++;
00230 if (!in2dratio.good()||ientries2>=NBTHETABINS) break;
00231
00232 }
00233 in2dratio.close();
00234
00235
00236
00237
00238 printf(">>> JetCalibration from %s ... \n",FileStep2MC);
00239 ifstream in2mc(FileStep2MC,ios::in);
00240 if(!in2mc) {
00241 cerr<<">> MarJetCal : File "<<FileStep2Data<<" for step 2 not found"<<endl;
00242 return;
00243 }
00244 ientries=0;
00245 while(1) {
00246 in2mc >> fStep2CoefMC[ientries].min >> fStep2CoefMC[ientries].max
00247 >> fStep2CoefMC[ientries].val[0] >> fStep2CoefMC[ientries].val[1]
00248 >> fStep2CoefMC[ientries].val[2] ;
00249 printf("%f < Theta < %f : A=%f B=%f C=%f\n",fStep2CoefMC[ientries].min,fStep2CoefMC[ientries].max,
00250 fStep2CoefMC[ientries].val[0],fStep2CoefMC[ientries].val[1],fStep2CoefMC[ientries].val[2]);
00251 ientries++;
00252 if (!in2mc.good()||ientries>=NBTHETABINS) break;
00253
00254 }
00255 in2mc.close();
00256
00257 printf(">>> JetCalibration from %s ... \n",FileStep2MCRatio);
00258 ifstream in2mcratio(FileStep2MCRatio,ios::in);
00259 if(!in2mcratio) {
00260 cerr<<">> MarJetCal : File "<<FileStep2Data<<" for step 2 not found"<<endl;
00261 return;
00262 }
00263 ientries=0;
00264 while(1) {
00265 in2mcratio >> fStep2CoefMCRatio[ientries].min >> fStep2CoefMCRatio[ientries].max
00266 >> fStep2CoefMCRatio[ientries].val[0] >> fStep2CoefMCRatio[ientries].val[1]
00267 >> fStep2CoefMCRatio[ientries].val[2] ;
00268 printf("%f < Theta < %f : A=%f B=%f C=%f\n",fStep2CoefMCRatio[ientries].min,fStep2CoefMCRatio[ientries].max,
00269 fStep2CoefMCRatio[ientries].val[0],fStep2CoefMCRatio[ientries].val[1],fStep2CoefMCRatio[ientries].val[2]);
00270 ientries++;
00271 if (!in2mcratio.good()||ientries>=NBTHETABINS) break;
00272
00273 }
00274 in2mcratio.close();
00275
00276 }
00277
00278
00279
00280 TMarJetCal::~TMarJetCal()
00281 {
00282
00283 };
00284
00285
00286
00287
00288 Float_t TMarJetCal::ApplyCalib(Float_t Ptjetnocal,Float_t Thetajet,Int_t MCFlag,Int_t option=2)
00289 {
00291
00292
00294
00295 Float_t Ptjet=Ptjetnocal;
00296
00297 if(option==0) return Ptjet;
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310 if(option!=2) return Ptjet;
00311 if(Ptjet<5||Thetajet*MYR2D>155) return Ptjet;
00312 Float_t A=0,B=0,C=0;
00313 Float_t factor=0;
00314
00315 for(Int_t j=0;j<1;j++) {
00316 if(MCFlag==0) {
00317 for(Int_t i=0;i<NBTHETABINS;i++) {
00318 if(Thetajet*MYR2D>fStep2CoefData[i].min&&Thetajet*MYR2D<=fStep2CoefData[i].max) {
00319 A=fStep2CoefData[i].val[0];
00320 B=fStep2CoefData[i].val[1];
00321 C=fStep2CoefData[i].val[2];
00322
00323 factor=1;
00324 break;
00325 }
00326 }
00327 }else{
00328 for(Int_t i=0;i<NBTHETABINS;i++) {
00329 if(Thetajet*MYR2D>fStep2CoefMC[i].min&&Thetajet*MYR2D<=fStep2CoefMC[i].max) {
00330 A=fStep2CoefMC[i].val[0];
00331 B=fStep2CoefMC[i].val[1];
00332 C=fStep2CoefMC[i].val[2];
00333 factor=1;
00334 break;
00335 }
00336 }
00337 }
00338 if(factor==1) {
00339 Float_t Ptjetcor=Ptjet;
00340
00341
00342 if (A !=0. && C !=0.) factor=A*(1-exp(-B-Ptjetcor/C));
00343 if(factor) Ptjet/=factor;
00344
00345 }
00346
00347
00348 }
00349
00350 return Ptjet;
00351
00352 }
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547 TLorentzVector TMarJetCal::ApplyHadroo2Calib(TLorentzVector tracks,TLorentzVector clusters,Float_t Thetajet,Short_t MCFlag)
00548 {
00550
00551
00553 TLorentzVector hadrons=tracks+clusters;
00554 TLorentzVector calib(0.,0.,0.,0.);
00555
00556 Float_t Ptjet=hadrons.Pt();
00557
00558
00559
00560
00561 if(Ptjet<5||Thetajet*MYR2D>155||Thetajet*MYR2D<7) {
00562
00563 return hadrons;
00564
00565 }
00566 Float_t A=0,B=0,C=0,D=0,E=0,F=0;
00567 Float_t factor=0;
00568
00569
00570
00571
00572
00573
00574
00575 if(MCFlag==0) {
00576 for(Int_t i=0;i<NBTHETABINS;i++) {
00577 if(Thetajet*MYR2D>fStep2CoefData[i].min&&Thetajet*MYR2D<=fStep2CoefData[i].max) {
00578 A=fStep2CoefData[i].val[0];
00579
00580 B=fStep2CoefData[i].val[1];
00581 C=fStep2CoefData[i].val[2];
00582 D=fStep2CoefDataRatio[i].val[0];
00583 E=fStep2CoefDataRatio[i].val[1];
00584 F=fStep2CoefDataRatio[i].val[2];
00585 factor=1;
00586 break;
00587 }
00588 }
00589 }else{
00590 for(Int_t i=0;i<NBTHETABINS;i++) {
00591 if(Thetajet*MYR2D>fStep2CoefMC[i].min&&Thetajet*MYR2D<=fStep2CoefMC[i].max) {
00592 A=fStep2CoefMC[i].val[0];
00593
00594 B=fStep2CoefMC[i].val[1];
00595 C=fStep2CoefMC[i].val[2];
00596 D=fStep2CoefMCRatio[i].val[0];
00597 E=fStep2CoefMCRatio[i].val[1];
00598 F=fStep2CoefMCRatio[i].val[2];
00599
00600 factor=1;
00601 break;
00602 }
00603 }
00604 }
00605
00606
00607
00608 Float_t Ptjetcor=Ptjet;
00609
00610
00611 Float_t Fptbal,Fc;
00612
00613 Fptbal=A*(1-exp(-B-Ptjetcor/C));
00614 if (Thetajet*MYR2D<30) {
00615 Fc=D*(1-exp(-E-Ptjetcor/F));
00616 }else{
00617 Fc=D*(1+exp(-E+Ptjetcor/F));
00618 }
00619
00620
00621
00622
00623 factor=1/Fptbal;
00624 Ptjetcor=(factor*(tracks+clusters)).Pt();
00625
00626 Fptbal=A*(1-exp(-B-Ptjetcor/C));
00627 if (Thetajet*MYR2D<30) {
00628 Fc=D*(1-exp(-E-Ptjetcor/F));
00629 }else{
00630 Fc=D*(1+exp(-E+Ptjetcor/F));
00631 }
00632
00633
00634
00635
00636
00637
00638 factor=1/Fptbal;
00639
00640 hadrons=(tracks+clusters)*factor;
00641
00642
00643
00644
00645
00646
00647
00648 calib=hadrons;
00649
00650
00651
00652 return calib;
00653
00654
00655 }
00656
00657
00658
00659
00660
00661
00662
00663 TLorentzVector TMarJetCal::MyHadroo2KtJetCalibration(H1PartJet* UncalJet,Short_t MCFlag)
00664 {
00665
00666
00667
00668
00669
00670
00671 if(UncalJet->GetPt()<4.
00672 ||UncalJet->GetTheta()*MYR2D>155
00673 ||UncalJet->GetTheta()*MYR2D<7) {
00674 return UncalJet->GetFourVector();
00675 }
00676
00677 Double_t Thetajet=UncalJet->GetTheta();
00678
00679 Float_t A=0,B=0,C=0,D=0,E=0,F=0;
00680 Float_t factor=0;
00681 if(MCFlag==0) {
00682 for(Int_t i=0;i<NBTHETABINS;i++) {
00683 if(Thetajet*MYR2D>fStep2CoefData[i].min&&Thetajet*MYR2D<=fStep2CoefData[i].max) {
00684 A=fStep2CoefData[i].val[0];
00685
00686 B=fStep2CoefData[i].val[1];
00687 C=fStep2CoefData[i].val[2];
00688 D=fStep2CoefDataRatio[i].val[0];
00689 E=fStep2CoefDataRatio[i].val[1];
00690 F=fStep2CoefDataRatio[i].val[2];
00691 factor=1;
00692 break;
00693 }
00694 }
00695 }else{
00696 for(Int_t i=0;i<NBTHETABINS;i++) {
00697 if(Thetajet*MYR2D>fStep2CoefMC[i].min&&Thetajet*MYR2D<=fStep2CoefMC[i].max) {
00698 A=fStep2CoefMC[i].val[0];
00699
00700 B=fStep2CoefMC[i].val[1];
00701 C=fStep2CoefMC[i].val[2];
00702 D=fStep2CoefMCRatio[i].val[0];
00703 E=fStep2CoefMCRatio[i].val[1];
00704 F=fStep2CoefMCRatio[i].val[2];
00705
00706 factor=1;
00707 break;
00708 }
00709 }
00710 }
00711
00712
00713
00714 Float_t Ptjetcor=UncalJet->GetPt();
00715 Float_t Fptbal;
00716 Float_t Fc;
00717
00718 Fptbal=A*(1-exp(-B-Ptjetcor/C));
00719 const TObjArray *JetParticles = UncalJet->GetParticles();
00720 Int_t NumParticles = JetParticles->GetEntriesFast();
00721 TLorentzVector tracks(0,0,0,0),clusters(0,0,0,0);
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739 for (Int_t ipart=0 ; ipart<NumParticles ; ipart++){
00740 const H1PartCand *jetpartcand = UncalJet->GetPartCand(ipart);
00741 if(!jetpartcand->IsSelTrack()){
00742 clusters+=jetpartcand->GetFourVector();
00743 } else {
00744 tracks+=jetpartcand->GetFourVector();
00745 }
00746
00747 }
00748 Fc=clusters.Pt()/(tracks.Pt()+clusters.Pt());
00749 factor=(1+Fptbal*(Fc-1))/(Fptbal*Fc);
00750 Ptjetcor=tracks.Pt()+factor*(clusters.Pt());
00751
00752
00753
00754 Fptbal=A*(1-exp(-B-Ptjetcor/C));
00755
00756
00757
00758
00759
00760 factor=(1+Fptbal*(Fc-1))/(Fptbal*Fc);
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770 TLorentzVector *jetpart4vect= new TLorentzVector[NumParticles];
00771
00772
00773
00774 for (Int_t ipart=0 ; ipart<NumParticles ; ipart++){
00775 const H1PartCand *jetpartcand = UncalJet->GetPartCand(ipart);
00776 Double_t pt=jetpartcand->GetPt();
00777 Double_t E=jetpartcand->GetE();
00778 Double_t eta=jetpartcand->GetEta();
00779 Double_t phi=jetpartcand->GetPhi();
00780
00781 if(!jetpartcand->IsSelTrack()){
00782 pt*=factor;
00783 E*=factor;
00784 }
00785 jetpart4vect[ipart].SetPtEtaPhiE(pt,eta,phi,E);
00786
00787 }
00788
00789
00790
00791 TLorentzVector CalJet(0,0,0,0);
00792
00793 Double_t Ptcal=0;
00794 Double_t Etacal=0;
00795 Double_t Phical=0;
00796
00797
00798 Double_t Pt1=0;
00799 Double_t Eta1=0;
00800 Double_t Phi1=0;
00801
00802
00803 Double_t Pt2=0;
00804 Double_t Eta2=0;
00805 Double_t Phi2=0;
00806
00807
00808
00809 for (Int_t i=0 ; i<NumParticles ; i++ ) {
00810 Pt1=Ptcal;
00811 Eta1=Etacal;
00812 Phi1=Phical;
00813
00814 Pt2 =jetpart4vect[i].Pt();
00815 Eta2=jetpart4vect[i].Eta();
00816 Phi2=jetpart4vect[i].Phi();
00817
00818 Ptcal=Pt1+Pt2;
00819 Etacal=(Eta1*Pt1+Eta2*Pt2)/(Pt1+Pt2);
00820 Phical=(Phi1*Pt1+Phi2*Pt2)/(Pt1+Pt2);
00821 }
00822
00823 CalJet.SetPtEtaPhiM(Ptcal,Etacal,Phical,0.);
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833 return CalJet;
00834
00835 }
00836
00837
00838
00839 TLorentzVector TMarJetCal::MyHadroo2TestJetCalibration(H1PartJet* UncalJet,Short_t MCFlag)
00840 {
00841
00842
00843
00844
00845
00846 if(UncalJet->GetPt()<5
00847 ||UncalJet->GetTheta()*MYR2D>157
00848 ||UncalJet->GetTheta()*MYR2D<6) {
00849 return UncalJet->GetFourVector();
00850 }
00851
00852 Double_t Thetajet=UncalJet->GetTheta();
00853
00854 Float_t A=0,B=0,C=0,D=0,E=0,F=0;
00855 Float_t factor=0;
00856 if(MCFlag==0) {
00857 for(Int_t i=0;i<NBTHETABINS;i++) {
00858 if(Thetajet*MYR2D>fStep2CoefData[i].min&&Thetajet*MYR2D<=fStep2CoefData[i].max) {
00859 A=fStep2CoefData[i].val[0];
00860
00861 B=fStep2CoefData[i].val[1];
00862 C=fStep2CoefData[i].val[2];
00863 D=fStep2CoefDataRatio[i].val[0];
00864 E=fStep2CoefDataRatio[i].val[1];
00865 F=fStep2CoefDataRatio[i].val[2];
00866 factor=1;
00867 break;
00868 }
00869 }
00870 }else{
00871 for(Int_t i=0;i<NBTHETABINS;i++) {
00872 if(Thetajet*MYR2D>fStep2CoefMC[i].min&&Thetajet*MYR2D<=fStep2CoefMC[i].max) {
00873 A=fStep2CoefMC[i].val[0];
00874
00875 B=fStep2CoefMC[i].val[1];
00876 C=fStep2CoefMC[i].val[2];
00877 D=fStep2CoefMCRatio[i].val[0];
00878 E=fStep2CoefMCRatio[i].val[1];
00879 F=fStep2CoefMCRatio[i].val[2];
00880
00881 factor=1;
00882 break;
00883 }
00884 }
00885 }
00886
00887
00888
00889 Float_t Ptjetcor=UncalJet->GetPt();
00890 Float_t Fptbal;
00891
00892 Fptbal=A*(1-exp(-B-Ptjetcor/C));
00893
00894 Ptjetcor/=Fptbal;
00895
00896 Fptbal=A*(1-exp(-B-Ptjetcor/C));
00897
00898
00899
00900 TLorentzVector CalJet(0,0,0,0);
00901 Double_t Ecal=0;
00902 Double_t Pxcal=0;
00903 Double_t Pycal=0;
00904 Double_t Pzcal=0;
00905
00906 Ecal=UncalJet->GetE()/Fptbal;
00907 Pxcal=UncalJet->GetPx()/Fptbal;
00908 Pycal=UncalJet->GetPy()/Fptbal;
00909 Pzcal=UncalJet->GetPz()/Fptbal;
00910
00911 CalJet.SetPxPyPzE(Pxcal,Pycal,Pzcal,Ecal);
00912
00913 return CalJet;
00914
00915 }