Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/Calorimeter.cc

    r38bf1ae r01f457a  
    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 calorimeter towers, performs calorimeter resolution smearing,
    2323 *  and creates energy flow objects (tracks, photons, and neutral hadrons).
     24 *
     25 *  $Date$
     26 *  $Revision$
     27 *
    2428 *
    2529 *  \author P. Demin - UCL, Louvain-la-Neuve
     
    8286{
    8387  ExRootConfParam param, paramEtaBins, paramPhiBins, paramFractions;
    84   Long_t i, j, k, size, sizeEtaBins, sizePhiBins;
     88  Long_t i, j, k, size, sizeEtaBins, sizePhiBins, sizeFractions;
    8589  Double_t ecalFraction, hcalFraction;
    8690  TBinMap::iterator itEtaBin;
     
    135139  {
    136140    paramFractions = param[i*2 + 1];
     141    sizeFractions = paramFractions.GetSize();
    137142
    138143    ecalFraction = paramFractions[0].GetDouble();
     
    141146    fFractionMap[param[i*2].GetInt()] = make_pair(ecalFraction, hcalFraction);
    142147  }
    143 
    144148/*
    145149  TFractionMap::iterator itFractionMap;
     
    151155
    152156  // read min E value for towers to be saved
    153   fECalEnergyMin = GetDouble("ECalEnergyMin", 0.0);
    154   fHCalEnergyMin = GetDouble("HCalEnergyMin", 0.0);
    155 
    156   fECalEnergySignificanceMin = GetDouble("ECalEnergySignificanceMin", 0.0);
    157   fHCalEnergySignificanceMin = GetDouble("HCalEnergySignificanceMin", 0.0);
    158 
    159   // switch on or off the dithering of the center of calorimeter towers
    160   fDitherTowerCenter = GetBool("DitherTowerCenter", true);
    161 
     157  fEcalEnergyMin = GetDouble("EcalTowerMinEnergy", 0.0);
     158  fHcalEnergyMin = GetDouble("HcalTowerMinEnergy", 0.0);
     159 
     160  fEcalSigmaMin  = GetDouble("EcalTowerMinSignificance", 0.0);
     161  fHcalSigmaMin  = GetDouble("HcalTowerMinSignificance", 0.0);
     162
     163 
    162164  // read resolution formulas
    163165  fECalResolutionFormula->Compile(GetString("ECalResolutionFormula", "0"));
     
    174176  fTowerOutputArray = ExportArray(GetString("TowerOutputArray", "towers"));
    175177  fPhotonOutputArray = ExportArray(GetString("PhotonOutputArray", "photons"));
    176 
     178 
    177179  fEFlowTrackOutputArray = ExportArray(GetString("EFlowTrackOutputArray", "eflowTracks"));
    178180  fEFlowPhotonOutputArray = ExportArray(GetString("EFlowPhotonOutputArray", "eflowPhotons"));
    179181  fEFlowNeutralHadronOutputArray = ExportArray(GetString("EFlowNeutralHadronOutputArray", "eflowNeutralHadrons"));
     182
     183
    180184}
    181185
     
    362366      fTrackHCalTime = 0.0;
    363367
    364       fTowerECalTimeWeight = 0.0;
    365       fTowerHCalTimeWeight = 0.0;
    366 
     368      fTowerECalWeightTime = 0.0;
     369      fTowerHCalWeightTime = 0.0;
     370     
    367371      fTowerTrackHits = 0;
    368372      fTowerPhotonHits = 0;
    369 
     373     
    370374      fTowerTrackArray->Clear();
    371375    }
     
    380384      position = track->Position;
    381385
    382 
     386     
    383387      ecalEnergy = momentum.E() * fTrackECalFractions[number];
    384388      hcalEnergy = momentum.E() * fTrackHCalFractions[number];
     
    386390      fTrackECalEnergy += ecalEnergy;
    387391      fTrackHCalEnergy += hcalEnergy;
    388 
     392     
    389393      fTrackECalTime += TMath::Sqrt(ecalEnergy)*position.T();
    390394      fTrackHCalTime += TMath::Sqrt(hcalEnergy)*position.T();
    391 
    392       fTrackECalTimeWeight += TMath::Sqrt(ecalEnergy);
    393       fTrackHCalTimeWeight += TMath::Sqrt(hcalEnergy);
     395       
     396      fTrackECalWeightTime += TMath::Sqrt(ecalEnergy);
     397      fTrackHCalWeightTime += TMath::Sqrt(hcalEnergy);
    394398
    395399      fTowerTrackArray->Add(track);
     
    397401      continue;
    398402    }
    399 
     403   
    400404    // check for photon and electron hits in current tower
    401405    if(flags & 2) ++fTowerPhotonHits;
    402 
     406   
    403407    particle = static_cast<Candidate*>(fParticleInputArray->At(number));
    404408    momentum = particle->Momentum;
     
    415419    fTowerHCalTime += TMath::Sqrt(hcalEnergy)*position.T();
    416420
    417     fTowerECalTimeWeight += TMath::Sqrt(ecalEnergy);
    418     fTowerHCalTimeWeight += TMath::Sqrt(hcalEnergy);
    419 
     421    fTowerECalWeightTime += TMath::Sqrt(ecalEnergy);
     422    fTowerHCalWeightTime += TMath::Sqrt(hcalEnergy);
     423   
    420424
    421425    fTower->AddCandidate(particle);
     
    437441
    438442  if(!fTower) return;
     443//  cout<<"----------------------"<<endl;
     444//  cout<<"Finalize Tower"<<endl;
     445//  cout<<""<<endl;
     446
    439447
    440448  ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy);
     449
     450//  ecalEnergy = gRandom->Gaus(fTowerECalEnergy, ecalSigma);
     451//  if(ecalEnergy < 0.0) ecalEnergy = 0.0;
     452
     453  ecalEnergy = LogNormal(fTowerECalEnergy, ecalSigma);
     454  ecalTime = (fTowerECalWeightTime < 1.0E-09 ) ? 0 : fTowerECalTime/fTowerECalWeightTime;
     455
    441456  hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy);
    442457
    443   ecalEnergy = LogNormal(fTowerECalEnergy, ecalSigma);
     458//  hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, hcalSigma);
     459//  if(hcalEnergy < 0.0) hcalEnergy = 0.0;
     460
    444461  hcalEnergy = LogNormal(fTowerHCalEnergy, hcalSigma);
    445 
    446   ecalTime = (fTowerECalTimeWeight < 1.0E-09 ) ? 0.0 : fTowerECalTime/fTowerECalTimeWeight;
    447   hcalTime = (fTowerHCalTimeWeight < 1.0E-09 ) ? 0.0 : fTowerHCalTime/fTowerHCalTimeWeight;
    448 
     462  hcalTime = (fTowerHCalWeightTime < 1.0E-09 ) ? 0 : fTowerHCalTime/fTowerHCalWeightTime;
     463
     464 
    449465  ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy);
    450466  hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy);
    451467
    452   if(ecalEnergy < fECalEnergyMin || ecalEnergy < fECalEnergySignificanceMin*ecalSigma) ecalEnergy = 0.0;
    453   if(hcalEnergy < fHCalEnergyMin || hcalEnergy < fHCalEnergySignificanceMin*hcalSigma) hcalEnergy = 0.0;
     468  ecalEnergy = (ecalEnergy < fEcalEnergyMin || ecalEnergy < fEcalSigmaMin*ecalSigma) ? 0 : ecalEnergy;
     469  hcalEnergy = (hcalEnergy < fHcalEnergyMin || hcalEnergy < fHcalSigmaMin*hcalSigma) ? 0 : hcalEnergy;
    454470
    455471  energy = ecalEnergy + hcalEnergy;
    456   time = (TMath::Sqrt(ecalEnergy)*ecalTime + TMath::Sqrt(hcalEnergy)*hcalTime)/(TMath::Sqrt(ecalEnergy) + TMath::Sqrt(hcalEnergy));
    457 
    458   if(fDitherTowerCenter)
    459   {
    460     eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
    461     phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]);
    462   }
    463   else
    464   {
    465     eta = fTowerEta;
    466     phi = fTowerPhi;
    467   }
     472  time = (TMath::Sqrt(ecalEnergy)*ecalTime + TMath::Sqrt(hcalEnergy)*hcalTime)/(TMath::Sqrt(ecalEnergy) + TMath::Sqrt(hcalEnergy));
     473
     474//  eta = fTowerEta;
     475//  phi = fTowerPhi;
     476
     477  eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
     478  phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]);
    468479
    469480  pt = energy / TMath::CosH(eta);
    470481
     482 // fTower->Position.SetXYZT(-time, 0.0, 0.0, time);
    471483  fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time);
    472484  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
     
    479491  fTower->Edges[3] = fTowerEdges[3];
    480492
    481   if(energy > 0.0)
     493  if( energy > 0.0 )
    482494  {
    483495    if(fTowerPhotonHits > 0 && fTowerTrackHits == 0)
     
    485497      fPhotonOutputArray->Add(fTower);
    486498    }
    487 
     499   
    488500    fTowerOutputArray->Add(fTower);
    489501  }
     
    499511
    500512  ecalEnergy -= fTrackECalEnergy;
     513  if(ecalEnergy < fEcalEnergyMin || ecalEnergy < fEcalSigmaMin*fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy)) ecalEnergy = 0.0;
     514
    501515  hcalEnergy -= fTrackHCalEnergy;
    502 
    503   ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy);
    504   hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy);
    505 
    506   if(ecalEnergy < fECalEnergyMin || ecalEnergy < fECalEnergySignificanceMin*ecalSigma) ecalEnergy = 0.0;
    507   if(hcalEnergy < fHCalEnergyMin || hcalEnergy < fHCalEnergySignificanceMin*hcalSigma) hcalEnergy = 0.0;
     516  if(hcalEnergy < fHcalEnergyMin || hcalEnergy < fHcalSigmaMin*fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy)) hcalEnergy = 0.0;
    508517
    509518  energy = ecalEnergy + hcalEnergy;
     
    518527    tower->Momentum.SetPtEtaPhiE(pt, eta, phi, ecalEnergy);
    519528    tower->Eem = ecalEnergy;
    520     tower->Ehad = 0.0;
     529    tower->Ehad = 0;
    521530
    522531    fEFlowPhotonOutputArray->Add(tower);
     
    530539
    531540    tower->Momentum.SetPtEtaPhiE(pt, eta, phi, hcalEnergy);
    532     tower->Eem = 0.0;
     541    tower->Eem = 0;
    533542    tower->Ehad = hcalEnergy;
    534543
    535544    fEFlowNeutralHadronOutputArray->Add(tower);
    536545  }
     546
     547
     548
     549
    537550}
    538551
     
    548561    a = TMath::Log(mean) - 0.5*b*b;
    549562
    550     return TMath::Exp(a + b*gRandom->Gaus(0.0, 1.0));
     563    return TMath::Exp(a + b*gRandom->Gaus(0, 1));
    551564  }
    552565  else
Note: See TracChangeset for help on using the changeset viewer.