CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CastorPedestalsAnalysis Class Reference

#include <CastorPedestalsAnalysis.h>

Inheritance diagram for CastorPedestalsAnalysis:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup) override
 
 CastorPedestalsAnalysis (const edm::ParameterSet &ps)
 
 ~CastorPedestalsAnalysis () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::vector< NewPedBunchBunches
 
edm::InputTag castorDigiCollectionTag
 
TH1F * CASTORMeans
 
TH1F * CASTORWidths
 
TH2F * dephist
 
bool dumpXML
 
bool firsttime
 
int firstTS
 
bool hiSaveFlag
 
int lastTS
 
std::string pedsADCfilename
 
std::string pedsfCfilename
 
std::string ROOTfilename
 
int runnum
 
TFile * theFile
 
bool verboseflag
 
std::string widthsADCfilename
 
std::string widthsfCfilename
 
std::string XMLfilename
 
std::string XMLtag
 
std::string ZSfilename
 

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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 72 of file CastorPedestalsAnalysis.h.

Constructor & Destructor Documentation

◆ CastorPedestalsAnalysis()

CastorPedestalsAnalysis::CastorPedestalsAnalysis ( const edm::ParameterSet ps)

Definition at line 11 of file CastorPedestalsAnalysis.cc.

12  : castorDigiCollectionTag(ps.getParameter<edm::InputTag>("castorDigiCollectionTag")) {
13  hiSaveFlag = ps.getUntrackedParameter<bool>("hiSaveFlag", false);
14  dumpXML = ps.getUntrackedParameter<bool>("dumpXML", false);
15  verboseflag = ps.getUntrackedParameter<bool>("verbose", false);
16  firstTS = ps.getUntrackedParameter<int>("firstTS", 0);
17  lastTS = ps.getUntrackedParameter<int>("lastTS", 9);
18  firsttime = true;
19 }

References dumpXML, firsttime, firstTS, edm::ParameterSet::getUntrackedParameter(), hiSaveFlag, lastTS, and verboseflag.

◆ ~CastorPedestalsAnalysis()

CastorPedestalsAnalysis::~CastorPedestalsAnalysis ( )
override

Definition at line 21 of file CastorPedestalsAnalysis.cc.

