Changeset 558 in svn for trunk/src/SmearUtil.cc
- Timestamp:
- Feb 24, 2010, 6:26:47 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SmearUtil.cc
r557 r558 38 38 #include "SmearUtil.h" 39 39 #include "TStopwatch.h" 40 #include "TF2.h" 40 41 41 42 #include <iostream> … … 142 143 143 144 // Tagging definition 144 BTAG_b = 40.; 145 BTAG_mistag_c = 10.; 146 BTAG_mistag_l = 1.; 145 BTAG_func_b = "0.4 + 0*x + 0*y"; // efficiency functions (x=Pt, y=eta) in ROOT::TF2 format 146 BTAG_func_c = "0.1 + 0*x + 0*y"; 147 BTAG_func_l = "0.01 + 0*x + 0*y"; 148 BTAG_func_g = "0.01 + 0*x + 0*y"; 149 147 150 148 151 // FLAGS … … 306 309 307 310 // Tagging definition 308 BTAG_b = DET.BTAG_b; 309 BTAG_mistag_c = DET.BTAG_mistag_c; 310 BTAG_mistag_l = DET.BTAG_mistag_l; 311 BTAG_func_b = DET.BTAG_func_b; 312 BTAG_func_c = DET.BTAG_func_c; 313 BTAG_func_l = DET.BTAG_func_l; 314 BTAG_func_g = DET.BTAG_func_g; 315 311 316 312 317 // FLAGS … … 462 467 463 468 // Tagging definition 464 BTAG_b = DET.BTAG_b; 465 BTAG_mistag_c = DET.BTAG_mistag_c; 466 BTAG_mistag_l = DET.BTAG_mistag_l; 469 BTAG_func_b = DET.BTAG_func_b; 470 BTAG_func_c = DET.BTAG_func_c; 471 BTAG_func_l = DET.BTAG_func_l; 472 BTAG_func_g = DET.BTAG_func_g; 467 473 468 474 // FLAGS … … 669 675 else if(strstr(temp_string.c_str(),"JET_Eflow")) {curstring >> varname >> ivalue; JET_Eflow = ivalue;} 670 676 671 else if(strstr(temp_string.c_str(),"BTAG_b")) {curstring >> varname >> value;BTAG_b = value;} 672 else if(strstr(temp_string.c_str(),"BTAG_mistag_c")) {curstring >> varname >> value;BTAG_mistag_c = value;} 673 else if(strstr(temp_string.c_str(),"BTAG_mistag_l")) {curstring >> varname >> value;BTAG_mistag_l = value;} 677 else if(strstr(temp_string.c_str(),"BTAG_func_b")) {curstring >> varname >> svalue; BTAG_func_b = svalue;} 678 else if(strstr(temp_string.c_str(),"BTAG_func_c")) {curstring >> varname >> svalue; BTAG_func_c = svalue;} 679 else if(strstr(temp_string.c_str(),"BTAG_func_l")) {curstring >> varname >> svalue; BTAG_func_l = svalue;} 680 else if(strstr(temp_string.c_str(),"BTAG_func_g")) {curstring >> varname >> svalue; BTAG_func_g = svalue;} 674 681 675 682 else if(strstr(temp_string.c_str(),"FLAG_vfd")) {curstring >> varname >> ivalue; FLAG_vfd = ivalue;} … … 1185 1192 << left << setw(5) <<TAU_track_pt <<""<< right << setw(20)<<"*"<<"\n"; 1186 1193 f_out<<"* *"<<"\n"; 1187 f_out<<"#*************************** *"<<"\n"; 1188 f_out<<"# B-tagging efficiencies [%] *"<<"\n"; 1189 f_out<<"#*************************** *"<<"\n"; 1190 f_out<<"* *"<<"\n"; 1191 f_out << left << setw(50) <<"* Efficiency to tag a \"b\" as a b-jet: "<<"" 1192 << left << setw(10) <<BTAG_b <<""<< right << setw(10)<<"*"<<"\n"; 1193 f_out << left << setw(50) <<"* Efficiency to mistag a c-jet as a b-jet: "<<"" 1194 << left << setw(10) <<BTAG_mistag_c <<""<< right << setw(10)<<"*"<<"\n"; 1195 f_out << left << setw(50) <<"* Efficiency to mistag a light jet as a b-jet: "<<"" 1196 << left << setw(10) <<BTAG_mistag_l <<""<< right << setw(10)<<"*"<<"\n"; 1194 f_out<<"#******************************* *"<<"\n"; 1195 f_out<<"# B-tagging efficiency functions *"<<"\n"; 1196 f_out<<"#******************************* *"<<"\n"; 1197 f_out<<"* *"<<"\n"; 1198 f_out << left << setw(50) <<"* Tagging a \"b\" as a b-jet: "<<"" 1199 << left << setw(18) <<BTAG_func_b <<""<< right << setw(2)<<"*"<<"\n"; 1200 f_out << left << setw(50) <<"* Mistagging a c-jet as a b-jet: "<<"" 1201 << left << setw(18) <<BTAG_func_c <<""<< right << setw(2)<<"*"<<"\n"; 1202 f_out << left << setw(50) <<"* Mistagging a gluon-jet as a b-jet: "<<"" 1203 << left << setw(18) <<BTAG_func_g <<""<< right << setw(2)<<"*"<<"\n"; 1204 f_out << left << setw(50) <<"* Mistagging a light jet as a b-jet: "<<"" 1205 << left << setw(18) <<BTAG_func_l <<""<< right << setw(2)<<"*"<<"\n"; 1206 1207 1197 1208 f_out<<"* *"<<"\n"; 1198 1209 f_out<<"* *"<<"\n"; … … 1386 1397 1387 1398 1388 //******************* *Simulates the b-tagging efficiency for real bjet, or the misendentification for other jets****************1399 //******************* Simulates the b-tagging efficiency for real bjet, or the misendentification for other jets**************** 1389 1400 1390 1401 bool RESOLution::Btaggedjet(const TLorentzVector &JET, const TSimpleArray<TRootC::GenParticle> &subarray) { 1391 float chance =grandom->Uniform()*100.; 1392 1393 /* old code -- for bookkeeping 1394 bool res1 = false; 1395 if( chance < BTAG_b && Bjets(subarray,JET.Eta(),JET.Phi())==pB ) { res1= true;} // b-tag of b-jets is 40% 1396 else if( chance < BTAG_mistag_c && Bjets(subarray,JET.Eta(),JET.Phi())==pC ) { res1= true;} // b-tag of c-jets is 10% 1397 else if( chance < BTAG_mistag_l) { 1398 int pid=Bjets(subarray,JET.Eta(),JET.Phi()); 1399 if(pid!=pB && pid!=pC && pid!=0) { res1=true; }// b-tag of light jets is 1% 1400 } 1401 else res1 = false; 1402 //return res1; 1403 */ 1404 1405 1406 bool res2 = false; int jet; 1407 if( chance > max(BTAG_b, max(BTAG_mistag_c, BTAG_mistag_l)) ) { // useless to try further 1408 res2 = false; 1409 } 1410 else { 1411 jet = Bjets(subarray,JET.Eta(),JET.Phi()); // once for all 1412 if( chance < BTAG_b && jet==pB ) { res2= true;} // b-tag of b-jets is 40% 1413 else if( chance < BTAG_mistag_c && jet==pC ) { res2= true;} // b-tag of c-jets is 10% 1414 else if( chance < BTAG_mistag_l && jet!=pB && jet!=pC && jet!=0) { res2=true; }// b-tag of light jets is 1% 1415 else res2= false; 1416 } 1417 //if (res1 != res2) cout << "BUUUUUUUUUUUUUUGGGGGGG" << endl; 1418 1419 return res2; 1402 1403 const float ptmax = 9E6; // GeV/c 1404 bool tag = false; 1405 string efficiency_formula=""; 1406 1407 // selects the correct formula 1408 int jet_id = Bjets(subarray,JET.Eta(),JET.Phi()); // gets the particle id of the most energetic parton in the jet 1409 switch (jet_id) { 1410 case pB: efficiency_formula = BTAG_func_b; break; 1411 case pC: efficiency_formula = BTAG_func_c; break; 1412 case pGLUON: efficiency_formula = BTAG_func_g; break; 1413 default: efficiency_formula = BTAG_func_l; break; 1414 } 1415 1416 TF2 efficiency("efficiency",efficiency_formula.c_str(),0,ptmax,-CEN_max_tracker,CEN_max_tracker); // efficiency function wrt Pt 1417 float x = grandom->Uniform(); // randomisation 1418 tag = (x < efficiency.Eval(JET.Pt(),JET.Eta())) ? true : false; 1419 //cout << "formula = " << efficiency_formula << "\t Pt = " << JET.Pt() 1420 // << "\t value = " << efficiency.Eval(JET.Pt()) 1421 // << "\t x = " << x << "\t tag= " << tag << endl; 1422 1423 return tag; 1420 1424 } 1421 1425 … … 1450 1454 float etiso = 0; // sum of all track pt in isolation cone 1451 1455 for (unsigned int i=0; i< towers.size(); i++) { 1452 // cout<<" eta part "<<iEta<<" eta tour "<<towers[i].getEta()<<endl; 1453 // cout<<" phi part "<<iPhi<<" phi tour "<<towers[i].getPhi()<<endl; 1454 1455 if(DeltaR(iPhi,iEta,towers[i].getPhi(),towers[i].getEta()) < ISOL_calo_Cone) { 1456 if( (DeltaR(iPhi,iEta,towers[i].getPhi(),towers[i].getEta()) < ISOL_calo_Cone) && (towers[i].getET() > ISOL_calo_ET) ) { 1456 1457 etiso += towers[i].getET(); // dR cut on tracks 1457 1458 } 1458 1459 } 1459 1460 1460 return etiso; 1461 1461 } … … 1463 1463 1464 1464 1465 // ******* Calorimetric isolation 1465 // ******* Calorimetric isolation -- for LHCO only 1466 1466 float RESOLution::CaloIsolation(const D_Particle& part, const D_CaloTowerList & towers, const float iPhi, const float iEta, const int iTower) { 1467 1467 // iPhi and iEta are the coordinates of the center of the tower crossed by the particle … … 1469 1469 // iTower is the index of the tower, in [0, n_tower]. iTower points only towers in positive range 1470 1470 1471 if(ISOL_calo_ET>1E10) return UNDEFINED; // avoid doing anything unreasonable...1472 1471 float et_sum=0; 1473 1472 … … 1504 1503 // << "calMuon.getEta= " << calMuon.getEta() << "\tcalMuon.getPhi()= " << calMuon.getPhi() <<"\t"; 1505 1504 1506 if(calMuon.getEta() != UNDEFINED && calMuon.getET() > ISOL_calo_ET) { 1505 //if(calMuon.getEta() != UNDEFINED && calMuon.getET() > ISOL_calo_ET) { 1506 if(calMuon.getEta() != UNDEFINED && calMuon.getET() > 0.0) { 1507 1507 et_sum += calMuon.getET(); 1508 1508 //cout << calMuon.getET() << " GeV"; … … 1513 1513 } // undefined index 1514 1514 else { 1515 cout << "out of range" << endl;1516 1515 if (CEN_max_mu < CEN_max_calo_fwd) 1517 1516 cout << "** ERROR in RESOLution::CaloIsolation: 'muon'-tower not found! **" << endl; 1518 1517 } // should never happen ! this would be a bug 1519 1520 1518 return (part.Pt()==0)? UNDEFINED: et_sum/part.Pt(); 1521 1519 }
Note:
See TracChangeset
for help on using the changeset viewer.