ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HbbAnalysis/plugins/HbbTreeMaker.cc
(Generate patch)

Comparing UserCode/HbbAnalysis/plugins/HbbTreeMaker.cc (file contents):
Revision 1.28 by amagnan, Thu Mar 17 12:47:39 2011 UTC vs.
Revision 1.29 by agilbert, Wed May 4 14:21:43 2011 UTC

# Line 58 | Line 58
58   #include "UserCode/HbbAnalysis/interface/L1Object.hh"
59   #include "UserCode/HbbAnalysis/interface/HLTObject.hh"
60  
61 + //AJG
62 + #include "DataFormats/JetReco/interface/JPTJetCollection.h"
63 + #include "DataFormats/JetReco/interface/JPTJet.h"
64 + #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
65 + #include "SimDataFormats/Vertex/interface/SimVertex.h"
66 +
67   #include "UserCode/HbbAnalysis/plugins/HbbTreeMaker.hh"
68  
69   using namespace HbbAnalysis;
# Line 162 | Line 168 | void HbbTreeMaker::analyze(const edm::Ev
168    }
169    HbbBeamSpot(lBeamSpot,event_->beamSpot());
170  
171 +  //AJG - This will only work on RECO sample
172 +  /*
173 +  std::cout << "Beamspot = (" << lBeamSpot->x0() << "," << lBeamSpot->y0() << "," << lBeamSpot->z0() << ")" << std::endl;
174 +  
175 +  edm::Handle<edm::SimVertexContainer> simVertexCollection;
176 +  aEvt.getByLabel("g4SimHits", simVertexCollection);
177 +  const edm::SimVertexContainer simVC = *(simVertexCollection.product());
178 +  std::cout << "SimVertexContainer size = " << simVC.size() << std::endl;
179 +  std::cout << "SimVertex[0] = (" << simVC.at(0).position().x() << ","
180 +                                  << simVC.at(0).position().y() << ","
181 +                                  << simVC.at(0).position().z() << ")" << std::endl;
182 +  */
183  
184    if (!processData_) {
185      edm::Handle<edm::HepMCProduct> mcProd;
# Line 177 | Line 195 | void HbbTreeMaker::analyze(const edm::Ev
195        std::cout << "AMM: Collection GenInfoProduct not available! Exception : " << e.what() << ". " << std::endl;
196      }
197  
198 <    HbbGenInfo(mcProd,lRunProd);
198 >    //HbbGenInfo(mcProd,lRunProd);
199    }
200  
201    edm::Handle<reco::GenParticleCollection> lGenParticles;
# Line 280 | Line 298 | void HbbTreeMaker::analyze(const edm::Ev
298      std::cout << "AMM: Collection " << caloJetSrc_  << " not available! Exception : " << e.what() << ". " << std::endl;
299    }
300  
283  //std::cout << "Processing calo jets:" << std::endl;
301    HbbJets(lCaloJetCollection,jetFlav_,lGenParticles,event_->caloJets());
302 <  
302 >
303 >  //AJG - Process reco JPT Jet Corrections:
304 >  //This section should be uncommented for testing purposes
305 >
306 >  /*
307 >     edm::Handle<reco::JPTJetCollection > lJptRL2L3RESJetCollection;
308 >     edm::Handle<reco::JPTJetCollection > lJptRL1L2L3RESJetCollection;
309 >
310 >     edm::Handle<reco::JPTJetCollection > lJptRRAWJetCollection;
311 >     try {
312 >     aEvt.getByLabel("JetPlusTrackZSPCorJetAntiKt5",lJptRRAWJetCollection);
313 >     if (!lJptRRAWJetCollection.isValid()){
314 >     edm::LogInfo("ERROR")<< "Error! Can't get JetPlusZSPCorJetAntiKt5 by label. ";
315 >     }
316 >     if (debug_) std::cout << "** jetPlusTrackZSPCorJetAntiKt5 = " << lJptRRAWJetCollection->size() << " elements." << std::endl;
317 >     } catch(cms::Exception& e)  {
318 >     std::cout << "AJG: Collection not available! Exception : " << e.what() << ". " << std::endl;
319 >     }
320 >
321 >     try {
322 >     aEvt.getByLabel("ak5JPTJetsL2L3Residual",lJptRL2L3RESJetCollection);
323 >     aEvt.getByLabel("JetPlusTrackZSPCorJetAntiKt5",lJptRRAWJetCollection);
324 >     aEvt.getByLabel("ak5JPTJetsL1L2L3Residual",lJptRL1L2L3RESJetCollection);
325 >     if (!lJptRRAWJetCollection.isValid()){
326 >     edm::LogInfo("ERROR")<< "Error! Can't get jptRecoJets by label. ";
327 >     }
328 >     if (debug_) std::cout << "** jptRecoJetcollection = " << lJptRRAWJetCollection->size() << " elements." << std::endl;
329 >     } catch(cms::Exception& e)  {
330 >     std::cout << "AJG: Collection " << jptJetSrc_  << " not available! Exception : " << e.what() << ". " << std::endl;
331 >     }
332 >
333 >
334 >     for(reco::JPTJetCollection::const_iterator jptjet = lJptRRAWJetCollection->begin(); jptjet != lJptRRAWJetCollection->end(); ++jptjet ) {
335 >
336 >     std::cout << "pT = " << jptjet->pt() << std::endl;
337 >
338 >     reco::TrackRefVector tpionsInVInC = jptjet->getPionsInVertexInCalo();
339 >     std::cout << "Pion Track Count (reco) = " << tpionsInVInC.size() << std::endl;
340 >     }
341 >
342 >     reco::JPTJetCollection::const_iterator jptRAWjet = lJptRRAWJetCollection->begin();
343 >     reco::JPTJetCollection::const_iterator jptL2L3RESjet = lJptRL2L3RESJetCollection->begin();
344 >     reco::JPTJetCollection::const_iterator jptL1L2L3RESjet = lJptRL1L2L3RESJetCollection->begin();
345 >     std::cout << "pT RAW = " << jptRAWjet->pt() << std::endl;
346 >     std::cout << "pT L2L3RES = " << jptL2L3RESjet->pt() << std::endl;
347 >     std::cout << "pT L1L2L3RES = " << jptL1L2L3RESjet->pt() << std::endl;
348 >     */
349 >
350 >
351 >
352    edm::Handle<std::vector<pat::Jet> > lJptJetCollection;
353    
354    try {
# Line 1293 | Line 1359 | void HbbTreeMaker::HbbJets(const edm::Ha
1359            }
1360            if (isJPT) {
1361              HbbAnalysis::JPTJetVars lJPT;
1362 < //          const reco::TrackRefVector& pionsInVertexInCalo () const{return jptSpecific().pionsInVertexInCalo; }
1362 >      reco::TrackRefVector pionsInVInC = (*iter).pionsInVertexInCalo();
1363 >      reco::TrackRefVector pionsInVOuC = (*iter).pionsInVertexOutCalo();
1364 >      reco::TrackRefVector pionsOuVInC = (*iter).pionsOutVertexInCalo();
1365 >      
1366 >      reco::TrackRefVector muonsInVInC = (*iter).muonsInVertexInCalo();
1367 >      reco::TrackRefVector muonsInVOuC = (*iter).muonsInVertexOutCalo();
1368 >      reco::TrackRefVector muonsOuVInC = (*iter).muonsOutVertexInCalo();
1369 >
1370 >      reco::TrackRefVector elecsInVInC = (*iter).elecsInVertexInCalo();
1371 >      reco::TrackRefVector elecsInVOuC = (*iter).elecsInVertexOutCalo();
1372 >      reco::TrackRefVector elecsOuVInC = (*iter).elecsOutVertexInCalo();
1373 >
1374 >      /*
1375 >      unsigned test_track_count = pionsInVInC.size() + pionsInVOuC.size() + pionsOuVInC.size();
1376 >      std::cout << "Total Pion Track Count = " << test_track_count << std::endl;
1377 >      */
1378 >
1379 >      for (reco::TrackRefVector::const_iterator trk_iter = pionsInVInC.begin();
1380 >          trk_iter != pionsInVInC.end();
1381 >          ++trk_iter) {
1382 >        lJPT.particleStatusPt.push_back(std::pair<unsigned int,double>(1,(*trk_iter)->pt()));
1383 >      }
1384 >      for (reco::TrackRefVector::const_iterator trk_iter = pionsInVOuC.begin();
1385 >          trk_iter != pionsInVOuC.end();
1386 >          ++trk_iter) {
1387 >        lJPT.particleStatusPt.push_back(std::pair<unsigned int,double>(2,(*trk_iter)->pt()));
1388 >      }
1389 >      for (reco::TrackRefVector::const_iterator trk_iter = pionsOuVInC.begin();
1390 >          trk_iter != pionsOuVInC.end();
1391 >          ++trk_iter) {
1392 >        lJPT.particleStatusPt.push_back(std::pair<unsigned int,double>(3,(*trk_iter)->pt()));
1393 >      }
1394 >
1395 >      for (reco::TrackRefVector::const_iterator trk_iter = muonsInVInC.begin();
1396 >          trk_iter != muonsInVInC.end();
1397 >          ++trk_iter) {
1398 >        lJPT.particleStatusPt.push_back(std::pair<unsigned int,double>(4,(*trk_iter)->pt()));
1399 >      }
1400 >      for (reco::TrackRefVector::const_iterator trk_iter = muonsInVOuC.begin();
1401 >          trk_iter != muonsInVOuC.end();
1402 >          ++trk_iter) {
1403 >        lJPT.particleStatusPt.push_back(std::pair<unsigned int,double>(5,(*trk_iter)->pt()));
1404 >      }
1405 >      for (reco::TrackRefVector::const_iterator trk_iter = muonsOuVInC.begin();
1406 >          trk_iter != muonsOuVInC.end();
1407 >          ++trk_iter) {
1408 >        lJPT.particleStatusPt.push_back(std::pair<unsigned int,double>(6,(*trk_iter)->pt()));
1409 >      }
1410 >      
1411 >      for (reco::TrackRefVector::const_iterator trk_iter = elecsInVInC.begin();
1412 >          trk_iter != elecsInVInC.end();
1413 >          ++trk_iter) {
1414 >        lJPT.particleStatusPt.push_back(std::pair<unsigned int,double>(7,(*trk_iter)->pt()));
1415 >      }
1416 >      for (reco::TrackRefVector::const_iterator trk_iter = elecsInVOuC.begin();
1417 >          trk_iter != elecsInVOuC.end();
1418 >          ++trk_iter) {
1419 >        lJPT.particleStatusPt.push_back(std::pair<unsigned int,double>(8,(*trk_iter)->pt()));
1420 >      }
1421 >      for (reco::TrackRefVector::const_iterator trk_iter = elecsOuVInC.begin();
1422 >          trk_iter != elecsOuVInC.end();
1423 >          ++trk_iter) {
1424 >        lJPT.particleStatusPt.push_back(std::pair<unsigned int,double>(9,(*trk_iter)->pt()));
1425 >      }
1426 >
1427 >      //            const reco::TrackRefVector& pionsInVertexInCalo () const{return jptSpecific().pionsInVertexInCalo; }
1428   //          const reco::TrackRefVector& pionsInVertexOutCalo() const{return jptSpecific().pionsInVertexOutCalo;}
1429   //          const reco::TrackRefVector& pionsOutVertexInCalo() const{return jptSpecific().pionsOutVertexInCalo;}
1430   //          const reco::TrackRefVector& muonsInVertexInCalo () const{return jptSpecific().muonsInVertexInCalo; }
# Line 1305 | Line 1436 | void HbbTreeMaker::HbbJets(const edm::Ha
1436              lJPT.zspCorrection = (*iter).zspCorrection();
1437              lJPT.elecMultiplicity = (*iter).elecMultiplicity();
1438  
1308
1439              HbbAnalysis::CaloJetVars lCalo;
1440              const reco::JPTJet * lJetRef = dynamic_cast<const reco::JPTJet *>((*iter).originalObject());
1441              edm::RefToBase<reco::Jet> jptjetRef = lJetRef->getCaloJetRef();
# Line 1313 | Line 1443 | void HbbTreeMaker::HbbJets(const edm::Ha
1443              // Dynamic_cast to CaloJet object
1444              reco::CaloJet const * rawcalojet =
1445                dynamic_cast<reco::CaloJet const *>( &* jptjetRef);
1446 <                                  
1446 >      lJPT.calopT = rawcalojet->pt();
1447 >      lJPT.caloEta = rawcalojet->eta();
1448 >      if (debug_) {
1449 >        std::cout << " -- Raw CaloJet pT = " << rawcalojet->pt() << std::endl;    
1450 >        std::cout << " -- Raw CaloJet Eta = " << rawcalojet->eta() << std::endl;
1451 >      }
1452              lCalo.maxEInEmTowers = rawcalojet->maxEInEmTowers();
1453              lCalo.maxEInHadTowers = rawcalojet->maxEInHadTowers();
1454              lCalo.energyFractionHadronic = rawcalojet->energyFractionHadronic();
# Line 1539 | Line 1674 | void HbbTreeMaker::HbbVertices(const edm
1674          lVtx.cov02 = (*iter).covariance(0,2);
1675          lVtx.cov12 = (*iter).covariance(1,2);
1676  
1677 +  //AJG
1678 +  /*
1679 +  std::cout << "Vertex (" << (*iter).x() << ","
1680 +                          << (*iter).y() << ","
1681 +                          << (*iter).z() << ")" << std::endl;
1682 +  */
1683 +
1684          HbbAnalysis::Vertex lObj(lVtx);
1685          aVec.push_back(lObj);
1686        }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines