48 edm::LogWarning(
"EcalSelectiveReadout") <<
"Parameter configFromCondDB of EcalSelectiveReadout module not found. "
49 "Selective readout configuration will be read from python file.";
114 auto_ptr<EBDigiCollection> selectedEBDigis;
115 auto_ptr<EEDigiCollection> selectedEEDigis;
116 auto_ptr<EBSrFlagCollection> ebSrFlags;
117 auto_ptr<EESrFlagCollection> eeSrFlags;
142 suppressor_->run(eventSetup, *trigPrims, *ebDigis, *eeDigis,
143 selectedEBDigis.get(), selectedEEDigis.get(),
144 ebSrFlags.get(), eeSrFlags.get());
148 ofstream ttfFile(
"TTF.txt", (iEvent==1?
ios::trunc:ios::app));
150 iEvent==1?
true:
false);
152 ofstream srfFile(
"SRF.txt", (iEvent==1?
ios::trunc:ios::app));
154 suppressor_->getEcalSelectiveReadout()->printHeader(srfFile);
156 srfFile <<
"# Event " << iEvent <<
"\n";
157 suppressor_->getEcalSelectiveReadout()->print(srfFile);
160 ofstream afFile(
"AF.txt", (iEvent==1?
ios::trunc:ios::app));
162 iEvent==1?
true:
false);
188 static bool firstCall=
true;
204 static bool firstCall =
true;
269 const char tccFlagMarker[] = {
'x',
'.',
'S',
'?',
'C',
'E',
'E',
'E',
'E'};
276 os <<
"# TCC flag map\n#\n"
277 "# +-->Phi " << tccFlagMarker[0+1] <<
": 000 (low interest)\n"
278 "# | " << tccFlagMarker[1+1] <<
": 001 (mid interest)\n"
279 "# | " << tccFlagMarker[2+1] <<
": 010 (not valid)\n"
280 "# V Eta " << tccFlagMarker[3+1] <<
": 011 (high interest)\n"
281 "# " << tccFlagMarker[4+1] <<
": 1xx forced readout (Hw error)\n"
285 vector<vector<int> > ttf(nEta, vector<int>(nPhi, -1));
287 it != tp.
end(); ++it){
289 if(trigPrim.
size()>0){
290 int iEta = trigPrim.
id().
ieta();
291 int iEta0 = iEta<0?iEta+nEta/2:iEta+nEta/2-1;
292 int iPhi0 = trigPrim.
id().
iphi() - 1;
293 ttf[iEta0][iPhi0] = trigPrim.
ttFlag();
296 for(
int iEta=0; iEta<nEta; ++iEta){
297 for(
int iPhi=0; iPhi<nPhi; ++iPhi){
298 os << tccFlagMarker[ttf[iEta][iPhi]+1];
308 static std::atomic<bool> warnWeightCnt{
true};
309 bool expected =
true;
310 if((
int)weights.size() > nFIRTaps && warnWeightCnt.compare_exchange_strong(expected,
false,std::memory_order_acq_rel)){
311 edm::LogWarning(
"Configuration") <<
"The list of DCC zero suppression FIR "
312 "weights given in parameter dccNormalizedWeights is longer "
313 "than the expected depth of the FIR filter :(" << nFIRTaps <<
"). "
314 "The last weights will be discarded.";
317 if(weights.size()>0){
319 double maxWeight = weights[iMaxWeight];
321 for(
unsigned i=0;
i<weights.size(); ++
i){
322 if(weights[
i]>maxWeight){
324 maxWeight = weights[iMaxWeight];
336 if(rc && maxWeightBin!=binOfMax){
338 <<
"The maximum weight of DCC zero suppression FIR filter is not "
339 "applied to the expected maximum sample(" << binOfMax
340 << (binOfMax==1?
"st":(binOfMax==2?
"nd":(binOfMax==3?
"rd":
"th")))
341 <<
" time sample). This may indicate faulty 'dccNormalizedWeights' "
342 "or 'ecalDccZs1sSample' parameters.";
350 int& binOfMax)
const{
355 string bofm(
"binOfMaximum");
356 if(
find(ebDigiParamList.begin(), ebDigiParamList.end(), bofm)
357 != ebDigiParamList.end()){
372 const char srpFlagMarker[] = {
'.',
'z',
'Z',
'F',
'4',
'5',
'6',
'7'};
376 const char* date = ctime(&t);
377 os <<
"#SRP flag map\n#\n"
378 "# Generatied on: " << date <<
"\n#\n"
379 "# +-->Phi/Y " << srpFlagMarker[0] <<
": suppressed\n"
380 "# | " << srpFlagMarker[1] <<
": ZS 1\n"
381 "# | " << srpFlagMarker[2] <<
": ZS 2\n"
382 "# V Eta/X " << srpFlagMarker[3] <<
": full readout\n"
417 os <<
"# Event " << iEvent <<
"\n";
425 for(
size_t i=0;
i <
sizeof(eeSrf)/
sizeof(
int); ((
int*)eeSrf)[
i++] = -1){};
427 it != eeSrFlags.
end(); ++it){
429 int iZ0 = flag.
id().
zside()>0?1:0;
430 int iX0 = flag.
id().
ix()-1;
431 int iY0 = flag.
id().
iy()-1;
432 assert(iZ0>=0 && iZ0<nEndcaps);
433 assert(iX0>=0 && iX0<nScX);
434 assert(iY0>=0 && iY0<nScY);
435 eeSrf[iZ0][iX0][iY0] = flag.
value();
437 const int nEbTtEta = 34;
438 const int nEeTtEta = 11;
439 const int nTtEta = nEeTtEta*2+nEbTtEta;
440 const int nTtPhi = 72;
441 int ebSrf[nEbTtEta][nTtPhi];
442 for(
size_t i=0;
i<
sizeof(ebSrf)/
sizeof(
int); ((
int*)ebSrf)[
i++] = -1){};
444 it != ebSrFlags.
end(); ++it){
447 int iEta = flag.
id().
ieta();
448 int iEta0 = iEta + nTtEta/2 - (iEta>=0?1:0);
449 int iEbEta0 = iEta0 - nEeTtEta;
450 int iPhi0 = flag.
id().
iphi() - 1;
451 assert(iEbEta0>=0 && iEbEta0<nEbTtEta);
452 assert(iPhi0>=0 && iPhi0<nTtPhi);
460 ebSrf[iEbEta0][iPhi0] = flag.
value();
467 for(
int iX0=0; iX0<nScX; ++iX0){
468 for(
int iY0=0; iY0<nScY; ++iY0){
469 int srFlag = eeSrf[0][iX0][iY0];
471 && srFlag<(
int)(
sizeof(srpFlagMarker)/
sizeof(srpFlagMarker[0])));
472 os << (srFlag==-1?
' ':srpFlagMarker[srFlag]);
481 for(
int iPhi0 = 0; iPhi0 < nTtPhi; ++iPhi0){
482 int srFlag = ebSrf[iEta0][iPhi0];
484 && srFlag<(
int)(
sizeof(srpFlagMarker)/
sizeof(srpFlagMarker[0])));
485 os << (srFlag==-1?
'?':srpFlagMarker[srFlag]);
491 for(
int iX0=0; iX0<nScX; ++iX0){
492 for(
int iY0=0; iY0<nScY; ++iY0){
493 int srFlag = eeSrf[1][iX0][iY0];
495 && srFlag<(
int)(
sizeof(srpFlagMarker)/
sizeof(srpFlagMarker[0])));
496 os << (srFlag==-1?
' ':srpFlagMarker[srFlag]);
507 throw cms::Exception(
"Configuration") <<
"Selective readout emulator, EcalSelectiveReadout, supports only single set of ZS weights. "
522 throw cms::Exception(
"Configuration") <<
"Inconsistency between number of weigth sets ("
524 <<
"number of ecalDccZs1Sample values ("
T getParameter(std::string const &) const
const CaloGeometry * theGeometry
T getUntrackedParameter(std::string const &, T const &) const
std::string trigPrimProducer_
std::string eedigiCollection_
std::string ebSRPdigiCollection_
const EEDigiCollection * getEEDigis(edm::Event &event) const
void checkTriggerMap(const edm::EventSetup &eventSetup)
void checkGeometry(const edm::EventSetup &eventSetup)
std::vector< EcalTriggerPrimitiveDigi >::const_iterator const_iterator
std::string eeSrFlagCollection_
std::vector< std::vector< float > > dccNormalizedWeights_
const char tccFlagMarker[]
bool getBinOfMax(const edm::Event &evt, const edm::ProductID &noZsDigiId, int &binOfMax) const
const EcalSRSettings * settings_
void printTTFlags(const EcalTrigPrimDigiCollection &tp, std::ostream &os) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int ieta() const
get the tower ieta
virtual void produce(edm::Event &event, const edm::EventSetup &eventSetup)
edm::ParameterSet params_
void checkElecMap(const edm::EventSetup &eventSetup)
edm::SortedCollection< EBSrFlag > EBSrFlagCollection
const EcalTrigTowerConstituentsMap * theTriggerTowerMap
edm::SortedCollection< EESrFlag > EESrFlagCollection
std::vector< int > ecalDccZs1stSample_
std::string trigPrimCollection_
const EcalElectronicsMapping * theElecMap
std::vector< std::string > getParameterNames() const
std::auto_ptr< EcalSelectiveReadoutSuppressor > suppressor_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void checkWeights(const edm::Event &evt, const edm::ProductID &noZSDigiId) const
static int getFIRTapCount()
const_iterator end() const
virtual ~EcalSelectiveReadoutProducer()
int iphi() const
get the tower iphi
static const int nEndcaps
const EBDigiCollection * getEBDigis(edm::Event &event) const
const EcalTrigPrimDigiCollection * getTrigPrims(edm::Event &event) const
const EcalTrigTowerDetId & id() const
const EcalScDetId & id() const
T const * product() const
static const size_t nTriggerTowersInEta
static const size_t nTriggerTowersInPhi
T const * product() const
const EcalTrigTowerDetId & id() const
std::string digiProducer_
std::string ebSrFlagCollection_
static void printSrFlags(std::ostream &os, const EBSrFlagCollection &ebSrFlags, const EESrFlagCollection &eeSrFlags, int iEvent=-1, bool withHeader=true)
EcalSelectiveReadoutProducer(const edm::ParameterSet ¶ms)
Provenance getProvenance(BranchID const &theID) const
static void checkValidity(const EcalSRSettings &settings)
int ttFlag() const
get the Trigger tower Flag of interesting sample
ParameterSet const & parameterSet(Provenance const &provenance)
std::string eeSRPdigiCollection_
const_iterator begin() const
const char srpFlagMarker[]
std::string ebdigiCollection_
std::auto_ptr< EcalSRSettings > settingsFromFile_