Changes in modules/OldCalorimeter.cc [341014c:b906e2b] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/OldCalorimeter.cc
r341014c rb906e2b 19 19 #include "classes/DelphesFormula.h" 20 20 21 #include "ExRootAnalysis/ExRootResult.h" 22 #include "ExRootAnalysis/ExRootFilter.h" 21 23 #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" 25 30 #include "TDatabasePDG.h" 26 #include "TFormula.h"27 31 #include "TLorentzVector.h" 28 #include "TMath.h"29 #include "TObjArray.h"30 #include "TRandom3.h"31 #include "TString.h"32 32 33 33 #include <algorithm> 34 #include <stdexcept> 34 35 #include <iostream> 35 36 #include <sstream> 36 #include <stdexcept>37 37 38 38 using namespace std; … … 82 82 if(fItTowerECalTrackArray) delete fItTowerECalTrackArray; 83 83 if(fTowerHCalTrackArray) delete fTowerHCalTrackArray; 84 if(fItTowerHCalTrackArray) delete fItTowerHCalTrackArray; 85 } 84 if(fItTowerHCalTrackArray) delete fItTowerHCalTrackArray;} 86 85 87 86 //------------------------------------------------------------------------------ … … 93 92 Double_t ecalFraction, hcalFraction; 94 93 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; 97 96 98 97 // read eta and phi bins … … 102 101 fEtaBins.clear(); 103 102 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]; 107 106 sizeEtaBins = paramEtaBins.GetSize(); 108 paramPhiBins = param[i *2 + 1];107 paramPhiBins = param[i*2 + 1]; 109 108 sizePhiBins = paramPhiBins.GetSize(); 110 109 … … 123 122 { 124 123 fEtaBins.push_back(itEtaBin->first); 125 phiBins = new vector< double>(itEtaBin->second.size());124 phiBins = new vector< double >(itEtaBin->second.size()); 126 125 fPhiBins.push_back(phiBins); 127 126 phiBins->clear(); … … 140 139 fFractionMap[0] = make_pair(0.0, 1.0); 141 140 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]; 145 144 sizeFractions = paramFractions.GetSize(); 146 145 … … 148 147 hcalFraction = paramFractions[1].GetDouble(); 149 148 150 fFractionMap[param[i *2].GetInt()] = make_pair(ecalFraction, hcalFraction);151 } 152 149 fFractionMap[param[i*2].GetInt()] = make_pair(ecalFraction, hcalFraction); 150 } 151 /* 153 152 TFractionMap::iterator itFractionMap; 154 153 for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap) … … 180 179 void OldCalorimeter::Finish() 181 180 { 182 vector< vector<Double_t> *>::iterator itPhiBin;181 vector< vector< Double_t>* >::iterator itPhiBin; 183 182 if(fItParticleInputArray) delete fItParticleInputArray; 184 183 if(fItTrackInputArray) delete fItTrackInputArray; … … 204 203 TFractionMap::iterator itFractionMap; 205 204 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; 211 210 212 211 DelphesFactory *factory = GetFactory(); … … 218 217 fItParticleInputArray->Reset(); 219 218 number = -1; 220 while((particle = static_cast<Candidate 219 while((particle = static_cast<Candidate*>(fItParticleInputArray->Next()))) 221 220 { 222 221 const TLorentzVector &particlePosition = particle->Position; … … 266 265 fItTrackInputArray->Reset(); 267 266 number = -1; 268 while((track = static_cast<Candidate 267 while((track = static_cast<Candidate*>(fItTrackInputArray->Next()))) 269 268 { 270 269 const TLorentzVector &trackPosition = track->Position; … … 316 315 towerHit = (*itTowerHits); 317 316 flags = (towerHit >> 24) & 0x00000000000000FFLL; 318 number = (towerHit) &0x0000000000FFFFFFLL;317 number = (towerHit) & 0x0000000000FFFFFFLL; 319 318 hitEtaPhi = towerHit >> 32; 320 319 … … 337 336 338 337 // 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]); 341 340 342 341 fTowerEdges[0] = fEtaBins[etaBin - 1]; … … 369 368 if(flags & 1) 370 369 { 371 track = static_cast<Candidate 370 track = static_cast<Candidate*>(fTrackInputArray->At(number)); 372 371 373 372 ++fTowerTrackAllHits; … … 409 408 if(flags & 8) ++fTowerPhotonHits; 410 409 411 particle = static_cast<Candidate 410 particle = static_cast<Candidate*>(fParticleInputArray->At(number)); 412 411 momentum = particle->Momentum; 413 412 … … 437 436 if(!fTower) return; 438 437 439 440 438 // ecalEnergy = gRandom->Gaus(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy)); 439 // if(ecalEnergy < 0.0) ecalEnergy = 0.0; 441 440 442 441 ecalEnergy = LogNormal(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy)); 443 442 444 445 443 // hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy)); 444 // if(hcalEnergy < 0.0) hcalEnergy = 0.0; 446 445 447 446 hcalEnergy = LogNormal(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy)); … … 449 448 energy = ecalEnergy + hcalEnergy; 450 449 451 452 450 // eta = fTowerEta; 451 // phi = fTowerPhi; 453 452 454 453 eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]); … … 482 481 { 483 482 fItTowerTrackArray->Reset(); 484 while((track = static_cast<Candidate 483 while((track = static_cast<Candidate*>(fItTowerTrackArray->Next()))) 485 484 { 486 485 fEFlowTrackOutputArray->Add(track); 487 486 } 488 487 } 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) 492 493 { 493 494 itTowerTrackArray = fItTowerTrackArray; … … 505 506 506 507 fItTowerHCalArray->Reset(); 507 while((particle = static_cast<Candidate 508 while((particle = static_cast<Candidate*>(fItTowerHCalArray->Next()))) 508 509 { 509 510 tower->AddCandidate(particle); … … 537 538 538 539 fItTowerECalArray->Reset(); 539 while((particle = static_cast<Candidate 540 while((particle = static_cast<Candidate*>(fItTowerECalArray->Next()))) 540 541 { 541 542 tower->AddCandidate(particle); … … 566 567 { 567 568 itTowerTrackArray->Reset(); 568 while((track = static_cast<Candidate 569 while((track = static_cast<Candidate*>(itTowerTrackArray->Next()))) 569 570 { 570 571 fEFlowTrackOutputArray->Add(track); … … 586 587 if(mean > 0.0) 587 588 { 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)); 592 593 } 593 594 else
Note:
See TracChangeset
for help on using the changeset viewer.