Changeset 310 in svn
- Timestamp:
- Mar 10, 2009, 11:52:16 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Delphes.cpp
r307 r310 23 23 ** Center for Particle Physics and Phenomenology (CP3) ** 24 24 ** Universite catholique de Louvain (UCL) ** 25 ** Louvain-la-Neuve, Belgium ** 25 ** Louvain-la-Neuve, Belgium ** 26 26 ** ** 27 27 ** Copyright (C) 2008-2009, ** … … 326 326 vector<int> NTrackJet; 327 327 328 bool FLAG_lhco = true;329 330 328 TSimpleArray<TRootGenParticle> NFCentralQ; 331 329 … … 380 378 input_particles.clear(); 381 379 NTrackJet.clear(); 382 383 { 384 D_CaloTowerList list_of_active_towers; 385 D_CaloTowerList list_of_towers_with_photon; // to speed up the code: will only look in interesting towers for gamma candidates 386 387 // 2.1a Loop over all particles in event, to fill the towers 388 itGen.Reset(); 389 GenParticle *particleG; 390 while( (particleG = (GenParticle*) itGen.Next()) ) { 391 380 381 382 D_CaloTowerList list_of_active_towers; 383 D_CaloTowerList list_of_towers_with_photon; // to speed up the code: will only look in interesting towers for gamma candidates 384 385 386 // 2.1a Loop over all particles in event, to fill the towers 387 itGen.Reset(); 388 GenParticle *particleG; 389 while( (particleG = (GenParticle*) itGen.Next()) ) 390 { 392 391 TRootGenParticle *particle = new TRootGenParticle(particleG); 393 392 int pid = abs(particle->PID); … … 402 401 fabs(particle->Eta) < DET->CEN_max_tracker && 403 402 particle->Status != 1 && 404 particle->PT > DET->PT_QUARKS_MIN ) { 405 NFCentralQ.Add(particle); 406 } 403 particle->PT > DET->PT_QUARKS_MIN ) 404 { 405 NFCentralQ.Add(particle); 406 } 407 407 408 408 // 2.1a.2********************* visible particles only 409 if( (particle->Status == 1) && (pid != pNU1) && (pid != pNU2) && (pid != pNU3) ){ 409 if( (particle->Status == 1) && (pid != pNU1) && (pid != pNU2) && (pid != pNU3) ) 410 { 411 // 2.1a.2.1 Central solenoidal magnetic field 412 TRACP->bfield(particle); // fills in particle->EtaCalo et particle->PhiCalo 413 // 2.1a.2.2 Filling the calorimetric towers -- includes also forward detectors ? 414 // first checks if the charged particles reach the calo! 415 if( DET->FLAG_bfield || 416 particle->Charge==0 || 417 (!DET->FLAG_bfield && particle->Charge!=0 && particle->PT > DET->TRACK_ptmin)) 418 if( 419 (particle->EtaCalo > list_of_calorimeters.getEtamin() ) && 420 (particle->EtaCalo < list_of_calorimeters.getEtamax() ) 421 ) 422 { 423 float iEta=UNDEFINED, iPhi=UNDEFINED; 424 DET->BinEtaPhi(particle->PhiCalo,particle->EtaCalo,iPhi,iEta); // fills in iPhi and iEta 425 if (iEta != UNDEFINED && iPhi != UNDEFINED) 426 { 427 D_CaloTower tower(iEta,iPhi); // new tower 428 tower.Set_Eem_Ehad_E_ET(particle->E*particle->getFem() , particle->E*particle->getFhad() ); 429 list_of_active_towers.addTower(tower); 430 // this list may contain several times the same calotower, as several particles 431 // may leave some energy in the same calotower 432 // After the loop on particles, identical cells in the list should be merged 433 } // iEta and iPhi must be defined 434 } 410 435 411 // 2.1a.2.1 Central solenoidal magnetic field 412 TRACP->bfield(particle); // fills in particle->EtaCalo et particle->PhiCalo 413 // 2.1a.2.2 Filling the calorimetric towers -- includes also forward detectors ? 414 // first checks if the charged particles reach the calo! 415 if( DET->FLAG_bfield || 416 particle->Charge==0 || 417 (!DET->FLAG_bfield && particle->Charge!=0 && particle->PT > DET->TRACK_ptmin)) 418 if( 419 (particle->EtaCalo > list_of_calorimeters.getEtamin() ) && 420 (particle->EtaCalo < list_of_calorimeters.getEtamax() ) 421 ) { 422 float iEta=UNDEFINED, iPhi=UNDEFINED; 423 DET->BinEtaPhi(particle->PhiCalo,particle->EtaCalo,iPhi,iEta); // fills in iPhi and iEta 424 if (iEta != UNDEFINED && iPhi != UNDEFINED) 425 { 426 D_CaloTower tower(iEta,iPhi); // new tower 427 tower.Set_Eem_Ehad_E_ET(particle->E*particle->getFem() , particle->E*particle->getFhad() ); 428 429 list_of_active_towers.addTower(tower); 430 // this list may contain several times the same calotower, as several particles 431 // may leave some energy in the same calotower 432 // After the loop on particles, identical cells in the list should be merged 433 } // iEta and iPhi must be defined 434 } 436 // 2.1a.2.3 charged particles in tracker: energy flow 437 // if bfield not simulated, pt should be high enough to be taken into account 438 // it is supposed here that DET->MAX_calo > DET->CEN_max_tracker > DET->CEN_max_mu > 0 439 if( particle->Charge !=0 && 440 fabs(particle->EtaCalo)< DET->CEN_max_tracker && // stays in the tracker -> track available 441 ( DET->FLAG_bfield || 442 (!DET->FLAG_bfield && particle->PT > DET->TRACK_ptmin) 443 ) 444 ) 445 { 446 // 2.1a.2.3.1 Filling the particle properties + smearing 447 // Hypothesis: the final eta/phi are the ones from the generator, thanks to the track reconstruction 448 // This is the EnergyFlow hypothesis 449 particle->SetEtaPhi(particle->Eta,particle->Phi); 450 float sET=UNDEFINED; // smeared ET, computed from the smeared E -> needed for the tracks 451 452 // 2.1a.2.3.2 Muons 453 if (pid == pMU && fabs(particle->EtaCalo)< DET->CEN_max_mu) 454 { 455 TLorentzVector p; 456 float sPT = gRandom->Gaus(particle->PT, DET->MU_SmearPt*particle->PT ); 457 if (sPT > 0 && sPT > DET->PTCUT_muon) 458 { 459 p.SetPtEtaPhiE(sPT,particle->Eta,particle->Phi,sPT*cosh(particle->Eta)); 460 muon.push_back(D_Particle(p,pMU,particle->EtaCalo,particle->PhiCalo)); 461 } 462 sET = (sPT >0)? sPT : 0; 463 } 464 // 2.1a.2.3.3 Electrons 465 else if (pid == pE) 466 { 467 // Finds in which calorimeter the particle has gone, to know its resolution 468 469 D_CaloElement currentCalo = list_of_calorimeters.getElement(particle->EtaCalo); 470 if(currentCalo.getName() == dummyCalo.getName()) 471 { 472 cout << "** Warning: the calo coverage behind the tracker is not complete! **" << endl; 473 } 474 475 // final smeared EM energy // electromagnetic fraction F_em =1 for electrons; 476 float sE = currentCalo.getElectromagneticResolution().Smear(particle->E); 477 if (sE>0) 478 { 479 sET = sE/cosh(particle->Eta); 480 // NB: ET is found via the calorimetry and not via the track curvature 481 482 TLorentzVector p; 483 p.SetPtEtaPhiE(sET,particle->Eta,particle->Phi,sE); 484 if (sET > DET->PTCUT_elec) 485 electron.push_back(D_Particle(p,particle->PID,particle->EtaCalo,particle->PhiCalo)); 486 } 487 else { sET=0;} // if negative smeared energy -- needed for the tracks 488 } 489 // 2.1a.2.3.4 Other charged particles : smear them for the tracks! 490 else 491 { //other particles 492 D_CaloElement currentCalo = list_of_calorimeters.getElement(particle->EtaCalo); 493 float sEem = currentCalo.getElectromagneticResolution().Smear(particle->E * particle->getFem()); 494 float sEhad = currentCalo.getHadronicResolution().Smear(particle->E * particle->getFhad()); 495 float sE = ( (sEem>0)? sEem : 0 ) + ( (sEhad>0)? sEhad : 0 ); 496 sET = sE/cosh(particle->EtaCalo); 497 } 498 499 // 2.1a.2.3.5 Tracks 500 if( (rand()%100) < DET->TRACK_eff && sET!=0) 501 { 502 elementTrack = (TRootTracks*) branchTrack->NewEntry(); 503 elementTrack->Set(particle->Eta, particle->Phi, particle->EtaCalo, particle->PhiCalo, sET, particle->Charge); 504 TrackCentral.push_back(*elementTrack); // tracks at vertex! 505 // TODO!!! apply a smearing on the position of the origin of the track 506 // TODO!!! elementTracks->SetPositionOut(Xout,Yout,Zout); 507 } 508 } // 2.1a.2.3 : if tracker/energy-flow 509 // 2.1a.2.4 Photons 510 // stays in the tracker -> track available -> gamma ID 511 else if( (pid == pGAMMA) && fabs(particle->EtaCalo)< DET->CEN_max_tracker ) 512 { 513 float iEta=UNDEFINED, iPhi=UNDEFINED; 514 DET->BinEtaPhi(particle->PhiCalo,particle->EtaCalo,iPhi,iEta); // fills in iPhi and iEta 515 D_CaloTower tower(iEta,iPhi); 516 // stores the list of towers where to apply the photon ID algorithm. Just a trick for a faster search 517 list_of_towers_with_photon.addTower(tower); 518 } 519 // 2.1a.2.5 : very forward detectors 520 else 521 { 522 if (DET->FLAG_RP==1) 523 { 524 // for the moment, only protons are transported 525 // BUT !!! could be a beam of other particles! (heavy ions?) 526 // BUT ALSO !!! if very forward muons, or others! 527 VFD->RomanPots(treeWriter,branchRP220,branchFP420,particle); 528 } 529 // 2.1a.2.6: Zero degree calorimeter 530 if(DET->FLAG_vfd==1) 531 { 532 VFD->ZDC(treeWriter,branchZDC,particle); 533 } 534 } 435 535 436 // 2.1a.2.3 charged particles in tracker: energy flow 437 // if bfield not simulated, pt should be high enough to be taken into account 438 // it is supposed here that DET->MAX_calo > DET->CEN_max_tracker > DET->CEN_max_mu > 0 439 if( particle->Charge !=0 && 440 fabs(particle->EtaCalo)< DET->CEN_max_tracker && // stays in the tracker -> track available 441 ( DET->FLAG_bfield || 442 (!DET->FLAG_bfield && particle->PT > DET->TRACK_ptmin) 443 ) 444 ) { 445 // 2.1a.2.3.1 Filling the particle properties + smearing 446 // Hypothesis: the final eta/phi are the ones from the generator, thanks to the track reconstruction 447 // This is the EnergyFlow hypothesis 448 particle->SetEtaPhi(particle->Eta,particle->Phi); 449 float sET=UNDEFINED; // smeared ET, computed from the smeared E -> needed for the tracks 450 451 // 2.1a.2.3.2 Muons 452 if (pid == pMU && fabs(particle->EtaCalo)< DET->CEN_max_mu) { 453 TLorentzVector p; 454 float sPT = gRandom->Gaus(particle->PT, DET->MU_SmearPt*particle->PT ); 455 if (sPT > 0 && sPT > DET->PTCUT_muon) { 456 p.SetPtEtaPhiE(sPT,particle->Eta,particle->Phi,sPT*cosh(particle->Eta)); 457 muon.push_back(D_Particle(p,pMU,particle->EtaCalo,particle->PhiCalo)); 458 } 459 sET = (sPT >0)? sPT : 0; 460 } 461 // 2.1a.2.3.3 Electrons 462 else if (pid == pE) { 463 // Finds in which calorimeter the particle has gone, to know its resolution 464 465 D_CaloElement currentCalo = list_of_calorimeters.getElement(particle->EtaCalo); 466 if(currentCalo.getName() == dummyCalo.getName()) { 467 cout << "** Warning: the calo coverage behind the tracker is not complete! **" << endl; } 468 469 // final smeared EM energy // electromagnetic fraction F_em =1 for electrons; 470 float sE = currentCalo.getElectromagneticResolution().Smear(particle->E); 471 if (sE>0) { 472 sET = sE/cosh(particle->Eta); 473 // NB: ET is found via the calorimetry and not via the track curvature 474 475 TLorentzVector p; 476 p.SetPtEtaPhiE(sET,particle->Eta,particle->Phi,sE); 477 if (sET > DET->PTCUT_elec) 478 electron.push_back(D_Particle(p,particle->PID,particle->EtaCalo,particle->PhiCalo)); 479 } else { sET=0;} // if negative smeared energy -- needed for the tracks 480 } 481 // 2.1a.2.3.4 Other charged particles : smear them for the tracks! 482 else { //other particles 483 D_CaloElement currentCalo = list_of_calorimeters.getElement(particle->EtaCalo); 484 float sEem = currentCalo.getElectromagneticResolution().Smear(particle->E * particle->getFem()); 485 float sEhad = currentCalo.getHadronicResolution().Smear(particle->E * particle->getFhad()); 486 float sE = ( (sEem>0)? sEem : 0 ) + ( (sEhad>0)? sEhad : 0 ); 487 sET = sE/cosh(particle->EtaCalo); 488 } 489 490 // 2.1a.2.3.5 Tracks 491 if( (rand()%100) < DET->TRACK_eff && sET!=0) { 492 elementTrack = (TRootTracks*) branchTrack->NewEntry(); 493 elementTrack->Set(particle->Eta, particle->Phi, particle->EtaCalo, particle->PhiCalo, sET, particle->Charge); 494 //TrackCentral.push_back(elementTrack->GetFourVector()); // tracks at vertex! 495 TrackCentral.push_back(*elementTrack); // tracks at vertex! 496 // TODO!!! apply a smearing on the position of the origin of the track 497 // TODO!!! elementTracks->SetPositionOut(Xout,Yout,Zout); 498 } 499 } // 2.1a.2.3 : if tracker/energy-flow 500 // 2.1a.2.4 Photons 501 // stays in the tracker -> track available -> gamma ID 502 else if( (pid == pGAMMA) && fabs(particle->EtaCalo)< DET->CEN_max_tracker ) { 503 float iEta=UNDEFINED, iPhi=UNDEFINED; 504 DET->BinEtaPhi(particle->PhiCalo,particle->EtaCalo,iPhi,iEta); // fills in iPhi and iEta 505 D_CaloTower tower(iEta,iPhi); 506 // stores the list of towers where to apply the photon ID algorithm. Just a trick for a faster search 507 list_of_towers_with_photon.addTower(tower); 508 } 509 // 2.1a.2.5 : very forward detectors 510 else 511 { 512 if (DET->FLAG_RP==1) { 513 // for the moment, only protons are transported 514 // BUT !!! could be a beam of other particles! (heavy ions?) 515 // BUT ALSO !!! if very forward muons, or others! 516 VFD->RomanPots(treeWriter,branchRP220,branchFP420,particle); 517 } 518 // 2.1a.2.6: Zero degree calorimeter 519 if(DET->FLAG_vfd==1) { 520 VFD->ZDC(treeWriter,branchZDC,particle); 521 } 522 } 523 524 } // 2.1a.2 : if visible particle 536 } // 2.1a.2 : if visible particle 525 537 delete particle; 526 } // loop on all particles 2.1a 527 528 529 // 2.1b loop on all (activated) towers 530 // at this stage, list_of_active_towers may contain several times the same tower 531 // first step is to merge identical towers, by matching their (iEta,iPhi) 532 list_of_active_towers.mergeDuplicates(); 533 // Calotower smearing 534 list_of_active_towers.smearTowers(list_of_calorimeters); 535 536 for(unsigned int i=0; i<list_of_active_towers.size(); i++) { 538 }// loop on all particles 2.1a 539 540 541 // 2.1b loop on all (activated) towers 542 // at this stage, list_of_active_towers may contain several times the same tower 543 // first step is to merge identical towers, by matching their (iEta,iPhi) 544 545 list_of_active_towers.sortElements(); 546 list_of_active_towers.mergeDuplicates(); 547 548 // Calotower smearing 549 list_of_active_towers.smearTowers(list_of_calorimeters); 550 551 for(unsigned int i=0; i<list_of_active_towers.size(); i++) 552 { 537 553 float iEta = list_of_active_towers[i].getEta(); 538 554 float iPhi = list_of_active_towers[i].getPhi(); 539 555 float e = list_of_active_towers[i].getE(); 540 if(iEta != UNDEFINED && iPhi != UNDEFINED && e!=0) { 541 elementCalo = (TRootCalo*) branchCalo->NewEntry(); 542 elementCalo->set(list_of_active_towers[i]); 543 // not beautiful : should be improved! 544 TLorentzVector p; 545 p.SetPtEtaPhiE(list_of_active_towers[i].getET(), iEta, iPhi, e ); 546 PhysicsTower Tower(LorentzVector(p.Px(),p.Py(),p.Pz(),p.E())); 547 towers.push_back(Tower); 548 } 556 if(iEta != UNDEFINED && iPhi != UNDEFINED && e!=0) 557 { 558 elementCalo = (TRootCalo*) branchCalo->NewEntry(); 559 elementCalo->set(list_of_active_towers[i]); 560 // not beautiful : should be improved! 561 TLorentzVector p; 562 p.SetPtEtaPhiE(list_of_active_towers[i].getET(), iEta, iPhi, e ); 563 PhysicsTower Tower(LorentzVector(p.Px(),p.Py(),p.Pz(),p.E())); 564 towers.push_back(Tower); 565 } 549 566 } // loop on towers 550 551 // 2.1c photon ID 552 // list_of_towers_with_photon is the list of towers with photon candidates 553 // already smeared ! 554 // sorts the vector and smears duplicates 555 list_of_towers_with_photon.mergeDuplicates(); 556 557 for(unsigned int i=0; i<list_of_towers_with_photon.size(); i++) { 567 568 // 2.1c photon ID 569 // list_of_towers_with_photon is the list of towers with photon candidates 570 // already smeared ! 571 // sorts the vector and smears duplicates 572 list_of_towers_with_photon.mergeDuplicates(); 573 574 for(unsigned int i=0; i<list_of_towers_with_photon.size(); i++) 575 { 558 576 float eta = list_of_towers_with_photon[i].getEta(); 559 577 float phi = list_of_towers_with_photon[i].getPhi(); 560 578 D_CaloTower cal(list_of_active_towers.getElement(eta,phi)); 561 if(cal.getEta() != UNDEFINED && cal.getPhi() != UNDEFINED && cal.getE() > 0) { 562 TLorentzVector p; 563 p.SetPtEtaPhiE(cal.getET(), eta,phi,cal.getE() ); 564 if (cal.getET() > DET->PTCUT_gamma) { gamma.push_back(D_Particle(p,pGAMMA,p.Eta(),p.Phi())); } 565 } 579 if(cal.getEta() != UNDEFINED && cal.getPhi() != UNDEFINED && cal.getE() > 0) 580 { 581 TLorentzVector p; 582 p.SetPtEtaPhiE(cal.getET(), eta,phi,cal.getE() ); 583 if (cal.getET() > DET->PTCUT_gamma) { gamma.push_back(D_Particle(p,pGAMMA,p.Eta(),p.Phi())); } 584 } 566 585 } // for -- list of photons 567 568 } // IF NEW ALGORITHM with energy flow569 570 571 572 586 573 587 // 2.2 ********** Output preparation & complex objects *********** 574 588 // 2.2.1 ********************* sorting collections by decreasing pt 575 589 DET->SortedVector(electron); 576 for(unsigned int i=0; i < electron.size(); i++) { 577 elementElec = (TRootElectron*) branchElectron->NewEntry(); 578 elementElec->Set(electron[i].Px(),electron[i].Py(),electron[i].Pz(),electron[i].E()); 579 elementElec->EtaCalo = electron[i].EtaCalo(); 580 elementElec->PhiCalo = electron[i].PhiCalo(); 581 elementElec->Charge = sign(electron[i].PID()); 582 elementElec->IsolFlag = DET->Isolation(electron[i].Phi(),electron[i].Eta(),TrackCentral,DET->ISOL_PT,DET->ISOL_Cone);//isolation based on tracks 583 } /////////////// HARDCODING 590 for(unsigned int i=0; i < electron.size(); i++) 591 { 592 elementElec = (TRootElectron*) branchElectron->NewEntry(); 593 elementElec->Set(electron[i].Px(),electron[i].Py(),electron[i].Pz(),electron[i].E()); 594 elementElec->EtaCalo = electron[i].EtaCalo(); 595 elementElec->PhiCalo = electron[i].PhiCalo(); 596 elementElec->Charge = sign(electron[i].PID()); 597 elementElec->IsolFlag = DET->Isolation(electron[i].Phi(),electron[i].Eta(),TrackCentral,DET->ISOL_PT,DET->ISOL_Cone);//isolation based on tracks 598 599 D_CaloTower calElec(list_of_active_towers.getElement(electron[i].EtaCalo(),electron[i].PhiCalo())); 600 elementElec->EHoverEE = calElec.getEhad()/calElec.getEem(); 601 } /////////////// HARDCODING 602 584 603 DET->SortedVector(muon); 585 for(unsigned int i=0; i < muon.size(); i++) { 586 elementMu = (TRootMuon*) branchMuon->NewEntry(); 587 elementMu->Charge = sign(muon[i].PID()); 588 elementMu->Set(muon[i].Px(),muon[i].Py(),muon[i].Pz(),muon[i].E()); 589 elementMu->EtaCalo = muon[i].EtaCalo(); 590 elementMu->PhiCalo = muon[i].PhiCalo(); 591 elementMu->IsolFlag = DET->Isolation(muon[i].Phi(),muon[i].Eta(),TrackCentral,DET->ISOL_PT,DET->ISOL_Cone); /////////////// HARDCODING 592 } 604 for(unsigned int i=0; i < muon.size(); i++) 605 { 606 elementMu = (TRootMuon*) branchMuon->NewEntry(); 607 elementMu->Charge = sign(muon[i].PID()); 608 elementMu->Set(muon[i].Px(),muon[i].Py(),muon[i].Pz(),muon[i].E()); 609 elementMu->EtaCalo = muon[i].EtaCalo(); 610 elementMu->PhiCalo = muon[i].PhiCalo(); 611 elementMu->IsolFlag = DET->Isolation(muon[i].Phi(),muon[i].Eta(),TrackCentral,DET->ISOL_PT,DET->ISOL_Cone); /////////////// HARDCODING 612 D_CaloTower calMuon(list_of_active_towers.getElement(muon[i].EtaCalo(),muon[i].PhiCalo())); 613 elementMu->EHoverEE = calMuon.getEhad()/calMuon.getEem(); 614 } 615 593 616 DET->SortedVector(gamma); 594 for(unsigned int i=0; i < gamma.size(); i++) { 595 elementPhoton = (TRootPhoton*) branchPhoton->NewEntry(); 596 elementPhoton->Set(gamma[i].Px(),gamma[i].Py(),gamma[i].Pz(),gamma[i].E()); 597 } 617 for(unsigned int i=0; i < gamma.size(); i++) 618 { 619 elementPhoton = (TRootPhoton*) branchPhoton->NewEntry(); 620 elementPhoton->Set(gamma[i].Px(),gamma[i].Py(),gamma[i].Pz(),gamma[i].E()); 621 D_CaloTower calGamma(list_of_active_towers.getElement(gamma[i].EtaCalo(),gamma[i].PhiCalo())); 622 elementPhoton->EHoverEE = calGamma.getEhad()/calGamma.getEem(); 623 } 598 624 599 625 // 2.2.2 ************* computes the Missing Transverse Momentum … … 617 643 618 644 // 2.2.3 ************* jets, B-tag, tau jets 619 vector<int> NTrackJet; 620 sorted_jets=JETRUN->RunJets(input_particles, TrackCentral,NTrackJet); 621 JETRUN->RunJetBtagging(treeWriter, branchJet,sorted_jets,NFCentralQ,NTrackJet); 622 JETRUN->RunTauJets(treeWriter,branchTauJet,sorted_jets,towers, TrackCentral,NTrackJet); 645 vector<int> NTrackJet; //for number of tracks 646 vector<float> EHADEEM; //for energyHad over energyEm 647 sorted_jets=JETRUN->RunJets(input_particles, TrackCentral,NTrackJet,EHADEEM,list_of_active_towers); 648 JETRUN->RunJetBtagging(treeWriter, branchJet,sorted_jets,NFCentralQ,NTrackJet,EHADEEM); 649 JETRUN->RunTauJets(treeWriter,branchTauJet,sorted_jets,towers, TrackCentral,NTrackJet,EHADEEM); 623 650 624 651 treeWriter->Fill(); 625 652 } // 2. Loop over all events ('for' loop) 626 653 627 628 cout <<"** **"<< endl;629 654 cout <<"** Exiting detector simulation... **"<< endl; 630 655 -
trunk/Resolutions.cpp
r307 r310 344 344 345 345 //***************************** 346 vector<TRootTracks> TrackCentral; 347 sorted_jetsGEN=JETRUN->RunJets(input_particlesGEN, TrackCentral, NTrackJet); 346 sorted_jetsGEN=JETRUN->RunJetsResol(input_particlesGEN); 348 347 349 348 TSimpleArray<TRootGenParticle> TausHadr = TauHadr(branchGen); -
trunk/Utilities/ExRootAnalysis/interface/BlockClasses.h
r307 r310 253 253 void SetEtaPhiCalo(const float eta, const float phi) {EtaCalo=eta; PhiCalo=phi;}; 254 254 255 float EHoverEE; 255 256 bool IsolFlag; 256 257 … … 266 267 static TCompare *fgCompare; //! 267 268 269 float EHoverEE; 268 270 ClassDef(TRootPhoton, 1) 269 271 }; … … 282 284 void SetEtaPhiCalo(const float eta, const float phi) {EtaCalo=eta; PhiCalo=phi;}; 283 285 286 float EHoverEE; 284 287 static TCompare *fgCompare; //! 285 288 … … 356 359 int NTracks; 357 360 361 float EHoverEE; 358 362 // float E; // particle energy in GeV 359 363 // float Px; // particle momentum vector (x component) in GeV … … 384 388 bool Btag; 385 389 int NTracks; 390 391 float EHoverEE; 386 392 ClassDef(TRootJet, 1) 387 393 }; -
trunk/interface/JetsUtil.h
r307 r310 79 79 void init(); // for constructors 80 80 81 vector<fastjet::PseudoJet> RunJets(const vector<fastjet::PseudoJet>& input_particles, const vector<TRootTracks> & TrackCentral, vector<int> &NTrackJet); 82 void RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle> & NFCentralQ, const vector<int> &NTrackJet); 83 //void RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TLorentzVector> & TrackCentral); 84 void RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TRootTracks> & TrackCentral, const vector<int> &NTrackJet); 81 vector<fastjet::PseudoJet> RunJets(const vector<fastjet::PseudoJet>& input_particles, const vector<TRootTracks> & TrackCentral, vector<int> &NTrackJet, vector<float> &EHADEEM, D_CaloTowerList list_of_active_towers); 82 83 vector<fastjet::PseudoJet> JetsUtil::RunJetsResol(const vector<fastjet::PseudoJet>& input_particles); 84 85 void RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle> & NFCentralQ, const vector<int> &NTrackJet, const vector<float> &EHADEEM); 86 87 void RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TRootTracks> & TrackCentral, const vector<int> &NTrackJet, const vector<float> &EHADEEM); 85 88 86 89 private: -
trunk/src/JetsUtil.cc
r307 r310 120 120 } 121 121 122 vector<fastjet::PseudoJet> JetsUtil::RunJets(const vector<fastjet::PseudoJet>& input_particles, const vector<TRootTracks> & TrackCentral, vector<int> &NTrackJet )122 vector<fastjet::PseudoJet> JetsUtil::RunJets(const vector<fastjet::PseudoJet>& input_particles, const vector<TRootTracks> & TrackCentral, vector<int> &NTrackJet, vector<float> &EHADEEM,D_CaloTowerList list_of_active_towers) 123 123 { 124 124 inclusive_jets.clear(); … … 135 135 sorted_jets = sorted_by_pt(inclusive_jets); 136 136 137 // check number of tracks in jets137 //Bin tracks to make the link 138 138 float iEtaTrack[TrackCentral.size()]; 139 139 float iPhiTrack[TrackCentral.size()]; … … 145 145 for (unsigned int i = 0; i < sorted_jets.size(); i++) 146 146 { 147 //check number of tracks in jets 147 148 numTrackJet=0; 148 149 vector<fastjet::PseudoJet> constituents = clust_seq.constituents(sorted_jets[i]); … … 155 156 } 156 157 NTrackJet.push_back(numTrackJet); 158 //now, get EHad over EEm 159 float EmVal=0,HadVal=0; 160 for (unsigned int j = 0; j < constituents.size(); j++) 161 { 162 D_CaloTower calConsti(list_of_active_towers.getElement(constituents[j].eta(),constituents[j].phi())); 163 EmVal += calConsti.getEem(); 164 HadVal += calConsti.getEhad(); 165 } 166 EHADEEM.push_back(HadVal/EmVal); 157 167 } 158 168 } … … 161 171 } 162 172 163 164 165 void JetsUtil::RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle>& NFCentralQ, const vector<int> &NTrackJet) 173 vector<fastjet::PseudoJet> JetsUtil::RunJetsResol(const vector<fastjet::PseudoJet>& input_particles) 174 { 175 inclusive_jets.clear(); 176 sorted_jets.clear(); 177 // run the jet clustering with the above jet definition 178 if(input_particles.size()!=0) 179 { 180 fastjet::ClusterSequence clust_seq(input_particles, jet_def); 181 // extract the inclusive jets with pt > 5 GeV 182 double ptmin = 5.0; 183 inclusive_jets = clust_seq.inclusive_jets(ptmin); 184 185 // sort jets into increasing pt 186 sorted_jets = sorted_by_pt(inclusive_jets); 187 } 188 return sorted_jets; 189 } 190 191 192 void JetsUtil::RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle>& NFCentralQ, const vector<int> &NTrackJet, const vector<float> &EHADEEM) 166 193 { 167 194 TRootJet *elementJet; … … 175 202 elementJet->Set(JET); 176 203 elementJet->NTracks = NTrackJet[i]; 204 elementJet->EHoverEE = EHADEEM[i]; 177 205 178 206 // b-jets … … 185 213 } 186 214 187 void JetsUtil::RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TRootTracks> & TrackCentral, const vector<int> &NTrackJet )215 void JetsUtil::RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TRootTracks> & TrackCentral, const vector<int> &NTrackJet, const vector<float> &EHADEEM) 188 216 { 189 217 TRootTauJet *elementTauJet; … … 205 233 elementTauJet->NTracks=NTrackJet[i]; 206 234 elementTauJet->Charge = charge; 235 elementTauJet->EHoverEE = EHADEEM[i]; 207 236 } // if tau jet 208 237 } // if JET.eta < tracker - tau_cone : Tau jet identification -
trunk/src/LHCOConverter.cc
r307 r310 174 174 particle = (TRootParticle*) branch->At(i); 175 175 double temp = sqrt(particle->PT*particle->PT + particle->Pz * particle->Pz); 176 double jmass = (particle->E - temp) * (particle->E + temp); // prevents some numerical sensitivity177 176 TLorentzVector pmu; 178 177 pmu.SetPtEtaPhiE(particle->PT, particle->Eta, particle->Phi, particle->E); 179 jmass = pmu.M();178 float jmass = pmu.M(); 180 179 float ntrk = 0.0; 181 180 float btag =0; 182 181 double ratioE = 0; 183 182 184 if(lhcoID == lhcoElectronID) { TRootElectron elec(*((TRootElectron*) branch->At(i))); ntrk = elec.Charge; } 185 else if (lhcoID == lhcoMuonID) { TRootMuon muon(*((TRootMuon*) branch->At(i))); ntrk = muon.Charge; } 183 if(lhcoID == lhcoPhotonID){TRootPhoton gam(*((TRootPhoton*) branch->At(i))); jmass=0; ratioE = gam.EHoverEE;} 184 if(lhcoID == lhcoElectronID) { TRootElectron elec(*((TRootElectron*) branch->At(i))); ntrk = elec.Charge; ratioE = elec.EHoverEE;} 185 else if (lhcoID == lhcoMuonID) { TRootMuon muon(*((TRootMuon*) branch->At(i))); ntrk = muon.Charge; ratioE = muon.EHoverEE;} 186 186 else if (lhcoID == lhcoTauJetID) { TRootTauJet taujet(*((TRootTauJet*) branch->At(i))); ntrk = taujet.Charge; } 187 else if (lhcoID == lhcoJetID) { TRootJet jet(*((TRootJet*) branch->At(i))); ntrk = jet.NTracks; btag = jet.Btag; }187 else if (lhcoID == lhcoJetID) { TRootJet jet(*((TRootJet*) branch->At(i))); ntrk = jet.NTracks; btag = jet.Btag; ratioE = jet.EHoverEE;} 188 188 if(lhcoID != lhcoETmisID) { 189 189 outfile << fixed << setprecision(3)
Note:
See TracChangeset
for help on using the changeset viewer.