Fork me on GitHub

Changeset b631c06 in git for modules/JetFakeParticle.cc


Ignore:
Timestamp:
Sep 10, 2015, 2:23:18 PM (9 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
93da593
Parents:
832ce9e
Message:

remove unneeded variables and change names of output arrays

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/JetFakeParticle.cc

    r832ce9e rb631c06  
    7373  ExRootConfParam param;
    7474  DelphesFormula *formula;
    75   Int_t i, size, pdg;
     75  Int_t i, size, pdgCode;
    7676
    7777  // read efficiency formulas
     
    8080
    8181  fEfficiencyMap.clear();
    82  
     82
    8383  for(i = 0; i < size/2; ++i)
    8484  {
    8585    formula = new DelphesFormula;
    8686    formula->Compile(param[i*2 + 1].GetString());
    87     pdg = param[i*2].GetInt();
    88    
    89     if(TMath::Abs(pdg) != 11 && TMath::Abs(pdg) != 13 && TMath::Abs(pdg) != 22)
     87    pdgCode = param[i*2].GetInt();
     88
     89    if(TMath::Abs(pdgCode) != 11 && TMath::Abs(pdgCode) != 13 && TMath::Abs(pdgCode) != 22)
    9090    {
    9191      throw runtime_error("Jets can only fake into electrons, muons or photons. Other particles are not authorized.");
    9292    }
    93    
     93
    9494    fEfficiencyMap[param[i*2].GetInt()] = formula;
    9595  }
     
    104104    fEfficiencyMap[0] = formula;
    105105  }
    106  
    107  
     106
    108107  // import input array
    109108
     
    113112  // create output array
    114113
    115   fElectronOutputArray = ExportArray(GetString("ElectronOutputArray", "electrons_fake"));
    116   fMuonOutputArray = ExportArray(GetString("MuonOutputArray", "muons_fake"));
    117   fPhotonOutputArray = ExportArray(GetString("PhotonOutputArray", "photons_fake"));
     114  fElectronOutputArray = ExportArray(GetString("ElectronOutputArray", "fakeElectrons"));
     115  fMuonOutputArray = ExportArray(GetString("MuonOutputArray", "fakeMuons"));
     116  fPhotonOutputArray = ExportArray(GetString("PhotonOutputArray", "fakePhotons"));
    118117  fJetOutputArray = ExportArray(GetString("JetOutputArray", "jets"));
    119118
     
    139138void JetFakeParticle::Process()
    140139{
    141   Candidate *candidate, *fake;
     140  Candidate *candidate, *fake = 0;
    142141  Double_t pt, eta, phi, e;
    143142  TFakeMap::iterator itEfficiencyMap;
    144143  DelphesFormula *formula;
    145   Int_t pdgCodeIn, pdgCodeOut, charge;
    146   Bool_t faked;
    147  
     144  Int_t pdgCodeOut;
     145
    148146  Double_t p, r, rs, total;
    149147
     
    157155    pt = candidateMomentum.Pt();
    158156    e = candidateMomentum.E();
    159    
     157
    160158    r = gRandom->Uniform();
    161159    total = 0.0;
    162     faked = 0;
    163    
     160    fake = 0;
     161
    164162    // loop over map for this jet
    165163    for(itEfficiencyMap = fEfficiencyMap.begin(); itEfficiencyMap != fEfficiencyMap.end(); ++itEfficiencyMap)
    166164    {
    167    
    168  
    169    
    170165      formula = itEfficiencyMap->second;
    171166      pdgCodeOut = itEfficiencyMap->first;
     
    175170      if(total <= r && r < total + p)
    176171      {
    177        
    178172        fake = static_cast<Candidate*>(candidate->Clone());
    179         faked = 1;
    180        
     173
    181174        // convert jet
    182        
     175
    183176        if(TMath::Abs(pdgCodeOut) == 11 || TMath::Abs(pdgCodeOut) == 13)
    184177        {
    185          
    186         // for electrons and muons fake use the jet charge (if non-zero, otherwise randomly assign sign)
    187          
    188           if(candidate->Charge != 0)fake->PID = -(candidate->Charge)*TMath::Abs(pdgCodeOut);
     178          // for electrons and muons fake use the jet charge (if non-zero, otherwise randomly assign sign)
     179
     180          if(candidate->Charge != 0)
     181          {
     182            fake->PID = -(candidate->Charge)*TMath::Abs(pdgCodeOut);
     183          }
    189184          else
    190185          {
    191186            rs = gRandom->Uniform();
    192187            fake->PID = (rs < 0.5) ? -TMath::Abs(pdgCodeOut) : TMath::Abs(pdgCodeOut);
    193           }
    194        
     188          }
    195189        }
    196        
     190
    197191        if(TMath::Abs(pdgCodeOut) == 22) fake->PID = 22;
    198        
     192
    199193        if(TMath::Abs(pdgCodeOut) == 11) fElectronOutputArray->Add(fake);
    200194        if(TMath::Abs(pdgCodeOut) == 13) fMuonOutputArray->Add(fake);
     
    202196
    203197        break;
    204 
    205198      }
    206199
    207200      total += p;
    208201    }
    209  
    210   if(!faked) fJetOutputArray->Add(candidate);
    211  
    212  }
    213 }
    214 
    215 //------------------------------------------------------------------------------
     202
     203    if(!fake) fJetOutputArray->Add(candidate);
     204  }
     205}
     206
     207//------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.