Fork me on GitHub

Changeset 558 in svn


Ignore:
Timestamp:
Feb 24, 2010, 6:26:47 PM (15 years ago)
Author:
Xavier Rouby
Message:

new b-tag

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/CHANGELOG

    r551 r558  
    1 * Changes relative to V.1.8
     1* Changes relative to V.1.8
     2   - new: b-(mis)tag algorithms
     3       * pt/eta dependence for b-(mis)tagging ;
     4       * now also for gluon-jets
     5       * related changes in the datacard:
     6         deleted parameters: BTAG_b, BTAG_mistag_c, BTAG_mistag_l
     7         new parameters: BTAG_func_b, BTAG_func_c, BTAG_func_g, BTAG_func_l
     8   - new: Isolation: SumEt & SumPt added for muons & electrons
     9     NB 'SumPt' was before 'IsolPt' in muon collection only
     10   - datacard: change of several variable names!!!
     11       before    ->  new name
     12       ISOL_PT        -> ISOL_trk_PT
     13       ISOL_Cone      -> ISOL_trk_Cone
     14       ISOL_Calo_Cone -> ISOL_calo_Cone
     15       ISOL_Calo_ET   -> ISOL_calo_ET
     16       ISOL_Calo_Grid -> ISOL_calo_Grid
     17   - bug fix: EtRatio for muons
    218   - new: ./configure for the installation
    319   - update: default jet algorithms have change in data cards
  • trunk/data/DetectorCard.dat

    r557 r558  
    8181ISOL_trk_Cone    0.5      //Cone  for isolation criteria
    8282ISOL_calo_Cone   0.5      //Cone  for isolation criteria
    83 ISOL_calo_ET     1E99     //minimal tower transverse energy for isolation criteria. 1E99 means "off"
     83ISOL_calo_ET     0        //minimal tower transverse energy for isolation criteria.
    8484ISOL_calo_Grid   3        //Grid size (N x N) for calorimetric isolation
    8585
     
    9090JET_Eflow        0              // Perfect energy assumed in the tracker coverage
    9191
    92 # Tagging definition
    93 BTAG_b           40             // b-tag efficiency (%)
    94 BTAG_mistag_c    10             // mistagging (%)
    95 BTAG_mistag_l    1              // mistagging (%)
     92# b-(mis)tagging efficiencies
     93# pt dependence for b-tagging and mistag
     94# see http://root.cern.ch/root/html/TFormula.html for syntax
     95# e.g. BTAG_func_b     0.4*(1-exp(-x))
     96# in case of no explicit dependence, on x (=PT) or y (=eta), you MUST add "+0*x" and/or "+0*y"
     97# e.g. BTAG_func_g     0.01 + 0*x + 0*y
     98# put 'x' for pt ; range: [0, 9E6 GeV/c]
     99# put 'y' for eta ; range [-CEN_max_tracker ; CEN_max_tracker ]
     100BTAG_func_b      0.4+0*x+0*y            // formula for Pt dependence of the b-tag efficiency (b-jets)
     101BTAG_func_c      0.1+0*x+0*y            // formula for Pt dependence of the mistag efficiency (c-jets)
     102BTAG_func_g      0.01+0*x+0*y           // (gluon-jets)
     103BTAG_func_l      0.01+0*x+0*y           // (light-jets)
    96104
    97105# FLAGS
  • trunk/data/DetectorCard_ATLAS.dat

    r557 r558  
    8181ISOL_trk_Cone    0.5      //Cone  for isolation criteria
    8282ISOL_calo_Cone   0.5      //Cone  for isolation criteria
    83 ISOL_calo_ET     1E99     //minimal tower transverse energy for isolation criteria. 1E99 means "off"
     83ISOL_calo_ET     0.5     //minimal tower transverse energy for isolation criteria.
    8484ISOL_calo_Grid   3        //Grid size (N x N) for calorimetric isolation
    8585
     
    9090JET_Eflow        1              // Perfect energy assumed in the tracker coverage
    9191
    92 # Tagging definition
    93 BTAG_b           50             // b-tag efficiency (%)
    94 BTAG_mistag_c    10             // mistagging (%)
    95 BTAG_mistag_l    1              // mistagging (%)
     92# b-(mis)tagging efficiencies
     93# pt dependence for b-tagging and mistag
     94# see http://root.cern.ch/root/html/TFormula.html for syntax
     95# e.g. BTAG_func_b     0.4*(1-exp(-x))
     96# in case of no explicit dependence, on x (=PT) or y (=eta), you MUST add "+0*x" and/or "+0*y"
     97# e.g. BTAG_func_g     0.01 + 0*x + 0*y
     98# put 'x' for pt ; range: [0, 9E6 GeV/c]
     99# put 'y' for eta ; range [-CEN_max_tracker ; CEN_max_tracker ]
     100BTAG_func_b      0.4+0*x+0*y            // formula for Pt dependence of the b-tag efficiency (b-jets)
     101BTAG_func_c      0.1+0*x+0*y            // formula for Pt dependence of the mistag efficiency (c-jets)
     102BTAG_func_g      0.01+0*x+0*y           // (gluon-jets)
     103BTAG_func_l      0.01+0*x+0*y           // (light-jets)
    96104
    97105# FLAGS
  • trunk/data/DetectorCard_CMS.dat

    r557 r558  
    8181ISOL_trk_Cone    0.5      //Cone  for isolation criteria
    8282ISOL_calo_Cone   0.5      //Cone  for isolation criteria
    83 ISOL_calo_ET     1E99     //minimal tower transverse energy for isolation criteria. 1E99 means "off"
     83ISOL_calo_ET     0.5      //minimal tower transverse energy for isolation criteria.
    8484ISOL_calo_Grid   3        //Grid size (N x N) for calorimetric isolation
    8585
     
    9090JET_Eflow        1              // Perfect energy assumed in the tracker coverage
    9191
    92 # Tagging definition
    93 BTAG_b           40             // b-tag efficiency (%)
    94 BTAG_mistag_c    10             // mistagging (%)
    95 BTAG_mistag_l    1              // mistagging (%)
     92# b-(mis)tagging efficiencies
     93# pt dependence for b-tagging and mistag
     94# see http://root.cern.ch/root/html/TFormula.html for syntax
     95# e.g. BTAG_func_b     0.4*(1-exp(-x))
     96# in case of no explicit dependence, on x (=PT) or y (=eta), you MUST add "+0*x" and/or "+0*y"
     97# e.g. BTAG_func_g     0.01 + 0*x + 0*y
     98# put 'x' for pt ; range: [0, 9E6 GeV/c]
     99# put 'y' for eta ; range [-CEN_max_tracker ; CEN_max_tracker ]
     100BTAG_func_b      0.4+0*x+0*y            // formula for Pt dependence of the b-tag efficiency (b-jets)
     101BTAG_func_c      0.1+0*x+0*y            // formula for Pt dependence of the mistag efficiency (c-jets)
     102BTAG_func_g      0.01+0*x+0*y           // (gluon-jets)
     103BTAG_func_l      0.01+0*x+0*y           // (light-jets)
    96104
    97105# FLAGS
  • trunk/genMakefile.tcl

    r533 r558  
    348348        @echo Building tarball of sources
    349349        @mkdir $(FOLDER)
    350         @rsync -qavztup --exclude=CVS* CREDITS VERSION FAQ Delphes.cpp Resolutions.cpp Resolutions_ATLAS.cpp Makefile rootlogon.C genMakefile.tcl interface lib routines src data Examples Utilities $(FOLDER)
     350        @rsync -qavztup --exclude=CVS* CREDITS VERSION CHANGELOG FAQ Delphes.cpp Resolutions.cpp Resolutions_ATLAS.cpp Makefile rootlogon.C genMakefile.tcl interface lib routines src data Examples Utilities configure $(FOLDER)
    351351        @rm -f $(FOLDER)/$(SHARED)
    352352        @rm -f $(FOLDER)/Utilities/FROG/frog
  • trunk/interface/SmearUtil.h

    r557 r558  
    217217 
    218218 //tagging definition
    219  float BTAG_b;         
    220  float BTAG_mistag_c;
    221  float BTAG_mistag_l;
     219 string BTAG_func_b;
     220 string BTAG_func_c;
     221 string BTAG_func_l;
     222 string BTAG_func_g;
    222223 
    223224
  • trunk/src/SmearUtil.cc

    r557 r558  
    3838#include "SmearUtil.h"
    3939#include "TStopwatch.h"
     40#include "TF2.h"
    4041
    4142#include <iostream>
     
    142143
    143144  // 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
    147150
    148151  // FLAGS
     
    306309
    307310  // 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
    311316
    312317  // FLAGS
     
    462467
    463468  // 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;
    467473
    468474  // FLAGS
     
    669675    else if(strstr(temp_string.c_str(),"JET_Eflow"))        {curstring >> varname >> ivalue; JET_Eflow        = ivalue;}
    670676 
    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;}
    674681
    675682    else if(strstr(temp_string.c_str(),"FLAG_vfd"))         {curstring >> varname >> ivalue; FLAG_vfd         = ivalue;}
     
    11851192        << left << setw(5) <<TAU_track_pt                                <<""<< right << setw(20)<<"*"<<"\n";
    11861193  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
    11971208  f_out<<"*                                                                    *"<<"\n";
    11981209  f_out<<"*                                                                    *"<<"\n";
     
    13861397
    13871398
    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****************
    13891400
    13901401bool 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;
    14201424}
    14211425
     
    14501454   float etiso = 0; // sum of all track pt in isolation cone
    14511455   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) ) {
    14561457           etiso += towers[i].getET(); // dR cut on tracks
    14571458          }
    14581459  }
    1459 
    14601460   return etiso;
    14611461}
     
    14631463
    14641464
    1465 // ******* Calorimetric isolation
     1465// ******* Calorimetric isolation -- for LHCO only
    14661466float RESOLution::CaloIsolation(const D_Particle& part,  const D_CaloTowerList & towers, const float iPhi, const float iEta, const int iTower) {
    14671467  // iPhi and iEta are the coordinates of the center of the tower crossed by the particle
     
    14691469  // iTower is the index of the tower, in [0, n_tower]. iTower points only towers in positive range
    14701470
    1471    if(ISOL_calo_ET>1E10) return UNDEFINED; // avoid doing anything unreasonable...
    14721471   float et_sum=0;
    14731472
     
    15041503            //     << "calMuon.getEta= " << calMuon.getEta() << "\tcalMuon.getPhi()= " << calMuon.getPhi() <<"\t";
    15051504
    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) {
    15071507               et_sum += calMuon.getET();
    15081508               //cout << calMuon.getET() << " GeV";
     
    15131513   }  // undefined index
    15141514   else {
    1515      cout << "out of range" << endl;
    15161515     if (CEN_max_mu < CEN_max_calo_fwd)
    15171516        cout << "**    ERROR in RESOLution::CaloIsolation: 'muon'-tower not found!  **" << endl;
    15181517   }      // should never happen ! this would be a bug
    1519  
    15201518  return (part.Pt()==0)? UNDEFINED: et_sum/part.Pt();
    15211519}
Note: See TracChangeset for help on using the changeset viewer.