21  {
22  CastorPedestals* rawPedsItem = new CastorPedestals(true);
23  CastorPedestalWidths* rawWidthsItem = new CastorPedestalWidths(true);
24  CastorPedestals* rawPedsItemfc = new CastorPedestals(false);
25  CastorPedestalWidths* rawWidthsItemfc = new CastorPedestalWidths(false);
26 
27  //Calculate pedestal constants
28  std::cout << "Calculating Pedestal constants...\n";
29  std::vector<NewPedBunch>::iterator bunch_it;
30  for (bunch_it = Bunches.begin(); bunch_it != Bunches.end(); ++bunch_it) {
31  if (bunch_it->usedflag) {
32  if (verboseflag)
33  std::cout << "Analyzing channel sector= " << bunch_it->detid.sector()
34  << " module = " << bunch_it->detid.module() << std::endl;
35  //pedestal constant is the mean
36  bunch_it->cap[0] /= bunch_it->num[0][0];
37  bunch_it->cap[1] /= bunch_it->num[1][1];
38  bunch_it->cap[2] /= bunch_it->num[2][2];
39  bunch_it->cap[3] /= bunch_it->num[3][3];
40  bunch_it->capfc[0] /= bunch_it->num[0][0];
41  bunch_it->capfc[1] /= bunch_it->num[1][1];
42  bunch_it->capfc[2] /= bunch_it->num[2][2];
43  bunch_it->capfc[3] /= bunch_it->num[3][3];
44  //widths are the covariance matrix--assumed symmetric
45  bunch_it->sig[0][0] = (bunch_it->prod[0][0] / bunch_it->num[0][0]) - (bunch_it->cap[0] * bunch_it->cap[0]);
46  bunch_it->sig[0][1] = (bunch_it->prod[0][1] / bunch_it->num[0][1]) - (bunch_it->cap[0] * bunch_it->cap[1]);
47  bunch_it->sig[0][2] = (bunch_it->prod[0][2] / bunch_it->num[0][2]) - (bunch_it->cap[0] * bunch_it->cap[2]);
48  bunch_it->sig[0][3] = (bunch_it->prod[0][3] / bunch_it->num[0][3]) - (bunch_it->cap[0] * bunch_it->cap[3]);
49  bunch_it->sig[1][0] = (bunch_it->prod[1][0] / bunch_it->num[1][0]) - (bunch_it->cap[1] * bunch_it->cap[0]);
50  bunch_it->sig[1][1] = (bunch_it->prod[1][1] / bunch_it->num[1][1]) - (bunch_it->cap[1] * bunch_it->cap[1]);
51  bunch_it->sig[1][2] = (bunch_it->prod[1][2] / bunch_it->num[1][2]) - (bunch_it->cap[1] * bunch_it->cap[2]);
52  bunch_it->sig[1][3] = (bunch_it->prod[1][3] / bunch_it->num[1][3]) - (bunch_it->cap[1] * bunch_it->cap[3]);
53  bunch_it->sig[2][0] = (bunch_it->prod[2][0] / bunch_it->num[2][0]) - (bunch_it->cap[2] * bunch_it->cap[0]);
54  bunch_it->sig[2][1] = (bunch_it->prod[2][1] / bunch_it->num[2][1]) - (bunch_it->cap[2] * bunch_it->cap[1]);
55  bunch_it->sig[2][2] = (bunch_it->prod[2][2] / bunch_it->num[2][2]) - (bunch_it->cap[2] * bunch_it->cap[2]);
56  bunch_it->sig[2][3] = (bunch_it->prod[2][3] / bunch_it->num[2][3]) - (bunch_it->cap[2] * bunch_it->cap[3]);
57  bunch_it->sig[3][0] = (bunch_it->prod[3][0] / bunch_it->num[3][0]) - (bunch_it->cap[3] * bunch_it->cap[0]);
58  bunch_it->sig[3][1] = (bunch_it->prod[3][1] / bunch_it->num[3][1]) - (bunch_it->cap[3] * bunch_it->cap[1]);
59  bunch_it->sig[3][2] = (bunch_it->prod[3][2] / bunch_it->num[3][2]) - (bunch_it->cap[3] * bunch_it->cap[2]);
60  bunch_it->sig[3][3] = (bunch_it->prod[3][3] / bunch_it->num[3][3]) - (bunch_it->cap[3] * bunch_it->cap[3]);
61 
62  bunch_it->sigfc[0][0] =
63  (bunch_it->prodfc[0][0] / bunch_it->num[0][0]) - (bunch_it->capfc[0] * bunch_it->capfc[0]);
64  bunch_it->sigfc[0][1] =
65  (bunch_it->prodfc[0][1] / bunch_it->num[0][1]) - (bunch_it->capfc[0] * bunch_it->capfc[1]);
66  bunch_it->sigfc[0][2] =
67  (bunch_it->prodfc[0][2] / bunch_it->num[0][2]) - (bunch_it->capfc[0] * bunch_it->capfc[2]);
68  bunch_it->sigfc[0][3] =
69  (bunch_it->prodfc[0][3] / bunch_it->num[0][3]) - (bunch_it->capfc[0] * bunch_it->capfc[3]);
70  bunch_it->sigfc[1][0] =
71  (bunch_it->prodfc[1][0] / bunch_it->num[1][0]) - (bunch_it->capfc[1] * bunch_it->capfc[0]);
72  bunch_it->sigfc[1][1] =
73  (bunch_it->prodfc[1][1] / bunch_it->num[1][1]) - (bunch_it->capfc[1] * bunch_it->capfc[1]);
74  bunch_it->sigfc[1][2] =
75  (bunch_it->prodfc[1][2] / bunch_it->num[1][2]) - (bunch_it->capfc[1] * bunch_it->capfc[2]);
76  bunch_it->sigfc[1][3] =
77  (bunch_it->prodfc[1][3] / bunch_it->num[1][3]) - (bunch_it->capfc[1] * bunch_it->capfc[3]);
78  bunch_it->sigfc[2][0] =
79  (bunch_it->prodfc[2][0] / bunch_it->num[2][0]) - (bunch_it->capfc[2] * bunch_it->capfc[0]);
80  bunch_it->sigfc[2][1] =
81  (bunch_it->prodfc[2][1] / bunch_it->num[2][1]) - (bunch_it->capfc[2] * bunch_it->capfc[1]);
82  bunch_it->sigfc[2][2] =
83  (bunch_it->prodfc[2][2] / bunch_it->num[2][2]) - (bunch_it->capfc[2] * bunch_it->capfc[2]);
84  bunch_it->sigfc[2][3] =
85  (bunch_it->prodfc[2][3] / bunch_it->num[2][3]) - (bunch_it->capfc[2] * bunch_it->capfc[3]);
86  bunch_it->sigfc[3][0] =
87  (bunch_it->prodfc[3][0] / bunch_it->num[3][0]) - (bunch_it->capfc[3] * bunch_it->capfc[0]);
88  bunch_it->sigfc[3][1] =
89  (bunch_it->prodfc[3][1] / bunch_it->num[3][1]) - (bunch_it->capfc[3] * bunch_it->capfc[1]);
90  bunch_it->sigfc[3][2] =
91  (bunch_it->prodfc[3][2] / bunch_it->num[3][2]) - (bunch_it->capfc[3] * bunch_it->capfc[2]);
92  bunch_it->sigfc[3][3] =
93  (bunch_it->prodfc[3][3] / bunch_it->num[3][3]) - (bunch_it->capfc[3] * bunch_it->capfc[3]);
94 
95  for (int i = 0; i != 3; i++) {
96  CASTORMeans->Fill(bunch_it->cap[i]);
97  CASTORWidths->Fill(bunch_it->sig[i][i]);
98  }
99 
100  //if(bunch_it->detid.subdet() == 1){
101 
102  int fillphi = bunch_it->detid.sector();
103  //if (bunch_it->detid.depth()==4) fillphi++;
104 
105  // dephist[bunch_it->detid.module()-1]->Fill(bunch_it->detid.ieta(),fillphi,
106  // (bunch_it->cap[0]+bunch_it->cap[1]+bunch_it->cap[2]+bunch_it->cap[3])/4);
107  dephist->Fill(bunch_it->detid.module(),
108  fillphi,
109  (bunch_it->cap[0] + bunch_it->cap[1] + bunch_it->cap[2] + bunch_it->cap[3]) / 4);
110 
111  const CastorPedestal item(bunch_it->detid,
112  bunch_it->cap[0],
113  bunch_it->cap[1],
114  bunch_it->cap[2],
115  bunch_it->cap[3],
116  bunch_it->sig[0][0],
117  bunch_it->sig[1][1],
118  bunch_it->sig[2][2],
119  bunch_it->sig[3][3]);
120  rawPedsItem->addValues(item);
121  CastorPedestalWidth widthsp(bunch_it->detid);
122  widthsp.setSigma(0, 0, bunch_it->sig[0][0]);
123  widthsp.setSigma(0, 1, bunch_it->sig[0][1]);
124  widthsp.setSigma(0, 2, bunch_it->sig[0][2]);
125  widthsp.setSigma(0, 3, bunch_it->sig[0][3]);
126  widthsp.setSigma(1, 0, bunch_it->sig[1][0]);
127  widthsp.setSigma(1, 1, bunch_it->sig[1][1]);
128  widthsp.setSigma(1, 2, bunch_it->sig[1][2]);
129  widthsp.setSigma(1, 3, bunch_it->sig[1][3]);
130  widthsp.setSigma(2, 0, bunch_it->sig[2][0]);
131  widthsp.setSigma(2, 1, bunch_it->sig[2][1]);
132  widthsp.setSigma(2, 2, bunch_it->sig[2][2]);
133  widthsp.setSigma(2, 3, bunch_it->sig[2][3]);
134  widthsp.setSigma(3, 0, bunch_it->sig[3][0]);
135  widthsp.setSigma(3, 1, bunch_it->sig[3][1]);
136  widthsp.setSigma(3, 2, bunch_it->sig[3][2]);
137  widthsp.setSigma(3, 3, bunch_it->sig[3][3]);
138  rawWidthsItem->addValues(widthsp);
139 
140  const CastorPedestal itemfc(bunch_it->detid,
141  bunch_it->capfc[0],
142  bunch_it->capfc[1],
143  bunch_it->capfc[2],
144  bunch_it->capfc[3],
145  bunch_it->sigfc[0][0],
146  bunch_it->sigfc[1][1],
147  bunch_it->sigfc[2][2],
148  bunch_it->sigfc[3][3]);
149  rawPedsItemfc->addValues(itemfc);
150  CastorPedestalWidth widthspfc(bunch_it->detid);
151  widthspfc.setSigma(0, 0, bunch_it->sigfc[0][0]);
152  widthspfc.setSigma(0, 1, bunch_it->sigfc[0][1]);
153  widthspfc.setSigma(0, 2, bunch_it->sigfc[0][2]);
154  widthspfc.setSigma(0, 3, bunch_it->sigfc[0][3]);
155  widthspfc.setSigma(1, 0, bunch_it->sigfc[1][0]);
156  widthspfc.setSigma(1, 1, bunch_it->sigfc[1][1]);
157  widthspfc.setSigma(1, 2, bunch_it->sigfc[1][2]);
158  widthspfc.setSigma(1, 3, bunch_it->sigfc[1][3]);
159  widthspfc.setSigma(2, 0, bunch_it->sigfc[2][0]);
160  widthspfc.setSigma(2, 1, bunch_it->sigfc[2][1]);
161  widthspfc.setSigma(2, 2, bunch_it->sigfc[2][2]);
162  widthspfc.setSigma(2, 3, bunch_it->sigfc[2][3]);
163  widthspfc.setSigma(3, 0, bunch_it->sigfc[3][0]);
164  widthspfc.setSigma(3, 1, bunch_it->sigfc[3][1]);
165  widthspfc.setSigma(3, 2, bunch_it->sigfc[3][2]);
166  widthspfc.setSigma(3, 3, bunch_it->sigfc[3][3]);
167  rawWidthsItemfc->addValues(widthspfc);
168  }
169  }
170 
171  // dump the resulting list of pedestals into a file
172  std::ofstream outStream1(pedsADCfilename.c_str());
173  CastorDbASCIIIO::dumpObject(outStream1, (*rawPedsItem));
174  std::ofstream outStream2(widthsADCfilename.c_str());
175  CastorDbASCIIIO::dumpObject(outStream2, (*rawWidthsItem));
176 
177  std::ofstream outStream3(pedsfCfilename.c_str());
178  CastorDbASCIIIO::dumpObject(outStream3, (*rawPedsItemfc));
179  std::ofstream outStream4(widthsfCfilename.c_str());
180  CastorDbASCIIIO::dumpObject(outStream4, (*rawWidthsItemfc));
181 
182  if (dumpXML) {
183  std::ofstream outStream5(XMLfilename.c_str());
184  // CastorCondXML::dumpObject (outStream5, runnum, runnum, runnum, XMLtag, 1, (*rawPedsItem), (*rawWidthsItem));
185  }
186 
187  if (hiSaveFlag) {
188  theFile->Write();
189  } else {
190  theFile->cd();
191  theFile->cd("CASTOR");
192  CASTORMeans->Write();
193  CASTORWidths->Write();
194  }
195  theFile->cd();
196  dephist->Write();
197  dephist->SetDrawOption("colz");
198  dephist->GetXaxis()->SetTitle("module");
199  dephist->GetYaxis()->SetTitle("sector");
200 
201  //for (int n=0; n!= 4; n++)
202  //{
203  //dephist[n]->Write();
204  //dephist[n]->SetDrawOption("colz");
205  //dephist[n]->GetXaxis()->SetTitle("i#eta");
206  //dephist[n]->GetYaxis()->SetTitle("i#phi");
207  //}
208 
209  std::stringstream tempstringout;
210  tempstringout << runnum;
211  std::string name1 = tempstringout.str() + "_pedplots_1d.png";
212  std::string name2 = tempstringout.str() + "_pedplots_2d.png";
213 
214  TStyle* theStyle = new TStyle("style", "null");
215  theStyle->SetPalette(1, nullptr);
216  theStyle->SetCanvasDefH(1200); //Height of canvas
217  theStyle->SetCanvasDefW(1600); //Width of canvas
218 
219  gStyle = theStyle;
220  /*
221  TCanvas * c1 = new TCanvas("c1","graph",1);
222  c1->Divide(2,2);
223  c1->cd(1);
224  CASTORMeans->Draw();
225  c1->SaveAs(name1.c_str());
226 
227  theStyle->SetOptStat("n");
228  gStyle = theStyle;
229 
230  TCanvas * c2 = new TCanvas("c2","graph",1);
231  // c2->Divide(2,2);
232  c2->cd(1);
233  dephist->Draw();
234  dephist->SetDrawOption("colz");
235  //c2->cd(2);
236  //dephist[1]->Draw();
237  //dephist[1]->SetDrawOption("colz");
238  //c2->cd(3);
239  //dephist[2]->Draw();
240  //dephist[2]->SetDrawOption("colz");
241  //c2->cd(4);
242  //dephist[3]->Draw();
243  //dephist[3]->SetDrawOption("colz");
244  c2->SaveAs(name2.c_str());
245 */
246  std::cout << "Writing ROOT file... ";
247  theFile->Close();
248  std::cout << "ROOT file closed.\n";
249 }

