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 Attributes
Digi2Raw2Digi Class Reference

#include <Digi2Raw2Digi.h>

Inheritance diagram for Digi2Raw2Digi:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
template<class Digi >
void compare (const edm::Event &, const edm::EventSetup &, const edm::EDGetTokenT< edm::SortedCollection< Digi > > &tok1, const edm::EDGetTokenT< edm::SortedCollection< Digi > > &tok2)
 
 Digi2Raw2Digi (const edm::ParameterSet &)
 
virtual void endJob ()
 
 ~Digi2Raw2Digi ()
 
- 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

DQMStoredbe_
 
edm::InputTag inputTag1_
 
edm::InputTag inputTag2_
 
MonitorElementmeStatus
 
std::string outputFile_
 
edm::EDGetTokenT
< edm::SortedCollection
< HBHEDataFrame > > 
tok_hbhe1_
 
edm::EDGetTokenT
< edm::SortedCollection
< HBHEDataFrame > > 
tok_hbhe2_
 
edm::EDGetTokenT
< edm::SortedCollection
< HFDataFrame > > 
tok_hf1_
 
edm::EDGetTokenT
< edm::SortedCollection
< HFDataFrame > > 
tok_hf2_
 
edm::EDGetTokenT
< edm::SortedCollection
< HODataFrame > > 
tok_ho1_
 
edm::EDGetTokenT
< edm::SortedCollection
< HODataFrame > > 
tok_ho2_
 
edm::EDGetTokenT
< edm::SortedCollection
< ZDCDataFrame > > 
tok_zdc1_
 
edm::EDGetTokenT
< edm::SortedCollection
< ZDCDataFrame > > 
tok_zdc2_
 
int unsuppressed
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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

Definition at line 16 of file Digi2Raw2Digi.h.

Constructor & Destructor Documentation

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

Definition at line 219 of file Digi2Raw2Digi.cc.

References DQMStore::book1D(), dbe_, timingPdfMaker::histo, inputTag1_, inputTag2_, meStatus, cppFunctionSkipper::operator, outputFile_, DQMStore::setCurrentFolder(), tok_hbhe1_, tok_hbhe2_, tok_hf1_, tok_hf2_, tok_ho1_, tok_ho2_, tok_zdc1_, and tok_zdc2_.

