CMS 3D CMS Logo

HGCTowerAlgo.cc
Go to the documentation of this file.
5 
14 
15 
16 using namespace HGCalTriggerBackend;
17 
18 
19 template<typename FECODEC, typename DATA>
20 class HGCTowerAlgo : public Algorithm<FECODEC>
21 {
22  public:
24 
25  protected:
27 
28 
29  public:
30 
32  Algorithm<FECODEC>(conf, cc),
33  trgcell_product_( new l1t::HGCalTriggerCellBxCollection ),
34  towermap_product_( new l1t::HGCalTowerMapBxCollection ),
35  tower_product_( new l1t::HGCalTowerBxCollection ),
36  calibration_( conf.getParameterSet("calib_parameters") ),
37  towermap2D_( conf.getParameterSet("towermap_parameters") ),
38  towermap3D_( )
39  {
40  }
41 
42 
44  {
45  prod.produces<l1t::HGCalTriggerCellBxCollection>( "calibratedTriggerCellsTower" );
46  prod.produces<l1t::HGCalTowerMapBxCollection>( "towerMap" );
47  prod.produces<l1t::HGCalTowerBxCollection>( "tower" );
48  }
49 
50 
51  void run(const l1t::HGCFETriggerDigiCollection& coll, const edm::EventSetup& es, edm::Event&evt ) final;
52 
53 
54  void putInEvent(edm::Event& evt) final
55  {
56 
57  }
58 
59 
60  void reset() final
61  {
62  trgcell_product_.reset( new l1t::HGCalTriggerCellBxCollection );
63  towermap_product_.reset( new l1t::HGCalTowerMapBxCollection );
64  tower_product_.reset( new l1t::HGCalTowerBxCollection );
65  }
66 
67 
68  private:
69 
70  /* pointers to collections of trigger-cells, towerMaps and towers */
71  std::unique_ptr<l1t::HGCalTriggerCellBxCollection> trgcell_product_;
72  std::unique_ptr<l1t::HGCalTowerMapBxCollection> towermap_product_;
73  std::unique_ptr<l1t::HGCalTowerBxCollection> tower_product_;
74 
76 
77  /* algorithms instances */
81 };
82 
83 
84 template<typename FECODEC, typename DATA>
86  const edm::EventSetup & es,
87  edm::Event & evt )
88 {
89  es.get<CaloGeometryRecord>().get("", triggerGeometry_);
90  calibration_.eventSetup(es);
91  towermap2D_.eventSetup(es);
92 
93  for( const auto& digi : coll ){
94 
95  HGCalDetId module_id( digi.id() );
96 
97 
98  DATA data;
99  data.reset();
100  digi.decode(codec_, data);
101 
102  for(const auto& triggercell : data.payload)
103  {
104 
105  if( triggercell.hwPt() > 0 )
106  {
107  l1t::HGCalTriggerCell calibratedtriggercell( triggercell );
108  calibration_.calibrateInGeV( calibratedtriggercell);
109  trgcell_product_->push_back( 0, calibratedtriggercell );
110  }
111 
112  }
113 
114  }
115 
116  /* orphan handles to the collections of trigger-cells, towermaps and towers */
120 
121  /* retrieve the orphan handle to the trigger-cells collection and put the collection in the event */
122  triggerCellsHandle = evt.put( std::move( trgcell_product_ ), "calibratedTriggerCellsTower");
123 
124  /* create a persistent vector of pointers to the trigger-cells */
125  std::vector<edm::Ptr<l1t::HGCalTriggerCell>> triggerCellsPtrs;
126  for( unsigned i = 0; i < triggerCellsHandle->size(); ++i ) {
127  edm::Ptr<l1t::HGCalTriggerCell> ptr(triggerCellsHandle,i);
128  triggerCellsPtrs.push_back(ptr);
129  }
130 
131  /* call to towerMap2D clustering */
132  towermap2D_.buildTowerMap2D( triggerCellsPtrs, *towermap_product_);
133 
134  /* retrieve the orphan handle to the towermaps collection and put the collection in the event */
135  towerMapsHandle = evt.put( std::move( towermap_product_ ), "towerMap");
136 
137  /* create a persistent vector of pointers to the towerMaps */
138  std::vector<edm::Ptr<l1t::HGCalTowerMap>> towerMapsPtrs;
139  for( unsigned i = 0; i < towerMapsHandle->size(); ++i ) {
140  edm::Ptr<l1t::HGCalTowerMap> ptr(towerMapsHandle,i);
141  towerMapsPtrs.push_back(ptr);
142  }
143 
144  /* call to towerMap3D clustering */
145  towermap3D_.buildTowerMap3D( towerMapsPtrs, *tower_product_);
146 
147  /* retrieve the orphan handle to the tower collection and put the collection in the event */
148  towersHandle = evt.put( std::move( tower_product_ ), "tower");
149 
150 }
151 
154 
155 
158  "HGCTowerAlgoBestChoice");
159 
162  "HGCTowerAlgoThreshold");
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
std::unique_ptr< l1t::HGCalTowerMapBxCollection > towermap_product_
Definition: HGCTowerAlgo.cc:72
unsigned size(int bx) const
BXVector< HGCalTriggerCell > HGCalTriggerCellBxCollection
std::unique_ptr< l1t::HGCalTriggerCellBxCollection > trgcell_product_
Definition: HGCTowerAlgo.cc:71
ParameterSet const & getParameterSet(ParameterSetID const &id)
delete x;
Definition: CaloConfig.h:22
BXVector< HGCalTowerMap > HGCalTowerMapBxCollection
Definition: HGCalTowerMap.h:11
BXVector< HGCalTower > HGCalTowerBxCollection
Definition: HGCalTower.h:10
edm::ESHandle< HGCalTriggerGeometryBase > triggerGeometry_
Definition: HGCTowerAlgo.cc:75
HGCTowerAlgo< HGCalTriggerCellBestChoiceCodec, HGCalTriggerCellBestChoiceCodec::data_type > HGCTowerAlgoBestChoice
HGCalTriggerCellCalibration calibration_
Definition: HGCTowerAlgo.cc:78
HGCTowerAlgo< HGCalTriggerCellThresholdCodec, HGCalTriggerCellThresholdCodec::data_type > HGCTowerAlgoThreshold
void putInEvent(edm::Event &evt) final
Definition: HGCTowerAlgo.cc:54
HGCalTowerMap2DImpl towermap2D_
Definition: HGCTowerAlgo.cc:79
std::unique_ptr< l1t::HGCalTowerBxCollection > tower_product_
Definition: HGCTowerAlgo.cc:73
JetCorrectorParametersCollection coll
Definition: classes.h:10
void run(const l1t::HGCFETriggerDigiCollection &coll, const edm::EventSetup &es, edm::Event &evt) final
Definition: HGCTowerAlgo.cc:85
HGCTowerAlgo(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
Definition: HGCTowerAlgo.cc:31
const T & get() const
Definition: EventSetup.h:55
HGCalTowerMap3DImpl towermap3D_
Definition: HGCTowerAlgo.cc:80
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
#define DEFINE_EDM_PLUGIN(factory, type, name)
void setProduces(edm::stream::EDProducer<> &prod) const final
Definition: HGCTowerAlgo.cc:43
void reset() final
Definition: HGCTowerAlgo.cc:60
def move(src, dest)
Definition: eostools.py:510