Fork me on GitHub

Changeset e5767b57 in git for modules


Ignore:
Timestamp:
Dec 21, 2014, 1:33:49 PM (10 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
a5bbe8a, d870fc5
Parents:
f10999a
Message:

add DitherTowerCenter parameter (#363) and replace TowerMinEnergy and TowerMinSignificance with EnergyMin and EnergySignificanceMin

Location:
modules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • modules/SimpleCalorimeter.cc

    rf10999a re5767b57  
    6060{
    6161  fResolutionFormula = new DelphesFormula;
    62  
     62
    6363  fTowerTrackArray = new TObjArray;
    6464  fItTowerTrackArray = fTowerTrackArray->MakeIterator();
     
    7070{
    7171  if(fResolutionFormula) delete fResolutionFormula;
    72  
     72
    7373  if(fTowerTrackArray) delete fTowerTrackArray;
    7474  if(fItTowerTrackArray) delete fItTowerTrackArray;
     
    136136    fFractionMap[param[i*2].GetInt()] = fraction;
    137137  }
     138
    138139/*
    139140  TFractionMap::iterator itFractionMap;
     
    145146
    146147  // read min E value for towers to be saved
    147   fEnergyMin = GetDouble("TowerMinEnergy", 0.0);
    148   fSigmaMin  = GetDouble("TowerMinSignificance", 0.0);
    149  
     148  fEnergyMin = GetDouble("EnergyMin", 0.0);
     149
     150  fEnergySignificanceMin = GetDouble("EnergySignificanceMin", 0.0);
     151
     152  // switch on or off the dithering of the center of calorimeter towers
     153  fDitherTowerCenter = GetBool("DitherTowerCenter", true);
     154
    150155  // read resolution formulas
    151156  fResolutionFormula->Compile(GetString("ResolutionFormula", "0"));
    152  
     157
    153158  // import array with output from other modules
    154159  fParticleInputArray = ImportArray(GetString("ParticleInputArray", "ParticlePropagator/particles"));
     
    161166  fTowerOutputArray = ExportArray(GetString("TowerOutputArray", "towers"));
    162167  fEFlowTowerOutputArray = ExportArray(GetString("EFlowTowerOutputArray", "eflowTowers"));
    163  
    164168}
    165169
     
    202206  fTowerFractions.clear();
    203207  fTrackFractions.clear();
    204  
     208
    205209  // loop over all particles
    206210  fItParticleInputArray->Reset();
     
    221225    fraction = itFractionMap->second;
    222226    fTowerFractions.push_back(fraction);
    223    
     227
    224228    if(fraction < 1.0E-9) continue;
    225229
     
    263267
    264268    fraction = itFractionMap->second;
    265  
     269
    266270    fTrackFractions.push_back(fraction);
    267  
     271
    268272    // find eta bin [1, fEtaBins.size - 1]
    269273    itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), trackPosition.Eta());
     
    329333      fTowerEnergy = 0.0;
    330334      fTrackEnergy = 0.0;
    331      
     335
    332336      fTowerTime = 0.0;
    333337      fTrackTime = 0.0;
    334      
    335       fTowerWeightTime = 0.0;
    336      
     338
     339      fTowerTimeWeight = 0.0;
     340
    337341      fTowerTrackHits = 0;
    338342      fTowerPhotonHits = 0;
    339      
     343
    340344      fTowerTrackArray->Clear();
    341345    }
     
    349353      momentum = track->Momentum;
    350354      position = track->Position;
    351  
     355
    352356      energy = momentum.E() * fTrackFractions[number];
    353      
     357
    354358      fTrackEnergy += energy;
    355      
     359
    356360      fTrackTime += TMath::Sqrt(energy)*position.T();
    357       fTrackWeightTime += TMath::Sqrt(energy);
    358    
     361      fTrackTimeWeight += TMath::Sqrt(energy);
     362
    359363      fTowerTrackArray->Add(track);
    360364
    361365      continue;
    362366    }
    363    
     367
    364368    // check for photon and electron hits in current tower
    365369    if(flags & 2) ++fTowerPhotonHits;
    366    
     370
    367371    particle = static_cast<Candidate*>(fParticleInputArray->At(number));
    368372    momentum = particle->Momentum;
     
    371375    // fill current tower
    372376    energy = momentum.E() * fTowerFractions[number];
    373    
     377
    374378    fTowerEnergy += energy;
    375    
     379
    376380    fTowerTime += TMath::Sqrt(energy)*position.T();
    377     fTowerWeightTime += TMath::Sqrt(energy);
    378    
     381    fTowerTimeWeight += TMath::Sqrt(energy);
     382
    379383    fTower->AddCandidate(particle);
    380384  }
     
    397401  sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerEnergy);
    398402
    399 //  energy = gRandom->Gaus(fTowerEnergy, sigma);
    400 //  if(energy < 0.0) energy = 0.0;
    401 
    402403  energy = LogNormal(fTowerEnergy, sigma);
    403   time = (fTowerWeightTime < 1.0E-09 ) ? 0 : fTowerTime/fTowerWeightTime;
     404
     405  time = (fTowerTimeWeight < 1.0E-09 ) ? 0.0 : fTowerTime/fTowerTimeWeight;
    404406
    405407  sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy);
    406  
    407   energy = (energy < fEnergyMin || energy < fSigmaMin*sigma) ? 0 : energy;
    408  
    409   eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
    410   phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]);
     408
     409  if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0;
     410
     411  if(fDitherTowerCenter)
     412  {
     413    eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
     414    phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]);
     415  }
     416  else
     417  {
     418    eta = fTowerEta;
     419    phi = fTowerPhi;
     420  }
    411421
    412422  pt = energy / TMath::CosH(eta);
    413423
    414  // fTower->Position.SetXYZT(-time, 0.0, 0.0, time);
    415424  fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time);
    416425  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
    417  
     426
    418427  fTower->Edges[0] = fTowerEdges[0];
    419428  fTower->Edges[1] = fTowerEdges[1];
     
    421430  fTower->Edges[3] = fTowerEdges[3];
    422431
    423 
    424432  // fill SimpleCalorimeter towers
    425433  if(energy > 0.0) fTowerOutputArray->Add(fTower);
    426434
    427  
    428435  // fill energy flow candidates
    429436  energy -= fTrackEnergy;
    430   if(energy < fEnergyMin || energy < fSigmaMin*fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy)) energy = 0.0;
    431    
     437
     438  sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy);
     439
     440  if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0;
     441
    432442  // save energy excess as an energy flow tower
    433443  if(energy > 0.0)
     
    440450    fEFlowTowerOutputArray->Add(tower);
    441451  }
    442 
    443452}
    444453
     
    454463    a = TMath::Log(mean) - 0.5*b*b;
    455464
    456     return TMath::Exp(a + b*gRandom->Gaus(0, 1));
     465    return TMath::Exp(a + b*gRandom->Gaus(0.0, 1.0));
    457466  }
    458467  else
  • modules/SimpleCalorimeter.h

    rf10999a re5767b57  
    5959  Double_t fTowerEnergy;
    6060  Double_t fTrackEnergy;
    61  
     61
    6262  Double_t fTowerTime;
    6363  Double_t fTrackTime;
    64    
    65   Double_t fTowerWeightTime;
    66   Double_t fTrackWeightTime;
    67  
     64
     65  Double_t fTowerTimeWeight;
     66  Double_t fTrackTimeWeight;
     67
    6868  Int_t fTowerTrackHits, fTowerPhotonHits;
    6969
    7070  Double_t fEnergyMin;
    71   Double_t fSigmaMin;
     71
     72  Double_t fEnergySignificanceMin;
     73
     74  Bool_t fDitherTowerCenter;
    7275
    7376  TFractionMap fFractionMap; //!
     
    8083
    8184  std::vector < Double_t > fTowerFractions;
    82  
     85
    8386  std::vector < Double_t > fTrackFractions;
    84  
     87
    8588  DelphesFormula *fResolutionFormula; //!
    86  
     89
    8790  TIterator *fItParticleInputArray; //!
    8891  TIterator *fItTrackInputArray; //!
     
    9295
    9396  TObjArray *fTowerOutputArray; //!
    94  
     97
    9598  TObjArray *fEFlowTowerOutputArray; //!
    96  
     99
    97100  TObjArray *fTowerTrackArray; //!
    98101  TIterator *fItTowerTrackArray; //!
Note: See TracChangeset for help on using the changeset viewer.