CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Private Member Functions | Private Attributes
L1RCTTestAnalyzer Class Reference

#include <src/L1RCTTestAnalyzer/src/L1RCTTestAnalyzer.cc>

Inheritance diagram for L1RCTTestAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
 L1RCTTestAnalyzer (const edm::ParameterSet &)
 
 ~L1RCTTestAnalyzer ()
 
- 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 (const std::string &iProcessName, std::vector< const char * > &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 ()
 

Static Private Member Functions

static bool compareEmCands (const L1CaloEmCand &cand1, const L1CaloEmCand &cand2)
 

Private Attributes

edm::InputTag ecalDigisLabel
 
std::vector< int > emIeta
 
std::vector< int > emIphi
 
std::vector< int > emIso
 
std::vector< int > emRank
 
TTree * emTree
 
TH1F * h_ecalTimeSample
 
TH1F * h_emCandTimeSample
 
TH1F * h_emIeta
 
TH1F * h_emIphi
 
TH1F * h_emIso
 
TH2F * h_emIsoInIetaIphi
 
TH2F * h_emNonIsoInIetaIphi
 
TH1F * h_emRank
 
TH2F * h_emRankInIetaIphi
 
TH1F * h_emRankOutOfTime
 
TH1F * h_hcalTimeSample
 
TH2F * h_regionFGInIetaIphi
 
TH1F * h_regionIeta
 
TH1F * h_regionIphi
 
TH1F * h_regionMip
 
TH1F * h_regionSum
 
TH2F * h_regionSumInIetaIphi
 
TH1F * h_towerMip
 
edm::InputTag hcalDigisLabel
 
std::string m_HepMCProduct
 
edm::InputTag rctDigisLabel
 
bool showEmCands
 
bool showRegionSums
 

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: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 55 of file L1RCTTestAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file L1RCTTestAnalyzer.cc.

References emIeta, emIphi, emIso, emRank, emTree, h_ecalTimeSample, h_emCandTimeSample, h_emIeta, h_emIphi, h_emIso, h_emIsoInIetaIphi, h_emNonIsoInIetaIphi, h_emRank, h_emRankInIetaIphi, h_emRankOutOfTime, h_hcalTimeSample, h_regionFGInIetaIphi, h_regionIeta, h_regionIphi, h_regionMip, h_regionSum, h_regionSumInIetaIphi, h_towerMip, and TFileService::make().

27  :
28  showEmCands(iConfig.getUntrackedParameter<bool>("showEmCands")),
29  showRegionSums(iConfig.getUntrackedParameter<bool>("showRegionSums")),
30  ecalDigisLabel(iConfig.getParameter<edm::InputTag>("ecalDigisLabel")),
31  hcalDigisLabel(iConfig.getParameter<edm::InputTag>("hcalDigisLabel")),
32  rctDigisLabel(iConfig.getParameter<edm::InputTag>("rctDigisLabel"))
33 {
34  //now do what ever initialization is needed
35 
37 
38  emTree = fs->make<TTree>("emTree","L1 RCT EM tree");
39 // emTree->Branch("emRank",emRank,"emRank/I");
40 // emTree->Branch("emIeta",emIeta,"emIeta/I");
41 // emTree->Branch("emIphi",emIphi,"emIphi/I");
42 // emTree->Branch("emIso" ,emIso ,"emIso/I");
43  emTree->Branch("emRank",&emRank);
44  emTree->Branch("emIeta",&emIeta);
45  emTree->Branch("emIphi",&emIphi);
46  emTree->Branch("emIso" ,&emIso);
47 
48  h_emRank = fs->make<TH1F>( "emRank", "emRank", 64, 0., 64. );
49  h_emRankOutOfTime = fs->make<TH1F>( "emRankOutOfTime", "emRankOutOfTime",
50  64, 0., 64. );
51  h_emIeta = fs->make<TH1F>( "emIeta", "emIeta", 22, 0., 22. );
52  h_emIphi = fs->make<TH1F>( "emIphi", "emIphi", 18, 0., 18. );
53  h_emIso = fs->make<TH1F>( "emIso", "emIso", 2, 0., 2. );
54  h_emRankInIetaIphi = fs->make<TH2F>( "emRank2D", "emRank2D", 22, 0., 22.,
55  18, 0., 18. );
56  h_emIsoInIetaIphi = fs->make<TH2F>( "emIso2D", "emIso2D", 22, 0., 22.,
57  18, 0., 18. );
58  h_emNonIsoInIetaIphi = fs->make<TH2F>( "emNonIso2D", "emNonIso2D", 22, 0.,
59  22., 18, 0., 18. );
60  h_emCandTimeSample = fs->make<TH1F>( "emCandTimeSample", "emCandTimeSample",
61  5, -2., 2.);
62 
63  h_regionSum = fs->make<TH1F>( "regionSum", "regionSum", 100, 0., 100. );
64  h_regionIeta = fs->make<TH1F>( "regionIeta", "regionIeta", 22, 0., 22. );
65  h_regionIphi = fs->make<TH1F>( "regionIphi", "regionIphi", 18, 0., 18. );
66  h_regionMip = fs->make<TH1F>( "regionMip", "regionMipBit", 2, 0., 2. );
67  h_regionSumInIetaIphi = fs->make<TH2F>( "regionSum2D", "regionSum2D", 22,
68  0., 22., 18, 0., 18. );
69  h_regionFGInIetaIphi = fs->make<TH2F>( "regionFG2D", "regionFG2D", 22, 0.,
70  22., 18, 0., 18. );
71 
72  h_towerMip = fs->make<TH1F>( "towerMip", "towerMipBit", 2, 0., 2. );
73 
74  h_ecalTimeSample = fs->make<TH1F>( "ecalTimeSample", "ecalTimeSample",
75  10, 0., 10. );
76  h_hcalTimeSample = fs->make<TH1F>( "hcalTimeSample", "hcalTimeSample",
77  10, 0., 10. );
78 
79  // get names of modules, producing object collections
80 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > emIeta
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::vector< int > emRank
edm::InputTag rctDigisLabel
edm::InputTag hcalDigisLabel
edm::InputTag ecalDigisLabel
std::vector< int > emIso
std::vector< int > emIphi
L1RCTTestAnalyzer::~L1RCTTestAnalyzer ( )

Definition at line 83 of file L1RCTTestAnalyzer.cc.

84 {
85 
86  // do anything here that needs to be done at destruction time
87  // (e.g. close files, deallocate resources etc.)
88 
89 }

Member Function Documentation

void L1RCTTestAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 98 of file L1RCTTestAnalyzer.cc.

References compareEmCands(), gather_cfg::cout, patCandidatesForDimuonsSequences_cff::ecal, ecalDigisLabel, emIeta, emIphi, emIso, emRank, emTree, edm::EventSetup::get(), edm::Event::getByLabel(), h_ecalTimeSample, h_emCandTimeSample, h_emIeta, h_emIphi, h_emIso, h_emIsoInIetaIphi, h_emNonIsoInIetaIphi, h_emRank, h_emRankInIetaIphi, h_emRankOutOfTime, h_hcalTimeSample, h_regionFGInIetaIphi, h_regionIeta, h_regionIphi, h_regionMip, h_regionSum, h_regionSumInIetaIphi, h_towerMip, patCandidatesForDimuonsSequences_cff::hcal, hcalDigisLabel, rctDigisLabel, compare_using_db::sample, showEmCands, showRegionSums, and python.multivaluedict::sort().

99 {
100  using namespace edm;
101 #ifdef THIS_IS_AN_EVENT_EXAMPLE
103  iEvent.getByLabel("example",pIn);
104 #endif
105 
106 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
107  ESHandle<SetupData> pSetup;
108  iSetup.get<SetupRecord>().get(pSetup);
109 #endif
110 
111  // as in L1GctTestAnalyzer.cc
112  Handle<L1CaloEmCollection> rctEmCands;
116 
117  L1CaloEmCollection::const_iterator em;
118  L1CaloRegionCollection::const_iterator rgn;
121 
122  iEvent.getByLabel(rctDigisLabel, rctEmCands);
123  iEvent.getByLabel(rctDigisLabel, rctRegions);
124  iEvent.getByLabel(ecalDigisLabel, ecalColl);
125  iEvent.getByLabel(hcalDigisLabel, hcalColl);
126 
127  // for sorting later
128  L1CaloEmCollection * myL1EmColl = new L1CaloEmCollection;
129 
130  for (ecal=ecalColl->begin(); ecal!=ecalColl->end(); ecal++)
131  {
132  for (unsigned short sample = 0; sample < (*ecal).size(); sample++)
133  {
134  h_ecalTimeSample->Fill(sample);
135  }
136  }
137 
138  for (hcal=hcalColl->begin(); hcal!=hcalColl->end(); hcal++)
139  {
140  h_towerMip->Fill( (*hcal).SOI_fineGrain() );
141  for (unsigned short sample = 0; sample < (*hcal).size(); sample++)
142  {
143  h_hcalTimeSample->Fill(sample);
144  }
145  }
146 
147  if(showEmCands)
148  {
149  // std::cout << std::endl << "L1 RCT EmCand objects" << std::endl;
150  }
151  for (em=rctEmCands->begin(); em!=rctEmCands->end(); em++){
152  // std::cout << "(Analyzer)\n" << (*em) << std::endl;
153 
154  L1CaloEmCand * myL1EmCand = new L1CaloEmCand(*em);
155  (*myL1EmColl).push_back(*myL1EmCand);
156  delete myL1EmCand;
157 
158  h_emCandTimeSample->Fill((*em).bx());
159  if ((*em).bx() == 0)
160  {
161  unsigned short n_emcands = 0;
162  //std::cout << std::endl << "rank: " << (*em).rank() ;
163 
164  if ((*em).rank() > 0)
165  {
166  h_emRank->Fill( (*em).rank() );
167  h_emIeta->Fill( (*em).regionId().ieta() );
168  h_emIphi->Fill( (*em).regionId().iphi() );
169  h_emIso->Fill( (*em).isolated() );
170  h_emRankInIetaIphi->Fill( (*em).regionId().ieta(),
171  (*em).regionId().iphi(),
172  (*em).rank() );
173  if ((*em).isolated())
174  {
175  h_emIsoInIetaIphi->Fill( (*em).regionId().ieta(),
176  (*em).regionId().iphi() );
177  }
178  else
179  {
180  h_emNonIsoInIetaIphi->Fill( (*em).regionId().ieta(),
181  (*em).regionId().iphi() );
182  }
183  }
184 
185  if (showEmCands)
186  {
187  if ((*em).rank() > 0)
188  {
189  // std::cout << std::endl << "rank: " << (*em).rank();
190  unsigned short rgnPhi = 999;
191  unsigned short rgn = (unsigned short) (*em).rctRegion();
192  unsigned short card = (unsigned short) (*em).rctCard();
193  unsigned short crate = (unsigned short) (*em).rctCrate();
194 
195  if (card == 6)
196  {
197  rgnPhi = rgn;
198  }
199  else if (card < 6)
200  {
201  rgnPhi = (card % 2);
202  }
203  else
204  {
205  std::cout << "rgnPhi not assigned (still " << rgnPhi << ") -- Weird card number! " << card ;
206  }
207 
208  //unsigned short phi_bin = ((crate % 9) * 2) + rgnPhi;
209  short eta_bin = (card/2) * 2 + 1;
210  if (card < 6)
211  {
212  eta_bin = eta_bin + rgn;
213  }
214  if (crate < 9)
215  {
216  eta_bin = -eta_bin;
217  }
218  n_emcands++;
219 
220  // std::cout << /* "rank: " << (*em).rank() << */ " eta_bin: " << eta_bin << " phi_bin: " << phi_bin << ". crate: " << crate << " card: " << card << " region: " << rgn << ". isolated: " << (*em).isolated();
221  }
222  }
223  }
224  else
225  {
226  h_emRankOutOfTime->Fill( (*em).rank() );
227  }
228  }
229  if(showEmCands)
230  {
231  // std::cout << std::endl;
232  }
233 
234  // next: SORT THESE GUYS so they're entered into the tree highest first
235 // std::sort(rctEmCands->begin(),rctEmCands->end(),compareEmCands);
236 // for (em=rctEmCands->begin(); em!=rctEmCands->end(); em++)
237  std::sort(myL1EmColl->begin(),myL1EmColl->end(),compareEmCands);
238  std::reverse(myL1EmColl->begin(),myL1EmColl->end()); // whoops!
239  for (em=myL1EmColl->begin(); em!=myL1EmColl->end(); em++)
240  {
241  emRank.push_back( (*em).rank() );
242  emIeta.push_back( (*em).regionId().ieta() );
243  emIphi.push_back( (*em).regionId().iphi() );
244  emIso.push_back( (*em).isolated() );
245  }
246  emTree->Fill();
247 
248 
249  if(showRegionSums)
250  {
251  std::cout << "Regions" << std::endl;
252  }
253  for (rgn=rctRegions->begin(); rgn!=rctRegions->end(); rgn++)
254  {
255  if ((*rgn).bx() == 0)
256  {
257  if(showRegionSums&&(*rgn).et()>0)
258  {
259  std::cout << /* "(Analyzer)\n" << */ (*rgn) << std::endl;
260  }
261  if ( (*rgn).et() > 0 )
262  {
263  h_regionSum->Fill( (*rgn).et() );
264  h_regionIeta->Fill( (*rgn).gctEta() );
265  h_regionIphi->Fill( (*rgn).gctPhi() );
266  h_regionSumInIetaIphi->Fill( (*rgn).gctEta(), (*rgn).gctPhi(),
267  (*rgn).et() );
268  h_regionFGInIetaIphi->Fill( (*rgn).gctEta(), (*rgn).gctPhi(),
269  (*rgn).fineGrain() );
270  }
271  h_regionMip->Fill( (*rgn).mip() );
272  }
273  }
274  if(showRegionSums)
275  {
276  std::cout << std::endl;
277  }
278 
279  emRank.clear();
280  emIeta.clear();
281  emIphi.clear();
282  emIso.clear();
283 
284  delete myL1EmColl;
285 }
std::vector< int > emIeta
std::vector< L1CaloEmCand > L1CaloEmCollection
static bool compareEmCands(const L1CaloEmCand &cand1, const L1CaloEmCand &cand2)
std::vector< EcalTriggerPrimitiveDigi >::const_iterator const_iterator
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:18
std::vector< int > emRank
edm::InputTag rctDigisLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
edm::InputTag hcalDigisLabel
edm::InputTag ecalDigisLabel
const T & get() const
Definition: EventSetup.h:56
tuple cout
Definition: gather_cfg.py:121
std::vector< int > emIso
std::vector< int > emIphi
bool L1RCTTestAnalyzer::compareEmCands ( const L1CaloEmCand cand1,
const L1CaloEmCand cand2 
)
staticprivate

Definition at line 288 of file L1RCTTestAnalyzer.cc.

References L1CaloEmCand::rank().

Referenced by analyze().

289 {
290  return (cand1.rank() < cand2.rank());
291 }
unsigned rank() const
get rank bits
Definition: L1CaloEmCand.h:44

Member Data Documentation

edm::InputTag L1RCTTestAnalyzer::ecalDigisLabel
private

Definition at line 69 of file L1RCTTestAnalyzer.h.

Referenced by analyze().

std::vector<int> L1RCTTestAnalyzer::emIeta
private

Definition at line 79 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

std::vector<int> L1RCTTestAnalyzer::emIphi
private

Definition at line 80 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

std::vector<int> L1RCTTestAnalyzer::emIso
private

Definition at line 81 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

std::vector<int> L1RCTTestAnalyzer::emRank
private

Definition at line 78 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TTree* L1RCTTestAnalyzer::emTree
private

Definition at line 73 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_ecalTimeSample
private

Definition at line 105 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_emCandTimeSample
private

Definition at line 92 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_emIeta
private

Definition at line 85 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_emIphi
private

Definition at line 86 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_emIso
private

Definition at line 87 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH2F* L1RCTTestAnalyzer::h_emIsoInIetaIphi
private

Definition at line 90 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH2F* L1RCTTestAnalyzer::h_emNonIsoInIetaIphi
private

Definition at line 91 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_emRank
private

Definition at line 83 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH2F* L1RCTTestAnalyzer::h_emRankInIetaIphi
private

Definition at line 88 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_emRankOutOfTime
private

Definition at line 84 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_hcalTimeSample
private

Definition at line 106 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH2F* L1RCTTestAnalyzer::h_regionFGInIetaIphi
private

Definition at line 101 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_regionIeta
private

Definition at line 95 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_regionIphi
private

Definition at line 96 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_regionMip
private

Definition at line 97 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_regionSum
private

Definition at line 94 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH2F* L1RCTTestAnalyzer::h_regionSumInIetaIphi
private

Definition at line 98 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

TH1F* L1RCTTestAnalyzer::h_towerMip
private

Definition at line 103 of file L1RCTTestAnalyzer.h.

Referenced by analyze(), and L1RCTTestAnalyzer().

edm::InputTag L1RCTTestAnalyzer::hcalDigisLabel
private

Definition at line 70 of file L1RCTTestAnalyzer.h.

Referenced by analyze().

std::string L1RCTTestAnalyzer::m_HepMCProduct
private

Definition at line 66 of file L1RCTTestAnalyzer.h.

edm::InputTag L1RCTTestAnalyzer::rctDigisLabel
private

Definition at line 71 of file L1RCTTestAnalyzer.h.

Referenced by analyze().

bool L1RCTTestAnalyzer::showEmCands
private

Definition at line 67 of file L1RCTTestAnalyzer.h.

Referenced by analyze().

bool L1RCTTestAnalyzer::showRegionSums
private

Definition at line 68 of file L1RCTTestAnalyzer.h.

Referenced by analyze().