References CastorCondObjectContainer< Item >::addValues(), Bunches, CASTORMeans, CASTORWidths, gather_cfg::cout, dephist, CastorDbASCIIIO::dumpObject(), dumpXML, hiSaveFlag, mps_fire::i, B2GTnPMonitor_cfi::item, hfnoseParametersInitialization_cfi::name2, pedsADCfilename, pedsfCfilename, runnum, CastorPedestalWidth::setSigma(), AlCaHLTBitMon_QueryRunRegistry::string, theFile, verboseflag, widthsADCfilename, widthsfCfilename, and XMLfilename.

Member Function Documentation

◆ analyze()

void CastorPedestalsAnalysis::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 252 of file CastorPedestalsAnalysis.cc.

252  {
253  using namespace edm;
254  using namespace std;
255 
257  e.getByLabel(castorDigiCollectionTag, castor);
258 
260  iSetup.get<CastorDbRecord>().get(conditions);
261 
262  const CastorQIEShape* shape = conditions->getCastorShape();
263 
264  if (firsttime) {
265  runnum = e.id().run();
266  std::string runnum_string;
267  std::stringstream tempstringout;
268  tempstringout << runnum;
269  runnum_string = tempstringout.str();
270  ROOTfilename = runnum_string + "-peds_ADC.root";
271  pedsADCfilename = runnum_string + "-peds_ADC.txt";
272  pedsfCfilename = runnum_string + "-peds_fC.txt";
273  widthsADCfilename = runnum_string + "-widths_ADC.txt";
274  widthsfCfilename = runnum_string + "-widths_fC.txt";
275  XMLfilename = runnum_string + "-peds_ADC_complete.xml";
276  XMLtag = "Castor_pedestals_" + runnum_string;
277 
278  theFile = new TFile(ROOTfilename.c_str(), "RECREATE");
279  theFile->cd();
280  // Create sub-directories
281  theFile->mkdir("CASTOR");
282  theFile->cd();
283 
284  CASTORMeans = new TH1F("All Ped Means CASTOR", "All Ped Means CASTOR", 100, 0, 9);
285  CASTORWidths = new TH1F("All Ped Widths CASTOR", "All Ped Widths CASTOR", 100, 0, 3);
286 
287  dephist = new TH2F("Pedestals (ADC)", "All Castor", 14, 0., 14.5, 16, .5, 16.5);
288  // dephist[0] = new TH2F("Pedestals (ADC)","Depth 1",89, -44, 44, 72, .5, 72.5);
289  // dephist[1] = new TH2F("Pedestals (ADC)","Depth 2",89, -44, 44, 72, .5, 72.5);
290  // dephist[2] = new TH2F("Pedestals (ADC)","Depth 3",89, -44, 44, 72, .5, 72.5);
291  // dephist[3] = new TH2F("Pedestals (ADC)","Depth 4",89, -44, 44, 72, .5, 72.5);
292 
294  iSetup.get<CastorElectronicsMapRcd>().get(refEMap);
295  const CastorElectronicsMap* myRefEMap = refEMap.product();
296  std::vector<HcalGenericDetId> listEMap = myRefEMap->allPrecisionId();
297  for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); ++it) {
298  HcalGenericDetId mygenid(it->rawId());
299  if (mygenid.isHcalCastorDetId()) {
300  NewPedBunch a;
301  HcalCastorDetId chanid(mygenid.rawId());
302  a.detid = chanid;
303  a.usedflag = false;
304  string type;
305  type = "CASTOR";
306  for (int i = 0; i != 4; i++) {
307  a.cap[i] = 0;
308  a.capfc[i] = 0;
309  for (int j = 0; j != 4; j++) {
310  a.sig[i][j] = 0;
311  a.sigfc[i][j] = 0;
312  a.prod[i][j] = 0;
313  a.prodfc[i][j] = 0;
314  a.num[i][j] = 0;
315  }
316  }
317  Bunches.push_back(a);
318  }
319  }
320  firsttime = false;
321  }
322 
323  std::vector<NewPedBunch>::iterator bunch_it;
324 
325  for (CastorDigiCollection::const_iterator j = castor->begin(); j != castor->end(); ++j) {
326  const CastorDataFrame digi = (const CastorDataFrame)(*j);
327  for (bunch_it = Bunches.begin(); bunch_it != Bunches.end(); ++bunch_it)
328  if (bunch_it->detid.rawId() == digi.id().rawId())
329  break;
330  bunch_it->usedflag = true;
331  for (int ts = firstTS; ts != lastTS + 1; ts++) {
332  const CastorQIECoder* coder = conditions->getCastorCoder(digi.id().rawId());
333  bunch_it->num[digi.sample(ts).capid()][digi.sample(ts).capid()] += 1;
334  bunch_it->cap[digi.sample(ts).capid()] += digi.sample(ts).adc();
335  double charge1 = coder->charge(*shape, digi.sample(ts).adc(), digi.sample(ts).capid());
336  bunch_it->capfc[digi.sample(ts).capid()] += charge1;
337  bunch_it->prod[digi.sample(ts).capid()][digi.sample(ts).capid()] +=
338  (digi.sample(ts).adc() * digi.sample(ts).adc());
339  bunch_it->prodfc[digi.sample(ts).capid()][digi.sample(ts).capid()] += charge1 * charge1;
340  if ((ts + 1 < digi.size()) && (ts + 1 < lastTS)) {
341  bunch_it->prod[digi.sample(ts).capid()][digi.sample(ts + 1).capid()] +=
342  digi.sample(ts).adc() * digi.sample(ts + 1).adc();
343  double charge2 = coder->charge(*shape, digi.sample(ts + 1).adc(), digi.sample(ts + 1).capid());
344  bunch_it->prodfc[digi.sample(ts).capid()][digi.sample(ts + 1).capid()] += charge1 * charge2;
345  bunch_it->num[digi.sample(ts).capid()][digi.sample(ts + 1).capid()] += 1;
346  }
347  if ((ts + 2 < digi.size()) && (ts + 2 < lastTS)) {
348  bunch_it->prod[digi.sample(ts).capid()][digi.sample(ts + 2).capid()] +=
349  digi.sample(ts).adc() * digi.sample(ts + 2).adc();
350  double charge2 = coder->charge(*shape, digi.sample(ts + 2).adc(), digi.sample(ts + 2).capid());
351  bunch_it->prodfc[digi.sample(ts).capid()][digi.sample(ts + 2).capid()] += charge1 * charge2;
352  bunch_it->num[digi.sample(ts).capid()][digi.sample(ts + 2).capid()] += 1;
353  }
354  if ((ts + 3 < digi.size()) && (ts + 3 < lastTS)) {
355  bunch_it->prod[digi.sample(ts).capid()][digi.sample(ts + 3).capid()] +=
356  digi.sample(ts).adc() * digi.sample(ts + 3).adc();
357  double charge2 = coder->charge(*shape, digi.sample(ts + 3).adc(), digi.sample(ts + 3).capid());
358  bunch_it->prodfc[digi.sample(ts).capid()][digi.sample(ts + 3).capid()] += charge1 * charge2;
359  bunch_it->num[digi.sample(ts).capid()][digi.sample(ts + 3).capid()] += 1;
360  }
361  }
362  }
363 
364  //this is the last brace
365 }

