Fork me on GitHub

Changeset 71 in svn for trunk/Delphes.cpp


Ignore:
Timestamp:
Dec 3, 2008, 2:47:52 AM (16 years ago)
Author:
Xavier Rouby
Message:

iEta et iPhi. Verification non complete.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Delphes.cpp

    r70 r71  
    5555  char *appargv[] = {appName, "-b"};
    5656  TApplication app(appName, &appargc, appargv);
    57  
    58   if(argc != 4 && argc != 3) {
    59       cout << " Usage: " << argv[0] << " input_file" << " output_file" << " data_card " << endl;
     57
     58  if(argc != 4 && argc != 3 && argc != 5) {
     59      cout << " Usage: " << argv[0] << " input_file output_file [detector_card] [trigger_card] " << endl;
    6060      cout << " input_list - list of files in Ntpl, StdHep of LHEF format," << endl;
    6161      cout << " output_file - output file." << endl;
    62       cout << " data_card - Datacard containing resolution variables for the detector simulation (optional) "<<endl;
     62      cout << " detector_card - Datacard containing resolution variables for the detector simulation (optional) "<<endl;
     63      cout << " trigger_card - Datacard containing the trigger algorithms (optional) "<<endl;
    6364      exit(1);
    6465  }
     
    9394  DET->Logfile(LogName);
    9495
    95 
    9696  //Trigger information
    97   TriggerTable *TRIGT = new TriggerTable();
    98   TRIGT->TriggerCardReader("data/trigger.dat");
    99   TRIGT->PrintTriggerTable(LogName);
    100   //outputFile->Close();
    101  
     97  //Trigger *TRIG = new Trigger();
     98  //TRIG->TriggerReader("data/trigger.dat");
    10299
    103100  //Propagation of tracks in the B field
     
    231228            {
    232229            genMomentum.SetPxPyPzE(particle->Px, particle->Py, particle->Pz, particle->E);
    233             //TRACP->Propagation(particle,genMomentum);
     230            TRACP->Propagation(particle,genMomentum);
    234231            float eta=fabs(genMomentum.Eta());
    235232            switch(pid) {
     
    271268                // back of the input_particles vector
    272269                input_particles.push_back(fastjet::PseudoJet(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E()));
    273  
     270               
    274271                genMomentumCalo.SetPxPyPzE(CaloTower.fourVector.px,CaloTower.fourVector.py,CaloTower.fourVector.pz,CaloTower.fourVector.E);
    275272                elementCalo = (TRootCalo*) branchCalo->NewEntry();
    276273                elementCalo->Set(genMomentumCalo);
     274                DET->BinEtaPhi(genMomentumCalo.Phi(), genMomentumCalo.Eta(), elementCalo->Phi, elementCalo->Eta);
    277275              }
    278276            }
     
    304302         
    305303        } // while
    306 
    307    // computes the Missing Transverse Momentum
    308    TLorentzVector Att(0.,0.,0.,0.);
    309    for(unsigned int i=0; i < towers.size(); i++)
    310      {
    311         Att.SetPxPyPzE(towers[i].fourVector.px,towers[i].fourVector.py,towers[i].fourVector.pz,towers[i].fourVector.E);
    312         PTmis = PTmis + Att;
    313      }
    314    elementEtmis = (TRootETmis*) branchETmis->NewEntry();
    315    elementEtmis->ET = (PTmis).Pt();
    316    elementEtmis->Phi = (-PTmis).Phi();
    317    elementEtmis->Px = (-PTmis).Px();
    318    elementEtmis->Py = (-PTmis).Py();
    319    //*****************************
    320    
     304     
    321305      for(unsigned int i=0; i < electron.size(); i++) {
    322306        if(electron[i].E()!=0 && fabs(electron[i].Eta()) < DET->MAX_TRACKER && electron[i].Pt() > DET->ELEC_pt)
     
    338322      }
    339323     
     324      // computes the Missing Transverse Momentum
     325      TLorentzVector Att(0.,0.,0.,0.);
     326      for(unsigned int i=0; i < towers.size(); i++)
     327        {
     328          Att.SetPxPyPzE(towers[i].fourVector.px,towers[i].fourVector.py,towers[i].fourVector.pz,towers[i].fourVector.E);
     329          PTmis = PTmis + Att;
     330        }
     331      elementEtmis = (TRootETmis*) branchETmis->NewEntry();
     332      elementEtmis->ET = (PTmis).Pt();
     333      elementEtmis->Phi = (-PTmis).Phi();
     334      elementEtmis->Px = (-PTmis).Px();
     335      elementEtmis->Py = (-PTmis).Py();
     336
     337      //*****************************
     338      treeWriter->Fill();
     339     
    340340      sorted_jets=JETRUN->RunJets(input_particles);
    341341      JETRUN->RunJetBtagging(treeWriter, branchJet,sorted_jets,NFCentralQ);
     
    344344      // Add here the trigger
    345345      // Should test all the trigger table on the event, based on reconstructed objects
    346       treeWriter->Fill();
    347      
     346     
    348347    } // Loop over all events
    349  
     348
    350349  treeWriter->Write();
     350 
     351  cout << "** Exiting..." << endl;
     352 
    351353  delete treeWriter;
    352  
    353   if(DET->DOTRIGGER == 1)
    354     {
    355       TChain chainT("Analysis");
    356       chainT.Add(outputfilename.c_str());
    357       ExRootTreeReader *treeReaderT = new ExRootTreeReader(&chainT);
    358      
    359       const TClonesArray *branchElecTrig = treeReaderT->UseBranch("Electron");
    360       const TClonesArray *branchMuonTrig = treeReaderT->UseBranch("Muon");
    361       const TClonesArray *branchJetTrig = treeReaderT->UseBranch("Jet");
    362       const TClonesArray *branchTauJetTrig = treeReaderT->UseBranch("TauJet");
    363       const TClonesArray *branchPhotonTrig = treeReaderT->UseBranch("Photon");
    364       const TClonesArray *branchETmisTrig = treeReaderT->UseBranch("ETmis");
    365      
    366       ExRootTreeWriter *treeWriterT = new ExRootTreeWriter(outputfilename, "Trigger");
    367       ExRootTreeBranch *branchTrigger = treeWriterT->NewBranch("TrigResult", TRootTrigger::Class());
    368      
    369       TRootTrigger *elementTrigger;
    370      
    371       Long64_t entryT, allEntriesT = treeReaderT->GetEntries();
    372       cout << "** Chain contains " << allEntriesT << " events" << endl;
    373       for(entryT = 0; entryT < allEntriesT; ++entryT)
    374         {
    375           treeWriterT->Clear();
    376           treeReaderT->ReadEntry(entry);
    377           elementTrigger = (TRootTrigger*) branchTrigger->NewEntry();
    378           elementTrigger->Accepted=1;
    379           treeWriterT->Fill();
    380         }
    381      
    382       treeWriterT->Write();
    383       delete treeWriterT;
    384     }
    385  
    386   cout << "** Exiting..." << endl;
    387  
    388354  delete treeReader;
    389355  delete DET;
    390356  if(converter) delete converter;
    391  
     357
    392358  todo("TODO");
    393359}
Note: See TracChangeset for help on using the changeset viewer.