File indexing completed on 2024-04-06 12:23:22
0001
0002
0003
0004 #include "FWCore/Utilities/interface/InputTag.h"
0005 #include "DataFormats/Common/interface/Handle.h"
0006 #include "DataFormats/PatCandidates/interface/Jet.h"
0007 #include "DataFormats/Math/interface/deltaPhi.h"
0008
0009 #include "PhysicsTools/FWLite/interface/EventContainer.h"
0010 #include "PhysicsTools/FWLite/interface/CommandLineParser.h"
0011
0012
0013 #include "TROOT.h"
0014
0015 using namespace std;
0016
0017
0018
0019
0020
0021
0022
0023
0024 int main (int argc, char* argv[])
0025 {
0026
0027
0028
0029
0030
0031
0032
0033 optutl::CommandLineParser parser ("Playing with jets");
0034
0035
0036
0037
0038
0039
0040 parser.stringValue ("outputFile") = "jetInfo.root";
0041
0042
0043 parser.parseArguments (argc, argv);
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053 fwlite::EventContainer eventCont (parser);
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 gROOT->SetStyle ("Plain");
0064
0065
0066 eventCont.add( new TH1F( "jetpt", "Jet p_{T} using standard absolute p_{T} calibration", 100, 0, 60) );
0067 eventCont.add( new TH1F( "jeteta", "Jet eta using standard absolute p_{T} calibration", 100, 0, 10) );
0068 eventCont.add( new TH1F( "reljetpt", "Jet p_{T} using relative inter eta calibration", 100, 0, 60) );
0069 eventCont.add( new TH1F( "reljeteta", "Jet eta using relative inter eta calibration", 100, 0, 10) );
0070 eventCont.add( new TH1F( "phijet1jet2", "Phi between Jet 1 and Jet 2", 100, 0, 3.5) );
0071 eventCont.add( new TH1F( "invarMass", "Invariant Mass of the 4-vector sum of Two Jets", 100, 0, 200) );
0072
0073
0074
0075
0076
0077
0078
0079
0080 edm::InputTag jetLabel ("selectedLayer1Jets");
0081
0082 for (eventCont.toBegin(); ! eventCont.atEnd(); ++eventCont)
0083 {
0084
0085
0086
0087
0088
0089 edm::Handle< vector< pat::Jet > > jetHandle;
0090 eventCont.getByLabel (jetLabel, jetHandle);
0091 assert ( jetHandle.isValid() );
0092
0093 const vector< pat::Jet >::const_iterator kJetEnd = jetHandle->end();
0094 for (vector< pat::Jet >::const_iterator jetIter = jetHandle->begin();
0095 jetIter != kJetEnd;
0096 ++jetIter)
0097 {
0098
0099
0100
0101
0102 eventCont.hist("reljetpt") ->Fill( jetIter->correctedJet("REL").pt() );
0103 eventCont.hist("reljeteta")->Fill( jetIter->correctedJet("REL").eta() );
0104 eventCont.hist("jetpt") ->Fill( jetIter->correctedJet("ABS").pt() );
0105
0106 eventCont.hist("jeteta") ->Fill( jetIter->eta() );
0107 }
0108
0109
0110 if (jetHandle->size() < 2)
0111 {
0112
0113 continue;
0114 }
0115
0116
0117 eventCont.hist("invarMass")->Fill( (jetHandle->at(0).p4() + jetHandle->at(1).p4()).M() );
0118 eventCont.hist("phijet1jet2")->Fill( deltaPhi( jetHandle->at(0).phi(), jetHandle->at(1).phi() ) );
0119 }
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132 return 0;
0133 }