Changeset 55 in svn for trunk/Delphes.cpp
- Timestamp:
- Nov 27, 2008, 3:05:11 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Delphes.cpp
r49 r55 19 19 #include "Utilities/ExRootAnalysis/interface/ExRootTreeBranch.h" 20 20 21 #include "H_BeamParticle.h"22 #include "H_BeamLine.h"23 #include "H_RomanPot.h"24 25 21 #include "interface/DataConverter.h" 26 22 #include "interface/HEPEVTConverter.h" … … 29 25 30 26 #include "interface/SmearUtil.h" 31 #include "Utilities/Fastjet/include/fastjet/PseudoJet.hh" 32 #include "Utilities/Fastjet/include/fastjet/ClusterSequence.hh" 33 34 // get info on how fastjet was configured 35 #include "Utilities/Fastjet/include/fastjet/config.h" 36 37 // make sure we have what is needed 38 #ifdef ENABLE_PLUGIN_SISCONE 39 # include "Utilities/Fastjet/plugins/SISCone/SISConePlugin.hh" 40 #endif 41 #ifdef ENABLE_PLUGIN_CDFCONES 42 # include "Utilities/Fastjet/plugins/CDFCones/CDFMidPointPlugin.hh" 43 # include "Utilities/Fastjet/plugins/CDFCones/CDFJetCluPlugin.hh" 44 #endif 45 46 #include<vector> 47 #include<iostream> 48 49 27 #include "interface/BFieldProp.h" 28 #include "interface/TriggerUtil.h" 29 #include "interface/VeryForward.h" 30 #include "interface/JetUtils.h" 31 32 #include <vector> 33 #include <iostream> 50 34 51 35 using namespace std; … … 68 52 { 69 53 int appargc = 2; 70 char *appName = " JetsSim";54 char *appName = "Delphes"; 71 55 char *appargv[] = {appName, "-b"}; 72 56 TApplication app(appName, &appargc, appargv); … … 103 87 string DetDatacard(""); 104 88 if(argc==4) DetDatacard =argv[3]; 89 90 //Smearing information 105 91 RESOLution *DET = new RESOLution(); 106 92 DET->ReadDataCard(DetDatacard); 107 93 DET->Logfile(LogName); 108 94 109 todo(LogName.c_str()); 95 //Trigger information 96 Trigger *TRIG = new Trigger(); 97 TRIG->TriggerReader("data/trigger.dat"); 98 99 //Propagation of tracks in the B field 100 TrackPropagation *TRACP = new TrackPropagation(); 101 102 //Jet information 103 JetsUtil *JETRUN = new JetsUtil(); 104 105 //VFD information 106 VeryForward * VFD = new VeryForward(); 107 108 //todo(LogName.c_str()); 110 109 111 110 DataConverter *converter=0; … … 163 162 TRootMuon *elementMu; 164 163 TRootPhoton *elementPhoton; 165 TRootJet *elementJet;166 TRootTauJet *elementTauJet;167 164 TRootTracks *elementTracks; 168 165 TRootCalo *elementCalo; 169 TRootZdcHits *elementZdc;170 TRootRomanPotHits *elementRP220, *elementFP420;171 166 172 167 TLorentzVector genMomentum(0,0,0,0); 173 168 TLorentzVector genMomentumCalo(0,0,0,0); 174 169 LorentzVector jetMomentum; 170 171 vector<fastjet::PseudoJet> input_particles;//for FastJet algorithm 172 vector<fastjet::PseudoJet> sorted_jets; 173 175 174 vector<TLorentzVector> TrackCentral; 176 175 vector<PhysicsTower> towers; 177 vector<fastjet::PseudoJet> input_particles;//for FastJet algorithm178 vector<fastjet::PseudoJet> inclusive_jets;179 vector<fastjet::PseudoJet> sorted_jets;180 176 181 177 vector<TLorentzVector> electron; … … 185 181 TSimpleArray<TRootGenParticle> NFCentralQ; 186 182 187 //Initialisation of Hector 188 extern bool relative_energy; 189 relative_energy = true; // should always be true 190 extern int kickers_on; 191 kickers_on = 1; // should always be 1 192 193 // user should provide : (1) optics file for each beamline, and IPname, 194 // and offset data (s,x) for optical elements 195 H_BeamLine* beamline1 = new H_BeamLine(1,500.); 196 beamline1->fill("data/LHCB1IR5_v6.500.tfs",1,"IP5"); 197 beamline1->offsetElements(120,-0.097); 198 H_RomanPot * rp220_1 = new H_RomanPot("rp220_1",220,2000); // RP 220m, 2mm, beam 1 199 H_RomanPot * rp420_1 = new H_RomanPot("rp420_1",420,4000); // RP 420m, 4mm, beam 1 200 beamline1->add(rp220_1); 201 beamline1->add(rp420_1); 202 203 H_BeamLine* beamline2 = new H_BeamLine(1,500.); 204 beamline2->fill("data/LHCB1IR5_v6.500.tfs",-1,"IP5"); 205 beamline2->offsetElements(120,+0.097); 206 H_RomanPot * rp220_2 = new H_RomanPot("rp220_2",220,2000);// RP 220m, 2mm, beam 2 207 H_RomanPot * rp420_2 = new H_RomanPot("rp420_2",420,4000);// RP 420m, 4mm, beam 2 208 beamline2->add(rp220_2); 209 beamline2->add(rp420_2); 210 211 // we will have four jet definitions, and the first three will be 212 // plugins 213 fastjet::JetDefinition jet_def; 214 fastjet::JetDefinition::Plugin * plugins; 215 216 switch(DET->JETALGO) { 217 default: 218 case 1: { 219 220 // set up a CDF midpoint jet definition 221 #ifdef ENABLE_PLUGIN_CDFCONES 222 plugins = new fastjet::CDFJetCluPlugin(DET->SEEDTHRESHOLD,DET->CONERADIUS,DET->C_ADJACENCYCUT,DET->C_MAXITERATIONS,DET->C_IRATCH,DET->OVERLAPTHRESHOLD); 223 jet_def = fastjet::JetDefinition(plugins); 224 #else 225 plugins = NULL; 226 #endif 227 } 228 break; 229 230 case 2: { 231 232 // set up a CDF midpoint jet definition 233 #ifdef ENABLE_PLUGIN_CDFCONES 234 plugins = new fastjet::CDFMidPointPlugin (DET->SEEDTHRESHOLD,DET->CONERADIUS,DET->M_CONEAREAFRACTION,DET->M_MAXPAIRSIZE,DET->M_MAXITERATIONS,DET->OVERLAPTHRESHOLD); 235 jet_def = fastjet::JetDefinition(plugins); 236 #else 237 plugins = NULL; 238 #endif 239 } 240 break; 241 case 3: { 242 // set up a siscone jet definition 243 #ifdef ENABLE_PLUGIN_SISCONE 244 plugins = new fastjet::SISConePlugin (DET->CONERADIUS,DET->OVERLAPTHRESHOLD,DET->NPASS, DET->PROTOJET_PTMIN); 245 jet_def = fastjet::JetDefinition(plugins); 246 #else 247 plugins = NULL; 248 #endif 249 } 250 break; 251 252 case 4: { 253 jet_def = fastjet::JetDefinition(fastjet::kt_algorithm, DET->CONERADIUS); 254 } 255 break; 256 257 case 5: { 258 jet_def = fastjet::JetDefinition(fastjet::cambridge_algorithm,DET->CONERADIUS); 259 } 260 break; 261 262 case 6: { 263 jet_def = fastjet::JetDefinition(fastjet::antikt_algorithm,DET->CONERADIUS); 264 } 265 break; 266 } 267 183 184 268 185 // Loop over all events 269 186 Long64_t entry, allEntries = treeReader->GetEntries(); … … 286 203 towers.clear(); 287 204 input_particles.clear(); 288 inclusive_jets.clear();289 sorted_jets.clear();290 205 291 206 // Loop over all particles in event … … 294 209 genMomentum.SetPxPyPzE(particle->Px, particle->Py, particle->Pz, particle->E); 295 210 296 297 float eta = fabs(particle->Eta);298 211 int pid = abs(particle->PID); 212 float eta = fabs(genMomentum.Eta()); 213 299 214 //subarray of the quarks (i.e. not final particles, i.e status not equal to 1) 300 215 // in the tracker (i.e. for those we know the tracks) … … 312 227 // keeps only final particles, visible by the central detector, including the fiducial volume 313 228 // the ordering of conditions have been optimised for speed : put first the STATUS condition 229 // 230 // 314 231 if( (particle->Status == 1) && 315 232 ( … … 318 235 ) 319 236 ) { 320 switch(pid) { 237 // TRACP->Propagation(particle,genMomentum); 238 eta = fabs(genMomentum.Eta()); 239 switch(pid) { 321 240 322 241 case pE: // all electrons with eta < DET->MAX_CALO_FWD … … 363 282 } 364 283 365 366 284 // all final charged particles 367 285 if( 368 286 ((rand()%100) < DET->TRACKING_EFF) && 369 287 (genMomentum.E()!=0) && 370 (fabs( particle->Eta) < DET->MAX_TRACKER) &&288 (fabs(genMomentum.Eta()) < DET->MAX_TRACKER) && 371 289 (genMomentum.Pt() > DET->PT_TRACKS_MIN ) && // pt too small to be taken into account 372 290 (pid != pGAMMA) && … … 386 304 } // switch 387 305 388 // Forward particles in CASTOR ? 389 /* if (particle->Status == 1 && (fabs(particle->Eta) > DET->MIN_CALO_VFWD) 390 && (fabs(particle->Eta) < DET->MAX_CALO_VFWD)) { 391 392 393 } // CASTOR 394 */ 395 // Zero degree calorimeter, for forward neutrons and photons 396 if (particle->Status ==1 && (pid == pN || pid == pGAMMA ) && eta > DET->MIN_ZDC ) { 397 // !!!!!!!!! vérifier que particle->Z est bien en micromÚtres!!! 398 // !!!!!!!!! vérifier que particle->T est bien en secondes!!! 399 // !!!!!!!!! pas de smearing ! on garde trop d'info ! 400 elementZdc = (TRootZdcHits*) branchZDC->NewEntry(); 401 elementZdc->Set(genMomentum); 402 403 // time of flight t is t = T + d/[ cos(theta) v ] 404 //double tx = acos(particle->Px/particle->Pz); 405 //double ty = acos(particle->Py/particle->Pz); 406 //double theta = (1E-6)*sqrt( pow(tx,2) + pow(ty,2) ); 407 //double flight_distance = (DET->ZDC_S - particle->Z*(1E-6))/cos(theta) ; // assumes that Z is in micrometers 408 double flight_distance = (DET->ZDC_S - particle->Z*(1E-6)); 409 // assumes also that the emission angle is so small that 1/(cos theta) = 1 410 elementZdc->T = 0*particle->T + flight_distance/speed_of_light; // assumes highly relativistic particles 411 elementZdc->side = sign(particle->Eta); 412 413 } 414 415 // if forward proton 416 if( (pid == pP) && (particle->Status == 1) && (fabs(particle->Eta) > DET->MAX_CALO_FWD) ) 417 { 418 // !!!!!!!! put here particle->CHARGE and particle->MASS 419 H_BeamParticle p1; /// put here particle->CHARGE and particle->MASS 420 p1.smearAng(); 421 p1.smearPos(); 422 p1.setPosition(p1.getX()-500.,p1.getY(),p1.getTX()-1*kickers_on*CRANG,p1.getTY(),0); 423 p1.set4Momentum(particle->Px,particle->Py,particle->Pz,particle->E); 424 425 H_BeamLine *beamline; 426 if(particle->Eta >0) beamline = beamline1; 427 else beamline = beamline2; 428 429 p1.computePath(beamline,1); 430 431 if(p1.stopped(beamline)) { 432 if (p1.getStoppingElement()->getName()=="rp220_1" || p1.getStoppingElement()->getName()=="rp220_2") { 433 p1.propagate(DET->RP220_S); 434 elementRP220 = (TRootRomanPotHits*) branchRP220->NewEntry(); 435 elementRP220->X = (1E-6)*p1.getX(); // [m] 436 elementRP220->Y = (1E-6)*p1.getY(); // [m] 437 elementRP220->Tx = (1E-6)*p1.getTX(); // [rad] 438 elementRP220->Ty = (1E-6)*p1.getTY(); // [rad] 439 elementRP220->S = p1.getS(); // [m] 440 elementRP220->T = -1; // not yet implemented 441 elementRP220->E = p1.getE(); // not yet implemented 442 elementRP220->q2 = -1; // not yet implemented 443 elementRP220->side = sign(particle->Eta); 444 445 } else if (p1.getStoppingElement()->getName()=="rp420_1" || p1.getStoppingElement()->getName()=="rp420_2") { 446 p1.propagate(DET->FP420_S); 447 elementFP420 = (TRootRomanPotHits*) branchFP420->NewEntry(); 448 elementFP420->X = (1E-6)*p1.getX(); // [m] 449 elementFP420->Y = (1E-6)*p1.getY(); // [m] 450 elementFP420->Tx = (1E-6)*p1.getTX(); // [rad] 451 elementFP420->Ty = (1E-6)*p1.getTY(); // [rad] 452 elementFP420->S = p1.getS(); // [m] 453 elementFP420->T = -1; // not yet implemented 454 elementFP420->E = p1.getE(); // not yet implemented 455 elementFP420->q2 = -1; // not yet implemented 456 elementFP420->side = sign(particle->Eta); 457 } 458 } 459 460 // if(p1.stopped(beamline) && (p1.getStoppingElement()->getS() > 100)) 461 // cout << "Eloss =" << 7000.-p1.getE() << " ; " << p1.getStoppingElement()->getName() << endl; 462 } // if forward proton 306 VFD->ZDC(treeWriter,branchZDC,particle); 307 VFD->RomanPots(treeWriter,branchRP220,branchFP420,particle); 463 308 464 309 } // while … … 497 342 //***************************** 498 343 499 // run the jet clustering with the above jet definition 500 if(input_particles.size()!=0) 501 { 502 fastjet::ClusterSequence clust_seq(input_particles, jet_def); 503 // extract the inclusive jets with pt > 5 GeV 504 double ptmin = 5.0; 505 inclusive_jets = clust_seq.inclusive_jets(ptmin); 506 // sort jets into increasing pt 507 sorted_jets = sorted_by_pt(inclusive_jets); 508 } 509 for (unsigned int i = 0; i < sorted_jets.size(); i++) { 510 TLorentzVector JET; 511 JET.SetPxPyPzE(sorted_jets[i].px(),sorted_jets[i].py(),sorted_jets[i].pz(),sorted_jets[i].E()); 512 // Tau jet identification : 1! track and electromagnetic collimation 513 if(fabs(JET.Eta()) < (DET->MAX_TRACKER - DET->TAU_CONE_TRACKS)) { 514 double Energie_tau_central = DET->EnergySmallCone(towers,JET.Eta(),JET.Phi()); 515 if( 516 ( Energie_tau_central/JET.E() > DET->TAU_EM_COLLIMATION ) && 517 ( DET->NumTracks(TrackCentral,DET->PT_TRACK_TAU,JET.Eta(),JET.Phi()) == 1 ) && 518 ( JET.Pt() > DET->TAUJET_pt) 519 ) { 520 elementTauJet = (TRootTauJet*) branchTauJet->NewEntry(); 521 elementTauJet->Set(JET); 522 } // if tau jet 523 } // if JET.eta < tracker - tau_cone : Tau jet identification 524 525 if(JET.Pt() > DET->JET_pt) 526 { 527 elementJet = (TRootJet*) branchJet->NewEntry(); 528 elementJet->Set(JET); 529 // b-jets 530 bool btag=false; 531 if((fabs(JET.Eta()) < DET->MAX_TRACKER && DET->Btaggedjet(JET, NFCentralQ)))btag=true; 532 elementJet->Btag = btag; 533 } 534 } // for itJet : loop on all jets 535 344 sorted_jets=JETRUN->RunJets(input_particles); 345 JETRUN->RunJetBtagging(treeWriter, branchJet,sorted_jets,NFCentralQ); 346 JETRUN->RunTauJets(treeWriter,branchTauJet,sorted_jets,towers, TrackCentral); 347 348 536 349 treeWriter->Fill(); 350 537 351 // Add here the trigger 538 352 // Should test all the trigger table on the event, based on reconstructed objects 353 354 // Trigger *TRIG = new Trigger(); 355 // TRIG->TriggerReader("data/trigger.dat"); 356 539 357 } // Loop over all events 358 540 359 treeWriter->Write(); 541 360
Note:
See TracChangeset
for help on using the changeset viewer.