Fork me on GitHub

Changeset 178 in svn for trunk/Delphes.cpp


Ignore:
Timestamp:
Jan 13, 2009, 12:37:55 AM (16 years ago)
Author:
Xavier Rouby
Message:

Cleaning, Comments, and removing the pt cut on tracks and calotowers when bfield simulated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Delphes.cpp

    r107 r178  
    6666  }
    6767 
     68// 1. ********** initialisation ***********
     69
    6870  srand (time (NULL));         /* Initialisation du générateur */
    6971 
     
    112114  //VFD information
    113115  VeryForward * VFD = new VeryForward(DetDatacard);
    114  
    115   //todo(LogName.c_str());
    116  
     116 
     117  // data converters
    117118  DataConverter *converter=0;
    118119 
     
    149150  TIter itGen((TCollection*)branchGen);
    150151 
    151   //write the output root file
     152  //Output file : contents of the analysis object data
    152153  ExRootTreeWriter *treeWriter = new ExRootTreeWriter(outputfilename, "Analysis");
    153154  ExRootTreeBranch *branchJet = treeWriter->NewBranch("Jet", TRootJet::Class());
     
    163164  ExRootTreeBranch *branchFP420 = treeWriter->NewBranch("FP420hits", TRootRomanPotHits::Class());
    164165 
    165  
    166166  TRootGenParticle *particle;
    167167  TRootETmis *elementEtmis;
     
    178178  vector<fastjet::PseudoJet> input_particles;//for FastJet algorithm
    179179  vector<fastjet::PseudoJet> sorted_jets;
    180  
    181180  vector<TLorentzVector> TrackCentral; 
    182181  vector<PhysicsTower> towers;
    183  
    184182  vector<ParticleUtil> electron;
    185183  vector<ParticleUtil> muon;
     
    187185
    188186  TSimpleArray<TRootGenParticle> NFCentralQ;
    189  
    190  
    191187  float iPhi=0,iEta=0;
    192188
    193   // Loop over all events
     189
     190
     191// 2. ********** Loop over all events ***********
    194192  Long64_t entry, allEntries = treeReader->GetEntries();
    195   cout << "** Chain contains " << allEntries << " events" << endl;
    196   for(entry = 0; entry < 200; ++entry)
     193  cout << "** The input list contains " << allEntries << " events" << endl;
     194
     195  // loop on all events
     196  for(entry = 0; entry < allEntries; ++entry)
    197197    {
    198198      TLorentzVector PTmis(0,0,0,0);
     
    210210      input_particles.clear();
    211211     
    212       // Loop over all particles in event
     212      // 2.1 Loop over all particles in event
    213213      itGen.Reset();
    214       while( (particle = (TRootGenParticle*) itGen.Next()) )
    215         {
     214      while( (particle = (TRootGenParticle*) itGen.Next()) ) {
    216215          int pid = abs(particle->PID);
     216
     217       
     218          // 2.1.1********************* preparation for the b-tagging
    217219          //// This subarray is needed for the B-jet algorithm
    218220          // optimization for speed : put first PID condition, then ETA condition, then either pt or status
     
    224226          }
    225227         
     228          // 2.1.2 ********************* central detector: keep only visible particles
    226229          // keeps only final particles, visible by the central detector, including the fiducial volume
    227230          // the ordering of conditions have been optimised for speed : put first the STATUS condition
    228           //
    229           //
    230231          if( (particle->Status == 1)    &&
    231232              ((pid != pNU1) && (pid != pNU2) && (pid != pNU3)) &&
     
    234235            {
    235236              genMomentum.SetPxPyPzE(particle->Px, particle->Py, particle->Pz, particle->E);
    236               if(DET->FLAG_bfield==1)TRACP->Propagation(particle,genMomentum);
     237
     238              // 2.1.2.1 ********************* central detector: magnetic field
     239              // genMomentum is then changed with respect to the magnetic field
     240              //if(DET->FLAG_bfield==1)  genMomentum = TRACP->Propagation(particle);
     241              if(DET->FLAG_bfield==1)  TRACP->Propagation(particle,genMomentum);
    237242              float eta=fabs(genMomentum.Eta());
    238              
     243             
     244 
     245              // 2.1.2.2 ********************* central detector: smearing (calorimeters, muon chambers)
    239246              switch(pid) {
    240247               
     
    264271                DET->SmearHadron(genMomentum, 1.0);
    265272                break;
    266               } // switch (pid)
    267              
     273              } // 2.1.2.2  switch (pid)
     274             
     275 
     276              // 2.1.2.3 ********************* central detector: calotowers
    268277              // all final particles but muons and neutrinos   
    269278              // for calorimetric towers and missing PT
    270279              int charge=Charge(pid);
    271280              if(genMomentum.E() !=0 && pid != pMU) {
    272                 if(charge == 0 || (charge !=0 && genMomentum.Pt() >= DET->TRACK_ptmin)){
    273                   DET->BinEtaPhi(genMomentum.Phi(), genMomentum.Eta(), iPhi, iEta);
    274                   if(iEta != -100 && iPhi != -100)
    275                     {
     281                // in case the Bfield is not simulated, checks that charged particles have enough pt to reach the calos
     282                if ( !DET->FLAG_bfield && charge!=0 && genMomentum.Pt() <= DET->TRACK_ptmin ) { /* particules do not reach calos */ }
     283                else { // particles reach calos
     284                  // applies the calo segmentation and returns iEta & iPhi
     285                  DET->BinEtaPhi(genMomentum.Phi(), genMomentum.Eta(), iPhi, iEta);
     286                  if(iEta != -100 && iPhi != -100) {
    276287                      genMomentumCalo.SetPtEtaPhiE(genMomentum.Pt(),iEta,iPhi,genMomentum.E());
    277288                      elementCalo = (TRootCalo*) branchCalo->NewEntry();
    278289                      elementCalo->Set(genMomentumCalo);
    279 
    280 //                    CalTower     myCaloTower(genMomentumCalo.Et,genMomentumCalo.Eta,genMomentumCalo.Phi,iEta,iPhi);
    281 //                    PhysicsTower Tower(LorentzVector(genMomentumCalo.Px(),genMomentumCalo.Py(),genMomentumCalo.Pz(), genMomentumCalo.E()),myCaloTower);
    282                       PhysicsTower Tower(LorentzVector(genMomentumCalo.Px(),genMomentumCalo.Py(),genMomentumCalo.Pz(), genMomentumCalo.E()));
     290                      PhysicsTower Tower(LorentzVector(genMomentumCalo.Px(),genMomentumCalo.Py(),genMomentumCalo.Pz(),genMomentumCalo.E()));
    283291                      towers.push_back(Tower);
    284                     }
    285                 }
    286               }
     292                  } // if iEta != -100
     293                } // else : when particles reach the calos
     294              } // 2.1.2.3 calotowers
    287295             
     296
     297              // 2.1.2.4 ********************* central detector: tracks
    288298              // all final charged particles
    289299              if(
    290300                 (genMomentum.E()!=0) &&
    291301                 (fabs(genMomentum.Eta()) < DET->CEN_max_tracker) &&
    292                  (genMomentum.Pt() > DET->TRACK_ptmin ) &&     // pt too small to be taken into account
     302                 (DET->FLAG_bfield || ( !DET->FLAG_bfield && genMomentum.Pt() > DET->TRACK_ptmin )) &&     
     303                        // if bfield not simulated, pt should be high enough to be taken into account
    293304                 ((rand()%100) < DET->TRACK_eff)  &&
    294305                 (charge!=0)
     
    298309                  elementTracks->Set(genMomentum);
    299310                  TrackCentral.push_back(genMomentum);
    300                 }
     311                } // 2.1.2.4 tracks
    301312             
    302             } // switch
     313            } // 2.1.2 central detector
    303314         
    304           if(DET->FLAG_vfd==1)
    305             { 
     315          // 2.1.3 ********************* forward detectors: zdc
     316          if(DET->FLAG_vfd==1) {
    306317             VFD->ZDC(treeWriter,branchZDC,particle);
    307318             VFD->RomanPots(treeWriter,branchRP220,branchFP420,particle);
    308             }
     319          }
    309320         
    310         } // while
    311      
     321       } // 2.1 while : loop on all particles of the event.
     322     
     323
     324
     325      // 2.2 ********** Output preparation & complex objects  ***********
     326 
     327      // 2.2.1 ********************* sorting collections by decreasing pt
    312328      DET->SortedVector(electron);
    313329      for(unsigned int i=0; i < electron.size(); i++) {
     
    330346      }
    331347     
    332       // computes the Missing Transverse Momentum
     348      // 2.2.2 ************* computes the Missing Transverse Momentum
    333349      TLorentzVector Att(0.,0.,0.,0.);
    334350      for(unsigned int i=0; i < towers.size(); i++)
     
    349365      elementEtmis->Py = (-PTmis).Py();
    350366     
    351       //*****************************
    352      
     367      // 2.2.3 ************* B-tag, tau jets
    353368      sorted_jets=JETRUN->RunJets(input_particles);
    354369      JETRUN->RunJetBtagging(treeWriter, branchJet,sorted_jets,NFCentralQ);
    355370      JETRUN->RunTauJets(treeWriter,branchTauJet,sorted_jets,towers, TrackCentral);
    356371     
    357       // Add here the trigger
    358       // Should test all the trigger table on the event, based on reconstructed objects
    359372      treeWriter->Fill();
    360      
    361     } // Loop over all events
     373    } // 2. Loop over all events ('for' loop)
    362374 
    363375  treeWriter->Write();
    364376  delete treeWriter;
    365  
    366   //running the trigger in case the FLAG trigger is put to 1 in the datacard
    367  
     377 
     378
     379 
     380// 3. ********** Trigger  & Frog ***********
     381  // 3.1 ************ running the trigger in case the FLAG trigger is put to 1 in the datacard
    368382  if(DET->FLAG_trigger == 1)
    369383    {
     384      // input
    370385      TChain chainT("Analysis");
    371386      chainT.Add(outputfilename.c_str());
    372387      ExRootTreeReader *treeReaderT = new ExRootTreeReader(&chainT);
    373388     
     389      // output
    374390      TClonesArray *branchElecTrig = treeReaderT->UseBranch("Electron");
    375391      TClonesArray *branchMuonTrig = treeReaderT->UseBranch("Muon");
     
    381397      ExRootTreeWriter *treeWriterT = new ExRootTreeWriter(outputfilename, "Trigger");
    382398      ExRootTreeBranch *branchTrigger = treeWriterT->NewBranch("TrigResult", TRootTrigger::Class());
    383      
     399     
     400 
    384401      Long64_t entryT, allEntriesT = treeReaderT->GetEntries();
    385       cout << "** Chain contains " << allEntriesT << " events" << endl;
    386       for(entryT = 0; entryT < allEntriesT; ++entryT)
    387         {
     402      cout << "** Trigger: the 'Analysis' tree contains " << allEntriesT << " events" << endl;
     403      // loop on all entries
     404      for(entryT = 0; entryT < allEntriesT; ++entryT) {
    388405          treeWriterT->Clear();
    389406          treeReaderT->ReadEntry(entryT);
    390407          TRIGT->GetGlobalResult(branchElecTrig, branchMuonTrig,branchJetTrig, branchTauJetTrig,branchPhotonTrig, branchETmisTrig,branchTrigger);
    391408          treeWriterT->Fill();
    392         }
     409      } // loop on all entries
    393410     
    394411      treeWriterT->Write();
    395412      delete treeWriterT;
    396     }
    397  
    398   //FROG display
     413    } // trigger
     414 
     415 
     416  // 3.2 ************** FROG display
    399417  if(DET->FLAG_frog == 1)
    400418    {
     
    404422    }
    405423 
     424
     425
     426
     427// 4. ********** End & Exit ***********
    406428  cout << "** Exiting..." << endl;
    407429 
     
    412434  delete JETRUN;
    413435  delete VFD;
    414  
    415436  if(converter) delete converter;
    416437 
    417438  todo("TODO");
    418439}
    419 
Note: See TracChangeset for help on using the changeset viewer.