test
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

double ecalLSB_
 
edm::EDGetTokenT
< EcalTrigPrimDigiCollection
ecalToken_
 
edm::Service< TFileServicefs_
 
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 64 of file L1CaloTowerTreeProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 104 of file L1CaloTowerTreeProducer.cc.

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

105 {
106 
107  ecalToken_ = consumes<EcalTrigPrimDigiCollection>(iConfig.getUntrackedParameter<edm::InputTag>("ecalToken"));
108  hcalToken_ = consumes<HcalTrigPrimDigiCollection>(iConfig.getUntrackedParameter<edm::InputTag>("hcalToken"));
109  l1TowerToken_ = consumes<l1t::CaloTowerBxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("l1TowerToken"));
110 
111  edm::InputTag clusterTag = iConfig.getUntrackedParameter<edm::InputTag>("l1ClusterToken");
112  if (clusterTag.instance() != std::string(""))
113  l1ClusterToken_ = consumes<l1t::CaloClusterBxCollection>(clusterTag);
114 
115  ecalLSB_ = iConfig.getUntrackedParameter<double>("ecalLSB", 0.5);
116  maxCaloTP_ = iConfig.getUntrackedParameter<unsigned int>("maxCaloTP", 5760);
117  maxL1Tower_ = iConfig.getUntrackedParameter<unsigned int>("maxL1Tower", 5760);
118  maxL1Cluster_ = iConfig.getUntrackedParameter<unsigned int>("maxL1Cluster", 5760);
119 
120  // set up output
121  tree_=fs_->make<TTree>("L1CaloTowerTree", "L1CaloTowerTree");
122  tree_->Branch("CaloTP", "L1Analysis::L1AnalysisCaloTPDataFormat", &caloTPData_, 32000, 3);
123  tree_->Branch("L1CaloTower", "L1Analysis::L1AnalysisL1CaloTowerDataFormat", &l1CaloTowerData_, 32000, 3);
124  tree_->Branch("L1CaloCluster", "L1Analysis::L1AnalysisL1CaloClusterDataFormat", &l1CaloClusterData_, 32000, 3);
125 
129 
130 }
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 133 of file L1CaloTowerTreeProducer.cc.

134 {
135 
136  // do anything here that needs to be done at desctruction time
137  // (e.g. close files, deallocate resources etc.)
138 
139 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 148 of file L1CaloTowerTreeProducer.cc.

References funct::abs(), caloTPData_, ecalLSB_, 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(), 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::L1AnalysisL1CaloClusterDataFormat::Reset(), L1Analysis::L1AnalysisL1CaloTowerDataFormat::Reset(), L1Analysis::L1AnalysisCaloTPDataFormat::Reset(), and tree_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 310 of file L1CaloTowerTreeProducer.cc.

311 {
312 }
void L1CaloTowerTreeProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 316 of file L1CaloTowerTreeProducer.cc.

316  {
317 }

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().

TTree* L1CaloTowerTreeProducer::tree_
private

Definition at line 92 of file L1CaloTowerTreeProducer.cc.

Referenced by analyze(), and L1CaloTowerTreeProducer().