#include <EcalSelectiveReadoutSuppressor.h>
Public Types | |
enum | { BARREL, ENDCAP } |
Public Member Functions | |
EcalSelectiveReadoutSuppressor (const edm::ParameterSet ¶ms, const EcalSRSettings *settings) | |
EcalSelectiveReadout * | getEcalSelectiveReadout () |
void | printTTFlags (std::ostream &os, int iEvent=-1, bool withHeader=true) const |
void | run (const edm::EventSetup &eventSetup, const EcalTrigPrimDigiCollection &trigPrims, EBDigiCollection &barrelDigis, EEDigiCollection &endcapDigis) |
void | run (const edm::EventSetup &eventSetup, const EcalTrigPrimDigiCollection &trigPrims, const EBDigiCollection &barrelDigis, const EEDigiCollection &endcapDigis, EBDigiCollection *selectedBarrelDigis, EEDigiCollection *selectedEndcapDigis, EBSrFlagCollection *ebSrFlags, EESrFlagCollection *eeSrFlags) |
void | setElecMap (const EcalElectronicsMapping *map) |
void | setGeometry (const CaloGeometry *caloGeometry) |
void | setTriggerMap (const EcalTrigTowerConstituentsMap *map) |
Static Public Member Functions | |
static int | getFIRTapCount () |
Private Member Functions | |
bool | accept (const edm::DataFrame &frame, int thr) |
template<class T > | |
double | frame2Energy (const T &frame, int timeOffset=0) const |
std::vector< int > | getFIRWeigths () |
int | iEta2cIndex (int iEta) const |
void | initCellThresholds (double barrelLowInterest, double endcapLowInterest, double barrelHighInterest, double endcapHighInterest) |
helpers for constructors | |
int | internalThreshold (double thresholdInGeV, int iSubDet) const |
int | iPhi2cIndex (int iPhi) const |
int | iTTEta2cIndex (int iEta) const |
int | iTTPhi2cIndex (int iPhi) const |
void | setTtFlags (const EcalTrigPrimDigiCollection &trigPrims) |
void | setTtFlags (const edm::EventSetup &eventSetup, const EBDigiCollection &ebDigis, const EEDigiCollection &eeDigis) |
Private Attributes | |
std::vector< int > | actions_ |
EcalSelectiveReadout::ttFlag_t | defaultTtf_ |
std::auto_ptr < EcalSelectiveReadout > | ecalSelectiveReadout |
int | firstFIRSample |
std::vector< int > | firWeights |
int | ievt_ |
int | srFlags [2][8] |
bool | symetricZS |
const EcalTrigTowerConstituentsMap * | theTriggerMap |
double | thrUnit [2] |
bool | trigPrimBypass_ |
double | trigPrimBypassHTH_ |
double | trigPrimBypassLTH_ |
int | trigPrimBypassMode_ |
bool | trigPrimBypassWithPeakFinder_ |
EcalSelectiveReadout::ttFlag_t | ttFlags [nTriggerTowersInEta][nTriggerTowersInPhi] |
bool | ttThresOnCompressedEt_ |
std::vector< float > | weights |
int | zsThreshold [2][8] |
Static Private Attributes | |
static const size_t | nBarrelTriggerTowersInEta = 34 |
static const size_t | nEndcaps = 2 |
static const size_t | nEndcapTriggerTowersInEta = 11 |
static const int | nFIRTaps = 6 |
static const size_t | nTriggerTowersInEta = 2*nEndcapTriggerTowersInEta+nBarrelTriggerTowersInEta |
static const size_t | nTriggerTowersInPhi = 72 |
Definition at line 17 of file EcalSelectiveReadoutSuppressor.h.
anonymous enum |
Definition at line 25 of file EcalSelectiveReadoutSuppressor.h.
EcalSelectiveReadoutSuppressor::EcalSelectiveReadoutSuppressor | ( | const edm::ParameterSet & | params, |
const EcalSRSettings * | settings | ||
) |
Construtor.
params | configuration from python file |
settings | configuration from condition DB |
Definition at line 31 of file EcalSelectiveReadoutSuppressor.cc.
References EcalSRSettings::actions_, actions_, BARREL, EcalSRSettings::dccNormalizedWeights_, defaultTtf_, EcalSRSettings::deltaEta_, EcalSRSettings::deltaPhi_, EcalSRSettings::ebDccAdcToGeV_, EcalSRSettings::ecalDccZs1stSample_, ecalSelectiveReadout, EcalSRSettings::eeDccAdcToGeV_, ENDCAP, Exception, firstFIRSample, edm::ParameterSet::getParameter(), i, initCellThresholds(), EcalSRSettings::srpHighInterestChannelZS_, EcalSRSettings::srpLowInterestChannelZS_, symetricZS, EcalSRSettings::symetricZS_, thrUnit, trigPrimBypass_, trigPrimBypassHTH_, trigPrimBypassLTH_, trigPrimBypassMode_, trigPrimBypassWithPeakFinder_, ttThresOnCompressedEt_, and weights.
: ttThresOnCompressedEt_(false), ievt_(0) { firstFIRSample = settings->ecalDccZs1stSample_[0]; weights = settings->dccNormalizedWeights_[0]; symetricZS = settings->symetricZS_[0]; actions_ = settings->actions_; int defTtf = params.getParameter<int>("defaultTtf"); if(defTtf < 0 || defTtf > 7){ throw cms::Exception("InvalidParameter") << "Value of EcalSelectiveReadoutProducer module parameter defaultTtf, " << defaultTtf_ << ", is out of the valid range 0..7\n"; } else{ defaultTtf_ = (EcalSelectiveReadout::ttFlag_t) defTtf; } //online configuration has only 4 actions flags, the 4 'forced' flags being the same with the force //bit set to 1. Extends the actions vector for case of online-type configuration: if(actions_.size()==4){ for(int i = 0; i < 4; ++i){ actions_.push_back(actions_[i] | 0x4); } } bool actionValid = actions_.size()==8; for(size_t i = 0; i < actions_.size(); ++i){ if(actions_[i] < 0 || actions_[i] > 7) actionValid = false; } if(!actionValid){ throw cms::Exception("InvalidParameter") << "EcalSelectiveReadoutProducer module parameter 'actions' is " "not valid. It must be a vector of 8 integer values comprised between 0 and 7\n"; } double adcToGeV = settings->ebDccAdcToGeV_; thrUnit[BARREL] = adcToGeV/4.; //unit=1/4th ADC count adcToGeV = settings->eeDccAdcToGeV_; thrUnit[ENDCAP] = adcToGeV/4.; //unit=1/4th ADC count ecalSelectiveReadout = auto_ptr<EcalSelectiveReadout>(new EcalSelectiveReadout( settings->deltaEta_[0], settings->deltaPhi_[0])); const int eb = 0; const int ee = 1; initCellThresholds(settings->srpLowInterestChannelZS_[eb], settings->srpLowInterestChannelZS_[ee], settings->srpHighInterestChannelZS_[eb], settings->srpHighInterestChannelZS_[ee] ); trigPrimBypass_ = params.getParameter<bool>("trigPrimBypass"); trigPrimBypassMode_ = params.getParameter<int>("trigPrimBypassMode"); trigPrimBypassWithPeakFinder_ = params.getParameter<bool>("trigPrimBypassWithPeakFinder"); trigPrimBypassLTH_ = params.getParameter<double>("trigPrimBypassLTH"); trigPrimBypassHTH_ = params.getParameter<double>("trigPrimBypassHTH"); if(trigPrimBypass_){ edm::LogWarning("Digitization") << "Beware a simplified trigger primitive " "computation is used for the ECAL selective readout"; if(trigPrimBypassMode_ !=0 && trigPrimBypassMode_ !=1){ throw cms::Exception("InvalidParameter") << "Invalid value for EcalSelectiveReadoutProducer parameter 'trigPrimBypassMode_'." " Valid values are 0 and 1.\n"; } ttThresOnCompressedEt_ = (trigPrimBypassMode_==1); } }
bool EcalSelectiveReadoutSuppressor::accept | ( | const edm::DataFrame & | frame, |
int | thr | ||
) | [private] |
Returns true if a digi passes the zero suppression.
frame,data | frame (aka digi). |
thr | zero suppression threshold in thrUnit. |
Definition at line 216 of file EcalSelectiveReadoutSuppressor.cc.
References EcalMGPASample::adc(), firstFIRSample, EcalMGPASample::gainId(), getFIRWeigths(), nFIRTaps, query::result, compare_using_db::sample, edm::DataFrame::size(), symetricZS, and w().
Referenced by run().
{ //FIR filter weights: const vector<int>& w = getFIRWeigths(); //accumulator used to compute weighted sum of samples int acc = 0; bool gain12saturated = false; const int gain12 = 0x01; const int lastFIRSample = firstFIRSample + nFIRTaps - 1; //LogDebug("DccFir") << "DCC FIR operation: "; int iWeight = 0; for(int iSample=firstFIRSample-1; iSample<lastFIRSample; ++iSample, ++iWeight){ if(iSample>=0 && iSample < (int)frame.size()){ EcalMGPASample sample(frame[iSample]); if(sample.gainId()!=gain12) gain12saturated = true; //LogTrace("DccFir") << (iSample>=firstFIRSample?"+":"") << sample.adc() // << "*(" << w[iWeight] << ")"; acc+=sample.adc()*w[iWeight]; } else{ edm::LogWarning("DccFir") << __FILE__ << ":" << __LINE__ << ": Not enough samples in data frame or 'ecalDccZs1stSample' module " "parameter is not valid..."; } } if(symetricZS){//cut on absolute value if(acc<0) acc = -acc; } //LogTrace("DccFir") << "\n"; //discards the 8 LSBs //(result of shift operator on negative numbers depends on compiler //implementation, therefore the value is offset to make sure it is positive //before performing the bit shift). acc = ((acc + (1<<30)) >>8) - (1 <<(30-8)); //ZS passed if weigthed sum acc above ZS threshold or if //one sample has a lower gain than gain 12 (that is gain 12 output //is saturated) const bool result = (acc >= thr) || gain12saturated; //LogTrace("DccFir") << "acc: " << acc << "\n" // << "threshold: " << thr << " (" // << thr*thrUnit[((EcalDataFrame&)frame).id().subdetId()==EcalBarrel?0:1] // << "GeV)\n" // << "saturated: " << (gain12saturated?"yes":"no") << "\n" // << "ZS passed: " << (result?"yes":"no") // << (symetricZS?" (symetric cut)":"") << "\n"; return result; }
double EcalSelectiveReadoutSuppressor::frame2Energy | ( | const T & | frame, |
int | timeOffset = 0 |
||
) | const [private] |
Definition at line 560 of file EcalSelectiveReadoutSuppressor.cc.
References dtNoiseDBValidation_cfg::cerr, i, n, evf::evtn::offset(), and weights.
Referenced by setTtFlags().
{ //we have to start by 0 in order to handle offset=-1 //(however Fenix FIR has AFAK only 5 taps) double weights[] = {0., -1/3., -1/3., -1/3., 0., 1.}; double adc2GeV = 0.; if(typeid(frame) == typeid(EBDataFrame)){ adc2GeV = 0.035; } else if(typeid(frame) == typeid(EEDataFrame)){ adc2GeV = 0.060; } else{ //T is an invalid type! //TODO: replace message by a cms exception cerr << "Severe error. " << __FILE__ << ":" << __LINE__ << ": " << "this is a bug. Please report it.\n"; } double acc = 0; const int n = min<int>(frame.size(), sizeof(weights)/sizeof(weights[0])); double gainInv[] = {12., 1., 6., 12.}; //cout << __PRETTY_FUNCTION__ << ": "; for(int i=offset; i < n; ++i){ int iframe = i + offset; if(iframe>=0 && iframe<frame.size()){ acc += weights[i]*frame[iframe].adc() *gainInv[frame[iframe].gainId()]*adc2GeV; //cout << (iframe>offset?"+":"") // << frame[iframe].adc() << "*" << gainInv[frame[iframe].gainId()] // << "*" << adc2GeV << "*(" << weights[i] << ")"; } } //cout << "\n"; return acc; }
EcalSelectiveReadout* EcalSelectiveReadoutSuppressor::getEcalSelectiveReadout | ( | ) | [inline] |
For debugging purposes.
Definition at line 84 of file EcalSelectiveReadoutSuppressor.h.
References ecalSelectiveReadout.
{ return ecalSelectiveReadout.get(); }
static int EcalSelectiveReadoutSuppressor::getFIRTapCount | ( | ) | [inline, static] |
Gets number of weights supported by the zero suppression filter
Definition at line 30 of file EcalSelectiveReadoutSuppressor.h.
References nFIRTaps.
Referenced by EcalSelectiveReadoutProducer::checkWeights().
{ return nFIRTaps;}
vector< int > EcalSelectiveReadoutSuppressor::getFIRWeigths | ( | ) | [private] |
Gets the integer weights used by the zero suppression FIR filter.
<U>Weight definitions:</U>
If a FIR weights exceeds the (2**12-1) absolute value limit, its absolute value is replaced by (2**12-1).
Definition at line 438 of file EcalSelectiveReadoutSuppressor.cc.
References abs, firWeights, i, min, nFIRTaps, and weights.
Referenced by accept().
{ if(firWeights.size()==0){ firWeights = vector<int>(nFIRTaps, 0); //default weight: 0; const static int maxWeight = 0xEFF; //weights coded on 11+1 signed bits for(unsigned i=0; i < min((size_t)nFIRTaps,weights.size()); ++i){ firWeights[i] = lround(weights[i] * (1<<10)); if(abs(firWeights[i])>maxWeight){//overflow firWeights[i] = firWeights[i]<0?-maxWeight:maxWeight; } } } return firWeights; }
int EcalSelectiveReadoutSuppressor::iEta2cIndex | ( | int | iEta | ) | const [inline, private] |
Transforms CMSSW eta ECAL crystal indices to indices starting at 0 to use for c-array or vector.
iEta | CMSSW eta index (numbering -85...-1,1...85) |
Definition at line 145 of file EcalSelectiveReadoutSuppressor.h.
{
return (iEta<0)?iEta+85:iEta+84;
}
void EcalSelectiveReadoutSuppressor::initCellThresholds | ( | double | barrelLowInterest, |
double | endcapLowInterest, | ||
double | barrelHighInterest, | ||
double | endcapHighInterest | ||
) | [private] |
helpers for constructors
Initializes ZS threshold and SR classificion to SR ("action") flags
Definition at line 122 of file EcalSelectiveReadoutSuppressor.cc.
References actions_, BARREL, ENDCAP, EcalSelectiveReadout::FORCED_MASK, i, internalThreshold(), max(), min, srFlags, and zsThreshold.
Referenced by EcalSelectiveReadoutSuppressor().
{ //center, neighbour and single RUs are grouped into a single //'high interest' group int lowInterestThr[2]; //index for BARREL/ENDCAP // int lowInterestSrFlag[2]; int highInterestThr[2]; // int highInterestSrFlag[2]; lowInterestThr[BARREL] = internalThreshold(barrelLowInterest, BARREL); // lowInterestSrFlag[BARREL] = thr2Srf(lowInterestThr[BARREL], // EcalSrFlag::SRF_ZS1); highInterestThr[BARREL] = internalThreshold(barrelHighInterest, BARREL); // highInterestSrFlag[BARREL] = thr2Srf(highInterestThr[BARREL], // EcalSrFlag::SRF_ZS2); lowInterestThr[ENDCAP] = internalThreshold(endcapLowInterest, ENDCAP); //lowInterestSrFlag[ENDCAP] = thr2Srf(lowInterestThr[ENDCAP], // EcalSrFlag::SRF_ZS1); highInterestThr[ENDCAP] = internalThreshold(endcapHighInterest, ENDCAP); // highInterestSrFlag[ENDCAP] = thr2Srf(highInterestThr[ENDCAP], // EcalSrFlag::SRF_ZS2); const int FORCED_MASK = EcalSelectiveReadout::FORCED_MASK; for(int iSubDet = 0; iSubDet<2; ++iSubDet){ //low interest //zsThreshold[iSubDet][0] = lowInterestThr[iSubDet]; //srFlags[iSubDet][0] = lowInterestSrFlag[iSubDet]; //srFlags[iSubDet][0 + FORCED_MASK] = FORCED_MASK | lowInterestSrFlag[iSubDet]; //single->high interest //zsThreshold[iSubDet][1] = highInterestThr[iSubDet]; //srFlags[iSubDet][1] = highInterestSrFlag[iSubDet]; //srFlags[iSubDet][1 + FORCED_MASK] = FORCED_MASK | highInterestSrFlag[iSubDet]; //neighbour->high interest //zsThreshold[iSubDet][2] = highInterestThr[iSubDet]; //srFlags[iSubDet][2] = highInterestSrFlag[iSubDet]; //srFlags[iSubDet][2 + FORCED_MASK] = FORCED_MASK | highInterestSrFlag[iSubDet]; //center->high interest //zsThreshold[iSubDet][3] = highInterestThr[iSubDet]; //srFlags[iSubDet][3] = highInterestSrFlag[iSubDet]; //srFlags[iSubDet][3 + FORCED_MASK] = FORCED_MASK | highInterestSrFlag[iSubDet]; for(size_t i = 0; i < 8; ++i){ srFlags[iSubDet][i] = actions_[i]; if((actions_[i] & ~FORCED_MASK) == 0) zsThreshold[iSubDet][i] = numeric_limits<int>::max(); else if((actions_[i] & ~FORCED_MASK) == 1) zsThreshold[iSubDet][i] = lowInterestThr[iSubDet]; else if((actions_[i] & ~FORCED_MASK) == 2) zsThreshold[iSubDet][i] = highInterestThr[iSubDet]; else zsThreshold[iSubDet][i] = numeric_limits<int>::min(); } // for(size_t i = 0; i < 8; ++i){ // cout << "zsThreshold[" << iSubDet << "][" << i << "] = " << zsThreshold[iSubDet][i] << endl; // } } }
int EcalSelectiveReadoutSuppressor::internalThreshold | ( | double | thresholdInGeV, |
int | iSubDet | ||
) | const [private] |
Converts threshold in GeV to threshold in internal unit used by the ZS FIR.
thresholdInGeV | the theshold in GeV |
iSubDet | 0 for barrel, 1 for endcap |
Definition at line 195 of file EcalSelectiveReadoutSuppressor.cc.
References max(), min, and thrUnit.
Referenced by initCellThresholds().
{ double thr_ = thresholdInGeV / thrUnit[iSubDet]; //treating over- and underflows, threshold is coded on 11+1 signed bits //an underflow threshold is considered here as if NoRO DCC switch is on //an overflow threshold is considered here as if ForcedRO DCC switch in on //Beware that conparison must be done on a double type, because conversion //cast to an int of a double higher than MAX_INT is undefined. int thr; if(thr_>=0x7FF+.5){ thr = numeric_limits<int>::max(); } else if(thr_<=-0x7FF-.5){ thr = numeric_limits<int>::min(); } else{ thr = lround(thr_); } return thr; }
int EcalSelectiveReadoutSuppressor::iPhi2cIndex | ( | int | iPhi | ) | const [inline, private] |
Transforms CMSSW phi ECAL crystal indices to indices starting at 0 to use for c-array or vector.
iPhi | CMSSW phi index (numbering 1...360) |
Definition at line 154 of file EcalSelectiveReadoutSuppressor.h.
{
return iPhi-1;
}
int EcalSelectiveReadoutSuppressor::iTTEta2cIndex | ( | int | iEta | ) | const [inline, private] |
Transforms CMSSW eta ECAL TT indices to indices starting at 0 to use for c-array or vector.
iEta | CMSSW eta index (numbering -28...-1,28...56) |
Definition at line 163 of file EcalSelectiveReadoutSuppressor.h.
Referenced by setTtFlags().
{
return (iEta<0)?iEta+28:iEta+27;
}
int EcalSelectiveReadoutSuppressor::iTTPhi2cIndex | ( | int | iPhi | ) | const [inline, private] |
Transforms CMSSW phi ECAL crystal indices to indices starting at 0 to use for c-array or vector.
iPhi | CMSSW phi index (numbering 1...72) |
Definition at line 172 of file EcalSelectiveReadoutSuppressor.h.
Referenced by setTtFlags().
{
return iPhi-1;
}
void EcalSelectiveReadoutSuppressor::printTTFlags | ( | std::ostream & | os, |
int | iEvent = -1 , |
||
bool | withHeader = true |
||
) | const |
Writes out TT flags. On of the 'run' method must be called beforehand. Beware this method might be removed in future.
os | stream to write to |
iEvent | event index. Ignored if <0. |
withHeader. | If true writes out a header with the legend. |
void EcalSelectiveReadoutSuppressor::run | ( | const edm::EventSetup & | eventSetup, |
const EcalTrigPrimDigiCollection & | trigPrims, | ||
EBDigiCollection & | barrelDigis, | ||
EEDigiCollection & | endcapDigis | ||
) |
Runs the selective readout(SR) algorithm.
eventSetup | event conditions |
trigPrims | the ECAL trigger primitives used as input to the SR. |
barrelDigis | [in,out] the EB digi collection to filter |
endcapDigis | [in,out] the EE digi collection to filter |
Definition at line 271 of file EcalSelectiveReadoutSuppressor.cc.
References EBDigiCollection::swap(), and EEDigiCollection::swap().
{ EBDigiCollection selectedBarrelDigis; EEDigiCollection selectedEndcapDigis; run(eventSetup, trigPrims, barrelDigis, endcapDigis, &selectedBarrelDigis, &selectedEndcapDigis, 0, 0); //replaces the input with the suppressed version barrelDigis.swap(selectedBarrelDigis); endcapDigis.swap(selectedEndcapDigis); }
void EcalSelectiveReadoutSuppressor::run | ( | const edm::EventSetup & | eventSetup, |
const EcalTrigPrimDigiCollection & | trigPrims, | ||
const EBDigiCollection & | barrelDigis, | ||
const EEDigiCollection & | endcapDigis, | ||
EBDigiCollection * | selectedBarrelDigis, | ||
EEDigiCollection * | selectedEndcapDigis, | ||
EBSrFlagCollection * | ebSrFlags, | ||
EESrFlagCollection * | eeSrFlags | ||
) |
Runs the selective readout (SR) algorithm.
eventSetup | event conditions |
trigPrims | the ECAL trigger primitives used as input to the SR. |
barrelDigis | the input EB digi collection |
endcapDigis | the input EE digi collection |
selectedBarrelDigis | [out] the EB digi passing the SR. Pointer to the collection to fill. If null, no collection is filled. |
selectedEndcapDigis | [out] the EE digi passing the SR. Pointer to the collection to fill. If null, no collection is filled. |
ebSrFlags | [out] the computed SR flags for EB. Pointer to the collection to fill. If null, no collection is filled. |
eeSrFlags | [out] the computed SR flags for EE. Pointer to the collection to fill. If null, no collection is filled. |
Definition at line 288 of file EcalSelectiveReadoutSuppressor.cc.
References accept(), BARREL, edm::DataFrameContainer::begin(), EcalBarrel, ecalSelectiveReadout, edm::DataFrameContainer::end(), ENDCAP, Exception, errorMatrix2Lands_multiChannel::id, ievt_, LogDebug, nBarrelTriggerTowersInEta, nTriggerTowersInPhi, edm::DataFrameContainer::push_back(), edm::SortedCollection< T, SORT >::push_back(), edm::SortedCollection< T, SORT >::reserve(), edm::DataFrameContainer::reserve(), setTtFlags(), edm::DataFrameContainer::size(), srFlags, trigPrimBypass_, ttFlags, ttThresOnCompressedEt_, EcalScDetId::validDetId(), and zsThreshold.
{ ++ievt_; if(!trigPrimBypass_ || ttThresOnCompressedEt_){//uses output of TPG emulator setTtFlags(trigPrims); } else{//debug mode, run w/o TP digis setTtFlags(eventSetup, barrelDigis, endcapDigis); } ecalSelectiveReadout->runSelectiveReadout0(ttFlags); if(selectedBarrelDigis){ selectedBarrelDigis->reserve(barrelDigis.size()/20); // do barrel first for(EBDigiCollection::const_iterator digiItr = barrelDigis.begin(); digiItr != barrelDigis.end(); ++digiItr){ int interestLevel = ecalSelectiveReadout->getCrystalInterest(EBDigiCollection::DetId(digiItr->id())) && ~EcalSelectiveReadout::FORCED_MASK; if(accept(*digiItr, zsThreshold[BARREL][interestLevel])){ selectedBarrelDigis->push_back(digiItr->id(), digiItr->begin()); } } } // and endcaps if(selectedEndcapDigis){ selectedEndcapDigis->reserve(endcapDigis.size()/20); for(EEDigiCollection::const_iterator digiItr = endcapDigis.begin(); digiItr != endcapDigis.end(); ++digiItr){ int interestLevel = ecalSelectiveReadout->getCrystalInterest(EEDigiCollection::DetId(digiItr->id())) & ~EcalSelectiveReadout::FORCED_MASK; if(accept(*digiItr, zsThreshold[ENDCAP][interestLevel])){ selectedEndcapDigis->push_back(digiItr->id(), digiItr->begin()); } } } if(ievt_ <= 10){ if(selectedEndcapDigis) LogDebug("EcalSelectiveReadout") // << __FILE__ << ":" << __LINE__ << ": " << "Number of EB digis passing the SR: " << selectedBarrelDigis->size() << " / " << barrelDigis.size() << "\n"; if(selectedEndcapDigis) LogDebug("EcalSelectiveReadout") // << __FILE__ << ":" << __LINE__ << ": " << "\nNumber of EE digis passing the SR: " << selectedEndcapDigis->size() << " / " << endcapDigis.size() << "\n"; } if(ebSrFlags) ebSrFlags->reserve(34*72); if(eeSrFlags) eeSrFlags->reserve(624); //SR flags: for(int iZ = -1; iZ <=1; iZ+=2){ //-1=>EE-, EB-, +1=>EE+, EB+ //barrel: for(unsigned iEta = 1; iEta <= nBarrelTriggerTowersInEta/2; ++iEta){ for(unsigned iPhi = 1; iPhi <= nTriggerTowersInPhi; ++iPhi){ const EcalTrigTowerDetId id(iZ, EcalBarrel, iEta, iPhi); EcalSelectiveReadout::towerInterest_t interest = ecalSelectiveReadout->getTowerInterest(id); if(interest<0){ throw cms::Exception("EcalSelectiveReadout") << __FILE__ << ":" << __LINE__ << ": " << "unknown SR flag. for " << " TT " << id << ". Most probably a bug."; } int flag; // if(interest==EcalSelectiveReadout::FORCED_RO){ // flag = EcalSrFlag::SRF_FORCED_MASK | EcalSrFlag::SRF_FULL; //} else{ flag = srFlags[BARREL][interest]; //} if(ebSrFlags) ebSrFlags->push_back(EBSrFlag(id, flag)); }//next iPhi } //next barrel iEta //endcap: EcalScDetId id; for(int iX = 1; iX <= 20; ++iX){ for(int iY = 1; iY <= 20; ++iY){ if (EcalScDetId::validDetId(iX, iY, iZ)) id = EcalScDetId(iX, iY, iZ); else continue; EcalSelectiveReadout::towerInterest_t interest = ecalSelectiveReadout->getSuperCrystalInterest(id); if(interest>=0){//negative no SC at (iX,iY) coordinates int flag; // if(interest==EcalSelectiveReadout::FORCED_RO){ // flag = EcalSrFlag::SRF_FORCED_MASK | EcalSrFlag::SRF_FULL; //} else{ flag = srFlags[ENDCAP][interest]; //} if(eeSrFlags) eeSrFlags->push_back(EESrFlag(id, flag)); } else if(iX < 9 || iX > 12 || iY < 9 || iY >12){ //not an inner partial SC edm::LogError("EcalSelectiveReadout") << __FILE__ << ":" << __LINE__ << ": " << "negative interest in EE for SC " << id << "\n"; } } //next iY } //next iX } }
void EcalSelectiveReadoutSuppressor::setElecMap | ( | const EcalElectronicsMapping * | map | ) |
Set the ECAL electronics mapping
map | the ECAL electronics map |
Definition at line 109 of file EcalSelectiveReadoutSuppressor.cc.
References ecalSelectiveReadout.
{ ecalSelectiveReadout->setElecMap(map); }
void EcalSelectiveReadoutSuppressor::setGeometry | ( | const CaloGeometry * | caloGeometry | ) |
Sets the geometry of the calorimeters
Definition at line 114 of file EcalSelectiveReadoutSuppressor.cc.
References ecalSelectiveReadout.
{ #ifndef ECALSELECTIVEREADOUT_NOGEOM ecalSelectiveReadout->setGeometry(caloGeometry); #endif }
void EcalSelectiveReadoutSuppressor::setTriggerMap | ( | const EcalTrigTowerConstituentsMap * | map | ) |
Set the mapping of which cell goes with which trigger tower
map | the trigger tower map |
Definition at line 104 of file EcalSelectiveReadoutSuppressor.cc.
References ecalSelectiveReadout, Association::map, and theTriggerMap.
{ theTriggerMap = map; ecalSelectiveReadout->setTriggerMap(map); }
void EcalSelectiveReadoutSuppressor::setTtFlags | ( | const EcalTrigPrimDigiCollection & | trigPrims | ) | [private] |
Help function to set the srFlags field.
trigPrim | the trigger primitive digi collection |
Definition at line 403 of file EcalSelectiveReadoutSuppressor.cc.
References edm::SortedCollection< T, SORT >::begin(), defaultTtf_, edm::SortedCollection< T, SORT >::end(), nTriggerTowersInEta, nTriggerTowersInPhi, trigPrimBypassHTH_, trigPrimBypassLTH_, EcalSelectiveReadout::TTF_HIGH_INTEREST, EcalSelectiveReadout::TTF_LOW_INTEREST, EcalSelectiveReadout::TTF_MID_INTEREST, ttFlags, and ttThresOnCompressedEt_.
{ for(size_t iEta0 = 0; iEta0 < nTriggerTowersInEta; ++iEta0){ for(size_t iPhi0 = 0; iPhi0 < nTriggerTowersInPhi; ++iPhi0){ ttFlags[iEta0][iPhi0] = defaultTtf_; } } for(EcalTrigPrimDigiCollection::const_iterator trigPrim = trigPrims.begin(); trigPrim != trigPrims.end(); ++trigPrim){ int iEta = trigPrim->id().ieta(); unsigned int iEta0; if(iEta<0){ //z- half ECAL: transforming ranges -28;-1 => 0;27 iEta0 = iEta + nTriggerTowersInEta/2; } else{ //z+ halfECAL: transforming ranges 1;28 => 28;55 iEta0 = iEta + nTriggerTowersInEta/2 - 1; } unsigned int iPhi0 = trigPrim->id().iphi() - 1; if(!ttThresOnCompressedEt_){ ttFlags[iEta0][iPhi0] = (EcalSelectiveReadout::ttFlag_t) trigPrim->ttFlag(); } else{ int compressedEt = trigPrim->compressedEt(); if(compressedEt < trigPrimBypassLTH_){ ttFlags[iEta0][iPhi0] = EcalSelectiveReadout::TTF_LOW_INTEREST; } else if(compressedEt < trigPrimBypassHTH_){ ttFlags[iEta0][iPhi0] = EcalSelectiveReadout::TTF_MID_INTEREST; } else{ ttFlags[iEta0][iPhi0] = EcalSelectiveReadout::TTF_HIGH_INTEREST; } } } }
void EcalSelectiveReadoutSuppressor::setTtFlags | ( | const edm::EventSetup & | eventSetup, |
const EBDigiCollection & | ebDigis, | ||
const EEDigiCollection & | eeDigis | ||
) | [private] |
Help function to set the srFlags field. Used in TrigPrimByPass mode
eventSetup | the EDM event setup |
ebDigi | the ECAL barrel APD digis |
eeDigi | the ECAL endcap VPT digis |
Definition at line 453 of file EcalSelectiveReadoutSuppressor.cc.
References edm::DataFrameContainer::begin(), alignCSCRings::e, DetId::Ecal, EcalBarrel, EcalEndcap, edm::DataFrameContainer::end(), frame2Energy(), edm::EventSetup::get(), CaloSubdetectorGeometry::getGeometry(), EBDataFrame::id(), EEDataFrame::id(), EcalTrigTowerDetId::ieta(), EcalTrigTowerDetId::iphi(), iTTEta2cIndex(), iTTPhi2cIndex(), nTriggerTowersInEta, nTriggerTowersInPhi, funct::sin(), theta(), theTriggerMap, EcalTrigTowerConstituentsMap::towerOf(), trigPrimBypassHTH_, trigPrimBypassLTH_, trigPrimBypassWithPeakFinder_, EcalSelectiveReadout::TTF_HIGH_INTEREST, EcalSelectiveReadout::TTF_LOW_INTEREST, EcalSelectiveReadout::TTF_MID_INTEREST, ttFlags, and ecaldqm::ttId().
Referenced by run().
{ double trigPrim[nTriggerTowersInEta][nTriggerTowersInPhi]; //ecal geometry: // static const CaloSubdetectorGeometry* eeGeometry = 0; // static const CaloSubdetectorGeometry* ebGeometry = 0; const CaloSubdetectorGeometry* eeGeometry = 0; const CaloSubdetectorGeometry* ebGeometry = 0; // if(eeGeometry==0 || ebGeometry==0){ edm::ESHandle<CaloGeometry> geoHandle; es.get<CaloGeometryRecord>().get(geoHandle); eeGeometry = (*geoHandle).getSubdetectorGeometry(DetId::Ecal, EcalEndcap); ebGeometry = (*geoHandle).getSubdetectorGeometry(DetId::Ecal, EcalBarrel); // } //init trigPrim array: bzero(trigPrim, sizeof(trigPrim)); for(EBDigiCollection::const_iterator it = ebDigis.begin(); it != ebDigis.end(); ++it){ EBDataFrame frame(*it); const EcalTrigTowerDetId& ttId = theTriggerMap->towerOf(frame.id()); // edm:::LogDebug("TT") << __FILE__ << ":" << __LINE__ << ": " // << ((EBDetId&)frame.id()).ieta() // << "," << ((EBDetId&)frame.id()).iphi() // << " -> " << ttId.ieta() << "," << ttId.iphi() << "\n"; const int iTTEta0 = iTTEta2cIndex(ttId.ieta()); const int iTTPhi0 = iTTPhi2cIndex(ttId.iphi()); double theta = ebGeometry->getGeometry(frame.id())->getPosition().theta(); double e = frame2Energy(frame); if(!trigPrimBypassWithPeakFinder_ || ((frame2Energy(frame,-1) < e) && (frame2Energy(frame, 1) < e))){ trigPrim[iTTEta0][iTTPhi0] += e*sin(theta); } } for(EEDigiCollection::const_iterator it = eeDigis.begin(); it != eeDigis.end(); ++it){ EEDataFrame frame(*it); const EcalTrigTowerDetId& ttId = theTriggerMap->towerOf(frame.id()); const int iTTEta0 = iTTEta2cIndex(ttId.ieta()); const int iTTPhi0 = iTTPhi2cIndex(ttId.iphi()); // cout << __FILE__ << ":" << __LINE__ << ": EE xtal->TT " // << ((EEDetId&)frame.id()).ix() // << "," << ((EEDetId&)frame.id()).iy() // << " -> " << ttId.ieta() << "," << ttId.iphi() << "\n"; double theta = eeGeometry->getGeometry(frame.id())->getPosition().theta(); double e = frame2Energy(frame); if(!trigPrimBypassWithPeakFinder_ || ((frame2Energy(frame,-1) < e) && (frame2Energy(frame, 1) < e))){ trigPrim[iTTEta0][iTTPhi0] += e*sin(theta); } } //dealing with pseudo-TT in two inner EE eta-ring: int innerTTEtas[] = {0, 1, 54, 55}; for(unsigned iRing = 0; iRing < sizeof(innerTTEtas)/sizeof(innerTTEtas[0]); ++iRing){ int iTTEta0 = innerTTEtas[iRing]; //this detector eta-section is divided in only 36 phi bins //For this eta regions, //current tower eta numbering scheme is inconsistent. For geometry //version 133: //- TT are numbered from 0 to 72 for 36 bins //- some TT have an even index, some an odd index //For geometry version 125, there are 72 phi bins. //The code below should handle both geometry definition. //If there are 72 input trigger primitives for each inner eta-ring, //then the average of the trigger primitive of the two pseudo-TT of //a pair (nEta, nEta+1) is taken as Et of both pseudo TTs. //If there are only 36 input TTs for each inner eta ring, then half //of the present primitive of a pseudo TT pair is used as Et of both //pseudo TTs. for(unsigned iTTPhi0 = 0; iTTPhi0 < nTriggerTowersInPhi-1; iTTPhi0 += 2){ double et = .5*(trigPrim[iTTEta0][iTTPhi0] +trigPrim[iTTEta0][iTTPhi0+1]); //divides the TT into 2 phi bins in order to match with 72 phi-bins SRP //scheme or average the Et on the two pseudo TTs if the TT is already //divided into two trigger primitives. trigPrim[iTTEta0][iTTPhi0] = et; trigPrim[iTTEta0][iTTPhi0+1] = et; } } for(unsigned iTTEta0 = 0; iTTEta0 < nTriggerTowersInEta; ++iTTEta0){ for(unsigned iTTPhi0 = 0; iTTPhi0 < nTriggerTowersInPhi; ++iTTPhi0){ if(trigPrim[iTTEta0][iTTPhi0] > trigPrimBypassHTH_){ ttFlags[iTTEta0][iTTPhi0] = EcalSelectiveReadout::TTF_HIGH_INTEREST; } else if(trigPrim[iTTEta0][iTTPhi0] > trigPrimBypassLTH_){ ttFlags[iTTEta0][iTTPhi0] = EcalSelectiveReadout::TTF_MID_INTEREST; } else{ ttFlags[iTTEta0][iTTPhi0] = EcalSelectiveReadout::TTF_LOW_INTEREST; } // cout /*LogDebug("TT")*/ // << "ttFlags[" << iTTEta0 << "][" << iTTPhi0 << "] = " // << ttFlags[iTTEta0][iTTPhi0] << "\n"; } } }
std::vector<int> EcalSelectiveReadoutSuppressor::actions_ [private] |
SR flag (low interest/single/neighbor/center) to action flag (suppress, ZS1, ZS2, FRO) map.
Definition at line 285 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutSuppressor(), and initCellThresholds().
Default TTF to substitute if absent from the trigger primitive collection
Definition at line 319 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutSuppressor(), and setTtFlags().
std::auto_ptr<EcalSelectiveReadout> EcalSelectiveReadoutSuppressor::ecalSelectiveReadout [private] |
Help class to comput selective readout flags.
Definition at line 227 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutSuppressor(), getEcalSelectiveReadout(), run(), setElecMap(), setGeometry(), and setTriggerMap().
int EcalSelectiveReadoutSuppressor::firstFIRSample [private] |
Time position of the first sample to use in zero suppession FIR filter. Numbering starts at 0.
Definition at line 238 of file EcalSelectiveReadoutSuppressor.h.
Referenced by accept(), and EcalSelectiveReadoutSuppressor().
std::vector<int> EcalSelectiveReadoutSuppressor::firWeights [private] |
Weights of zero suppression FIR filter
Definition at line 242 of file EcalSelectiveReadoutSuppressor.h.
Referenced by getFIRWeigths().
int EcalSelectiveReadoutSuppressor::ievt_ [private] |
Number of produced events
Definition at line 323 of file EcalSelectiveReadoutSuppressor.h.
Referenced by run().
const size_t EcalSelectiveReadoutSuppressor::nBarrelTriggerTowersInEta = 34 [static, private] |
Number of eta trigger tower divisions in the barrel.
Definition at line 213 of file EcalSelectiveReadoutSuppressor.h.
Referenced by run().
const size_t EcalSelectiveReadoutSuppressor::nEndcaps = 2 [static, private] |
Help function to get SR flag from ZS threshold using min/max convention for SUPPRESS and FULL_READOUT: see zsThreshold.
thr | ZS threshold in thrUnit |
flag | for Zero suppression: EcalSrFlag::SRF_ZS1 or EcalSrFlag::SRF_ZS2 |
Definition at line 205 of file EcalSelectiveReadoutSuppressor.h.
const size_t EcalSelectiveReadoutSuppressor::nEndcapTriggerTowersInEta = 11 [static, private] |
Number of eta trigger tower divisions in one endcap.
Definition at line 209 of file EcalSelectiveReadoutSuppressor.h.
const int EcalSelectiveReadoutSuppressor::nFIRTaps = 6 [static, private] |
Depth of DCC zero suppression FIR filter (number of taps), in principal 6.
Definition at line 247 of file EcalSelectiveReadoutSuppressor.h.
Referenced by accept(), getFIRTapCount(), and getFIRWeigths().
const size_t EcalSelectiveReadoutSuppressor::nTriggerTowersInEta = 2*nEndcapTriggerTowersInEta+nBarrelTriggerTowersInEta [static, private] |
Number of eta divisions in trigger towers for the whole ECAL
Definition at line 218 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutProducer::printTTFlags(), and setTtFlags().
const size_t EcalSelectiveReadoutSuppressor::nTriggerTowersInPhi = 72 [static, private] |
Number of phi divisions in trigger towers.
Definition at line 222 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutProducer::printTTFlags(), run(), and setTtFlags().
int EcalSelectiveReadoutSuppressor::srFlags[2][8] [private] |
Maps RU interest flag (low interest, single neighbour, center) to Selective readout action flag (type of readout). 1st index: 0 for barrel, 1 for endcap 2nd index: RU interest (low, single, neighbour, center, forced low, forced single...)
Definition at line 315 of file EcalSelectiveReadoutSuppressor.h.
Referenced by initCellThresholds(), and run().
bool EcalSelectiveReadoutSuppressor::symetricZS [private] |
Flag to use a symetric zero suppression (cut on absolute value)
Definition at line 255 of file EcalSelectiveReadoutSuppressor.h.
Referenced by accept(), and EcalSelectiveReadoutSuppressor().
Definition at line 229 of file EcalSelectiveReadoutSuppressor.h.
Referenced by setTriggerMap(), and setTtFlags().
double EcalSelectiveReadoutSuppressor::thrUnit[2] [private] |
Internal unit for Zero Suppression threshold (1/4th ADC count) used by the FIR. Index: 0 for barrel, 1 for endcap
Definition at line 269 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutSuppressor(), and internalThreshold().
bool EcalSelectiveReadoutSuppressor::trigPrimBypass_ [private] |
Switch for trigger primitive simulation module bypass debug mode.
Definition at line 273 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutSuppressor(), and run().
double EcalSelectiveReadoutSuppressor::trigPrimBypassHTH_ [private] |
Low TT Et threshold for trigger primitive simulation module bypass debug mode.
Definition at line 306 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutSuppressor(), and setTtFlags().
double EcalSelectiveReadoutSuppressor::trigPrimBypassLTH_ [private] |
Low TT Et threshold for trigger primitive simulation module bypass debug mode.
Definition at line 301 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutSuppressor(), and setTtFlags().
int EcalSelectiveReadoutSuppressor::trigPrimBypassMode_ [private] |
Mode selection for "Trig bypass" mode 0: TT thresholds applied on sum of crystal Et's 1: TT thresholds applies on compressed Et from Trigger primitive
Definition at line 280 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutSuppressor().
When in trigger primitive simulation module bypass debug mode, switch to enable Peak finder effect simulation
Definition at line 296 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutSuppressor(), and setTtFlags().
EcalSelectiveReadout::ttFlag_t EcalSelectiveReadoutSuppressor::ttFlags[nTriggerTowersInEta][nTriggerTowersInPhi] [private] |
Trigger tower flags: see setTtFlags()
Definition at line 233 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutProducer::printTTFlags(), run(), and setTtFlags().
bool EcalSelectiveReadoutSuppressor::ttThresOnCompressedEt_ [private] |
Switch to applies trigPrimBypassLTH_ and trigPrimBypassHTH_ thresholds on TPG compressed ET instead of using flags from TPG: trig prim bypass mode 1.
Definition at line 291 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutSuppressor(), run(), and setTtFlags().
std::vector<float> EcalSelectiveReadoutSuppressor::weights [private] |
DCC zero suppression FIR filter uncalibrated normalized weigths
Definition at line 251 of file EcalSelectiveReadoutSuppressor.h.
Referenced by EcalSelectiveReadoutSuppressor(), frame2Energy(), and getFIRWeigths().
int EcalSelectiveReadoutSuppressor::zsThreshold[2][8] [private] |
Zero suppresion threshold for the ECAL expressed in ebThrUnit and eeThrUnit. Set to numeric_limits<int>::min() for FULL READOUT and to numeric_limits<int>::max() for SUPPRESS. First index: 0 for barrel, 1 for endcap 2nd index: channel interest (see EcalSelectiveReadout::towerInterest_t
Definition at line 263 of file EcalSelectiveReadoutSuppressor.h.
Referenced by initCellThresholds(), and run().