Changeset 94 in svn for trunk/Delphes.cpp
- Timestamp:
- Dec 12, 2008, 5:32:29 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Delphes.cpp
r80 r94 29 29 #include "interface/VeryForward.h" 30 30 #include "interface/JetUtils.h" 31 #include "interface/FrogUtil.h" 31 32 32 33 #include <vector> … … 40 41 cout << "** TODO list ..." << endl; 41 42 while(infile.good()) { 42 43 44 43 string temp; 44 getline(infile,temp); 45 cout << "*" << temp << endl; 45 46 } 46 47 cout << "** done...\n"; … … 55 56 char *appargv[] = {appName, "-b"}; 56 57 TApplication app(appName, &appargc, appargv); 57 58 58 59 if(argc != 4 && argc != 3 && argc != 5) { 59 60 61 62 63 64 60 cout << " Usage: " << argv[0] << " input_file output_file [detector_card] [trigger_card] " << endl; 61 cout << " input_list - list of files in Ntpl, StdHep of LHEF format," << endl; 62 cout << " output_file - output file." << endl; 63 cout << " detector_card - Datacard containing resolution variables for the detector simulation (optional) "<<endl; 64 cout << " trigger_card - Datacard containing the trigger algorithms (optional) "<<endl; 65 exit(1); 65 66 } 66 67 67 68 srand (time (NULL)); /* Initialisation du générateur */ 68 69 … … 70 71 string inputFileList(argv[1]), outputfilename(argv[2]); 71 72 if(outputfilename.find(".root") > outputfilename.length() ) { 72 73 73 cout << "output_file should be a .root file!\n"; 74 exit(1); 74 75 } 75 76 //create output log-file name … … 77 78 string LogName = forLog.erase(forLog.find(".root")); 78 79 LogName = LogName+"_run.log"; 79 80 80 81 TFile *outputFile = TFile::Open(outputfilename.c_str(), "RECREATE"); // Creates the file, but should be closed just after 81 82 outputFile->Close(); 82 83 83 84 string line; 84 85 ifstream infile(inputFileList.c_str()); 85 86 infile >> line; // the first line determines the type of input files 86 87 87 88 //read the datacard input file 88 89 string DetDatacard(""); 89 if(argc ==4) DetDatacard =argv[3];90 90 if(argc>=4) DetDatacard =argv[3]; 91 91 92 //Smearing information 92 93 RESOLution *DET = new RESOLution(); 93 94 DET->ReadDataCard(DetDatacard); 94 95 DET->Logfile(LogName); 95 96 96 97 //read the trigger input file 97 98 string TrigDatacard("data/trigger.dat"); 98 99 if(argc==5) TrigDatacard =argv[4]; 99 100 100 101 //Trigger information 101 102 TriggerTable *TRIGT = new TriggerTable(); 102 103 TRIGT->TriggerCardReader(TrigDatacard.c_str()); 103 104 TRIGT->PrintTriggerTable(LogName); 104 105 105 106 //Propagation of tracks in the B field 106 107 TrackPropagation *TRACP = new TrackPropagation(); 107 108 108 109 //Jet information 109 110 JetsUtil *JETRUN = new JetsUtil(); 110 111 111 112 //VFD information 112 113 VeryForward * VFD = new VeryForward(); 113 114 114 115 //todo(LogName.c_str()); 115 116 116 117 DataConverter *converter=0; 117 118 118 119 if(strstr(line.c_str(),".hep")) 119 120 { … … 174 175 TLorentzVector genMomentumCalo(0,0,0,0); 175 176 LorentzVector jetMomentum; 176 177 177 178 vector<fastjet::PseudoJet> input_particles;//for FastJet algorithm 178 179 vector<fastjet::PseudoJet> sorted_jets; 179 180 180 181 vector<TLorentzVector> TrackCentral; 181 182 vector<PhysicsTower> towers; … … 186 187 TSimpleArray<TRootGenParticle> NFCentralQ; 187 188 188 189 189 190 190 191 // Loop over all events 191 192 Long64_t entry, allEntries = treeReader->GetEntries(); … … 212 213 { 213 214 int pid = abs(particle->PID); 214 215 //// This subarray is needed for the B-jet algorithm 215 216 // optimization for speed : put first PID condition, then ETA condition, then either pt or status 216 217 if( (pid <= pB || pid == pGLUON) &&// is it a light quark or a gluon, i.e. is it one of these : u,d,c,s,b,g ? 217 fabs(particle->Eta) < DET-> MAX_TRACKER&&218 fabs(particle->Eta) < DET->CEN_max_tracker && 218 219 particle->Status != 1 && 219 220 particle->PT > DET->PT_QUARKS_MIN ) { 220 221 NFCentralQ.Add(particle); 221 222 } 222 223 223 224 // keeps only final particles, visible by the central detector, including the fiducial volume 224 225 // the ordering of conditions have been optimised for speed : put first the STATUS condition … … 227 228 if( (particle->Status == 1) && 228 229 ((pid != pNU1) && (pid != pNU2) && (pid != pNU3)) && 229 (fabs(particle->Eta) < DET-> MAX_CALO_FWD)230 )230 (fabs(particle->Eta) < DET->CEN_max_calo_fwd) 231 ) 231 232 { 232 genMomentum.SetPxPyPzE(particle->Px, particle->Py, particle->Pz, particle->E); 233 TRACP->Propagation(particle,genMomentum); 234 float eta=fabs(genMomentum.Eta()); 235 236 switch(pid) { 233 genMomentum.SetPxPyPzE(particle->Px, particle->Py, particle->Pz, particle->E); 234 if(DET->FLAG_bfield==1)TRACP->Propagation(particle,genMomentum); 235 float eta=fabs(genMomentum.Eta()); 237 236 238 case pE: // all electrons with eta < DET->MAX_CALO_FWD 239 DET->SmearElectron(genMomentum); 240 if(genMomentum.E()!=0 && eta < DET->MAX_TRACKER && genMomentum.Pt() > DET->ELEC_pt){ 241 electron.push_back(ParticleUtil(genMomentum,particle->PID)); 242 } 243 break; // case pE 244 case pGAMMA: // all photons with eta < DET->MAX_CALO_FWD 245 DET->SmearElectron(genMomentum); 246 if(genMomentum.E()!=0 && eta < DET->MAX_TRACKER && genMomentum.Pt() > DET->GAMMA_pt) { 247 gamma.push_back(ParticleUtil(genMomentum,particle->PID)); 237 switch(pid) { 238 239 case pE: // all electrons with eta < DET->MAX_CALO_FWD 240 DET->SmearElectron(genMomentum); 241 if(genMomentum.E()!=0 && eta < DET->CEN_max_tracker && genMomentum.Pt() > DET->PTCUT_elec){ 242 electron.push_back(ParticleUtil(genMomentum,particle->PID)); 243 } 244 break; // case pE 245 case pGAMMA: // all photons with eta < DET->MAX_CALO_FWD 246 DET->SmearElectron(genMomentum); 247 if(genMomentum.E()!=0 && eta < DET->CEN_max_tracker && genMomentum.Pt() > DET->PTCUT_gamma) { 248 gamma.push_back(ParticleUtil(genMomentum,particle->PID)); 249 } 250 break; // case pGAMMA 251 case pMU: // all muons with eta < DET->MAX_MU 252 DET->SmearMu(genMomentum); 253 if(genMomentum.E()!=0 && eta < DET->CEN_max_mu && genMomentum.Pt() > DET->PTCUT_muon){ 254 muon.push_back(ParticleUtil(genMomentum,particle->PID)); 255 } 256 break; // case pMU 257 case pLAMBDA: // all lambdas with eta < DET->MAX_CALO_FWD 258 case pK0S: // all K0s with eta < DET->MAX_CALO_FWD 259 DET->SmearHadron(genMomentum, 0.7); 260 break; // case hadron 261 default: // all other final particles with eta < DET->MAX_CALO_FWD 262 DET->SmearHadron(genMomentum, 1.0); 263 break; 264 } // switch (pid) 265 266 // all final particles but muons and neutrinos 267 // for calorimetric towers and mission PT 268 int charge=Charge(pid); 269 if(genMomentum.E() !=0 && pid != pMU) { 270 if(charge == 0 || (charge !=0 && genMomentum.Pt() >= DET->TRACK_ptmin)){ 271 PhysicsTower CaloTower = PhysicsTower(LorentzVector(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E())); 272 towers.push_back(CaloTower); 273 // create a fastjet::PseudoJet with these components and put it onto 274 // back of the input_particles vector 275 input_particles.push_back(fastjet::PseudoJet(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E())); 276 277 genMomentumCalo.SetPxPyPzE(CaloTower.fourVector.px,CaloTower.fourVector.py,CaloTower.fourVector.pz,CaloTower.fourVector.E); 278 279 elementCalo = (TRootCalo*) branchCalo->NewEntry(); 280 elementCalo->Set(genMomentumCalo); 281 DET->BinEtaPhi(genMomentumCalo.Phi(), genMomentumCalo.Eta(), elementCalo->Phi, elementCalo->Eta); 282 } 248 283 } 249 break; // case pGAMMA 250 case pMU: // all muons with eta < DET->MAX_MU 251 DET->SmearMu(genMomentum); 252 if(genMomentum.E()!=0 && eta < DET->MAX_MU && genMomentum.Pt() > DET->MUON_pt){ 253 muon.push_back(ParticleUtil(genMomentum,particle->PID)); 254 } 255 break; // case pMU 256 case pLAMBDA: // all lambdas with eta < DET->MAX_CALO_FWD 257 case pK0S: // all K0s with eta < DET->MAX_CALO_FWD 258 DET->SmearHadron(genMomentum, 0.7); 259 break; // case hadron 260 default: // all other final particles with eta < DET->MAX_CALO_FWD 261 DET->SmearHadron(genMomentum, 1.0); 262 break; 263 } // switch (pid) 264 265 // all final particles but muons and neutrinos 266 // for calorimetric towers and mission PT 267 int charge=Charge(pid); 268 if(genMomentum.E() !=0 && pid != pMU) { 269 if(charge == 0 || (charge !=0 && genMomentum.Pt() >= DET->PT_TRACKS_MIN)){ 270 PhysicsTower CaloTower = PhysicsTower(LorentzVector(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E())); 271 towers.push_back(CaloTower); 272 // create a fastjet::PseudoJet with these components and put it onto 273 // back of the input_particles vector 274 input_particles.push_back(fastjet::PseudoJet(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E())); 275 276 genMomentumCalo.SetPxPyPzE(CaloTower.fourVector.px,CaloTower.fourVector.py,CaloTower.fourVector.pz,CaloTower.fourVector.E); 277 278 elementCalo = (TRootCalo*) branchCalo->NewEntry(); 279 elementCalo->Set(genMomentumCalo); 280 DET->BinEtaPhi(genMomentumCalo.Phi(), genMomentumCalo.Eta(), elementCalo->Phi, elementCalo->Eta); 281 } 282 } 283 284 // all final charged particles 285 if( 286 (genMomentum.E()!=0) && 287 (fabs(genMomentum.Eta()) < DET->MAX_TRACKER) && 288 (genMomentum.Pt() > DET->PT_TRACKS_MIN ) && // pt too small to be taken into account 289 ((rand()%100) < DET->TRACKING_EFF) && 290 (charge!=0) 291 ) 292 { 293 elementTracks = (TRootTracks*) branchTracks->NewEntry(); 294 elementTracks->Set(genMomentum); 295 TrackCentral.push_back(genMomentum); 296 } 297 284 285 // all final charged particles 286 if( 287 (genMomentum.E()!=0) && 288 (fabs(genMomentum.Eta()) < DET->CEN_max_tracker) && 289 (genMomentum.Pt() > DET->TRACK_ptmin ) && // pt too small to be taken into account 290 ((rand()%100) < DET->TRACK_eff) && 291 (charge!=0) 292 ) 293 { 294 elementTracks = (TRootTracks*) branchTracks->NewEntry(); 295 elementTracks->Set(genMomentum); 296 TrackCentral.push_back(genMomentum); 297 } 298 298 299 } // switch 299 300 300 VFD->ZDC(treeWriter,branchZDC,particle); 301 VFD->RomanPots(treeWriter,branchRP220,branchFP420,particle); 301 if(DET->FLAG_vfd==1) 302 { 303 VFD->ZDC(treeWriter,branchZDC,particle); 304 VFD->RomanPots(treeWriter,branchRP220,branchFP420,particle); 305 } 302 306 303 307 } // while … … 350 354 treeWriter->Write(); 351 355 delete treeWriter; 352 356 353 357 //running the trigger in case the FLAG trigger is put to 1 in the datacard 354 355 if(DET-> DOTRIGGER== 1)358 359 if(DET->FLAG_trigger == 1) 356 360 { 357 361 TChain chainT("Analysis"); … … 378 382 treeWriterT->Fill(); 379 383 } 380 384 381 385 treeWriterT->Write(); 382 386 delete treeWriterT; 383 387 } 384 388 389 //FROG display 390 if(DET->FLAG_frog == 1) 391 { 392 FrogDisplay *FROG = new FrogDisplay(); 393 FROG->BuidEvents(outputfilename,DET->NEvents_Frog); 394 FROG->BuildGeom(); 395 } 396 385 397 cout << "** Exiting..." << endl; 386 398 … … 391 403 delete JETRUN; 392 404 delete VFD; 393 405 394 406 if(converter) delete converter; 395 407 396 408 todo("TODO"); 397 409 }
Note:
See TracChangeset
for help on using the changeset viewer.