220  : inputTag1_(iConfig.getParameter<edm::InputTag>("digiLabel1")),
221  inputTag2_(iConfig.getParameter<edm::InputTag>("digiLabel2")),
222  outputFile_(iConfig.getUntrackedParameter<std::string>("outputFile")),
223  dbe_(0)
224 {
225 
226  // register for data access
227  tok_hbhe1_ = consumes<edm::SortedCollection<HBHEDataFrame> >(inputTag1_);
228  tok_hbhe2_ = consumes<edm::SortedCollection<HBHEDataFrame> >(inputTag2_);
229  tok_ho1_ = consumes<edm::SortedCollection<HODataFrame> >(inputTag1_);
230  tok_ho2_ = consumes<edm::SortedCollection<HODataFrame> >(inputTag2_);
231  tok_hf1_ = consumes<edm::SortedCollection<HFDataFrame> >(inputTag1_);
232  tok_hf2_ = consumes<edm::SortedCollection<HFDataFrame> >(inputTag2_);
233  tok_zdc1_ = consumes<edm::SortedCollection<ZDCDataFrame> >(edm::InputTag("simHcalUnsuppressedDigis"));
234  tok_zdc2_ = consumes<edm::SortedCollection<ZDCDataFrame> >(inputTag2_);
235 
236 
237  // DQM ROOT output
238  if ( outputFile_.size() != 0 ) {
239  edm::LogInfo("OutputInfo")
240  << " Hcal RecHit Task histograms will be saved to '"
241  << outputFile_.c_str() << "'";
242  } else {
243  edm::LogInfo("OutputInfo")
244  << " Hcal RecHit Task histograms will NOT be saved";
245  }
246 
247  // DQM service initialization
249 
250  if ( dbe_ ) {
251  dbe_->setCurrentFolder("Digi2Raw2DigiV/Digi2Raw2DigiTask");
252  }
253 
254  // const char * sub = hcalselector_.c_str();
255  char histo[100];
256  sprintf (histo, "Digi2Raw2Digi_status") ;
257  // bins: 1)full match 2)ID match, not content 3) no match
258  // 4) number of events with diff number of Digis
259  meStatus = dbe_->book1D(histo, histo, 5, 0., 5.);
260 
261 }
std::string outputFile_
Definition: Digi2Raw2Digi.h:38
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
edm::EDGetTokenT< edm::SortedCollection< HBHEDataFrame > > tok_hbhe2_
Definition: Digi2Raw2Digi.h:30
edm::EDGetTokenT< edm::SortedCollection< ZDCDataFrame > > tok_zdc2_
Definition: Digi2Raw2Digi.h:36
edm::EDGetTokenT< edm::SortedCollection< HFDataFrame > > tok_hf2_
Definition: Digi2Raw2Digi.h:34
edm::EDGetTokenT< edm::SortedCollection< ZDCDataFrame > > tok_zdc1_
Definition: Digi2Raw2Digi.h:35
DQMStore * dbe_
Definition: Digi2Raw2Digi.h:39
edm::EDGetTokenT< edm::SortedCollection< HBHEDataFrame > > tok_hbhe1_
Definition: Digi2Raw2Digi.h:29
edm::EDGetTokenT< edm::SortedCollection< HODataFrame > > tok_ho1_
Definition: Digi2Raw2Digi.h:31
edm::EDGetTokenT< edm::SortedCollection< HFDataFrame > > tok_hf1_
Definition: Digi2Raw2Digi.h:33
edm::EDGetTokenT< edm::SortedCollection< HODataFrame > > tok_ho2_
Definition: Digi2Raw2Digi.h:32
edm::InputTag inputTag2_
Definition: Digi2Raw2Digi.h:27
edm::InputTag inputTag1_
Definition: Digi2Raw2Digi.h:26
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
MonitorElement * meStatus
Definition: Digi2Raw2Digi.h:41
Digi2Raw2Digi::~Digi2Raw2Digi ( )

Definition at line 268 of file Digi2Raw2Digi.cc.

268 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 271 of file Digi2Raw2Digi.cc.

References iEvent, tok_hbhe1_, tok_hbhe2_, tok_hf1_, tok_hf2_, tok_ho1_, tok_ho2_, tok_zdc1_, tok_zdc2_, and unsuppressed.

272 {
273  unsuppressed = 0;
274 
275  // std::cout << "=== HBHE ==================" << std::endl;
276  compare<HBHEDataFrame>(iEvent,iSetup,tok_hbhe1_,tok_hbhe2_);
277 
278  // std::cout << "=== HO ====================" << std::endl;
279  compare<HODataFrame>(iEvent,iSetup,tok_ho1_,tok_ho2_);
280 
281  // std::cout << "=== HF ====================" << std::endl;
282  compare<HFDataFrame>(iEvent,iSetup,tok_hf1_,tok_hf2_);
283 
284 
285  // std::cout << "=== ZDC ===================" << std::endl;
286  unsuppressed = 1;
287  compare<ZDCDataFrame>(iEvent,iSetup,tok_zdc1_,tok_zdc2_);
288 
289 
290  // std::cout << "=== CASTOR ================" << std::endl;
291  // compare<CastorDataFrame>(iEvent,iSetup);
292 
293 }
edm::EDGetTokenT< edm::SortedCollection< HBHEDataFrame > > tok_hbhe2_
Definition: Digi2Raw2Digi.h:30
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< edm::SortedCollection< ZDCDataFrame > > tok_zdc2_
Definition: Digi2Raw2Digi.h:36
edm::EDGetTokenT< edm::SortedCollection< HFDataFrame > > tok_hf2_
Definition: Digi2Raw2Digi.h:34
edm::EDGetTokenT< edm::SortedCollection< ZDCDataFrame > > tok_zdc1_
Definition: Digi2Raw2Digi.h:35
edm::EDGetTokenT< edm::SortedCollection< HBHEDataFrame > > tok_hbhe1_
Definition: Digi2Raw2Digi.h:29
edm::EDGetTokenT< edm::SortedCollection< HODataFrame > > tok_ho1_
Definition: Digi2Raw2Digi.h:31
edm::EDGetTokenT< edm::SortedCollection< HFDataFrame > > tok_hf1_
Definition: Digi2Raw2Digi.h:33
edm::EDGetTokenT< edm::SortedCollection< HODataFrame > > tok_ho2_
Definition: Digi2Raw2Digi.h:32
void Digi2Raw2Digi::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 263 of file Digi2Raw2Digi.cc.

