CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
L1CaloTowerTreeProducer Class Reference

#include <L1TriggerDPG/L1Ntuples/src/L1CaloTowerTreeProducer.cc>

Inheritance diagram for L1CaloTowerTreeProducer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1CaloTowerTreeProducer (const edm::ParameterSet &)
 
 ~L1CaloTowerTreeProducer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::vector< ModuleDescription const * > &modules, 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 updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Public Attributes

L1Analysis::L1AnalysisCaloTPDataFormatcaloTPData_
 
L1Analysis::L1AnalysisL1CaloClusterDataFormatl1CaloClusterData_
 
L1Analysis::L1AnalysisL1CaloTowerDataFormatl1CaloTowerData_
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob (void)
 
virtual void endJob ()
 

Private Attributes

double ecalLSB_
 
edm::EDGetTokenT< EcalTrigPrimDigiCollectionecalToken_
 
edm::Service< TFileServicefs_
 
edm::EDGetTokenT< HcalTrigPrimDigiCollectionhcalToken_
 
edm::EDGetTokenT< l1t::CaloClusterBxCollectionl1ClusterToken_
 
edm::EDGetTokenT< l1t::CaloTowerBxCollectionl1TowerToken_
 
unsigned maxCaloTP_
 
unsigned maxL1Cluster_
 
unsigned maxL1Tower_
 
bool storeCaloClusters_
 
TTree * tree_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Description: Produce L1 Extra tree

Implementation:

Definition at line 64 of file L1CaloTowerTreeProducer.cc.

Constructor & Destructor Documentation

L1CaloTowerTreeProducer::L1CaloTowerTreeProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 105 of file L1CaloTowerTreeProducer.cc.

References caloTPData_, ecalLSB_, ecalToken_, fs_, edm::ParameterSet::getUntrackedParameter(), hcalToken_, edm::InputTag::instance(), l1CaloClusterData_, l1CaloTowerData_, l1ClusterToken_, l1TowerToken_, edm::InputTag::label(), TFileService::make(), maxCaloTP_, maxL1Cluster_, maxL1Tower_, or, storeCaloClusters_, AlCaHLTBitMon_QueryRunRegistry::string, and tree_.

106 {
107 
108  ecalToken_ = consumes<EcalTrigPrimDigiCollection>(iConfig.getUntrackedParameter<edm::InputTag>("ecalToken"));
109  hcalToken_ = consumes<HcalTrigPrimDigiCollection>(iConfig.getUntrackedParameter<edm::InputTag>("hcalToken"));
110  l1TowerToken_ = consumes<l1t::CaloTowerBxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("l1TowerToken"));
111 
112  edm::InputTag clusterTag = iConfig.getUntrackedParameter<edm::InputTag>("l1ClusterToken");
113  storeCaloClusters_=true;
114  if ( clusterTag.label() == std::string("") or clusterTag.label() == std::string("none")) storeCaloClusters_=false;
115 
116  if (clusterTag.instance() != std::string(""))
118 
119  ecalLSB_ = iConfig.getUntrackedParameter<double>("ecalLSB", 0.5);
120  maxCaloTP_ = iConfig.getUntrackedParameter<unsigned int>("maxCaloTP", 5760);
121  maxL1Tower_ = iConfig.getUntrackedParameter<unsigned int>("maxL1Tower", 5760);
122  maxL1Cluster_ = iConfig.getUntrackedParameter<unsigned int>("maxL1Cluster", 5760);
123 
124  // set up output
125  tree_=fs_->make<TTree>("L1CaloTowerTree", "L1CaloTowerTree");
126  tree_->Branch("CaloTP", "L1Analysis::L1AnalysisCaloTPDataFormat", &caloTPData_, 32000, 3);
127  tree_->Branch("L1CaloTower", "L1Analysis::L1AnalysisL1CaloTowerDataFormat", &l1CaloTowerData_, 32000, 3);
128 
129  if (storeCaloClusters_)
130  tree_->Branch("L1CaloCluster", "L1Analysis::L1AnalysisL1CaloClusterDataFormat", &l1CaloClusterData_, 32000, 3);
131 
132  caloTPData_ = new L1Analysis::L1AnalysisCaloTPDataFormat();
133  l1CaloTowerData_ = new L1Analysis::L1AnalysisL1CaloTowerDataFormat();
134  l1CaloClusterData_ = new L1Analysis::L1AnalysisL1CaloClusterDataFormat();
135 
136 }
T getUntrackedParameter(std::string const &, T const &) const
BXVector< CaloCluster > CaloClusterBxCollection
Definition: CaloCluster.h:85
static PFTauRenderPlugin instance
S make(const edm::ParameterSet &cfg)
delete x;
Definition: CaloConfig.h:22
L1Analysis::L1AnalysisCaloTPDataFormat * caloTPData_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::Service< TFileService > fs_
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalToken_
edm::EDGetTokenT< l1t::CaloClusterBxCollection > l1ClusterToken_
L1Analysis::L1AnalysisL1CaloClusterDataFormat * l1CaloClusterData_
edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecalToken_
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< l1t::CaloTowerBxCollection > l1TowerToken_
if(dp >Float(M_PI)) dp-
L1Analysis::L1AnalysisL1CaloTowerDataFormat * l1CaloTowerData_
L1CaloTowerTreeProducer::~L1CaloTowerTreeProducer ( )

