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)
 
 CastorPedestalsAnalysis (const edm::ParameterSet &ps)
 
virtual ~CastorPedestalsAnalysis ()
 
- 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 ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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 &)
 
- 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 73 of file CastorPedestalsAnalysis.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file CastorPedestalsAnalysis.cc.

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

11  :
12  castorDigiCollectionTag(ps.getParameter<edm::InputTag>("castorDigiCollectionTag"))
13 {
14  hiSaveFlag = ps.getUntrackedParameter<bool>("hiSaveFlag", false);
15  dumpXML = ps.getUntrackedParameter<bool>("dumpXML", false);
16  verboseflag = ps.getUntrackedParameter<bool>("verbose", false);
17  firstTS = ps.getUntrackedParameter<int>("firstTS", 0);
18  lastTS = ps.getUntrackedParameter<int>("lastTS", 9);
19  firsttime = true;
20 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
CastorPedestalsAnalysis::~CastorPedestalsAnalysis ( )
virtual

Definition at line 23 of file CastorPedestalsAnalysis.cc.

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

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

Member Function Documentation

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

Definition at line 231 of file CastorPedestalsAnalysis.cc.

References a, HcalQIESample::adc(), CastorElectronicsMap::allPrecisionId(), edm::SortedCollection< T, SORT >::begin(), Bunches, NewPedBunch::cap, NewPedBunch::capfc, HcalQIESample::capid(), castorDigitizer_cfi::castor, castorDigiCollectionTag, CASTORMeans, CASTORWidths, CastorQIECoder::charge(), DEFINE_FWK_MODULE, dephist, NewPedBunch::detid, edm::SortedCollection< T, SORT >::end(), firsttime, firstTS, edm::EventSetup::get(), edm::Event::getByLabel(), CastorDbService::getCastorCoder(), CastorDbService::getCastorShape(), mps_fire::i, CastorDataFrame::id(), edm::EventBase::id(), lastTS, NewPedBunch::num, pedsADCfilename, pedsfCfilename, NewPedBunch::prod, NewPedBunch::prodfc, edm::ESHandle< T >::product(), DetId::rawId(), ROOTfilename, edm::EventID::run(), runnum, CastorDataFrame::sample(), NewPedBunch::sig, NewPedBunch::sigfc, CastorDataFrame::size(), AlCaHLTBitMon_QueryRunRegistry::string, theFile, NewPedBunch::usedflag, widthsADCfilename, widthsfCfilename, XMLfilename, and XMLtag.

232 {
233  using namespace edm;
234  using namespace std;
235 
237  e.getByLabel(castorDigiCollectionTag, castor);
238 
240  iSetup.get<CastorDbRecord>().get(conditions);
241 
242  const CastorQIEShape* shape = conditions->getCastorShape();
243 
244  if(firsttime)
245  {
246  runnum = e.id().run();
247  std::string runnum_string;
248  std::stringstream tempstringout;
249  tempstringout << runnum;
250  runnum_string = tempstringout.str();
251  ROOTfilename = runnum_string + "-peds_ADC.root";
252  pedsADCfilename = runnum_string + "-peds_ADC.txt";
253  pedsfCfilename = runnum_string + "-peds_fC.txt";
254  widthsADCfilename = runnum_string + "-widths_ADC.txt";
255  widthsfCfilename = runnum_string + "-widths_fC.txt";
256  XMLfilename = runnum_string + "-peds_ADC_complete.xml";
257  XMLtag = "Castor_pedestals_" + runnum_string;
258 
259  theFile = new TFile(ROOTfilename.c_str(), "RECREATE");
260  theFile->cd();
261  // Create sub-directories
262  theFile->mkdir("CASTOR");
263  theFile->cd();
264 
265  CASTORMeans = new TH1F("All Ped Means CASTOR","All Ped Means CASTOR", 100, 0, 9);
266  CASTORWidths = new TH1F("All Ped Widths CASTOR","All Ped Widths CASTOR", 100, 0, 3);
267 
268  dephist = new TH2F("Pedestals (ADC)","All Castor",14, 0., 14.5, 16, .5, 16.5);
269  // dephist[0] = new TH2F("Pedestals (ADC)","Depth 1",89, -44, 44, 72, .5, 72.5);
270  // dephist[1] = new TH2F("Pedestals (ADC)","Depth 2",89, -44, 44, 72, .5, 72.5);
271  // dephist[2] = new TH2F("Pedestals (ADC)","Depth 3",89, -44, 44, 72, .5, 72.5);
272  // dephist[3] = new TH2F("Pedestals (ADC)","Depth 4",89, -44, 44, 72, .5, 72.5);
273 
275  iSetup.get<CastorElectronicsMapRcd>().get(refEMap);
276  const CastorElectronicsMap* myRefEMap = refEMap.product();
277  std::vector<HcalGenericDetId> listEMap = myRefEMap->allPrecisionId();
278  for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); ++it)
279  {
280  HcalGenericDetId mygenid(it->rawId());
281  if(mygenid.isHcalCastorDetId())
282  {
283  NewPedBunch a;
284  HcalCastorDetId chanid(mygenid.rawId());
285  a.detid = chanid;
286  a.usedflag = false;
287  string type;
288  type = "CASTOR";
289  for(int i = 0; i != 4; i++)
290  {
291  a.cap[i] = 0;
292  a.capfc[i] = 0;
293  for(int j = 0; j != 4; j++)
294  {
295  a.sig[i][j] = 0;
296  a.sigfc[i][j] = 0;
297  a.prod[i][j] = 0;
298  a.prodfc[i][j] = 0;
299  a.num[i][j] = 0;
300  }
301  }
302  Bunches.push_back(a);
303  }
304  }
305  firsttime = false;
306  }
307 
308  std::vector<NewPedBunch>::iterator bunch_it;
309 
310  for(CastorDigiCollection::const_iterator j = castor->begin(); j != castor->end(); ++j)
311  {
312  const CastorDataFrame digi = (const CastorDataFrame)(*j);
313  for(bunch_it = Bunches.begin(); bunch_it != Bunches.end(); ++bunch_it)
314  if(bunch_it->detid.rawId() == digi.id().rawId()) break;
315  bunch_it->usedflag = true;
316  for(int ts = firstTS; ts != lastTS+1; ts++)
317  {
318  const CastorQIECoder* coder = conditions->getCastorCoder(digi.id().rawId());
319  bunch_it->num[digi.sample(ts).capid()][digi.sample(ts).capid()] += 1;
320  bunch_it->cap[digi.sample(ts).capid()] += digi.sample(ts).adc();
321  double charge1 = coder->charge(*shape, digi.sample(ts).adc(), digi.sample(ts).capid());
322  bunch_it->capfc[digi.sample(ts).capid()] += charge1;
323  bunch_it->prod[digi.sample(ts).capid()][digi.sample(ts).capid()] += (digi.sample(ts).adc() * digi.sample(ts).adc());
324  bunch_it->prodfc[digi.sample(ts).capid()][digi.sample(ts).capid()] += charge1 * charge1;
325  if((ts+1 < digi.size()) && (ts+1 < lastTS)){
326  bunch_it->prod[digi.sample(ts).capid()][digi.sample(ts+1).capid()] += digi.sample(ts).adc()*digi.sample(ts+1).adc();
327  double charge2 = coder->charge(*shape, digi.sample(ts+1).adc(), digi.sample(ts+1).capid());
328  bunch_it->prodfc[digi.sample(ts).capid()][digi.sample(ts+1).capid()] += charge1*charge2;
329  bunch_it->num[digi.sample(ts).capid()][digi.sample(ts+1).capid()] += 1;
330  }
331  if((ts+2 < digi.size()) && (ts+2 < lastTS)){
332  bunch_it->prod[digi.sample(ts).capid()][digi.sample(ts+2).capid()] += digi.sample(ts).adc()*digi.sample(ts+2).adc();
333  double charge2 = coder->charge(*shape, digi.sample(ts+2).adc(), digi.sample(ts+2).capid());
334  bunch_it->prodfc[digi.sample(ts).capid()][digi.sample(ts+2).capid()] += charge1*charge2;
335  bunch_it->num[digi.sample(ts).capid()][digi.sample(ts+2).capid()] += 1;
336  }
337  if((ts+3 < digi.size()) && (ts+3 < lastTS)){
338  bunch_it->prod[digi.sample(ts).capid()][digi.sample(ts+3).capid()] += digi.sample(ts).adc()*digi.sample(ts+3).adc();
339  double charge2 = coder->charge(*shape, digi.sample(ts+3).adc(), digi.sample(ts+3).capid());
340  bunch_it->prodfc[digi.sample(ts).capid()][digi.sample(ts+3).capid()] += charge1*charge2;
341  bunch_it->num[digi.sample(ts).capid()][digi.sample(ts+3).capid()] += 1;
342  }
343  }
344  }
345 
346 
347 //this is the last brace
348 }
type
Definition: HCALResponse.h:21
std::vector< NewPedBunch > Bunches
int adc() const
get the ADC sample
Definition: HcalQIESample.h:22
const HcalQIESample & sample(int i) const
access a sample
std::vector< CastorDataFrame >::const_iterator const_iterator
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const CastorQIEShape * getCastorShape() const
float charge(const CastorQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.
HcalCastorDetId detid
const_iterator end() const
std::vector< HcalGenericDetId > allPrecisionId() const
int capid() const
get the Capacitor id
Definition: HcalQIESample.h:26
HLT enums.
double a
Definition: hdecay.h:121
const HcalCastorDetId & id() const
int size() const
total number of samples in the digi
T const * product() const
Definition: ESHandle.h:86
const_iterator begin() const
const CastorQIECoder * getCastorCoder(const HcalGenericDetId &fId) const

Member Data Documentation

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

Definition at line 85 of file CastorPedestalsAnalysis.h.

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

edm::InputTag CastorPedestalsAnalysis::castorDigiCollectionTag
private

Definition at line 111 of file CastorPedestalsAnalysis.h.

Referenced by analyze().

TH1F* CastorPedestalsAnalysis::CASTORMeans
private

Definition at line 102 of file CastorPedestalsAnalysis.h.

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

TH1F* CastorPedestalsAnalysis::CASTORWidths
private

Definition at line 103 of file CastorPedestalsAnalysis.h.

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

TH2F* CastorPedestalsAnalysis::dephist
private

Definition at line 106 of file CastorPedestalsAnalysis.h.

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

bool CastorPedestalsAnalysis::dumpXML
private

Definition at line 88 of file CastorPedestalsAnalysis.h.

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

bool CastorPedestalsAnalysis::firsttime
private

Definition at line 109 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and CastorPedestalsAnalysis().

int CastorPedestalsAnalysis::firstTS
private

Definition at line 91 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and CastorPedestalsAnalysis().

bool CastorPedestalsAnalysis::hiSaveFlag
private

Definition at line 87 of file CastorPedestalsAnalysis.h.

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

int CastorPedestalsAnalysis::lastTS
private

Definition at line 92 of file CastorPedestalsAnalysis.h.

Referenced by analyze(), and CastorPedestalsAnalysis().

std::string CastorPedestalsAnalysis::pedsADCfilename
private

Definition at line 94 of file CastorPedestalsAnalysis.h.

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

std::string CastorPedestalsAnalysis::pedsfCfilename
private

Definition at line 95 of file CastorPedestalsAnalysis.h.

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

std::string CastorPedestalsAnalysis::ROOTfilename
private

Definition at line 93 of file CastorPedestalsAnalysis.h.

Referenced by analyze().

int CastorPedestalsAnalysis::runnum
private

Definition at line 90 of file CastorPedestalsAnalysis.h.

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

TFile* CastorPedestalsAnalysis::theFile
private

Definition at line 108 of file CastorPedestalsAnalysis.h.

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

bool CastorPedestalsAnalysis::verboseflag
private

Definition at line 89 of file CastorPedestalsAnalysis.h.

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

std::string CastorPedestalsAnalysis::widthsADCfilename
private

Definition at line 96 of file CastorPedestalsAnalysis.h.

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

std::string CastorPedestalsAnalysis::widthsfCfilename
private

Definition at line 97 of file CastorPedestalsAnalysis.h.

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

std::string CastorPedestalsAnalysis::XMLfilename
private

Definition at line 98 of file CastorPedestalsAnalysis.h.

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

std::string CastorPedestalsAnalysis::XMLtag
private

Definition at line 99 of file CastorPedestalsAnalysis.h.

Referenced by analyze().

std::string CastorPedestalsAnalysis::ZSfilename
private

Definition at line 100 of file CastorPedestalsAnalysis.h.