CMS 3D CMS Logo

FastJetFWLiteWrapper Class Reference

FastJetFWLiteWrapper is the Wrapper subclass which runs the FastJetAlgorithm for jetfinding. More...

#include <RecoParticleFlow/PFRootEvent/interface/FastJetFWLiteWrapper.h>

List of all members.

Public Member Functions

 FastJetFWLiteWrapper ()
double getPtMin ()
double getRParam ()
void run (const JetReco::InputCollection &fInput, JetReco::OutputCollection *fOutput)
void setPtMin (double aPtMin)
void setRParam (double aRparam)
 ~FastJetFWLiteWrapper ()

Private Attributes

fastjet::ActiveAreaSpec * mActiveArea
fastjet::JetDefinition * mJetDefinition
int theActive_Area_Repeats_
double theDcut_
bool theDoSubtraction_
double theGhost_EtaMax_
double theGhostArea_
double theMedian_Pt_Per_Area_
int theMode_
int theNjets_
double thePtMin_
double theRparam_


Detailed Description

FastJetFWLiteWrapper is the Wrapper subclass which runs the FastJetAlgorithm for jetfinding.

The FastJet package, written by Matteo Cacciari and Gavin Salam, provides a fast implementation of the longitudinally invariant kt and longitudinally invariant inclusive Cambridge/Aachen jet finders. More information can be found at: https://parthe.lpthe.jussieu.fr/~salam/fastjet/

Authors:
Andreas Oehler, University Karlsruhe (TH) and Dorian Kcira, Institut de Physique Nucleaire Departement de Physique Universite Catholique de Louvain have written the FastJetFWLiteWrapper class which uses the above mentioned package within the Framework of CMSSW
Version:
1st Version Nov. 6 2006

Definition at line 45 of file FastJetFWLiteWrapper.h.


Constructor & Destructor Documentation

FastJetFWLiteWrapper::FastJetFWLiteWrapper (  ) 

Definition at line 38 of file FastJetFWLiteWrapper.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), mActiveArea, theActive_Area_Repeats_, theDcut_, theDoSubtraction_, theGhost_EtaMax_, theGhostArea_, theMode_, theNjets_, thePtMin_, and theRparam_.

00039   : mJetDefinition (0), 
00040     mActiveArea (0)
00041 {
00042 
00043   //default ktRParam should be 1
00044   theRparam_=1;
00045   //default PtMin should be 10
00046   thePtMin_=10.;
00047   //default JetFinder should be "kt_algorithm"
00048   string JetFinder="kt_algorithm";; 
00049   //default Strategy should be "Best" 
00050   string Strategy="Best";
00051   //default dcut should be -1 (off)
00052   theDcut_=-1.;
00053   //default njets should be -1 (off)
00054   theNjets_=-1;  
00055   //default UE_Subtraction should be false (off)
00056   theDoSubtraction_=false; 
00057   //default Ghost_EtaMax should be 6
00058   theGhost_EtaMax_=6;
00059   //default Active_Area_Repeats 5
00060   theActive_Area_Repeats_=5;
00061   //default GhostArea 0.01  
00062   theGhostArea_=0.01;
00063   mActiveArea = new fastjet::ActiveAreaSpec ( theGhost_EtaMax_, theActive_Area_Repeats_ , theGhostArea_);       
00064 
00065   
00066   //configuring algorithm 
00067   
00068   
00069   fastjet::JetFinder jet_finder;
00070   if (JetFinder=="cambridge_algorithm") jet_finder=fastjet::cambridge_algorithm;
00071   else jet_finder=fastjet::kt_algorithm;
00072         
00073   //choosing search-strategy:
00074         
00075   fastjet::Strategy strategy;
00076   if (Strategy=="N2Plain") strategy=fastjet::N2Plain;
00077   // N2Plain is best for N<50
00078   else if (Strategy=="N2Tiled") strategy=fastjet::N2Tiled;
00079   // N2Tiled is best for 50<N<400
00080   else if (Strategy=="N2MinHeapTiled") strategy=fastjet::N2MinHeapTiled;
00081   // N2MinHeapTiles is best for 400<N<15000
00082   else if (Strategy=="NlnN") strategy=fastjet::NlnN;
00083   // NlnN is best for N>15000
00084   else if (Strategy=="NlnNCam") strategy=fastjet::NlnNCam;
00085   // NlnNCam is best for N>6000
00086   else strategy=fastjet::Best;
00087   // Chooses best Strategy for every event, depending on N and ktRParam
00088         
00089   //additional strategies are possible, but not documented in the manual as they are experimental,
00090   //they are also not used by the "Best" method. Note: "NlnNCam" only works with 
00091   //the cambridge_algorithm and does not link against CGAL, "NlnN" is only 
00092   //available if fastjet is linked against CGAL.
00093   //The above given numbers of N are for ktRaram=1.0, for other ktRParam the numbers would be 
00094   //different.
00095   
00096   theMode_=0;
00097   if ((theNjets_!=-1)&&(theDcut_==-1)){
00098     theMode_=3;
00099   }
00100   else if ((theNjets_==-1)&&(theDcut_!=-1)){
00101     theMode_=2;
00102   }
00103   else if ((theNjets_!=-1)&&(theDcut_!=-1)){
00104     cout  <<"[FastJetWrapper] `njets` and `dcut` set!=-1! - running inclusive Mode"<<endl;
00105     theMode_=1;
00106   }
00107   else {
00108     theMode_=0;     
00109   }
00110         
00111   // theJetConfig_->theJetDef=fastjet::JetDefinition(jet_finder, theRparam_, strategy);
00112   cout <<"*******************************************"<<endl;
00113   cout <<"* Configuration of FastJet                "<<endl;
00114   if (theDoSubtraction_) cout <<"* running with ActiveAreaSubtraction(median)"<<endl;
00115   switch (theMode_){
00116   case 0:
00117     cout <<"* Mode     : inclusive"<<endl;
00118     cout <<"* PtMin    : "<<thePtMin_<<endl;
00119     break;
00120   case 1:
00121     cout <<"* [WARNING] Mode     : inclusive - dcut and njets set!"<<endl;
00122     cout <<"* PtMin    : "<<thePtMin_<<endl;
00123     break;
00124   case 2:    
00125     cout <<"* Mode     : exclusive"<<endl;
00126     cout <<"* dcut     : "<<theDcut_<<endl;
00127     break;
00128   case 3:
00129     cout <<"* Mode     : exclusive"<<endl;
00130     cout <<"* njets    : "<<theNjets_<<endl;
00131     break;
00132   }
00133   cout <<"* Rparam   : "<<theRparam_<<endl;
00134   cout <<"* JetFinder: "<<JetFinder<<endl;
00135   cout <<"* Strategy : "<<Strategy<<endl;
00136   cout <<"*******************************************"<<endl;
00137   
00138 }

