Fork me on GitHub

Changeset 14ae668 in git


Ignore:
Timestamp:
Dec 12, 2014, 1:54:46 PM (10 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
3d10d1f
Parents:
a8782e8
Message:

added comments in ExternalFast

Location:
examples
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • examples/ExternalFastJetBasic.cpp

    ra8782e8 r14ae668  
    1919/*
    2020
    21 First, you need to set DELPHES_DIR, FASTJET_DIR and ROOT_DIR:
     21
     22########################################################################
     23
     24
     25This simple example shows how to use Delphes with an external fastjet installation.
     26Events are specified via the multidimentionnal array "EVENTS" (for an example reading
     27an hepmc file see ExternalFastJetHepMC.cpp).
     28
     29In order to run this example you first, you need to set the paths to your Delphes, FastJet
     30and ROOT installations (DELPHES_DIR, FASTJET_DIR and ROOT_DIR):
    2231
    2332DELPHES_DIR=<path to Delphes installation>
     
    2534ROOT_DIR=<path to ROOT installation>
    2635
    27 Then run the following commands to build ExternalFastJetBasic:
     36Then run the following commands to build the executable:
    2837
    2938DELPHES_LIB="-L$DELPHES_DIR -lDelphesNoFastJet"
     
    3847LDFLAGS="$FASTJET_LIB $ROOT_LIB $DELPHES_LIB"
    3948
    40 g++ $CXXFLAGS $LDFLAGS ExternalFastJetBasic.cpp -o ExternalFastJetBasic
     49g++ $CXXFLAGS $LDFLAGS examples/ExternalFastJetBasic.cpp -o examples/ExternalFastJetBasic
     50
     51Then run from the main Delphes dir:
     52
     53./examples/ExternalFastJetBasic cards/delphes_card_CMS_NoFastJet.tcl
     54
     55
     56########################################################################
     57
    4158
    4259*/
     
    95112//---------------------------------------------------------------------------
    96113
     114
     115// this function converts input event array into Delphes candidates (defined below)
     116
    97117void ConvertInput(Int_t event, DelphesFactory *factory, TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray);
     118
     119
     120//----------------------------------------------------------------------------------------------------------------------------
    98121
    99122int main(int argc, char *argv[])
     
    149172    modularDelphes->InitTask();
    150173
     174   
     175    // fastjet definition
    151176    ClusterSequence::print_banner();
    152177    definition = new JetDefinition(antikt_algorithm, 0.5);
    153 
    154     inputArray = modularDelphes->ImportArray("Calorimeter/towers");
     178   
     179    // Define your input candidates to fastjet (by default particle-flow objects).
     180    // If you want pure calorimeter towers change "EFlowMerger/eflow" into "Calorimeter/towers":
     181     
     182    inputArray = modularDelphes->ImportArray("EFlowMerger/eflow");
     183     
    155184    inputIterator = inputArray->MakeIterator();
    156185
     
    159188    {
    160189      modularDelphes->Clear();
     190     
     191      // convert EVENT input array into Delphes internal format
    161192      ConvertInput(event, factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray);
     193     
     194      // run Delphes reconstruction
    162195      modularDelphes->ProcessTask();
    163196
    164197      inputList.clear();
    165198      inputIterator->Reset();
     199     
     200     
     201      // pass delphes candidates to fastjet clustering 
    166202      while((candidate = static_cast<Candidate*>(inputIterator->Next())))
    167203      {
     
    170206        inputList.push_back(jet);
    171207      }
     208     
     209      // run clustering
    172210      ClusterSequence sequence(inputList, *definition);
    173211      outputList.clear();
     
    204242  }
    205243}
     244
     245
     246// ------------------------------------------------------------------------------------------------------------------------------------
    206247
    207248void ConvertInput(Int_t event, DelphesFactory *factory, TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray)
  • examples/ExternalFastJetHepMC.cpp

    ra8782e8 r14ae668  
    1818
    1919/*
    20 
    21 First, you need to set DELPHES_DIR, FASTJET_DIR and ROOT_DIR:
     20########################################################################
     21
     22
     23This simple example shows how to use Delphes with an external fastjet installation.
     24Events in hepmc format are read via the DelphesHepMC reader.
     25
     26In order to run this example you first, you need to set the paths to your Delphes, FastJet
     27and ROOT installations (DELPHES_DIR, FASTJET_DIR and ROOT_DIR):
    2228
    2329DELPHES_DIR=<path to Delphes installation>
     
    2531ROOT_DIR=<path to ROOT installation>
    2632
    27 Then run the following commands to build ExternalFastJetHepMC:
     33Then run the following commands to build the executable:
    2834
    2935DELPHES_LIB="-L$DELPHES_DIR -lDelphesNoFastJet"
     
    3844LDFLAGS="$FASTJET_LIB $ROOT_LIB $DELPHES_LIB"
    3945
    40 g++ $CXXFLAGS $LDFLAGS ExternalFastJetHepMC.cpp -o ExternalFastJetHepMC
     46g++ $CXXFLAGS $LDFLAGS examples/ExternalFastJetHepMC.cpp -o examples/ExternalFastJetHepMC
     47
     48Then 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########################################################################
    4154
    4255*/
     
    163176
    164177    ClusterSequence::print_banner();
     178
    165179//    recomb = new WinnerTakeAllRecombiner();
    166180//    definition = new JetDefinition(antikt_algorithm, 0.5, recomb, Best);
     181 
    167182    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
    170190    inputIterator = inputArray->MakeIterator();
     191
     192
     193    // start reading hepmc file
    171194
    172195    i = 2;
     
    204227      }
    205228
     229     
    206230      reader->SetInputFile(inputFile);
    207231
     
    214238        stableParticleOutputArray, partonOutputArray) && !interrupted)
    215239      {
    216         if(reader->EventReady())
     240       
     241         // loop over events
     242        if(reader->EventReady())
    217243        {
    218244          ++eventCounter;
     
    220246          if(eventCounter > skipEvents)
    221247          {
    222             modularDelphes->ProcessTask();
     248           
     249            // run delphes reconstruction
     250            modularDelphes->ProcessTask();
    223251           
    224252            inputList.clear();
    225253            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())))
    227258            {
    228259              momentum = candidate->Momentum;
     
    230261              inputList.push_back(jet);
    231262            }
    232             ClusterSequence sequence(inputList, *definition);
     263           
     264            // run fastjet clustering
     265            ClusterSequence sequence(inputList, *definition);
    233266            outputList.clear();
    234267            outputList = sorted_by_pt(sequence.inclusive_jets(0.0));
    235268
    236             // tell the user what was done
     269           
     270            // Prints for the first event:
    237271            //  - the description of the algorithm used
    238272            //  - show the inclusive jets as
    239273            //      {index, rapidity, phi, pt}
    240274            //----------------------------------------------------------
    241             if(eventCounter == skipEvents + 1)
     275           
     276            if(eventCounter == skipEvents + 1)
    242277            {
    243278              cout << "Ran " << definition->description() << endl;
     
    258293          reader->Clear();
    259294        }
    260       }
     295      } // end of event loop
    261296
    262297      if(inputFile != stdin) fclose(inputFile);
Note: See TracChangeset for help on using the changeset viewer.