9 #include "Math/GenVector/PxPyPzM4D.h" 67 parser.
addOption (
"mode", CommandLineParser::kInteger,
68 "Normal(0), VQQ(1), LF(2), Wc(3)",
70 parser.
addOption (
"sampleName", CommandLineParser::kString,
71 "Sample name (e.g., top, Wqq, etc.)");
106 gROOT->SetStyle (
"Plain");
117 for (eventCont.
toBegin(); !eventCont.
atEnd(); ++eventCont)
123 jetCollection.
getByLabel (eventCont,
"selectedLayer1Jets");
124 assert ( jetCollection.
isValid() );
127 goodMuonCollection.
getByLabel (eventCont,
"goodLeptons");
128 assert ( goodMuonCollection.isValid() );
131 if (! goodMuonCollection->size() )
147 int numBottom = 0, numCharm = 0, numLight = 0;
149 double sumVertexMass = 0.;
151 const vector< pat::Jet >::const_iterator kJetEnd = jetCollection->end();
152 for (vector< pat::Jet >::const_iterator jetIter = jetCollection->begin();
157 if( jetIter->bDiscriminator(
"simpleSecondaryVertexBJetTags") < 2.05 )
163 = jetIter->tagInfoSecondaryVertex(
"secondaryVertex");
176 int jetFlavor =
std::abs( jetIter->partonFlavour() );
181 else if (4 == jetFlavor)
193 ROOT::Math::LorentzVector< ROOT::Math::PxPyPzM4D<double> > sumVec;
199 trackIter != kEndTracks;
202 const double kPionMass = 0.13957018;
203 ROOT::Math::LorentzVector< ROOT::Math::PxPyPzM4D<double> > vec;
204 vec.SetPx( (*trackIter)->px() );
205 vec.SetPy( (*trackIter)->py() );
206 vec.SetPz( (*trackIter)->pz() );
207 vec.SetM (kPionMass);
210 sumVertexMass += sumVec.M();
221 int numJets =
std::min( (
int) jetCollection->size(), 5 );
222 eventCont.
hist( sampleName +
"_jettag")->Fill (numJets, numTags);
234 sumVertexMass /= numTags;
235 string whichtag =
"";
239 if (numBottom) whichtag =
"_b";
240 else if (numCharm) whichtag =
"_c";
241 else if (numLight) whichtag =
"_q";
242 else whichtag =
"_X";
245 if (2 == numBottom) whichtag =
"_bb";
246 else if (2 == numCharm) whichtag =
"_cc";
247 else if (2 == numLight) whichtag =
"_qq";
248 else if (numBottom && numCharm) whichtag =
"_bc";
249 else if (numBottom && numLight) whichtag =
"_bq";
250 else if (numCharm && numLight) whichtag =
"_bq";
251 else whichtag =
"_XX";
253 string massName = sampleName
254 + Form(
"_secvtxMass_%dj_%dt", numJets, numTags);
255 eventCont.
hist(massName)->Fill (sumVertexMass);
256 eventCont.
hist(massName + whichtag)->Fill (sumVertexMass);
300 CommandLineParser::SVec baseNameVec;
301 CommandLineParser::SVec beginningVec, endingVec;
308 beginningVec.push_back (
"X");
309 beginningVec.push_back (
"W");
310 beginningVec.push_back (
"Z");
312 endingVec.push_back(
"bb" );
313 endingVec.push_back(
"b2" );
314 endingVec.push_back(
"cc" );
315 endingVec.push_back(
"c2" );
316 for (CommandLineParser::SVecConstIter outerIter = beginningVec.begin();
317 beginningVec.end() != outerIter;
320 for (CommandLineParser::SVecConstIter innerIter = endingVec.begin();
321 endingVec.end() != innerIter;
324 baseNameVec.push_back( *outerIter + *innerIter);
331 baseNameVec.push_back(parser.
stringValue (
"sampleName") +
"b3");
332 baseNameVec.push_back(parser.
stringValue (
"sampleName") +
"c3");
336 baseNameVec.push_back(parser.
stringValue (
"sampleName"));
342 CommandLineParser::SVec singleTagEndingVec, doubleTagEndingVec;
343 singleTagEndingVec.push_back (
"_b");
344 singleTagEndingVec.push_back (
"_c");
345 singleTagEndingVec.push_back (
"_q");
346 doubleTagEndingVec.push_back (
"_bb");
347 doubleTagEndingVec.push_back (
"_cc");
348 doubleTagEndingVec.push_back (
"_qq");
349 doubleTagEndingVec.push_back (
"_bc");
350 doubleTagEndingVec.push_back (
"_bq");
351 doubleTagEndingVec.push_back (
"_cq");
356 for (CommandLineParser::SVecConstIter baseIter = baseNameVec.begin();
357 baseNameVec.end() != baseIter;
363 TString histName = *baseIter +
"_jettag";
364 eventCont.
add(
new TH2F( histName, histName,
375 histName = *baseIter + Form (
"_secvtxMass_%dj_%dt",
jet,
tag);
376 eventCont.
add(
new TH1F( histName, histName, 40, 0, 10) );
377 CommandLineParser::SVec *vecPtr = &singleTagEndingVec;
380 vecPtr = &doubleTagEndingVec;
382 for (CommandLineParser::SVecConstIter tagIter = vecPtr->begin();
383 vecPtr->end() != tagIter;
389 histName = *baseIter + Form (
"_secvtxMass_%dj_%dt",
jet,
tag)
391 eventCont.
add(
new TH1F( histName, histName, 40, 0, 10) );
416 heavyFlavorCategory.
getByLabel (eventCont,
"flavorHistoryFilter");
417 assert ( heavyFlavorCategory.
isValid() );
418 int HFcat = (*heavyFlavorCategory);
429 }
else if (6 == HFcat)
432 }
else if (11 != HFcat)
465 genParticleCollection.
getByLabel (eventCont,
"genParticles");
466 assert ( genParticleCollection.
isValid() );
469 const vector< reco::GenParticle>::const_iterator
470 kGenPartEnd = genParticleCollection->end();
471 for (vector< reco::GenParticle>::const_iterator gpIter =
472 genParticleCollection->begin();
473 gpIter != kGenPartEnd; ++gpIter )
475 if (gpIter->status() == 3 &&
std::abs(gpIter->pdgId()) == 23)
480 if (gpIter->status() == 3 &&
std::abs(gpIter->pdgId()) == 24)
trackRef_iterator tracks_end() const
last iterator over tracks
const VTX & secondaryVertex(unsigned int index) const
std::string & stringValue(std::string key)
void parseArguments(int argc, char **argv, bool allowArgs=false)
bool calcSampleName(fwlite::EventContainer &eventCont, string &sampleName)
void bookHistograms(fwlite::EventContainer &eventCont)
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
int & integerValue(std::string key)
void outputNameTagFunc(string &tag)
Abs< T >::type abs(const T &t)
void add(TH1 *histPtr, const std::string &directory="")
unsigned int nVertices() const
const EventContainer & toBegin()
void addOption(std::string key, OptionType type, const std::string &description="")
int main(int argc, char *argv[])
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
trackRef_iterator tracks_begin() const
first iterator over tracks
TH1 * hist(const std::string &name)
optutl::CommandLineParser & parser()