263 {}
template<class Digi >
void Digi2Raw2Digi::compare ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const edm::EDGetTokenT< edm::SortedCollection< Digi > > &  tok1,
const edm::EDGetTokenT< edm::SortedCollection< Digi > > &  tok2 
)

Definition at line 39 of file Digi2Raw2Digi.cc.

References ecalMGPA::adc(), gather_cfg::cout, HcalDetId::depth(), MonitorElement::Fill(), edm::Event::getByToken(), i, fjr2json::lumi, match(), meStatus, unsuppressed, and ecaldqm::zside().

39  {
40 
41  typename edm::Handle<edm::SortedCollection<Digi> > digiCollection1;
43  typename edm::Handle<edm::SortedCollection<Digi> > digiCollection2;
45 
46  if(unsuppressed) { // ZDC
47  iEvent.getByToken (tok1, digiCollection1);
48  }
49  else iEvent.getByToken (tok1, digiCollection1);
50 
51  iEvent.getByToken (tok2, digiCollection2);
52 
53  int size1 = 0;
54  int size2 = 0;
55 
56  for (digiItr1=digiCollection1->begin();digiItr1!=digiCollection1->end();digiItr1++) {
57  size1++;
58  }
59 
60  for (digiItr2=digiCollection2->begin();digiItr2!=digiCollection2->end();digiItr2++) {
61  size2++;
62  }
63 
64  //std::cout << "Digi collections size1 = "<< size1
65  // << " size2 = " << size2 << std::endl;
66 
67 
68  // CYCLE over first DIGI collection ======================================
69 
70  for (digiItr1=digiCollection1->begin();digiItr1!=digiCollection1->end();digiItr1++) {
71  HcalGenericDetId HcalGenDetId(digiItr1->id());
72  int tsize = (*digiItr1).size();
73  int match = 0;
74 
75  if(HcalGenDetId.isHcalZDCDetId()){
76  //for zdc
77  HcalZDCDetId element(digiItr1->id());
78  int zside = element.zside();
79  int section = element.section();
80  int channel = element.channel();
81  int gsub = HcalGenDetId.genericSubdet();
82 
83  if(section==3){// lumi section not reconstructed
84  size2++;
85  match = 1;
86  goto lumi;
87  }
88 
89 
90  //std::cout<< " Zdc genSubdet="<< gsub << " zside=" <<zside
91  // << " section= "<< section << " channel " <<channel
92  // <<std::endl;
93 
94  for (digiItr2=digiCollection2->begin();digiItr2!=digiCollection2->end();digiItr2++) {
95  HcalZDCDetId element2(digiItr2->id());
96 
97  //int zside2 = element2.zside();
98  //int section2 = element2.section();
99  //int channel2 = element2.channel();
100  //int gsub2 = HcalGenDetId.genericSubdet();
101 
102  //std::cout<< " Zdc genSubdet="<<gsub2
103  // << " zside=" <<zside2
104  // << " section= "<<section2
105  // <<" channel "<<channel2
106  // <<std::endl;
107 
108  if(element == element2) {
109  match = 1;
110  int identical = 1;
111  for (int i=0; i<tsize; i++) {
112  double adc = (*digiItr1)[i].adc();
113  int capid = (*digiItr1)[i].capid();
114  // std::cout << std::endl << " capid1=" << capid
115  // << " adc1=" << adc
116  // << std::endl;
117  double adc2 = (*digiItr2)[i].adc();
118  int capid2 = (*digiItr2)[i].capid();
119  // std::cout << " capid2=" << capid2 << " adc2=" << adc2
120  // << std::endl;
121  if( capid != capid2 || adc != adc2) {
122  std::cout << "===> PROBLEM !!! gebsubdet=" << gsub
123  << " zside=" <<zside
124  << " section= "<< section << " channel " <<channel
125  << std::endl;
126  std::cout << " capid1["<< i << "]=" << capid
127  << " adc1["<< i << "]=" << adc
128  << " capid2["<< i << "]=" << capid2
129  << " adc2["<< i << "]=" << adc2
130  << std::endl;
131  identical = 0;
132  meStatus->Fill(1.);
133  break;
134  }
135  } // end of DataFrames array
136  if(identical) meStatus->Fill(0.);
137  break; // matched HcalZDCID is processed,
138  // go to next (primary collection) cell
139  }
140  } // end of cycle over 2d DIGI collection
141  lumi:
142  if (!match) {
143  meStatus->Fill(2.);
144  std::cout << "===> PROBLEM !!! gsubdet=" << gsub
145  << " zside=" <<zside
146  << " section= "<< section << " channel " <<channel
147  << " HcalZDCId match is not found !!!"
148  << std::endl;
149  }
150 
151  }
152  else{
153  //for Hcal subdetectors
154  HcalDetId cell(digiItr1->id());
155  int depth = cell.depth();
156  int iphi = cell.iphi()-1;
157  int ieta = cell.ieta();
158  int sub = cell.subdet();
159  // if(ieta > 0) ieta--;
160  // std::cout << " Cell subdet=" << sub << " ieta=" << ieta
161  // << " inphi=" << iphi << " depth=" << depth << std::endl;
162 
163  // CYCLE over second DIGI collection ======================================
164  for (digiItr2=digiCollection2->begin();digiItr2!=digiCollection2->end();digiItr2++) {
165 
166  HcalDetId cell2(digiItr2->id());
167 
168  if( cell == cell2) {
169  match = 1;
170  int identical = 1;
171  for (int i=0; i<tsize; i++) {
172  double adc = (*digiItr1)[i].adc();
173  int capid = (*digiItr1)[i].capid();
174  // std::cout << std::endl << " capid1=" << capid
175  // << " adc1=" << adc
176  // << std::endl;
177  double adc2 = (*digiItr2)[i].adc();
178  int capid2 = (*digiItr2)[i].capid();
179  // std::cout << " capid2=" << capid2 << " adc2=" << adc2
180  // << std::endl;
181  if( capid != capid2 || adc != adc2) {
182  std::cout << "===> PROBLEM !!! subdet=" << sub << " ieta="
183  << ieta << " inphi=" << iphi << " depth=" << depth
184  << std::endl;
185  std::cout << " capid1["<< i << "]=" << capid
186  << " adc1["<< i << "]=" << adc
187  << " capid2["<< i << "]=" << capid2
188  << " adc2["<< i << "]=" << adc2
189  << std::endl;
190  identical = 0;
191  meStatus->Fill(1.);
192  break;
193  }
194  } // end of DataFrames array
195  if(identical) meStatus->Fill(0.);
196  break; // matched HcalID is processed,
197  // go to next (primary collection) cell
198  }
199  } // end of cycle over 2d DIGI collection
200  if (!match) {
201  meStatus->Fill(2.);
202  std::cout << "===> PROBLEM !!! subdet=" << sub << " ieta="
203  << ieta << " inphi=" << iphi << " depth=" << depth
204  << " HcalID match is not found !!!"
205  << std::endl;
206  }
207  }
208  } // end of cycle over 1st DIGI collection
209 
210  if (size1 != size2) {
211  meStatus->Fill(3.);
212  std::cout << "===> PROBLEM !!! Different size of Digi collections : "
213  << size1 << " and " << size2
214  << std::endl;
215  }
216 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
tuple lumi
Definition: fjr2json.py:35
std::vector< T >::const_iterator const_iterator
int zside(DetId const &)
void Fill(long long x)
int depth() const
get the tower depth
Definition: HcalDetId.h:40
tuple cout
Definition: gather_cfg.py:121
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
MonitorElement * meStatus
Definition: Digi2Raw2Digi.h:41
void Digi2Raw2Digi::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 264 of file Digi2Raw2Digi.cc.

References dbe_, outputFile_, and DQMStore::save().

264  {
265  if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
266 }
std::string outputFile_
Definition: Digi2Raw2Digi.h:38
DQMStore * dbe_
Definition: Digi2Raw2Digi.h:39
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540

Member Data Documentation

DQMStore* Digi2Raw2Digi::dbe_
private

Definition at line 39 of file Digi2Raw2Digi.h.

Referenced by Digi2Raw2Digi(), and endJob().

edm::InputTag Digi2Raw2Digi::inputTag1_
private

Definition at line 26 of file Digi2Raw2Digi.h.

Referenced by Digi2Raw2Digi().

edm::InputTag Digi2Raw2Digi::inputTag2_
private

Definition at line 27 of file Digi2Raw2Digi.h.

Referenced by Digi2Raw2Digi().

MonitorElement* Digi2Raw2Digi::meStatus
private

Definition at line 41 of file Digi2Raw2Digi.h.

Referenced by compare(), and Digi2Raw2Digi().

std::string Digi2Raw2Digi::outputFile_
private

Definition at line 38 of file Digi2Raw2Digi.h.

Referenced by Digi2Raw2Digi(), and endJob().

edm::EDGetTokenT<edm::SortedCollection<HBHEDataFrame> > Digi2Raw2Digi::tok_hbhe1_
private

Definition at line 29 of file Digi2Raw2Digi.h.

Referenced by analyze(), and Digi2Raw2Digi().

edm::EDGetTokenT<edm::SortedCollection<HBHEDataFrame> > Digi2Raw2Digi::tok_hbhe2_
private

Definition at line 30 of file Digi2Raw2Digi.h.

Referenced by analyze(), and Digi2Raw2Digi().

edm::EDGetTokenT<edm::SortedCollection<HFDataFrame> > Digi2Raw2Digi::tok_hf1_
private

Definition at line 33 of file Digi2Raw2Digi.h.

Referenced by analyze(), and Digi2Raw2Digi().

edm::EDGetTokenT<edm::SortedCollection<HFDataFrame> > Digi2Raw2Digi::tok_hf2_
private

Definition at line 34 of file Digi2Raw2Digi.h.

Referenced by analyze(), and Digi2Raw2Digi().

edm::EDGetTokenT<edm::SortedCollection<HODataFrame> > Digi2Raw2Digi::tok_ho1_
private

Definition at line 31 of file Digi2Raw2Digi.h.

Referenced by analyze(), and Digi2Raw2Digi().

edm::EDGetTokenT<edm::SortedCollection<HODataFrame> > Digi2Raw2Digi::tok_ho2_
private

Definition at line 32 of file Digi2Raw2Digi.h.

Referenced by analyze(), and Digi2Raw2Digi().

edm::EDGetTokenT<edm::SortedCollection<ZDCDataFrame> > Digi2Raw2Digi::tok_zdc1_
private

Definition at line 35 of file Digi2Raw2Digi.h.

Referenced by analyze(), and Digi2Raw2Digi().

edm::EDGetTokenT<edm::SortedCollection<ZDCDataFrame> > Digi2Raw2Digi::tok_zdc2_
private

Definition at line 36 of file Digi2Raw2Digi.h.

Referenced by analyze(), and Digi2Raw2Digi().

int Digi2Raw2Digi::unsuppressed
private

Definition at line 43 of file Digi2Raw2Digi.h.

Referenced by analyze(), and compare().