References a, HcalQIESample::adc(), CastorElectronicsMap::allPrecisionId(), Bunches, HcalQIESample::capid(), castorDigitizer_cfi::castor, castorDigiCollectionTag, CASTORMeans, CASTORWidths, CastorQIECoder::charge(), dephist, MillePedeFileConverter_cfg::e, firsttime, firstTS, edm::EventSetup::get(), get, CastorDbService::getCastorCoder(), CastorDbService::getCastorShape(), mps_fire::i, CastorDataFrame::id(), dqmiolumiharvest::j, lastTS, pedsADCfilename, pedsfCfilename, edm::ESHandle< T >::product(), DetId::rawId(), ROOTfilename, runnum, CastorDataFrame::sample(), CastorDataFrame::size(), AlCaHLTBitMon_QueryRunRegistry::string, theFile, widthsADCfilename, widthsfCfilename, XMLfilename, and XMLtag.

Member Data Documentation

◆ Bunches

std::vector<NewPedBunch> CastorPedestalsAnalysis::Bunches
private

Definition at line 83 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and ~CastorPedestalsAnalysis().

◆ castorDigiCollectionTag

edm::InputTag CastorPedestalsAnalysis::castorDigiCollectionTag
private

Definition at line 109 of file CastorPedestalsAnalysis.h.

