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