Definition at line 139 of file L1CaloTowerTreeProducer.cc.

140 {
141 
142  // do anything here that needs to be done at desctruction time
143  // (e.g. close files, deallocate resources etc.)
144 
145 }

Member Function Documentation

void L1CaloTowerTreeProducer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Definition at line 154 of file L1CaloTowerTreeProducer.cc.

References funct::abs(), BXVector< T >::begin(), caloTPData_, ecalLSB_, ecalToken_, L1Analysis::L1AnalysisCaloTPDataFormat::ecalTPCaliphi, L1Analysis::L1AnalysisCaloTPDataFormat::ecalTPcompEt, L1Analysis::L1AnalysisCaloTPDataFormat::ecalTPet, L1Analysis::L1AnalysisCaloTPDataFormat::ecalTPfineGrain, L1Analysis::L1AnalysisCaloTPDataFormat::ecalTPieta, L1Analysis::L1AnalysisCaloTPDataFormat::ecalTPiphi, BXVector< T >::end(), stringResolutionProvider_cfi::et, L1Analysis::L1AnalysisL1CaloClusterDataFormat::et, L1Analysis::L1AnalysisL1CaloTowerDataFormat::et, L1Analysis::L1AnalysisL1CaloClusterDataFormat::eta, L1Analysis::L1AnalysisL1CaloTowerDataFormat::eta, edm::EventSetup::get(), edm::Event::getByToken(), BXVector< T >::getFirstBX(), BXVector< T >::getLastBX(), CaloTPGTranscoder::hcaletValue(), hcalToken_, L1Analysis::L1AnalysisCaloTPDataFormat::hcalTPCaliphi, L1Analysis::L1AnalysisCaloTPDataFormat::hcalTPcompEt, L1Analysis::L1AnalysisCaloTPDataFormat::hcalTPet, L1Analysis::L1AnalysisCaloTPDataFormat::hcalTPfineGrain, L1Analysis::L1AnalysisCaloTPDataFormat::hcalTPieta, L1Analysis::L1AnalysisCaloTPDataFormat::hcalTPiphi, L1Analysis::L1AnalysisL1CaloTowerDataFormat::iem, L1Analysis::L1AnalysisL1CaloClusterDataFormat::iet, L1Analysis::L1AnalysisL1CaloTowerDataFormat::iet, L1Analysis::L1AnalysisL1CaloClusterDataFormat::ieta, L1Analysis::L1AnalysisL1CaloTowerDataFormat::ieta, L1Analysis::L1AnalysisL1CaloTowerDataFormat::ihad, L1Analysis::L1AnalysisL1CaloClusterDataFormat::iphi, L1Analysis::L1AnalysisL1CaloTowerDataFormat::iphi, L1Analysis::L1AnalysisL1CaloClusterDataFormat::iqual, L1Analysis::L1AnalysisL1CaloTowerDataFormat::iqual, L1Analysis::L1AnalysisL1CaloTowerDataFormat::iratio, edm::EDGetTokenT< T >::isUninitialized(), edm::HandleBase::isValid(), l1CaloClusterData_, l1CaloTowerData_, l1ClusterToken_, l1TowerToken_, L1Analysis::L1AnalysisL1CaloClusterDataFormat::nCluster, L1Analysis::L1AnalysisCaloTPDataFormat::nECALTP, L1Analysis::L1AnalysisCaloTPDataFormat::nHCALTP, L1Analysis::L1AnalysisL1CaloTowerDataFormat::nTower, L1Analysis::L1AnalysisL1CaloClusterDataFormat::phi, L1Analysis::L1AnalysisL1CaloTowerDataFormat::phi, edm::Handle< T >::product(), L1Analysis::L1AnalysisCaloTPDataFormat::Reset(), L1Analysis::L1AnalysisL1CaloTowerDataFormat::Reset(), L1Analysis::L1AnalysisL1CaloClusterDataFormat::Reset(), storeCaloClusters_, and tree_.

