Skip to content

Commit

Permalink
Clang-Format
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsbuild committed May 31, 2019
1 parent 8193a8c commit 5dd8b8d
Show file tree
Hide file tree
Showing 215 changed files with 23,614 additions and 25,742 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@

#include "AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.h"


DEFINE_FWK_MODULE(SiStripProcessedRawDigiProducer);
Original file line number Diff line number Diff line change
Expand Up @@ -18,97 +18,98 @@
#include <functional>

SiStripProcessedRawDigiProducer::SiStripProcessedRawDigiProducer(edm::ParameterSet const& conf)
: inputTags(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")),
inputTokensDigi(edm::vector_transform(inputTags, [this](edm::InputTag const & tag){return consumes<edm::DetSetVector<SiStripDigi> >(tag);})),
inputTokensRawDigi(edm::vector_transform(inputTags, [this](edm::InputTag const & tag){return consumes<edm::DetSetVector<SiStripRawDigi> >(tag);})),
subtractorPed(SiStripRawProcessingFactory::create_SubtractorPed(conf)),
subtractorCMN(SiStripRawProcessingFactory::create_SubtractorCMN(conf)){

produces< edm::DetSetVector<SiStripProcessedRawDigi> >("");
: inputTags(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")),
inputTokensDigi(edm::vector_transform(
inputTags, [this](edm::InputTag const& tag) { return consumes<edm::DetSetVector<SiStripDigi> >(tag); })),
inputTokensRawDigi(edm::vector_transform(
inputTags, [this](edm::InputTag const& tag) { return consumes<edm::DetSetVector<SiStripRawDigi> >(tag); })),
subtractorPed(SiStripRawProcessingFactory::create_SubtractorPed(conf)),
subtractorCMN(SiStripRawProcessingFactory::create_SubtractorCMN(conf)) {
produces<edm::DetSetVector<SiStripProcessedRawDigi> >("");
}

void SiStripProcessedRawDigiProducer::
produce(edm::Event& e, const edm::EventSetup& es) {

std::unique_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > output(new edm::DetSetVector<SiStripProcessedRawDigi>());
edm::Handle< edm::DetSetVector<SiStripDigi> > inputDigis;
edm::Handle< edm::DetSetVector<SiStripRawDigi> > inputRawdigis;
void SiStripProcessedRawDigiProducer::produce(edm::Event& e, const edm::EventSetup& es) {
std::unique_ptr<edm::DetSetVector<SiStripProcessedRawDigi> > output(new edm::DetSetVector<SiStripProcessedRawDigi>());
edm::Handle<edm::DetSetVector<SiStripDigi> > inputDigis;
edm::Handle<edm::DetSetVector<SiStripRawDigi> > inputRawdigis;

es.get<SiStripGainRcd>().get(gainHandle);
subtractorPed->init(es);
subtractorCMN->init(es);

std::string label = findInput(inputRawdigis, inputTokensRawDigi, e);
if( "VirginRaw" == label ) vr_process(*inputRawdigis, *output);
else if( "ProcessedRaw" == label ) pr_process(*inputRawdigis, *output);
else if( "ZeroSuppressed" == findInput(inputDigis, inputTokensDigi, e) ) zs_process(*inputDigis, *output);
if ("VirginRaw" == label)
vr_process(*inputRawdigis, *output);
else if ("ProcessedRaw" == label)
pr_process(*inputRawdigis, *output);
else if ("ZeroSuppressed" == findInput(inputDigis, inputTokensDigi, e))
zs_process(*inputDigis, *output);
else
edm::LogError("Input Not Found");

e.put(std::move(output));
}

template<class T>
inline
std::string SiStripProcessedRawDigiProducer::
findInput(edm::Handle<T>& handle, const std::vector<edm::EDGetTokenT<T> >& tokens, const edm::Event& e ) {

for( typename std::vector<edm::EDGetTokenT<T> >::const_iterator
token = tokens.begin(); token != tokens.end(); ++token ) {
template <class T>
inline std::string SiStripProcessedRawDigiProducer::findInput(edm::Handle<T>& handle,
const std::vector<edm::EDGetTokenT<T> >& tokens,
const edm::Event& e) {
for (typename std::vector<edm::EDGetTokenT<T> >::const_iterator token = tokens.begin(); token != tokens.end();
++token) {
unsigned index(token - tokens.begin());
e.getByToken(*token, handle);
if( handle.isValid() && !handle->empty() ) {
if (handle.isValid() && !handle->empty()) {
edm::LogInfo("Input") << inputTags.at(index);
return inputTags.at(index).instance();
}
}
return "Input Not Found";
}

void SiStripProcessedRawDigiProducer::
zs_process(const edm::DetSetVector<SiStripDigi> & input, edm::DetSetVector<SiStripProcessedRawDigi>& output) {
void SiStripProcessedRawDigiProducer::zs_process(const edm::DetSetVector<SiStripDigi>& input,
edm::DetSetVector<SiStripProcessedRawDigi>& output) {
std::vector<float> digis;
for(edm::DetSetVector<SiStripDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset ) {
for (edm::DetSetVector<SiStripDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
digis.clear();
for(edm::DetSet<SiStripDigi>::const_iterator digi = detset->begin(); digi != detset->end(); ++digi) {
digis.resize( digi->strip(), 0);
digis.push_back( digi->adc() );
for (edm::DetSet<SiStripDigi>::const_iterator digi = detset->begin(); digi != detset->end(); ++digi) {
digis.resize(digi->strip(), 0);
digis.push_back(digi->adc());
}
common_process( detset->id, digis, output);
common_process(detset->id, digis, output);
}
}

void SiStripProcessedRawDigiProducer::
pr_process(const edm::DetSetVector<SiStripRawDigi> & input, edm::DetSetVector<SiStripProcessedRawDigi>& output) {
for(edm::DetSetVector<SiStripRawDigi>::const_iterator detset=input.begin(); detset!=input.end(); ++detset) {
void SiStripProcessedRawDigiProducer::pr_process(const edm::DetSetVector<SiStripRawDigi>& input,
edm::DetSetVector<SiStripProcessedRawDigi>& output) {
for (edm::DetSetVector<SiStripRawDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
std::vector<float> digis;
transform(detset->begin(), detset->end(), back_inserter(digis), boost::bind(&SiStripRawDigi::adc , _1));
transform(detset->begin(), detset->end(), back_inserter(digis), boost::bind(&SiStripRawDigi::adc, _1));
subtractorCMN->subtract(detset->id, 0, digis);
common_process( detset->id, digis, output);
common_process(detset->id, digis, output);
}
}

void SiStripProcessedRawDigiProducer::
vr_process(const edm::DetSetVector<SiStripRawDigi> & input, edm::DetSetVector<SiStripProcessedRawDigi>& output) {
for(edm::DetSetVector<SiStripRawDigi>::const_iterator detset=input.begin(); detset!=input.end(); ++detset) {
void SiStripProcessedRawDigiProducer::vr_process(const edm::DetSetVector<SiStripRawDigi>& input,
edm::DetSetVector<SiStripProcessedRawDigi>& output) {
for (edm::DetSetVector<SiStripRawDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
std::vector<int16_t> int_digis(detset->size());
subtractorPed->subtract(*detset,int_digis);
subtractorPed->subtract(*detset, int_digis);
std::vector<float> digis(int_digis.begin(), int_digis.end());
subtractorCMN->subtract(detset->id, 0, digis);
common_process( detset->id, digis, output);
common_process(detset->id, digis, output);
}
}

void SiStripProcessedRawDigiProducer::
common_process(const uint32_t detId, std::vector<float> & digis, edm::DetSetVector<SiStripProcessedRawDigi>& output) {

void SiStripProcessedRawDigiProducer::common_process(const uint32_t detId,
std::vector<float>& digis,
edm::DetSetVector<SiStripProcessedRawDigi>& output) {
//Apply Gains
SiStripApvGain::Range detGainRange = gainHandle->getRange(detId);
for(std::vector<float>::iterator it=digis.begin(); it<digis.end(); ++it)
(*it)/= (gainHandle->getStripGain(it-digis.begin(), detGainRange));
SiStripApvGain::Range detGainRange = gainHandle->getRange(detId);
for (std::vector<float>::iterator it = digis.begin(); it < digis.end(); ++it)
(*it) /= (gainHandle->getStripGain(it - digis.begin(), detGainRange));

//Insert as DetSet
edm::DetSet<SiStripProcessedRawDigi> ds(detId);
copy(digis.begin(), digis.end(), back_inserter(ds.data) );
copy(digis.begin(), digis.end(), back_inserter(ds.data));
output.insert(ds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,25 @@ class SiStripGain;
class SiStripProcessedRawDigi;

class SiStripProcessedRawDigiProducer : public edm::EDProducer {

public:

public:
explicit SiStripProcessedRawDigiProducer(edm::ParameterSet const&);

private:

private:
void produce(edm::Event& e, const edm::EventSetup& es) override;
template<class T> std::string findInput(edm::Handle<T>& handle, const std::vector<edm::EDGetTokenT<T> >& tokens, const edm::Event& e);
template <class T>
std::string findInput(edm::Handle<T>& handle, const std::vector<edm::EDGetTokenT<T> >& tokens, const edm::Event& e);

void vr_process(const edm::DetSetVector<SiStripRawDigi>&, edm::DetSetVector<SiStripProcessedRawDigi>&);
void pr_process(const edm::DetSetVector<SiStripRawDigi>&, edm::DetSetVector<SiStripProcessedRawDigi>&);
void zs_process(const edm::DetSetVector<SiStripDigi>&, edm::DetSetVector<SiStripProcessedRawDigi>&);
void common_process( const uint32_t, std::vector<float>&, edm::DetSetVector<SiStripProcessedRawDigi>&);

void zs_process(const edm::DetSetVector<SiStripDigi>&, edm::DetSetVector<SiStripProcessedRawDigi>&);
void common_process(const uint32_t, std::vector<float>&, edm::DetSetVector<SiStripProcessedRawDigi>&);

std::vector<edm::InputTag> inputTags;
std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > > inputTokensDigi;
std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > > inputTokensRawDigi;
edm::ESHandle<SiStripGain> gainHandle;

std::unique_ptr<SiStripPedestalsSubtractor> subtractorPed;
std::unique_ptr<SiStripPedestalsSubtractor> subtractorPed;
std::unique_ptr<SiStripCommonModeNoiseSubtractor> subtractorCMN;

};
#endif

93 changes: 45 additions & 48 deletions AnalysisDataFormats/SUSYBSMObjects/interface/HSCPCaloInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,54 @@

namespace susybsm {

class HSCPCaloInfo {
public:
float hcalCrossedEnergy, ecalCrossedEnergy, hoCrossedEnergy;
float ecal3by3dir, ecal5by5dir;
float hcal3by3dir, hcal5by5dir;
float ecalBeta, ecalBetaError;
float ecalDeDx;
float trkIsoDr;
float ecalTime, ecalTimeError;
float ecalInvBetaError;
int ecalCrysCrossed;
std::vector<float> ecalSwissCrossKs;
std::vector<float> ecalE1OverE9s;
std::vector<float> ecalTrackLengths;
std::vector<float> ecalEnergies;
std::vector<float> ecalTimes;
std::vector<float> ecalTimeErrors;
std::vector<float> ecalChi2s;
std::vector<float> ecalOutOfTimeChi2s;
std::vector<float> ecalOutOfTimeEnergies;
std::vector<DetId> ecalDetIds;
std::vector<GlobalPoint> ecalTrackExitPositions;

class HSCPCaloInfo
{
public:
float hcalCrossedEnergy, ecalCrossedEnergy, hoCrossedEnergy;
float ecal3by3dir, ecal5by5dir;
float hcal3by3dir, hcal5by5dir;
float ecalBeta, ecalBetaError;
float ecalDeDx;
float trkIsoDr;
float ecalTime, ecalTimeError;
float ecalInvBetaError;
int ecalCrysCrossed;
std::vector<float> ecalSwissCrossKs;
std::vector<float> ecalE1OverE9s;
std::vector<float> ecalTrackLengths;
std::vector<float> ecalEnergies;
std::vector<float> ecalTimes;
std::vector<float> ecalTimeErrors;
std::vector<float> ecalChi2s;
std::vector<float> ecalOutOfTimeChi2s;
std::vector<float> ecalOutOfTimeEnergies;
std::vector<DetId> ecalDetIds;
std::vector<GlobalPoint> ecalTrackExitPositions;

HSCPCaloInfo()
{
hcalCrossedEnergy = -9999;
ecalCrossedEnergy = -9999;
hoCrossedEnergy = -9999;
ecal3by3dir = -9999;
ecal5by5dir = -9999;
hcal3by3dir = -9999;
hcal5by5dir = -9999;
ecalBeta = -9999;
ecalBetaError = -9999;
ecalDeDx = -9999;
trkIsoDr = -9999;
ecalTime = -9999;
ecalTimeError = -9999;
ecalInvBetaError = -9999;
ecalCrysCrossed = 0;
}
HSCPCaloInfo() {
hcalCrossedEnergy = -9999;
ecalCrossedEnergy = -9999;
hoCrossedEnergy = -9999;
ecal3by3dir = -9999;
ecal5by5dir = -9999;
hcal3by3dir = -9999;
hcal5by5dir = -9999;
ecalBeta = -9999;
ecalBetaError = -9999;
ecalDeDx = -9999;
trkIsoDr = -9999;
ecalTime = -9999;
ecalTimeError = -9999;
ecalInvBetaError = -9999;
ecalCrysCrossed = 0;
}
};

typedef std::vector<HSCPCaloInfo> HSCPCaloInfoCollection;
typedef edm::ValueMap<HSCPCaloInfo> HSCPCaloInfoValueMap;
typedef edm::Ref<HSCPCaloInfoCollection> HSCPCaloInfoRef;
typedef edm::RefProd<HSCPCaloInfoCollection> HSCPCaloInfoRefProd;
typedef edm::RefVector<HSCPCaloInfoCollection> HSCPCaloInfoRefVector;
typedef std::vector<HSCPCaloInfo> HSCPCaloInfoCollection;
typedef edm::ValueMap<HSCPCaloInfo> HSCPCaloInfoValueMap;
typedef edm::Ref<HSCPCaloInfoCollection> HSCPCaloInfoRef;
typedef edm::RefProd<HSCPCaloInfoCollection> HSCPCaloInfoRefProd;
typedef edm::RefVector<HSCPCaloInfoCollection> HSCPCaloInfoRefVector;

}
} // namespace susybsm

#endif
31 changes: 15 additions & 16 deletions AnalysisDataFormats/SUSYBSMObjects/interface/HSCPDeDxInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@

namespace susybsm {

class HSCPDeDxInfo
{
public:
std::vector<float> charges;
std::vector<float> pathlengths;
std::vector<uint32_t> detIds;
std::vector<float> localPosXs;
std::vector<float> localPosYs;
std::vector<uint32_t> clusterIndices;
HSCPDeDxInfo(){}
class HSCPDeDxInfo {
public:
std::vector<float> charges;
std::vector<float> pathlengths;
std::vector<uint32_t> detIds;
std::vector<float> localPosXs;
std::vector<float> localPosYs;
std::vector<uint32_t> clusterIndices;
HSCPDeDxInfo() {}
};

typedef std::vector<HSCPDeDxInfo> HSCPDeDxInfoCollection;
typedef edm::ValueMap<HSCPDeDxInfo> HSCPDeDxInfoValueMap;
typedef edm::Ref<HSCPDeDxInfoCollection> HSCPDeDxInfoRef;
typedef edm::RefProd<HSCPDeDxInfoCollection> HSCPDeDxInfoRefProd;
typedef edm::RefVector<HSCPDeDxInfoCollection> HSCPDeDxInfoRefVector;
}
typedef std::vector<HSCPDeDxInfo> HSCPDeDxInfoCollection;
typedef edm::ValueMap<HSCPDeDxInfo> HSCPDeDxInfoValueMap;
typedef edm::Ref<HSCPDeDxInfoCollection> HSCPDeDxInfoRef;
typedef edm::RefProd<HSCPDeDxInfoCollection> HSCPDeDxInfoRefProd;
typedef edm::RefVector<HSCPDeDxInfoCollection> HSCPDeDxInfoRefVector;
} // namespace susybsm

#endif
Loading

0 comments on commit 5dd8b8d

Please sign in to comment.