CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CastorTTRecord Class Reference
Inheritance diagram for CastorTTRecord:
edm::one::EDProducer<> edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CastorTTRecord (const edm::ParameterSet &ps)
 
void getEnergy_fC (double energy[16][14], edm::Handle< CastorDigiCollection > &CastorDigiColl, edm::Event &e, const edm::EventSetup &c)
 
void getTriggerDecisions (std::vector< bool > &decision, double energy[16][14]) const
 
void getTriggerDecisionsPerOctant (std::vector< bool > tdps[16], double energy[16][14]) const
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~CastorTTRecord () override
 
- Public Member Functions inherited from edm::one::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< CastorDigiCollectionCastorDigiColl_
 
unsigned int CastorSignalTS_
 
edm::ESGetToken< CastorDbService, CastorDbRecordconditionsToken_
 
double reweighted_gain
 
std::vector< std::string > TrigNames_
 
std::vector< double > TrigThresholds_
 
std::vector< unsigned int > ttpBits_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 19 of file CastorTTRecord.cc.

Constructor & Destructor Documentation

◆ CastorTTRecord()

CastorTTRecord::CastorTTRecord ( const edm::ParameterSet ps)
explicit

Definition at line 52 of file CastorTTRecord.cc.

References CastorDigiColl_, CastorSignalTS_, conditionsToken_, edm::ParameterSet::getParameter(), reweighted_gain, TrigNames_, TrigThresholds_, and ttpBits_.