155 {
156 
157  // do calo towers
158  caloTPData_->Reset();
159 
161  iSetup.get<CaloTPGRecord>().get(decoder);
162 
165 
166  iEvent.getByToken(ecalToken_, ecalTPs);
167  iEvent.getByToken(hcalToken_, hcalTPs);
168 
169  if (ecalTPs.isValid()){
170 
171  for ( auto itr : *(ecalTPs.product()) ) {
172 
173  short ieta = (short) itr.id().ieta();
174  // unsigned short absIeta = (unsigned short) abs(ieta);
175  // short sign = ieta/absIeta;
176 
177  unsigned short cal_iphi = (unsigned short) itr.id().iphi();
178  unsigned short iphi = (72 + 18 - cal_iphi) % 72;
179  unsigned short compEt = itr.compressedEt();
180  double et = ecalLSB_ * compEt;
181  unsigned short fineGrain = (unsigned short) itr.fineGrain();
182 
183  if (compEt > 0) {
184  caloTPData_->ecalTPieta.push_back( ieta );
185  caloTPData_->ecalTPCaliphi.push_back( cal_iphi );
186  caloTPData_->ecalTPiphi.push_back( iphi );
187  caloTPData_->ecalTPet.push_back( et );
188  caloTPData_->ecalTPcompEt.push_back( compEt );
189  caloTPData_->ecalTPfineGrain.push_back( fineGrain );
190  caloTPData_->nECALTP++;
191  }
192  }
193 
194  }
195  else {
196  edm::LogWarning("L1TNtuple") << "ECAL TPs not found, branch will not be filled";
197  }
198 
199 
200  if (hcalTPs.isValid()) {
201 
202  for ( auto itr : (*hcalTPs.product()) ) {
203 
204  int ver = itr.id().version();
205  short ieta = (short) itr.id().ieta();
206  unsigned short absIeta = (unsigned short) abs(ieta);
207  // short sign = ieta/absIeta;
208 
209  unsigned short cal_iphi = (unsigned short) itr.id().iphi();
210  unsigned short iphi = (72 + 18 - cal_iphi) % 72;
211 
212  unsigned short compEt = itr.SOI_compressedEt();
213  double et = decoder->hcaletValue(itr.id(), itr.t0());
214 
215  unsigned short fineGrain = (unsigned short) itr.SOI_fineGrain();
216 
217  if (compEt > 0 && (absIeta<29 || ver==1)) {
218  caloTPData_->hcalTPieta.push_back( ieta );
219  caloTPData_->hcalTPCaliphi.push_back( cal_iphi );
220  caloTPData_->hcalTPiphi.push_back( iphi );
221  caloTPData_->hcalTPet.push_back( et );
222  caloTPData_->hcalTPcompEt.push_back( compEt );
223  caloTPData_->hcalTPfineGrain.push_back( fineGrain );
224  caloTPData_->nHCALTP++;
225  }
226  }
227 
228  }
229  else {
230  edm::LogWarning("L1TNtuple") << "HCAL TPs not found, branch will not be filled";
231  }
232 
233  // do L1 towers
235 
237 
238  iEvent.getByToken(l1TowerToken_, l1Towers);
239 
240  if (l1Towers.isValid()){
241 
242  for ( int ibx=l1Towers->getFirstBX(); ibx<=l1Towers->getLastBX(); ++ibx) {
243 
244  for ( auto itr = l1Towers->begin(ibx); itr !=l1Towers->end(ibx); ++itr ) {
245 
246  if (itr->hwPt()<=0) continue;
247 
248  // l1CaloTowerData_->bx.push_back( ibx );
249  l1CaloTowerData_->et.push_back( itr->pt() );
250  l1CaloTowerData_->eta.push_back( itr->eta() );
251  l1CaloTowerData_->phi.push_back( itr->phi() );
252  l1CaloTowerData_->iet.push_back( itr->hwPt() );
253  l1CaloTowerData_->ieta.push_back( itr->hwEta() );
254  l1CaloTowerData_->iphi.push_back( itr->hwPhi() );
255  l1CaloTowerData_->iem.push_back( itr->hwEtEm() );
256  l1CaloTowerData_->ihad.push_back( itr->hwEtHad() );
257  l1CaloTowerData_->iratio.push_back( itr->hwEtRatio() );
258  l1CaloTowerData_->iqual.push_back( itr->hwQual() );
259 
261 
262  }
263 
264  }
265 
266  }
267  else {
268  edm::LogWarning("L1TNtuple") << "L1 Calo Towerss not found, branch will not be filled";
269  }
270 
271 
272  // do L1 clusters
273  if (storeCaloClusters_){
275 
277 
279  iEvent.getByToken(l1ClusterToken_, l1Clusters);
280 
281  if (l1Clusters.isValid()){
282 
283  for ( int ibx=l1Clusters->getFirstBX(); ibx<=l1Clusters->getLastBX(); ++ibx) {
284 
285  for ( auto itr = l1Clusters->begin(ibx); itr !=l1Clusters->end(ibx); ++itr ) {
286 
287  if (itr->hwPt()<=0) continue;
288 
289  // l1CaloClusterData_->bx.push_back( ibx );
290  l1CaloClusterData_->et.push_back( itr->pt() );
291  l1CaloClusterData_->eta.push_back( itr->eta() );
292  l1CaloClusterData_->phi.push_back( itr->phi() );
293  l1CaloClusterData_->iet.push_back( itr->hwPt() );
294  l1CaloClusterData_->ieta.push_back( itr->hwEta() );
295  l1CaloClusterData_->iphi.push_back( itr->hwPhi() );
296  l1CaloClusterData_->iqual.push_back( itr->hwQual() );
297 
299 
300  }
301 
302  }
303 
304  }
305  else {
306  edm::LogWarning("L1TNtuple") << "L1 Calo Clusters not found, branch will not be filled";
307  }
308  }
309 
310 
311  tree_->Fill();
312 
313 }
const_iterator end(int bx) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
L1Analysis::L1AnalysisCaloTPDataFormat * caloTPData_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalToken_
bool isValid() const
Definition: HandleBase.h:74
int getFirstBX() const
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< l1t::CaloClusterBxCollection > l1ClusterToken_
const T & get() const
Definition: EventSetup.h:56
L1Analysis::L1AnalysisL1CaloClusterDataFormat * l1CaloClusterData_
edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecalToken_
et
define resolution functions of each parameter
edm::EDGetTokenT< l1t::CaloTowerBxCollection > l1TowerToken_
int getLastBX() const
bool isUninitialized() const
Definition: EDGetToken.h:73
virtual double hcaletValue(const int &ieta, const int &iphi, const int &version, const int &compressedValue) const =0
L1Analysis::L1AnalysisL1CaloTowerDataFormat * l1CaloTowerData_
const_iterator begin(int bx) const
void L1CaloTowerTreeProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 317 of file L1CaloTowerTreeProducer.cc.

