Changeset b631c06 in git for modules/JetFakeParticle.cc
- Timestamp:
- Sep 10, 2015, 2:23:18 PM (9 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 93da593
- Parents:
- 832ce9e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/JetFakeParticle.cc
r832ce9e rb631c06 73 73 ExRootConfParam param; 74 74 DelphesFormula *formula; 75 Int_t i, size, pdg ;75 Int_t i, size, pdgCode; 76 76 77 77 // read efficiency formulas … … 80 80 81 81 fEfficiencyMap.clear(); 82 82 83 83 for(i = 0; i < size/2; ++i) 84 84 { 85 85 formula = new DelphesFormula; 86 86 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) 90 90 { 91 91 throw runtime_error("Jets can only fake into electrons, muons or photons. Other particles are not authorized."); 92 92 } 93 93 94 94 fEfficiencyMap[param[i*2].GetInt()] = formula; 95 95 } … … 104 104 fEfficiencyMap[0] = formula; 105 105 } 106 107 106 108 107 // import input array 109 108 … … 113 112 // create output array 114 113 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")); 118 117 fJetOutputArray = ExportArray(GetString("JetOutputArray", "jets")); 119 118 … … 139 138 void JetFakeParticle::Process() 140 139 { 141 Candidate *candidate, *fake ;140 Candidate *candidate, *fake = 0; 142 141 Double_t pt, eta, phi, e; 143 142 TFakeMap::iterator itEfficiencyMap; 144 143 DelphesFormula *formula; 145 Int_t pdgCodeIn, pdgCodeOut, charge; 146 Bool_t faked; 147 144 Int_t pdgCodeOut; 145 148 146 Double_t p, r, rs, total; 149 147 … … 157 155 pt = candidateMomentum.Pt(); 158 156 e = candidateMomentum.E(); 159 157 160 158 r = gRandom->Uniform(); 161 159 total = 0.0; 162 fake d= 0;163 160 fake = 0; 161 164 162 // loop over map for this jet 165 163 for(itEfficiencyMap = fEfficiencyMap.begin(); itEfficiencyMap != fEfficiencyMap.end(); ++itEfficiencyMap) 166 164 { 167 168 169 170 165 formula = itEfficiencyMap->second; 171 166 pdgCodeOut = itEfficiencyMap->first; … … 175 170 if(total <= r && r < total + p) 176 171 { 177 178 172 fake = static_cast<Candidate*>(candidate->Clone()); 179 faked = 1; 180 173 181 174 // convert jet 182 175 183 176 if(TMath::Abs(pdgCodeOut) == 11 || TMath::Abs(pdgCodeOut) == 13) 184 177 { 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 } 189 184 else 190 185 { 191 186 rs = gRandom->Uniform(); 192 187 fake->PID = (rs < 0.5) ? -TMath::Abs(pdgCodeOut) : TMath::Abs(pdgCodeOut); 193 } 194 188 } 195 189 } 196 190 197 191 if(TMath::Abs(pdgCodeOut) == 22) fake->PID = 22; 198 192 199 193 if(TMath::Abs(pdgCodeOut) == 11) fElectronOutputArray->Add(fake); 200 194 if(TMath::Abs(pdgCodeOut) == 13) fMuonOutputArray->Add(fake); … … 202 196 203 197 break; 204 205 198 } 206 199 207 200 total += p; 208 201 } 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.