Referenced by analyze().

◆ CASTORMeans

TH1F* CastorPedestalsAnalysis::CASTORMeans
private

Definition at line 100 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and ~CastorPedestalsAnalysis().

◆ CASTORWidths

TH1F* CastorPedestalsAnalysis::CASTORWidths
private

Definition at line 101 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and ~CastorPedestalsAnalysis().

◆ dephist

TH2F* CastorPedestalsAnalysis::dephist
private

Definition at line 104 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and ~CastorPedestalsAnalysis().

◆ dumpXML

bool CastorPedestalsAnalysis::dumpXML
private

Definition at line 86 of file CastorPedestalsAnalysis.h.

Referenced by CastorPedestalsAnalysis(), and ~CastorPedestalsAnalysis().

◆ firsttime

bool CastorPedestalsAnalysis::firsttime
private

Definition at line 107 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and CastorPedestalsAnalysis().

◆ firstTS

int CastorPedestalsAnalysis::firstTS
private

Definition at line 89 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and CastorPedestalsAnalysis().

◆ hiSaveFlag

bool CastorPedestalsAnalysis::hiSaveFlag
private

Definition at line 85 of file CastorPedestalsAnalysis.h.

Referenced by CastorPedestalsAnalysis(), and ~CastorPedestalsAnalysis().

