Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/OldCalorimeter.cc

    rb906e2b r341014c  
    1919#include "classes/DelphesFormula.h"
    2020
     21#include "ExRootAnalysis/ExRootClassifier.h"
     22#include "ExRootAnalysis/ExRootFilter.h"
    2123#include "ExRootAnalysis/ExRootResult.h"
    22 #include "ExRootAnalysis/ExRootFilter.h"
    23 #include "ExRootAnalysis/ExRootClassifier.h"
    24 
     24
     25#include "TDatabasePDG.h"
     26#include "TFormula.h"
     27#include "TLorentzVector.h"
    2528#include "TMath.h"
     29#include "TObjArray.h"
     30#include "TRandom3.h"
    2631#include "TString.h"
    27 #include "TFormula.h"
    28 #include "TRandom3.h"
    29 #include "TObjArray.h"
    30 #include "TDatabasePDG.h"
    31 #include "TLorentzVector.h"
    3232
    3333#include <algorithm>
    34 #include <stdexcept>
    3534#include <iostream>
    3635#include <sstream>
     36#include <stdexcept>
    3737
    3838using namespace std;
     
    8282  if(fItTowerECalTrackArray) delete fItTowerECalTrackArray;
    8383  if(fTowerHCalTrackArray) delete fTowerHCalTrackArray;
    84   if(fItTowerHCalTrackArray) delete fItTowerHCalTrackArray;}
     84  if(fItTowerHCalTrackArray) delete fItTowerHCalTrackArray;
     85}
    8586
    8687//------------------------------------------------------------------------------
     
    9293  Double_t ecalFraction, hcalFraction;
    9394  TBinMap::iterator itEtaBin;
    94   set< Double_t >::iterator itPhiBin;
    95   vector< Double_t > *phiBins;
     95  set<Double_t>::iterator itPhiBin;
     96  vector<Double_t> *phiBins;
    9697
    9798  // read eta and phi bins
     
    101102  fEtaBins.clear();
    102103  fPhiBins.clear();
    103   for(i = 0; i < size/2; ++i)
    104   {
    105     paramEtaBins = param[i*2];
     104  for(i = 0; i < size / 2; ++i)
     105  {
     106    paramEtaBins = param[i * 2];
    106107    sizeEtaBins = paramEtaBins.GetSize();
    107     paramPhiBins = param[i*2 + 1];
     108    paramPhiBins = param[i * 2 + 1];
    108109    sizePhiBins = paramPhiBins.GetSize();
    109110
     
    122123  {
    123124    fEtaBins.push_back(itEtaBin->first);
    124     phiBins = new vector< double >(itEtaBin->second.size());
     125    phiBins = new vector<double>(itEtaBin->second.size());
    125126    fPhiBins.push_back(phiBins);
    126127    phiBins->clear();
     
    139140  fFractionMap[0] = make_pair(0.0, 1.0);
    140141
    141   for(i = 0; i < size/2; ++i)
    142   {
    143     paramFractions = param[i*2 + 1];
     142  for(i = 0; i < size / 2; ++i)
     143  {
     144    paramFractions = param[i * 2 + 1];
    144145    sizeFractions = paramFractions.GetSize();
    145146
     
    147148    hcalFraction = paramFractions[1].GetDouble();
    148149
    149     fFractionMap[param[i*2].GetInt()] = make_pair(ecalFraction, hcalFraction);
    150   }
    151 /*
     150    fFractionMap[param[i * 2].GetInt()] = make_pair(ecalFraction, hcalFraction);
     151  }
     152  /*
    152153  TFractionMap::iterator itFractionMap;
    153154  for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap)
     
    179180void OldCalorimeter::Finish()
    180181{
    181   vector< vector< Double_t>* >::iterator itPhiBin;
     182  vector<vector<Double_t> *>::iterator itPhiBin;
    182183  if(fItParticleInputArray) delete fItParticleInputArray;
    183184  if(fItTrackInputArray) delete fItTrackInputArray;
     
    203204  TFractionMap::iterator itFractionMap;
    204205
    205   vector< Double_t >::iterator itEtaBin;
    206   vector< Double_t >::iterator itPhiBin;
    207   vector< Double_t > *phiBins;
    208 
    209   vector< Long64_t >::iterator itTowerHits;
     206  vector<Double_t>::iterator itEtaBin;
     207  vector<Double_t>::iterator itPhiBin;
     208  vector<Double_t> *phiBins;
     209
     210  vector<Long64_t>::iterator itTowerHits;
    210211
    211212  DelphesFactory *factory = GetFactory();
     
    217218  fItParticleInputArray->Reset();
    218219  number = -1;
    219   while((particle = static_cast<Candidate*>(fItParticleInputArray->Next())))
     220  while((particle = static_cast<Candidate *>(fItParticleInputArray->Next())))
    220221  {
    221222    const TLorentzVector &particlePosition = particle->Position;
     
    265266  fItTrackInputArray->Reset();
    266267  number = -1;
    267   while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
     268  while((track = static_cast<Candidate *>(fItTrackInputArray->Next())))
    268269  {
    269270    const TLorentzVector &trackPosition = track->Position;
     
    315316    towerHit = (*itTowerHits);
    316317    flags = (towerHit >> 24) & 0x00000000000000FFLL;
    317     number = (towerHit) & 0x0000000000FFFFFFLL;
     318    number = (towerHit)&0x0000000000FFFFFFLL;
    318319    hitEtaPhi = towerHit >> 32;
    319320
     
    336337
    337338      // calculate eta and phi of the tower's center
    338       fTowerEta = 0.5*(fEtaBins[etaBin - 1] + fEtaBins[etaBin]);
    339       fTowerPhi = 0.5*((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);
     339      fTowerEta = 0.5 * (fEtaBins[etaBin - 1] + fEtaBins[etaBin]);
     340      fTowerPhi = 0.5 * ((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);
    340341
    341342      fTowerEdges[0] = fEtaBins[etaBin - 1];
     
    368369    if(flags & 1)
    369370    {
    370       track = static_cast<Candidate*>(fTrackInputArray->At(number));
     371      track = static_cast<Candidate *>(fTrackInputArray->At(number));
    371372
    372373      ++fTowerTrackAllHits;
     
    408409    if(flags & 8) ++fTowerPhotonHits;
    409410
    410     particle = static_cast<Candidate*>(fParticleInputArray->At(number));
     411    particle = static_cast<Candidate *>(fParticleInputArray->At(number));
    411412    momentum = particle->Momentum;
    412413
     
    436437  if(!fTower) return;
    437438
    438 //  ecalEnergy = gRandom->Gaus(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy));
    439 //  if(ecalEnergy < 0.0) ecalEnergy = 0.0;
     439  //  ecalEnergy = gRandom->Gaus(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy));
     440  //  if(ecalEnergy < 0.0) ecalEnergy = 0.0;
    440441
    441442  ecalEnergy = LogNormal(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy));
    442443
    443 //  hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy));
    444 //  if(hcalEnergy < 0.0) hcalEnergy = 0.0;
     444  //  hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy));
     445  //  if(hcalEnergy < 0.0) hcalEnergy = 0.0;
    445446
    446447  hcalEnergy = LogNormal(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy));
     
    448449  energy = ecalEnergy + hcalEnergy;
    449450
    450 //  eta = fTowerEta;
    451 //  phi = fTowerPhi;
     451  //  eta = fTowerEta;
     452  //  phi = fTowerPhi;
    452453
    453454  eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
     
    481482  {
    482483    fItTowerTrackArray->Reset();
    483     while((track = static_cast<Candidate*>(fItTowerTrackArray->Next())))
     484    while((track = static_cast<Candidate *>(fItTowerTrackArray->Next())))
    484485    {
    485486      fEFlowTrackOutputArray->Add(track);
    486487    }
    487488  }
    488   else if(fTowerTrackAllHits > 0 &&
    489           fTowerECalHits + fTowerHCalHits == fTowerAllHits)
    490   {
    491     if(fTowerECalHits == fTowerECalTrackHits &&
    492        fTowerHCalHits == fTowerHCalTrackHits)
     489  else if(fTowerTrackAllHits > 0 && fTowerECalHits + fTowerHCalHits == fTowerAllHits)
     490  {
     491    if(fTowerECalHits == fTowerECalTrackHits && fTowerHCalHits == fTowerHCalTrackHits)
    493492    {
    494493      itTowerTrackArray = fItTowerTrackArray;
     
    506505
    507506        fItTowerHCalArray->Reset();
    508         while((particle = static_cast<Candidate*>(fItTowerHCalArray->Next())))
     507        while((particle = static_cast<Candidate *>(fItTowerHCalArray->Next())))
    509508        {
    510509          tower->AddCandidate(particle);
     
    538537
    539538        fItTowerECalArray->Reset();
    540         while((particle = static_cast<Candidate*>(fItTowerECalArray->Next())))
     539        while((particle = static_cast<Candidate *>(fItTowerECalArray->Next())))
    541540        {
    542541          tower->AddCandidate(particle);
     
    567566    {
    568567      itTowerTrackArray->Reset();
    569       while((track = static_cast<Candidate*>(itTowerTrackArray->Next())))
     568      while((track = static_cast<Candidate *>(itTowerTrackArray->Next())))
    570569      {
    571570        fEFlowTrackOutputArray->Add(track);
     
    587586  if(mean > 0.0)
    588587  {
    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));
     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));
    593592  }
    594593  else
Note: See TracChangeset for help on using the changeset viewer.