FastJetFWLiteWrapper::~FastJetFWLiteWrapper (  ) 

Definition at line 33 of file FastJetFWLiteWrapper.cc.

References mActiveArea, and mJetDefinition.

00033                                            {
00034   delete mJetDefinition;
00035   delete mActiveArea;
00036 }


Member Function Documentation

double FastJetFWLiteWrapper::getPtMin (  )  [inline]

Definition at line 79 of file FastJetFWLiteWrapper.h.

References thePtMin_.

00079 {return thePtMin_ ;}

double FastJetFWLiteWrapper::getRParam (  )  [inline]

Definition at line 80 of file FastJetFWLiteWrapper.h.

References theRparam_.

00080 {return  theRparam_;} 

void FastJetFWLiteWrapper::run ( const JetReco::InputCollection fInput,
JetReco::OutputCollection fOutput 
)

Definition at line 140 of file FastJetFWLiteWrapper.cc.

References c, i, iggi_31X_cfg::input, metsig::jet, pfTauBenchmarkGeneric_cfi::jets, mJetDefinition, p4, and thePtMin_.

Referenced by FWLiteJetProducer::makeFastJets().

00140                                                                                                      {
00141   if (!fOutput) return;
00142   fOutput->clear();
00143   
00144   // convert inputs
00145   std::vector<fastjet::PseudoJet> fjInputs;
00146   fjInputs.reserve (fInput.size());
00147   
00148   JetReco::InputCollection::const_iterator input = fInput.begin();
00149   for (unsigned i = 0; i < fInput.size(); ++i) {
00150     const JetReco::InputItem& c = fInput[i];
00151     fjInputs.push_back (fastjet::PseudoJet (c->px(),c->py(),c->pz(),c->energy()));
00152     fjInputs.back().set_user_index(i);
00153   }
00154    
00155   // create an object that represents your choice of jet finder and 
00156   // the associated parameters
00157   // run the jet clustering with the above jet definition
00158 
00159   // here we need to keep both pointers, as "area" interfaces are missing in base class
00160   fastjet::ClusterSequenceActiveArea* clusterSequenceWithArea = 0;
00161   fastjet::ClusterSequenceWithArea* clusterSequence = 0;
00162   //  if (mActiveArea) {
00163   // clusterSequenceWithArea = new fastjet::ClusterSequenceActiveArea (fjInputs, *mJetDefinition, *mActiveArea);
00164   // clusterSequence = clusterSequenceWithArea;
00165   // }
00166   // else {
00167   clusterSequence = new fastjet::ClusterSequenceWithArea (fjInputs, *mJetDefinition);
00168   // }
00169   // retrieve jets for selected mode
00170   std::vector<fastjet::PseudoJet> jets = clusterSequence->inclusive_jets (thePtMin_);
00171 
00172   // get PU pt
00173   double median_Pt_Per_Area = clusterSequenceWithArea ? clusterSequenceWithArea->pt_per_unit_area() : 0.;
00174 
00175   // process found jets
00176   for (std::vector<fastjet::PseudoJet>::const_iterator jet=jets.begin(); jet!=jets.end();++jet) {
00177     // jet itself
00178     double px=jet->px();
00179     double py=jet->py();
00180     double pz=jet->pz();
00181     double E=jet->E();
00182     double jetArea=clusterSequence->area(*jet);
00183     double pu=0.;
00184     // PU subtraction
00185     if (clusterSequenceWithArea) {
00186       fastjet::PseudoJet pu_p4 = median_Pt_Per_Area * clusterSequenceWithArea->area_4vector(*jet);
00187       pu = pu_p4.E();
00188       if (pu_p4.perp2() >= jet->perp2() || pu_p4.E() >= jet->E()) { // if the correction is too large, set the jet to zero
00189         px = py = pz = E = 0.;
00190       } 
00191       else {   // otherwise do an E-scheme subtraction
00192         px -= pu_p4.px();
00193         py -= pu_p4.py();
00194         pz -= pu_p4.pz();
00195         E -= pu_p4.E();
00196       }
00197     }
00198     math::XYZTLorentzVector p4(px,py,pz,E);
00199     // constituents
00200     std::vector<fastjet::PseudoJet> fastjet_constituents = clusterSequence->constituents(*jet);
00201     JetReco::InputCollection jetConstituents; 
00202     jetConstituents.reserve (fastjet_constituents.size());
00203     for (std::vector<fastjet::PseudoJet>::const_iterator itConst=fastjet_constituents.begin();
00204          itConst!=fastjet_constituents.end();itConst++){
00205       jetConstituents.push_back(fInput[(*itConst).user_index()]);
00206     }
00207     // Build ProtoJet
00208     fOutput->push_back(ProtoJet(p4,jetConstituents));
00209     fOutput->back().setJetArea (jetArea);
00210     fOutput->back().setPileup (pu);
00211   }
00212   // cleanup
00213   if (clusterSequenceWithArea) delete clusterSequenceWithArea;
00214   else delete clusterSequence; // sigh... No plymorphism in fastjet
00215 }