52  {
53  CastorDigiColl_ = consumes<CastorDigiCollection>(ps.getParameter<edm::InputTag>("CastorDigiCollection"));
54  CastorSignalTS_ = ps.getParameter<unsigned int>("CastorSignalTS");
55 
56  ttpBits_ = ps.getParameter<std::vector<unsigned int>>("ttpBits");
57  TrigNames_ = ps.getParameter<std::vector<std::string>>("TriggerBitNames");
58  TrigThresholds_ = ps.getParameter<std::vector<double>>("TriggerThresholds");
59  conditionsToken_ = esConsumes<CastorDbService, CastorDbRecord>();
60  reweighted_gain = 1.0;
61 
62  produces<L1GtTechnicalTriggerRecord>();
63 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< unsigned int > ttpBits_
unsigned int CastorSignalTS_
std::vector< std::string > TrigNames_
std::vector< double > TrigThresholds_
edm::ESGetToken< CastorDbService, CastorDbRecord > conditionsToken_
edm::EDGetTokenT< CastorDigiCollection > CastorDigiColl_
double reweighted_gain

◆ ~CastorTTRecord()

CastorTTRecord::~CastorTTRecord ( )
override

Definition at line 65 of file CastorTTRecord.cc.

65 {}

Member Function Documentation

◆ getEnergy_fC()

void CastorTTRecord::getEnergy_fC ( double  energy[16][14],
edm::Handle< CastorDigiCollection > &  CastorDigiColl,
edm::Event e,
const edm::EventSetup c 
)

Definition at line 102 of file CastorTTRecord.cc.

References CastorCoderDb::adc2fC(), edm::SortedCollection< T, SORT >::begin(), AlignmentProducer_cff::calibrations, CastorSignalTS_, submitPVValidationJobs::conditions, conditionsToken_, edm::SortedCollection< T, SORT >::end(), HCALHighEnergyHPDFilter_cfi::energy, options_cfi::eventSetup, CastorDataFrame::id(), HcalCastorDetId::module(), reweighted_gain, HcalCastorDetId::sector(), and l1trig_cff::shape.

Referenced by produce().

105  {
106  // std::cerr << "**** RUNNING THROUGH CastorTTRecord::getEnergy_fC" <<
107  // std::endl;
108 
109  // Get Conditions
111  const CastorQIEShape *shape = conditions->getCastorShape(); // this one is generic
112 
113  for (int isec = 0; isec < 16; isec++)
114  for (int imod = 0; imod < 14; imod++)
115  energy[isec][imod] = 0;
116 
117  // Loop over digis
119  for (idigi = CastorDigiColl->begin(); idigi != CastorDigiColl->end(); idigi++) {
120  const CastorDataFrame &digi = (*idigi);
121  HcalCastorDetId cell = digi.id();
122 
123  // Get Castor Coder
124  const CastorQIECoder *channelCoder = conditions->getCastorCoder(cell);
125  CastorCoderDb coder(*channelCoder, *shape);
126 
127  // Get Castor Calibration
128  const CastorCalibrations &calibrations = conditions->getCastorCalibrations(cell);
129 
130  // convert adc to fC
131  CaloSamples tool;
132  coder.adc2fC(digi, tool);
133 
134  // pedestal substraction
135  int capid = digi[CastorSignalTS_].capid();
136  double fC = tool[CastorSignalTS_] - calibrations.pedestal(capid);
137 
138  // to correct threshold levels in fC for different gains
139  reweighted_gain = calibrations.gain(capid) / 0.015;
140 
141  energy[digi.id().sector() - 1][digi.id().module() - 1] = fC;
142  }
143 }
unsigned int CastorSignalTS_
std::vector< T >::const_iterator const_iterator
int module() const
get the module (1-2 for EM, 1-12 for HAD)
const_iterator begin() const
int sector() const
get the sector (1-16)
edm::ESGetToken< CastorDbService, CastorDbRecord > conditionsToken_
const_iterator end() const
const HcalCastorDetId & id() const
double reweighted_gain

◆ getTriggerDecisions()

void CastorTTRecord::getTriggerDecisions ( std::vector< bool > &  decision,
double  energy[16][14] 
) const

Definition at line 145 of file CastorTTRecord.cc.

References HCALHighEnergyHPDFilter_cfi::energy, and getTriggerDecisionsPerOctant().

Referenced by produce().

145  {
146  // std::cerr << "**** RUNNING THROUGH CastorTTRecord::getTriggerDecisions" <<
147  // std::endl;
148 
149  // check if number of bits is at least four
150  if (decision.size() < 4)
151  return;
152 
153  std::vector<bool> tdpo[8]; // TriggerDecisionsPerOctant
155 
156  // preset trigger decisions
157  decision.at(0) = true;
158  decision.at(1) = false;
159  decision.at(2) = false;
160  decision.at(3) = false;
161 
162  // canceld for low pt jet
163  // bool EM_decision = false;
164  // bool HAD_decision = false;
165  // loop over castor octants
166  for (int ioct = 0; ioct < 8; ioct++) {
167  int next_oct = (ioct + 1) % 8;
168  int prev_oct = (ioct + 8 - 1) % 8;
169 
170  // gap Trigger
171  if (!tdpo[ioct].at(0))
172  decision.at(0) = false;
173  if (!tdpo[ioct].at(1))
174  decision.at(0) = false;
175 
176  // jet Trigger
177  if (tdpo[ioct].at(2))
178  decision.at(1) = true;
179 
180  // electron
181  // canceld for low pt jet
182  // if( tdpo[ioct].at(3) ) EM_decision = true;
183  // if( tdpo[ioct].at(4) ) HAD_decision = true;
184 
185  // iso muon
186  if (tdpo[ioct].at(5)) {
187  // was one of the other sectors
188  // in the octant empty ?
189  if (tdpo[ioct].at(0)) {
190  if (tdpo[prev_oct].at(1) && tdpo[next_oct].at(0) && tdpo[next_oct].at(1))
191  decision.at(3) = true;
192  } else if (tdpo[ioct].at(1)) {
193  if (tdpo[prev_oct].at(0) && tdpo[prev_oct].at(1) && tdpo[next_oct].at(0))
194  decision.at(3) = true;
195  }
196  // when not no iso muon
197  }
198 
199  // low pt jet Trigger
200  if (tdpo[ioct].at(6))
201  decision.at(2) = true;
202  }
203 
204  // for EM Trigger whole castor not hadronic and somewhere EM
205  // canceld for low pt jet
206  // decision.at(2) = EM_decision && !HAD_decision;
207 }
void getTriggerDecisionsPerOctant(std::vector< bool > tdps[16], double energy[16][14]) const

◆ getTriggerDecisionsPerOctant()

void CastorTTRecord::getTriggerDecisionsPerOctant ( std::vector< bool >  tdps[16],
double  energy[16][14] 
) const

Definition at line 209 of file CastorTTRecord.cc.

References HCALHighEnergyHPDFilter_cfi::energy, reweighted_gain, and TrigThresholds_.

Referenced by getTriggerDecisions().

209  {
210  // std::cerr << "**** RUNNING THROUGH
211  // CastorTTRecord::getTriggerDecisionsPerOctant" << std::endl;
212 
213  // loop over octatants
214  for (int ioct = 0; ioct < 8; ioct++) {
215  // six bits from HTR card
216  // 0. first sector empty
217  // 1. second sector empty
218  // 2. jet any sector
219  // 3. EM any sector
220  // 4. HAD any sector
221  // 5. muon any sector
222  // add instead of EM Trigger (not bit 6 in real)
223  // 6. low pt jet any sector
224  tdpo[ioct].resize(7);
225 
226  for (int ibit = 0; ibit < 7; ibit++)
227  tdpo[ioct].at(ibit) = false;
228 
229  // loop over castor sectors in octant
230  for (int ioctsec = 0; ioctsec < 2; ioctsec++) {
231  // absolute sector number
232  int isec = 2 * ioct + ioctsec;
233 
234  // init module sums for every sector
235  double fCsum_mod = 0;
236  double fCsum_em = 0, fCsum_ha = 0;
237  double fCsum_jet_had = 0;
238  double fCsum_col[3] = {0, 0, 0};
239 
240  // loop over modules
241  for (int imod = 0; imod < 14; imod++) {
242  // total sum
243  fCsum_mod += energy[isec][imod];
244 
245  // EM & HAD sum
246  if (imod < 2)
247  fCsum_em += energy[isec][imod];
248  if (imod > 2 && imod < 12)
249  fCsum_ha += energy[isec][imod];
250 
251  // sum over three sector parts
252  if (imod < 4)
253  fCsum_col[0] += energy[isec][imod];
254  else if (imod < 8)
255  fCsum_col[1] += energy[isec][imod];
256  else if (imod < 12)
257  fCsum_col[2] += energy[isec][imod];
258 
259  // HAD sum for jet trigger v2
260  if (imod > 1 && imod < 5)
261  fCsum_jet_had += energy[isec][imod];
262  }
263 
264  // gap Trigger
265  if (fCsum_mod < TrigThresholds_.at(0)) {
266  if (ioctsec == 0)
267  tdpo[ioct].at(0) = true;
268  else if (ioctsec == 1)
269  tdpo[ioct].at(1) = true;
270  }
271 
272  // jet Trigger
273  // with gain correction
274  /* old version of jet trigger ( deprecated because of saturation )
275  if( fCsum_mod > TrigThresholds_.at(1) / reweighted_gain )
276  tdpo[ioct].at(2) = true;
277  */
278  if (fCsum_jet_had > TrigThresholds_.at(1) / reweighted_gain)
279  // additional high threshold near saturation for EM part
280  if (energy[isec][0] > 26000 / reweighted_gain && energy[isec][1] > 26000 / reweighted_gain)
281  tdpo[ioct].at(2) = true;
282 
283  // low pt jet Trigger
284  if (fCsum_mod > TrigThresholds_.at(5) / reweighted_gain)
285  tdpo[ioct].at(6) = true;
286 
287  // egamma Trigger
288  // with gain correction only in the EM threshold
289  if (fCsum_em > TrigThresholds_.at(2) / reweighted_gain)
290  tdpo[ioct].at(3) = true;
291  if (fCsum_ha > TrigThresholds_.at(3))
292  tdpo[ioct].at(4) = true;
293 
294  // muon Trigger
295  int countColumns = 0;
296  for (int icol = 0; icol < 3; icol++)
297  if (fCsum_col[icol] > TrigThresholds_.at(4))
298  countColumns++;
299  if (countColumns >= 2)
300  tdpo[ioct].at(5) = true;
301  }
302  }
303 }
std::vector< double > TrigThresholds_
double reweighted_gain

◆ produce()

void CastorTTRecord::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::one::EDProducerBase.

Definition at line 67 of file CastorTTRecord.cc.

References CastorDigiColl_, MillePedeFileConverter_cfg::e, options_cfi::eventSetup, getEnergy_fC(), getTriggerDecisions(), mps_fire::i, eostools::move(), convertSQLitetoXML_cfg::output, TrigNames_, and ttpBits_.

67  {
68  // std::cerr << "**** RUNNING THROUGH CastorTTRecord::produce" << std::endl;
69 
70  std::vector<L1GtTechnicalTrigger> vecTT(ttpBits_.size());
71 
72  // Get Inputs
73  edm::Handle<CastorDigiCollection> CastorDigiColl;
74  e.getByToken(CastorDigiColl_, CastorDigiColl);
75 
76  if (!CastorDigiColl.failedToGet()) {
77  double cas_efC[16][14];
78  getEnergy_fC(cas_efC, CastorDigiColl, e, eventSetup);
79 
80  std::vector<bool> decision(ttpBits_.size());
81 
82  getTriggerDecisions(decision, cas_efC);
83 
84  for (unsigned int i = 0; i < ttpBits_.size(); i++) {
85  // if( decision.at(i) ) std::cerr << "**** Something Triggered" <<
86  // std::endl; std::cout << "Run CastorTTRecord::produce. TriggerBit = " <<
87  // ttpBits_.at(i) << "; TriggerName = " << TrigNames_.at(i) << "; Decision
88  // = " << decision[i] << std::endl;
89  vecTT.at(i) = L1GtTechnicalTrigger(TrigNames_.at(i), ttpBits_.at(i), 0, decision.at(i));
90  }
91 
92  } else {
93  vecTT.clear();
94  }
95 
96  // Put output into event
97  std::unique_ptr<L1GtTechnicalTriggerRecord> output(new L1GtTechnicalTriggerRecord());
98  output->setGtTechnicalTrigger(vecTT);
99  e.put(std::move(output));
100 }
std::vector< unsigned int > ttpBits_
std::vector< std::string > TrigNames_
edm::EDGetTokenT< CastorDigiCollection > CastorDigiColl_
void getEnergy_fC(double energy[16][14], edm::Handle< CastorDigiCollection > &CastorDigiColl, edm::Event &e, const edm::EventSetup &c)
def move(src, dest)
Definition: eostools.py:511
void getTriggerDecisions(std::vector< bool > &decision, double energy[16][14]) const

Member Data Documentation

◆ CastorDigiColl_

edm::EDGetTokenT<CastorDigiCollection> CastorTTRecord::CastorDigiColl_
private

Definition at line 41 of file CastorTTRecord.cc.

Referenced by CastorTTRecord(), and produce().

◆ CastorSignalTS_

unsigned int CastorTTRecord::CastorSignalTS_
private

Definition at line 42 of file CastorTTRecord.cc.

Referenced by CastorTTRecord(), and getEnergy_fC().

◆ conditionsToken_

edm::ESGetToken<CastorDbService, CastorDbRecord> CastorTTRecord::conditionsToken_
private

Definition at line 47 of file CastorTTRecord.cc.

Referenced by CastorTTRecord(), and getEnergy_fC().

◆ reweighted_gain

double CastorTTRecord::reweighted_gain
private

Definition at line 49 of file CastorTTRecord.cc.

Referenced by CastorTTRecord(), getEnergy_fC(), and getTriggerDecisionsPerOctant().

◆ TrigNames_

std::vector<std::string> CastorTTRecord::TrigNames_
private

Definition at line 45 of file CastorTTRecord.cc.

Referenced by CastorTTRecord(), and produce().

◆ TrigThresholds_

std::vector<double> CastorTTRecord::TrigThresholds_
private

Definition at line 46 of file CastorTTRecord.cc.

Referenced by CastorTTRecord(), and getTriggerDecisionsPerOctant().

◆ ttpBits_

std::vector<unsigned int> CastorTTRecord::ttpBits_
private

Definition at line 44 of file CastorTTRecord.cc.

Referenced by CastorTTRecord(), and produce().