Changeset 178 in svn for trunk/Delphes.cpp
- Timestamp:
- Jan 13, 2009, 12:37:55 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Delphes.cpp
r107 r178 66 66 } 67 67 68 // 1. ********** initialisation *********** 69 68 70 srand (time (NULL)); /* Initialisation du générateur */ 69 71 … … 112 114 //VFD information 113 115 VeryForward * VFD = new VeryForward(DetDatacard); 114 115 //todo(LogName.c_str()); 116 116 117 // data converters 117 118 DataConverter *converter=0; 118 119 … … 149 150 TIter itGen((TCollection*)branchGen); 150 151 151 // write the output root file152 //Output file : contents of the analysis object data 152 153 ExRootTreeWriter *treeWriter = new ExRootTreeWriter(outputfilename, "Analysis"); 153 154 ExRootTreeBranch *branchJet = treeWriter->NewBranch("Jet", TRootJet::Class()); … … 163 164 ExRootTreeBranch *branchFP420 = treeWriter->NewBranch("FP420hits", TRootRomanPotHits::Class()); 164 165 165 166 166 TRootGenParticle *particle; 167 167 TRootETmis *elementEtmis; … … 178 178 vector<fastjet::PseudoJet> input_particles;//for FastJet algorithm 179 179 vector<fastjet::PseudoJet> sorted_jets; 180 181 180 vector<TLorentzVector> TrackCentral; 182 181 vector<PhysicsTower> towers; 183 184 182 vector<ParticleUtil> electron; 185 183 vector<ParticleUtil> muon; … … 187 185 188 186 TSimpleArray<TRootGenParticle> NFCentralQ; 189 190 191 187 float iPhi=0,iEta=0; 192 188 193 // Loop over all events 189 190 191 // 2. ********** Loop over all events *********** 194 192 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) 197 197 { 198 198 TLorentzVector PTmis(0,0,0,0); … … 210 210 input_particles.clear(); 211 211 212 // Loop over all particles in event212 // 2.1 Loop over all particles in event 213 213 itGen.Reset(); 214 while( (particle = (TRootGenParticle*) itGen.Next()) ) 215 { 214 while( (particle = (TRootGenParticle*) itGen.Next()) ) { 216 215 int pid = abs(particle->PID); 216 217 218 // 2.1.1********************* preparation for the b-tagging 217 219 //// This subarray is needed for the B-jet algorithm 218 220 // optimization for speed : put first PID condition, then ETA condition, then either pt or status … … 224 226 } 225 227 228 // 2.1.2 ********************* central detector: keep only visible particles 226 229 // keeps only final particles, visible by the central detector, including the fiducial volume 227 230 // the ordering of conditions have been optimised for speed : put first the STATUS condition 228 //229 //230 231 if( (particle->Status == 1) && 231 232 ((pid != pNU1) && (pid != pNU2) && (pid != pNU3)) && … … 234 235 { 235 236 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); 237 242 float eta=fabs(genMomentum.Eta()); 238 243 244 245 // 2.1.2.2 ********************* central detector: smearing (calorimeters, muon chambers) 239 246 switch(pid) { 240 247 … … 264 271 DET->SmearHadron(genMomentum, 1.0); 265 272 break; 266 } // switch (pid) 267 273 } // 2.1.2.2 switch (pid) 274 275 276 // 2.1.2.3 ********************* central detector: calotowers 268 277 // all final particles but muons and neutrinos 269 278 // for calorimetric towers and missing PT 270 279 int charge=Charge(pid); 271 280 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) { 276 287 genMomentumCalo.SetPtEtaPhiE(genMomentum.Pt(),iEta,iPhi,genMomentum.E()); 277 288 elementCalo = (TRootCalo*) branchCalo->NewEntry(); 278 289 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())); 283 291 towers.push_back(Tower); 284 }285 } 286 } 292 } // if iEta != -100 293 } // else : when particles reach the calos 294 } // 2.1.2.3 calotowers 287 295 296 297 // 2.1.2.4 ********************* central detector: tracks 288 298 // all final charged particles 289 299 if( 290 300 (genMomentum.E()!=0) && 291 301 (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 293 304 ((rand()%100) < DET->TRACK_eff) && 294 305 (charge!=0) … … 298 309 elementTracks->Set(genMomentum); 299 310 TrackCentral.push_back(genMomentum); 300 } 311 } // 2.1.2.4 tracks 301 312 302 } // switch313 } // 2.1.2 central detector 303 314 304 if(DET->FLAG_vfd==1)305 {315 // 2.1.3 ********************* forward detectors: zdc 316 if(DET->FLAG_vfd==1) { 306 317 VFD->ZDC(treeWriter,branchZDC,particle); 307 318 VFD->RomanPots(treeWriter,branchRP220,branchFP420,particle); 308 319 } 309 320 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 312 328 DET->SortedVector(electron); 313 329 for(unsigned int i=0; i < electron.size(); i++) { … … 330 346 } 331 347 332 // computes the Missing Transverse Momentum348 // 2.2.2 ************* computes the Missing Transverse Momentum 333 349 TLorentzVector Att(0.,0.,0.,0.); 334 350 for(unsigned int i=0; i < towers.size(); i++) … … 349 365 elementEtmis->Py = (-PTmis).Py(); 350 366 351 //***************************** 352 367 // 2.2.3 ************* B-tag, tau jets 353 368 sorted_jets=JETRUN->RunJets(input_particles); 354 369 JETRUN->RunJetBtagging(treeWriter, branchJet,sorted_jets,NFCentralQ); 355 370 JETRUN->RunTauJets(treeWriter,branchTauJet,sorted_jets,towers, TrackCentral); 356 371 357 // Add here the trigger358 // Should test all the trigger table on the event, based on reconstructed objects359 372 treeWriter->Fill(); 360 361 } // Loop over all events 373 } // 2. Loop over all events ('for' loop) 362 374 363 375 treeWriter->Write(); 364 376 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 368 382 if(DET->FLAG_trigger == 1) 369 383 { 384 // input 370 385 TChain chainT("Analysis"); 371 386 chainT.Add(outputfilename.c_str()); 372 387 ExRootTreeReader *treeReaderT = new ExRootTreeReader(&chainT); 373 388 389 // output 374 390 TClonesArray *branchElecTrig = treeReaderT->UseBranch("Electron"); 375 391 TClonesArray *branchMuonTrig = treeReaderT->UseBranch("Muon"); … … 381 397 ExRootTreeWriter *treeWriterT = new ExRootTreeWriter(outputfilename, "Trigger"); 382 398 ExRootTreeBranch *branchTrigger = treeWriterT->NewBranch("TrigResult", TRootTrigger::Class()); 383 399 400 384 401 Long64_t entryT, allEntriesT = treeReaderT->GetEntries(); 385 cout << "** Chaincontains " << 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) { 388 405 treeWriterT->Clear(); 389 406 treeReaderT->ReadEntry(entryT); 390 407 TRIGT->GetGlobalResult(branchElecTrig, branchMuonTrig,branchJetTrig, branchTauJetTrig,branchPhotonTrig, branchETmisTrig,branchTrigger); 391 408 treeWriterT->Fill(); 392 }409 } // loop on all entries 393 410 394 411 treeWriterT->Write(); 395 412 delete treeWriterT; 396 } 397 398 //FROG display 413 } // trigger 414 415 416 // 3.2 ************** FROG display 399 417 if(DET->FLAG_frog == 1) 400 418 { … … 404 422 } 405 423 424 425 426 427 // 4. ********** End & Exit *********** 406 428 cout << "** Exiting..." << endl; 407 429 … … 412 434 delete JETRUN; 413 435 delete VFD; 414 415 436 if(converter) delete converter; 416 437 417 438 todo("TODO"); 418 439 } 419
Note:
See TracChangeset
for help on using the changeset viewer.