Changeset 14ae668 in git for examples/ExternalFastJetHepMC.cpp
- Timestamp:
- Dec 12, 2014, 1:54:46 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 3d10d1f
- Parents:
- a8782e8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/ExternalFastJetHepMC.cpp
ra8782e8 r14ae668 18 18 19 19 /* 20 21 First, you need to set DELPHES_DIR, FASTJET_DIR and ROOT_DIR: 20 ######################################################################## 21 22 23 This simple example shows how to use Delphes with an external fastjet installation. 24 Events in hepmc format are read via the DelphesHepMC reader. 25 26 In order to run this example you first, you need to set the paths to your Delphes, FastJet 27 and ROOT installations (DELPHES_DIR, FASTJET_DIR and ROOT_DIR): 22 28 23 29 DELPHES_DIR=<path to Delphes installation> … … 25 31 ROOT_DIR=<path to ROOT installation> 26 32 27 Then run the following commands to build ExternalFastJetHepMC:33 Then run the following commands to build the executable: 28 34 29 35 DELPHES_LIB="-L$DELPHES_DIR -lDelphesNoFastJet" … … 38 44 LDFLAGS="$FASTJET_LIB $ROOT_LIB $DELPHES_LIB" 39 45 40 g++ $CXXFLAGS $LDFLAGS ExternalFastJetHepMC.cpp -o ExternalFastJetHepMC 46 g++ $CXXFLAGS $LDFLAGS examples/ExternalFastJetHepMC.cpp -o examples/ExternalFastJetHepMC 47 48 Then run from the main Delphes dir (you need an event file in hepmc format): 49 50 ./examples/ExternalFastJetHepMC cards/delphes_card_CMS_NoFastJet.tcl file.hepmc 51 52 53 ######################################################################## 41 54 42 55 */ … … 163 176 164 177 ClusterSequence::print_banner(); 178 165 179 // recomb = new WinnerTakeAllRecombiner(); 166 180 // definition = new JetDefinition(antikt_algorithm, 0.5, recomb, Best); 181 167 182 definition = new JetDefinition(antikt_algorithm, 0.5); 168 169 inputArray = modularDelphes->ImportArray("Calorimeter/towers"); 183 184 185 // Define your input candidates to fastjet (by default particle-flow objects). 186 // If you want pure calorimeter towers change "EFlowMerger/eflow" into "Calorimeter/towers": 187 188 inputArray = modularDelphes->ImportArray("EFlowMerger/eflow"); 189 170 190 inputIterator = inputArray->MakeIterator(); 191 192 193 // start reading hepmc file 171 194 172 195 i = 2; … … 204 227 } 205 228 229 206 230 reader->SetInputFile(inputFile); 207 231 … … 214 238 stableParticleOutputArray, partonOutputArray) && !interrupted) 215 239 { 216 if(reader->EventReady()) 240 241 // loop over events 242 if(reader->EventReady()) 217 243 { 218 244 ++eventCounter; … … 220 246 if(eventCounter > skipEvents) 221 247 { 222 modularDelphes->ProcessTask(); 248 249 // run delphes reconstruction 250 modularDelphes->ProcessTask(); 223 251 224 252 inputList.clear(); 225 253 inputIterator->Reset(); 226 while((candidate = static_cast<Candidate*>(inputIterator->Next()))) 254 255 256 // pass delphes candidates to fastjet clustering 257 while((candidate = static_cast<Candidate*>(inputIterator->Next()))) 227 258 { 228 259 momentum = candidate->Momentum; … … 230 261 inputList.push_back(jet); 231 262 } 232 ClusterSequence sequence(inputList, *definition); 263 264 // run fastjet clustering 265 ClusterSequence sequence(inputList, *definition); 233 266 outputList.clear(); 234 267 outputList = sorted_by_pt(sequence.inclusive_jets(0.0)); 235 268 236 // tell the user what was done 269 270 // Prints for the first event: 237 271 // - the description of the algorithm used 238 272 // - show the inclusive jets as 239 273 // {index, rapidity, phi, pt} 240 274 //---------------------------------------------------------- 241 if(eventCounter == skipEvents + 1) 275 276 if(eventCounter == skipEvents + 1) 242 277 { 243 278 cout << "Ran " << definition->description() << endl; … … 258 293 reader->Clear(); 259 294 } 260 } 295 } // end of event loop 261 296 262 297 if(inputFile != stdin) fclose(inputFile);
Note:
See TracChangeset
for help on using the changeset viewer.