Changes between Version 24 and Version 25 of WorkBook/LibraryInterface
- Timestamp:
- Nov 13, 2012, 5:36:14 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WorkBook/LibraryInterface
v24 v25 9 9 setup ROOT environment variables 10 10 11 wget --no-check-certificate https:// server06.fynu.ucl.ac.be/projects/delphes/raw-attachment/wiki/LibraryInterface/ModularDelphes.tar.gz11 wget --no-check-certificate https://cp3.irmp.ucl.ac.be/projects/delphes/raw-attachment/wiki/LibraryInterface/ModularDelphes.tar.gz 12 12 tar -zxf ModularDelphes.tar.gz 13 13 … … 44 44 45 45 #include "TObjArray.h" 46 #include "TDatabasePDG.h" 47 #include "TParticlePDG.h" 46 48 #include "TLorentzVector.h" 47 49 48 #include " ExRootAnalysis/ExRootFactory.h"49 #include " ExRootAnalysis/ExRootAnalysis.h"50 #include " ExRootAnalysis/ExRootCandidate.h"50 #include "modules/Delphes.h" 51 #include "classes/DelphesClasses.h" 52 #include "classes/DelphesFactory.h" 51 53 52 54 using namespace std; 53 55 54 void ConvertInput( ExRootFactory *factory, TObjArray *particleOutputArray, TObjArray *partonOutputArray);56 void ConvertInput(DelphesFactory *factory, TObjArray *particleOutputArray, TObjArray *candidateOutputArray, TObjArray *partonOutputArray); 55 57 56 void ConvertOutput( ExRootAnalysis *modularDelphes);58 void ConvertOutput(Delphes *modularDelphes); 57 59 58 60 bool ReadEvent() { return true; } … … 64 66 // Declaration of variables 65 67 ExRootConfReader *confReader; 66 ExRootAnalysis *modularDelphes;67 ExRootFactory *factory;68 Delphes *modularDelphes; 69 DelphesFactory *factory; 68 70 TObjArray *particleOutputArray; 71 TObjArray *candidateOutputArray; 69 72 TObjArray *partonOutputArray; 70 73 … … 82 85 confReader->ReadFile("etc/delphes_card_CMS.tcl"); 83 86 84 modularDelphes = new ExRootAnalysis("Delphes");87 modularDelphes = new Delphes("Delphes"); 85 88 modularDelphes->SetConfReader(confReader); 86 89 87 90 factory = modularDelphes->GetFactory(); 91 88 92 particleOutputArray = modularDelphes->ExportArray("particles"); 93 candidateOutputArray = modularDelphes->ExportArray("candidates"); 89 94 partonOutputArray = modularDelphes->ExportArray("partons"); 90 95 … … 95 100 { 96 101 modularDelphes->Clear(); 97 ConvertInput(factory, particleOutputArray, partonOutputArray);102 ConvertInput(factory, particleOutputArray, candidateOutputArray, partonOutputArray); 98 103 modularDelphes->ProcessTask(); 99 104 ConvertOutput(modularDelphes); … … 113 118 } 114 119 115 void ConvertInput( ExRootFactory *factory, TObjArray *particleOutputArray, TObjArray *partonOutputArray)120 void ConvertInput(DelphesFactory *factory, TObjArray *particleOutputArray, TObjArray *candidateOutputArray, TObjArray *partonOutputArray) 116 121 { 117 ExRootCandidate *candidate; 118 TLorentzVector candidateMomentum, candidatePosition; 122 Candidate *candidate; 123 TDatabasePDG *pdg; 124 TParticlePDG *pdgParticle; 119 125 Int_t pid, status; 120 Double_t px, py, pz, e , m;126 Double_t px, py, pz, e; 121 127 Double_t x, y, z, t; 122 128 129 pdg = TDatabasePDG::Instance() 130 123 131 while(ReadParticle()) 124 132 { … … 127 135 candidate = factory->NewCandidate(); 128 136 129 candidate-> SetType(pid);137 candidate->PID = pid; 130 138 131 candidateMomentum.SetPxPyPzE(px, py, pz, e); 132 candidate->SetMomentum(candidateMomentum); 139 candidate->Status = status; 133 140 134 candidatePosition.SetXYZT(x, y, z, t); 135 candidate->SetPosition(candidatePosition); 141 142 pdgParticle = pdg->GetParticle(fPID); 143 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; 144 candidate->Mass = pdgParticle ? pdgParticle->Mass() : -999.9; 145 146 candidate->Momentum.SetPxPyPzE(px, py, pz, e); 147 148 candidate->Position.SetXYZT(x, y, z, t); 149 150 particleOutputArray->Add(candidate); 151 152 if(!pdgParticle) return; 136 153 137 154 if(status == 1) 138 155 { 139 particleOutputArray->Add(candidate);156 candidateOutputArray->Add(candidate); 140 157 } 141 158 else if(status == 2) … … 147 164 } 148 165 149 void ConvertOutput( ExRootAnalysis *modularDelphes)166 void ConvertOutput(Delphes *modularDelphes) 150 167 { 151 168 const TObjArray *arrayJets = modularDelphes->ImportArray("FastJetFinder/jets"); 152 169 TIter iteratorJets(arrayJets); 153 ExRootCandidate *candidate;170 Candidate *candidate; 154 171 155 172 iteratorJets.Reset(); 156 while((candidate = static_cast< ExRootCandidate*>(iteratorJets.Next())))173 while((candidate = static_cast<Candidate*>(iteratorJets.Next()))) 157 174 { 158 175 const TLorentzVector &momentum = candidate->GetMomentum();