Skip to content

Commit

Permalink
Clang-Format
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsbuild committed May 8, 2019
1 parent c458253 commit 22aeb75
Show file tree
Hide file tree
Showing 81 changed files with 2,225 additions and 2,983 deletions.
44 changes: 16 additions & 28 deletions SimCalorimetry/CastorTechTrigProducer/src/CastorTTRecord.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include "FWCore/MessageLogger/interface/MessageLogger.h"

CastorTTRecord::CastorTTRecord(const edm::ParameterSet &ps) {
CastorDigiColl_ = consumes<CastorDigiCollection>(
ps.getParameter<edm::InputTag>("CastorDigiCollection"));
CastorDigiColl_ = consumes<CastorDigiCollection>(ps.getParameter<edm::InputTag>("CastorDigiCollection"));
CastorSignalTS_ = ps.getParameter<unsigned int>("CastorSignalTS");

ttpBits_ = ps.getParameter<std::vector<unsigned int>>("ttpBits");
Expand All @@ -28,7 +27,6 @@ CastorTTRecord::CastorTTRecord(const edm::ParameterSet &ps) {
CastorTTRecord::~CastorTTRecord() {}

void CastorTTRecord::produce(edm::Event &e, const edm::EventSetup &eventSetup) {

// std::cerr << "**** RUNNING THROUGH CastorTTRecord::produce" << std::endl;

std::vector<L1GtTechnicalTrigger> vecTT(ttpBits_.size());
Expand All @@ -38,7 +36,6 @@ void CastorTTRecord::produce(edm::Event &e, const edm::EventSetup &eventSetup) {
e.getByToken(CastorDigiColl_, CastorDigiColl);

if (!CastorDigiColl.failedToGet()) {

double cas_efC[16][14];
getEnergy_fC(cas_efC, CastorDigiColl, e, eventSetup);

Expand All @@ -51,41 +48,38 @@ void CastorTTRecord::produce(edm::Event &e, const edm::EventSetup &eventSetup) {
// std::endl; std::cout << "Run CastorTTRecord::produce. TriggerBit = " <<
// ttpBits_.at(i) << "; TriggerName = " << TrigNames_.at(i) << "; Decision
// = " << decision[i] << std::endl;
vecTT.at(i) = L1GtTechnicalTrigger(TrigNames_.at(i), ttpBits_.at(i), 0,
decision.at(i));
vecTT.at(i) = L1GtTechnicalTrigger(TrigNames_.at(i), ttpBits_.at(i), 0, decision.at(i));
}

} else {
vecTT.clear();
}

// Put output into event
std::unique_ptr<L1GtTechnicalTriggerRecord> output(
new L1GtTechnicalTriggerRecord());
std::unique_ptr<L1GtTechnicalTriggerRecord> output(new L1GtTechnicalTriggerRecord());
output->setGtTechnicalTrigger(vecTT);
e.put(std::move(output));
}

void CastorTTRecord::getEnergy_fC(
double energy[16][14], edm::Handle<CastorDigiCollection> &CastorDigiColl,
edm::Event &e, const edm::EventSetup &eventSetup) {
void CastorTTRecord::getEnergy_fC(double energy[16][14],
edm::Handle<CastorDigiCollection> &CastorDigiColl,
edm::Event &e,
const edm::EventSetup &eventSetup) {
// std::cerr << "**** RUNNING THROUGH CastorTTRecord::getEnergy_fC" <<
// std::endl;

// Get Conditions
edm::ESHandle<CastorDbService> conditions;
eventSetup.get<CastorDbRecord>().get(conditions);
const CastorQIEShape *shape =
conditions->getCastorShape(); // this one is generic
const CastorQIEShape *shape = conditions->getCastorShape(); // this one is generic

for (int isec = 0; isec < 16; isec++)
for (int imod = 0; imod < 14; imod++)
energy[isec][imod] = 0;

// Loop over digis
CastorDigiCollection::const_iterator idigi;
for (idigi = CastorDigiColl->begin(); idigi != CastorDigiColl->end();
idigi++) {
for (idigi = CastorDigiColl->begin(); idigi != CastorDigiColl->end(); idigi++) {
const CastorDataFrame &digi = (*idigi);
HcalCastorDetId cell = digi.id();

Expand All @@ -94,8 +88,7 @@ void CastorTTRecord::getEnergy_fC(
CastorCoderDb coder(*channelCoder, *shape);

// Get Castor Calibration
const CastorCalibrations &calibrations =
conditions->getCastorCalibrations(cell);
const CastorCalibrations &calibrations = conditions->getCastorCalibrations(cell);

// convert adc to fC
CaloSamples tool;
Expand All @@ -112,16 +105,15 @@ void CastorTTRecord::getEnergy_fC(
}
}

void CastorTTRecord::getTriggerDecisions(std::vector<bool> &decision,
double energy[16][14]) const {
void CastorTTRecord::getTriggerDecisions(std::vector<bool> &decision, double energy[16][14]) const {
// std::cerr << "**** RUNNING THROUGH CastorTTRecord::getTriggerDecisions" <<
// std::endl;

// check if number of bits is at least four
if (decision.size() < 4)
return;

std::vector<bool> tdpo[8]; // TriggerDecisionsPerOctant
std::vector<bool> tdpo[8]; // TriggerDecisionsPerOctant
getTriggerDecisionsPerOctant(tdpo, energy);

// preset trigger decisions
Expand Down Expand Up @@ -158,12 +150,10 @@ void CastorTTRecord::getTriggerDecisions(std::vector<bool> &decision,
// was one of the other sectors
// in the octant empty ?
if (tdpo[ioct].at(0)) {
if (tdpo[prev_oct].at(1) && tdpo[next_oct].at(0) &&
tdpo[next_oct].at(1))
if (tdpo[prev_oct].at(1) && tdpo[next_oct].at(0) && tdpo[next_oct].at(1))
decision.at(3) = true;
} else if (tdpo[ioct].at(1)) {
if (tdpo[prev_oct].at(0) && tdpo[prev_oct].at(1) &&
tdpo[next_oct].at(0))
if (tdpo[prev_oct].at(0) && tdpo[prev_oct].at(1) && tdpo[next_oct].at(0))
decision.at(3) = true;
}
// when not no iso muon
Expand All @@ -179,8 +169,7 @@ void CastorTTRecord::getTriggerDecisions(std::vector<bool> &decision,
// decision.at(2) = EM_decision && !HAD_decision;
}

void CastorTTRecord::getTriggerDecisionsPerOctant(std::vector<bool> tdpo[8],
double energy[16][14]) const {
void CastorTTRecord::getTriggerDecisionsPerOctant(std::vector<bool> tdpo[8], double energy[16][14]) const {
// std::cerr << "**** RUNNING THROUGH
// CastorTTRecord::getTriggerDecisionsPerOctant" << std::endl;

Expand Down Expand Up @@ -251,8 +240,7 @@ void CastorTTRecord::getTriggerDecisionsPerOctant(std::vector<bool> tdpo[8],
*/
if (fCsum_jet_had > TrigThresholds_.at(1) / reweighted_gain)
// additional high threshold near saturation for EM part
if (energy[isec][0] > 26000 / reweighted_gain &&
energy[isec][1] > 26000 / reweighted_gain)
if (energy[isec][0] > 26000 / reweighted_gain && energy[isec][1] > 26000 / reweighted_gain)
tdpo[ioct].at(2) = true;

// low pt jet Trigger
Expand Down
9 changes: 4 additions & 5 deletions SimCalorimetry/CastorTechTrigProducer/src/CastorTTRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ class CastorTTRecord : public edm::one::EDProducer<> {
// modules]
void getEnergy_fC(double energy[16][14],
edm::Handle<CastorDigiCollection> &CastorDigiColl,
edm::Event &e, const edm::EventSetup &c);
edm::Event &e,
const edm::EventSetup &c);

// get Trigger decisions | vector needs same SIZE and ORDER as in 'ttpBits_'
void getTriggerDecisions(std::vector<bool> &decision,
double energy[16][14]) const;
void getTriggerDecisions(std::vector<bool> &decision, double energy[16][14]) const;

// get Trigger decisions for every octant | vector has size of 6 -> 6 HTR card
// bits
void getTriggerDecisionsPerOctant(std::vector<bool> tdps[16],
double energy[16][14]) const;
void getTriggerDecisionsPerOctant(std::vector<bool> tdps[16], double energy[16][14]) const;

private:
edm::EDGetTokenT<CastorDigiCollection> CastorDigiColl_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

#include <vector>

template <class C> class EcalZeroSuppressor {
template <class C>
class EcalZeroSuppressor {
public:
virtual ~EcalZeroSuppressor(){};

Expand All @@ -36,9 +37,7 @@ template <class C> class EcalZeroSuppressor {
bool accept(const C &frame, const double &threshold);

/// can be fetched every event from the EventSetup
void setPedestals(const EcalPedestals *pedestals) {
thePedestals = pedestals;
}
void setPedestals(const EcalPedestals *pedestals) { thePedestals = pedestals; }

private:
const EcalPedestals *thePedestals;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
template <class C>
void EcalZeroSuppressor<C>::findGain12Pedestal(const DetId &detId, double &ped,
double &width) {
void EcalZeroSuppressor<C>::findGain12Pedestal(const DetId &detId, double &ped, double &width) {
ped = 200.;
width = 1.;
EcalPedestalsMapIterator mapItr = thePedestals->getMap().find(detId);
// should I care if it doesn't get found?
if (mapItr == thePedestals->getMap().end()) {
edm::LogError("SetupInfo")
<< "Could not find pedestal for " << detId.rawId() << " among the "
<< thePedestals->getMap().size();
edm::LogError("SetupInfo") << "Could not find pedestal for " << detId.rawId() << " among the "
<< thePedestals->getMap().size();
} else {
ped = (*mapItr).mean_x12;
width = (*mapItr).rms_x12;
Expand All @@ -17,7 +15,6 @@ void EcalZeroSuppressor<C>::findGain12Pedestal(const DetId &detId, double &ped,

template <class C>
bool EcalZeroSuppressor<C>::accept(const C &frame, const double &threshold) {

bool pass = true;

DetId detId = frame.id();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

#include <vector>

template <class C> class TrivialAmplitudeAlgo {
template <class C>
class TrivialAmplitudeAlgo {
public:
explicit TrivialAmplitudeAlgo();
virtual ~TrivialAmplitudeAlgo(){};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
template <class C> TrivialAmplitudeAlgo<C>::TrivialAmplitudeAlgo() {

template <class C>
TrivialAmplitudeAlgo<C>::TrivialAmplitudeAlgo() {
// 3+1 set of trivial weights

theWeights.reserve(10);
Expand All @@ -22,8 +22,8 @@ template <class C> TrivialAmplitudeAlgo<C>::TrivialAmplitudeAlgo() {
theGainFactors[3] = 12.;
}

template <class C> double TrivialAmplitudeAlgo<C>::energy(const C &frame) {

template <class C>
double TrivialAmplitudeAlgo<C>::energy(const C &frame) {
double Erec = 0.;

// Simple energy computation with the weight method
Expand All @@ -32,20 +32,17 @@ template <class C> double TrivialAmplitudeAlgo<C>::energy(const C &frame) {
for (int sample = 0; sample < frame.size(); ++sample) {
int gain = (frame.sample(sample).gainId());
if (gain >= 1 || gain <= 3) {
Erec = Erec + theWeights[sample] * (frame.sample(sample).adc()) *
theGainFactors[gain];
Erec = Erec + theWeights[sample] * (frame.sample(sample).adc()) * theGainFactors[gain];
} else {
edm::LogWarning("EcalAmplitudeError")
<< "Wrong gain in frame " << sample << " \n"
<< frame;
edm::LogWarning("EcalAmplitudeError") << "Wrong gain in frame " << sample << " \n" << frame;
}
}

return Erec;
}

template <class C> double TrivialAmplitudeAlgo<C>::pedestal(const C &frame) {

template <class C>
double TrivialAmplitudeAlgo<C>::pedestal(const C &frame) {
double PrePed = 0.;

// Simple predestal from 3 first samples
Expand All @@ -54,12 +51,9 @@ template <class C> double TrivialAmplitudeAlgo<C>::pedestal(const C &frame) {
for (int sample = 0; sample < 3; ++sample) {
int gain = (frame.sample(sample).gainId());
if (gain >= 1 || gain <= 3) {
PrePed = PrePed + theWeights[sample] * (frame.sample(sample).adc()) *
theGainFactors[gain];
PrePed = PrePed + theWeights[sample] * (frame.sample(sample).adc()) * theGainFactors[gain];
} else {
edm::LogWarning("EcalAmplitudeError")
<< "Wrong gain in frame " << sample << " \n"
<< frame;
edm::LogWarning("EcalAmplitudeError") << "Wrong gain in frame " << sample << " \n" << frame;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ class EcalZeroSuppressionProducer : public edm::stream::EDProducer<> {
double glbBarrelThreshold_;
double glbEndcapThreshold_;

std::string digiProducer_; // name of module/plugin/producer making digis
std::string EBdigiCollection_; // secondary name given to collection of digis
std::string EEdigiCollection_; // secondary name given to collection of digis
std::string
EBZSdigiCollection_; // secondary name given to collection of digis
std::string
EEZSdigiCollection_; // secondary name given to collection of digis
std::string digiProducer_; // name of module/plugin/producer making digis
std::string EBdigiCollection_; // secondary name given to collection of digis
std::string EEdigiCollection_; // secondary name given to collection of digis
std::string EBZSdigiCollection_; // secondary name given to collection of digis
std::string EEZSdigiCollection_; // secondary name given to collection of digis

EcalZeroSuppressor<EBDataFrame> theBarrelZeroSuppressor_;
EcalZeroSuppressor<EEDataFrame> theEndcapZeroSuppressor_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "SimCalorimetry/EcalZeroSuppressionProducers/interface/ESZeroSuppressionProducer.h"

ESZeroSuppressionProducer::ESZeroSuppressionProducer(
const edm::ParameterSet &ps) {

ESZeroSuppressionProducer::ESZeroSuppressionProducer(const edm::ParameterSet &ps) {
digiProducer_ = ps.getParameter<std::string>("digiProducer");
ESdigiCollection_ = ps.getParameter<std::string>("ESdigiCollection");
ESZSdigiCollection_ = ps.getParameter<std::string>("ESZSdigiCollection");
Expand All @@ -17,9 +15,7 @@ ESZeroSuppressionProducer::ESZeroSuppressionProducer(

ESZeroSuppressionProducer::~ESZeroSuppressionProducer() {}

void ESZeroSuppressionProducer::produce(edm::Event &event,
const edm::EventSetup &eventSetup) {

void ESZeroSuppressionProducer::produce(edm::Event &event, const edm::EventSetup &eventSetup) {
eventSetup.get<ESThresholdsRcd>().get(esthresholds_);
const ESThresholds *thresholds = esthresholds_.product();

Expand All @@ -33,17 +29,14 @@ void ESZeroSuppressionProducer::produce(edm::Event &event,
bool fullESDigis = true;
event.getByToken(ES_token, ESDigis);
if (!ESDigis.isValid()) {
edm::LogError("ZeroSuppressionError")
<< "Error! can't get the product " << ESdigiCollection_.c_str();
edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << ESdigiCollection_.c_str();
fullESDigis = false;
}

std::unique_ptr<ESDigiCollection> ESZSDigis(new ESDigiCollection());

if (fullESDigis) {
for (ESDigiCollection::const_iterator i(ESDigis->begin());
i != ESDigis->end(); ++i) {

for (ESDigiCollection::const_iterator i(ESDigis->begin()); i != ESDigis->end(); ++i) {
ESDataFrame dataframe = (*i);

ESPedestals::const_iterator it_ped = pedestals->find(dataframe.id());
Expand Down
Loading

0 comments on commit 22aeb75

Please sign in to comment.