Fork me on GitHub

Changeset 392 in svn for trunk


Ignore:
Timestamp:
May 18, 2009, 6:52:13 PM (16 years ago)
Author:
Xavier Rouby
Message:

new CaloIsolation for muons : EtRatio up-to-date

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/interface/SmearUtil.h

    r383 r392  
    260260
    261261  /// Lepton isolation based on calorimetry (optional. Default: off)
    262   float CaloIsolation(const D_Particle& part,  const D_CaloTowerList & towers);
     262  float CaloIsolation(const D_Particle& part,  const D_CaloTowerList & towers, const float iPhi, const float iEta);
    263263
    264264  //********************* returns a segmented value for eta and phi, for calo towers *****
  • trunk/src/SmearUtil.cc

    r384 r392  
    121121  ISOL_Cone       = 0.5;      //Cone  for isolation criteria
    122122  ISOL_Calo_ET    = 1E99;     //minimal tower energy for isolation criteria. Default off = 1E99
    123   ISOL_Calo_Grid  = 3;        //Grid size (N x N) for calorimetric isolation
     123  ISOL_Calo_Grid  = 3;        //Grid size (N x N) for calorimetric isolation -- should be odd
    124124
    125125  // General jet variable
     
    592592    else if(strstr(temp_string.c_str(),"PdgTableFilename"))     {curstring >> varname >> svalue; PdgTableFilename = svalue;}
    593593  }
    594  
     594 
     595  if(ISOL_Calo_Grid%2 ==0) {
     596    ISOL_Calo_Grid++;
     597    cout <<"**        WARNING: ISOL_Calo_Grid is not odd. Set it to  "<< ISOL_Calo_Grid << "        **" << endl;
     598  }
     599 
    595600  //jet stuffs not defined in the input datacard
    596601  JET_overlap     = 0.75;
     
    12261231
    12271232// ******* Calorimetric isolation
    1228 float RESOLution::CaloIsolation(const D_Particle& part,  const D_CaloTowerList & towers) {
     1233float RESOLution::CaloIsolation(const D_Particle& part,  const D_CaloTowerList & towers, const float iPhi, const float iEta) {
    12291234 // etrat, which is a percentage between 00 and 99. It is the ratio of the transverse energy
    12301235 // in a 3×3 grid surrounding the muon to the pT of the muon. For well-isolated muons, both ptiso and etrat will be small.
    12311236   if(ISOL_Calo_ET>1E10) return UNDEFINED; // avoid doing anything unreasonable...
    1232    float etrat=0;
     1237   float et_sum=0;
    12331238   // available parameters: ISOL_Calo_ET ,  ISOL_Calo_Grid
    1234 /*   for(unsigned int i=0; i < towers.size(); i++) {
    1235      if(towers[i].E > ISOL_Calo_ET) {
    1236         float genDeltaR = DeltaR(part.Phi(),part.Eta(),towers[i].getPhi(),towers[i].getEta());
    1237         if(genDeltaR < ISOL_Calo_Cone) {
    1238            ptiso += towers[i].getET();
    1239         }           
    1240      }
    1241    } // loop on towers
    1242    ptiso -=
    1243 */
    1244   etrat = 100*etrat/part.Pt();
     1239   // Get the EtaCalo/PhiCalo of the muon ;
     1240   // transform it into iEta/iPhi to get the towers, and their neighbourh (i-1, i-2, etc)
     1241
     1242   unsigned int N = ISOL_Calo_Grid;
     1243   int index= iUNDEFINED; // index of the central tower of the grid in TOWER_eta_edges[.];
     1244                          // !! TOWER_eta_edges is only with eta>0
     1245   // finds the index of the central tower of the NxN grid
     1246   for (unsigned int i=1; i< TOWER_number+1; i++) {
     1247       if(fabs(iEta) >= TOWER_eta_edges[i-1] && fabs(iEta) < TOWER_eta_edges[i]) {
     1248           index = i-1;
     1249           break;
     1250       }
     1251   }
     1252   if(index != iUNDEFINED) {
     1253           // finds the size in phi of the cells for this eta
     1254           float dphi = TOWER_dphi[index]*pi/180.; // in rad
     1255
     1256           //cout << "Grid " << " ----------\n";
     1257           for (unsigned int i_eta=0; i_eta<N; i_eta++) {
     1258              unsigned int real_index = (iEta>0) ? index+i_eta-(N-1)/2 : index+1+i_eta-(N-1)/2 ;
     1259              float eta_ith_tower = TOWER_eta_edges[real_index];
     1260              if(iEta<0) eta_ith_tower *= -1;
     1261                                       
     1262              for (unsigned int i_phi=0; i_phi<N; i_phi++) {
     1263                 float phi_ith_tower = iPhi + (float)(i_phi - (N-1.)/2.)*dphi;
     1264                 D_CaloTower calMuon(towers.getElement(eta_ith_tower,phi_ith_tower));
     1265                 if(calMuon.getEta() != UNDEFINED && calMuon.getE() > ISOL_Calo_ET) {
     1266                    et_sum += calMuon.getE();
     1267                    //cout << "eta/phi = " << eta_ith_tower << "\t" << phi_ith_tower << "\t" << calMuon.getE() << " GeV" << endl;
     1268                 }
     1269                 //else cout << "eta/phi = " << eta_ith_tower << "\t" << phi_ith_tower << "\tnot active\n";
     1270              }
     1271   
     1272           } // NxN grid
     1273        //cout << "-----------" << etrat << endl;
     1274   }
     1275   else if (CEN_max_mu < CEN_max_calo_fwd)
     1276        cout << "**    ERROR in RESOLution::CaloIsolation: 'muon'-tower not found!  **" << endl;
     1277        // should never happen ! this would be a bug
     1278  //cout << "etrat = " << et_sum << "\t Pt=" << part.Pt() << endl;
     1279 
     1280  // should return a number between 0 and 99 (due to LHCO definitions)
     1281  // which is Pt(muon) / sum(ET)
     1282  float etrat = 0.;
     1283  if(et_sum==0) etrat = 99.;
     1284  else if(et_sum>0) etrat = 100*part.Pt()/et_sum;
    12451285  if(etrat<0) cout << "Error: negative etrat in CaloIsolation (" << etrat <<")\n";
    1246   else if(etrat>99) cout << "Error: etrat shoud be in [0;99] in CaloIsolation (" << etrat <<")\n";
     1286  //else if(etrat>99) cout << "Error: etrat should be in [0;99] in CaloIsolation (" << etrat <<")\n";
     1287  if(etrat>99) etrat = 99;
    12471288  return etrat;
    12481289}
Note: See TracChangeset for help on using the changeset viewer.