CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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

unsigned long long ecalScaleCacheID_
 scales More...
 
edm::EDGetTokenT
< EcalTrigPrimDigiCollection
ecalToken_
 
edm::Service< TFileServicefs_
 
unsigned long long hcalScaleCacheID_
 
edm::EDGetTokenT
< HcalTrigPrimDigiCollection
hcalToken_
 
edm::EDGetTokenT
< l1t::CaloClusterBxCollection
l1ClusterToken_
 
edm::EDGetTokenT
< l1t::CaloTowerBxCollection
l1TowerToken_
 
unsigned maxCaloTP_
 
unsigned maxL1Cluster_
 
unsigned maxL1Tower_
 
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 66 of file L1CaloTowerTreeProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 109 of file L1CaloTowerTreeProducer.cc.

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

110 {
111 
112  ecalToken_ = consumes<EcalTrigPrimDigiCollection>(iConfig.getUntrackedParameter<edm::InputTag>("ecalToken"));
113  hcalToken_ = consumes<HcalTrigPrimDigiCollection>(iConfig.getUntrackedParameter<edm::InputTag>("hcalToken"));
114  l1TowerToken_ = consumes<l1t::CaloTowerBxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("l1TowerToken"));
115 
116  edm::InputTag clusterTag = iConfig.getUntrackedParameter<edm::InputTag>("l1ClusterToken");
117  if (clusterTag.instance() != std::string(""))
118  l1ClusterToken_ = consumes<l1t::CaloClusterBxCollection>(clusterTag);
119 
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  tree_->Branch("L1CaloCluster", "L1Analysis::L1AnalysisL1CaloClusterDataFormat", &l1CaloClusterData_, 32000, 3);
129 
133 
134 }
T getUntrackedParameter(std::string const &, T const &) const
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
L1Analysis::L1AnalysisCaloTPDataFormat * caloTPData_
edm::Service< TFileService > fs_
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalToken_
edm::EDGetTokenT< l1t::CaloClusterBxCollection > l1ClusterToken_
L1Analysis::L1AnalysisL1CaloClusterDataFormat * l1CaloClusterData_
edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecalToken_
edm::EDGetTokenT< l1t::CaloTowerBxCollection > l1TowerToken_
L1Analysis::L1AnalysisL1CaloTowerDataFormat * l1CaloTowerData_
std::string const & instance() const
Definition: InputTag.h:37
L1CaloTowerTreeProducer::~L1CaloTowerTreeProducer ( )

Definition at line 137 of file L1CaloTowerTreeProducer.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 152 of file L1CaloTowerTreeProducer.cc.

References funct::abs(), edm::eventsetup::EventSetupRecord::cacheIdentifier(), caloTPData_, ecalScaleCacheID_, ecalToken_, L1Analysis::L1AnalysisCaloTPDataFormat::ecalTPCaliphi, L1Analysis::L1AnalysisCaloTPDataFormat::ecalTPcompEt, L1Analysis::L1AnalysisCaloTPDataFormat::ecalTPet, L1Analysis::L1AnalysisCaloTPDataFormat::ecalTPfineGrain, L1Analysis::L1AnalysisCaloTPDataFormat::ecalTPieta, L1Analysis::L1AnalysisCaloTPDataFormat::ecalTPiphi, L1Analysis::L1AnalysisL1CaloClusterDataFormat::et, L1Analysis::L1AnalysisL1CaloTowerDataFormat::et, L1Analysis::L1AnalysisL1CaloClusterDataFormat::eta, L1Analysis::L1AnalysisL1CaloTowerDataFormat::eta, edm::EventSetup::get(), edm::Event::getByToken(), hcalScaleCacheID_, 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::ESHandleBase::isValid(), 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::L1AnalysisL1CaloClusterDataFormat::Reset(), L1Analysis::L1AnalysisCaloTPDataFormat::Reset(), L1Analysis::L1AnalysisL1CaloTowerDataFormat::Reset(), jetcorrextractor::sign(), and tree_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 326 of file L1CaloTowerTreeProducer.cc.

327 {
328 }
void L1CaloTowerTreeProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 332 of file L1CaloTowerTreeProducer.cc.

332  {
333 }

Member Data Documentation

L1Analysis::L1AnalysisCaloTPDataFormat* L1CaloTowerTreeProducer::caloTPData_

Definition at line 79 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

unsigned long long L1CaloTowerTreeProducer::ecalScaleCacheID_
private

scales

Definition at line 96 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze().

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

Definition at line 100 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

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

Definition at line 90 of file L1CaloTowerTreeProducer.cc.

Referenced by L1CaloTowerTreeProducer().

unsigned long long L1CaloTowerTreeProducer::hcalScaleCacheID_
private

Definition at line 97 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze().

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

Definition at line 101 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

L1Analysis::L1AnalysisL1CaloClusterDataFormat* L1CaloTowerTreeProducer::l1CaloClusterData_

Definition at line 81 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

L1Analysis::L1AnalysisL1CaloTowerDataFormat* L1CaloTowerTreeProducer::l1CaloTowerData_

Definition at line 80 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

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

Definition at line 103 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

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

Definition at line 102 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().

unsigned L1CaloTowerTreeProducer::maxCaloTP_
private

Definition at line 85 of file L1CaloTowerTreeProducer.cc.

Referenced by L1CaloTowerTreeProducer().

unsigned L1CaloTowerTreeProducer::maxL1Cluster_
private

Definition at line 87 of file L1CaloTowerTreeProducer.cc.

Referenced by L1CaloTowerTreeProducer().

unsigned L1CaloTowerTreeProducer::maxL1Tower_
private

Definition at line 86 of file L1CaloTowerTreeProducer.cc.

Referenced by L1CaloTowerTreeProducer().

TTree* L1CaloTowerTreeProducer::tree_
private

Definition at line 93 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().