Changeset d870fc5 in git for modules/IdentificationMap.cc
- Timestamp:
- Dec 21, 2014, 4:03:35 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- d77b51d
- Parents:
- 7f12612 (diff), e5767b57 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/IdentificationMap.cc
r7f12612 rd870fc5 2 2 * Delphes: a framework for fast simulation of a generic collider experiment 3 3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium 4 * 4 * 5 5 * This program is free software: you can redistribute it and/or modify 6 6 * it under the terms of the GNU General Public License as published by 7 7 * the Free Software Foundation, either version 3 of the License, or 8 8 * (at your option) any later version. 9 * 9 * 10 10 * This program is distributed in the hope that it will be useful, 11 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 13 * GNU General Public License for more details. 14 * 14 * 15 15 * You should have received a copy of the GNU General Public License 16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. … … 20 20 /** \class IdentificationMap 21 21 * 22 * Converts particles with some PDG code into another particle, according to parametrized probability as function of pt eta 23 given by user. 24 * 25 * $Date: 2014-08-07 14:57:44 +0100 (Thu, 07 Aug 2014) $ 26 * $Revision: 905 $ 27 * 22 * Converts particles with some PDG code into another particle, 23 * according to parametrized probability. 28 24 * 29 25 * \author M. Selvaggi - UCL, Louvain-la-Neuve … … 49 45 #include "TLorentzVector.h" 50 46 51 #include <algorithm> 47 #include <algorithm> 52 48 #include <stdexcept> 53 49 #include <iostream> … … 75 71 // read efficiency formula 76 72 77 73 78 74 TMisIDMap::iterator itEfficiencyMap; 79 75 ExRootConfParam param; 80 76 DelphesFormula *formula; 81 77 Int_t i, size, pdg; 82 78 83 79 // read efficiency formulas 84 80 param = GetParam("EfficiencyFormula"); 85 81 size = param.GetSize(); 86 82 87 83 fEfficiencyMap.clear(); 88 84 for(i = 0; i < size/3; ++i) … … 92 88 pdg = param[i*3].GetInt(); 93 89 fEfficiencyMap.insert(make_pair(pdg,make_pair(param[i*3 + 1].GetInt(),formula))); 94 90 95 91 // cout<<param[i*3].GetInt()<<","<<param[i*3+1].GetInt()<<","<<param[i*3 + 2].GetString()<<endl; 96 92 97 93 } 98 94 … … 106 102 fEfficiencyMap.insert(make_pair(0,make_pair(0,formula))); 107 103 } 108 104 109 105 // import input array 110 106 … … 122 118 { 123 119 if(fItInputArray) delete fItInputArray; 124 120 125 121 TMisIDMap::iterator itEfficiencyMap; 126 122 DelphesFormula *formula; … … 136 132 137 133 void IdentificationMap::Process() 138 { 134 { 139 135 Candidate *candidate; 140 136 Double_t pt, eta, phi; … … 145 141 146 142 Double_t P, Pi; 147 143 148 144 // cout<<"------------ New Event ------------"<<endl; 149 145 150 146 fItInputArray->Reset(); 151 147 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) … … 158 154 pdgIn = candidate->PID; 159 155 charge = candidate->Charge; 160 156 161 157 // cout<<"------------ New Candidate ------------"<<endl; 162 158 // cout<<candidate->PID<<" "<<pt<<","<<eta<<","<<phi<<endl; 163 159 164 160 P = 1.0; 165 161 166 162 //first check that PID of this particle is specified in cfg, if not set look for PID=0 167 163 168 164 itEfficiencyMap = fEfficiencyMap.find(pdgIn); 169 170 range = fEfficiencyMap.equal_range(pdgIn); 165 166 range = fEfficiencyMap.equal_range(pdgIn); 171 167 if(range.first == range.second) range = fEfficiencyMap.equal_range(-pdgIn); 172 168 if(range.first == range.second) range = fEfficiencyMap.equal_range(0); 173 169 174 170 //loop over submap for this pid 175 171 for (TMisIDMap::iterator it=range.first; it!=range.second; ++it) 176 { 177 172 { 173 178 174 formula = (it->second).second; 179 175 pdgOut = (it->second).first; 180 176 181 177 Pi = formula->Eval(pt, eta); 182 178 183 179 // check that sum of probabilities does not exceed 1. 184 180 P = (P - Pi)/P; 185 181 186 182 if( P < 0.0 ) continue; 187 183 else 188 184 { 189 185 190 186 //randomly assign a PID to particle according to map 191 187 Double_t rndm = gRandom->Uniform(); 192 188 193 189 if(rndm > P) 194 190 { … … 198 194 break; 199 195 } 200 } 201 196 } 197 202 198 } 203 199 204 200 } 205 201
Note:
See TracChangeset
for help on using the changeset viewer.