Fork me on GitHub

Changeset d870fc5 in git for modules/SimpleCalorimeter.cc


Ignore:
Timestamp:
Dec 21, 2014, 4:03:35 PM (10 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
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.
Message:

Merge remote-tracking branch 'upstream/master'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/SimpleCalorimeter.cc

    r7f12612 rd870fc5  
    22 *  Delphes: a framework for fast simulation of a generic collider experiment
    33 *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
    4  * 
     4 *
    55 *  This program is free software: you can redistribute it and/or modify
    66 *  it under the terms of the GNU General Public License as published by
    77 *  the Free Software Foundation, either version 3 of the License, or
    88 *  (at your option) any later version.
    9  * 
     9 *
    1010 *  This program is distributed in the hope that it will be useful,
    1111 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    1212 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1313 *  GNU General Public License for more details.
    14  * 
     14 *
    1515 *  You should have received a copy of the GNU General Public License
    1616 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    2222 *  Fills SimpleCalorimeter towers, performs SimpleCalorimeter resolution smearing,
    2323 *  and creates energy flow objects (tracks, photons, and neutral hadrons).
    24  *
    25  *  $Date: 2014-04-16 15:29:31 +0200 (Wed, 16 Apr 2014) $
    26  *  $Revision: 1364 $
    27  *
    2824 *
    2925 *  \author P. Demin - UCL, Louvain-la-Neuve
     
    6460{
    6561  fResolutionFormula = new DelphesFormula;
    66  
     62
    6763  fTowerTrackArray = new TObjArray;
    6864  fItTowerTrackArray = fTowerTrackArray->MakeIterator();
     
    7470{
    7571  if(fResolutionFormula) delete fResolutionFormula;
    76  
     72
    7773  if(fTowerTrackArray) delete fTowerTrackArray;
    7874  if(fItTowerTrackArray) delete fItTowerTrackArray;
     
    140136    fFractionMap[param[i*2].GetInt()] = fraction;
    141137  }
     138
    142139/*
    143140  TFractionMap::iterator itFractionMap;
     
    149146
    150147  // read min E value for towers to be saved
    151   fEnergyMin = GetDouble("TowerMinEnergy", 0.0);
    152   fSigmaMin  = GetDouble("TowerMinSignificance", 0.0);
    153  
     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
    154155  // read resolution formulas
    155156  fResolutionFormula->Compile(GetString("ResolutionFormula", "0"));
    156  
     157
    157158  // import array with output from other modules
    158159  fParticleInputArray = ImportArray(GetString("ParticleInputArray", "ParticlePropagator/particles"));
     
    165166  fTowerOutputArray = ExportArray(GetString("TowerOutputArray", "towers"));
    166167  fEFlowTowerOutputArray = ExportArray(GetString("EFlowTowerOutputArray", "eflowTowers"));
    167  
    168168}
    169169
     
    206206  fTowerFractions.clear();
    207207  fTrackFractions.clear();
    208  
     208
    209209  // loop over all particles
    210210  fItParticleInputArray->Reset();
     
    225225    fraction = itFractionMap->second;
    226226    fTowerFractions.push_back(fraction);
    227    
     227
    228228    if(fraction < 1.0E-9) continue;
    229229
     
    267267
    268268    fraction = itFractionMap->second;
    269  
     269
    270270    fTrackFractions.push_back(fraction);
    271  
     271
    272272    // find eta bin [1, fEtaBins.size - 1]
    273273    itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), trackPosition.Eta());
     
    333333      fTowerEnergy = 0.0;
    334334      fTrackEnergy = 0.0;
    335      
     335
    336336      fTowerTime = 0.0;
    337337      fTrackTime = 0.0;
    338      
    339       fTowerWeightTime = 0.0;
    340      
     338
     339      fTowerTimeWeight = 0.0;
     340
    341341      fTowerTrackHits = 0;
    342342      fTowerPhotonHits = 0;
    343      
     343
    344344      fTowerTrackArray->Clear();
    345345    }
     
    353353      momentum = track->Momentum;
    354354      position = track->Position;
    355  
     355
    356356      energy = momentum.E() * fTrackFractions[number];
    357      
     357
    358358      fTrackEnergy += energy;
    359      
     359
    360360      fTrackTime += TMath::Sqrt(energy)*position.T();
    361       fTrackWeightTime += TMath::Sqrt(energy);
    362    
     361      fTrackTimeWeight += TMath::Sqrt(energy);
     362
    363363      fTowerTrackArray->Add(track);
    364364
    365365      continue;
    366366    }
    367    
     367
    368368    // check for photon and electron hits in current tower
    369369    if(flags & 2) ++fTowerPhotonHits;
    370    
     370
    371371    particle = static_cast<Candidate*>(fParticleInputArray->At(number));
    372372    momentum = particle->Momentum;
     
    375375    // fill current tower
    376376    energy = momentum.E() * fTowerFractions[number];
    377    
     377
    378378    fTowerEnergy += energy;
    379    
     379
    380380    fTowerTime += TMath::Sqrt(energy)*position.T();
    381     fTowerWeightTime += TMath::Sqrt(energy);
    382    
     381    fTowerTimeWeight += TMath::Sqrt(energy);
     382
    383383    fTower->AddCandidate(particle);
    384384  }
     
    401401  sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerEnergy);
    402402
    403 //  energy = gRandom->Gaus(fTowerEnergy, sigma);
    404 //  if(energy < 0.0) energy = 0.0;
    405 
    406403  energy = LogNormal(fTowerEnergy, sigma);
    407   time = (fTowerWeightTime < 1.0E-09 ) ? 0 : fTowerTime/fTowerWeightTime;
     404
     405  time = (fTowerTimeWeight < 1.0E-09 ) ? 0.0 : fTowerTime/fTowerTimeWeight;
    408406
    409407  sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy);
    410  
    411   energy = (energy < fEnergyMin || energy < fSigmaMin*sigma) ? 0 : energy;
    412  
    413   eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
    414   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  }
    415421
    416422  pt = energy / TMath::CosH(eta);
    417423
    418  // fTower->Position.SetXYZT(-time, 0.0, 0.0, time);
    419424  fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time);
    420425  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
    421  
     426
    422427  fTower->Edges[0] = fTowerEdges[0];
    423428  fTower->Edges[1] = fTowerEdges[1];
     
    425430  fTower->Edges[3] = fTowerEdges[3];
    426431
    427 
    428432  // fill SimpleCalorimeter towers
    429433  if(energy > 0.0) fTowerOutputArray->Add(fTower);
    430434
    431  
    432435  // fill energy flow candidates
    433436  energy -= fTrackEnergy;
    434   if(energy < fEnergyMin || energy < fSigmaMin*fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy)) energy = 0.0;
    435    
     437
     438  sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy);
     439
     440  if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0;
     441
    436442  // save energy excess as an energy flow tower
    437443  if(energy > 0.0)
     
    444450    fEFlowTowerOutputArray->Add(tower);
    445451  }
    446 
    447452}
    448453
     
    458463    a = TMath::Log(mean) - 0.5*b*b;
    459464
    460     return TMath::Exp(a + b*gRandom->Gaus(0, 1));
     465    return TMath::Exp(a + b*gRandom->Gaus(0.0, 1.0));
    461466  }
    462467  else
Note: See TracChangeset for help on using the changeset viewer.