Fork me on GitHub

Changeset cab38f6 in git for modules/IdentificationMap.cc


Ignore:
Timestamp:
Dec 19, 2014, 3:15:11 PM (10 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
df35033
Parents:
a190d94
Message:

remove svn tags and fix formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/IdentificationMap.cc

    ra190d94 rcab38f6  
    2020/** \class IdentificationMap
    2121 *
    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.
    2824 *
    2925 *  \author M. Selvaggi - UCL, Louvain-la-Neuve
     
    4945#include "TLorentzVector.h"
    5046
    51 #include <algorithm> 
     47#include <algorithm>
    5248#include <stdexcept>
    5349#include <iostream>
     
    7571  // read efficiency formula
    7672
    77  
     73
    7874  TMisIDMap::iterator itEfficiencyMap;
    7975  ExRootConfParam param;
    8076  DelphesFormula *formula;
    8177  Int_t i, size, pdg;
    82  
     78
    8379  // read efficiency formulas
    8480  param = GetParam("EfficiencyFormula");
    8581  size = param.GetSize();
    86  
     82
    8783  fEfficiencyMap.clear();
    8884  for(i = 0; i < size/3; ++i)
     
    9288    pdg = param[i*3].GetInt();
    9389    fEfficiencyMap.insert(make_pair(pdg,make_pair(param[i*3 + 1].GetInt(),formula)));
    94  
     90
    9591   // cout<<param[i*3].GetInt()<<","<<param[i*3+1].GetInt()<<","<<param[i*3 + 2].GetString()<<endl;
    96  
     92
    9793  }
    9894
     
    106102    fEfficiencyMap.insert(make_pair(0,make_pair(0,formula)));
    107103  }
    108  
     104
    109105  // import input array
    110106
     
    122118{
    123119  if(fItInputArray) delete fItInputArray;
    124  
     120
    125121  TMisIDMap::iterator itEfficiencyMap;
    126122  DelphesFormula *formula;
     
    136132
    137133void IdentificationMap::Process()
    138 { 
     134{
    139135  Candidate *candidate;
    140136  Double_t pt, eta, phi;
     
    145141
    146142  Double_t P, Pi;
    147    
     143
    148144 // cout<<"------------ New Event ------------"<<endl;
    149    
     145
    150146  fItInputArray->Reset();
    151147  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
     
    158154    pdgIn = candidate->PID;
    159155    charge = candidate->Charge;
    160    
     156
    161157   // cout<<"------------ New Candidate ------------"<<endl;
    162158   // cout<<candidate->PID<<"   "<<pt<<","<<eta<<","<<phi<<endl;
    163      
     159
    164160    P = 1.0;
    165    
     161
    166162    //first check that PID of this particle is specified in cfg, if not set look for PID=0
    167      
     163
    168164    itEfficiencyMap = fEfficiencyMap.find(pdgIn);
    169      
    170     range = fEfficiencyMap.equal_range(pdgIn); 
     165
     166    range = fEfficiencyMap.equal_range(pdgIn);
    171167    if(range.first == range.second) range = fEfficiencyMap.equal_range(-pdgIn);
    172168    if(range.first == range.second) range = fEfficiencyMap.equal_range(0);
    173    
     169
    174170    //loop over submap for this pid
    175171    for (TMisIDMap::iterator it=range.first; it!=range.second; ++it)
    176     { 
    177        
     172    {
     173
    178174      formula = (it->second).second;
    179175      pdgOut = (it->second).first;
    180176
    181177      Pi = formula->Eval(pt, eta);
    182    
     178
    183179      // check that sum of probabilities does not exceed 1.
    184180      P = (P - Pi)/P;
    185        
     181
    186182      if( P < 0.0 ) continue;
    187183      else
    188184      {
    189      
     185
    190186       //randomly assign a PID to particle according to map
    191187       Double_t rndm = gRandom->Uniform();
    192        
     188
    193189       if(rndm > P)
    194190       {
     
    198194         break;
    199195       }
    200       } 
    201        
     196      }
     197
    202198    }
    203      
     199
    204200   }
    205201
Note: See TracChangeset for help on using the changeset viewer.