◆ lastTS

int CastorPedestalsAnalysis::lastTS
private

Definition at line 90 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and CastorPedestalsAnalysis().

◆ pedsADCfilename

std::string CastorPedestalsAnalysis::pedsADCfilename
private

Definition at line 92 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and ~CastorPedestalsAnalysis().

◆ pedsfCfilename

std::string CastorPedestalsAnalysis::pedsfCfilename
private

Definition at line 93 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and ~CastorPedestalsAnalysis().

◆ ROOTfilename

std::string CastorPedestalsAnalysis::ROOTfilename
private

Definition at line 91 of file CastorPedestalsAnalysis.h.

Referenced by analyze().

◆ runnum

int CastorPedestalsAnalysis::runnum
private

Definition at line 88 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and ~CastorPedestalsAnalysis().

◆ theFile

TFile* CastorPedestalsAnalysis::theFile
private

Definition at line 106 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and ~CastorPedestalsAnalysis().

◆ verboseflag

bool CastorPedestalsAnalysis::verboseflag
private

Definition at line 87 of file CastorPedestalsAnalysis.h.

Referenced by CastorPedestalsAnalysis(), and ~CastorPedestalsAnalysis().

◆ widthsADCfilename

std::string CastorPedestalsAnalysis::widthsADCfilename
private