318 {
319 }
void L1CaloTowerTreeProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 323 of file L1CaloTowerTreeProducer.cc.

References DEFINE_FWK_MODULE.

323  {
324 }

Member Data Documentation

L1Analysis::L1AnalysisCaloTPDataFormat* L1CaloTowerTreeProducer::caloTPData_

Definition at line 77 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

double L1CaloTowerTreeProducer::ecalLSB_
private

Definition at line 83 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

edm::EDGetTokenT<EcalTrigPrimDigiCollection> L1CaloTowerTreeProducer::ecalToken_
private

Definition at line 95 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

edm::Service<TFileService> L1CaloTowerTreeProducer::fs_
private

Definition at line 89 of file L1CaloTowerTreeProducer.cc.

Referenced by L1CaloTowerTreeProducer().

edm::EDGetTokenT<HcalTrigPrimDigiCollection> L1CaloTowerTreeProducer::hcalToken_
private

Definition at line 96 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

L1Analysis::L1AnalysisL1CaloClusterDataFormat* L1CaloTowerTreeProducer::l1CaloClusterData_

Definition at line 79 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

L1Analysis::L1AnalysisL1CaloTowerDataFormat* L1CaloTowerTreeProducer::l1CaloTowerData_

Definition at line 78 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

edm::EDGetTokenT<l1t::CaloClusterBxCollection> L1CaloTowerTreeProducer::l1ClusterToken_
private

Definition at line 98 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

edm::EDGetTokenT<l1t::CaloTowerBxCollection> L1CaloTowerTreeProducer::l1TowerToken_
private

Definition at line 97 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

unsigned L1CaloTowerTreeProducer::maxCaloTP_
private

Definition at line 84 of file L1CaloTowerTreeProducer.cc.

Referenced by L1CaloTowerTreeProducer().

unsigned L1CaloTowerTreeProducer::maxL1Cluster_
private

Definition at line 86 of file L1CaloTowerTreeProducer.cc.

Referenced by L1CaloTowerTreeProducer().

unsigned L1CaloTowerTreeProducer::maxL1Tower_
private

Definition at line 85 of file L1CaloTowerTreeProducer.cc.

Referenced by L1CaloTowerTreeProducer().

bool L1CaloTowerTreeProducer::storeCaloClusters_
private

Definition at line 100 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

TTree* L1CaloTowerTreeProducer::tree_
private

Definition at line 92 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().