Skip to content

Commit

Permalink
Update KGenEventInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
JoramBerger committed Nov 30, 2014
1 parent 2738bb3 commit 26b6863
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
18 changes: 9 additions & 9 deletions DataFormats/interface/KInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ typedef int bx_id;

struct KGenEventInfo : public KEventInfo
{
double weight;
double binValue;
double alphaQCD;
float numPUInteractionsTruth; // "true" number of PU interactions
unsigned char numPUInteractionsM2; // bx = -2
unsigned char numPUInteractionsM1; // bx = -1
unsigned char numPUInteractions0; // bx = 0
unsigned char numPUInteractionsP1; // bx = +1
unsigned char numPUInteractionsP2; // bx = +2
double weight; //< Monte-Carlo weight of the event
double binValue; //< ?
double alphaQCD; //< value of alpha_S for this event
float nPUMean; //< mean ("true") number of PU interactions
unsigned char nPUm2; // bx = -2
unsigned char nPUm1; // bx = -1
unsigned char nPU; // bx = 0
unsigned char nPUp1; // bx = +1
unsigned char nPUp2; // bx = +2
};


Expand Down
2 changes: 1 addition & 1 deletion DataFormats/test/KDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ std::ostream &operator<<(std::ostream &os, const KGenEventInfo &m)
os << static_cast<const KEventInfo>(m) << std::endl;
return os
<< "Weight: " << m.weight
<< "#PU: " << m.numPUInteractionsTruth;
<< "#PU: " << m.nPUMean;
}

std::ostream &displayHLT(std::ostream &os, const KLumiInfo &metaLumi, const KEventInfo &metaEvent)
Expand Down
35 changes: 17 additions & 18 deletions Producers/interface/KGenInfoProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,38 +82,37 @@ class KGenInfoProducer : public KInfoProducer<Tmeta>
//metaEvent->alphaQED = hEventInfo->alphaQED();

// Get PU infos
this->metaEvent->numPUInteractionsM2 = 0;
this->metaEvent->numPUInteractionsM1 = 0;
this->metaEvent->numPUInteractions0 = 0;
this->metaEvent->numPUInteractionsP1 = 0;
this->metaEvent->numPUInteractionsP2 = 0;
this->metaEvent->nPUm2 = 0;
this->metaEvent->nPUm1 = 0;
this->metaEvent->nPU = 0;
this->metaEvent->nPUp1 = 0;
this->metaEvent->nPUp2 = 0;
edm::Handle<std::vector<PileupSummaryInfo> > puHandles;
if (event.getByLabel(puInfoSource, puHandles) && puHandles.isValid())
{
for (std::vector<PileupSummaryInfo>::const_iterator it = puHandles->begin(); it != puHandles->end(); ++it)
{
unsigned char nPU = (unsigned char)std::min(255, it->getPU_NumInteractions());
if (it->getBunchCrossing() == -2)
this->metaEvent->numPUInteractionsM2 = nPU;
this->metaEvent->nPUm2 = nPU;
else if (it->getBunchCrossing() == -1)
this->metaEvent->numPUInteractionsM1 = nPU;
this->metaEvent->nPUm1 = nPU;
else if (it->getBunchCrossing() == 0)
this->metaEvent->numPUInteractions0 = nPU;
this->metaEvent->nPU = nPU;
else if (it->getBunchCrossing() == 1)
this->metaEvent->numPUInteractionsP1 = nPU;
this->metaEvent->nPUp1 = nPU;
else if (it->getBunchCrossing() == 2)
this->metaEvent->numPUInteractionsP2 = nPU;
this->metaEvent->nPUp2 = nPU;

// remove the following line to compile with CMSSW 4.2.7 or earlier
this->metaEvent->numPUInteractionsTruth = it->getTrueNumInteractions();
this->metaEvent->nPUMean = it->getTrueNumInteractions(); // remove this line to compile with CMSSW 4.2.7 or earlier
}
}
else
{
// in some versions of CMSSW it's not a vector:
edm::Handle<PileupSummaryInfo> puHandle;
if (event.getByLabel(puInfoSource, puHandle) && puHandle.isValid())
this->metaEvent->numPUInteractions0 = (unsigned char)std::min(255, puHandle->getPU_NumInteractions());
this->metaEvent->nPU = (unsigned char)std::min(255, puHandle->getPU_NumInteractions());
}

return true;
Expand Down Expand Up @@ -172,11 +171,11 @@ class KHepMCInfoProducer : public KInfoProducer<Tmeta>
//metaEvent->alphaQED = hEventInfo->alphaQED();

// Get PU infos
this->metaEvent->numPUInteractionsM2 = 0;
this->metaEvent->numPUInteractionsM1 = 0;
this->metaEvent->numPUInteractions0 = 0;
this->metaEvent->numPUInteractionsP1 = 0;
this->metaEvent->numPUInteractionsP2 = 0;
this->metaEvent->nPUm2 = 0;
this->metaEvent->nPUm1 = 0;
this->metaEvent->nPU = 0;
this->metaEvent->nPUp1 = 0;
this->metaEvent->nPUp2 = 0;

return true;
}
Expand Down

0 comments on commit 26b6863

Please sign in to comment.