Definition at line 94 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and ~CastorPedestalsAnalysis().

◆ widthsfCfilename

std::string CastorPedestalsAnalysis::widthsfCfilename
private

Definition at line 95 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and ~CastorPedestalsAnalysis().

◆ XMLfilename

std::string CastorPedestalsAnalysis::XMLfilename
private

Definition at line 96 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and ~CastorPedestalsAnalysis().

◆ XMLtag

std::string CastorPedestalsAnalysis::XMLtag
private

Definition at line 97 of file CastorPedestalsAnalysis.h.

Referenced by analyze().

◆ ZSfilename

std::string CastorPedestalsAnalysis::ZSfilename
private

Definition at line 98 of file CastorPedestalsAnalysis.h.

CastorPedestalsAnalysis::Bunches
std::vector< NewPedBunch > Bunches
Definition: CastorPedestalsAnalysis.h:83
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
CastorPedestalsAnalysis::runnum
int runnum
Definition: CastorPedestalsAnalysis.h:88
CastorPedestalsAnalysis::hiSaveFlag
bool hiSaveFlag
Definition: CastorPedestalsAnalysis.h:85
CastorPedestalsAnalysis::dumpXML
bool dumpXML
Definition: CastorPedestalsAnalysis.h:86
mps_fire.i
i
Definition: mps_fire.py:355
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
HcalGenericDetId
Definition: HcalGenericDetId.h:15
CastorPedestalsAnalysis::firsttime
bool firsttime
Definition: CastorPedestalsAnalysis.h:107
CastorPedestalsAnalysis::dephist
TH2F * dephist
Definition: CastorPedestalsAnalysis.h:104
HcalQIESample::adc
constexpr int adc() const
get the ADC sample
Definition: HcalQIESample.h:43
edm
HLT enums.
Definition: AlignableModifier.h:19
CastorPedestalsAnalysis::XMLtag
std::string XMLtag
Definition: CastorPedestalsAnalysis.h:97
gather_cfg.cout
cout
Definition: gather_cfg.py:144
CastorDbService::getCastorCoder
const CastorQIECoder * getCastorCoder(const HcalGenericDetId &fId) const
Definition: CastorDbService.cc:169
CastorPedestalsAnalysis::widthsfCfilename
std::string widthsfCfilename
Definition: CastorPedestalsAnalysis.h:95
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
CastorDataFrame::id
const HcalCastorDetId & id() const
Definition: CastorDataFrame.h:22
CastorPedestal
Definition: CastorPedestal.h:16
CastorPedestalWidth
Definition: CastorPedestalWidth.h:16
edm::Handle
Definition: AssociativeIterator.h:50
CastorPedestalsAnalysis::CASTORMeans
TH1F * CASTORMeans
Definition: CastorPedestalsAnalysis.h:100
CastorPedestalsAnalysis::lastTS
int lastTS
Definition: CastorPedestalsAnalysis.h:90
CastorPedestalsAnalysis::castorDigiCollectionTag
edm::InputTag castorDigiCollectionTag
Definition: CastorPedestalsAnalysis.h:109
CastorPedestalsAnalysis::ROOTfilename
std::string ROOTfilename
Definition: CastorPedestalsAnalysis.h:91
edm::ESHandle
Definition: DTSurvey.h:22
CastorPedestals
Definition: CastorPedestals.h:18
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalCastorDetId
Definition: HcalCastorDetId.h:23
CastorDataFrame::sample
const HcalQIESample & sample(int i) const
access a sample
Definition: CastorDataFrame.h:39
CastorDbService::getCastorShape
const CastorQIEShape * getCastorShape() const
Definition: CastorDbService.cc:176
CastorDataFrame
Definition: CastorDataFrame.h:15
CastorDbASCIIIO::dumpObject
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
Definition: CastorDbASCIIIO.cc:323
CastorDataFrame::size
int size() const
total number of samples in the digi
Definition: CastorDataFrame.h:26
a
double a
Definition: hdecay.h:119
CastorQIECoder::charge
float charge(const CastorQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.
Definition: CastorQIECoder.cc:17
CastorPedestalsAnalysis::XMLfilename
std::string XMLfilename
Definition: CastorPedestalsAnalysis.h:96
CastorPedestalsAnalysis::verboseflag
bool verboseflag
Definition: CastorPedestalsAnalysis.h:87
CastorCondObjectContainer::addValues
bool addValues(const Item &myItem)
Definition: CastorCondObjectContainer.h:98
CastorPedestalsAnalysis::widthsADCfilename
std::string widthsADCfilename
Definition: CastorPedestalsAnalysis.h:94
HcalQIESample::capid
constexpr int capid() const
get the Capacitor id
Definition: HcalQIESample.h:47
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
get
#define get
CastorPedestalsAnalysis::CASTORWidths
TH1F * CASTORWidths
Definition: CastorPedestalsAnalysis.h:101
CastorPedestalsAnalysis::pedsfCfilename
std::string pedsfCfilename
Definition: CastorPedestalsAnalysis.h:93
CastorDbRecord
Definition: CastorDbRecord.h:29
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
type
type
Definition: HCALResponse.h:21
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
CastorPedestalsAnalysis::pedsADCfilename
std::string pedsADCfilename
Definition: CastorPedestalsAnalysis.h:92
CastorPedestalsAnalysis::theFile
TFile * theFile
Definition: CastorPedestalsAnalysis.h:106
CastorElectronicsMapRcd
Definition: CastorElectronicsMapRcd.h:4
CastorPedestalWidths
Definition: CastorPedestalWidths.h:18
CastorQIECoder
Definition: CastorQIECoder.h:21
CastorElectronicsMap
Definition: CastorElectronicsMap.h:30
CastorPedestalsAnalysis::firstTS
int firstTS
Definition: CastorPedestalsAnalysis.h:89
NewPedBunch
Definition: CastorPedestalsAnalysis.h:60
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
CastorElectronicsMap::allPrecisionId
std::vector< HcalGenericDetId > allPrecisionId() const
Definition: CastorElectronicsMap.cc:178
hfnoseParametersInitialization_cfi.name2
name2
Definition: hfnoseParametersInitialization_cfi.py:8
edm::InputTag
Definition: InputTag.h:15
CastorQIEShape
Definition: CastorQIEShape.h:14
castorDigitizer_cfi.castor
castor
Definition: castorDigitizer_cfi.py:9
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37