Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/OldCalorimeter.cc

    r341014c rb906e2b  
    1919#include "classes/DelphesFormula.h"
    2020
     21#include "ExRootAnalysis/ExRootResult.h"
     22#include "ExRootAnalysis/ExRootFilter.h"
    2123#include "ExRootAnalysis/ExRootClassifier.h"
    22 #include "ExRootAnalysis/ExRootFilter.h"
    23 #include "ExRootAnalysis/ExRootResult.h"
    24 
     24
     25#include "TMath.h"
     26#include "TString.h"
     27#include "TFormula.h"
     28#include "TRandom3.h"
     29#include "TObjArray.h"
    2530#include "TDatabasePDG.h"
    26 #include "TFormula.h"
    2731#include "TLorentzVector.h"
    28 #include "TMath.h"
    29 #include "TObjArray.h"
    30 #include "TRandom3.h"
    31 #include "TString.h"
    3232
    3333#include <algorithm>
     34#include <stdexcept>
    3435#include <iostream>
    3536#include <sstream>
    36 #include <stdexcept>
    3737
    3838using namespace std;
     
    8282  if(fItTowerECalTrackArray) delete fItTowerECalTrackArray;
    8383  if(fTowerHCalTrackArray) delete fTowerHCalTrackArray;
    84   if(fItTowerHCalTrackArray) delete fItTowerHCalTrackArray;
    85 }
     84  if(fItTowerHCalTrackArray) delete fItTowerHCalTrackArray;}
    8685
    8786//------------------------------------------------------------------------------
     
    9392  Double_t ecalFraction, hcalFraction;
    9493  TBinMap::iterator itEtaBin;
    95   set<Double_t>::iterator itPhiBin;
    96   vector<Double_t> *phiBins;
     94  set< Double_t >::iterator itPhiBin;
     95  vector< Double_t > *phiBins;
    9796
    9897  // read eta and phi bins
     
    102101  fEtaBins.clear();
    103102  fPhiBins.clear();
    104   for(i = 0; i < size / 2; ++i)
    105   {
    106     paramEtaBins = param[i * 2];
     103  for(i = 0; i < size/2; ++i)
     104  {
     105    paramEtaBins = param[i*2];
    107106    sizeEtaBins = paramEtaBins.GetSize();
    108     paramPhiBins = param[i * 2 + 1];
     107    paramPhiBins = param[i*2 + 1];
    109108    sizePhiBins = paramPhiBins.GetSize();
    110109
     
    123122  {
    124123    fEtaBins.push_back(itEtaBin->first);
    125     phiBins = new vector<double>(itEtaBin->second.size());
     124    phiBins = new vector< double >(itEtaBin->second.size());
    126125    fPhiBins.push_back(phiBins);
    127126    phiBins->clear();
     
    140139  fFractionMap[0] = make_pair(0.0, 1.0);
    141140
    142   for(i = 0; i < size / 2; ++i)
    143   {
    144     paramFractions = param[i * 2 + 1];
     141  for(i = 0; i < size/2; ++i)
     142  {
     143    paramFractions = param[i*2 + 1];
    145144    sizeFractions = paramFractions.GetSize();
    146145
     
    148147    hcalFraction = paramFractions[1].GetDouble();
    149148
    150     fFractionMap[param[i * 2].GetInt()] = make_pair(ecalFraction, hcalFraction);
    151   }
    152   /*
     149    fFractionMap[param[i*2].GetInt()] = make_pair(ecalFraction, hcalFraction);
     150  }
     151/*
    153152  TFractionMap::iterator itFractionMap;
    154153  for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap)
     
    180179void OldCalorimeter::Finish()
    181180{
    182   vector<vector<Double_t> *>::iterator itPhiBin;
     181  vector< vector< Double_t>* >::iterator itPhiBin;
    183182  if(fItParticleInputArray) delete fItParticleInputArray;
    184183  if(fItTrackInputArray) delete fItTrackInputArray;
     
    204203  TFractionMap::iterator itFractionMap;
    205204
    206   vector<Double_t>::iterator itEtaBin;
    207   vector<Double_t>::iterator itPhiBin;
    208   vector<Double_t> *phiBins;
    209 
    210   vector<Long64_t>::iterator itTowerHits;
     205  vector< Double_t >::iterator itEtaBin;
     206  vector< Double_t >::iterator itPhiBin;
     207  vector< Double_t > *phiBins;
     208
     209  vector< Long64_t >::iterator itTowerHits;
    211210
    212211  DelphesFactory *factory = GetFactory();
     
    218217  fItParticleInputArray->Reset();
    219218  number = -1;
    220   while((particle = static_cast<Candidate *>(fItParticleInputArray->Next())))
     219  while((particle = static_cast<Candidate*>(fItParticleInputArray->Next())))
    221220  {
    222221    const TLorentzVector &particlePosition = particle->Position;
     
    266265  fItTrackInputArray->Reset();
    267266  number = -1;
    268   while((track = static_cast<Candidate *>(fItTrackInputArray->Next())))
     267  while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
    269268  {
    270269    const TLorentzVector &trackPosition = track->Position;
     
    316315    towerHit = (*itTowerHits);
    317316    flags = (towerHit >> 24) & 0x00000000000000FFLL;
    318     number = (towerHit)&0x0000000000FFFFFFLL;
     317    number = (towerHit) & 0x0000000000FFFFFFLL;
    319318    hitEtaPhi = towerHit >> 32;
    320319
     
    337336
    338337      // calculate eta and phi of the tower's center
    339       fTowerEta = 0.5 * (fEtaBins[etaBin - 1] + fEtaBins[etaBin]);
    340       fTowerPhi = 0.5 * ((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);
     338      fTowerEta = 0.5*(fEtaBins[etaBin - 1] + fEtaBins[etaBin]);
     339      fTowerPhi = 0.5*((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);
    341340
    342341      fTowerEdges[0] = fEtaBins[etaBin - 1];
     
    369368    if(flags & 1)
    370369    {
    371       track = static_cast<Candidate *>(fTrackInputArray->At(number));
     370      track = static_cast<Candidate*>(fTrackInputArray->At(number));
    372371
    373372      ++fTowerTrackAllHits;
     
    409408    if(flags & 8) ++fTowerPhotonHits;
    410409
    411     particle = static_cast<Candidate *>(fParticleInputArray->At(number));
     410    particle = static_cast<Candidate*>(fParticleInputArray->At(number));
    412411    momentum = particle->Momentum;
    413412
     
    437436  if(!fTower) return;
    438437
    439   //  ecalEnergy = gRandom->Gaus(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy));
    440   //  if(ecalEnergy < 0.0) ecalEnergy = 0.0;
     438//  ecalEnergy = gRandom->Gaus(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy));
     439//  if(ecalEnergy < 0.0) ecalEnergy = 0.0;
    441440
    442441  ecalEnergy = LogNormal(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy));
    443442
    444   //  hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy));
    445   //  if(hcalEnergy < 0.0) hcalEnergy = 0.0;
     443//  hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy));
     444//  if(hcalEnergy < 0.0) hcalEnergy = 0.0;
    446445
    447446  hcalEnergy = LogNormal(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy));
     
    449448  energy = ecalEnergy + hcalEnergy;
    450449
    451   //  eta = fTowerEta;
    452   //  phi = fTowerPhi;
     450//  eta = fTowerEta;
     451//  phi = fTowerPhi;
    453452
    454453  eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
     
    482481  {
    483482    fItTowerTrackArray->Reset();
    484     while((track = static_cast<Candidate *>(fItTowerTrackArray->Next())))
     483    while((track = static_cast<Candidate*>(fItTowerTrackArray->Next())))
    485484    {
    486485      fEFlowTrackOutputArray->Add(track);
    487486    }
    488487  }
    489   else if(fTowerTrackAllHits > 0 && fTowerECalHits + fTowerHCalHits == fTowerAllHits)
    490   {
    491     if(fTowerECalHits == fTowerECalTrackHits && fTowerHCalHits == fTowerHCalTrackHits)
     488  else if(fTowerTrackAllHits > 0 &&
     489          fTowerECalHits + fTowerHCalHits == fTowerAllHits)
     490  {
     491    if(fTowerECalHits == fTowerECalTrackHits &&
     492       fTowerHCalHits == fTowerHCalTrackHits)
    492493    {
    493494      itTowerTrackArray = fItTowerTrackArray;
     
    505506
    506507        fItTowerHCalArray->Reset();
    507         while((particle = static_cast<Candidate *>(fItTowerHCalArray->Next())))
     508        while((particle = static_cast<Candidate*>(fItTowerHCalArray->Next())))
    508509        {
    509510          tower->AddCandidate(particle);
     
    537538
    538539        fItTowerECalArray->Reset();
    539         while((particle = static_cast<Candidate *>(fItTowerECalArray->Next())))
     540        while((particle = static_cast<Candidate*>(fItTowerECalArray->Next())))
    540541        {
    541542          tower->AddCandidate(particle);
     
    566567    {
    567568      itTowerTrackArray->Reset();
    568       while((track = static_cast<Candidate *>(itTowerTrackArray->Next())))
     569      while((track = static_cast<Candidate*>(itTowerTrackArray->Next())))
    569570      {
    570571        fEFlowTrackOutputArray->Add(track);
     
    586587  if(mean > 0.0)
    587588  {
    588     b = TMath::Sqrt(TMath::Log((1.0 + (sigma * sigma) / (mean * mean))));
    589     a = TMath::Log(mean) - 0.5 * b * b;
    590 
    591     return TMath::Exp(a + b * gRandom->Gaus(0, 1));
     589    b = TMath::Sqrt(TMath::Log((1.0 + (sigma*sigma)/(mean*mean))));
     590    a = TMath::Log(mean) - 0.5*b*b;
     591
     592    return TMath::Exp(a + b*gRandom->Gaus(0, 1));
    592593  }
    593594  else
Note: See TracChangeset for help on using the changeset viewer.