Fork me on GitHub

Changeset 406b698 in git for modules


Ignore:
Timestamp:
Dec 21, 2014, 11:04:36 AM (10 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
1d1f6a4
Parents:
a740c66
Message:

replace map with vector< GridMedianBackgroundEstimator * >

Location:
modules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • modules/FastJetGridMedianEstimator.cc

    ra740c66 r406b698  
    9494void FastJetGridMedianEstimator::Init()
    9595{
    96   // read eta ranges
     96  ExRootConfParam param;
     97  Long_t i, size;
     98  Double_t drap, dphi, rapMin, rapMax;
    9799
    98   ExRootConfParam param = GetParam("GridRange");
    99   Long_t i, size;
    100  
    101   fGrid.clear();
     100  // read rapidity ranges
     101
     102  param = GetParam("GridRange");
    102103  size = param.GetSize();
     104
     105  fEstimators.clear();
    103106  for(i = 0; i < size/4; ++i)
    104107  {
    105     fGrid[make_pair(param[i*4].GetDouble(), param[i*4 + 1].GetDouble())] = make_pair(param[i*4 + 2].GetDouble(), param[i*4 + 3].GetDouble());
    106     //cout<<param[i*4].GetDouble()<<","<<  param[i*4 + 1].GetDouble()<<","<< param[i*4 + 2].GetDouble()<<","<< param[i*4 + 3].GetDouble()<<endl;
     108    rapMin = param[i*4].GetDouble();
     109    rapMax = param[i*4 + 1].GetDouble();
     110    drap = param[i*4 + 2].GetDouble();
     111    dphi = param[i*4 + 3].GetDouble();
     112    fEstimators.push_back(new GridMedianBackgroundEstimator(rapMin, rapMax, drap, dphi));
     113  }
    107114
    108   }
    109  
    110  
    111   //cout<<fGrid[make_pair(0.0,2.5)].first<<","<<fGrid[make_pair(0.0,2.5)].second<<endl;
    112  
    113  // import input array
     115  // import input array
    114116
    115117  fInputArray = ImportArray(GetString("InputArray", "Calorimeter/towers"));
     
    117119
    118120  fRhoOutputArray = ExportArray(GetString("RhoOutputArray", "rho"));
    119  
    120121}
    121122
     
    124125void FastJetGridMedianEstimator::Finish()
    125126{
     127  vector< GridMedianBackgroundEstimator * >::iterator itEstimators;
     128
     129  for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators)
     130  {
     131    if(*itEstimators) delete *itEstimators;
     132  }
     133
    126134  if(fItInputArray) delete fItInputArray;
    127135}
     
    133141  Candidate *candidate;
    134142  TLorentzVector momentum;
    135   Double_t deta, dphi, detaMin, detaMax;
    136143  Int_t number;
    137144  Double_t rho = 0;
    138145  PseudoJet jet;
    139   vector<PseudoJet> inputList, outputList;
    140  
    141   std::map< std::pair< Double_t , Double_t > , std::pair< Double_t , Double_t > >::iterator itGrid;
    142  
     146  vector< PseudoJet > inputList, outputList;
     147
     148  vector< GridMedianBackgroundEstimator * >::iterator itEstimators;;
     149
    143150  DelphesFactory *factory = GetFactory();
    144  
     151
    145152  inputList.clear();
    146  
     153
    147154  // loop over input objects
    148155  fItInputArray->Reset();
     
    157164  }
    158165
    159  
    160166  // compute rho and store it
    161  
    162   // cout<<"caio"<<endl;
    163   for(itGrid = fGrid.begin(); itGrid != fGrid.end(); ++itGrid)
     167
     168  for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators)
    164169  {
    165    //Selector select_rapidity = SelectorAbsRapRange(itEtaRangeMap->first, itEtaRangeMap->second);
    166    // JetMedianBackgroundEstimator estimator(select_rapidity, *fDefinition, *fAreaDefinition);
    167      
    168     //cout<<itGrid->first.first<<endl;
    169    
    170     detaMin = (itGrid->first).first;
    171     detaMax = (itGrid->first).second;
    172     deta    = (itGrid->second).first;
    173     dphi    = (itGrid->second).second;
    174    
    175     //cout<<detaMin<<","<<detaMax<<","<<deta<<","<<dphi<<endl;
    176    
    177    
    178     RectangularGrid grid(detaMin, detaMax, deta, dphi);
    179     //cout<<grid.is_initialised()<<endl;
    180     //cout<<grid.rapmin()<<","<<grid.rapmax()<<","<<grid.drap()<<","<<grid.dphi()<<endl;
    181      
    182     GridMedianBackgroundEstimator estimator(grid);
    183      
    184     estimator.set_particles(inputList);
    185      
    186     //cout<<estimator.description()<<endl;
    187      
    188     rho = estimator.rho();
    189     //cout<<rho<<endl;     
     170    (*itEstimators)->set_particles(inputList);
    190171
     172    rho = (*itEstimators)->rho();
    191173
    192174    candidate = factory->NewCandidate();
    193175    candidate->Momentum.SetPtEtaPhiE(rho, 0.0, 0.0, rho);
    194     candidate->Edges[0] = detaMin;
    195     candidate->Edges[1] = detaMax;
     176    candidate->Edges[0] = (*itEstimators)->rapmin();
     177    candidate->Edges[1] = (*itEstimators)->rapmax();
    196178    fRhoOutputArray->Add(candidate);
    197179  }
    198  
    199180}
  • modules/FastJetGridMedianEstimator.h

    ra740c66 r406b698  
    3030
    3131#include "classes/DelphesModule.h"
    32 #include <map>
    33 #include <utility>
    34 
     32#include <vector>
    3533
    3634class TObjArray;
     
    3836
    3937namespace fastjet {
    40   class JetDefinition;
    41   class AreaDefinition;
    42   class Selector;
    43   namespace contrib {
    44     class NjettinessPlugin;
    45   }
     38  class GridMedianBackgroundEstimator;
    4639}
    4740
     
    5851
    5952private:
    60  
    61   typedef std::map< std::pair< Double_t , Double_t > , std::pair< Double_t , Double_t > > TGrid; //!
    62    
    63   TGrid fGrid; //!
    64  
     53
     54  std::vector< fastjet::GridMedianBackgroundEstimator * > fEstimators; //!
     55
    6556  TIterator *fItInputArray; //!
    6657
Note: See TracChangeset for help on using the changeset viewer.