Fork me on GitHub

Changeset 447 in svn


Ignore:
Timestamp:
Jun 19, 2009, 7:07:04 PM (16 years ago)
Author:
Xavier Rouby
Message:

update resolutions CMS/ATLAS

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Resolutions.cpp

    r445 r447  
    3333
    3434/// \file Resolution.cpp
    35 /// \brief Prepares the resolution calculation
     35/// \brief Resolution for CMS
    3636
    3737#include "TChain.h"
     
    111111
    112112
    113 void PairingJet(TLorentzVector &JETSm, const TLorentzVector &JET, const TClonesArray *branchJet, const float dR=0.25)
     113void PairingJet(TLorentzVector &JETSm, const TLorentzVector &JET, const TClonesArray *branchJet)
    114114{
    115115  JETSm.SetPxPyPzE(0,0,0,0);
     
    125125        {
    126126          deltaRtest = DeltaR(JET.Phi(),JET.Eta(),Att.Phi(),Att.Eta());
    127           if(deltaRtest < dR)
     127          if(deltaRtest < 0.25)
    128128             {
    129129               JETSm = Att;
     
    203203  if(argc != 3) {
    204204      cout << " Usage: " << argv[0] << " input_file" << " output_file" << endl;
    205       cout << " input_file - input file in Delphes-root format," << endl;
     205      cout << " input_list - list of files in 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   /*
    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);
     259  DET->ReadDataCard("data/DetectorCard_CMS.dat");
    268260
    269261
    270262  //Jet information
    271   JetsUtil *JETRUN = new JetsUtil(detectorcard);
     263  JetsUtil *JETRUN = new JetsUtil("data/DetectorCard_CMS.dat");
    272264
    273265  TLorentzVector genMomentum(0,0,0,0);//TLorentzVector containing generator level information
     
    277269  vector<fastjet::PseudoJet> input_particlesGEN;//for FastJet algorithm
    278270  vector<fastjet::PseudoJet> sorted_jetsGEN;
     271 
    279272  vector<int> NTrackJet;
     273 
    280274  vector<TLorentzVector> towers;
    281275 
     
    315309          //Calculate ETMIS from generated particles
    316310          if((pid == pNU1) || (pid == pNU2) || (pid == pNU3))PTmisGEN = PTmisGEN + genMomentum;
    317 
    318           //Electrons and muons 
     311         
    319312          if( (particle->Status == 1)    &&
    320313            ((pid != pNU1) && (pid != pNU2) && (pid != pNU3)) &&
     
    335328                 case pMU: // all muons with eta < DET->MAX_MU
    336329                    PairingMuon(recoMomentum,genMomentum,branchMuon);
    337                     if(recoMomentum.E()!=0){
     330                    if(recoMomentum.E() !=0){
    338331                     elementMuon = (RESOLMUON*) branchmuon->NewEntry();
    339                      elementMuon->OverPT = 1./genMomentum.Pt();
    340                      elementMuon->OverSmearedPT = 1./recoMomentum.Pt();}
     332                     elementMuon->OverPT = (1/genMomentum.Pt());
     333                     elementMuon->OverSmearedPT = (1/recoMomentum.Pt());}
    341334                   break; // case pMU
    342335                 default:
     
    369362      elementEtmis->Ex = (-PTmisGEN).Px();
    370363      elementEtmis->SEt = ScalarEt;
     364
    371365      elementEtmis->EtSmeare = (PTmisReco).Pt()-(PTmisGEN).Pt();
    372366      elementEtmis->ExSmeare = (-PTmisReco).Px()-(PTmisGEN).Px();
     
    376370
    377371      TSimpleArray<TRootGenParticle> TausHadr = TauHadr(branchGen);
     372
    378373      TLorentzVector JETreco(0,0,0,0);
    379374      for (unsigned int i = 0; i < sorted_jetsGEN.size(); i++) {
     
    381376        JETgen.SetPxPyPzE(sorted_jetsGEN[i].px(),sorted_jetsGEN[i].py(),sorted_jetsGEN[i].pz(),sorted_jetsGEN[i].E());
    382377        PairingJet(JETreco,JETgen,branchJet);
    383         if(JETreco.Pt()>jet_pt_cut)
     378        if(JETreco.Pt()>1)
    384379          {
    385380            elementJet= (RESOLJET*) branchjet->NewEntry();
    386381            elementJet->PT = JETgen.Et();
    387382            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.) ;
    391383          }
    392384      }
     
    407399                  {
    408400                    elementTaujet= (TAUHAD*) branchtaujet->NewEntry();
    409                     elementTaujet->EnergieCen = EnergySmallCone(towers,JETT.Eta(),JETT.Phi(),DET->TAU_energy_scone,DET->JET_seed)/JETT.E();
     401                    elementTaujet->EnergieCen = (EnergySmallCone(towers,JETT.Eta(),JETT.Phi(),DET->TAU_energy_scone,DET->JET_seed)/JETT.E());
    410402                    elementTaujet->NumTrack = NumTracks(branchTracks,DET->TAU_track_pt,JETT.Eta(),JETT.Phi(),DET->TAU_track_scone);
    411403                    if( (EnergySmallCone(towers,JETT.Eta(),JETT.Phi(),DET->TAU_energy_scone,DET->JET_seed)/JETT.E()) > 0.95
     
    417409       
    418410      } // for itJet : loop on all jets
     411//cout<<"i"<<endl;
    419412     
    420413      treeWriter->Fill();
    421414    } // Loop over all events
    422415  treeWriter->Write();
    423 
    424   cout << detectorcard << " has been used.\n";
     416float frac = numTauRec/numTau; 
     417cout<<numTauRec<<endl;
     418cout<<numTau<<endl;
     419
    425420  cout << "** Exiting..." << endl;
     421  cout<<frac<<endl;
     422
    426423 
    427424  delete treeWriter;
Note: See TracChangeset for help on using the changeset viewer.