diff --git a/DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigi.h b/DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigi.h new file mode 100644 index 0000000000000..b33c32670b717 --- /dev/null +++ b/DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigi.h @@ -0,0 +1,108 @@ +#ifndef CSCDigi_CSCALCTPreTriggerDigi_h +#define CSCDigi_CSCALCTPreTriggerDigi_h + +/**\class CSCALCTPreTriggerDigi + * + * Pre-trigger Digi for ALCT trigger primitives. + * + */ + +#include +#include + +class CSCALCTPreTriggerDigi { +public: + /// Constructors + CSCALCTPreTriggerDigi(const int valid, + const int quality, + const int accel, + const int patternb, + const int keywire, + const int bx, + const int trknmb = 0); + /// default + CSCALCTPreTriggerDigi(); + + /// clear this ALCT + void clear(); + + /// check ALCT validity (1 - valid ALCT) + bool isValid() const { return valid_; } + + /// set valid + void setValid(const int valid) { valid_ = valid; } + + /// return quality of a pattern + int getQuality() const { return quality_; } + + /// set quality + void setQuality(const int quality) { quality_ = quality; } + + /// return Accelerator bit + /// 1-Accelerator pattern, 0-CollisionA or CollisionB pattern + int getAccelerator() const { return accel_; } + + /// set accelerator bit + void setAccelerator(const int accelerator) { accel_ = accelerator; } + + /// return Collision Pattern B bit + /// 1-CollisionB pattern (accel_ = 0), + /// 0-CollisionA pattern (accel_ = 0) + int getCollisionB() const { return patternb_; } + + /// set Collision Pattern B bit + void setCollisionB(const int collision) { patternb_ = collision; } + + /// return key wire group + int getKeyWG() const { return keywire_; } + + /// set key wire group + void setKeyWG(const int keyWG) { keywire_ = keyWG; } + + /// return BX - five low bits of BXN counter tagged by the ALCT + int getBX() const { return bx_; } + + /// set BX + void setBX(const int BX) { bx_ = BX; } + + /// return track number (1,2) + int getTrknmb() const { return trknmb_; } + + /// Set track number (1,2) after sorting ALCTs. + void setTrknmb(const uint16_t number) { trknmb_ = number; } + + /// return 12-bit full BX. + int getFullBX() const { return fullbx_; } + + /// Set 12-bit full BX. + void setFullBX(const uint16_t fullbx) { fullbx_ = fullbx; } + + /// True if the first ALCT has a larger quality, or if it has the same + /// quality but a larger wire group. + bool operator>(const CSCALCTPreTriggerDigi&) const; + + /// True if all members (except the number) of both ALCTs are equal. + bool operator==(const CSCALCTPreTriggerDigi&) const; + + /// True if the preceding one is false. + bool operator!=(const CSCALCTPreTriggerDigi&) const; + + /// Print content of digi. + void print() const; + + /// set wiregroup number + void setWireGroup(unsigned int wiregroup) { keywire_ = wiregroup; } + +private: + uint16_t valid_; + uint16_t quality_; + uint16_t accel_; + uint16_t patternb_; // not used since 2007 + uint16_t keywire_; + uint16_t bx_; + uint16_t trknmb_; + uint16_t fullbx_; +}; + +std::ostream& operator<<(std::ostream& o, const CSCALCTPreTriggerDigi& digi); +#endif diff --git a/DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigiCollection.h b/DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigiCollection.h new file mode 100644 index 0000000000000..6c6e1abf00313 --- /dev/null +++ b/DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigiCollection.h @@ -0,0 +1,16 @@ +#ifndef CSCALCTPreTriggerDigi_CSCALCTPreTriggerDigiCollection_h +#define CSCALCTPreTriggerDigi_CSCALCTPreTriggerDigiCollection_h + +/** \class CSCALCTPreTriggerDigiCollection + * + * For ALCT trigger primitives + * +*/ + +#include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigi.h" +#include "DataFormats/MuonData/interface/MuonDigiCollection.h" + +typedef MuonDigiCollection CSCALCTPreTriggerDigiCollection; + +#endif diff --git a/DataFormats/CSCDigi/src/CSCALCTPreTriggerDigi.cc b/DataFormats/CSCDigi/src/CSCALCTPreTriggerDigi.cc new file mode 100644 index 0000000000000..6e321d7d6e703 --- /dev/null +++ b/DataFormats/CSCDigi/src/CSCALCTPreTriggerDigi.cc @@ -0,0 +1,101 @@ +#include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigi.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include +#include + +using namespace std; + +/// Constructors +CSCALCTPreTriggerDigi::CSCALCTPreTriggerDigi(const int valid, + const int quality, + const int accel, + const int patternb, + const int keywire, + const int bx, + const int trknmb) { + valid_ = valid; + quality_ = quality; + accel_ = accel; + patternb_ = patternb; + keywire_ = keywire; + bx_ = bx; + trknmb_ = trknmb; +} + +/// Default +CSCALCTPreTriggerDigi::CSCALCTPreTriggerDigi() { + clear(); // set contents to zero +} + +/// Clears this ALCT. +void CSCALCTPreTriggerDigi::clear() { + valid_ = 0; + quality_ = 0; + accel_ = 0; + patternb_ = 0; + keywire_ = 0; + bx_ = 0; + trknmb_ = 0; + fullbx_ = 0; +} + +bool CSCALCTPreTriggerDigi::operator>(const CSCALCTPreTriggerDigi& rhs) const { + bool returnValue = false; + + // Early ALCTs are always preferred to the ones found at later bx's. + if (getBX() < rhs.getBX()) { + returnValue = true; + } + if (getBX() != rhs.getBX()) { + return returnValue; + } + + // The > operator then checks the quality of ALCTs. + // If two qualities are equal, the ALCT furthest from the beam axis + // (lowest eta, highest wire group number) is selected. + int quality1 = getQuality(); + int quality2 = rhs.getQuality(); + if (quality1 > quality2) { + returnValue = true; + } else if (quality1 == quality2 && getKeyWG() > rhs.getKeyWG()) { + returnValue = true; + } + return returnValue; +} + +bool CSCALCTPreTriggerDigi::operator==(const CSCALCTPreTriggerDigi& rhs) const { + // Exact equality. + bool returnValue = false; + if (isValid() == rhs.isValid() && getQuality() == rhs.getQuality() && getAccelerator() == rhs.getAccelerator() && + getCollisionB() == rhs.getCollisionB() && getKeyWG() == rhs.getKeyWG() && getBX() == rhs.getBX()) { + returnValue = true; + } + return returnValue; +} + +bool CSCALCTPreTriggerDigi::operator!=(const CSCALCTPreTriggerDigi& rhs) const { + // True if == is false. + bool returnValue = true; + if ((*this) == rhs) + returnValue = false; + return returnValue; +} + +/// Debug +void CSCALCTPreTriggerDigi::print() const { + if (isValid()) { + edm::LogVerbatim("CSCDigi") << "CSC ALCT #" << setw(1) << getTrknmb() << ": Valid = " << setw(1) << isValid() + << " Quality = " << setw(2) << getQuality() << " Accel. = " << setw(1) + << getAccelerator() << " PatternB = " << setw(1) << getCollisionB() + << " Key wire group = " << setw(3) << getKeyWG() << " BX = " << setw(2) << getBX() + << " Full BX= " << std::setw(1) << getFullBX(); + } else { + edm::LogVerbatim("CSCDigi") << "Not a valid Anode LCT."; + } +} + +std::ostream& operator<<(std::ostream& o, const CSCALCTPreTriggerDigi& digi) { + return o << "CSC ALCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " Quality = " << digi.getQuality() + << " Accel. = " << digi.getAccelerator() << " PatternB = " << digi.getCollisionB() + << " Key wire group = " << digi.getKeyWG() << " BX = " << digi.getBX(); +} diff --git a/DataFormats/CSCDigi/src/classes.h b/DataFormats/CSCDigi/src/classes.h index 3fd68a54e4e96..879a26bef5055 100644 --- a/DataFormats/CSCDigi/src/classes.h +++ b/DataFormats/CSCDigi/src/classes.h @@ -29,6 +29,8 @@ #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigi.h" #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigi.h" +#include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigiCollection.h" // dummy structs to ensure backward compatibility struct GEMCSCLCTDigi {}; diff --git a/DataFormats/CSCDigi/src/classes_def.xml b/DataFormats/CSCDigi/src/classes_def.xml index acac95fb56182..6e8c9c16816f4 100644 --- a/DataFormats/CSCDigi/src/classes_def.xml +++ b/DataFormats/CSCDigi/src/classes_def.xml @@ -28,6 +28,9 @@ + + + @@ -59,6 +62,7 @@ + @@ -76,6 +80,7 @@ + @@ -92,8 +97,9 @@ - + + @@ -111,8 +117,9 @@ - + + @@ -129,8 +136,9 @@ - + + diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h index 5162625f04d25..292c07496d22d 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h @@ -36,6 +36,8 @@ #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h" +#include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigi.h" +#include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h" #include @@ -75,6 +77,9 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { /** Returns vector of all found ALCTs, if any. */ std::vector getALCTs() const; + /** read out pre-ALCTs */ + std::vector preTriggerDigis() const { return thePreTriggerDigis; } + /** Return best/second best ALCTs */ CSCALCTDigi getBestALCT(int bx) const; CSCALCTDigi getSecondALCT(int bx) const; @@ -105,6 +110,8 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { std::vector lct_list; + std::vector thePreTriggerDigis; + /** Configuration parameters. */ unsigned int fifo_tbins, fifo_pretrig, drift_delay; unsigned int nplanes_hit_pretrig, nplanes_hit_accel_pretrig; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h index 61e997833cc02..76d569e1a540c 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h @@ -23,6 +23,7 @@ #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerCollection.h" @@ -70,6 +71,7 @@ class CSCTriggerPrimitivesBuilder { const GEMPadDigiClusterCollection* gemPadClusters, CSCALCTDigiCollection& oc_alct, CSCCLCTDigiCollection& oc_clct, + CSCALCTPreTriggerDigiCollection& oc_alctpretrigger, CSCCLCTPreTriggerDigiCollection& oc_clctpretrigger, CSCCLCTPreTriggerCollection& oc_pretrig, CSCCorrelatedLCTDigiCollection& oc_lct, diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc index 7ccc03ac51f9a..34c8a0aab0364 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc @@ -26,6 +26,7 @@ #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" #include "DataFormats/GEMDigi/interface/GEMCoPadDigiCollection.h" @@ -47,6 +48,8 @@ CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterS : edm::InputTag(""); checkBadChambers_ = conf.getParameter("checkBadChambers"); + savePreTriggers_ = conf.getParameter("savePreTriggers"); + // check whether you need to run the integrated local triggers const edm::ParameterSet commonParam(conf.getParameter("commonParam")); runME11ILT_ = commonParam.existsAs("runME11ILT") ? commonParam.getParameter("runME11ILT") : false; @@ -62,6 +65,7 @@ CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterS produces(); produces(); produces(); + produces(); produces(); produces("MPCSORTED"); if (runME11ILT_ or runME21ILT_) @@ -134,6 +138,7 @@ void CSCTriggerPrimitivesProducer::produce(edm::StreamID iID, edm::Event& ev, co std::unique_ptr oc_alct(new CSCALCTDigiCollection); std::unique_ptr oc_clct(new CSCCLCTDigiCollection); std::unique_ptr oc_clctpretrigger(new CSCCLCTPreTriggerDigiCollection); + std::unique_ptr oc_alctpretrigger(new CSCALCTPreTriggerDigiCollection); std::unique_ptr oc_pretrig(new CSCCLCTPreTriggerCollection); std::unique_ptr oc_lct(new CSCCorrelatedLCTDigiCollection); std::unique_ptr oc_sorted_lct(new CSCCorrelatedLCTDigiCollection); @@ -161,6 +166,7 @@ void CSCTriggerPrimitivesProducer::produce(edm::StreamID iID, edm::Event& ev, co gemPadClusters, *oc_alct, *oc_clct, + *oc_alctpretrigger, *oc_clctpretrigger, *oc_pretrig, *oc_lct, @@ -173,7 +179,10 @@ void CSCTriggerPrimitivesProducer::produce(edm::StreamID iID, edm::Event& ev, co // Put collections in event. ev.put(std::move(oc_alct)); ev.put(std::move(oc_clct)); - ev.put(std::move(oc_clctpretrigger)); + if (savePreTriggers_) { + ev.put(std::move(oc_alctpretrigger)); + ev.put(std::move(oc_clctpretrigger)); + } ev.put(std::move(oc_pretrig)); ev.put(std::move(oc_lct)); ev.put(std::move(oc_sorted_lct), "MPCSORTED"); diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h index 4c94fb1ea3f2d..997b68f011401 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h @@ -74,6 +74,9 @@ class CSCTriggerPrimitivesProducer : public edm::global::EDProducer& pretriggerV = tmb11->clctProc->preTriggerDigisME1b(); const std::vector& clctV1a = tmb11->clctProc->readoutCLCTsME1a(); const std::vector& pretriggerV1a = tmb11->clctProc->preTriggerDigisME1a(); + const std::vector& alctpretriggerV = tmb11->alctProc->preTriggerDigis(); if (infoV > 1) LogTrace("CSCTriggerPrimitivesBuilder") @@ -195,6 +197,7 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(clctV, oc_clct, detid, " ME1b CLCT digi"); put(pretriggerV, oc_pretrigger, detid, " ME1b CLCT pre-trigger digi"); put(preTriggerBXs, oc_pretrig, detid, " ME1b CLCT pre-trigger BX"); + put(alctpretriggerV, oc_alctpretrigger, detid, " ME1b ALCT pre-trigger digi"); // ME1/a @@ -237,6 +240,7 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& clctV1a = tmb11GEM->clctProc->readoutCLCTsME1a(); const std::vector& pretriggerV1a = tmb11GEM->clctProc->preTriggerDigisME1a(); const std::vector& copads = tmb11GEM->coPadProcessor->readoutCoPads(); + const std::vector& alctpretriggerV = tmb11GEM->alctProc->preTriggerDigis(); // ME1/b if (!(lctV.empty() && alctV.empty() && clctV.empty()) and infoV > 1) { @@ -250,6 +254,7 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(pretriggerV, oc_pretrigger, detid, " ME1b CLCT pre-trigger digi"); put(preTriggerBXs, oc_pretrig, detid, " ME1b CLCT pre-trigger BX"); put(copads, oc_gemcopad, gemId, " GEM coincidence pad"); + put(alctpretriggerV, oc_alctpretrigger, detid, " ME1b ALCT pre-trigger digi"); // ME1/a if (disableME1a_) @@ -285,6 +290,7 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& preTriggerBXs = tmb21GEM->clctProc->preTriggerBXs(); const std::vector& pretriggerV = tmb21GEM->clctProc->preTriggerDigis(); const std::vector& copads = tmb21GEM->coPadProcessor->readoutCoPads(); + const std::vector& alctpretriggerV = tmb21GEM->alctProc->preTriggerDigis(); if (!(alctV.empty() && clctV.empty() && lctV.empty()) and infoV > 1) { LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder got results in " << detid; @@ -297,6 +303,7 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(pretriggerV, oc_pretrigger, detid, " ME21 CLCT pre-trigger digi"); put(preTriggerBXs, oc_pretrig, detid, " ME21 CLCT pre-trigger BX"); put(copads, oc_gemcopad, gemId, " GEM coincidence pad"); + put(alctpretriggerV, oc_alctpretrigger, detid, " ME21 ALCT pre-trigger digi"); } // running upgraded ME2/1-ME3/1-ME4/1 TMBs (without GEMs or RPCs) else if ((stat == 2 or stat == 3 or stat == 4) && ring == 1 && isSLHC_) { @@ -311,6 +318,7 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& clctV = utmb->clctProc->readoutCLCTs(); const std::vector& preTriggerBXs = utmb->clctProc->preTriggerBXs(); const std::vector& pretriggerV = utmb->clctProc->preTriggerDigis(); + const std::vector& alctpretriggerV = utmb->alctProc->preTriggerDigis(); if (!(alctV.empty() && clctV.empty() && lctV.empty()) and infoV > 1) { LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder got results in " << detid; @@ -322,6 +330,7 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(clctV, oc_clct, detid, " CLCT digi"); put(pretriggerV, oc_pretrigger, detid, " CLCT pre-trigger digi"); put(preTriggerBXs, oc_pretrig, detid, " CLCT pre-trigger BX"); + put(alctpretriggerV, oc_alctpretrigger, detid, " ALCT pre-trigger digi"); } // running non-upgraded TMB @@ -335,6 +344,7 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& clctV = tmb->clctProc->readoutCLCTs(); const std::vector& preTriggerBXs = tmb->clctProc->preTriggerBXs(); const std::vector& pretriggerV = tmb->clctProc->preTriggerDigis(); + const std::vector& alctpretriggerV = tmb->alctProc->preTriggerDigis(); if (!(alctV.empty() && clctV.empty() && lctV.empty()) and infoV > 1) { LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder got results in " << detid; @@ -346,6 +356,7 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(clctV, oc_clct, detid, tmb->getCSCName() + " CLCT digi"); put(pretriggerV, oc_pretrigger, detid, tmb->getCSCName() + " CLCT pre-trigger digi"); put(preTriggerBXs, oc_pretrig, detid, tmb->getCSCName() + " CLCT pre-trigger BX"); + put(alctpretriggerV, oc_alctpretrigger, detid, tmb->getCSCName() + " ALCT pre-trigger digi"); } // non-upgraded TMB } }