Report problems to ATLAS LXR Team (with time and IP address indicated)

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: linux ]
Version: head ] [ nightly ] [ GaudiDev ]
  Links to LXR source navigation pages for stable releases [ 12.*.* ]   [ 13.*.* ]   [ 14.*.* ]   [ 15.*.* ] 

001 // ================================================
002 //        ClusterFastJetStrategy class Implementation
003 //
004 //
005 // ================================================
006 //
007 // Namespace Atlfast
008 //
009 #include "AtlfastAlgs/ClusterFastJetStrategy.h"
010 #include "AtlfastEvent/Cell.h"
011 #include "AtlfastEvent/KtCluster.h"
012 #include "AtlfastEvent/ICluster.h"
013 
014 #include "fastjet/SISConePlugin.hh"
015 #include "JetRec/YSplitter.h"
016 
017 // Gaudi includes
018 #include "GaudiKernel/MsgStream.h"
019 
020 //Other
021 #include "CLHEP/Vector/LorentzVector.h"
022 
023 namespace Atlfast {
024 
025   /**
026    * This Class builds Atlfast::KtClusters from Atlfast::Cells
027    * It uses the FastKt Algorithm as well as the SISCone Algorithm via the
028    * FastJet Interface.
029    * It stores the Atlfast::KtClusters as Atlfast::Cluster* in a std::vector.
030    * All unused cells are put in the a std::vector of Atlfast::Cells
031    *
032    * @author Jon Couchman (Original)
033    * @author Alexander Richards (FastJet update)
034    */
035 
036   ClusterFastJetStrategy::ClusterFastJetStrategy(std::string strategy, 
037                                                  double coneRadius,
038                                                  double overlapThreshold,
039                                                  double minet, 
040                                                  double rp, 
041                                                  std::string angle, 
042                                                  std::string recom, 
043                                                  int subjet) : 
044     m_minClusterET(minet), m_rParameter(rp), m_subjet(subjet), m_plugin(0), m_jetDef(0) {
045 
046     
047     if(strategy == "Kt" || strategy == "Cam" || strategy == "AntiKt"){
048       
049       //set kt angle scheme
050       if(angle == "angular") {m_angle = 1;}
051       else if (angle == "deltaR") {m_angle = 2;}
052       else if (angle == "QCD") {m_angle = 3;}
053       else{
054         std::cerr << "Warning, unknown Kt angle scheme. Scheme set to \"deltaR\"" << std::endl;
055         m_angle = 2;
056       }
057       
058       fastjet::RecombinationScheme recombScheme;
059       
060       //set kt rcombination scheme
061       if(recom == "E")         {m_recom = 1; recombScheme = fastjet::E_scheme;}
062       else if (recom == "pt")  {m_recom = 2; recombScheme = fastjet::pt_scheme;}
063       else if (recom == "pt2") {m_recom = 3; recombScheme = fastjet::pt2_scheme;}
064       else if (recom == "et")  {m_recom = 4; recombScheme = fastjet::Et_scheme;}
065       else if (recom == "et2") {m_recom = 5; recombScheme = fastjet::Et2_scheme;}
066       else{
067         std::cerr << "Warning, unknown Kt recombination scheme. Scheme set to \"E\"" << std::endl;
068         m_recom = 1;
069         recombScheme = fastjet::E_scheme;
070       }
071       
072       // What is this?
073       fastjet::Strategy ktstrategy = fastjet::Best;
074       fastjet::JetAlgorithm jetalgorithm = fastjet::kt_algorithm;
075       if ( strategy == "Cam" )     jetalgorithm = fastjet::cambridge_algorithm;
076       if ( strategy == "AntiKt" )  jetalgorithm = fastjet::antikt_algorithm;
077       
078       m_jetDef = new fastjet::JetDefinition(jetalgorithm, m_rParameter, recombScheme, ktstrategy);
079       
080     }
081     else if (strategy == "Cone"){
082       // Does this have to be a new statement?
083       m_plugin = new fastjet::SISConePlugin(coneRadius, overlapThreshold);
084       m_jetDef = new fastjet::JetDefinition(m_plugin);
085       
086     } 
087   }
088 
089   std::string ClusterFastJetStrategy::Details(const char type[], const fastjet::PseudoJet &pj)const{
090     char outputDetails[256];
091     std::string outString;
092     sprintf(outputDetails,"%10g %10g %10g %10g  %s\0",pj.px(),pj.py(),pj.pz(),pj.E(),type);
093     outString.append(outputDetails);
094     return outString;
095   }
096   std::string ClusterFastJetStrategy::Details(const char type[])const{
097     char outputDetails[256];
098     std::string outString;
099     sprintf(outputDetails,"%10s %10s %10s %10s  %s\0","px","py","pz","E",type);
100     outString.append(outputDetails);
101     return outString;
102   }
103 
104    // Destructor
105 
106   ClusterFastJetStrategy::~ClusterFastJetStrategy()
107   {
108    delete m_plugin;
109    delete m_jetDef;
110   } 
111 
112   void ClusterFastJetStrategy::makeClusters(MsgStream& log, 
113                                             const std::vector<IKinematic*>& storedCells,
114                                             IKinematicVector& unusedCells,
115                                             IClusterCollection* clusters) const {
116     
117     log << MSG::DEBUG << storedCells.size() << " cells to start with"<<endreq;
118 
119     /** First we make a std::vector<PseudoJet> from the Atlfast::Cells
120         We need to fill a map relating PseudoJets to Cells so that we
121         can associate the Atlfast::Cells with the Atlfast::KtClusters    */
122     
123     std::vector<IKinematic*>::const_iterator itr = storedCells.begin();
124     std::vector<fastjet::PseudoJet> input_particles;
125     std::map<fastjet::PseudoJet,IKinematic*,JetComp> CellMap;
126 
127 
128     log << MSG::VERBOSE <<"Event Summary..."<<endreq;
129     log << MSG::VERBOSE <<Details("Input_Particles")<<endreq;
130 
131     fastjet::PseudoJet tempVec;
132     input_particles.reserve(storedCells.size());
133     for(; itr != storedCells.end() ; ++itr){
134       tempVec = fastjet::PseudoJet((*itr)->momentum());
135       log << MSG::VERBOSE <<Details("Input_Particles",tempVec)<<endreq;
136       input_particles.push_back(tempVec);
137       CellMap[tempVec] = (*itr);
138     }
139     log << MSG::DEBUG << "Made vector of input particles"<<endreq;
140     log << MSG::VERBOSE << "Number of input Cells "<<CellMap.size()<<". Number of input particles "<<input_particles.size()<<endreq;
141     int iRemoved=0; //count the removed cells
142     /** Now make a ClusterSequence object from the std::vector<PsuedoJet>
143         This Object calculates all the Clusters using the chosen (Kt/SISCone) clustering scheme
144         defined by the input variables.
145     */
146     if(!m_jetDef){ 
147       printf("ClusterFastJetStrategy  ERROR  Error no jet definition exists, maybe you didn't type the clustering strategy correctly.\n");
148       printf("ClusterFastJetStrategy  ERROR  Returning having made no clusters.\n");
149       return; 
150     }
151     fastjet::ClusterSequence clust_seq(input_particles, *m_jetDef);
152     log << MSG::DEBUG << "Made ClusterSequence"<<endreq;
153     
154     /** Now we retrieve all the Clusters made by the ClusterSequence as inclusive jet vector<PseudoJet> */
155     
156     
157     std::vector<fastjet::PseudoJet> inclusive_jets = clust_seq.inclusive_jets();
158     
159     
160     /** We can construct Atlfast::KtClusters from the returned PseudoJets
161      as they are HepLorentzVectors. Also use the map to get list of Clusters associated
162     Cells. Also make a second ClusterSequence from each PseudoJets constituents to calculate the
163     y-cut */
164     log << MSG::DEBUG << "Got events jets "<< inclusive_jets.size() << endreq;
165     
166     std::vector<fastjet::PseudoJet>::const_iterator ijet = inclusive_jets.begin();
167     double et=0;
168     double modP=0;
169     
170     log << MSG::VERBOSE <<Details("Output_Jets")<<endreq;
171     log << MSG::VERBOSE <<Details("Output_Constituents")<<endreq;
172     for (; ijet != inclusive_jets.end() ; ++ijet){
173       log << MSG::VERBOSE <<Details("Output_Jets",(*ijet))<<endreq;
174       modP=sqrt( (*ijet).px()*(*ijet).px() + (*ijet).py()*(*ijet).py() + (*ijet).pz()*(*ijet).pz() );
175       et=(*ijet).E() * (*ijet).perp()/modP;
176       
177       if(et > m_minClusterET) { 
178         std::vector<fastjet::PseudoJet> jet_constituents;
179         jet_constituents = clust_seq.constituents(*ijet);
180         //Make a vector of associated cells
181         std::vector<IKinematic*> tempCellVec;
182         std::vector<fastjet::PseudoJet>::const_iterator iconstituent  = jet_constituents.begin();
183         std::vector<HepLorentzVector> ysplit_constituents;
184         log << MSG::VERBOSE <<"Number of constituents in jet: "<<jet_constituents.size()<<endreq;
185         for (; iconstituent != jet_constituents.end() ; ++iconstituent){
186           log << MSG::VERBOSE <<Details("Output_Constituents",(*iconstituent))<<endreq;
187           ysplit_constituents.push_back(HepLorentzVector((*iconstituent).px(),(*iconstituent).py(),(*iconstituent).pz(),(*iconstituent).E()));
188           if(CellMap.find(*iconstituent) == CellMap.end()){
189             log << MSG::WARNING <<  "Cannot find this constituent in map of cells" << endreq;
190           }
191           else {
192             tempCellVec.push_back(CellMap[(*iconstituent)]);
193             log << MSG::VERBOSE <<"Removing cell as matched with constituent"<<endreq;
194             CellMap.erase(*iconstituent);
195             ++iRemoved;
196             //log << MSG::DEBUG << "Removed cell from map" << endreq;
197           }
198         }
199         //now do sub-jet analysis if required
200         double yCut = 0.;
201         //int type = 4 // pp collisions
202         if(m_subjet){
203           YSplitter ys(ysplit_constituents,/*type*/4, m_angle, m_recom, m_rParameter);//type = 4 - pp collisions
204           yCut = ys.getYMergeVals(1).at(0);
205         }
206 
207         //Make a Atlfast::KtCluster
208         HepLorentzVector tmp((*ijet).px(), (*ijet).py(), (*ijet).pz(), (*ijet).E());
209         ICluster* clu = new KtCluster(tmp,tempCellVec.begin(),tempCellVec.end(),yCut);
210         log << MSG::DEBUG << "Made a KtCluster" << endreq;
211         /** put cluster into main vector */
212         clusters->push_back(clu);
213       }
214       else{ log << MSG::VERBOSE <<"Jet has not enough et to cluster: JetEt = "<<et<<", min cluster Et = "<<m_minClusterET<<endreq; }
215     }
216     //return;
217     log << MSG::DEBUG <<  "Number of clusters Made by Kt algo " << clusters->size() << endreq;
218     /** Put copies of all the unassociated cells into the unusedCells vector */
219     std::map<fastjet::PseudoJet,IKinematic*,JetComp>::iterator celit = CellMap.begin();
220 
221     for (; celit != CellMap.end() ; ++celit){
222 
223       unusedCells.push_back( ( (*celit).second ) );
224     }
225     
226     log << MSG::VERBOSE << "Number of output clusters "<<inclusive_jets.size()<<".Number of Removed cells "<<iRemoved<<". Number of saved KtClusters "<<clusters->size()<< endreq;
227     log << MSG::DEBUG << "Size of unusedCells vector " << unusedCells.size() << endreq;
228     return;
229   }
230   
231 } // end of namespace bracket
232 
233 
234 
235 

source navigation ] diff markup ] identifier search ] general search ]

Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems
This page was automatically generated by the LXR engine. Valid HTML 4.01!