void FastJetFWLiteWrapper::setPtMin ( double  aPtMin  )  [inline]

Definition at line 75 of file FastJetFWLiteWrapper.h.

References thePtMin_.

Referenced by FWLiteJetProducer::updateParameter().

00075 {thePtMin_=aPtMin;}

void FastJetFWLiteWrapper::setRParam ( double  aRparam  )  [inline]

Definition at line 76 of file FastJetFWLiteWrapper.h.

References theRparam_.

Referenced by FWLiteJetProducer::updateParameter().

00076 { theRparam_=aRparam;} 


Member Data Documentation

fastjet::ActiveAreaSpec* FastJetFWLiteWrapper::mActiveArea [private]

Definition at line 70 of file FastJetFWLiteWrapper.h.

Referenced by FastJetFWLiteWrapper(), and ~FastJetFWLiteWrapper().

fastjet::JetDefinition* FastJetFWLiteWrapper::mJetDefinition [private]

Definition at line 69 of file FastJetFWLiteWrapper.h.

Referenced by run(), and ~FastJetFWLiteWrapper().

int FastJetFWLiteWrapper::theActive_Area_Repeats_ [private]

Definition at line 65 of file FastJetFWLiteWrapper.h.

Referenced by FastJetFWLiteWrapper().

double FastJetFWLiteWrapper::theDcut_ [private]

Definition at line 60 of file FastJetFWLiteWrapper.h.

Referenced by FastJetFWLiteWrapper().

bool FastJetFWLiteWrapper::theDoSubtraction_ [private]

Definition at line 63 of file FastJetFWLiteWrapper.h.

Referenced by FastJetFWLiteWrapper().

double FastJetFWLiteWrapper::theGhost_EtaMax_ [private]

Definition at line 64 of file FastJetFWLiteWrapper.h.

Referenced by FastJetFWLiteWrapper().

double FastJetFWLiteWrapper::theGhostArea_ [private]

Definition at line 67 of file FastJetFWLiteWrapper.h.

Referenced by FastJetFWLiteWrapper().

double FastJetFWLiteWrapper::theMedian_Pt_Per_Area_ [private]

Definition at line 68 of file FastJetFWLiteWrapper.h.

int FastJetFWLiteWrapper::theMode_ [private]

Definition at line 56 of file FastJetFWLiteWrapper.h.

Referenced by FastJetFWLiteWrapper().

int FastJetFWLiteWrapper::theNjets_ [private]

Definition at line 61 of file FastJetFWLiteWrapper.h.

Referenced by FastJetFWLiteWrapper().

double FastJetFWLiteWrapper::thePtMin_ [private]

Definition at line 58 of file FastJetFWLiteWrapper.h.

Referenced by FastJetFWLiteWrapper(), getPtMin(), run(), and setPtMin().

double FastJetFWLiteWrapper::theRparam_ [private]

Definition at line 59 of file FastJetFWLiteWrapper.h.

Referenced by FastJetFWLiteWrapper(), getRParam(), and setRParam().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:42 2009 for CMSSW by  doxygen 1.5.4