CMS 3D CMS Logo

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

#include <JetToDigiDump.h>

Inheritance diagram for JetToDigiDump:
edm::EDAnalyzer

Public Member Functions

 JetToDigiDump (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

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

Private Attributes

std::string CaloJetAlg
 
int DebugLevel
 
int Dump
 
std::string DumpLevel
 
int evtCount
 
bool ShowECal
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 15 of file JetToDigiDump.h.

Constructor & Destructor Documentation

JetToDigiDump::JetToDigiDump ( const edm::ParameterSet cfg)

Definition at line 43 of file JetToDigiDump.cc.

43  :
44  DumpLevel( cfg.getParameter<string>( "DumpLevel" ) ),
45  CaloJetAlg( cfg.getParameter<string>( "CaloJetAlg" ) ),
46  DebugLevel( cfg.getParameter<int>( "DebugLevel" ) ),
47  ShowECal( cfg.getParameter<bool>( "ShowECal" ) )
48  {
49 }
T getParameter(std::string const &) const
std::string CaloJetAlg
Definition: JetToDigiDump.h:27
std::string DumpLevel
Definition: JetToDigiDump.h:26

Member Function Documentation

void JetToDigiDump::analyze ( const edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 78 of file JetToDigiDump.cc.

References abs, HcalQIESample::adc(), EcalMGPASample::adc(), CaloJetAlg, HiRecoJets_cff::caloTowers, HcalQIESample::capid(), dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, DebugLevel, HcalDetId::depth(), DetId::det(), Dump, egHLT::errCodes::EBRecHits, DetId::Ecal, egHLT::errCodes::EERecHits, evtCount, EcalMGPASample::gainId(), edm::Event::getByLabel(), egHLT::errCodes::HBHERecHits, DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, egHLT::errCodes::HFRecHits, i, HcalDetId::ieta(), EBDetId::ieta(), HcalDetId::iphi(), EBDetId::iphi(), EBDetId::ism(), EEDetId::ix(), EEDetId::iy(), j, metsig::jet, gen::k, HcalQIESample::nominal_fC(), EcalDataFrame::sample(), ShowECal, HcalDetId::subdet(), and DetId::subdetId().

78  {
79 
80  int jetInd;
93  // Old:
94  //Handle<edm::SortedCollection<EBDataFrame> > EBDigis;
95  //Handle<edm::SortedCollection<EBDataFrame> > EEDigis;
96 
97  //Find the CaloTowers in leading CaloJets
98  if (DebugLevel) cout<<"Getting caloJets"<<endl;
99 
100  evt.getByLabel( CaloJetAlg, caloJets );
101  if (Dump >= 2) evt.getByLabel( "towerMaker", caloTowers );
102  if (Dump >= 3) {
103  if (DebugLevel) cout<<"Getting recHits"<<endl;
104  evt.getByLabel( "hbhereco", HBHERecHits );
105  evt.getByLabel( "horeco", HORecHits );
106  evt.getByLabel( "hfreco", HFRecHits );
107  evt.getByLabel( "ecalRecHit", "EcalRecHitsEB", EBRecHits );
108  evt.getByLabel( "ecalRecHit", "EcalRecHitsEE", EERecHits );
109  if (DebugLevel) cout<<"# of hits gotten - HBHE: "<<HBHERecHits->size()<<endl;
110  evt.getByLabel( "hcalDigis", HBHEDigis );
111  evt.getByLabel( "hcalDigis", HODigis );
112  evt.getByLabel( "hcalDigis", HFDigis );
113  if (DebugLevel) cout<<"# of digis gotten - HBHE: "<<HBHEDigis->size()<<endl;
114  if (ShowECal) {
115  evt.getByLabel( "ecalDigis", "ebDigis", EBDigis );
116  evt.getByLabel( "ecalDigis", "eeDigis", EEDigis );
117  }
118  }
119 
120  cout << endl << "Evt: "<<evtCount <<", Num Jets=" <<caloJets->end() - caloJets->begin() << endl;
121  if(Dump>=1)cout <<" *********************************************************" <<endl;
122  jetInd = 0;
123  if(Dump>=1)for( CaloJetCollection::const_iterator jet = caloJets->begin(); jet != caloJets->end(); ++ jet ) {
124  //2_1_? std::vector <CaloTowerPtr> towers = jet->getCaloConstituents ();
125  //2_0_7"
126  std::vector <CaloTowerPtr> towers = jet->getCaloConstituents ();
127  int nConstituents= towers.size();
128  cout <<" Jet: "<<jetInd<<", eta="<<jet->eta()<<", phi="<<jet->phi()<<", pt="<<jet->pt()<<\
129  ",E="<<jet->energy()<<", EB E="<<jet->emEnergyInEB()<<" ,HB E="<<jet->hadEnergyInHB()<<\
130  ", HO E="<<jet->hadEnergyInHO()<<" ,EE E="<< jet->emEnergyInEE()\
131  <<", HE E="<<jet->hadEnergyInHE()<<", HF E="<<jet->hadEnergyInHF()+jet->emEnergyInHF()<<", Num Towers="<<nConstituents<<endl;
132  if(Dump>=2)cout <<" ====================================================="<<endl;
133  float sumTowerE = 0.0;
134  if(Dump>=2)for (int i = 0; i <nConstituents ; i++) {
135  CaloTowerCollection::const_iterator theTower=caloTowers->find(towers[i]->id()); //Find the tower from its CaloTowerDetID
136  if (theTower == caloTowers->end()) {cerr<<"Bug? Can't find the tower"<<endl; return;}
137  int ietaTower = towers[i]->id().ieta();
138  int iphiTower = towers[i]->id().iphi();
139  sumTowerE += theTower->energy();
140  size_t numRecHits = theTower->constituentsSize();
141  cout << " Tower " << i <<": ieta=" << ietaTower << ", eta=" << theTower->eta() <<", iphi=" << iphiTower << ", phi=" << theTower->phi() << \
142  ", energy=" << theTower->energy() << ", EM=" << theTower->emEnergy()<< ", HAD=" << theTower->hadEnergy()\
143  << ", HO=" << theTower->outerEnergy() <<", Num Rec Hits =" << numRecHits << endl;
144  if(Dump>=3)cout << " ------------------------------------------------"<<endl;
145  float sumRecHitE = 0.0;
146  if(Dump>=3)for(size_t j = 0; j <numRecHits ; j++) {
147  DetId RecHitDetID=theTower->constituent(j);
148  DetId::Detector DetNum=RecHitDetID.det();
149  if( DetNum == DetId::Hcal ){
150  //cout << "RecHit " << j << ": Detector = " << DetNum << ": Hcal " << endl;
151  HcalDetId HcalID = RecHitDetID;
152  HcalSubdetector HcalNum = HcalID.subdet();
153  if( HcalNum == HcalBarrel ){
154  HBHERecHitCollection::const_iterator theRecHit=HBHERecHits->find(HcalID);
155  sumRecHitE += theRecHit->energy();
156  HBHEDigiCollection::const_iterator theDigis=HBHEDigis->find(HcalID);
157  cout << " RecHit: " << j << ": HB, ieta=" << HcalID.ieta() << ", iphi=" << HcalID.iphi()<<
158  ", depth=" << HcalID.depth() << ", energy=" << theRecHit->energy() << ", time=" <<\
159  theRecHit->time() <<", All Digis=" << theDigis->size() << ", presamples =" <<\
160  theDigis->presamples() <<endl;
161  /* const HcalElectronicsId HW_ID = theDigis->elecId();
162  cout << "Digi: Index=" << HW_ID.linearIndex() << ", raw ID=" << HW_ID.rawId() << ", fiberChan=" << HW_ID.fiberChanId() << ", fiberInd=" << HW_ID.fiberIndex() \
163  << ", HTR chan=" << HW_ID.htrChanId() << ", HTR Slot=" << HW_ID.htrSlot() << ", HDR top/bot=" << HW_ID.htrTopBottom() \
164  << ", VME crate=" << HW_ID.readoutVMECrateId() << ", DCC=" << HW_ID.dccid() << ", DCC spigot=" << HW_ID.spigot() << endl;
165  */
166  float SumDigiCharge = 0.0;
167  float EstimatedPedestal=0.0;
168  int SamplesToAdd = 4;
169  if(Dump>=4)cout << " ......................................"<<endl;
170  if(Dump>=4)for(int k=0; k<theDigis->size(); k++){
171  const HcalQIESample QIE = theDigis->sample(k);
172  if(k>=theDigis->presamples()&&k<theDigis->presamples()+SamplesToAdd)SumDigiCharge+=QIE.nominal_fC();
173  if(k<theDigis->presamples()-1)EstimatedPedestal+=QIE.nominal_fC()*SamplesToAdd/(theDigis->presamples()-1);
174  cout << " Digi: " << k << ", cap ID = " << QIE.capid() << ": ADC Counts = " << QIE.adc() << ", nominal fC = " << QIE.nominal_fC() <<endl;
175  }
176  if(Dump>=4)cout << " 4 Digi fC ="<<SumDigiCharge<<", est. ped. fC="<<EstimatedPedestal<<", est. GeV/fc="<<theRecHit->energy()/(SumDigiCharge-EstimatedPedestal) << endl;
177  if(Dump>=4)cout << " ......................................"<<endl;
178  }
179  else if( HcalNum == HcalEndcap ){
180  HBHERecHitCollection::const_iterator theRecHit=HBHERecHits->find(HcalID);
181  if( (abs(HcalID.ieta())==28||abs(HcalID.ieta())==29)&&HcalID.depth()==3){
182  sumRecHitE += theRecHit->energy()/2; //Depth 3 split over tower 28 & 29
183  }
184  else{
185  sumRecHitE += theRecHit->energy();
186  }
187  HBHEDigiCollection::const_iterator theDigis=HBHEDigis->find(HcalID);
188  cout << " RecHit: " << j << ": HE, ieta=" << HcalID.ieta() << ", iphi=" << HcalID.iphi()<<
189  ", depth=" << HcalID.depth() << ", energy=" << theRecHit->energy() << ", time=" <<\
190  theRecHit->time() <<", All Digis=" << theDigis->size() << ", presamples =" <<\
191  theDigis->presamples() <<endl;
192  float SumDigiCharge = 0.0;
193  float EstimatedPedestal=0.0;
194  int SamplesToAdd = 4;
195  if(Dump>=4)cout << " ......................................"<<endl;
196  if(Dump>=4)for(int k=0; k<theDigis->size(); k++){
197  const HcalQIESample QIE = theDigis->sample(k);
198  if(k>=theDigis->presamples()&&k<theDigis->presamples()+SamplesToAdd)SumDigiCharge+=QIE.nominal_fC();
199  if(k<theDigis->presamples()-1)EstimatedPedestal+=QIE.nominal_fC()*SamplesToAdd/(theDigis->presamples()-1);
200  cout << " Digi: " << k << ", cap ID = " << QIE.capid() << ": ADC Counts = " << QIE.adc() << ", nominal fC = " << QIE.nominal_fC() <<endl;
201  }
202  if(Dump>=4)cout << " 4 Digi fC ="<<SumDigiCharge<<", est. ped. fC="<<EstimatedPedestal<<", est. GeV/fc="<<theRecHit->energy()/(SumDigiCharge-EstimatedPedestal) << endl;
203  if(Dump>=4)cout << " ......................................"<<endl;
204  }
205  else if( HcalNum == HcalOuter ){
206  HORecHitCollection::const_iterator theRecHit=HORecHits->find(HcalID);
207  sumRecHitE += theRecHit->energy();
208  HODigiCollection::const_iterator theDigis=HODigis->find(HcalID);
209  cout << " RecHit: " << j << ": HO, ieta=" << HcalID.ieta() << ", iphi=" << HcalID.iphi()<<
210  ", depth=" << HcalID.depth() << ", energy=" << theRecHit->energy() << ", time=" <<\
211  theRecHit->time() <<", All Digis=" << theDigis->size() << ", presamples =" <<\
212  theDigis->presamples() <<endl;
213  float SumDigiCharge = 0.0;
214  float EstimatedPedestal=0.0;
215  int SamplesToAdd = 4;
216  if(Dump>=4)cout << " ......................................"<<endl;
217  if(Dump>=4)for(int k=0; k<theDigis->size(); k++){
218  const HcalQIESample QIE = theDigis->sample(k);
219  if(k>=theDigis->presamples()&&k<theDigis->presamples()+SamplesToAdd)SumDigiCharge+=QIE.nominal_fC();
220  if(k<theDigis->presamples()-1)EstimatedPedestal+=QIE.nominal_fC()*SamplesToAdd/(theDigis->presamples()-1);
221  cout << " Digi: " << k << ", cap ID = " << QIE.capid() << ": ADC Counts = " << QIE.adc() << ", nominal fC = " << QIE.nominal_fC() <<endl;
222  }
223  if(Dump>=4)cout << " 4 Digi fC ="<<SumDigiCharge<<", est. ped. fC="<<EstimatedPedestal<<", est. GeV/fc="<<theRecHit->energy()/(SumDigiCharge-EstimatedPedestal) << endl;
224  if(Dump>=4)cout << " ......................................"<<endl;
225  }
226  else if( HcalNum == HcalForward ){
227  HFRecHitCollection::const_iterator theRecHit=HFRecHits->find(HcalID);
228  sumRecHitE += theRecHit->energy();
229  HFDigiCollection::const_iterator theDigis=HFDigis->find(HcalID);
230  cout << " RecHit: " << j << ": HF, ieta=" << HcalID.ieta() << ", iphi=" << HcalID.iphi()<<
231  ", depth=" << HcalID.depth() << ", energy=" << theRecHit->energy() << ", time=" <<\
232  theRecHit->time() <<", All Digis=" << theDigis->size() << ", presamples =" <<\
233  theDigis->presamples() <<endl;
234  float SumDigiCharge = 0.0;
235  float EstimatedPedestal=0.0;
236  int SamplesToAdd = 1;
237  if(Dump>=4)cout << " ......................................"<<endl;
238  if(Dump>=4)for(int k=0; k<theDigis->size(); k++){
239  const HcalQIESample QIE = theDigis->sample(k);
240  if(k>=theDigis->presamples()&&k<theDigis->presamples()+SamplesToAdd)SumDigiCharge+=QIE.nominal_fC();
241  if(k<theDigis->presamples()-1)EstimatedPedestal+=QIE.nominal_fC()*SamplesToAdd/(theDigis->presamples()-1);
242  cout << " Digi: " << k << ", cap ID = " << QIE.capid() << ": ADC Counts = " << QIE.adc() << ", nominal fC = " << QIE.nominal_fC() <<endl;
243  }
244  if(Dump>=4)cout << " 1 Digi fC ="<<SumDigiCharge<<", est. ped. fC="<<EstimatedPedestal<<", est. GeV/fc="<<theRecHit->energy()/(SumDigiCharge-EstimatedPedestal) << endl;
245  if(Dump>=4)cout << " ......................................"<<endl;
246  }
247  }
248  if( ShowECal && DetNum == DetId::Ecal ){
249  int EcalNum = RecHitDetID.subdetId();
250  if( EcalNum == 1 ){
251  EBDetId EcalID = RecHitDetID;
252  EBRecHitCollection::const_iterator theRecHit=EBRecHits->find(EcalID);
253  EBDigiCollection::const_iterator theDigis=EBDigis->find(EcalID);
254  sumRecHitE += theRecHit->energy();
255  cout << " RecHit " << j << ": EB, ieta=" << EcalID.ieta() << ", iphi=" << EcalID.iphi() << ", SM=" << EcalID.ism() << ", energy=" << theRecHit->energy() <<", All Digis=" << theDigis->size()<< endl;
256  if(Dump>=4)cout << " ......................................"<<endl;
257  if(Dump>=4)for(unsigned int k=0; k<theDigis->size(); k++){
258  EBDataFrame frame (*theDigis);
259  const EcalMGPASample MGPA = frame.sample(k);
260  cout << " Digi: " << k << ": ADC Sample = " << MGPA.adc() << ", Gain ID = "<< MGPA.gainId() <<endl;
261  }
262  if(Dump>=4)cout << " ......................................"<<endl;
263  }
264  else if( EcalNum == 2 ){
265  EEDetId EcalID = RecHitDetID;
266  EERecHitCollection::const_iterator theRecHit=EERecHits->find(EcalID);
267  EEDigiCollection::const_iterator theDigis=EEDigis->find(EcalID);
268  sumRecHitE += theRecHit->energy();
269  cout << " RecHit " << j << ": EE, ix=" << EcalID.ix() << ", iy=" << EcalID.iy() << ", energy=" << theRecHit->energy() << ", All Digis=" << theDigis->size()<< endl;
270  if(Dump>=4)cout << " ......................................"<<endl;
271  if(Dump>=4)for(unsigned int k=0; k<theDigis->size(); k++){
272  EEDataFrame frame (*theDigis);
273  const EcalMGPASample MGPA = frame.sample(k);
274  cout << " Digi: " << k << ": ADC Sample = " << MGPA.adc() << ", Gain ID = "<< MGPA.gainId() <<endl;
275  }
276  if(Dump>=4)cout << " ......................................"<<endl;
277  }
278  }
279  }
280  if(Dump>=3){
281  if( abs(ietaTower)==28||abs(ietaTower)==29){
282  cout << " Splitted Sum of RecHit Energies=" << sumRecHitE <<", CaloTower energy=" << theTower->energy() << endl;
283  }
284  else{
285  cout << " Sum of RecHit Energies=" << sumRecHitE <<", CaloTower energy=" << theTower->energy() << endl;
286  }
287  }
288  if(Dump>=3)cout << " ------------------------------------------------"<<endl;
289  }
290  if(Dump>=2)cout << " Sum of tower energies=" << sumTowerE << ", CaloJet energy=" << jet->energy() << endl;
291  jetInd++;
292  if(Dump>=2)cout <<" ====================================================="<<endl;
293  }
294  evtCount++;
295  if(Dump>=1)cout <<" *********************************************************" <<endl;
296 
297 }
int i
Definition: DBlmapReader.cc:9
int ix() const
Definition: EEDetId.h:71
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:32
int adc() const
get the ADC sample
Definition: HcalQIESample.h:24
std::vector< CaloTower >::const_iterator const_iterator
#define abs(x)
Definition: mlp_lapack.h:159
int gainId() const
get the gainId (2 bits)
int ism() const
get the ECAL/SM id
Definition: EBDetId.cc:79
int iphi() const
get the crystal iphi
Definition: EBDetId.h:46
std::string CaloJetAlg
Definition: JetToDigiDump.h:27
int depth() const
get the tower depth
Definition: HcalDetId.h:42
int ieta() const
get the cell ieta
Definition: HcalDetId.h:38
HcalSubdetector
Definition: HcalAssistant.h:32
int j
Definition: DBlmapReader.cc:9
int iy() const
Definition: EEDetId.h:77
int ieta() const
get the crystal ieta
Definition: EBDetId.h:44
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
int k[5][pyjets_maxn]
int iphi() const
get the cell iphi
Definition: HcalDetId.h:40
Definition: DetId.h:20
int capid() const
get the Capacitor id
Definition: HcalQIESample.h:28
Detector
Definition: DetId.h:26
double nominal_fC() const
get the nominal FC (no calibrations applied)
tuple cout
Definition: gather_cfg.py:121
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
int adc() const
get the ADC sample (12 bits)
void JetToDigiDump::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 51 of file JetToDigiDump.cc.

References CaloJetAlg, gather_cfg::cout, DebugLevel, Dump, DumpLevel, and evtCount.

51  {
52  if(DumpLevel=="Jets")
53  {
54  cout << "Dump of Jets" << endl;
55  Dump=1;
56  }
57  else if(DumpLevel=="Towers")
58  {
59  cout << "Dump of Jets and constituent CaloTowers" << endl;
60  Dump=2;
61  }
62  else if(DumpLevel=="RecHits")
63  {
64  cout << "Dump of Jets, constituent CaloTowers, and constituent RecHits" << endl;
65  Dump=3;
66  }
67  else if(DumpLevel=="Digis")
68  {
69  cout << "Dump of Jets, constituent CaloTowers, constituent RecHits and associated Digis" << endl;
70  Dump=4;
71  }
72  cout << "Jet Algorithm being dumped is " << CaloJetAlg << endl;
73  cout<<"Debug level is " << DebugLevel << endl;
74  //Initialize some stuff
75  evtCount = 0;
76 }
std::string CaloJetAlg
Definition: JetToDigiDump.h:27
std::string DumpLevel
Definition: JetToDigiDump.h:26
tuple cout
Definition: gather_cfg.py:121
void JetToDigiDump::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 299 of file JetToDigiDump.cc.

299  {
300 
301 
302 }

Member Data Documentation

std::string JetToDigiDump::CaloJetAlg
private

Definition at line 27 of file JetToDigiDump.h.

Referenced by analyze(), and beginJob().

int JetToDigiDump::DebugLevel
private

Definition at line 28 of file JetToDigiDump.h.

Referenced by analyze(), and beginJob().

int JetToDigiDump::Dump
private

Definition at line 32 of file JetToDigiDump.h.

Referenced by analyze(), and beginJob().

std::string JetToDigiDump::DumpLevel
private

Definition at line 26 of file JetToDigiDump.h.

Referenced by beginJob().

int JetToDigiDump::evtCount
private

Definition at line 33 of file JetToDigiDump.h.

Referenced by analyze(), and beginJob().

bool JetToDigiDump::ShowECal
private

Definition at line 29 of file JetToDigiDump.h.

Referenced by analyze().