- Timestamp:
- Jul 22, 2013, 5:41:43 PM (11 years ago)
- Location:
- trunk/modules
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/Calorimeter.cc
r1145 r1233 43 43 fECalResolutionFormula(0), fHCalResolutionFormula(0), 44 44 fItParticleInputArray(0), fItTrackInputArray(0), 45 fTowerTrackArray(0), fItTowerTrackArray(0), 46 fTowerPhotonArray(0), fItTowerPhotonArray(0) 45 fTowerECalArray(0), fItTowerECalArray(0), 46 fTowerHCalArray(0), fItTowerHCalArray(0), 47 fTowerECalTrackArray(0), fItTowerECalTrackArray(0), 48 fTowerHCalTrackArray(0), fItTowerHCalTrackArray(0) 47 49 { 48 50 fECalResolutionFormula = new DelphesFormula; 49 51 fHCalResolutionFormula = new DelphesFormula; 50 fTowerTrackArray = new TObjArray; 51 fItTowerTrackArray = fTowerTrackArray->MakeIterator(); 52 fTowerPhotonArray = new TObjArray; 53 fItTowerPhotonArray = fTowerPhotonArray->MakeIterator(); 52 53 fTowerECalArray = new TObjArray; 54 fItTowerECalArray = fTowerECalArray->MakeIterator(); 55 fTowerHCalArray = new TObjArray; 56 fItTowerHCalArray = fTowerHCalArray->MakeIterator(); 57 58 fTowerECalTrackArray = new TObjArray; 59 fItTowerECalTrackArray = fTowerECalTrackArray->MakeIterator(); 60 fTowerHCalTrackArray = new TObjArray; 61 fItTowerHCalTrackArray = fTowerHCalTrackArray->MakeIterator(); 54 62 } 55 63 … … 60 68 if(fECalResolutionFormula) delete fECalResolutionFormula; 61 69 if(fHCalResolutionFormula) delete fHCalResolutionFormula; 62 if(fTowerTrackArray) delete fTowerTrackArray; 63 if(fItTowerTrackArray) delete fItTowerTrackArray; 64 if(fTowerPhotonArray) delete fTowerPhotonArray; 65 if(fItTowerPhotonArray) delete fItTowerPhotonArray; 66 } 70 71 if(fTowerECalArray) delete fTowerECalArray; 72 if(fItTowerECalArray) delete fItTowerECalArray; 73 if(fTowerHCalArray) delete fTowerHCalArray; 74 if(fItTowerHCalArray) delete fItTowerHCalArray; 75 76 if(fTowerECalTrackArray) delete fTowerECalTrackArray; 77 if(fItTowerECalTrackArray) delete fItTowerECalTrackArray; 78 if(fTowerHCalTrackArray) delete fTowerHCalTrackArray; 79 if(fItTowerHCalTrackArray) delete fItTowerHCalTrackArray;} 67 80 68 81 //------------------------------------------------------------------------------ … … 233 246 phiBin = distance(phiBins->begin(), itPhiBin); 234 247 235 flags = (particle->Charge == 0); 236 flags |= (pdgCode == 22) << 1; 237 flags |= (pdgCode == 11) << 2; 248 flags = 0; 249 flags |= (ecalFraction >= 1.0E-9) << 1; 250 flags |= (hcalFraction >= 1.0E-9) << 2; 251 flags |= (pdgCode == 11 || pdgCode == 22) << 3; 238 252 239 253 // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for particle number} … … 251 265 ++number; 252 266 267 pdgCode = TMath::Abs(track->PID); 268 269 itFractionMap = fFractionMap.find(pdgCode); 270 if(itFractionMap == fFractionMap.end()) 271 { 272 itFractionMap = fFractionMap.find(0); 273 } 274 275 ecalFraction = itFractionMap->second.first; 276 hcalFraction = itFractionMap->second.second; 277 253 278 // find eta bin [1, fEtaBins.size - 1] 254 279 itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), trackPosition.Eta()); … … 264 289 phiBin = distance(phiBins->begin(), itPhiBin); 265 290 291 flags = 1; 292 flags |= (ecalFraction >= 1.0E-9) << 1; 293 flags |= (hcalFraction >= 1.0E-9) << 2; 294 266 295 // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for track number} 267 towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t( 1) << 27) | Long64_t(number);296 towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number); 268 297 269 298 fTowerHits.push_back(towerHit); … … 313 342 fTowerHCalEnergy = 0.0; 314 343 315 fTowerECalNeutralEnergy = 0.0;316 fTowerHCalNeutralEnergy = 0.0;317 318 fTowerNeutralHits = 0;319 344 fTowerPhotonHits = 0; 320 fTowerElectronHits = 0; 321 fTowerTrackHits = 0; 345 322 346 fTowerAllHits = 0; 323 324 fTowerTrackArray->Clear(); 325 fTowerPhotonArray->Clear(); 347 fTowerECalHits = 0; 348 fTowerHCalHits = 0; 349 350 fTowerTrackAllHits = 0; 351 fTowerECalTrackHits = 0; 352 fTowerHCalTrackHits = 0; 353 354 fTowerECalTrackArray->Clear(); 355 fTowerHCalTrackArray->Clear(); 356 fTowerECalArray->Clear(); 357 fTowerHCalArray->Clear(); 326 358 } 327 359 328 360 // check for track hits 329 if(flags & 8) 330 { 331 ++fTowerTrackHits; 361 if(flags & 1) 362 { 332 363 track = static_cast<Candidate*>(fTrackInputArray->At(number)); 364 365 ++fTowerTrackAllHits; 333 366 fTowerTrackArray->Add(track); 367 if(flags & 2) 368 { 369 ++fTowerECalTrackHits; 370 fTowerECalTrackArray->Add(track); 371 } 372 if(flags & 4) 373 { 374 ++fTowerHCalTrackHits; 375 fTowerHCalTrackArray->Add(track); 376 } 334 377 continue; 335 378 } 379 380 ++fTowerAllHits; 381 382 // check for ECAL hits in current tower 383 if(flags & 2) 384 { 385 ++fTowerECalHits; 386 fTowerECalArray->Add(particle); 387 } 388 389 // check for HCAL hits in current tower 390 if(flags & 4) 391 { 392 ++fTowerHCalHits; 393 fTowerHCalArray->Add(particle); 394 } 395 396 // check for photon and electron hits in current tower 397 if(flags & 8) ++fTowerPhotonHits; 336 398 337 399 particle = static_cast<Candidate*>(fParticleInputArray->At(number)); … … 345 407 fTowerHCalEnergy += hcalEnergy; 346 408 347 ++fTowerAllHits;348 409 fTower->AddCandidate(particle); 349 350 // check for neutral hits in current tower351 if(flags & 1) ++fTowerNeutralHits;352 353 // check for photon hits in current tower354 if(flags & 2)355 {356 ++fTowerPhotonHits;357 fTowerPhotonArray->Add(particle);358 }359 360 // check for electron hits in current tower361 if(flags & 4) ++fTowerElectronHits;362 410 } 363 411 … … 373 421 Double_t energy, pt, eta, phi; 374 422 Double_t ecalEnergy, hcalEnergy; 423 TIterator *iterator; 375 424 376 425 if(!fTower) return; … … 409 458 if(energy > 0.0) 410 459 { 411 if((fTowerPhotonHits > 0 || fTowerElectronHits > 0) && 412 fTowerTrackHits == 0) 460 if(fTowerPhotonHits > 0 && fTowerTrackAllHits == 0) 413 461 { 414 462 fPhotonOutputArray->Add(fTower); … … 419 467 420 468 // fill energy flow candidates 421 if(fTowerTrack Hits == fTowerAllHits)469 if(fTowerTrackAllHits == fTowerAllHits) 422 470 { 423 471 fItTowerTrackArray->Reset(); … … 427 475 } 428 476 } 429 else if(fTowerTrackHits > 0 && 430 fTowerElectronHits == 0 && 431 fTowerPhotonHits + fTowerTrackHits == fTowerAllHits) 432 { 433 fItTowerTrackArray->Reset(); 434 while((track = static_cast<Candidate*>(fItTowerTrackArray->Next()))) 435 { 436 fEFlowTrackOutputArray->Add(track); 437 } 438 439 if(ecalEnergy > 0.0) 477 else if(fTowerTrackAllHits > 0 && 478 fTowerECalHits + fTowerHCalHits == fTowerAllHits && 479 (fTowerECalHits == fTowerECalTrackHits || fTowerHCalHits == fTowerHCalTrackHits)) 480 { 481 if(fTowerECalHits == fTowerECalTrackHits) 482 { 483 fItTowerECalTrackArray->Reset(); 484 while((track = static_cast<Candidate*>(fItTowerECalTrackArray->Next()))) 485 { 486 fEFlowTrackOutputArray->Add(track); 487 } 488 energy = hcalEnergy; 489 iterator = fItTowerHCalArray; 490 } 491 492 if(fTowerHCalHits == fTowerHCalTrackHits) 493 { 494 fItTowerHCalTrackArray->Reset(); 495 while((track = static_cast<Candidate*>(fItTowerHCalTrackArray->Next()))) 496 { 497 fEFlowTrackOutputArray->Add(track); 498 } 499 energy = ecalEnergy; 500 iterator = fItTowerECalArray; 501 } 502 503 if(energy > 0.0 && iterator) 440 504 { 441 505 DelphesFactory *factory = GetFactory(); … … 444 508 tower = factory->NewCandidate(); 445 509 446 fItTowerPhotonArray->Reset();447 while((particle = static_cast<Candidate*>( fItTowerPhotonArray->Next())))510 iterator->Reset(); 511 while((particle = static_cast<Candidate*>(iterator->Next()))) 448 512 { 449 513 tower->AddCandidate(particle); 450 514 } 451 515 452 pt = e calEnergy / TMath::CosH(eta);516 pt = energy / TMath::CosH(eta); 453 517 454 518 tower->Position.SetPtEtaPhiE(1.0, eta, phi, 0.0); 455 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, e calEnergy);456 tower->Eem = e calEnergy;519 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); 520 tower->Eem = energy; 457 521 tower->Ehad = 0.0; 458 522 -
trunk/modules/Calorimeter.h
r1145 r1233 45 45 Double_t fTowerECalEnergy, fTowerHCalEnergy; 46 46 Double_t fTowerECalNeutralEnergy, fTowerHCalNeutralEnergy; 47 Int_t fTowerNeutralHits, fTowerPhotonHits, fTowerElectronHits, fTowerTrackHits, fTowerAllHits; 47 Int_t fTowerPhotonHits, fTowerECalHits, fTowerHCalHits, fTowerAllHits; 48 Int_t fTowerECalTrackHits, fTowerHCalTrackHits, fTowerTrackAllHits; 48 49 49 50 TFractionMap fFractionMap; //! … … 73 74 TObjArray *fEFlowTowerOutputArray; //! 74 75 75 TObjArray *fTower TrackArray; //!76 TIterator *fItTower TrackArray; //!76 TObjArray *fTowerECalTrackArray; //! 77 TIterator *fItTowerECalTrackArray; //! 77 78 78 TObjArray *fTowerPhotonArray; //! 79 TIterator *fItTowerPhotonArray; //! 79 TObjArray *fTowerHCalTrackArray; //! 80 TIterator *fItTowerHCalTrackArray; //! 81 82 TObjArray *fTowerECalArray; //! 83 TIterator *fItTowerECalArray; //! 84 85 TObjArray *fTowerHCalArray; //! 86 TIterator *fItTowerHCalArray; //! 80 87 81 88 void FinalizeTower();
Note:
See TracChangeset
for help on using the changeset viewer.