|
|
Go to the documentation of this file.
26 using namespace boost;
33 : ttThresOnCompressedEt_(
false), ievt_(0) {
39 int defTtf =
params.getParameter<
int>(
"defaultTtf");
40 if (defTtf < 0 || defTtf > 7) {
41 throw cms::Exception(
"InvalidParameter") <<
"Value of EcalSelectiveReadoutProducer module parameter defaultTtf, "
42 <<
defaultTtf_ <<
", is out of the valid range 0..7\n";
50 for (
int i = 0;
i < 4; ++
i) {
55 bool actionValid =
actions_.size() == 8;
63 <<
"EcalSelectiveReadoutProducer module parameter 'actions' is "
64 "not valid. It must be a vector of 8 integer values comprised between 0 and 7\n";
85 edm::LogWarning(
"Digitization") <<
"Beware a simplified trigger primitive "
86 "computation is used for the ECAL selective readout";
89 <<
"Invalid value for EcalSelectiveReadoutProducer parameter 'trigPrimBypassMode_'."
90 " Valid values are 0 and 1.\n";
106 #ifndef ECALSELECTIVEREADOUT_NOGEOM
112 double endcapLowInterest,
113 double barrelHighInterest,
114 double endcapHighInterest) {
117 int lowInterestThr[2];
119 int highInterestThr[2];
140 for (
int iSubDet = 0; iSubDet < 2; ++iSubDet) {
160 for (
size_t i = 0;
i < 8; ++
i) {
164 else if ((
actions_[
i] & ~FORCED_MASK) == 1)
166 else if ((
actions_[
i] & ~FORCED_MASK) == 2)
189 double thr_ = thresholdInGeV /
thrUnit[iSubDet];
196 if (thr_ >= 0x7FF + .5) {
198 }
else if (thr_ <= -0x7FF - .5) {
214 bool gain12saturated =
false;
215 const int gain12 = 0x01;
219 for (
int iSample =
firstFIRSample - 1; iSample < lastFIRSample; ++iSample, ++iWeight) {
220 if (iSample >= 0 && iSample < (
int)
frame.size()) {
222 if (
sample.gainId() != gain12)
223 gain12saturated =
true;
226 acc +=
sample.adc() *
w[iWeight];
229 <<
": Not enough samples in data frame or 'ecalDccZs1stSample' module "
230 "parameter is not valid...";
244 acc = ((acc + (1 << 30)) >> 8) - (1 << (30 - 8));
250 const bool result = (acc >= thr) || gain12saturated;
294 if (selectedBarrelDigis) {
302 selectedBarrelDigis->
push_back(digiItr->id(), digiItr->begin());
308 if (selectedEndcapDigis) {
314 selectedEndcapDigis->
push_back(digiItr->id(), digiItr->begin());
320 int neb = (selectedBarrelDigis ? selectedBarrelDigis->
size() : 0);
321 if (selectedEndcapDigis)
324 <<
"Number of EB digis passing the SR: " << neb <<
" / " <<
barrelDigis.size() <<
"\n";
325 if (selectedEndcapDigis)
328 <<
"\nNumber of EE digis passing the SR: " << selectedEndcapDigis->
size() <<
" / " <<
endcapDigis.size()
337 for (
int iZ = -1; iZ <= 1; iZ += 2) {
344 throw cms::Exception(
"EcalSelectiveReadout") << __FILE__ <<
":" << __LINE__ <<
": "
345 <<
"unknown SR flag. for "
346 <<
" TT " <<
id <<
". Most probably a bug.";
361 for (
int iX = 1; iX <= 20; ++iX) {
362 for (
int iY = 1; iY <= 20; ++iY) {
379 }
else if (iX < 9 || iX > 12 || iY < 9 || iY > 12) {
380 edm::LogError(
"EcalSelectiveReadout") << __FILE__ <<
":" << __LINE__ <<
": "
381 <<
"negative interest in EE for SC " <<
id <<
"\n";
396 int iEta = trigPrim->id().ieta();
404 unsigned int iPhi0 = trigPrim->id().iphi() - 1;
409 int compressedEt = trigPrim->compressedEt();
424 const static int maxWeight = 0xEFF;
453 bzero(trigPrim,
sizeof(trigPrim));
467 trigPrim[iTTEta0][iTTPhi0] +=
e *
sin(
theta);
483 trigPrim[iTTEta0][iTTPhi0] +=
e *
sin(
theta);
488 int innerTTEtas[] = {0, 1, 54, 55};
489 for (
unsigned iRing = 0; iRing <
sizeof(innerTTEtas) /
sizeof(innerTTEtas[0]); ++iRing) {
490 int iTTEta0 = innerTTEtas[iRing];
507 double et = .5 * (trigPrim[iTTEta0][iTTPhi0] + trigPrim[iTTEta0][iTTPhi0 + 1]);
511 trigPrim[iTTEta0][iTTPhi0] =
et;
512 trigPrim[iTTEta0][iTTPhi0 + 1] =
et;
537 double weights[] = {0., -1 / 3., -1 / 3., -1 / 3., 0., 1.};
546 cerr <<
"Severe error. " << __FILE__ <<
":" << __LINE__ <<
": "
547 <<
"this is a bug. Please report it.\n";
554 double gainInv[] = {12., 1., 6., 12.};
559 if (iframe >= 0 && iframe <
frame.size()) {
571 const char tccFlagMarker[] = {
'?',
'.',
'S',
'?',
'C',
'E',
'E',
'E',
'E'};
576 os <<
"# TCC flag map\n#\n"
579 <<
": 000 (low interest)\n"
582 <<
": 001 (mid interest)\n"
585 <<
": 010 (not valid)\n"
588 <<
": 011 (high interest)\n"
590 <<
tccFlagMarker[1 + 4] <<
": 1xx forced readout (Hw error)\n";
594 os <<
"#\n#Event " <<
iEvent <<
"\n";
598 for (
int iPhi = 0; iPhi <
nPhi; ++iPhi) {
const static size_t nTriggerTowersInPhi
std::vector< float > srpLowInterestChannelZS_
void initCellThresholds(double barrelLowInterest, double endcapLowInterest, double barrelHighInterest, double endcapHighInterest)
helpers for constructors
std::vector< T >::const_iterator const_iterator
void setGeometry(const CaloGeometry *caloGeometry)
double trigPrimBypassHTH_
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
EcalSelectiveReadout::ttFlag_t defaultTtf_
unsigned ttId(DetId const &, EcalElectronicsMapping const *)
static bool validDetId(int ix, int iy, int iz)
double frame2Energy(const T &frame, int timeOffset=0) const
std::vector< int > actions_
std::vector< int > getFIRWeigths()
bool trigPrimBypassWithPeakFinder_
void setTtFlags(const edm::EventSetup &eventSetup, const EBDigiCollection &ebDigis, const EEDigiCollection &eeDigis)
void push_back(T const &t)
Log< level::Warning, false > LogWarning
std::unique_ptr< EcalSelectiveReadout > ecalSelectiveReadout
bool accept(const edm::DataFrame &frame, int thr)
Sin< T >::type sin(const T &t)
const static size_t nTriggerTowersInEta
std::vector< int > deltaEta_
void push_back(const Digi &digi)
const_iterator begin() const
const EcalTrigTowerConstituentsMap * theTriggerMap
void setTriggerMap(const EcalTrigTowerConstituentsMap *map)
EcalSelectiveReadout::ttFlag_t ttFlags[nTriggerTowersInEta][nTriggerTowersInPhi]
void printTTFlags(std::ostream &os, int iEvent=-1, bool withHeader=true) const
static const int FORCED_MASK
Geom::Theta< T > theta() const
void push_back(const Digi &digi)
void reserve(size_t isize)
std::vector< int > symetricZS_
const static size_t nTriggerTowersInEta
double trigPrimBypassLTH_
const_iterator end() const
const_iterator begin() const
The iterator returned can not safely be used across threads.
std::vector< int > firWeights
int iTTEta2cIndex(int iEta) const
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::vector< int > deltaPhi_
const static size_t nBarrelTriggerTowersInEta
Log< level::Error, false > LogError
int iTTPhi2cIndex(int iPhi) const
float ebDccAdcToGeV_
ADC to GeV conversion factor used in ZS filter for EB.
EcalSelectiveReadoutSuppressor(const edm::ParameterSet ¶ms, const EcalSRSettings *settings)
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
bool ttThresOnCompressedEt_
std::vector< std::vector< float > > dccNormalizedWeights_
static const int nFIRTaps
const char tccFlagMarker[]
std::vector< int > ecalDccZs1stSample_
void reserve(size_type n)
float eeDccAdcToGeV_
ADC to GeV conversion factor used in ZS filter for EE.
void setElecMap(const EcalElectronicsMapping *map)
std::vector< float > weights
void run(const edm::EventSetup &eventSetup, const EcalTrigPrimDigiCollection &trigPrims, EBDigiCollection &barrelDigis, EEDigiCollection &endcapDigis)
std::vector< float > srpHighInterestChannelZS_
std::vector< int > actions_
int internalThreshold(double thresholdInGeV, int iSubDet) const
Abs< T >::type abs(const T &t)
const static size_t nTriggerTowersInPhi
const_iterator end() const