Fork me on GitHub

Changeset 445 in svn


Ignore:
Timestamp:
Jun 19, 2009, 6:59:40 PM (15 years ago)
Author:
Xavier Rouby
Message:

modifs pour ATLAS resolution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Resolutions.cpp

    r443 r445  
    3232***********************************************************************/
    3333
    34 /// \file Smearing.cpp
    35 /// \brief executable for the FastSim
     34/// \file Resolution.cpp
     35/// \brief Prepares the resolution calculation
    3636
    3737#include "TChain.h"
     
    111111
    112112
    113 void PairingJet(TLorentzVector &JETSm, const TLorentzVector &JET, const TClonesArray *branchJet)
     113void PairingJet(TLorentzVector &JETSm, const TLorentzVector &JET, const TClonesArray *branchJet, const float dR=0.25)
    114114{
    115115  JETSm.SetPxPyPzE(0,0,0,0);
     
    125125        {
    126126          deltaRtest = DeltaR(JET.Phi(),JET.Eta(),Att.Phi(),Att.Eta());
    127           if(deltaRtest < 0.25)
     127          if(deltaRtest < dR)
    128128             {
    129129               JETSm = Att;
     
    203203  if(argc != 3) {
    204204      cout << " Usage: " << argv[0] << " input_file" << " output_file" << endl;
    205       cout << " input_list - list of files in root format," << endl;
     205      cout << " input_file - input file in Delphes-root format," << endl;
    206206      cout << " output_file - output file." << endl;
    207207      exit(1);
     
    220220
    221221
    222   TFile *outputFile = TFile::Open(outputfilename.c_str(), "RECREATE"); // Creates the file, but should be closed just after
     222  TFile *outputFile = TFile::Open(outputfilename.c_str(), "RECREATE");// Creates the file, but should be closed just after
    223223  outputFile->Close();
    224224 
     
    257257 
    258258  RESOLution *DET = new RESOLution();
    259   DET->ReadDataCard("data/DetectorCard_CMS.dat");
     259  /*
     260  string detectorcard = "data/DetectorCard_CMS.dat";
     261  const float dR_jetpairing = 0.25;
     262  const float jet_pt_cut = 1;
     263  */
     264  string detectorcard = "data/DetectorCard_ATLAS.dat";
     265  const float dR_jetpairing = 0.2;
     266  const float jet_pt_cut = 7;
     267  DET->ReadDataCard(detectorcard);
    260268
    261269
    262270  //Jet information
    263   JetsUtil *JETRUN = new JetsUtil("data/DetectorCard_CMS.dat");
     271  JetsUtil *JETRUN = new JetsUtil(detectorcard);
    264272
    265273  TLorentzVector genMomentum(0,0,0,0);//TLorentzVector containing generator level information
     
    269277  vector<fastjet::PseudoJet> input_particlesGEN;//for FastJet algorithm
    270278  vector<fastjet::PseudoJet> sorted_jetsGEN;
    271  
    272279  vector<int> NTrackJet;
    273  
    274280  vector<TLorentzVector> towers;
    275281 
     
    309315          //Calculate ETMIS from generated particles
    310316          if((pid == pNU1) || (pid == pNU2) || (pid == pNU3))PTmisGEN = PTmisGEN + genMomentum;
    311          
     317
     318          //Electrons and muons 
    312319          if( (particle->Status == 1)    &&
    313320            ((pid != pNU1) && (pid != pNU2) && (pid != pNU3)) &&
     
    328335                 case pMU: // all muons with eta < DET->MAX_MU
    329336                    PairingMuon(recoMomentum,genMomentum,branchMuon);
    330                     if(recoMomentum.E() !=0){
     337                    if(recoMomentum.E()!=0){
    331338                     elementMuon = (RESOLMUON*) branchmuon->NewEntry();
    332                      elementMuon->OverPT = (1/genMomentum.Pt());
    333                      elementMuon->OverSmearedPT = (1/recoMomentum.Pt());}
     339                     elementMuon->OverPT = 1./genMomentum.Pt();
     340                     elementMuon->OverSmearedPT = 1./recoMomentum.Pt();}
    334341                   break; // case pMU
    335342                 default:
     
    362369      elementEtmis->Ex = (-PTmisGEN).Px();
    363370      elementEtmis->SEt = ScalarEt;
    364 
    365371      elementEtmis->EtSmeare = (PTmisReco).Pt()-(PTmisGEN).Pt();
    366372      elementEtmis->ExSmeare = (-PTmisReco).Px()-(PTmisGEN).Px();
     
    370376
    371377      TSimpleArray<TRootGenParticle> TausHadr = TauHadr(branchGen);
    372 
    373378      TLorentzVector JETreco(0,0,0,0);
    374379      for (unsigned int i = 0; i < sorted_jetsGEN.size(); i++) {
     
    376381        JETgen.SetPxPyPzE(sorted_jetsGEN[i].px(),sorted_jetsGEN[i].py(),sorted_jetsGEN[i].pz(),sorted_jetsGEN[i].E());
    377382        PairingJet(JETreco,JETgen,branchJet);
    378         if(JETreco.Pt()>1)
     383        if(JETreco.Pt()>jet_pt_cut)
    379384          {
    380385            elementJet= (RESOLJET*) branchjet->NewEntry();
    381386            elementJet->PT = JETgen.Et();
    382387            elementJet->SmearedPT = JETreco.Et()/JETgen.Et();
     388            elementJet->E = JETgen.E();
     389            elementJet->dE = (JETreco.E()-JETgen.E())/JETgen.E() ;
     390            elementJet->dE2 = pow( (JETreco.E()-JETgen.E())/JETgen.E() , 2.) ;
    383391          }
    384392      }
     
    399407                  {
    400408                    elementTaujet= (TAUHAD*) branchtaujet->NewEntry();
    401                     elementTaujet->EnergieCen = (EnergySmallCone(towers,JETT.Eta(),JETT.Phi(),DET->TAU_energy_scone,DET->JET_seed)/JETT.E());
     409                    elementTaujet->EnergieCen = EnergySmallCone(towers,JETT.Eta(),JETT.Phi(),DET->TAU_energy_scone,DET->JET_seed)/JETT.E();
    402410                    elementTaujet->NumTrack = NumTracks(branchTracks,DET->TAU_track_pt,JETT.Eta(),JETT.Phi(),DET->TAU_track_scone);
    403411                    if( (EnergySmallCone(towers,JETT.Eta(),JETT.Phi(),DET->TAU_energy_scone,DET->JET_seed)/JETT.E()) > 0.95
     
    409417       
    410418      } // for itJet : loop on all jets
    411 //cout<<"i"<<endl;
    412419     
    413420      treeWriter->Fill();
    414421    } // Loop over all events
    415422  treeWriter->Write();
    416 float frac = numTauRec/numTau; 
    417 cout<<numTauRec<<endl;
    418 cout<<numTau<<endl;
    419 
     423
     424  cout << detectorcard << " has been used.\n";
    420425  cout << "** Exiting..." << endl;
    421   cout<<frac<<endl;
    422 
    423426 
    424427  delete treeWriter;
Note: See TracChangeset for help on using the changeset viewer.